Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
python.CaloCondTools.CaloBlobReader Class Reference
Inheritance diagram for python.CaloCondTools.CaloBlobReader:
Collaboration diagram for python.CaloCondTools.CaloBlobReader:

Public Member Functions

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

Private Attributes

 __db
 
 __folder
 
 __folderType
 
 __tag
 
 __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__()

def 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 

Member Function Documentation

◆ folderIsMultiVersion()

def 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()

def 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 

◆ getDBobjsWithinRange()

def 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
private

Definition at line 297 of file CaloCondTools.py.

◆ __folder

python.CaloCondTools.CaloBlobReader.__folder
private

Definition at line 298 of file CaloCondTools.py.

◆ __folderType

python.CaloCondTools.CaloBlobReader.__folderType
private

Definition at line 306 of file CaloCondTools.py.

◆ __objDict

python.CaloCondTools.CaloBlobReader.__objDict
private

Definition at line 315 of file CaloCondTools.py.

◆ __tag

python.CaloCondTools.CaloBlobReader.__tag
private

Definition at line 311 of file CaloCondTools.py.


The documentation for this class was generated from the following file:
python.CaloCondTools.getAthenaFolderType
def getAthenaFolderType(folderDescr)
Definition: CaloCondTools.py:52
python.CaloCondTools.getCoolValidityKey
def getCoolValidityKey(pointInTime, isSince=True)
Definition: CaloCondTools.py:203
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
error
Definition: IImpactPoint3dEstimator.h:70
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88