ATLAS Offline Software
Functions | Variables
DeMoUpdate Namespace Reference

Functions

def sort_period (text)
 Ancillary functions. More...
 
def printProp (varname)
 
def listify (l)
 
def findLB (lbts, startOfVetoPeriod)
 
def printBoth (string0, boolean, f)
 Functions dedicated to output printing. More...
 
def singleRunReport (runNumber, dict1, dict2, directory, defects, veto, exactVetoComput)
 
def extractNamePartition (foundDefect)
 Functions dedicated to defect retrieval and basic string manipulations. More...
 
def retrieveDefectsFromDB (run, defectTag, grlDef, signOffDefects)
 
def updateRunList (year=time.localtime().tm_year)
 Retrieval of new runs not yet in YearStats-common/runlist-[year]-AtlasReady.dat. More...
 
def getRunInfo (runlist, defectTag="HEAD")
 Retrieval of run characteristics. More...
 

Variables

bool debug = False
 
 passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
 
 passwd = passfile.read().strip(); passfile.close()
 
 dqmapi = xmlrpc.client.ServerProxy('https://%s@atlasdqm.cern.ch'%(passwd))
 
string runListDir = "./YearStats-common"
 
 parser = ArgumentParser(description='',formatter_class=RawTextHelpFormatter)
 
 dest
 
 default
 
 help
 
 action
 
 type
 
 int
 
 nargs
 
 args = parser.parse_args()
 
dictionary options = {}
 
dictionary yearTagProperties = {}
 
dictionary partitions = {}
 
dictionary grlDef = {}
 
dictionary defectVeto = {}
 
dictionary veto = {}
 
dictionary signOff = {}
 
dictionary runlist = {'filename':"",'primary':[],'toprocess':[],'weeklyfile':[],'weekly-dqmeeting':"",'roughVeto':[]}
 
 year
 
string tokenName = "DeMo-%s-%s-%s.token"%(options['system'],options['year'],options['tag'])
 
int startrun = 0
 
int endrun = 1e12
 
string runListFilename = "%s/%s/%s"%(runListDir,options['year'],runlist['filename'])
 
 fRunList = open(runListFilename,'r')
 
string roughVetoFilename = runListDir+"/%s/%s/roughVeto-%s.dat"%(options['system'],options['year'],options['year'])
 
 fRoughVeto = open(roughVetoFilename,'r')
 
string yearStatsArchiveFilename = '%s/TProfiles.root'%options['yearStatsDir']
 
string confirm = "y"
 
 fLastReset = open("%s/lastResetYS.dat"%options['yearStatsDir'],"w")
 
 errorLogFile = open("%s/errors.log"%options['yearStatsDir'],'a')
 
 notYetSignedOffRuns = open('%s/runs-notYetSignedOff.dat'%options['yearStatsDir'],'w')
 
def runinfo = getRunInfo(runlist['primary'],options['defectTag'])
 
list oldRunsNotYetignedOff = []
 
int oneWeek = 7*24*3600
 
 key
 
 reverse
 
def defects = runinfo[run]["signoffDefects"].keys()
 
list statuses = [ runinfo[run]["signoffDefects"][d]["status"] for d in defects ]
 
bool fullySignedOff = True
 
int signOffTime = 0
 
 weeklyFile = open("%s/%s/runlist-weekly.dat"%(runListDir,options['year']),'r')
 
dictionary periodListCurrent = {}
 
list newPeriodInYearStats = []
 
bool bool_newRunsInYearStats = False
 
 allperiods_full = list(set([ p for irun in runlist['toprocess'] for p in runinfo[irun]["periods"] ]))
 
 allperiods = list(set([runinfo[irun]["period"] for irun in runlist['toprocess'] if runinfo[irun]["period"] != "?"]))
 
string periodFileName = "%s/runs-%s.dat"%(options['yearStatsDir'],iper)
 
 f = open(periodFileName,'r')
 
 existingRuns = f.readlines()
 
bool periodToBeAdded = False
 
dictionary hProfRun_IntolDefect = {}
 Book Histograms for general plot with intolerable defects/veto Fill them with past period inefficiencies. More...
 
dictionary hProfRun_Veto = {}
 
dictionary hProfPeriod_IntolDefect = {}
 
dictionary hProfPeriod_Veto = {}
 
list allIntolDef = ["allIntol","allIntol_recov"]
 
 idefName = idef.split("__")[0]
 
list periodListYear = []
 
string profPeriodName = "hProfPeriod_IntolDefect_%s"%(idef)
 
 file = TFile(yearStatsArchiveFilename)
 
 hProfPeriod_archive = file.Get("%s_archive"%(profPeriodName))
 
 periodNbYear = len(periodListYear)
 
 h1Run_IntLuminosity = MakeTH1("h1_IntLumi","Run","Integrated luminosity", -0.5,+0.5+len(runlist['toprocess']),len(runlist['toprocess'])+1,kBlack)
 
 h1Per_IntLumi = MakeTH1("periodLuminosity","Period","Luminosity(pb-1)",-0.5,+0.5+periodNbYear,periodNbYear+1,1)
 TO BE MODIFIED WHEN TH1 IS SAVED IN TPROFILE.ROOT. More...
 
dictionary h1_vetoInstLumiEvol = {}
 Book histograms for luminosity profile and veto rejection as a function of luminosity. More...
 
dictionary lbAffected = {}
 Initialize total luminosity affected per defect for all runs. More...
 
tuple boolExactVetoComput_run = (options['exactVetoComput']) and (runNb not in runlist['roughVeto'])
 
 v_lbTimeSt = GetLBTimeStamps(runNb)
 
 defectDatabase = DQDefects.DefectsDB(tag=options['defectTag'])
 
