1 |
fantasia |
1.2 |
#!/bin/bash
|
2 |
|
|
#Usage ./certifyRuns.sh runList TriggerList firstFitRun lastFitRun fitFile fitRootFile JSONFile
|
3 |
fantasia |
1.1 |
|
4 |
fantasia |
1.2 |
runList=runList.txt
|
5 |
fantasia |
1.4 |
TriggerList=monitorlist_Sept_Core_2012.list
|
6 |
fantasia |
1.5 |
firstFitRun=202305
|
7 |
|
|
lastFitRun=203002
|
8 |
|
|
fitFile=Fits/2012/Fit_HLT_NoV_10LS_Run${firstFitRun}to${lastFitRun}.pkl #Contains fit parameters to make predictions
|
9 |
|
|
fitRootFile=HLT_10LS_delivered_vs_rate_Run${firstFitRun}-${lastFitRun}.root #Contains fit curves to look at
|
10 |
|
|
JSONFile=Cert_190456-202305_8TeV_PromptReco_Collisions12_JSON.txt #Latest golden json to be use in making fit file
|
11 |
fantasia |
1.2 |
|
12 |
|
|
if [ $# -ge 1 ]; then
|
13 |
|
|
runList=${1}
|
14 |
|
|
fi
|
15 |
|
|
if [ $# -ge 2 ]; then
|
16 |
|
|
TriggerList=${2}
|
17 |
|
|
fi
|
18 |
|
|
if [ $# -ge 3 ]; then
|
19 |
|
|
firstFitRun=${3}
|
20 |
|
|
fi
|
21 |
|
|
if [ $# -ge 4 ]; then
|
22 |
|
|
lastFitRun=${4}
|
23 |
|
|
fi
|
24 |
|
|
if [ $# -ge 5 ]; then
|
25 |
|
|
fitFile=${5}
|
26 |
|
|
fi
|
27 |
|
|
if [ $# -ge 6 ]; then
|
28 |
|
|
fitRootFile=${6}
|
29 |
|
|
fi
|
30 |
|
|
if [ $# -ge 7 ]; then
|
31 |
|
|
JSONFile=${7}
|
32 |
|
|
fi
|
33 |
|
|
|
34 |
|
|
echo Certifying runs from file $runList
|
35 |
|
|
echo Using Trigger List $TriggerList from run $firstFitRun to $lastFitRun
|
36 |
|
|
echo Fit files are $fitFile $fitRootFile
|
37 |
|
|
echo JSON file is $JSONFile
|
38 |
|
|
|
39 |
fantasia |
1.4 |
if [ ! -f $JSONFile ]; then
|
40 |
|
|
scp lxplus.cern.ch:/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions12/8TeV/Prompt/${JSONFile} .
|
41 |
|
|
fi
|
42 |
|
|
|
43 |
|
|
if [ ! -f $runList ]; then
|
44 |
|
|
echo "Did not find $runList, but it can be made like"
|
45 |
|
|
echo 'for i in $(eval echo {202305..203002}); do echo $i >> runList.txt ; done'
|
46 |
|
|
exit 1
|
47 |
|
|
fi
|
48 |
|
|
|
49 |
fantasia |
1.2 |
#if fit file doesn't exist, make it!!!
|
50 |
fantasia |
1.3 |
if [[ ( ! -f $fitFile ) || ( ! -f $fitRootFile ) ]]; then
|
51 |
fantasia |
1.2 |
echo Fit file do not exist, creating
|
52 |
fantasia |
1.3 |
./DatabaseRatePredictor.py --makeFits --TriggerList=$TriggerList --Beam --NoVersion --json=$JSONFile ${firstFitRun}-${lastFitRun}
|
53 |
fantasia |
1.2 |
echo Done making fit file.
|
54 |
|
|
fi
|
55 |
|
|
|
56 |
fantasia |
1.4 |
if [[ ! -f $fitFile ]]; then
|
57 |
|
|
echo "Fit file $fitFile does not exist...aborting"
|
58 |
|
|
exit 1
|
59 |
|
|
fi
|
60 |
|
|
|
61 |
|
|
if [[ ! -f $fitRootFile ]]; then
|
62 |
|
|
echo "Fit file $fitRootFile does not exist...aborting"
|
63 |
|
|
exit 1
|
64 |
|
|
fi
|
65 |
|
|
|
66 |
|
|
touch nonCollisionsRunList.txt
|
67 |
fantasia |
1.2 |
for run in `cat $runList`
|
68 |
fantasia |
1.1 |
do
|
69 |
fantasia |
1.3 |
if [ -f HLT_1LS_ls_vs_rawrate_Run${run}-${run}.pdf ]; then
|
70 |
|
|
echo Skipping because .pdf exists for run $run
|
71 |
|
|
continue
|
72 |
|
|
fi
|
73 |
|
|
|
74 |
fantasia |
1.4 |
if [[ $(grep $run nonCollisionsRunList.txt 2> /dev/null) ]] ; then
|
75 |
|
|
echo Skipping because run $run was already checked to be non-collisions
|
76 |
|
|
continue
|
77 |
|
|
fi
|
78 |
|
|
|
79 |
fantasia |
1.1 |
echo Producing Plots for run $run
|
80 |
fantasia |
1.4 |
./DatabaseRatePredictor.py --Beam --secondary --TriggerList=${TriggerList} --fitFile=${fitFile} ${run} >& log
|
81 |
fantasia |
1.3 |
if [ ! -f HLT_1LS_ls_vs_rawrate_Run${run}-${run}.root ]; then
|
82 |
fantasia |
1.4 |
echo -e "\tNo output root fit file for run $run, was the collisions key used?\n"
|
83 |
|
|
echo $run >> nonCollisionsRunList.txt
|
84 |
fantasia |
1.3 |
continue
|
85 |
|
|
fi
|
86 |
|
|
|
87 |
fantasia |
1.4 |
root -b -l -q 'dumpToPDF.C+("HLT_1LS_ls_vs_rawrate_Run'${run}'-'${run}'.root", "'${fitRootFile}'")'
|
88 |
fantasia |
1.3 |
if [ $? -ne 0 ]; then
|
89 |
fantasia |
1.4 |
echo Return value from dumpToPDF not 0!!!! Quitting...
|
90 |
fantasia |
1.3 |
exit 1
|
91 |
|
|
fi
|
92 |
fantasia |
1.1 |
done
|
93 |
fantasia |
1.2 |
|
94 |
fantasia |
1.4 |
echo Done.
|
95 |
|
|
|