ATLAS Offline Software
Loading...
Searching...
No Matches
python.TimeStampToRunLumi Namespace Reference

Functions

 TimeStampToRunLumi (tmstmp, guard=1, dbInstance="CONDBR2")

Function Documentation

◆ TimeStampToRunLumi()

python.TimeStampToRunLumi.TimeStampToRunLumi ( tmstmp,
guard = 1,
dbInstance = "CONDBR2" )

Definition at line 3 of file TimeStampToRunLumi.py.

3def TimeStampToRunLumi(tmstmp,guard=1,dbInstance="CONDBR2"):
4 from PyCool import cool
5 from time import asctime,localtime
6 dbSvc = cool.DatabaseSvcFactory.databaseService()
7 db=dbSvc.openDatabase("COOLONL_TRIGGER/"+dbInstance)
8 folder=db.getFolder("/TRIGGER/LUMI/LBTIME")
9 range=guard*24*60*60*1e9 # 2 days in ns
10 t1=int(tmstmp-range)
11 t2=int(tmstmp+range)
12 itr=folder.browseObjects(t1,t2,cool.ChannelSelection.all())
13 while itr.goToNext():
14 obj=itr.currentRef()
15 #print ("Working on obj.until() =",asctime(localtime(obj.until()/1e9)) )
16 if obj.until()>tmstmp:
17 pl=obj.payload()
18 run=pl["Run"]
19 lb=pl["LumiBlock"]
20 print ("Found Run/Lumi [%i/%i] lasting from %s to %s" %\
21 (run,lb,asctime(localtime(obj.since()/1e9)),asctime(localtime(obj.until()/1e9))))
22 itr.close()
23 db.closeDatabase()
24 return (run,lb)
25 print ("WARNING: No run/lumi block found for time",asctime(localtime(tmstmp/1e9)),"in folder /TRIGGER/LUMI/LBTIME of DB COOLONL_TRIGGER/CONDBR2")
26 itr.close()
27 db.closeDatabase()
28 return None