ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
DetDescrCond
DetectorStatus
python
DetStatusCoolLib.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3
# DetStatusCoolLib.py
4
# python functions for dealing with detector status read from COOL
5
# Richard Hawkings, 22/10/07
6
7
from
PyCool
import
cool
8
from
CoolConvUtilities.AtlCoolLib
import
indirectOpen,RangeList
9
from
DetectorStatus.DetStatusLib
import
DetStatusReq
10
11
def
statusCutsToRange
(dbconn,foldername,since,until,tag,statusreq):
12
"""Return a RangeList giving the good IOV range corresponding to the
13
specified set of daetector status cuts, using the given DB and folder"""
14
range=RangeList(since,until)
15
reqs=DetStatusReq()
16
reqs.setFromString(statusreq)
17
folder=dbconn.getFolder(foldername)
18
# loop over all requested status cuts
19
for (ichan,req) in reqs.getDict().items():
20
itr=folder.browseObjects(since,until,cool.ChannelSelection(ichan),tag)
21
lastiov=since
22
while itr.goToNext():
23
obj=itr.currentRef()
24
status=obj.payload()['Code']
25
if (lastiov<obj.since()):
26
# veto gaps where no status data was provided - assume bad
27
range.vetoRange(lastiov,obj.since())
28
if (status<req):
29
range.vetoRange(obj.since(),obj.until())
30
lastiov=obj.until()
31
# veto final gap (if any)
32
range.vetoRange(lastiov,until)
33
itr.close()
34
return range
35
36
def testStatusCutsToRange():
37
dbconn=indirectOpen('COOLOFL_GLOBAL/COMP200')
38
statusCutsToRange(dbconn,'/GLOBAL/DETSTATUS/LBSUMM',0,cool.ValidityKeyMax,'TRTB 3')
39
40
if __name__=='__main__':
41
testStatusCutsToRange()
python.DetStatusCoolLib.statusCutsToRange
statusCutsToRange(dbconn, foldername, since, until, tag, statusreq)
Definition
DetStatusCoolLib.py:11
Generated on
for ATLAS Offline Software by
1.17.0