9def main( runNum = None, procType = None, forceSkipQueue = 0, Stream = None ):
13 print(
'ERROR no run number given')
18 print(
'ERROR no process type given')
21 print(
'ERROR no stream given')
23 for iType
in procType:
24 if iType
not in [
'doNoisyStrip',
'doNoiseOccupancy',
'doDeadChip',
'doDeadStrip',
'doHV',
'doBSErrorDB',
'doRawOccupancy',
'doEfficiency',
'doLorentzAngle']:
25 print(
'ERROR process type does not match any possible candidates')
36 runQuery =
'AtlRunQuery.py '
37 runQuery +=
'--run \"' + str(Run0) +
'\" '
39 if 'cos' not in Stream
and 'idcomm' not in Stream:
40 runQuery +=
'--lhc \"stablebeams TRUE\" '
42 runQuery +=
'--partition \"ATLAS\" '
43 runQuery +=
'--detmaskin \"240A\" '
47 runQuery +=
'--projecttag \"data*_*eV\" '
49 runQuery +=
'--projecttag \"data*_hi\" '
51 runQuery +=
'--projecttag \"data*_cos\" '
53 runQuery +=
'--projecttag \"data*_idcom\" '
55 if pType ==
'doNoisyStrip':
56 runQuery +=
'--streams \"*calibration_SCTNoise 10000+\" '
57 runQuery +=
'--show \"streams *calibration_SCTNoise\" '
59 if pType ==
'doDeadChip' or pType ==
'doDeadStrip':
61 if 'cos' not in Stream:
62 runQuery +=
'--streams \"*express 200000+\" '
63 runQuery +=
'--show \"streams *express\" '
65 runQuery +=
'--streams \"*IDCosmic 200000+\" '
66 runQuery +=
'--show \"streams *IDCosmic\" '
69 runQuery +=
'--show run --show projecttag --show events --show time --show \"lhc\" '
70 runQuery +=
'--noroot --nohtml --verbose'
78 if 'cos' not in Stream
and 'idcomm' not in Stream:
81 if os.path.exists(
'./data/MyLBCollection.xml'):
82 f = open(
'./data/MyLBCollection.xml')
85 if "Metadata" in line
and "RunList" in line
and str(Run0)
in line:
87 print(
"Run %s : run selection passed ---> job will be launched" %(Run0))
92 print(
"ERROR problem in access to /data/MyLBCollection.xml file produced by AtlRunQuery.py --- probably due to AtlRunQuery crash...")
96 print(
"Run %s : run selection didn't pass Stable Beam check--- job will be finished" %(Run0))
102 if pType !=
'doNoisyStrip' or forceSkipQueue == 1 :
109 if os.path.exists(
'/afs/cern.ch/work/s/sctcalib/lastRun') :
110 f = open(
'/afs/cern.ch/work/s/sctcalib/lastRun')
116 print(
"Run %s : the last run uploaded" %(RunLast)[:-1])
119 if int(RunLast) > int(Run0) :
120 print(
"Run %s : taken later than the current run ---> job will not be run" %(RunLast)[:-1])
124 runQuery =
'AtlRunQuery.py '
125 runQuery +=
'--run \"' + str(RunLast[:-1]) +
'+\" '
128 if 'cos' not in Stream
and 'idcomm' not in Stream:
129 runQuery +=
'--lhc \"stablebeams TRUE\" '
130 runQuery +=
'--partition \"ATLAS\" '
131 runQuery +=
'--detmaskin \"240A\" '
134 runQuery +=
'--projecttag \"data*_*eV\" '
136 runQuery +=
'--projecttag \"data*_hi\" '
137 elif 'cos' in Stream:
138 runQuery +=
'--projecttag \"data*_cos\" '
140 runQuery +=
'--projecttag \"data*_idcomm\" '
146 runQuery +=
'--streams \"*calibration_SCTNoise 10000+\" '
147 runQuery +=
'--show \"streams *calibration_SCTNoise\" '
148 runQuery +=
'--show run --show projecttag --show events --show time --show \"lhc\" '
149 runQuery +=
'--noroot --nohtml --verbose'
158 if os.path.exists(
"./data/QueryResult.txt") :
159 f = open(
'./data/QueryResult.txt')
162 if 'Run:' in line
and runNum==
'':
163 runNum = line.split(
':')[1]
164 runNum = runNum.replace(
"\n",
'').
replace(
' ',
'')
165 if 'Project tag:' in line
and runPro==
'':
166 runPro = line.split(
'\'')[1]
167 if runNum!=
'' and runPro!=
'':
169 runList.append(runNum)
170 runDict[runNum] = runPro
179 for iRun
in range( int(RunLast)+1, int(Run0) ):
180 if str(iRun)
in runList:
182 print(
"Run %s: this run has to be processed/uploaded ---> job in pending state " %(iRun))
187 print(
"Run %s : checked the last run uploaded ---> job will be launched" %(Run0))
210 print(
'Run %s : waiting for previous run(s) processed/uploaded' %(Run0))
214 print(
'Run %s : job starts running now' %(Run0))
218if __name__ ==
"__main__":
220 runNumber = int( sys.argv[1] )
222 print(
"Failed to read run number" %(sys.argv[1]))
225 processType = str( sys.argv[2] )
227 print(
"Failed to read proces type" %(sys.argv[2]))
230 skipQueue = int( sys.argv[3] )
232 print(
"Setting skipqueue to default (wait until previous runs are analysed)")
235 main( runNum = runNumber, procType = processType, forceSkipQueue = skipQueue )
void print(char *figname, TCanvas *c1)
std::string replace(std::string s, const std::string &s2, const std::string &s3)