Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
function print_the_help {
echo "USAGE: monitor_singles [-r run_number] [-n nevents]"
echo "OPTIONS: "
echo " -I,--no-update Don't update run info or charge goals. Also set when count goal = 0."
echo " -r,--run run number [default: most current run]"
echo " -m,--mode DAQ mode, ['coin' (default), 'shms', 'hms']"
echo " -n,--nevents Number of events to replay. [default: -1 (full replay)]"
echo " -h,--help print help"
echo " "
echo " This script will do the following: "
echo " 1. Replay the data using the latest run and 100k events if not specified. "
echo " 2. Run the good event counters"
echo " 4. Fill a json database with useful run information."
echo " db2/run_list.json (read only)"
echo " db2/run_hms_count_list.json"
echo " db2/run_shms_count_list.json"
echo " "
echo "EXAMPLES:"
echo " "
echo "process a full run in coin mode (default) "
echo " $ do_good_coin -n -1 -r 1234 "
echo " "
echo "CONTACT: Sylvester Joosten (sjjooste@jlab.org) 217-848-0565"
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
daq_mode='coin'
num_events=-1
run_number=$(latest_run -t shms)
update_run_info=0
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-r|--run)
run_number="$2"
shift # past argument
shift # past value
;;
-n|--nevents)
num_events="$2"
shift # past argument
shift # past value
;;
-m|--mode)
daq_mode="$2"
shift # past argument
shift # past value
;;
-I|--no-update)
update_run_info=0
shift # past argument
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
pushd $CURRENT_REPLAY_DIR
if [ "$daq_mode" != "shms" ]; then
root -b -q "scripts/good_hms_counter.cxx+(${run_number}, ${num_events}, \"${daq_mode}\")"
fi
if [ "$daq_mode" != "hms" ]; then
root -b -q "scripts/good_shms_counter.cxx+(${run_number}, ${num_events}, \"${daq_mode}\")"