list globalFilterLB = []
 
 retrievedDefects = defectDatabase.retrieve((runNb, 1), (runNb, runinfo[runNb]['nLB']), grlDef["globalFilterDefects"])
 
 atlasready = GetReadyFlag(runNb)
 
 thisRunPerLB = dict()
 
 lumiacct = fetch_iovs('COOLOFL_TRIGGER::/TRIGGER/OFLLUMI/LumiAccounting', tag=yearTagProperties["OflLumiAcct tag"], since=v_lbTimeSt[1][0]*1000000000, until=v_lbTimeSt[len(v_lbTimeSt)][1]*1000000000)
 
string errorMsg = "Missing lumi for Run %d - LB %d\n"%(runNb,lb)
 
def parsedDefects = retrieveDefectsFromDB(runNb, options['defectTag'], grlDef,signOff)
 
 defectFound
 
 partAffected
 
string db2 = "COOLOFL_LAR/CONDBR2"
 
string folderName = "/LAR/BadChannelsOfl/EventVeto"
 
 totalVeto = showEventVeto.showEventVetoFolder(db2,folderName,options['vetoTag'],runNb,runNb,0)
 
def lb0 = findLB(v_lbTimeSt,totalVeto[veto["COOL"][iVeto]][iVetoedLB][0]/1e9)
 
def lb1 = findLB(v_lbTimeSt,totalVeto[veto["COOL"][iVeto]][iVetoedLB][0]/1e9)
 
dictionary lineNb = {}
 Treatment when a run range was considered (weekly report) More...
 
dictionary column = {}
 
dictionary c1 = {}
 
int canvasIndex = 0
 
bool newCanvas = True
 
list labels_col = ["Run","Run start / stop","LB ready","Peak lumi","Filt. lumi","GRL ineff.","Veto ineff.","Period","Status"]
 
list xlow_col = [0.01,0.075,0.405,0.485,0.57,0.65,0.735,0.83,0.89,0.99]
 
float ylowTable = 0.99 - 0.98/(len(runlist['toprocess'])+6)*(len(runlist['toprocess'])+2)
 
 notYetSignedOff_TPave = TPaveText(xlow_col[0],0.01,xlow_col[len(labels_col)],ylowTable)
 
string tmp = "Old runs (> 7 days) not yet signed off: "
 
string tmp2 = ""
 
dictionary canvasResults = {}
 
dictionary legendResults = {}
 
dictionary stackResults = {}
 
string filename = 'Files/weeklyHisto-%s-%s.root'%(startrun, endrun)
 Show Plots only for considered runs. More...
 
 fAll = open("%s/runs-ALL.dat"%options['yearStatsDir'],'a')
 
string irun_string = "%d (%.0f ub-1)"%(irun,runinfo[irun]['Lumi'])
 
string defectFileName = "%s/loss-%s.dat"%(options['yearStatsDir'],idef)
 
string defString = "%s -> %.6f pb-1 (recov: %.6f pb-1)\n"%(irun_string,runinfo[irun]["lumiDefect_%s"%(idef)]/1e6,runinfo[irun]["lumiDefect_%s__recov"%(idef)]/1e6)
 
bool toAdd = True
 
 f2 = open(defectFileName,'r')
 
string vetoFileName = "%s/loss-%sVETO.dat"%(options['yearStatsDir'],iVeto)
 
string vetoString = "%s -> %.6f pb-1 \n"%(irun_string,runinfo[irun]["lumiVeto_%s"%(iVeto)]/1e6)
 

Function Documentation

◆ extractNamePartition()

def DeMoUpdate.extractNamePartition (   foundDefect)

Functions dedicated to defect retrieval and basic string manipulations.

Definition at line 141 of file DeMoUpdate.py.

