ATLAS Offline Software
Functions
python.TimeStampToRunLumi Namespace Reference

Functions

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

Function Documentation

◆ TimeStampToRunLumi()

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

Definition at line 3 of file TimeStampToRunLumi.py.

3 def 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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.TimeStampToRunLumi.TimeStampToRunLumi
def TimeStampToRunLumi(tmstmp, guard=1, dbInstance="CONDBR2")
Definition: TimeStampToRunLumi.py:3