10def main( runNum=None, projectName='' ):
11 if runNum is None:
12 print(
'ERROR no runNumber given')
13 sys.exit(-1)
14
15 if projectName == '':
16 print(
'ERROR no projectName given')
17 sys.exit(-1)
18
19 year=int(projectName[4:6])
20
21 print(
'runInfo from python folder')
22 since = ( runNum << 32 )
23 until = ( (runNum+1) << 32 )-1
24 dbSvc = cool.DatabaseSvcFactory.databaseService()
25
26
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( ' ' )
30 pwd = pwdinfolist[0]
31 else :
32 print(
'ERROR : unable to open pwd file')
33 sys.exit(-1)
34
35 if (year > 13):
36 RunCtrlDB = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=CONDBR2;user=ATLAS_COOL_READER;password='+pwd
37 else:
38 RunCtrlDB = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=COMP200;user=ATLAS_COOL_READER;password='+pwd
39
40 try:
41 RunCtrlDb = dbSvc.openDatabase( RunCtrlDB )
42 except Exception as e:
43 print(
'Problem opening database', e)
44 sys.exit(-1)
45
46 folder_runCtrl = RunCtrlDb.getFolder( '/TDAQ/RunCtrl/EOR' )
47 chList = folder_runCtrl.listChannels()
48 if not chList:
49 print(
'ERROR : no data in /TDAQ/RunCtrl/EOR')
50
51 for Id in chList:
52
53 objs = folder_runCtrl.browseObjects( since, until, cool.ChannelSelection(Id) )
54 for obj in objs:
55 payl = obj.payload()
56
57 RunNumber = payl[ 'RunNumber' ]
58 SORTime = payl[ 'SORTime' ]
59 EORTime = payl[ 'EORTime' ]
60 iovstart = obj.since()
61 iovend = obj.until()
62 nLB = iovend - ( iovstart + 1 )
63 ProjectTag = payl[ 'T0ProjectTag' ]
64 DetectorMask = payl[ 'DetectorMask' ]
65 objs.close()
66 break
67 RunCtrlDb.closeDatabase()
68
69 ts1 = SORTime/1000000000
70 ts2 = EORTime/1000000000
71
72
73 mask= int (DetectorMask,16)
74
75 if (year < 12):
76 dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 1 )
77 elif (year < 21):
78 dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 2 )
79 else:
80 dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 3 )
81
82 res=''
83 found = False
84 for i in range(64):
85 if ( mask & (1 << i) ) :
86 if "SCT BA" in dName[i] :
87 found = True
88 res += "SCTBA,"
89 if "SCT BC" in dName[i] :
90 found = True
91 res += "SCTBC,"
92 if "SCT EA" in dName[i] :
93 found = True
94 res += "SCTEA,"
95 if "SCT EC" in dName[i] :
96 found = True
97 res += "SCTEC,"
98
99 if found:
100 if len(res)>1:
101 res = res[:-1]
102 else:
103 res += 'NONE'
104
105
106 fw = open( 'runInfo.txt', 'w' )
107 fw.write( str(RunNumber) + ' ' + str(ProjectTag) + ' ' + str(ts1) + ' ' + str(ts2) + ' ' + str(nLB) + ' ' + res )
108 fw.close()
109
void print(char *figname, TCanvas *c1)
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)