141 def extractNamePartition(foundDefect):
142  # Parse the defect name, return name, partition where available
143  defectName = ""
144  defectPart = ""
145  if (foundDefect.startswith("PIXEL")): # [PIXEL]_[PARTITION]_[NAME]
146  defectSplitted = foundDefect.split("_",2)
147  if len(defectSplitted) > 2:
148  defectPart=defectSplitted[1]
149  defectName=defectSplitted[2]
150  elif (foundDefect.startswith("SCT")): # SCT_[NAME]
151  defectSplitted = foundDefect.split("_",1)
152  if len(defectSplitted) > 1:
153  defectName=defectSplitted[1]
154  elif (foundDefect.startswith("TRT")): # TRT_[NAME]
155  defectSplitted = foundDefect.split("_",1)
156  if len(defectSplitted) > 1:
157  defectName=defectSplitted[1]
158  elif (foundDefect.startswith("LAR")): # [LAR]_[PART]_[Name] or [LAR]_[Name] - No "_" in any [NAME]
159  defectSplitted = foundDefect.split("_",2)
160  if len(defectSplitted) == 2: # LAR_[NAME]
161  defectName=defectSplitted[1]
162  elif len(defectSplitted) == 3: # LAR_[PART]_[NAME]
163  defectPart=defectSplitted[1]
164  defectName=defectSplitted[2]
165  elif (foundDefect.startswith("CALO_ONLINEDB")):# CALO_ONLINEDB_[NAME] (only for CALO_ONLINEDB_LOWMU) - Accounted to LAr
166  defectSplitted = foundDefect.split("_",2)
167  if len(defectSplitted) > 2:
168  defectName=defectSplitted[2]
169  elif (foundDefect.startswith("TILE")): # [TILE]_[PART]_[Name]
170  defectSplitted = foundDefect.split("_",2)
171  if len(defectSplitted) > 2:
172  defectPart=defectSplitted[1]
173  defectName=defectSplitted[2]
174  elif (foundDefect.startswith("MS")): # MS_[SUBDETECTOR]_[PARTITION]_[NAME]
175  defectSplitted = foundDefect.split("_",3)
176  if len(defectSplitted) > 3:
177  systemAffected=defectSplitted[1]
178  defectPart=defectSplitted[2]
179  defectName=defectSplitted[3]
180  elif (foundDefect.startswith("MCP")): # MCP_[NAME]
181  defectSplitted = foundDefect.split("_",1)
182  if len(defectSplitted) > 1:
183  defectName=defectSplitted[1]
184  elif (foundDefect.startswith("ID")):# ID_[NAME]
185  defectSplitted = foundDefect.split("_",1)
186  if len(defectSplitted) > 1:
187  defectName=defectSplitted[1]
188  elif (foundDefect.startswith("JET")):# JET_[NAME]
189  defectSplitted = foundDefect.split("_",1)
190  if len(defectSplitted) > 1:
191  defectName=defectSplitted[1]
192  elif (foundDefect.startswith("MET")):# MET_[NAME]
193  defectSplitted = foundDefect.split("_",1)
194  if len(defectSplitted) > 1:
195  defectName=defectSplitted[1]
196  elif (foundDefect.startswith("EGAMMA")):# EGAMMA_[NAME]_[PART] or EGAMMA_[NAME]
197  if ("BARREL" in foundDefect or "ENDCAP" in foundDefect or "FORWARD" in foundDefect): #EGAMMA_[NAME]_[PART]
198  defectSplitted = foundDefect.split("_",2)
199  if len(defectSplitted) > 2:
200  defectName=defectSplitted[1]
201  defectPart=defectSplitted[2]
202  else:
203  defectSplitted = foundDefect.split("_",1)
204  if len(defectSplitted) > 1:
205  defectName=defectSplitted[1]
206  elif (foundDefect.startswith("TAU")): # TAU_[PART]_[NAME]
207  defectSplitted = foundDefect.split("_",2)
208  if len(defectSplitted) > 2:
209  defectPart=defectSplitted[1]
210  defectName=defectSplitted[2]
211  elif (foundDefect.startswith("CALO")): # CALO_[PART]_[NAME]
212  defectSplitted = foundDefect.split("_",2)
213  if len(defectSplitted) > 2:
214  defectPart=defectSplitted[1]
215  defectName=defectSplitted[2]
216  elif (foundDefect.startswith("BTAG")):# BTAG_[NAME]
217  defectSplitted = foundDefect.split("_",1)
218  if len(defectSplitted) > 1:
219  defectName=defectSplitted[1]
220  elif (foundDefect.startswith("TRIG")): # TRIG_L1_[NAME] TRIG_HLT_[NAME]
221  defectSplitted = foundDefect.split("_",2)
222  if len(defectSplitted) > 2:
223  defectName=defectSplitted[2]
224  elif (foundDefect.startswith("LUMI")): # LUMI_[NAME]
225  defectSplitted = foundDefect.split("_",1)
226  if len(defectSplitted) > 1:
227  defectName=defectSplitted[1]
228  elif (foundDefect.startswith("ALFA")): # ALFA_[NAME]
229  defectSplitted = foundDefect.split("_",1)
230  if len(defectSplitted) > 1:
231  defectName=defectSplitted[1]
232  elif (foundDefect.startswith("AFP")): # AFP_[NAME] or AFP_[PART]_[NAME]
233  if ("_A_" in foundDefect or "_C_" in foundDefect): #AFP_[PART]_[NAME]
234  defectSplitted = foundDefect.split("_",2)
235  if len(defectSplitted) > 2:
236  defectName=defectSplitted[2]
237  defectPart=defectSplitted[1]
238  if ("_A_NEAR_" in foundDefect or "_C_NEAR_" in foundDefect or "_A_FAR_" in foundDefect or "_C_FAR_" in foundDefect): #AFP_[PART]_[NEAR/FAR]_[NAME]
239  defectSplitted = foundDefect.split("_",3)
240  if len(defectSplitted) > 3:
241  defectName=defectSplitted[3]
242  defectPart="%s_%s"%(defectSplitted[1],defectSplitted[2])
243  else:
244  defectSplitted = foundDefect.split("_",1)
245  if len(defectSplitted) > 1:
246  defectName=defectSplitted[1]
247  elif (foundDefect.startswith("LCD")): # LCD_[NAME]
248  defectSplitted = foundDefect.split("_",1)
249  if len(defectSplitted) > 1:
250  defectName=defectSplitted[1]
251  elif (foundDefect.startswith("ZDC")): # ZDC_[NAME]
252  defectSplitted = foundDefect.split("_",1)
253  if len(defectSplitted) > 1:
254  defectName=defectSplitted[1]
255  elif (foundDefect.startswith("GLOBAL")): # GLOBAL_[NAME]
256  defectSplitted = foundDefect.split("_",1)
257  if len(defectSplitted) > 1:
258  defectName=defectSplitted[1]
259 
260  return defectName, defectPart
261 

◆ findLB()

def DeMoUpdate.findLB (   lbts,
  startOfVetoPeriod 
)

Definition at line 85 of file DeMoUpdate.py.

85 def findLB(lbts,startOfVetoPeriod):
86  # Find the lumiblock where a veto period starts
87  for i in list(lbts.keys()):
88  if (startOfVetoPeriod>lbts[i][0] and startOfVetoPeriod<lbts[i][1]):
89  return i
90  return i
91 

◆ getRunInfo()

def DeMoUpdate.getRunInfo (   runlist,
  defectTag = "HEAD" 
)

Retrieval of run characteristics.

Definition at line 314 of file DeMoUpdate.py.

