41 def timeof(run,lumisection):
43 if run
not in runlstime.keys():
44 print(
"Reading lumi time from lumireg localcopy files")
45 filename=
"localcopy/BeamFitResults_Run"+run+
".txt" 46 if not os.path.exists(filename):
47 print(
"WARNING: file ",filename,
" does not exist. Returning null.")
52 in_file = open(filename)
53 pieces = paragraphs(in_file,start_of_new_beamspot_measurement,
True)
58 tmp = BeamspotMeasurement(piece)
59 except Exception
as err:
60 print(
" ERROR Found corrupt " \
61 "beamspot measurement entry!", file=sys.stderr)
62 print(
" !!! %s !!!" %
str(err), file=sys.stderr)
65 runfromfile=tmp.run_number
66 (lumimin,lumimax)=tmp.lumi_range
67 time_begin=tmp.time_begin
69 time_begin=calendar.timegm(time_begin.timetuple())
70 time_end=calendar.timegm(time_end.timetuple())-23
71 lstime[lumimin]=time_begin
72 lstime[lumimax]=time_end
75 lslist=sorted(lstime.keys())
78 lstimesorted.append((ls,lstime[ls]))
79 runlstime[run]=lstimesorted
91 lstimesorted=runlstime[run]
93 for pair
in lstimesorted:
95 if abs(lumisection-lumi)<dcloselumi:
96 dcloselumi=
abs(lumisection-lumi)
100 finaltime=closetime+(lumisection-closelumi)*23
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Abs< T >::type abs(const T &t)
def timeof(run, lumisection)