Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DeMoGenerateWWW.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 # Author : Benjamin Trocme (CNRS/IN2P3 - LPSC Grenoble) - 2022 - 2023
4 #
5 # Script used to generate to https://atlasdqm.web.cern.ch/atlasdqm/DeMo/ webpage
6 #
7 # Documentation: https://twiki.cern.ch/twiki/bin/viewauth/Atlas/DataQualityDemo
8 
9 
10 import sys, socket, pathlib, errno, re, subprocess, os
11 import argparse
12 
13 from DeMoLib import retrieveYearTagProperties,returnPeriod
14 
15 maindir = "/eos/project/a/atlas-dataquality/www/DeMo/"
16 libdir = os.path.dirname(__file__)
17 
18 weeklyYear = "2024"
19 weeklyTag = "AtlasReady"
20 
21 global run3_yt
22 run3_yt = {"2022":["AtlasReady_BestLumi_HEAD","AtlasReady_BestLumi","GRL_M"],
23  "2023":["AtlasReady","GRL_summer"],
24  "2024":["AtlasReady"]}
25 
26 # run3_yt_description is retrieved from the DeMoConfig.dat files. See below
27 global run3_yt_description
28 run3_yt_description = {}
29 
30 global subsystems
31 subsystems = {"Inner detector":["Pixel","SCT","TRT"],
32  "Calorimeters":["LAr","Tile"],
33  "Muon":["RPC","MDT","TGC","CSC"],
34  "Trigger/Lumi/Global":["Trig_L1","Trig_HLT","Lumi","Global"],
35  "Forward": ["ALFA","AFP","LUCID","ZDC"],
36  "Combined perf.":["IDGlobal","BTag","CaloCP","MuonCP"]}
37 global subsystemName
38 subsystemName = {"Pixel":"Pixel",
39  "SCT":"SCT",
40  "TRT":"TRT",
41  "LAr":"LAr",
42  "Tile":"Tile",
43  "RPC":"RPC",
44  "MDT":"MDT",
45  "TGC":"TGC",
46  "CSC":"CSC",
47  "Trig_L1":"L1 trigger",
48  "Trig_HLT":"HLT trigger",
49  "Lumi":"Luminosity",
50  "Global":"Global",
51  "ALFA":"ALFA",
52  "AFP":"AFP",
53  "LUCID":"LUCID",
54  "ZDC":"ZDC",
55  "IDGlobal":"ID global",
56  "BTag":"Btagging",
57  "CaloCP":"Calorimeter combined",
58  "MuonCP":"Muon combined"}
59 
60 subsystemNotInRun2 = {}
61 subsystemNotInRun3 = ["CSC"]
62 
63 runListDir = "./YearStats-common"
64 
65 
68 def addLink(l):
69  htmlSplitted = l.split("https")
70 
71  if len(htmlSplitted)>1: # Url found -> Direct link added
72  urlAlreadyReplaced = []
73  for iUrl in range(1,len(htmlSplitted)):
74  url = "https%s"%(htmlSplitted[iUrl].split(" ")[0])
75  if (url not in urlAlreadyReplaced):
76  l = l.replace(url,'''<a href="%s" target="_blank"> %s </a>'''%(url,url))
77  urlAlreadyReplaced.append(url)
78 
79  return l
80 
81 
82 
83 def addHeader(page,year):
84 
85  run3 = (year != "Run2")
86 
87  page.write('''<!doctype html>\n''')
88  page.write('''<html lang=''>\n''')
89  page.write('''<head>\n''')
90  page.write(''' <meta charset='utf-8'>\n''')
91  page.write(''' <meta http-equiv="X-UA-Compatible" content="IE=edge">\n''')
92  page.write(''' <meta name="viewport" content="width=device-width, initial-scale=1">\n''')
93  page.write(''' <link rel="stylesheet" href="styles.css">\n''')
94  page.write(''' <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>\n''')
95  page.write(''' <script src="script.js"></script>\n''')
96  page.write(''' <title>DeMo outputs</title>\n''')
97  page.write('''</head> \n''')
98  page.write('''<body>\n''')
99 
100 
101  page.write('''<div id='cssmenu'>\n''')
102  page.write('''<ul>\n''')
103  if (year == "Run2"):
104  page.write(''' <li><a href='index-Run2.html'><span><b>Run 2</b></span></a></li>\n''')
105  else:
106  page.write(''' <li><a href='index-Run2.html'><span>Run 2</span></a></li>\n''')
107  for irun3_year in run3_yt.keys():
108  if (irun3_year == year):
109  page.write(''' <li><a href='index-%s.html'><span><b>%s</b></span></a></li>\n'''%(irun3_year,irun3_year))
110  else:
111  page.write(''' <li><a href='index-%s.html'><span>%s</span></a></li>\n'''%(irun3_year,irun3_year))
112  page.write('''</ul>\n''')
113  page.write('''</div>\n''')
114 
115 
116  page.write('''<div id='cssmenu'>\n''')
117  page.write('''<ul>\n''')
118 
119 
120  page.write(''' <li class='active has-sub'><a><span>Overview</span></a>\n''')
121  page.write(''' <ul>\n''')
122  if (run3):
123  if (year == weeklyYear):
124  page.write(''' <li><a href='Weekly.html'><span>Weekly</span></a></li>\n''')
125 
126  for iTag in run3_yt[year]:
127  page.write(''' <li><hr><a href='YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>\n'''%(year,iTag,run3_yt_description["%s_%s"%(year,iTag)]))
128  page.write(''' <li><a href='recapDefectsHighlights-%s-%s.html'><span>Defect highlights (beta) - %s </span></a></li>\n'''%(year,iTag,run3_yt_description["%s_%s"%(year,iTag)]))
129  else:
130  page.write(''' <li><a href='YearStats-2018-DQPaper_2018.html'><span>2018 overview - DQ Paper</span></a></li>\n''')
131  page.write(''' <li><a href='YearStats-2017-DQPaper_2017.html'><span>2017 overview - DQ Paper</span></a></li>\n''')
132  page.write(''' <li><a href='YearStats-2016-DQPaper_2016.html'><span>2016 overview - DQ Paper</span></a></li>\n''')
133  page.write(''' <li><a href='YearStats-2015-DQPaper_2015.html'><span>2015 overview - DQ Paper</span></a></li>\n''')
134 
135  page.write(''' </ul>\n''')
136  page.write(''' </li>\n''')
137 
138  for iSystem in subsystems.keys():
139  page.write(''' <li class='active has-sub'><a><span>%s</span></a>'''%iSystem)
140  page.write(''' <ul>\n''')
141 
142  for iSystem in subsystems[iSystem]:
143  if ((run3) and (iSystem not in subsystemNotInRun3)) or ((not run3) and (iSystem not in subsystemNotInRun2)):
144  page.write('''<li class='has-sub'><a ><span>%s</span></a>'''%subsystemName[iSystem])
145  page.write(''' <ul>\n''')
146  else:
147  continue
148 
149  if (run3) and (iSystem not in subsystemNotInRun3):
150  if (year == weeklyYear):
151  page.write(''' <li><a href='%s-Weekly.html'><span>Weekly</span></a></li>\n'''%(iSystem))
152  for iTag in run3_yt[year]:
153  page.write(''' <li><hr><a href='%s-YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>\n'''%(iSystem,year,iTag,run3_yt_description["%s_%s"%(year,iTag)]))
154  page.write(''' <li><a href='%s-recapDefects-%s-%s.html'><span>Defect recap - %s </span></a></li>\n'''%(iSystem,year,iTag,run3_yt_description["%s_%s"%(year,iTag)]))
155  elif (iSystem not in subsystemNotInRun2):
156  page.write(''' <li><hr><a href='%s-YearStats-DQPaper_.html'><span>Year stats - Run2</span></a></li>\n'''%(iSystem))
157  page.write(''' <li class='last'><a href='%s-recapDefects-DQPaper_.html'><span>Defect recap - Run2</span></a></li>\n'''%(iSystem))
158  page.write(''' </ul>\n''')
159  page.write('''</li>\n''')
160  page.write('''</ul>\n''')
161  page.write('''</li>\n''')
162 
163  page.write('''</ul>\n''')
164  page.write('''</div>\n''')
165 
166  page.write('''<br>\n''')
167 
168  return
169 
170 
171 def addFooter(page):
172  page.write('''<div style="text-align:left" class="rectangle">\n''')
173  page.write('''Link to the <a href="logs/DeMoCron.log"> cron job output </a> - Documentation available <a href="https://twiki.cern.ch/twiki/bin/view/Atlas/DataQualityDemo"> here </a> <br>\n''')
174  page.write('''Original developer: Benjamin Trocm&eacute (LPSC Grenoble) - Maintenance: Benjamin Trocm&eacute (LPSC Grenoble)\n''')
175  page.write('''</div></body>\n''')
176  page.write('''<html>\n''')
177  return
178 
179 
180 def addHeaderWeekly(page):
181  page.write('''<div style="text-align:left" class="rectangle">\n''')
182  page.write('''Considered dataset: <br>\n''')
183  page.write('''- all ATLAS-ready runs acquired in the last 7 days <br>\n''')
184  page.write('''- all ATLAS-ready runs fully signed off in the last 7 days <br>\n''')
185  page.write('''- all runs considered for the upcoming wednesday formal signoff (list available <a href="%s/%s/runlist-weekly.dat" target="_blank"> here </a>)<br>'''%(runListDir,weeklyYear))
186  page.write('''Plots updated daily at midnight<br>\n''')
187  page.write('''Status meaning (based on UNCHECKED defect status):<br>\n''')
188  page.write('''-EXPR. : no assessment yet<br>\n''')
189  page.write('''-BULK : express assessment completed<br>\n''')
190  page.write('''-DONE : express and bulk assessment completed (but no final signoff - relevant only for LAr)<br>\n''')
191  page.write('''-FINAL OK: assessment completed<br>\n''')
192  page.write('''The spade symbol after the status indicates that this run is supposed to be signed off at the upcoming DQ wednesday meeting <br>\n''')
193  page.write('''</div>\n''')
194  return
195 
196 
197 def addHeaderYearStatsRecap(page,year="",tag="",system="",type="YearStats"):
198  page.write('''<div style="text-align:left" class="rectangle">\n''')
199 
200  if (system != ""):
201  if (type == "YearStats"):
202  page.write('''<b>%s - %s</b> - Switch to the <a href="%s-recapDefects-%s-%s.html"> defect recap page</a><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)],system,year,tag))
203  else:
204  page.write('''<b>%s - %s</b> - Switch to the <a href="%s-YearStats-%s-%s.html"> year stats page</a><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)],system,year,tag))
205  else:
206  page.write('''<b>%s - %s</b><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)]))
207 
208  if "AtlasReady" in tag: # Year tag named AtlasReady are usually devoted to monitor all runs
209  page.write('''All runs with ATLAS ready considered.''')
210  if "GRL" in tag:
211  page.write('''List of runs derived from the <a href="https://twiki.cern.ch/twiki/bin/view/AtlasProtected/GoodRunListsForAnalysisRun3" target="_blank">GRL twiki </a>.''')
212  page.write('''<br> Direct link to the <a href="%s/%s/runlist-%s-%s.dat" target="_blank"> list. </a> <br>\n'''%(runListDir,year,year,tag))
213 
214  # Scan the DeMoLib.py file to extract the monitored defects and the database tags
215  DeMoLibFile = open("%s/DeMoLib.py"%libdir,"r")
216  offLumiTag = ""
217  offLumiAcctTag = ""
218  defectTag = ""
219  if (system != ""):
220  listOfDefects = {"partIntol":"","partTol":"","globIntol":"","globTol":""}
221 
222  for line in DeMoLibFile:
223  if (system != ""):
224  defectSearch = "%s system"%system
225  for iType in listOfDefects.keys():
226  if re.search(defectSearch, line) and iType in line:
227  listOfDefects[iType] = (((line.split(" = ")[1]).split("# %s system"%system)[0]).replace(" ","")).replace(",",", ")
228 
229  DeMoLibFile.close()
230 
231  if (system != ""):
232  page.write("<hr>")
233  page.write('''<b>Monitored defects </b><br>\n''')
234  if len(listOfDefects["globIntol"])>2:
235  page.write('''Global intolerable defects: %s <br>'''%listOfDefects["globIntol"])
236  if len(listOfDefects["partIntol"])>2:
237  page.write('''Partition intolerable defects: %s <br>'''%listOfDefects["partIntol"])
238  if len(listOfDefects["globTol"])>2:
239  page.write('''Global tolerable defects : %s <br>'''%listOfDefects["globTol"])
240  if len(listOfDefects["partTol"])>2:
241  page.write('''Partition tolerable defects : %s <br>'''%listOfDefects["partTol"])
242 
243  # Add the database tags
244  page.write('''<b>Database tags </b><br>\n''')
245  yearTagProperties = retrieveYearTagProperties(year,tag)
246  for iyt in yearTagProperties.keys():
247  if (iyt == "Defect tag") or (iyt == "OflLumi tag") or (iyt == "OflLumiAcct tag"):
248  page.write('''%s: %s <br>\n'''%(iyt,yearTagProperties[iyt]))
249  if (iyt == "Veto tag") and (system == "LAr"):
250  page.write('''%s: %s <br>\n'''%(iyt,yearTagProperties[iyt]))
251 
252  if (system != ""):
253  page.write('''<hr><a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - \n'''%(system,year,tag))
254  if (type == "YearStats"):
255  page.write('''<a href="YearStats-%s/%s/%s/daemon-grl.out" target="_blank"> daemon output </a> - \n'''%(system,year,tag))
256  else:
257  page.write('''<a href="YearStats-%s/%s/%s/daemon-grl.out" target="_blank"> daemon output </a> - \n'''%(system,year,tag))
258  # Add the time of the last reset
259  if (os.path.exists("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag))):
260  lastResetFile = open("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag),"r")
261  for iline in lastResetFile.readlines():
262  page.write("Last year-stats reset: %s"%iline)
263 
264  # Look for remaining tokens
265  p = subprocess.Popen("ls",stdout=subprocess.PIPE)
266  (output, err) = p.communicate()
267  remainingToken = ""
268  for iLine in (output.decode('ascii').split("\n")):
269  if (system != ""):
270  if "%s-%s-%s.token"%(system,year,tag) in iLine:
271  remainingToken = "%s<br>"%iLine
272  else:
273  if "%s-%s.token"%(year,tag) in iLine:
274  remainingToken = remainingToken + "%s<br>"%iLine
275  if remainingToken != "":
276  page.write('''<hr><b>Remaining tokens</b>\n''')
277  page.write('''<br>There are some remaining tokens in ~atlasdqm/w1/DeMo: %s <br> This may indicate a problem in processing. Please check the daemon ouputs...'''%remainingToken)
278 
279  if (system == ""):
280  page.write('''</div>\n''')
281  else:
282  page.write("<hr>\n")
283 
284  return
285 
286 
288  page.write('''<div style="text-align:left" class="rectangle">\n''')
289  page.write('''Considered dataset: all "stable beam" runs signed off.\n''')
290  page.write('''<br><a href='#2018' target='_self'> 2018 dataset </a>\n''')
291  page.write('''<br><a href='#2017' target='_self'> 2017 dataset </a>\n''')
292  page.write('''<br><a href='#2016' target='_self'> 2016 dataset </a>\n''')
293  page.write('''<br><a href='#2015' target='_self'> 2015 dataset </a>\n''')
294  page.write('''</div>\n''')
295  return
296 
297 
299 
300  for iYear in ["2015","2016","2017","2018"]:
301  page = open("%s/YearStats-%s-DQPaper_%s.html"%(maindir,iYear,iYear),"w")
302  addHeader(page,"Run2")
303  for iSystem in subsystemName.keys():
304  if (iSystem not in subsystemNotInRun2):
305  page.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%iSystem)
306  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iSystem,iYear,iYear))
307  if iSystem == "LAr":
308  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iSystem,iYear,iYear))
309  page.write('''</div>\n''')
310  addFooter(page)
311  page.close()
312 
313 
314  for iSystem in subsystemName.keys():
315  if (iSystem not in subsystemNotInRun3):
316  page = open("%s/%s-YearStats-DQPaper_.html"%(maindir,iSystem),"w")
317  addHeader(page,"Run2")
318  for iYear in ["2015","2016","2017","2018"]:
319  page.write('''<div style="text-align:left" class="rectangle"><b>%s</b>\n'''%(iYear))
320  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear))
321  if iSystem == "LAr":
322  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear))
323  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-lumi.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear))
324  page.write('''</div>\n''')
325  addFooter(page)
326  page.close()
327 
328 
329  for iSystem in subsystemName.keys():
330  if (iSystem not in subsystemNotInRun2):
331  page = open("%s/%s-recapDefects-DQPaper_.html"%(maindir,iSystem),"w")
332  addHeader(page,"Run2")
334  for iYear in ["2015","2016","2017","2018"]:
335  page.write('''<hr>\n''')
336  page.write('''<a id='%s'> %s dataset </a>\n'''%(iYear,iYear))
337  readFile = open("YearStats-%s/%s/DQPaper_%s/recapDefects.html"%(iSystem,iYear,iYear))
338  for line in readFile:
339  page.write(line)
340  addFooter(page)
341  page.close()
342 
343 
344 def createWeeklyOverview(weeklyYear,weeklyTag):
345  weekly = open("%s/Weekly.html"%maindir,"w")
346  addHeader(weekly,weeklyYear)
347  addHeaderWeekly(weekly)
348  for iSystem in subsystemName.keys():
349  if (iSystem not in subsystemNotInRun3):
350  weekly.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%subsystemName[iSystem])
351  weekly.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache"/></figure>\n'''%(iSystem,weeklyYear,weeklyTag))
352  weekly.write('''<a> Link to the <a href="%s-Weekly.html" > weekly plots.</a>\n'''%(iSystem))
353  weekly.write('''</div>\n''')
354  addFooter(weekly)
355  weekly.close()
356 
357 
358 def createWeeklySystem(weeklyYear,weeklyTag,system):
359  page = open("%s/%s-Weekly.html"%(maindir,system),"w")
360  addHeader(page,weeklyYear)
361  addHeaderWeekly(page)
362  page.write('''<div style="text-align:left" class="rectangle"><b>%s</b> - <a href="YearStats-%s/%s/%s/daemon-weekly.out" target="_blank"> Daemon output </a>\n'''%(subsystemName[system],system,weeklyYear,weeklyTag))
363  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/defects--Run--%s.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag,weeklyTag))
364  if system == "LAr" :
365  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/veto--Run--%s.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag,weeklyTag))
366  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/noiseBurst_veto_evol.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag))
367  page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag))
368  addFooter(page)
369  page.close()
370 
371 
372 def createYearStatsSystem(year,tag,system):
373  yearTag = "%s_%s"%(year,tag)
374  page = open("%s/%s-YearStats-%s-%s.html"%(maindir,system,year,tag),"w")
375  addHeader(page,year)
376  addHeaderYearStatsRecap(page,year,tag,system,"YearStats")
377  page.write('''<div style="text-align:left" class="rectangle"><figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /> </a></figure>\n'''%(system,year,tag,system,year,tag))
378  if system == "LAr" :
379  page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(system,year,tag,system,year,tag))
380  page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(system,year,tag,system,year,tag))
381  page.write('''</div>\n''')
382  page.write('''</div>\n''')
383  addFooter(page)
384  page.close()
385 
386 
388  yearTag = "%s_%s"%(year,tag)
389  page = open("%s/YearStats-%s-%s.html"%(maindir,year,tag),"w")
390  addHeader(page,year)
391  addHeaderYearStatsRecap(page,year,tag)
392 
393  page.write('''<div style="text-align:left" class="rectangle"> <b>ATLAS </b><br>\n''')
394  page.write('''Within each system, the overlaps between defects are treated.<br>\n''')
395  page.write('''For the ATLAS inefficiency, the overlaps between systems are treated.<br>\n''')
396  page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" alt="" width="750" content="no-cache" /></figure> </a>\n'''%(year,tag,year,tag))
397  page.write('''</div>\n''')
398 
399  for iSystem in subsystemName.keys():
400  if (iSystem not in subsystemNotInRun3):
401  page.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%subsystemName[iSystem])
402  page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(iSystem,year,tag,iSystem,year,tag))
403  page.write('''</div>\n''')
404 
405  addFooter(page)
406  page.close()
407 
408 
409 def createDefectRecapSystem(year,tag,system):
410  yearTag = "%s_%s"%(year,tag)
411  page = open("%s/%s-recapDefects-%s-%s.html"%(maindir,system,year,tag),"w")
412  addHeader(page,year)
413  addHeaderYearStatsRecap(page,year,tag,system,"Recap")
414  #page.write('''<div style="text-align:left" class="rectangle"><b>%s - %s</b> - <a href="YearStats-%s/%s/%s/daemon-recapDefects.out" target="_blank"> daemon output </a> - <a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - Switch to the <a href="%s-YearStats-%s-%s.html"> year stats page</a> </div>\n'''%(year,run3_yt_description[tag],system,year,tag,system,year,tag,system,year,tag))
415 
416  if (os.path.exists("YearStats-%s/%s/%s/recapDefects.html"%(system,year,tag))):
417  readFile = open("YearStats-%s/%s/%s/recapDefects.html"%(system,year,tag))
418  for line in readFile: # NB: the recapDefects.html files contain a single line for the whole table.
419  page.write(addLink(line))
420 
421  page.write('''</div>\n''')
422  addFooter(page)
423  page.close()
424 
425 
427  yearTag = "%s_%s"%(year,tag)
428  page = open("%s/recapDefectsHighlights-%s-%s.html"%(maindir,year,tag),"w")
429  addHeader(page,year)
430  addHeaderYearStatsRecap(page,year,tag)
431 
432  defectsToKeep = {"Pixel":["DISABLED"],
433  "TRT":["DISABLED"],
434  "RPC":["DISABLED"],
435  "MDT":["DISABLED"],
436  "TGC":["DISABLED"],
437  "Global":["TOROID_OFF","NOTCONSIDERED"]
438  }
439 
440  runHighlights = {}
441 
442  for iSystem in subsystemName.keys():
443  if (iSystem in defectsToKeep.keys()) and (iSystem not in subsystemNotInRun3):
444  if (os.path.exists("YearStats-%s/%s/%s/recapDefects.txt"%(iSystem,year,tag))):
445  readFile = open("YearStats-%s/%s/%s/recapDefects.txt"%(iSystem,year,tag))
446 
447  currentDefect = ""
448  currentRun = ""
449 
450  for line in readFile:
451  if line.startswith("===== Recap for "):
452  currentDefect = ((line.split("===== Recap for ")[1]).split("===")[0]).replace(" ","")
453  elif line.startswith("Description:") or line.startswith(" Run") or (currentDefect not in defectsToKeep[iSystem]):
454  continue
455  else:
456  iovLine = line.split("|")
457  if (len(iovLine) == 8): # The defect to keep should be on a single line (i.e. not multiple iov in a given run)
458  runFound = iovLine[0]
459  if (runFound not in runHighlights.keys()):
460  runHighlights[runFound] = {}
461  runHighlights[runFound]["TotLumi"] = iovLine[2]
462  if (iovLine[3] == runHighlights[runFound]["TotLumi"]):
463  runHighlights[runFound][iSystem] = "<th>Whole run </th><th>%s : %s</th>"%(currentDefect,addLink(iovLine[7]))
464  else:
465  runHighlights[runFound][iSystem] = "<th>%s </th><th>%s : %s</th>"%(iovLine[3],currentDefect,addLink(iovLine[7]))
466 
467  page.write('''<div style="text-align:left" class="rectangle">''')
468 
469  page.write('''<table class="report"><tr class="out0"> <th width="100pix"></th><th width="100pix"></th><th width="100pix"></th><th width="150pix"></th><th width="100pix"></th></th><th width="1200pix"></th></tr>\n''')
470  page.write('''<tr class="out0"><th> Run </th><th> Period </th> <th> Total lumi </th><th> Affected system </th> <th> Lost lumi </th> <th> Comment </th> </tr> \n''')
471 
472  listOfRuns = list(runHighlights.keys())
473  listOfRuns.sort(reverse=True)
474 
475  for iRun in listOfRuns:
476  newRun = True
477  for iSystem in runHighlights[iRun].keys():
478  if iSystem == "TotLumi":
479  continue
480  if newRun:
481  page.write('''<tr class="out1"><th> %s </th> <th> %s </th> <th> %s </th> <th> %s </th> %s </tr> </tr>\n'''%(iRun,returnPeriod(int(iRun),"Pixel",year,"AtlasReady"),runHighlights[iRun]["TotLumi"],iSystem,runHighlights[iRun][iSystem]))
482  newRun = False
483  else:
484  page.write('''<tr class="out1"><th> </th> <th> </th> <th> </th> <th> %s </th> %s </tr></tr>\n'''%(iSystem,runHighlights[iRun][iSystem]))
485 
486  page.write('''</table>\n''')
487 
488 
489  page.write('''</div>''')
490  addFooter(page)
491  page.close()
492 
493 
494 
497 
498 parser = argparse.ArgumentParser(description='')
499 parser.add_argument('-y','--year',dest='parser_year',default = "2024",help='Year: Run2, 2022,2023...[Default: 2024].',action='store')
500 
501 args = parser.parse_args()
502 parser.print_help()
503 
504 year = args.parser_year
505 
506 # run3_yt_description is retrieved from the DeMoConfig.dat file
507 run3_yt_description = {}
508 for iYear in run3_yt.keys():
509  for iTag in run3_yt[iYear]:
510  DeMoConfigFile = open("%s/%s/DeMoConfig-%s-%s.dat"%(runListDir,iYear,iYear,iTag),"r")
511  for iline in DeMoConfigFile:
512  if "Description: " in iline:
513  run3_yt_description["%s_%s"%(iYear,iTag)] = (iline.split("Description: ")[1]).replace("\n","")
514 
515 homepage = open("%s/index-%s.html"%(maindir,year),"w")
516 addHeader(homepage,year)
517 addFooter(homepage)
518 homepage.close()
519 
520 if (year == "Run2"):
521 
523 else:
524 
525  createWeeklyOverview(weeklyYear,weeklyTag)
526 
527 
528  for iSystem in subsystemName.keys():
529  if iSystem not in subsystemNotInRun3:
530  createWeeklySystem(weeklyYear,weeklyTag,iSystem)
531 
532 
533  for iTag in run3_yt[year]:
534  createYearStatsOverview(year,iTag)
535 
536 
537  for iTag in run3_yt[year]:
538  for iSystem in subsystemName.keys():
539  if (iSystem not in subsystemNotInRun3):
540  createYearStatsSystem(year,iTag,iSystem)
541 
542 
543  for iTag in run3_yt[year]:
544  for iSystem in subsystemName.keys():
545  if (iSystem not in subsystemNotInRun3):
546  createDefectRecapSystem(year,iTag,iSystem)
547 
548 
549  for iTag in run3_yt[year]:
550  createDefectRecapHighlights(year,iTag)
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
DeMoGenerateWWW.addHeader
def addHeader(page, year)
Definition: DeMoGenerateWWW.py:83
DeMoGenerateWWW.createYearStatsOverview
def createYearStatsOverview(year, tag)
Definition: DeMoGenerateWWW.py:387
DeMoGenerateWWW.addFooter
def addFooter(page)
Definition: DeMoGenerateWWW.py:171
DeMoGenerateWWW.addLink
def addLink(l)
When https is found in a character line, add a link in html If none, simply return the line unchanged...
Definition: DeMoGenerateWWW.py:68
DeMoGenerateWWW.createDefectRecapHighlights
def createDefectRecapHighlights(year, tag)
Definition: DeMoGenerateWWW.py:426
DeMoGenerateWWW.createWeeklySystem
def createWeeklySystem(weeklyYear, weeklyTag, system)
Definition: DeMoGenerateWWW.py:358
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
DeMoGenerateWWW.addHeaderRun2RecapDefects
def addHeaderRun2RecapDefects(page)
Definition: DeMoGenerateWWW.py:287
DeMoLib.retrieveYearTagProperties
def retrieveYearTagProperties(year, tag)
Return the year/tag properties (defect/veto/lumi tags...) stored in YearStats-common/DeMoConfig-[year...
Definition: DeMoLib.py:68
DeMoGenerateWWW.addHeaderWeekly
def addHeaderWeekly(page)
Definition: DeMoGenerateWWW.py:180
DeMoGenerateWWW.createWeeklyOverview
def createWeeklyOverview(weeklyYear, weeklyTag)
Definition: DeMoGenerateWWW.py:344
Trk::open
@ open
Definition: BinningType.h:40
DeMoGenerateWWW.createRun2LegacyPages
def createRun2LegacyPages()
Definition: DeMoGenerateWWW.py:298
DeMoGenerateWWW.addHeaderYearStatsRecap
def addHeaderYearStatsRecap(page, year="", tag="", system="", type="YearStats")
Definition: DeMoGenerateWWW.py:197
DeMoLib.returnPeriod
def returnPeriod(runNb, system, year, tag)
Return the data period of a run based on the information stored in YearStats-[system]/[year]/[tag]/ru...
Definition: DeMoLib.py:56
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
DeMoGenerateWWW.createYearStatsSystem
def createYearStatsSystem(year, tag, system)
Definition: DeMoGenerateWWW.py:372
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
DeMoGenerateWWW.createDefectRecapSystem
def createDefectRecapSystem(year, tag, system)
Definition: DeMoGenerateWWW.py:409