314 def getRunInfo(runlist, defectTag="HEAD"):
315  # Retrieve run characteristics (period, time...)
316  possSignoffDefects = sum(list(signOff.values()),[])
317  run_signoffDefects = dqmapi.get_defects_lb({'run_list':runlist},possSignoffDefects,defectTag,True,True)
318 
319  infokeys = ["Run type", "Project tag", "Partition name", "Number of events passing Event Filter", "Run start", "Run end", "Number of luminosity blocks", "Data source", "Detector mask", "Recording enabled", "Number of events in physics streams" ]
320 
321  defectvals = [ "startlb", "endlb", "status", "time"]
322 
323  beamkeys = ["Max beam energy during run", "Stable beam flag enabled during run", "ATLAS ready flag enabled during run", "Total integrated luminosity", "ATLAS ready luminosity (/nb)"]
324 
325  for rd in run_signoffDefects.keys():
326  for defect in run_signoffDefects[rd].keys():
327  run_signoffDefects[rd][defect] = { ik:li for ik,li in zip(defectvals,run_signoffDefects[rd][defect][0]) }
328 
329  run_spec = {'run_list':runlist, 'stream': 'physics_CosmicCalo', 'source': 'tier0'}
330  run_info = dqmapi.get_run_information(run_spec)
331  for ri in run_info.keys():
332  run_info[ri] = { ik:li for ik,li in zip(infokeys,run_info[ri]) }
333 
334  beam_info = dqmapi.get_run_beamluminfo(run_spec)
335  for bi in beam_info.keys():
336  beam_info[bi] = { ik:li for ik,li in zip(beamkeys,beam_info[bi]) }
337 
338  run_periods = dqmapi.get_data_periods({'run_list':runlist})
339  allinfo = {}
340  def addDetails(inputDict, col=None):
341  for r in inputDict.keys():
342  run = int(r)
343  if run not in allinfo.keys():
344  allinfo[run] = {}
345  if col is not None:
346  allinfo[run][col] = inputDict[r]
347  else:
348  allinfo[run].update(inputDict[r])
349  addDetails(run_info)
350  addDetails(beam_info)
351  addDetails(run_periods, "periods")
352  addDetails(run_signoffDefects, "signoffDefects")
353 
354  # only take first period??
355  for r in allinfo.keys():
356  try:
357  allinfo[r]["period"] = allinfo[r]["periods"][0]
358  except IndexError:
359  print("Weird list of periods for",r,":",allinfo[r]["periods"])
360  allinfo[r]["period"]="?"
361 
362 
363  return allinfo
364 
365 

◆ listify()

def DeMoUpdate.listify (   l)

Definition at line 67 of file DeMoUpdate.py.

67 def listify(l):
68  if len(l)==0: return ''
69  elif len(l)==1: return str(l[0])
70  l.sort()
71  interval=False
72  a = ''
73  for i in range(len(l)-1):
74  if interval:
75  if l[i+1]-l[i]==1: pass
76  else: a += str(l[i])+' '; interval=False
77  else:
78  a += str(l[i])
79  if l[i+1]-l[i]==1: a += '-'; interval=True
80  else: a += ' '
81  a += str(l[-1])
82  return a
83 

◆ printBoth()

def DeMoUpdate.printBoth (   string0,
  boolean,
  f 
)

Functions dedicated to output printing.

Definition at line 94 of file DeMoUpdate.py.

94 def printBoth(string0,boolean,f):
95  # Print and, if the boolean is true, also write to the provided file
96  print(string0)
97  if boolean:# Also write on txt file
98  f.write(string0+'\n')
99  return
100 

◆ printProp()

def DeMoUpdate.printProp (   varname)

Definition at line 60 of file DeMoUpdate.py.

60 def printProp(varname):
61  print("**",varname,"**")
62  if hasattr(sys.modules[__name__],varname):
63  print(getattr(sys.modules[__name__],varname))
64 
65 

◆ retrieveDefectsFromDB()

def DeMoUpdate.retrieveDefectsFromDB (   run,
  defectTag,
  grlDef,
  signOffDefects 
)

Definition at line 262 of file DeMoUpdate.py.

262 def retrieveDefectsFromDB(run, defectTag, grlDef,signOffDefects):
263  # Get the list of defects for this run, parse them
264  defectDatabase = DQDefects.DefectsDB(tag=defectTag)
265  system_defects = []
266  for iPrefix in grlDef["prefix"]:
267  system_defects += [d for d in (defectDatabase.defect_names | defectDatabase.virtual_defect_names) if (d.startswith(iPrefix))]
268  for iSignOff in signOffDefects.keys():
269  if (signOffDefects[iSignOff] != ""):
270  system_defects += signOffDefects[iSignOff]
271  retrievedDefects = defectDatabase.retrieve((run, 1), (run+1, 0), system_defects)
272  parsed_defects = {}
273  for rd in retrievedDefects:
274  defectName, defectPart = extractNamePartition(rd.channel)
275  if not( defectName is None and defectName is None):
276  parsed_defects[rd] = [defectName, defectPart]
277  return parsed_defects
278 

◆ singleRunReport()

def DeMoUpdate.singleRunReport (   runNumber,
  dict1,
  dict2,
  directory,
  defects,
  veto,
  exactVetoComput 
)

Definition at line 101 of file DeMoUpdate.py.

101 def singleRunReport(runNumber,dict1,dict2,directory,defects,veto,exactVetoComput):
102  # Print single run report. Only printing, no computation
103  import string
104 
105  runDir = directory+"/Run"
106 
107  if dict1['signoff'] == "DONE" or dict1['signoff'] == "FINAL OK":
108  repOnDisk = True
109  f = open(runDir+'/%s.txt' % (runNumber), 'w')
110  else:
111  repOnDisk = False
112  f = open(runDir+'/dummy.txt', 'w')
113 
114  printBoth('Run start : %s'%dict1['Start'],repOnDisk,f)
115  printBoth('Run stop : %s'%dict1['Stop'],repOnDisk,f)
116  printBoth('LB with ATLAS ready = %9s'%(listify(dict1["readyLB"])),repOnDisk,f)
117  printBoth('LB with ATLAS ready and no global defect = %9s'%(listify(dict1["readyLB_globalFilter"])),repOnDisk,f)
118  printBoth('Nb of bunches = %d'%(dict1['nBunches']),repOnDisk,f)
119  printBoth('Peak lumi = %.1e'%(dict1['peakLumi']*1e30),repOnDisk,f)
120  printBoth('Integrated luminosity used for normalis. = %s'%(strLumi(dict1['Lumi'],"ub",False,True)),repOnDisk,f)
121  printBoth('%s GRL inefficiency : %.2f%% / %s'%(options["system"],dict1["ineffDefect_allIntol"],strLumi(dict1['Lumi']*dict1["ineffDefect_allIntol"]/100.,"ub",False,True)),repOnDisk,f)
122  for idef in (defects["globIntol"]):
123  if (len(dict2[idef])>0):
124  printBoth('Nb of LBs with %24s: %i -> %.2f%% (%s)'%(defectVeto["description"][idef].ljust(24),len(dict2[idef]),dict1["ineffDefect_%s"%(idef)],str(dict2[idef])),repOnDisk,f)
125  for idef in (defects["partIntol"]):
126  if (len(dict2[idef]["AllPartitions"])>0):
127  printBoth('Nb of LBs with %24s: %i -> %.2f%% (%s)'%(defectVeto["description"][idef].ljust(24),len(dict2[idef]["AllPartitions"]),dict1["ineffDefect_%s"%(idef)],str(dict2[idef]["AllPartitions"])),repOnDisk,f)
128  if len(veto["all"])>0:
129  if exactVetoComput:
130  printBoth('LAr veto inefficiency : %.3f%%'%(dict1["ineffVeto_allVeto"]),repOnDisk,f)
131  else:
132  printBoth('LAr veto inefficiency (rough computat.): %.3f%%'%(dict1["ineffVeto_allVeto"]),repOnDisk,f)
133  for iVeto in veto["all"]:
134  printBoth('%s veto inefficiency : %.3f%%'%(defectVeto["description"][iVeto],dict1["ineffVeto_%s"%(iVeto)]),repOnDisk,f)
135  f.close()
136 
137  return
138 

