8 from PyCool
import cool, coral
10 from CoolRunQuery.utils.AtlRunQueryLookup
import InitDetectorMaskDecoder
12 print 'Please use the runInfo script from python/runInfo.py!'
15 coolCherryPyRoot=
'http://coolcherrypy.cern.ch:8080/cooldb/ATLAS_COOLPROD/ATLAS_COOLONL_TDAQ/COMP200/TDAQ/RunCtrl/EOR_Params/timespan/'
18 since = ( runNum << 32 )
19 until = ( (runNum+1) << 32 )-1
20 return str(since)+
'-'+
str(until)
24 httpHeaders={
'Accept':
'text/xml'}
26 request=urllib2.Request(url,textData, httpHeaders)
27 u=urllib2.urlopen(request)
28 xmlDocString = u.read()
33 regex=
'<value name="'+valueName+
'">(.+)</value>'
34 m=re.search(regex,xmlString)
37 except AttributeError:
41 regex=
'<channel .+ since="(\d+)" until="(\d+)"'
42 m=re.search(regex,xmlString)
44 return long(m.group(1)), long(m.group(2))
45 except AttributeError:
51 print 'ERROR no runNumber given'
54 print 'runInfo from scripts folder'
60 nLB = iovend - ( iovstart + 1 )
64 ts1 = long(
extractValue(xmlString,
"SORTime"))/1000000000L
65 ts2 = long(
extractValue(xmlString,
"EORTime"))/1000000000L
67 mask=long(DetectorMask)
70 signatures={
"SCT BA":
"SCTBA,",
"SCT BC":
"SCTBC,",
"SCT EA":
"SCTEA,",
"SCT EC":
"SCTEC,"}
72 if ( mask & (1 << i) ) :
73 for k,v
in signatures.iteritems():
81 fw =
open(
'runInfo.txt',
'w' )
82 fw.write(
str(RunNumber) +
' ' +
str(ProjectTag) +
' ' +
str(ts1) +
' ' +
str(ts2) +
' ' +
str(nLB) +
' ' + res )
85 if __name__ ==
"__main__":
87 runNumber =
int( sys.argv[1] )
89 print "The run number could not be converted to int"
92 main(runNum = runNumber)