10 def main( runNum=None, projectName='' ):
12 print(
'ERROR no runNumber given')
16 print(
'ERROR no projectName given')
19 year=
int(projectName[4:6])
21 print(
'runInfo from python folder')
22 since = ( runNum << 32 )
23 until = ( (runNum+1) << 32 )-1
24 dbSvc = cool.DatabaseSvcFactory.databaseService()
27 if os.path.exists(
"/afs/cern.ch/work/s/sctcalib/CondReadPwd") :
28 pwdinfo =
open(
'/afs/cern.ch/work/s/sctcalib/CondReadPwd',
'r' ).
read()
29 pwdinfolist = pwdinfo.split(
' ' )
32 print(
'ERROR : unable to open pwd file')
36 RunCtrlDB =
'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=CONDBR2;user=ATLAS_COOL_READER;password='+pwd
38 RunCtrlDB =
'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=COMP200;user=ATLAS_COOL_READER;password='+pwd
41 RunCtrlDb = dbSvc.openDatabase( RunCtrlDB )
42 except Exception
as e:
43 print(
'Problem opening database', e)
46 folder_runCtrl = RunCtrlDb.getFolder(
'/TDAQ/RunCtrl/EOR' )
47 chList = folder_runCtrl.listChannels()
49 print(
'ERROR : no data in /TDAQ/RunCtrl/EOR')
53 objs = folder_runCtrl.browseObjects( since, until, cool.ChannelSelection(Id) )
57 RunNumber = payl[
'RunNumber' ]
58 SORTime = payl[
'SORTime' ]
59 EORTime = payl[
'EORTime' ]
60 iovstart = obj.since()
62 nLB = iovend - ( iovstart + 1 )
63 ProjectTag = payl[
'T0ProjectTag' ]
64 DetectorMask = payl[
'DetectorMask' ]
67 RunCtrlDb.closeDatabase()
69 ts1 = SORTime/1000000000
70 ts2 = EORTime/1000000000
73 mask= int (DetectorMask,16)
85 if ( mask & (1 << i) ) :
86 if "SCT BA" in dName[i] :
89 if "SCT BC" in dName[i] :
92 if "SCT EA" in dName[i] :
95 if "SCT EC" in dName[i] :
106 fw =
open(
'runInfo.txt',
'w' )
107 fw.write(
str(RunNumber) +
' ' +
str(ProjectTag) +
' ' +
str(ts1) +
' ' +
str(ts2) +
' ' +
str(nLB) +
' ' + res )