◆ sort_period()

def DeMoUpdate.sort_period (   text)

Ancillary functions.

Definition at line 55 of file DeMoUpdate.py.

55 def sort_period(text):
56  letter = "".join([i for i in text if not i.isdigit()])
57  number = "".join([i for i in text if i.isdigit()])
58  return (letter, int(number))
59 

◆ updateRunList()

def DeMoUpdate.updateRunList (   year = time.localtime().tm_year)

Retrieval of new runs not yet in YearStats-common/runlist-[year]-AtlasReady.dat.

Definition at line 281 of file DeMoUpdate.py.

281 def updateRunList(year=time.localtime().tm_year):
282  # Update list of runs. If there is not an up-to-date file, get the latest info from the atlas dqm APIs'''
283  print("Checking run list for year",year)
284 
285  latestRun=dqmapi.get_latest_run()
286  recentRuns = dqmapi.get_run_beamluminfo({'low_run':str(latestRun-1000),'high_run':str(latestRun)})
287  def writeRuns(outfile, fileRuns = []):
288  for r in sorted(recentRuns.keys(), key=int):
289  if (recentRuns[r][2]): # ATLAS ready
290  if r not in fileRuns:
291  fileRuns.append(r)
292  print("Adding the ATLAS ready run: %s"%r)
293  outfile.write("%s\n"%r)
294  allRunListDat = "%s/%s/runlist-%s-AtlasReady.dat"%(runListDir,str(year),str(year))
295  if os.path.isfile(allRunListDat):
296  fRunList = open(allRunListDat,'r+')
297  fileRuns = [l.strip() for l in fRunList.readlines() ]
298  if len(fileRuns)>0:
299  latestFileRun = max([int(r) for r in fileRuns])
300  else: latestFileRun = 0
301  if latestFileRun < latestRun:
302  print("Run file",allRunListDat,"is not up-to-date")
303  print("Latest run is ",latestRun, " while latest run in file is",latestFileRun)
304  print("Will check ATLAS ready filters & update if needed")
305  writeRuns(fRunList, fileRuns)
306  fRunList.close()
307  sys.exit()
308  else:
309  print("The run list for year ",year," is not available... please create one by hand")
310  sys.exit()
311 

Variable Documentation

◆ action

DeMoUpdate.action

Definition at line 373 of file DeMoUpdate.py.

◆ allIntolDef

list DeMoUpdate.allIntolDef = ["allIntol","allIntol_recov"]

Definition at line 696 of file DeMoUpdate.py.

◆ allperiods

DeMoUpdate.allperiods = list(set([runinfo[irun]["period"] for irun in runlist['toprocess'] if runinfo[irun]["period"] != "?"]))

Definition at line 615 of file DeMoUpdate.py.

◆ allperiods_full

DeMoUpdate.allperiods_full = list(set([ p for irun in runlist['toprocess'] for p in runinfo[irun]["periods"] ]))

Definition at line 614 of file DeMoUpdate.py.

◆ args

DeMoUpdate.args = parser.parse_args()

Definition at line 400 of file DeMoUpdate.py.

◆ atlasready

DeMoUpdate.atlasready = GetReadyFlag(runNb)

Definition at line 856 of file DeMoUpdate.py.

◆ bool_newRunsInYearStats

bool DeMoUpdate.bool_newRunsInYearStats = False

Definition at line 612 of file DeMoUpdate.py.

◆ boolExactVetoComput_run

tuple DeMoUpdate.boolExactVetoComput_run = (options['exactVetoComput']) and (runNb not in runlist['roughVeto'])

Definition at line 823 of file DeMoUpdate.py.

◆ c1

dictionary DeMoUpdate.c1 = {}

Definition at line 1112 of file DeMoUpdate.py.

◆ canvasIndex

int DeMoUpdate.canvasIndex = 0

Definition at line 1114 of file DeMoUpdate.py.

◆ canvasResults

dictionary DeMoUpdate.canvasResults = {}

Definition at line 1201 of file DeMoUpdate.py.

◆ column

dictionary DeMoUpdate.column = {}

Definition at line 1110 of file DeMoUpdate.py.

◆ confirm

string DeMoUpdate.confirm = "y"

Definition at line 521 of file DeMoUpdate.py.

◆ db2

string DeMoUpdate.db2 = "COOLOFL_LAR/CONDBR2"

Definition at line 1032 of file DeMoUpdate.py.

◆ debug

bool DeMoUpdate.debug = False

Definition at line 42 of file DeMoUpdate.py.

◆ default

DeMoUpdate.default

Definition at line 373 of file DeMoUpdate.py.

◆ defectDatabase

DeMoUpdate.defectDatabase = DQDefects.DefectsDB(tag=options['defectTag'])

