| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Public Attributes | Private Attributes

# GaudiMP::pTools::HistoAgent Class Reference

List of all members.

## Public Member Functions
def | __init__
def | register
def | Receive
def | RebuildHistoStore
def | bookDataObject
def | bookTH1D
def | bookTH2D
def | bookTH3D
def | bookTProfile
def | bookTProfile2D
## Public Attributes
| hvt
| histos
| qin
| log
| bookingDict
## Private Attributes
| _gmpc

## Detailed Description

Definition at line 49 of file pTools.py.

## Constructor & Destructor Documentation

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

Definition at line 50 of file pTools.py.

    00051                                        :
    00052         self._gmpc = gmpComponent
    00053         self.hvt = self._gmpc.hvt
    00054         self.histos = []
    00055         self.qin = self._gmpc.hq
    00056         self.log = self._gmpc.log
    00057
    00058         # There are many methods for booking Histogram Objects to Histo store
    00059         # here they are collected in a dictionary, with key = a relevant name
    00060         self.bookingDict = {}
    00061         self.bookingDict['DataObject']        = self.bookDataObject
    00062         self.bookingDict['NTuple::Directory'] = self.bookDataObject
    00063         self.bookingDict['NTuple::File']      = self.bookDataObject
    00064         self.bookingDict['TH1D']       = self.bookTH1D
    00065         self.bookingDict['TH2D']       = self.bookTH2D
    00066         self.bookingDict['TH3D']       = self.bookTH3D
    00067         self.bookingDict['TProfile']   = self.bookTProfile
    00068         self.bookingDict['TProfile2D'] = self.bookTProfile2D

## Member Function Documentation

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

    Register a DataObject to the Histo Store

Definition at line 132 of file pTools.py.

    00133                                     :
    00134         '''
    00135         Register a DataObject to the Histo Store
    00136         '''
    00137         self._gmpc.hvt.registerObject( n, o )

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

    Register a ROOT 1D THisto to the Histo Store

Definition at line 138 of file pTools.py.

    00139                                :
    00140         '''
    00141         Register a ROOT 1D THisto to the Histo Store
    00142         '''
    00143         obj = self.hvt._ihs.book( n, o.GetTitle(),\
    00144                                      o.GetXaxis().GetNbins(),\
    00145                                      o.GetXaxis().GetXmin(),\
    00146                                      o.GetXaxis().GetXmax() )
    00147         aida2root(obj).Add(o)

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

    Register a ROOT 2D THisto to the Histo Store

Definition at line 148 of file pTools.py.

    00149                                :
    00150         '''
    00151         Register a ROOT 2D THisto to the Histo Store
    00152         '''
    00153         obj = self.hvt._ihs.book( n, o.GetTitle(),\
    00154                                      o.GetXaxis().GetNbins(),\
    00155                                      o.GetXaxis().GetXmin(),\
    00156                                      o.GetXaxis().GetXmax(),\
    00157                                      o.GetYaxis().GetNbins(),\
    00158                                      o.GetYaxis().GetXmin(),\
    00159                                      o.GetYaxis().GetXmax() )
    00160         aida2root(obj).Add(o)

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

    Register a ROOT 3D THisto to the Histo Store

Definition at line 161 of file pTools.py.

    00162                                :
    00163         '''
    00164         Register a ROOT 3D THisto to the Histo Store
    00165         '''
    00166         obj = self.hvt._ihs.book( n, o.GetTitle(),\
    00167                                      o.GetXaxis().GetXbins(),\
    00168                                      o.GetXaxis().GetXmin(),\
    00169                                      o.GetXaxis().GetXmax(),\
    00170                                      o.GetYaxis().GetXbins(),\
    00171                                      o.GetYaxis().GetXmin(),\
    00172                                      o.GetYaxis().GetXmax(),\
    00173                                      o.GetZaxis().GetXbins(),\
    00174                                      o.GetZaxis().GetXmin(),\
    00175                                      o.GetZaxis().GetXmax() )
    00176         aida2root(obj).Add(o)

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

    Register a ROOT TProfile to the Histo Store

Definition at line 177 of file pTools.py.

    00178                                    :
    00179         '''
    00180         Register a ROOT TProfile to the Histo Store
    00181         '''
    00182         obj = self.hvt._ihs.bookProf( n, o.GetTitle(),\
    00183                                          o.GetXaxis().GetNbins(),\
    00184                                          o.GetXaxis().GetXmin(),\
    00185                                          o.GetXaxis().GetXmax(),\
    00186                                          o.GetOption() )
    00187         aida2root(obj).Add(o)

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

    Register a ROOT TProfile2D to the Histo Store

