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

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self)
 cmpBN (self, a, b)
 isInInterval (self, point, interval)
 add (self, key, value, interval)
 dump (self)
 get (self, key, point)

Static Protected Attributes

dict _iovs = {}
dict _cached = {}

Detailed Description

Definition at line 10 of file EI_Lib.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.EI_Lib.IOV.__init__ ( self)

Definition at line 15 of file EI_Lib.py.

15 def __init__(self):
16 pass
17

Member Function Documentation

◆ add()

python.EI_Lib.IOV.add ( self,
key,
value,
interval )

Definition at line 55 of file EI_Lib.py.

55 def add(self, key, value, interval):
56 if key not in self._iovs:
57 self._iovs[key] = []
58
59 try:
60 if len(interval) != 4:
61 raise TypeError("interval must contain 4 elements")
62 except Exception:
63 raise TypeError("interval must be a tuple or list")
64
65 try:
66 # convert interval into ints to prevent lexicographic comparison
67 interval2 = []
68 for number in interval:
69 interval2.append(int(number))
70 except Exception:
71 raise TypeError("interval ranges must be a integers or longs")
72
73 self._iovs[key].append((interval2, value))
74
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55

◆ cmpBN()

python.EI_Lib.IOV.cmpBN ( self,
a,
b )

Definition at line 18 of file EI_Lib.py.

18 def cmpBN(self, a, b):
19
20 # compare a and b and return -1,0,1 if a is <,=,> than b
21 # a (and b) are represented as a pair of numbers
22 # (most significant part, least significant part)
23
24 try:
25 (r, e) = a
26 (r1, e1) = b
27 except Exception:
28 raise TypeError("element must be a tuple with two components")
29
30 c = cmp(r, r1) # compare most significant part
31 if c == 0:
32 c = cmp(e, e1) # if equal, compare least significant part
33
34 return c
35

◆ dump()

python.EI_Lib.IOV.dump ( self)

Definition at line 75 of file EI_Lib.py.

75 def dump(self):
76 for k in self._iovs:
77 print(k)
78 for e in self._iovs[k]:
79 print(" ", e)
80
void print(char *figname, TCanvas *c1)
-event-from-file

◆ get()

python.EI_Lib.IOV.get ( self,
key,
point )

Definition at line 81 of file EI_Lib.py.

81 def get(self, key, point):
82 if key not in self._iovs:
83 return None
84 if key in self._cached:
85 i, v = self._cached[key]
86 if self.isInInterval(point, i):
87 return v
88 ivalues = self._iovs[key]
89 for i, v in ivalues:
90 if self.isInInterval(point, i):
91 self._cached[key] = (i, v)
92 return v
93 return None
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ isInInterval()

python.EI_Lib.IOV.isInInterval ( self,
point,
interval )

Definition at line 36 of file EI_Lib.py.

36 def isInInterval(self, point, interval):
37
38 try:
39 if len(interval) != 4:
40 raise TypeError("interval must contain 4 elements")
41 except Exception:
42 raise TypeError("interval must be a tuple or list")
43
44 # broke down the two parts of the interval
45
46 i1 = interval[:2]
47 i2 = interval[2:]
48
49 # look if point belongs to [i1,i2[
50 if self.cmpBN(point, i1) >= 0 and self.cmpBN(point, i2) < 0:
51 return True
52 else:
53 return False
54

Member Data Documentation

◆ _cached

dict python.EI_Lib.IOV._cached = {}
staticprotected

Definition at line 13 of file EI_Lib.py.

◆ _iovs

dict python.EI_Lib.IOV._iovs = {}
staticprotected

Definition at line 12 of file EI_Lib.py.


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