Definition at line 835 of file DeMoUpdate.py.

◆ defectFileName

string DeMoUpdate.defectFileName = "%s/loss-%s.dat"%(options['yearStatsDir'],idef)

Definition at line 1299 of file DeMoUpdate.py.

◆ defectFound

DeMoUpdate.defectFound

Definition at line 946 of file DeMoUpdate.py.

◆ defects

def DeMoUpdate.defects = runinfo[run]["signoffDefects"].keys()

Definition at line 567 of file DeMoUpdate.py.

◆ defectVeto

dictionary DeMoUpdate.defectVeto = {}

Definition at line 412 of file DeMoUpdate.py.

◆ defString

string DeMoUpdate.defString = "%s -> %.6f pb-1 (recov: %.6f pb-1)\n"%(irun_string,runinfo[irun]["lumiDefect_%s"%(idef)]/1e6,runinfo[irun]["lumiDefect_%s__recov"%(idef)]/1e6)

Definition at line 1301 of file DeMoUpdate.py.

◆ dest

DeMoUpdate.dest

Definition at line 373 of file DeMoUpdate.py.

◆ dqmapi

DeMoUpdate.dqmapi = xmlrpc.client.ServerProxy('https://%s@atlasdqm.cern.ch'%(passwd))

Definition at line 47 of file DeMoUpdate.py.

◆ endrun

dictionary DeMoUpdate.endrun = 1e12

Definition at line 463 of file DeMoUpdate.py.

◆ errorLogFile

DeMoUpdate.errorLogFile = open("%s/errors.log"%options['yearStatsDir'],'a')

Definition at line 538 of file DeMoUpdate.py.

◆ errorMsg

string DeMoUpdate.errorMsg = "Missing lumi for Run %d - LB %d\n"%(runNb,lb)

Definition at line 897 of file DeMoUpdate.py.

◆ existingRuns

DeMoUpdate.existingRuns = f.readlines()

Definition at line 640 of file DeMoUpdate.py.

◆ f

DeMoUpdate.f = open(periodFileName,'r')

Definition at line 639 of file DeMoUpdate.py.

◆ f2

DeMoUpdate.f2 = open(defectFileName,'r')

Definition at line 1306 of file DeMoUpdate.py.

◆ fAll

DeMoUpdate.fAll = open("%s/runs-ALL.dat"%options['yearStatsDir'],'a')

Definition at line 1276 of file DeMoUpdate.py.

◆ file

DeMoUpdate.file = TFile(yearStatsArchiveFilename)

Definition at line 709 of file DeMoUpdate.py.

◆ filename

string DeMoUpdate.filename = 'Files/weeklyHisto-%s-%s.root'%(startrun, endrun)

Show Plots only for considered runs.

Definition at line 1227 of file DeMoUpdate.py.

◆ fLastReset

DeMoUpdate.fLastReset = open("%s/lastResetYS.dat"%options['yearStatsDir'],"w")

Definition at line 533 of file DeMoUpdate.py.

◆ folderName

string DeMoUpdate.folderName = "/LAR/BadChannelsOfl/EventVeto"

Definition at line 1033 of file DeMoUpdate.py.

◆ fRoughVeto

DeMoUpdate.fRoughVeto = open(roughVetoFilename,'r')

Definition at line 491 of file DeMoUpdate.py.

◆ fRunList

DeMoUpdate.fRunList = open(runListFilename,'r')

Definition at line 476 of file DeMoUpdate.py.

◆ fullySignedOff

bool DeMoUpdate.fullySignedOff = True

Definition at line 570 of file DeMoUpdate.py.

◆ globalFilterLB

list DeMoUpdate.globalFilterLB = []

Definition at line 837 of file DeMoUpdate.py.

◆ grlDef

dictionary DeMoUpdate.grlDef = {}

Definition at line 411 of file DeMoUpdate.py.

◆ h1_vetoInstLumiEvol

dictionary DeMoUpdate.h1_vetoInstLumiEvol = {}

Book histograms for luminosity profile and veto rejection as a function of luminosity.

Definition at line 781 of file DeMoUpdate.py.

◆ h1Per_IntLumi

DeMoUpdate.h1Per_IntLumi = MakeTH1("periodLuminosity","Period","Luminosity(pb-1)",-0.5,+0.5+periodNbYear,periodNbYear+1,1)

TO BE MODIFIED WHEN TH1 IS SAVED IN TPROFILE.ROOT.

Can be filled in a more logical way

Definition at line 769 of file DeMoUpdate.py.

◆ h1Run_IntLuminosity

DeMoUpdate.h1Run_IntLuminosity = MakeTH1("h1_IntLumi","Run","Integrated luminosity", -0.5,+0.5+len(runlist['toprocess']),len(runlist['toprocess'])+1,kBlack)

Definition at line 763 of file DeMoUpdate.py.

◆ help

DeMoUpdate.help

Definition at line 373 of file DeMoUpdate.py.

◆ hProfPeriod_archive

DeMoUpdate.hProfPeriod_archive = file.Get("%s_archive"%(profPeriodName))

Definition at line 710 of file DeMoUpdate.py.

◆ hProfPeriod_IntolDefect

dictionary DeMoUpdate.hProfPeriod_IntolDefect = {}

Definition at line 693 of file DeMoUpdate.py.

◆ hProfPeriod_Veto

dictionary DeMoUpdate.hProfPeriod_Veto = {}

Definition at line 694 of file DeMoUpdate.py.

◆ hProfRun_IntolDefect

dictionary DeMoUpdate.hProfRun_IntolDefect = {}

Book Histograms for general plot with intolerable defects/veto Fill them with past period inefficiencies.

Definition at line 689 of file DeMoUpdate.py.

◆ hProfRun_Veto

dictionary DeMoUpdate.hProfRun_Veto = {}

Definition at line 690 of file DeMoUpdate.py.

◆ idefName

DeMoUpdate.idefName = idef.split("__")[0]

Definition at line 699 of file DeMoUpdate.py.

◆ int

DeMoUpdate.int

