|
def | __init__ (self, useOracle=False, debug=True) |
|
def | __del__ (self) |
|
def | getRunStartTime (self, runnr) |
|
def | getLHCInfo (self, timeSinceEpochInSec) |
|
def | getRunEndTime (self, runnr) |
|
def | getLbTimes (self, runnr) |
|
def | lbTime (self, runnr, lbnr) |
|
def | getScanInfo (self, runnr) |
|
def | scanInfo (self, runnr, lbnr) |
|
Utility to query COOL to retrieve start and end time of run and LBs.
Definition at line 122 of file COOLUtils.py.
◆ __init__()
def python.COOLUtils.COOLQuery.__init__ |
( |
|
self, |
|
|
|
useOracle = False , |
|
|
|
debug = True |
|
) |
| |
Definition at line 124 of file COOLUtils.py.
124 def __init__(self,useOracle=False,debug=True):
126 self.tdaqdbname=
'COOLONL_TDAQ/CONDBR2'
127 self.coolpath=
'/TDAQ/RunCtrl'
128 self.coolScanPath=
'/TDAQ/OLC/LHC/SCANDATA'
130 self.trigdbname=
'COOLONL_TRIGGER/CONDBR2'
131 self.coollbpath=
'/TRIGGER/LUMI/LBLB'
133 self.dcsdbname =
'COOLOFL_DCS/CONDBR2'
134 self.coollhcpath =
'/LHC/DCS/FILLSTATE'
138 print (
'open cool db' )
139 self.cooldb = AtlCoolLib.indirectOpen(self.tdaqdbname,
True, self.debug)
140 print (
'open cooltrig db')
141 self.cooltrigdb = AtlCoolLib.indirectOpen(self.trigdbname,
True, self.debug)
142 print (
'open cooldcs db')
143 self.cooldcsdb = AtlCoolLib.indirectOpen(self.dcsdbname,
True, self.debug)
145 self.lbDictCache = {
'runnr':
None,
'lbDict':
None}
146 self.scanDictCache = {
'runnr':
None,
'scanDict':
None}
◆ __del__()
def python.COOLUtils.COOLQuery.__del__ |
( |
|
self | ) |
|
Definition at line 148 of file COOLUtils.py.
150 self.cooldb.closeDatabase()
151 self.cooltrigdb.closeDatabase()
152 self.cooldcsdb.closeDatabase()
154 print (
"DB time out -- ignore")
◆ getLbTimes()
def python.COOLUtils.COOLQuery.getLbTimes |
( |
|
self, |
|
|
|
runnr |
|
) |
| |
Get dict of LB start and end times in Unix time (seconds since epoch).
Definition at line 210 of file COOLUtils.py.
210 def getLbTimes(self,runnr):
211 """Get dict of LB start and end times in Unix time (seconds since epoch)."""
214 if (iov2>cool.ValidityKeyMax): iov2=cool.ValidityKeyMax
215 folderLB_Params = self.cooltrigdb.getFolder(self.coollbpath)
216 itr = folderLB_Params.browseObjects(iov1, iov2, cool.ChannelSelection.all())
218 while itr.goToNext():
219 obj = itr.currentRef()
222 lb = since & 0xFFFFFFFF
223 if (run != runnr):
continue
225 tlo = obj.payload()[
'StartTime']
226 thi = obj.payload()[
'EndTime']
◆ getLHCInfo()
def python.COOLUtils.COOLQuery.getLHCInfo |
( |
|
self, |
|
|
|
timeSinceEpochInSec |
|
) |
| |
Get LHC fill and other info from COOL. The relevant COOL folder,
/LHC/DCS/FILLSTATE is time-based, so the iov must be specified in
ns since the epoch, but the argument to getLHCInfo is s since the
epoch for convenience.
Definition at line 171 of file COOLUtils.py.
171 def getLHCInfo(self,timeSinceEpochInSec):
172 """Get LHC fill and other info from COOL. The relevant COOL folder,
173 /LHC/DCS/FILLSTATE is time-based, so the iov must be specified in
174 ns since the epoch, but the argument to getLHCInfo is s since the
175 epoch for convenience."""
176 t = timeSinceEpochInSec*1000000000
177 lhcfolder = self.cooldcsdb.getFolder(self.coollhcpath)
178 itr = lhcfolder.browseObjects(t,t,cool.ChannelSelection.all())
180 info = {
'FillNumber': 0,
181 'StableBeams':
False,
186 obj = itr.currentRef()
187 for k
in info.keys():
189 info[k] = obj.payload()[k]
191 print (
'WARNING: Cannot find value for',k)
◆ getRunEndTime()
def python.COOLUtils.COOLQuery.getRunEndTime |
( |
|
self, |
|
|
|
runnr |
|
) |
| |
Get end time of run in Unix time (seconds since epoch).
Definition at line 196 of file COOLUtils.py.
196 def getRunEndTime(self,runnr):
197 """Get end time of run in Unix time (seconds since epoch)."""
199 if (iov>cool.ValidityKeyMax): iov=cool.ValidityKeyMax
200 folderEOR_Params = self.cooldb.getFolder(self.coolpath+
'/EOR')
201 itr = folderEOR_Params.browseObjects(iov, iov, cool.ChannelSelection.all())
204 obj = itr.currentRef()
205 eorTime = obj.payload()[
'EORTime']
◆ getRunStartTime()
def python.COOLUtils.COOLQuery.getRunStartTime |
( |
|
self, |
|
|
|
runnr |
|
) |
| |
Get start time of run in Unix time (seconds since epoch).
Definition at line 156 of file COOLUtils.py.
156 def getRunStartTime(self,runnr):
157 """Get start time of run in Unix time (seconds since epoch)."""
159 if (iov>cool.ValidityKeyMax): iov=cool.ValidityKeyMax
160 folderSOR_Params = self.cooldb.getFolder(self.coolpath+
'/SOR')
161 itr = folderSOR_Params.browseObjects(iov, iov, cool.ChannelSelection.all())
164 obj = itr.currentRef()
165 sorTime = obj.payload()[
'SORTime']
◆ getScanInfo()
def python.COOLUtils.COOLQuery.getScanInfo |
( |
|
self, |
|
|
|
runnr |
|
) |
| |
Get dict of scan info
Definition at line 241 of file COOLUtils.py.
241 def getScanInfo(self,runnr):
242 """Get dict of scan info"""
243 iov1 = self.getRunStartTime(runnr)*1000000000
244 iov2 = self.getRunEndTime(runnr)*1000000000
245 if (iov2>cool.ValidityKeyMax): iov2=cool.ValidityKeyMax
246 folderScan_Params = self.cooldb.getFolder(self.coolScanPath)
247 itr = folderScan_Params.browseObjects(iov1, iov2, cool.ChannelSelection.all())
249 while itr.goToNext():
250 obj = itr.currentRef()
251 runLB = obj.payload()[
'RunLB']
253 if (run != runnr):
continue
254 lb = runLB & 0xFFFFFFFF
255 channelId = obj.channelId()
256 scanningIP = obj.payload()[
'ScanningIP']
258 mask = 1 << channelId
259 if(scanningIP & mask == 0):
continue
260 acquisitionFlag = obj.payload()[
'AcquisitionFlag']
261 nominalSeparation = obj.payload()[
'NominalSeparation']
262 nominalSeparationPlane = obj.payload()[
'NominalSeparationPlane']
263 B1DeltaXSet = obj.payload()[
'B1DeltaXSet']
264 B2DeltaXSet = obj.payload()[
'B2DeltaXSet']
265 B1DeltaYSet = obj.payload()[
'B1DeltaYSet']
266 B2DeltaYSet = obj.payload()[
'B2DeltaYSet']
267 scanDict[lb] = (scanningIP,acquisitionFlag,nominalSeparation,nominalSeparationPlane,B1DeltaXSet,B2DeltaXSet,B1DeltaYSet,B2DeltaYSet)
◆ lbTime()
def python.COOLUtils.COOLQuery.lbTime |
( |
|
self, |
|
|
|
runnr, |
|
|
|
lbnr |
|
) |
| |
Get (startTime,endTime) for a given LB. The LB information is cached
for the last run, in order make this efficient for querying for the
times of individual LBs.
Definition at line 230 of file COOLUtils.py.
230 def lbTime(self,runnr,lbnr):
231 """Get (startTime,endTime) for a given LB. The LB information is cached
232 for the last run, in order make this efficient for querying for the
233 times of individual LBs."""
235 if self.lbDictCache[
'runnr']!=runnr:
237 self.lbDictCache[
'lbDict'] = self.getLbTimes(runnr)
238 self.lbDictCache[
'runnr'] = runnr
239 return self.lbDictCache[
'lbDict'].
get(lbnr,
None)
◆ scanInfo()
def python.COOLUtils.COOLQuery.scanInfo |
( |
|
self, |
|
|
|
runnr, |
|
|
|
lbnr |
|
) |
| |
Get scan information for a given LB. The LB information is cached
for the last run, in order make this efficient for querying for the
times of individual LBs.
Definition at line 270 of file COOLUtils.py.
270 def scanInfo(self,runnr,lbnr):
271 """Get scan information for a given LB. The LB information is cached
272 for the last run, in order make this efficient for querying for the
273 times of individual LBs."""
275 if self.scanDictCache[
'runnr']!=runnr:
276 self.scanDictCache[
'scanDict'] = self.getScanInfo(runnr)
277 self.scanDictCache[
'runnr'] = runnr
278 return self.scanDictCache[
'scanDict'].
get(lbnr,
None)
◆ cooldb
python.COOLUtils.COOLQuery.cooldb |
◆ cooldcsdb
python.COOLUtils.COOLQuery.cooldcsdb |
◆ coollbpath
python.COOLUtils.COOLQuery.coollbpath |
◆ coollhcpath
python.COOLUtils.COOLQuery.coollhcpath |
◆ coolpath
python.COOLUtils.COOLQuery.coolpath |
◆ coolScanPath
python.COOLUtils.COOLQuery.coolScanPath |
◆ cooltrigdb
python.COOLUtils.COOLQuery.cooltrigdb |
◆ dcsdbname
python.COOLUtils.COOLQuery.dcsdbname |
◆ debug
python.COOLUtils.COOLQuery.debug |
◆ lbDictCache
python.COOLUtils.COOLQuery.lbDictCache |
◆ scanDictCache
python.COOLUtils.COOLQuery.scanDictCache |
◆ tdaqdbname
python.COOLUtils.COOLQuery.tdaqdbname |
◆ trigdbname
python.COOLUtils.COOLQuery.trigdbname |
The documentation for this class was generated from the following file: