CMS 3D CMS Logo

Functions
checkPayloads Namespace Reference

Functions

def getListOfRunsAndLumiFromFile (firstRun=-1, fileName="")
 
def getListOfRunsAndLumiFromRR (firstRun=-1, error="")
 
def getUploadedIOVs (tagName, destDB="oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT")
 
def main ()
 

Function Documentation

◆ getListOfRunsAndLumiFromFile()

def checkPayloads.getListOfRunsAndLumiFromFile (   firstRun = -1,
  fileName = "" 
)

Definition at line 42 of file checkPayloads.py.

42 def getListOfRunsAndLumiFromFile(firstRun=-1,fileName=""):
43  file = open(fileName);
44  jsonFile = file.read();
45  file.close()
46  jsonList=json.loads(jsonFile);
47 
48  selected_dcs = {};
49  for element in jsonList:
50  selected_dcs[long(element)]=jsonList[element]
51  return selected_dcs
52 

Referenced by main().

◆ getListOfRunsAndLumiFromRR()

def checkPayloads.getListOfRunsAndLumiFromRR (   firstRun = -1,
  error = "" 
)

Definition at line 54 of file checkPayloads.py.

54 def getListOfRunsAndLumiFromRR(firstRun=-1,error=""):
55  RunReg ="http://pccmsdqm04.cern.ch/runregistry"
56  #RunReg = "http://localhost:40010/runregistry"
57  #Dataset=%Online%
58  Group = "Collisions10"
59 
60  # get handler to RR XML-RPC server
61  FULLADDRESS=RunReg + "/xmlrpc"
62  #print "RunRegistry from: ",FULLADDRESS
63  #firstRun = 153000
64  server = xmlrpclib.ServerProxy(FULLADDRESS)
65  #sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun) + " and {datasetName} LIKE '" + Dataset + "'"
66  sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun)
67 
68  tries = 0;
69  maxAttempts = 3
70  while tries<maxAttempts:
71  try:
72  run_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_runs', sel_runtable)
73  break
74  except:
75  tries += 1
76  print("Trying to get run data. This fails only 2-3 times so don't panic yet...", tries, "/", maxAttempts)
77  time.sleep(1)
78  print("Exception type: ", sys.exc_info()[0])
79  if tries==maxAttempts:
80  error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!"
81  print(error);
82  return {};
83 
84  listOfRuns=[]
85  runErrors = {}
86  for line in run_data.split("\n"):
87  run=line.split(',')[0]
88  if run.isdigit():
89  listOfRuns.append(run)
90 
91  tries = 0
92  maxAttempts = 3
93  firstRun = listOfRuns[len(listOfRuns)-1];
94  lastRun = listOfRuns[0];
95  sel_dcstable="{groupName} ='" + Group + "' and {runNumber} >= " + str(firstRun) + " and {runNumber} <= " + str(lastRun) + " and {parDcsBpix} = 1 and {parDcsFpix} = 1 and {parDcsTibtid} = 1 and {parDcsTecM} = 1 and {parDcsTecP} = 1 and {parDcsTob} = 1 and {parDcsEbminus} = 1 and {parDcsEbplus} = 1 and {parDcsEeMinus} = 1 and {parDcsEePlus} = 1 and {parDcsEsMinus} = 1 and {parDcsEsPlus} = 1 and {parDcsHbheA} = 1 and {parDcsHbheB} = 1 and {parDcsHbheC} = 1 and {parDcsH0} = 1 and {parDcsHf} = 1"
96  while tries<maxAttempts:
97  try:
98  dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable)
99  break
100  except:
101  tries += 1
102  print("I was able to get the list of runs and now I am trying to access the detector status", tries, "/", maxAttempts)
103  time.sleep(1)
104  print("Exception type: ", sys.exc_info()[0])
105 
106  if tries==maxAttempts:
107  error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!"
108  print(error);
109  return {};
110 
111  #This is the original and shold work in the furture as soon as the server will be moved to a more powerfull PC
112  #while tries<maxAttempts:
113  # try:
114  # run_data = server.DataExporter.export('RUN' , 'GLOBAL', 'csv_runs', sel_runtable)
115  # dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable)
116  # #print run_data
117  # #print dcs_data
118  # break
119  # except:
120  # print "Something wrong in accessing runregistry, retrying in 5s...."
121  # tries += 1
122  # time.sleep(2)
123  # print "Exception type: ", sys.exc_info()[0]
124  #
125  # if tries==maxAttempts:
126  # error = "Run registry unaccessible.....exiting now"
127  # sys.exit(error)
128 
129 
130 
131  selected_dcs={}
132  jsonList=json.loads(dcs_data)
133 
134  #for element in jsonList:
135  for element in listOfRuns:
136  #if element in listOfRuns:
137  if element in jsonList:
138  selected_dcs[long(element)]=jsonList[element]
139  else:
140  #print "WARNING: Run " + element + " is a collision10 run with 0 lumis in Run Registry!"
141  selected_dcs[long(element)]= [[]]
142  return selected_dcs
143 

References print(), and str.

◆ getUploadedIOVs()

def checkPayloads.getUploadedIOVs (   tagName,
  destDB = "oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT" 
)

Definition at line 17 of file checkPayloads.py.