Definition at line 381 of file DeMoUpdate.py.

◆ irun_string

string DeMoUpdate.irun_string = "%d (%.0f ub-1)"%(irun,runinfo[irun]['Lumi'])

Definition at line 1295 of file DeMoUpdate.py.

◆ key

DeMoUpdate.key

Definition at line 563 of file DeMoUpdate.py.

◆ labels_col

list DeMoUpdate.labels_col = ["Run","Run start / stop","LB ready","Peak lumi","Filt. lumi","GRL ineff.","Veto ineff.","Period","Status"]

Definition at line 1125 of file DeMoUpdate.py.

◆ lb0

def DeMoUpdate.lb0 = findLB(v_lbTimeSt,totalVeto[veto["COOL"][iVeto]][iVetoedLB][0]/1e9)

Definition at line 1051 of file DeMoUpdate.py.

◆ lb1

def DeMoUpdate.lb1 = findLB(v_lbTimeSt,totalVeto[veto["COOL"][iVeto]][iVetoedLB][0]/1e9)

Definition at line 1052 of file DeMoUpdate.py.

◆ lbAffected

dictionary DeMoUpdate.lbAffected = {}

Initialize total luminosity affected per defect for all runs.

Main loop over selected runs

Definition at line 811 of file DeMoUpdate.py.

◆ legendResults

dictionary DeMoUpdate.legendResults = {}

Definition at line 1202 of file DeMoUpdate.py.

◆ lineNb

dictionary DeMoUpdate.lineNb = {}

Treatment when a run range was considered (weekly report)

Definition at line 1109 of file DeMoUpdate.py.

◆ lumiacct

DeMoUpdate.lumiacct = fetch_iovs('COOLOFL_TRIGGER::/TRIGGER/OFLLUMI/LumiAccounting', tag=yearTagProperties["OflLumiAcct tag"], since=v_lbTimeSt[1][0]*1000000000, until=v_lbTimeSt[len(v_lbTimeSt)][1]*1000000000)

Definition at line 884 of file DeMoUpdate.py.

◆ nargs

DeMoUpdate.nargs

Definition at line 381 of file DeMoUpdate.py.

◆ newCanvas

bool DeMoUpdate.newCanvas = True

Definition at line 1115 of file DeMoUpdate.py.

◆ newPeriodInYearStats

list DeMoUpdate.newPeriodInYearStats = []

Definition at line 611 of file DeMoUpdate.py.

◆ notYetSignedOff_TPave

DeMoUpdate.notYetSignedOff_TPave = TPaveText(xlow_col[0],0.01,xlow_col[len(labels_col)],ylowTable)

Definition at line 1136 of file DeMoUpdate.py.

◆ notYetSignedOffRuns

DeMoUpdate.notYetSignedOffRuns = open('%s/runs-notYetSignedOff.dat'%options['yearStatsDir'],'w')

Definition at line 539 of file DeMoUpdate.py.

◆ oldRunsNotYetignedOff

list DeMoUpdate.oldRunsNotYetignedOff = []

Definition at line 556 of file DeMoUpdate.py.

◆ oneWeek

int DeMoUpdate.oneWeek = 7*24*3600

Definition at line 562 of file DeMoUpdate.py.

◆ options

DeMoUpdate.options = {}

Definition at line 408 of file DeMoUpdate.py.

◆ parsedDefects

def DeMoUpdate.parsedDefects = retrieveDefectsFromDB(runNb, options['defectTag'], grlDef,signOff)

Definition at line 920 of file DeMoUpdate.py.

◆ parser

DeMoUpdate.parser = ArgumentParser(description='',formatter_class=RawTextHelpFormatter)

Definition at line 371 of file DeMoUpdate.py.

◆ partAffected

DeMoUpdate.partAffected

Definition at line 946 of file DeMoUpdate.py.

◆ partitions

dictionary DeMoUpdate.partitions = {}

Definition at line 410 of file DeMoUpdate.py.

◆ passfile

DeMoUpdate.passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")

Definition at line 45 of file DeMoUpdate.py.

◆ passwd

DeMoUpdate.passwd = passfile.read().strip(); passfile.close()

Definition at line 46 of file DeMoUpdate.py.

◆ periodFileName

string DeMoUpdate.periodFileName = "%s/runs-%s.dat"%(options['yearStatsDir'],iper)

Definition at line 637 of file DeMoUpdate.py.

◆ periodListCurrent

dictionary DeMoUpdate.periodListCurrent = {}

Definition at line 610 of file DeMoUpdate.py.

◆ periodListYear

list DeMoUpdate.periodListYear = []

Definition at line 706 of file DeMoUpdate.py.

◆ periodNbYear

DeMoUpdate.periodNbYear = len(periodListYear)

Definition at line 719 of file DeMoUpdate.py.

◆ periodToBeAdded

bool DeMoUpdate.periodToBeAdded = False

Definition at line 648 of file DeMoUpdate.py.

◆ profPeriodName

string DeMoUpdate.profPeriodName = "hProfPeriod_IntolDefect_%s"%(idef)

Definition at line 707 of file DeMoUpdate.py.

◆ retrievedDefects

DeMoUpdate.retrievedDefects = defectDatabase.retrieve((runNb, 1), (runNb, runinfo[runNb]['nLB']), grlDef["globalFilterDefects"])

Definition at line 841 of file DeMoUpdate.py.

◆ reverse

DeMoUpdate.reverse

Definition at line 563 of file DeMoUpdate.py.

◆ roughVetoFilename

string DeMoUpdate.roughVetoFilename = runListDir+"/%s/%s/roughVeto-%s.dat"%(options['system'],options['year'],options['year'])

Definition at line 489 of file DeMoUpdate.py.

◆ runinfo

def DeMoUpdate.runinfo = getRunInfo(runlist['primary'],options['defectTag'])

Definition at line 542 of file DeMoUpdate.py.

◆ runlist

dictionary DeMoUpdate.runlist = {'filename':"",'primary':[],'toprocess':[],'weeklyfile':[],'weekly-dqmeeting':"",'roughVeto':[]}

