-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunSourceAnalysis.sh
executable file
·131 lines (111 loc) · 4.04 KB
/
runSourceAnalysis.sh
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
PARSED_OPTIONS=$(getopt -n "$0" -o i:p:lvwb --long "input:led:long,view,web,baseline,fromHistos" -- "$@")
#Bad arguments, something has gone wrong with the getopt command.
if [ $? -ne 0 ];
then
echo "Usage: $0 -i input"
exit 1
fi
eval set -- "$PARSED_OPTIONS"
inputFile=""
ledFile=""
long=0
fromHistos=0
view=0
web=0
baseline=0
while true;
do
case "$1" in
-i|--input)
if [ -n "$2" ];
then
inputFile=$2
echo "Running fit on ${inputFile}"
fi
shift 2;;
-p|--led)
if [ -n "$2" ];
then
ledFile=$2
echo "Ledrun ${ledFile}"
fi
shift 2;;
-l|--long)
long=1
echo "LongRun analysis"
shift;;
-v|--view)
view=1
echo "View analysis results"
shift;;
-w|--web)
web=1
echo "Transfer to web server"
shift;;
-b|--baseline)
baseline=1
echo "Analysis baseline"
shift;;
--fromHistos)
fromHistos=1
echo "Running from histograms"
shift;;
--)
shift
break;;
esac
done
if [ "$inputFile" == "" ];
then
echo "Usage: $0 -i inputFile. Please check your inputs"
exit 1
fi
if [ "$ledFile" == "" ];
then
echo "Usage: $0 -p ledFile. Please check your inputs"
exit 1
fi
source ~/H4AnalysisEnv.sh
mkdir -p SourceAnalysis
if [ $long -eq 1 ]; then
if [ $fromHistos -eq 0 ]; then
python fitSource.py --input=/data/cmsdaq/source/ntuples/h4Reco_$inputFile.root --output=SourceAnalysis --led=SinglePEAnalysis/${ledFile}_simul_out.root --longRun
else
if [ ! -f "/data/cmsdaq/source/histos/histos_${inputFile}.root" ]; then
python makeHisto.py --input=/data/cmsdaq/source/ntuples/h4Reco_${inputFile}.root --output=/data/cmsdaq/source/histos/histos_${inputFile}.root --inputEnvData=/data/cmsdaq/slowControl/temperatures --runType=source --longRun
fi
python fitSource.py --input=/data/cmsdaq/source/histos/histos_$inputFile.root --output=SourceAnalysis --led=SinglePEAnalysis/${ledFile}_simul_out.root --fromHistos --longRun
fi
else
if [ $fromHistos -eq 0 ]; then
python fitSource.py --input=/data/cmsdaq/source/ntuples/h4Reco_$inputFile.root --output=SourceAnalysis --led=SinglePEAnalysis/${ledFile}_simul_out.root
else
if [ ! -f "/data/cmsdaq/source/histos/histos_${inputFile}.root" ]; then
python makeHisto.py --input=/data/cmsdaq/source/ntuples/h4Reco_${inputFile}.root --output=/data/cmsdaq/source/histos/histos_${inputFile}.root --inputEnvData=/data/cmsdaq/slowControl/temperatures --runType=source
fi
python fitSource.py --input=/data/cmsdaq/source/histos/histos_$inputFile.root --output=SourceAnalysis --led=SinglePEAnalysis/${ledFile}_simul_out.root --fromHistos
fi
fi
python fitWaveform.py --input=/data/cmsdaq/source/ntuples/h4Reco_${inputFile}.root --output=SourceAnalysis
if [ $baseline -eq 1 ]; then
python AnalisysBaseline.py --input=/data/cmsdaq/source/ntuples/h4Reco_${inputFile}.root --output=SourceAnalysis
fi
if [ $view -eq 1 ]; then
for file in SourceAnalysis/chargeFit*${inputFile}*.png SourceAnalysis/fitWaveform*${inputFile}*.png SourceAnalysis/baselineRMS*${inputFile}*.png; do
display $file > /dev/null 2>&1 &
done
fi
if [ $web -eq 1 ]; then
mkdir -p /data/cmsdaq/www/process/${inputFile}
cp -v /data/cmsdaq/www/process/index.php /data/cmsdaq/www/process/${inputFile}/index.php
for file in SourceAnalysis/chargeFit*${inputFile}*.png SourceAnalysis/fitWaveform*${inputFile}*.png SourceAnalysis/baselineRMS*${inputFile}*.png; do
cp -v $file /data/cmsdaq/www/process/${inputFile}/
done
for file in SourceAnalysis/chargeFit*${inputFile}*.pdf SourceAnalysis/fitWaveform*${inputFile}*.pdf SourceAnalysis/baselineRMS*${inputFile}*.png; do
cp -v $file /data/cmsdaq/www/process/${inputFile}/
done
. /home/cmsdaq/mattermost.ini
python summary.py --input=${inputFile} --output=SourceAnalysis
# curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "#### SOURCE Run analysed '${inputFile}' :tada:\n Results available at http://10.0.0.44/process/'${inputFile}'\n", "username": "pmt-bench"}' ${WEB_HOOK}
fi