ATLAS Offline Software
Loading...
Searching...
No Matches
python.LumiDBCache.LumiDBCache Class Reference
Collaboration diagram for python.LumiDBCache.LumiDBCache:

Public Member Functions

 __init__ (self, dbstr=None, folderstr=None)
 clearValidity (self)
 setValidity (self, obj)
 isValid (self, time)
 getPayload (self, time)

Public Attributes

 reader = CoolDataReader(dbstr, folderstr)
 validStartTime = cool.ValidityKeyMax
 validEndTime = cool.ValidityKeyMin
 payload = None

Detailed Description

Definition at line 17 of file LumiDBCache.py.

Constructor & Destructor Documentation

◆ __init__()

python.LumiDBCache.LumiDBCache.__init__ ( self,
dbstr = None,
folderstr = None )

Definition at line 19 of file LumiDBCache.py.

19 def __init__(self, dbstr=None, folderstr=None):
20
21 self.reader = CoolDataReader(dbstr, folderstr)
22 self.clearValidity()
23

Member Function Documentation

◆ clearValidity()

python.LumiDBCache.LumiDBCache.clearValidity ( self)

Definition at line 24 of file LumiDBCache.py.

24 def clearValidity(self):
25
26 self.validStartTime = cool.ValidityKeyMax
27 self.validEndTime = cool.ValidityKeyMin
28 self.payload = None
29

◆ getPayload()

python.LumiDBCache.LumiDBCache.getPayload ( self,
time )

Definition at line 38 of file LumiDBCache.py.

38 def getPayload(self, time):
39
40 # Is existing version valid?
41 if self.isValid(time):
42 return self.payload
43
44 # Nope, invalidate cache
45 self.clearValidity()
46
47 # Check if we already have the pre-fetched in the reader
48 for obj in self.reader.data:
49 if not obj.since() <= time < obj.until(): continue
50 self.setValidity(obj)
51
52 # Did we find it?
53 if self.isValid(time):
54 return self.payload
55
56 # Guess not, try reading directly from DB
57 self.reader.setIOVRange(time, time)
58 self.reader.readData()
59
60 # Try once more to find the object
61 for obj in self.reader.data:
62 if not obj.since() <= time < obj.until(): continue
63 self.setValidity(obj)
64
65 # Did we find it?
66 if self.isValid(time):
67 return self.payload
68
69 return None
70

◆ isValid()

python.LumiDBCache.LumiDBCache.isValid ( self,
time )

Definition at line 35 of file LumiDBCache.py.

35 def isValid(self, time):
36 return (self.validStartTime <= time < self.validEndTime)
37
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878

◆ setValidity()

python.LumiDBCache.LumiDBCache.setValidity ( self,
obj )

Definition at line 30 of file LumiDBCache.py.

30 def setValidity(self, obj):
31 self.validStartTime = obj.since()
32 self.validEndTime = obj.until()
33 self.payload = obj.payload()
34

Member Data Documentation

◆ payload

python.LumiDBCache.LumiDBCache.payload = None

Definition at line 28 of file LumiDBCache.py.

◆ reader

python.LumiDBCache.LumiDBCache.reader = CoolDataReader(dbstr, folderstr)

Definition at line 21 of file LumiDBCache.py.

◆ validEndTime

python.LumiDBCache.LumiDBCache.validEndTime = cool.ValidityKeyMin

Definition at line 27 of file LumiDBCache.py.

◆ validStartTime

python.LumiDBCache.LumiDBCache.validStartTime = cool.ValidityKeyMax

Definition at line 26 of file LumiDBCache.py.


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