Definition at line 17 of file RunLumiTime.py.
◆ __init__()
def RunLumiTime.RunLumiTime.__init__ |
( |
|
self | ) |
|
Definition at line 19 of file RunLumiTime.py.
22 self.onlLumiDB =
'COOLONL_TRIGGER/CONDBR2'
25 self.onlLBLBFolder =
'/TRIGGER/LUMI/LBLB'
31 args = self.parseArgs()
34 self.verbose = args.verbose
37 self.outFile = args.outfile
40 self.runList = args.runlist
42 print(f
"Finished parsing run list: {', '.join([str(run) for run in self.runList])}")
◆ __del__()
def RunLumiTime.RunLumiTime.__del__ |
( |
|
self | ) |
|
◆ __enter__()
def RunLumiTime.RunLumiTime.__enter__ |
( |
|
self | ) |
|
Definition at line 44 of file RunLumiTime.py.
46 self.dbHandler = LumiDBHandler()
◆ __exit__()
def RunLumiTime.RunLumiTime.__exit__ |
( |
|
self, |
|
|
|
exc_type, |
|
|
|
exc_value, |
|
|
|
exc_traceback |
|
) |
| |
Definition at line 49 of file RunLumiTime.py.
49 def __exit__(self, exc_type, exc_value, exc_traceback):
◆ closeDb()
def RunLumiTime.RunLumiTime.closeDb |
( |
|
self | ) |
|
Definition at line 55 of file RunLumiTime.py.
56 if self.dbHandler
is not None:
57 self.dbHandler.closeAllDB()
◆ execute()
def RunLumiTime.RunLumiTime.execute |
( |
|
self | ) |
|
Definition at line 76 of file RunLumiTime.py.
78 if self.dbHandler
is None:
79 self.dbHandler = LumiDBHandler()
84 if self.outFile
is not None:
85 fp =
open(self.outFile,
'w')
87 if self.outFile.endswith(
".json"):
90 if self.outFile.endswith(
".csv"):
95 lblb = CoolDataReader(self.onlLumiDB, self.onlLBLBFolder)
98 for run
in self.runList:
100 lblb.setIOVRangeFromRun(run)
101 if not lblb.readData():
102 print(f
'RunLumiTime - No LBLB data found for run {run}!')
105 for obj
in lblb.data:
107 run = obj.since() >> 32
108 lb = obj.since() & 0xFFFFFFFF
110 startTime = obj.payload()[
'StartTime']
111 endTime = obj.payload()[
'EndTime']
113 if not run
in output:
117 "begin": startTime/1.e9,
121 entry = (run, lb, startTime/1.e9, endTime/1.e9)
122 separator =
',' if format==
'csv' else ' '
123 print(separator.join([
str(v)
for v
in entry]), file=fp)
127 json.dump(output, fp, indent=4)
132 print(f
"Wrote file {self.outFile}")
◆ parseArgs()
def RunLumiTime.RunLumiTime.parseArgs |
( |
|
self | ) |
|
Definition at line 59 of file RunLumiTime.py.
60 parser = ArgumentParser()
62 parser.add_argument(
"-v",
"--verbose",
63 action=
"store_true", dest=
"verbose",
64 help=
"turn on verbose output")
66 parser.add_argument(
"-r",
"--run", nargs=
'*', required=
True, type=int,
67 dest=
"runlist", metavar=
"RUN",
68 help=
"show specific run(s)")
70 parser.add_argument(
'-o',
'--output',
71 dest=
'outfile', metavar =
"FILE", default=
None, type=str,
72 help=
"write results to output file (default stdout). If filename ends in csv or json those formats are used.")
74 return parser.parse_args()
◆ dbHandler
RunLumiTime.RunLumiTime.dbHandler |
◆ onlLBLBFolder
RunLumiTime.RunLumiTime.onlLBLBFolder |
◆ onlLumiDB
RunLumiTime.RunLumiTime.onlLumiDB |
◆ outFile
RunLumiTime.RunLumiTime.outFile |
◆ runList
RunLumiTime.RunLumiTime.runList |
◆ verbose
RunLumiTime.RunLumiTime.verbose |
The documentation for this class was generated from the following file: