| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Private Attributes | List of all members
GaudiMP.pTools.HistoAgent Class Reference

## Public Member Functions
def | __init__ (self, gmpComponent)
def | register (self, tup)
def | Receive (self)
def | RebuildHistoStore (self)
def | bookDataObject (self, n, o)
def | bookTH1D (self, n, o)
def | bookTH2D (self, n, o)
def | bookTH3D (self, n, o)
def | bookTProfile (self, n, o)
def | bookTProfile2D (self, n, o)

## Public Attributes
| hvt
| histos
| qin
| log
| bookingDict

## Private Attributes
| _gmpc

## Detailed Description

Definition at line 51 of file pTools.py.

## Constructor & Destructor Documentation

def GaudiMP.pTools.HistoAgent.__init__ | ( |  | self,
|  |  | gmpComponent
| ) |  |

Definition at line 52 of file pTools.py.

52 def __init__(self, gmpComponent):
53 self._gmpc = gmpComponent
54 self.hvt = self._gmpc.hvt
55 self.histos = []
56 self.qin = self._gmpc.hq
57 self.log = self._gmpc.log
58
59 # There are many methods for booking Histogram Objects to Histo store
60 # here they are collected in a dictionary, with key = a relevant name
61 self.bookingDict = {}
62 self.bookingDict['DataObject'] = self.bookDataObject
63 self.bookingDict['NTuple::Directory'] = self.bookDataObject
64 self.bookingDict['NTuple::File'] = self.bookDataObject
65 self.bookingDict['TH1D'] = self.bookTH1D
66 self.bookingDict['TH2D'] = self.bookTH2D
67 self.bookingDict['TH3D'] = self.bookTH3D
68 self.bookingDict['TProfile'] = self.bookTProfile
69 self.bookingDict['TProfile2D'] = self.bookTProfile2D
70
GaudiMP.pTools.HistoAgent.bookingDict
bookingDict
Definition: pTools.py:61
GaudiMP.pTools.HistoAgent.bookTH2D
def bookTH2D(self, n, o)
Definition: pTools.py:154
GaudiMP.pTools.HistoAgent.bookTH1D
def bookTH1D(self, n, o)
Definition: pTools.py:144
GaudiMP.pTools.HistoAgent._gmpc
_gmpc
Definition: pTools.py:53
GaudiMP.pTools.HistoAgent.__init__
def __init__(self, gmpComponent)
Definition: pTools.py:52
GaudiMP.pTools.HistoAgent.bookTH3D
def bookTH3D(self, n, o)
Definition: pTools.py:167
GaudiMP.pTools.HistoAgent.hvt
hvt
Definition: pTools.py:54
GaudiMP.pTools.HistoAgent.qin
qin
Definition: pTools.py:56
GaudiMP.pTools.HistoAgent.histos
histos
Definition: pTools.py:55
GaudiMP.pTools.HistoAgent.bookTProfile
def bookTProfile(self, n, o)
Definition: pTools.py:183
GaudiMP.pTools.HistoAgent.bookDataObject
def bookDataObject(self, n, o)
Definition: pTools.py:138
GaudiMP.pTools.HistoAgent.log
log
Definition: pTools.py:57
GaudiMP.pTools.HistoAgent.bookTProfile2D
def bookTProfile2D(self, n, o)
Definition: pTools.py:194

## Member Function Documentation

def GaudiMP.pTools.HistoAgent.bookDataObject | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a DataObject to the Histo Store

Definition at line 138 of file pTools.py.

138 def bookDataObject(self, n, o):
139 '''
140 Register a DataObject to the Histo Store
141 '''
142 self._gmpc.hvt.registerObject(n, o)
143
GaudiMP.pTools.HistoAgent.bookDataObject
def bookDataObject(self, n, o)
Definition: pTools.py:138

def GaudiMP.pTools.HistoAgent.bookTH1D | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a ROOT 1D THisto to the Histo Store

Definition at line 144 of file pTools.py.