Definition at line 188 of file pTools.py.

    00189                                      :
    00190         '''
    00191         Register a ROOT TProfile2D to the Histo Store
    00192         '''
    00193         obj = self.hvt._ihs.bookProf( n, o.GetTitle(),\
    00194                                          o.GetXaxis().GetNbins(),\
    00195                                          o.GetXaxis().GetXmin(),\
    00196                                          o.GetXaxis().GetXmax(),\
    00197                                          o.GetYaxis().GetNbins(),\
    00198                                          o.GetYaxis().GetXmin(),\
    00199                                          o.GetYaxis().GetXmax()  )
    00200         aida2root(obj).Add(o)
    00201
    00202 # =============================================================================

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 89 of file pTools.py.

    00090                                   :
    00091         '''
    00092         Rebuild the Histogram Store from the histos received by Receive()
    00093         If we have a histo which is not in the store,
    00094         book and fill it according to self.bookingDict
    00095         If we have a histo with a matching histo in the store,
    00096         add the two histos, remembering that aida2root must be used on
    00097         the Stored histo for compatibility.
    00098         '''
    00099         errors = 0
    00100         for tup in self.histos :
    00101             workerID, histDict = tup
    00102             added = 0 ; registered = 0; booked = 0
    00103             for n in histDict.keys() :
    00104                 o = histDict[ n ]
    00105                 obj = self.hvt.retrieve( n )
    00106                 if obj :
    00107                     try    :
    00108                         aida2root(obj).Add(o)
    00109                     except :
    00110                         self.log.warning('FAILED TO ADD : %s'%(str(obj)))
    00111                         errors += 1
    00112                     added += 1
    00113                 else :
    00114                     if o.__class__.__name__ in self.bookingDict.keys() :
    00115                         try    :
    00116                             self.bookingDict[o.__class__.__name__](n, o)
    00117                         except :
    00118                             self.log.warning('FAILED TO REGISTER : %s\tto%s'\
    00119                                              %(o.__class__.__name__, n))
    00120                             errors += 1
    00121                     else :
    00122                         self.log.warning( 'No booking method for: %s\t%s\t%s'\
    00123                                           %(n,type(o),o.__class__.__name__) )
    00124                         errors += 1
    00125                     booked += 1
    00126         hs = self.hvt.getHistoNames()
    00127         self.log.info( 'Histo Store Rebuilt : ' )
    00128         self.log.info( '  Contains %i objects.'%(len(hs)) )
    00129         self.log.info( '  Errors in Rebuilding : %i'%(errors) )
    00130         return SUCCESS
    00131

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

Definition at line 74 of file pTools.py.

    00075                         :
    00076         hstatus = self._gmpc.nWorkers+1    # +1 for the Reader!
    00077         while True :
    00078             tup = self.qin.get()
    00079             if tup == 'HISTOS_SENT' :
    00080                 self.log.debug('received HISTOS_SENT message')
    00081                 hstatus -= 1
    00082                 if not hstatus : break
    00083             else   :
    00084               self.register( tup )
    00085         self._gmpc.sEvent.set()
    00086         self.log.info('Writer received all histo bundles and set sync event')
    00087         return SUCCESS
    00088

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

Definition at line 69 of file pTools.py.

    00070                               :
    00071         # add a tuple of (worker-id, histoDict) to self.histos
    00072         assert tup.__class__.__name__ == 'tuple'
    00073         self.histos.append( tup )

## Member Data Documentation

GaudiMP::pTools::HistoAgent::_gmpc`[private]`

Definition at line 50 of file pTools.py.

GaudiMP::pTools::HistoAgent::bookingDict

Definition at line 50 of file pTools.py.

GaudiMP::pTools::HistoAgent::histos

Definition at line 50 of file pTools.py.

GaudiMP::pTools::HistoAgent::hvt

Definition at line 50 of file pTools.py.

GaudiMP::pTools::HistoAgent::log

Definition at line 50 of file pTools.py.

GaudiMP::pTools::HistoAgent::qin

Definition at line 50 of file pTools.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiMP/python/GaudiMP/pTools.py

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines