/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Private Member Functions
DybPython::DybPythonAlg::DybPythonAlg Class Reference
Inheritance diagram for DybPython::DybPythonAlg::DybPythonAlg:
Inheritance graph
[legend]
Collaboration diagram for DybPython::DybPythonAlg::DybPythonAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize
def verbose
def debug
def info
def warning
def error
def fatal
def getAES
def initializeHeader
def finalizeHeader

Public Attributes

 msgSvc
 archiveSvc
 stats
 defaultInputLocation
 execNumber
 currentJobId

Private Member Functions

def _initializeAES

Detailed Description

Definition at line 31 of file DybPythonAlg.py.


Constructor & Destructor Documentation

def DybPython::DybPythonAlg::DybPythonAlg::__init__ (   self,
  name = None 
)
Create a DybPythonAlg.  The name is the class name by default.
If sub class overrides this method it must be explicitly called like:

DybPythonAlg.__init__(self,name)
or
DybPythonAlg.__init__(self)

Reimplemented in DybPython::TestDecorators::TestDecorators.

Definition at line 33 of file DybPythonAlg.py.

00034                                   :
00035 
00036         '''
00037         Create a DybPythonAlg.  The name is the class name by default.
00038         If sub class overrides this method it must be explicitly called like:
00039 
00040         DybPythonAlg.__init__(self,name)
00041         or
00042         DybPythonAlg.__init__(self)
00043         '''
00044 
00045         if not name: name = self.__class__.__name__
00046         GaudiAlgo.__init__(self,name)
00047         self.msgSvc = None
00048         self.archiveSvc = None
00049         self.stats = iStatsSvc(self)
00050         self.defaultInputLocation = None
00051         self.execNumber = None # FIXME: Add auto-increment, if possible
00052         return


Member Function Documentation

def DybPython::DybPythonAlg::DybPythonAlg::initialize (   self)
Initialize the algorithm.  If sub classes overrides this
method they must call it explicitly near the beginning like:

sc = DybPythonAlg.initialize(self)
if sc.isFailure(): return sc
# ... now do my own initialization ...

Reimplemented in DybPython::TestDecorators::TestDecorators.

Definition at line 53 of file DybPythonAlg.py.

00054                         :
00055 
00056         '''Initialize the algorithm.  If sub classes overrides this
00057         method they must call it explicitly near the beginning like:
00058 
00059         sc = DybPythonAlg.initialize(self)
00060         if sc.isFailure(): return sc
00061         # ... now do my own initialization ...
00062         '''
00063 
00064         status = GaudiAlgo.initialize(self)
00065         if not status.isSuccess(): return status
00066         # Get handle to message svc
00067         self.msgSvc = self.svc('IMessageSvc','MessageSvc')
00068         if self.msgSvc == None:
00069             print "DybPythonAlg.initialize(): Failed to get MessageSvc"
00070             return FAILURE
00071         # Catch current Job ID
00072         jobInfoSvc = self.svc("IJobInfoSvc","JobInfoSvc")
00073         if not jobInfoSvc:
00074             self.error("Failed to initialize JobInfoSvc")
00075             return FAILURE
00076         self.currentJobId = jobInfoSvc.currentJobInfo().jobId()
00077         return SUCCESS

def DybPython::DybPythonAlg::DybPythonAlg::_initializeAES (   self) [private]

Definition at line 78 of file DybPythonAlg.py.

00079                             :
00080         # Get handle to archive data svc if it is available
00081         if self.archiveSvc != None:
00082             self.warning("Archive data service already initialized.")
00083             return SUCCESS
00084         archiveSvc = self.svc("IDataProviderSvc","EventDataArchiveSvc")
00085         if archiveSvc == None:
00086             self.warning("Archive data service not available.")
00087             return FAILURE
00088         else:
00089             baseSvc = self.svc("IService","EventDataArchiveSvc")
00090             self.archiveSvc = iDataSvc( baseSvc.name(), archiveSvc )
00091         return SUCCESS

def DybPython::DybPythonAlg::DybPythonAlg::execute (   self)

Reimplemented in DybPython::TestDecorators::TestDecorators.

Definition at line 92 of file DybPythonAlg.py.

00093                      :
00094         'Subclass should override this method'
00095         self.info("Executing DybPythonAlg:"+self.name())
00096         return SUCCESS

def DybPython::DybPythonAlg::DybPythonAlg::finalize (   self)
Finalize the algorithm.  If sub classes overrides this
method they must call it explicitly like at the end:

# ... first do my own finalization ...
return DybPythonAlg.finalize(self)

Reimplemented in DybPython::TestDecorators::TestDecorators.

Definition at line 97 of file DybPythonAlg.py.

00098                       :
00099         '''Finalize the algorithm.  If sub classes overrides this
00100         method they must call it explicitly like at the end:
00101 
00102         # ... first do my own finalization ...
00103         return DybPythonAlg.finalize(self)
00104         '''
00105         self.msgSvc.release()
00106         self.msgSvc = None
00107         self.archiveSvc = None
00108         status = GaudiAlgo.finalize(self)
00109         return status

def DybPython::DybPythonAlg::DybPythonAlg::verbose (   self,
  message 
)

Definition at line 111 of file DybPythonAlg.py.

00112                               :
00113         'Emit message at verbose level'
00114         self.msgSvc.reportMessage(self.name(), VERBOSE, message)
00115         return

def DybPython::DybPythonAlg::DybPythonAlg::debug (   self,
  message 
)

