ATLAS Offline Software
Loading...
Searching...
No Matches
python.CaloCondTools.CaloBlobReader Class Reference
Inheritance diagram for python.CaloCondTools.CaloBlobReader:
Collaboration diagram for python.CaloCondTools.CaloBlobReader:

Public Member Functions

 __init__ (self, db, folder, tag="")
 getCells (self, systemId, pointInTime)
 getDBobjsWithinRange (self, chan, point1inTime=(0, 0), point2inTime=(2147483647, 4294967295), printError=True)
 folderIsMultiVersion (self)

Private Attributes

 __db = db
 __folder = self.__db.getFolder(folder)
 __folderType = getAthenaFolderType(folderDescr)
 __tag = tag
dict __objDict = {}

Detailed Description

CaloBlobReader is a helper class, managing the details of COOL interactions

Definition at line 279 of file CaloCondTools.py.

Constructor & Destructor Documentation

◆ __init__()

python.CaloCondTools.CaloBlobReader.__init__ ( self,
db,
folder,
tag = "" )
Input:
- db    : db should be an open database connection 
- folder: full folder path
- tag   : The folder tag, e.g. \"000-00\"

Definition at line 285 of file CaloCondTools.py.

285 def __init__(self, db, folder, tag=""):
286 """
287 Input:
288 - db : db should be an open database connection
289 - folder: full folder path
290 - tag : The folder tag, e.g. \"000-00\"
291 """
292 #=== initialize base class
293 CaloCondLogger.__init__(self,"CaloBlobReader")
294
295 #=== try to open db
296 try:
297 self.__db = db
298 self.__folder = self.__db.getFolder(folder)
299 except Exception as e:
300 self.log().critical( e )
301 raise
302
303 #=== determine if "run-lumi" or "time" folder
304 validFolderTypes = ("run-lumi","time")
305 folderDescr = self.__folder.description()
306 self.__folderType = getAthenaFolderType(folderDescr)
307 if self.__folderType not in validFolderTypes:
308 raise Exception("Invalid folder type found: \'%s\'" % self.__folderType)
309
310 #=== use camelized full folder path only if tag is given
311 self.__tag = tag
312
313 #=== initialize dictionary to keep reference to DB object
314 #=== and timestamp, so they do not go out of scope
315 self.__objDict = {}
316
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91

Member Function Documentation

◆ folderIsMultiVersion()

python.CaloCondTools.CaloBlobReader.folderIsMultiVersion ( self)
Returns true if MultiVersion folder is connected

Definition at line 373 of file CaloCondTools.py.

373 def folderIsMultiVersion(self):
374 """
375 Returns true if MultiVersion folder is connected
376 """
377 if self.__folder.versioningMode()==cool.FolderVersioning.MULTI_VERSION:
378 return True
379 else:
380 return False
381
382
383#======================================================================
384#===
385#=== CaloBlobWriter
386#===
387#======================================================================
388
389#
390#______________________________________________________________________

◆ getCells()

python.CaloCondTools.CaloBlobReader.getCells ( self,
systemId,
pointInTime )
Returns a CaloCondBlob object for the given system.

Definition at line 318 of file CaloCondTools.py.

318 def getCells(self, systemId, pointInTime):
319 """
320 Returns a CaloCondBlob object for the given system.
321 """
322
323 validityKey = getCoolValidityKey(pointInTime)
324 self.log().debug("Validity key is %s", validityKey)
325 try:
326 #=== Have we retrieved data previously?
327 key = (systemId,validityKey)
328 obj = self.__objDict.get(key)
329 #=== ... if not, get it from DB
330 if not obj:
331 channelId = cool.ChannelId(systemId)
332 obj = self.__folder.findObject(validityKey, channelId, self.__tag)
333 self.log().debug("Fetching from DB: %s", obj)
334 blob = obj.payload()[0]
335 self.log().debug("blob size: %d", blob.size())
336 #=== store object in dictionary
337 self.__objDict[key] = obj
338 #=== get blob
339 blob = obj.payload()[0]
340 self.log().debug("blob size: %d", blob.size())
341
342 #=== create CaloCondBlob object
343 flt = g.CaloCondBlobFlt.getInstance(blob)
344 return flt
345 except Exception as e:
346 self.log().error("Fetching of systemId=%i failed with exception %s",systemId,e)
347 return None
348
const bool debug
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ getDBobjsWithinRange()

python.CaloCondTools.CaloBlobReader.getDBobjsWithinRange ( self,
chan,
point1inTime = (0,0),
point2inTime = (2147483647,4294967295),
printError = True )
Returns all DB objects for the given COOL channel, within given validity range -- default: [0-Infinity)

Definition at line 350 of file CaloCondTools.py.

350 def getDBobjsWithinRange(self, chan, point1inTime=(0,0), point2inTime=(2147483647,4294967295), printError=True):
351 """
352 Returns all DB objects for the given COOL channel, within given validity range -- default: [0-Infinity)
353 """
354
355 validityKey1 = getCoolValidityKey(point1inTime,True)
356 validityKey2 = getCoolValidityKey(point2inTime,False)
357
358 #print "Validity keys range is %s - %s" % (validityKey1, validityKey2)
359 self.log().debug("Validity key range is %s - %s", validityKey1,validityKey2)
360
361 objs = None
362 try:
363 dbChanSel = cool.ChannelSelection(chan)
364 #self.log().debug("Fetching blobs from DB: %s" % obj)
365 objs = self.__folder.browseObjects(validityKey1,validityKey2,dbChanSel,self.__tag)
366 except Exception as e:
367 if printError:
368 self.log().error("CaloCondTools.getDBobjsWithinRange(): Fetching of COOL_chan=%i failed with exception %s", chan,e)
369
370 return objs
371

Member Data Documentation

◆ __db

python.CaloCondTools.CaloBlobReader.__db = db
private

Definition at line 297 of file CaloCondTools.py.

◆ __folder

python.CaloCondTools.CaloBlobReader.__folder = self.__db.getFolder(folder)
private

Definition at line 298 of file CaloCondTools.py.

◆ __folderType

python.CaloCondTools.CaloBlobReader.__folderType = getAthenaFolderType(folderDescr)
private

Definition at line 306 of file CaloCondTools.py.

◆ __objDict

dict python.CaloCondTools.CaloBlobReader.__objDict = {}
private

Definition at line 315 of file CaloCondTools.py.

◆ __tag

python.CaloCondTools.CaloBlobReader.__tag = tag
private

Definition at line 311 of file CaloCondTools.py.


The documentation for this class was generated from the following file: