-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathstartMonitor
More file actions
executable file
·90 lines (79 loc) · 3.21 KB
/
startMonitor
File metadata and controls
executable file
·90 lines (79 loc) · 3.21 KB
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
#!/bin/bash
usage() {
echo "Usage:"
echo "runPedestal <required arguments> [optional arguments]"
echo
echo
echo "required arguments"
echo " -i, --fileInfo= : wildcard of input files in single quotes."
echo " Can obtain the number of time bins separated by a ':'"
echo " e.g. 'cru*.raw:1000' for 1000 time bins"
echo " the time bin option after the ':' overwrites the --timeBins option"
echo
echo "optional arguments:"
echo " -p, --pedestalFile= : pedestal file"
echo " -f, --fistTimeBin= : first time bin for pulser search"
echo " -l, --lastTimeBin= : last time bin for pulser search"
echo " -t, --timeBins= : number of time bins to process (default: $timeBins)"
echo " -v, --verbosity= : set verbosity level"
echo " -d, --debugLevel= : set debug level"
echo " -s, --sector= : select specific sector (default 0)"
echo " -o, --overview : show readout side overview"
echo " -h, --help : show this help message"
}
usageAndExit() {
usage
if [[ "$0" =~ startMonitor ]]; then
exit 0
else
return 0
fi
}
# ===| default variable values |================================================
fileInfo=
pedestalFile=
firstTimeBin=0
lastTimeBin=512
timeBins=512
verbosity=0
debugLevel=0
selectedSector=0
showOverview=0
# ===| parse command line options |=============================================
OPTIONS=$(getopt -l "fileInfo:,pedestalFile:,firstTimeBin:,lastTimeBin:,timeBins:,verbosity:,debugLevel:,sector:,overview,help" -o "i:p:f:l:t:v:d:s:oh" -n "startMonitor" -- "$@")
if [ $? != 0 ] ; then
usageAndExit
fi
eval set -- "$OPTIONS"
while true; do
case "$1" in
--) shift; break;;
-i|--fileInfo) fileInfo=$2; shift 2;;
-p|--pedestalFile) pedestalFile=$2; shift 2;;
-f|--firstTimeBin) firstTimeBin=$2; shift 2;;
-l|--lastTimeBin) lastTimeBin=$2; shift 2;;
-t|--timeBins) timeBins=$2; shift 2;;
-v|--verbosity) verbosity=$2; shift 2;;
-d|--debugLevel) debugLevel=$2; shift 2;;
-s|--sector) selectedSector=$2; shift 2;;
-o|--overview) showOverview=1; shift;;
-h|--help) usageAndExit;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
# ===| check for required arguments |===========================================
if [[ -z "$fileInfo" ]]; then
usageAndExit
fi
# ===| check time bin info |====================================================
if [[ $fileInfo =~ : ]]; then
timeBins=${fileInfo#*:}
timeBins=${timeBins%%:*}
else
fileInfo=${fileInfo}:${timeBins}
fi
# ===| command building and execution |=========================================
#cmd="valgrind --log-file=valgrind.log root.exe -l $O2_SRC/Detectors/TPC/reconstruction/macro/addInclude.C $O2_SRC/Detectors/TPC/monitor/macro/RunSimpleEventDisplay.C+g'(\"$fileInfo\",\"$pedestalFile\",$timeBins,$verbosity,$debugLevel,$selectedSector,$showOverview)'"
cmd="root.exe -l $O2_SRC/Detectors/TPC/reconstruction/macro/addInclude.C $O2_SRC/Detectors/TPC/monitor/macro/RunSimpleEventDisplay.C+g'(\"$fileInfo\", \"$pedestalFile\", $firstTimeBin, $lastTimeBin, $timeBins, $verbosity, $debugLevel, $selectedSector, $showOverview)'"
echo "running: $cmd"
eval $cmd