Definition at line 116 of file DybPythonAlg.py.

00117                             :
00118         'Emit message at debug level'
00119         self.msgSvc.reportMessage(self.name(), DEBUG, message)
00120         return
    
def DybPython::DybPythonAlg::DybPythonAlg::info (   self,
  message 
)

Definition at line 121 of file DybPythonAlg.py.

00122                            :
00123         'Emit message at info level'
00124         self.msgSvc.reportMessage(self.name(), INFO, message)
00125         return
    
def DybPython::DybPythonAlg::DybPythonAlg::warning (   self,
  message 
)

Definition at line 126 of file DybPythonAlg.py.

00127                               :
00128         'Emit message at warning level'
00129         self.msgSvc.reportMessage(self.name(), WARNING, message)
00130         return
    
def DybPython::DybPythonAlg::DybPythonAlg::error (   self,
  message 
)

Definition at line 131 of file DybPythonAlg.py.

00132                             :
00133         'Emit message at error level'
00134         self.msgSvc.reportMessage(self.name(), ERROR, message)
00135         return
    
def DybPython::DybPythonAlg::DybPythonAlg::fatal (   self,
  message 
)

Definition at line 136 of file DybPythonAlg.py.

00137                             :
00138         'Emit message at fatal level'
00139         self.msgSvc.reportMessage(self.name(), FATAL, message)
00140         return
    
def DybPython::DybPythonAlg::DybPythonAlg::getAES (   self,
  path 
)

Definition at line 141 of file DybPythonAlg.py.

00142                           :
00143         'Return the list of items at the AES path'
00144         if self.archiveSvc == None:
00145             status = self._initializeAES()
00146             if (not status.isSuccess()) or self.archiveSvc == None:
00147                 self.error("Archive data svc not available")
00148                 return None
00149         archiveList = self.archiveSvc[path]
00150         if archiveList == None:
00151             self.error("Path in archive not available: "+path)
00152             return None
00153         dataList = []
00154         for dataObject in irange(archiveList.begin(), archiveList.end()):
00155             dataList.append(dataObject)
00156         return dataList

def DybPython::DybPythonAlg::DybPythonAlg::initializeHeader (   self,
  newHeader 
)
Initialize a new header object

Definition at line 157 of file DybPythonAlg.py.

00158                                         :
00159         '''Initialize a new header object'''
00160         gbl.SetOwnership(newHeader, False)
00161         newHeader.setExecNumber(0)
00162         newHeader.setEarliest(TimeStamp.GetBOT())
00163         newHeader.setLatest(TimeStamp.GetBOT())
00164         newHeader.setJobId(self.currentJobId)

def DybPython::DybPythonAlg::DybPythonAlg::finalizeHeader (   self,
  newHeader,
  referenceHeader = None 
)
Finalize a new header object, before writing to TES

Definition at line 165 of file DybPythonAlg.py.

00166                                                              :
00167         '''Finalize a new header object, before writing to TES'''
00168         # Catch and set default input header, if needed
00169         if len(newHeader.inputHeaders())==0:
00170             if not referenceHeader and self.defaultInputLocation:
00171                 evt = self.evtSvc()
00172                 referenceHeader = evt[self.defaultInputLocation]
00173             if not referenceHeader:
00174                 self.error("Failed to retrieve input header: ",
00175                            self.defaultInputLocation)
00176                 return FAILURE
00177             newHeader.addInputHeader( referenceHeader )
00178         # Set header information based on input headers
00179         inputHeaders = newHeader.inputHeaders()
00180         if len(inputHeaders)==0:
00181             self.error("No input header specified for",newHeader.name())
00182             return FAILURE
00183         if self.execNumber:
00184             newHeader.setExecNumber(self.execNumber)
00185         else:
00186             #FIXME: use self.execNumber once auto-increment is fixed.
00187             newHeader.setExecNumber(inputHeaders[0].execNumber()) 
00188         newHeader.setContext(inputHeaders[0].context())
00189         newHeader.setEarliest(inputHeaders[0].earliest())
00190         newHeader.setLatest(inputHeaders[0].latest())
00191         detectorId = inputHeaders[0].context().GetDetId()
00192         firstHeader = True
00193         for inputHeader in inputHeaders:
00194             if firstHeader:
00195                 firstHeader=False
00196                 continue
00197             # Extend time/detector range if needed
00198             inputDetId = inputHeader.context().GetDetId()
00199             if detectorId != DetectorId.kAll and detectorId != inputDetId:
00200                 detectorId = DetectorId.kAll
00201                 newContext = Context( newHeader.context() )
00202                 newContext.SetDetId( DetectorId.kAll )
00203                 newHeader.setContext( newContext )
00204             # Extend time range if needed
00205             if inputHeader.earliest()<newHeader.earliest():
00206                 newHeader.setEarliest(inputHeader.earliest())
00207             if inputHeader.latest()>newHeader.latest():
00208                 newHeader.setLatest(inputHeader.latest())
00209         newHeader.setJobId(self.currentJobId)
00210         return SUCCESS
00211             
00212 

Member Data Documentation

Definition at line 40 of file DybPythonAlg.py.

Definition at line 40 of file DybPythonAlg.py.

Definition at line 40 of file DybPythonAlg.py.

Definition at line 40 of file DybPythonAlg.py.

Definition at line 40 of file DybPythonAlg.py.

Definition at line 59 of file DybPythonAlg.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:41 for DybPython by doxygen 1.7.4