17 def getUploadedIOVs(tagName,destDB="oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT"): listIOVCommand = "cmscond_list_iov -c " + destDB + " -P /afs/cern.ch/cms/DB/conddb -t " + tagName
18  dbError = commands.getstatusoutput( listIOVCommand )
19  if dbError[0] != 0 :
20  if dbError[1].find("metadata entry \"" + tagName + "\" does not exist") != -1:
21  exit(dbError[1])
22  else:
23  exit("ERROR: Can\'t connect to db because:\n" + dbError[1])
24 
25 
26  aCommand = listIOVCommand + " | grep DB= | awk \'{print $1}\'"
27  #print aCommand
28  output = commands.getstatusoutput( aCommand )
29 
30  #WARNING when we pass to lumi IOV this should be long long
31  if output[1] == '':
32  exit("ERROR: The tag " + tagName + " exists but I can't get the value of the last IOV")
33 
34  runs = []
35  for run in output[1].split('\n'):
36  runs.append(long(run))
37 
38  return runs
39 
40 

References beamvalidation.exit(), spr.find(), and submitPVValidationJobs.split().

Referenced by main().

◆ main()

def checkPayloads.main ( )

Definition at line 145 of file checkPayloads.py.

145 def main():
146  usage = "USAGE: ./checkPayloads.py (optional tagNumber) (optional \"lumi\") (optional \"z\" (optional destDB)"
147  printExtra = False
148  tagNumber = "14"
149  dbBase = ""
150  sigmaZ = ""
151 
152  if len(sys.argv) >= 2:
153  if not sys.argv[1].isdigit():
154  exit(usage)
155  else:
156  tagNumber = sys.argv[1]
157  if len(sys.argv) >= 3:
158  if not sys.argv[2] == "lumi":
159  exit(usage)
160  else:
161  dbBase = "_LumiBased"
162  if len(sys.argv) >= 4:
163  if not sys.argv[3] == "z":
164  exit(usage)
165  else:
166  sigmaZ = "_SigmaZ"
167  destDB = ""
168  if(len(sys.argv) > 4):
169  destDB = sys.argv[4]
170  #132573 Beam lost immediately
171  #132958 Bad strips
172  #133081 Bad pixels bad strips
173  #133242 Bad strips
174  #133472 Bad strips
175  #133473 Only 20 lumisection, run duration 00:00:03:00
176  #133509 Should be good!!!!!!!!!!
177  #136290 Bad Pixels bad strips
178  #138560 Bad pixels bad strips
179  #138562 Bad HLT bad L1T, need to rescale the Jet Triggers
180  #139363 NOT in the bad list but only 15 lumis and stopped for DAQ problems
181  #139455 Bad Pixels and Strips and stopped because of HCAL trigger rate too high
182  #140133 Beams dumped
183  #140182 No pixel and Strips with few entries
184  #141865 Pixel are bad but Strips work. Run is acceptable but need relaxed cuts since there are no pixels. BeamWidth measurement is bad 80um compared to 40um
185  #142461 Run crashed immediately due to PIX, stable beams since LS1
186  #142465 PostCollsions10, beams lost, HCAl DQM partly working
187  #142503 Bad pixels bad strips
188  #142653 Strips not in data taking
189  #143977 No Beam Strips and Pixels bad
190  #148859 Strips and Pixels HV off waiting for beam
191 
192  knownMissingRunList = [132573,132958,133081,133242,133472,133473,136290,138560,138562,139455,140133,140182,142461,142465,142503,142653,143977,148859]
193  tagName = "BeamSpotObjects_2009" + dbBase + sigmaZ + "_v" + tagNumber + "_offline"
194  print("Checking payloads for tag " + tagName)
195  listOfRunsAndLumi = {};
196  #listOfRunsAndLumi = getListOfRunsAndLumiFromRR(-1);
197  if(not listOfRunsAndLumi):
198  listOfRunsAndLumi = getListOfRunsAndLumiFromFile(-1,"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/Cert_132440-149442_7TeV_StreamExpress_Collisions10_JSON_v3.txt");
199  tmpListOfIOVs = []
200  if(destDB != ""):
201  tmpListOfIOVs = getUploadedIOVs(tagName,destDB)
202  else:
203  tmpListOfIOVs = getUploadedIOVs(tagName)
204 
205 
206  listOfIOVs = []
207  if(dbBase == ''):
208  listOfIOVs = tmpListOfIOVs
209  else:
210  for iov in tmpListOfIOVs:
211  if((iov >> 32) not in listOfIOVs):
212  listOfIOVs.append(iov >>32)
213  RRRuns = sorted(listOfRunsAndLumi.keys())
214  for run in RRRuns:
215  #print listOfRunsAndLumiFromRR[run]
216  if run not in listOfIOVs:
217  extraMsg = ""
218  if listOfRunsAndLumi[run] == [[]]:
219  extraMsg = " but it is empty in the RR"
220  if not printExtra: continue
221  if run in knownMissingRunList :
222  extraMsg = " but this run is know to be bad " #+ runErrors[run]
223  if not printExtra: continue
224  print("Run: " + str(run) + " is missing for DB tag " + tagName + extraMsg)
225 
226 

References beamvalidation.exit(), getListOfRunsAndLumiFromFile(), getUploadedIOVs(), if(), print(), and str.

checkPayloads.main
def main()
Definition: checkPayloads.py:145
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
checkPayloads.getListOfRunsAndLumiFromRR
def getListOfRunsAndLumiFromRR(firstRun=-1, error="")
Definition: checkPayloads.py:54
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
checkPayloads.getUploadedIOVs
def getUploadedIOVs(tagName, destDB="oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT")
Definition: checkPayloads.py:17
checkPayloads.getListOfRunsAndLumiFromFile
def getListOfRunsAndLumiFromFile(firstRun=-1, fileName="")
Definition: checkPayloads.py:42
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
str
#define str(s)
Definition: TestProcessor.cc:53
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52