144 def bookTH1D(self, n, o):
145 '''
146 Register a ROOT 1D THisto to the Histo Store
147 '''
148 obj = self.hvt._ihs.book(n, o.GetTitle(),
149 o.GetXaxis().GetNbins(),
150 o.GetXaxis().GetXmin(),
151 o.GetXaxis().GetXmax())
152 aida2root(obj).Add(o)
153
GaudiMP.pTools.HistoAgent.bookTH1D
def bookTH1D(self, n, o)
Definition: pTools.py:144
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46

def GaudiMP.pTools.HistoAgent.bookTH2D | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a ROOT 2D THisto to the Histo Store

Definition at line 154 of file pTools.py.

154 def bookTH2D(self, n, o):
155 '''
156 Register a ROOT 2D THisto to the Histo Store
157 '''
158 obj = self.hvt._ihs.book(n, o.GetTitle(),
159 o.GetXaxis().GetNbins(),
160 o.GetXaxis().GetXmin(),
161 o.GetXaxis().GetXmax(),
162 o.GetYaxis().GetNbins(),
163 o.GetYaxis().GetXmin(),
164 o.GetYaxis().GetXmax())
165 aida2root(obj).Add(o)
166
GaudiMP.pTools.HistoAgent.bookTH2D
def bookTH2D(self, n, o)
Definition: pTools.py:154
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46

def GaudiMP.pTools.HistoAgent.bookTH3D | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a ROOT 3D THisto to the Histo Store

Definition at line 167 of file pTools.py.

167 def bookTH3D(self, n, o):
168 '''
169 Register a ROOT 3D THisto to the Histo Store
170 '''
171 obj = self.hvt._ihs.book(n, o.GetTitle(),
172 o.GetXaxis().GetXbins(),
173 o.GetXaxis().GetXmin(),
174 o.GetXaxis().GetXmax(),
175 o.GetYaxis().GetXbins(),
176 o.GetYaxis().GetXmin(),
177 o.GetYaxis().GetXmax(),
178 o.GetZaxis().GetXbins(),
179 o.GetZaxis().GetXmin(),
180 o.GetZaxis().GetXmax())
181 aida2root(obj).Add(o)
182
GaudiMP.pTools.HistoAgent.bookTH3D
def bookTH3D(self, n, o)
Definition: pTools.py:167
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46

def GaudiMP.pTools.HistoAgent.bookTProfile | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a ROOT TProfile to the Histo Store

Definition at line 183 of file pTools.py.

183 def bookTProfile(self, n, o):
184 '''
185 Register a ROOT TProfile to the Histo Store
186 '''
187 obj = self.hvt._ihs.bookProf(n, o.GetTitle(),
188 o.GetXaxis().GetNbins(),
189 o.GetXaxis().GetXmin(),
190 o.GetXaxis().GetXmax(),
191 o.GetOption())
192 aida2root(obj).Add(o)
193
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46
GaudiMP.pTools.HistoAgent.bookTProfile
def bookTProfile(self, n, o)
Definition: pTools.py:183

def GaudiMP.pTools.HistoAgent.bookTProfile2D | ( |  | self,
|  |  | n,
|  |  | o
| ) |  |

    Register a ROOT TProfile2D to the Histo Store

Definition at line 194 of file pTools.py.

194 def bookTProfile2D(self, n, o):
195 '''
196 Register a ROOT TProfile2D to the Histo Store
197 '''
198 obj = self.hvt._ihs.bookProf(n, o.GetTitle(),
199 o.GetXaxis().GetNbins(),
200 o.GetXaxis().GetXmin(),
201 o.GetXaxis().GetXmax(),
202 o.GetYaxis().GetNbins(),
203 o.GetYaxis().GetXmin(),
204 o.GetYaxis().GetXmax())
205 aida2root(obj).Add(o)
206
207 # =============================================================================
208
209
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46
GaudiMP.pTools.HistoAgent.bookTProfile2D
def bookTProfile2D(self, n, o)
Definition: pTools.py:194

def GaudiMP.pTools.HistoAgent.RebuildHistoStore | ( |  | self | ) |

    Rebuild the Histogram Store from the histos received by Receive()
    If we have a histo which is not in the store,
    book and fill it according to self.bookingDict
    If we have a histo with a matching histo in the store,
    add the two histos, remembering that aida2root must be used on
    the Stored histo for compatibility.