Definition at line 415 of file DeMoUpdate.py.

◆ runListDir

string DeMoUpdate.runListDir = "./YearStats-common"

Definition at line 50 of file DeMoUpdate.py.

◆ runListFilename

string DeMoUpdate.runListFilename = "%s/%s/%s"%(runListDir,options['year'],runlist['filename'])

Definition at line 474 of file DeMoUpdate.py.

◆ signOff

dictionary DeMoUpdate.signOff = {}

Definition at line 414 of file DeMoUpdate.py.

◆ signOffTime

DeMoUpdate.signOffTime = 0

Definition at line 576 of file DeMoUpdate.py.

◆ stackResults

dictionary DeMoUpdate.stackResults = {}

Definition at line 1203 of file DeMoUpdate.py.

◆ startrun

dictionary DeMoUpdate.startrun = 0

Definition at line 462 of file DeMoUpdate.py.

◆ statuses

list DeMoUpdate.statuses = [ runinfo[run]["signoffDefects"][d]["status"] for d in defects ]

Definition at line 568 of file DeMoUpdate.py.

◆ thisRunPerLB

DeMoUpdate.thisRunPerLB = dict()

Definition at line 867 of file DeMoUpdate.py.

◆ tmp

string DeMoUpdate.tmp = "Old runs (> 7 days) not yet signed off: "

Definition at line 1167 of file DeMoUpdate.py.

◆ tmp2

string DeMoUpdate.tmp2 = ""

Definition at line 1168 of file DeMoUpdate.py.

◆ toAdd

bool DeMoUpdate.toAdd = True

Definition at line 1304 of file DeMoUpdate.py.

◆ tokenName

string DeMoUpdate.tokenName = "DeMo-%s-%s-%s.token"%(options['system'],options['year'],options['tag'])

Definition at line 452 of file DeMoUpdate.py.

◆ totalVeto

DeMoUpdate.totalVeto = showEventVeto.showEventVetoFolder(db2,folderName,options['vetoTag'],runNb,runNb,0)

Definition at line 1036 of file DeMoUpdate.py.

◆ type

DeMoUpdate.type

Definition at line 381 of file DeMoUpdate.py.

◆ v_lbTimeSt

DeMoUpdate.v_lbTimeSt = GetLBTimeStamps(runNb)

Definition at line 828 of file DeMoUpdate.py.

◆ veto

dictionary DeMoUpdate.veto = {}

Definition at line 413 of file DeMoUpdate.py.

◆ vetoFileName

string DeMoUpdate.vetoFileName = "%s/loss-%sVETO.dat"%(options['yearStatsDir'],iVeto)

Definition at line 1318 of file DeMoUpdate.py.

◆ vetoString

string DeMoUpdate.vetoString = "%s -> %.6f pb-1 \n"%(irun_string,runinfo[irun]["lumiVeto_%s"%(iVeto)]/1e6)

Definition at line 1319 of file DeMoUpdate.py.

◆ weeklyFile

DeMoUpdate.weeklyFile = open("%s/%s/runlist-weekly.dat"%(runListDir,options['year']),'r')

Definition at line 586 of file DeMoUpdate.py.

◆ xlow_col

list DeMoUpdate.xlow_col = [0.01,0.075,0.405,0.485,0.57,0.65,0.735,0.83,0.89,0.99]

Definition at line 1126 of file DeMoUpdate.py.

◆ year

DeMoUpdate.year

Definition at line 418 of file DeMoUpdate.py.

◆ yearStatsArchiveFilename

string DeMoUpdate.yearStatsArchiveFilename = '%s/TProfiles.root'%options['yearStatsDir']

Definition at line 503 of file DeMoUpdate.py.

◆ yearTagProperties

DeMoUpdate.yearTagProperties = {}

Definition at line 409 of file DeMoUpdate.py.

◆ ylowTable

float DeMoUpdate.ylowTable = 0.99 - 0.98/(len(runlist['toprocess'])+6)*(len(runlist['toprocess'])+2)

Definition at line 1127 of file DeMoUpdate.py.

max
#define max(a, b)
Definition: cfImp.cxx:41
DeMoUpdate.printProp
def printProp(varname)
Definition: DeMoUpdate.py:60
DeMoUpdate.sort_period
def sort_period(text)
Ancillary functions.
Definition: DeMoUpdate.py:55
DeMoUpdate.findLB
def findLB(lbts, startOfVetoPeriod)
Definition: DeMoUpdate.py:85
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
DeMoUpdate.getRunInfo
def getRunInfo(runlist, defectTag="HEAD")
Retrieval of run characteristics.
Definition: DeMoUpdate.py:314
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
DeMoUpdate.singleRunReport
def singleRunReport(runNumber, dict1, dict2, directory, defects, veto, exactVetoComput)
Definition: DeMoUpdate.py:101
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
DeMoUpdate.int
int
Definition: DeMoUpdate.py:381
DeMoUpdate.printBoth
def printBoth(string0, boolean, f)
Functions dedicated to output printing.
Definition: DeMoUpdate.py:94
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
DeMoUpdate.listify
def listify(l)
Definition: DeMoUpdate.py:67
DeMoLib.strLumi
def strLumi(lumi, unit="ub", latex=True, floatNumber=False)
Return a string with the luminosity in a human readable way If the unit is %%, this is a percentage.
Definition: DeMoLib.py:86
DeMoUpdate.retrieveDefectsFromDB
def retrieveDefectsFromDB(run, defectTag, grlDef, signOffDefects)
Definition: DeMoUpdate.py:262
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67
DeMoUpdate.extractNamePartition
def extractNamePartition(foundDefect)
Functions dedicated to defect retrieval and basic string manipulations.
Definition: DeMoUpdate.py:141
DeMoUpdate.updateRunList
def updateRunList(year=time.localtime().tm_year)
Retrieval of new runs not yet in YearStats-common/runlist-[year]-AtlasReady.dat.
Definition: DeMoUpdate.py:281