Definition at line 91 of file pTools.py.

91 def RebuildHistoStore(self):
92 '''
93 Rebuild the Histogram Store from the histos received by Receive()
94 If we have a histo which is not in the store,
95 book and fill it according to self.bookingDict
96 If we have a histo with a matching histo in the store,
97 add the two histos, remembering that aida2root must be used on
98 the Stored histo for compatibility.
99 '''
100 errors = 0
101 for tup in self.histos:
102 workerID, histDict = tup
103 added = 0
104 registered = 0
105 booked = 0
106
107 for n in histDict.keys():
108 o = histDict[n]
109 obj = self.hvt.retrieve(n)
110
111 if obj:
112 try:
113 aida2root(obj).Add(o)
114 except:
115 self.log.warning('FAILED TO ADD : %s' % (str(obj)))
116 errors += 1
117 added += 1
118 else:
119
120 if o.__class__.__name__ in self.bookingDict.keys():
121 try:
122 self.bookingDict[o.__class__.__name__](n, o)
123 except:
124 self.log.warning('FAILED TO REGISTER : %s\tto%s'
125 % (o.__class__.__name__, n))
126 errors += 1
127 else:
128 self.log.warning('No booking method for: %s\t%s\t%s'
129 % (n, type(o), o.__class__.__name__))
130 errors += 1
131 booked += 1
132 hs = self.hvt.getHistoNames()
133 self.log.info('Histo Store Rebuilt : ')
134 self.log.info(' Contains %i objects.' % (len(hs)))
135 self.log.info(' Errors in Rebuilding : %i' % (errors))
136 return SUCCESS
137
GaudiMP.pTools.HistoAgent.bookingDict
bookingDict
Definition: pTools.py:61
GaudiMP.pTools.HistoAgent.RebuildHistoStore
def RebuildHistoStore(self)
Definition: pTools.py:91
gaudirun.type
type
Definition: gaudirun.py:133
GaudiMP.pTools.aida2root
aida2root
Definition: pTools.py:46
GaudiMP.pTools.HistoAgent.histos
histos
Definition: pTools.py:55

def GaudiMP.pTools.HistoAgent.Receive | ( |  | self | ) |

Definition at line 76 of file pTools.py.

76 def Receive(self):
77 hstatus = self._gmpc.nWorkers + 1 # +1 for the Reader!
78 while True:
79 tup = self.qin.get()
80 if tup == 'HISTOS_SENT':
81 self.log.debug('received HISTOS_SENT message')
82 hstatus -= 1
83 if not hstatus:
84 break
85 else:
86 self.register(tup)
87 self._gmpc.sEvent.set()
88 self.log.info('Writer received all histo bundles and set sync event')
89 return SUCCESS
90
GaudiMP.pTools.HistoAgent.Receive
def Receive(self)
Definition: pTools.py:76
GaudiMP.pTools.HistoAgent.register
def register(self, tup)
Definition: pTools.py:71

def GaudiMP.pTools.HistoAgent.register | ( |  | self,
|  |  | tup
| ) |  |

Definition at line 71 of file pTools.py.

71 def register(self, tup):
72 # add a tuple of (worker-id, histoDict) to self.histos
73 assert tup.__class__.__name__ == 'tuple'
74 self.histos.append(tup)
75
GaudiMP.pTools.HistoAgent.register
def register(self, tup)
Definition: pTools.py:71

## Member Data Documentation

GaudiMP.pTools.HistoAgent._gmpc
| private

Definition at line 53 of file pTools.py.

GaudiMP.pTools.HistoAgent.bookingDict

Definition at line 61 of file pTools.py.

GaudiMP.pTools.HistoAgent.histos

Definition at line 55 of file pTools.py.

GaudiMP.pTools.HistoAgent.hvt

Definition at line 54 of file pTools.py.

GaudiMP.pTools.HistoAgent.log

Definition at line 57 of file pTools.py.

GaudiMP.pTools.HistoAgent.qin

Definition at line 56 of file pTools.py.

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

- GaudiMP/python/GaudiMP/pTools.py