#include <DybBaseAlg.h>
Inheritance diagram for DybBaseAlg:
Public Member Functions | |
DybBaseAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~DybBaseAlg () |
virtual StatusCode | sysInitialize () |
Will call initialize(). | |
virtual StatusCode | sysExecute () |
Will call preExecute() execute() and postExecute(). | |
virtual StatusCode | preExecute () |
be called before execute(). | |
virtual StatusCode | postExecute () |
be called after execute(). | |
virtual StatusCode | sysFinalize () |
Will call finalize(). | |
IDataProviderSvc * | arcSvc () const |
Access the archive Event Service. | |
void | putTES (DataObject *obj, std::string location) const |
Put data in the TES. | |
template<class TYPE> | |
TYPE * | getTES (std::string location) const |
Access data from the TES. | |
template<class TYPE> | |
TYPE * | getAES (std::string location, int index) const |
Access data from the Archive Event service at the given index. | |
std::vector< DataObject * > | getAEScollection (std::string location) const |
Return the list of archived data objects at the given location. | |
int | getExecNum () |
Access current execution ("event") number. | |
std::string | Location () const |
Access the TES location. | |
virtual StatusCode | initialize () |
virtual StatusCode | execute () |
virtual StatusCode | finalize () |
void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
void | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
bool | registerContext () const |
INTupleSvc * | evtColSvc () const |
IAlgContextSvc * | contextSvc () const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | sysStart () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysBeginRun () |
virtual StatusCode | sysEndRun () |
virtual const std::string & | name () const |
virtual const std::string & | version () const |
virtual StatusCode | configure () |
virtual StatusCode | terminate () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual bool | isExecuted () const |
virtual void | setExecuted (bool state) |
virtual void | resetExecuted () |
virtual StatusCode | beginRun () |
virtual StatusCode | endRun () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual bool | isEnabled () const |
virtual bool | filterPassed () const |
virtual void | setFilterPassed (bool state) |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
void | setOutputLevel (int level) |
IAuditorSvc * | auditorSvc () const |
IChronoStatSvc * | chronoSvc () const |
IChronoStatSvc * | chronoStatService () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | detDataService () const |
IConversionSvc * | detCnvSvc () const |
IConversionSvc * | detDataCnvService () const |
IDataProviderSvc * | eventSvc () const |
IDataProviderSvc * | evtSvc () const |
IDataProviderSvc * | eventDataService () const |
IConversionSvc * | eventCnvSvc () const |
IConversionSvc * | eventDataCnvService () const |
IHistogramSvc * | histoSvc () const |
IHistogramSvc * | histogramDataService () const |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () const |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | ntupleService () const |
IRndmGenSvc * | randSvc () const |
IToolSvc * | toolSvc () const |
IExceptionSvc * | exceptionSvc () const |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
std::vector< Algorithm * > * | subAlgorithms () const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
unsigned long | addRef () |
StatusCode | queryInterface (const InterfaceID &riid, void **) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
void | InitializeHeader (DayaBay::HeaderObject *header) |
Initialize new header object. Set exec number, job id, etc. | |
void | AppendInputHeader (const DayaBay::HeaderObject *header) const |
Explicitly add an input header that was retrieved directly instead of through this classes get* methods. | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
bool | isInitialized () const |
bool | isFinalized () const |
int | outputLevel () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Protected Attributes | |
DayaBay::HeaderObject * | m_headerObject |
bool | m_pullMode |
runing mode, push or pull | |
std::string | m_location |
Property: Location. | |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Attributes | |
int | m_execNum |
Property: ExecutionNumber. | |
int | m_saveRandomState |
Property: SaveRandomState. | |
std::vector< const DayaBay::HeaderObject * > | m_inputHeaders |
std::vector< unsigned long > | m_state |
state of Random Engine | |
IJobInfoSvc * | m_jobInfoSvc |
handle to JobInfoSvc |
Brett Viren <bv@bnl.gov> Thu Mar 24 12:58:11 2011
Definition at line 23 of file DybBaseAlg.h.
DybBaseAlg::DybBaseAlg | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 11 of file DybBaseAlg.cc.
00012 : GaudiAlgorithm(name,pSvcLocator) 00013 , m_headerObject(0) 00014 , m_jobInfoSvc(0) 00015 { 00016 declareProperty("ExecutionNumber",m_execNum = 1, 00017 "The starting execution number."); 00018 declareProperty("SaveRandomState",m_saveRandomState = false, 00019 "Set true/false to save the random state."); 00020 00021 m_pullMode=false; 00022 00023 }
DybBaseAlg::~DybBaseAlg | ( | ) | [virtual] |
StatusCode DybBaseAlg::sysInitialize | ( | ) | [virtual] |
Will call initialize().
Reimplemented from GaudiAlgorithm.
Definition at line 29 of file DybBaseAlg.cc.
00030 { 00031 // Call parent 00032 StatusCode sc = this->GaudiAlgorithm::initialize(); 00033 if (sc.isFailure()) return sc; 00034 00035 // This insinuates on GaudiAlgorithm's operation in order to do 00036 // any "dybish" initialization: 00037 // do_dybstuff_init(); 00038 00039 // Trigger calling subclass, back to your regularly scheduled operations 00040 sc = this->Algorithm::sysInitialize(); 00041 if (sc.isFailure()) return sc; 00042 00043 return StatusCode::SUCCESS; 00044 }
StatusCode DybBaseAlg::sysExecute | ( | ) | [virtual] |
Will call preExecute() execute() and postExecute().
Reimplemented from GaudiAlgorithm.
Definition at line 46 of file DybBaseAlg.cc.
00047 { 00048 if(!m_pullMode) { 00049 if(preExecute().isFailure()) return StatusCode::FAILURE; 00050 } 00051 00052 // Trigger subclass's execute(); 00053 if (this->Algorithm::sysExecute().isFailure()) return StatusCode::FAILURE; 00054 00055 if(!m_pullMode) { 00056 if(postExecute().isFailure()) return StatusCode::FAILURE; 00057 } 00058 00059 return StatusCode::SUCCESS; 00060 }
StatusCode DybBaseAlg::preExecute | ( | ) | [virtual] |
be called before execute().
Definition at line 62 of file DybBaseAlg.cc.
00063 { 00064 if (!m_saveRandomState) return StatusCode::SUCCESS; 00065 00066 // Get random state 00067 IRndmEngine *engine = 0; 00068 if (randSvc()->queryInterface(IID_IRndmEngine,(void**)&engine).isFailure()) { 00069 warning() << "Could not get IRndmEngine interace from random service, " 00070 "no state saved!" << endreq; 00071 } 00072 else { 00073 engine->rndmState(m_state); 00074 debug () << "Storing random state: ["; 00075 for (size_t ind=0; ind<m_state.size(); ++ind) { 00076 debug () << " " << m_state[ind]; 00077 } 00078 debug () << " ]" << endreq; 00079 } 00080 00081 return StatusCode::SUCCESS; 00082 }
StatusCode DybBaseAlg::postExecute | ( | ) | [virtual] |
be called after execute().
Definition at line 84 of file DybBaseAlg.cc.
00085 { 00086 // Set some base HeaderObject values 00087 if (m_headerObject) { 00088 m_headerObject->setRandomState(m_state); 00089 const std::vector<const DayaBay::IHeader*> iheaders(m_inputHeaders.begin(),m_inputHeaders.end()); 00090 m_headerObject->setInputHeaders(iheaders); 00091 00092 00093 // Add to TES. This must be done after algorithm has chance to 00094 // fill earliest/latest with non-default values as this put() 00095 // triggers an insert() into the RegistrationSequence. 00096 00097 if (!m_pullMode) { 00098 put(m_headerObject,m_location); 00099 } 00100 } 00101 00102 // Prepare alg for next execution cycle 00103 debug() <<"Clearing " << m_inputHeaders.size() << " cached input headers" << endreq; 00104 m_inputHeaders.clear(); 00105 ++m_execNum; 00106 m_headerObject = 0; // owned by TES 00107 00108 return StatusCode::SUCCESS; 00109 }
StatusCode DybBaseAlg::sysFinalize | ( | ) | [virtual] |
Will call finalize().
Reimplemented from GaudiAlgorithm.
Definition at line 111 of file DybBaseAlg.cc.
00112 { 00113 if (this->finalize().isFailure()) { 00114 return StatusCode::FAILURE; 00115 } 00116 return this->GaudiAlgorithm::finalize(); 00117 }
IDataProviderSvc * DybBaseAlg::arcSvc | ( | ) | const |
void DybBaseAlg::putTES | ( | DataObject * | obj, | |
std::string | location | |||
) | const |
Put data in the TES.
It is like a normal put<>() but will build up the full path leading to the location with DataObjects.
Definition at line 153 of file DybBaseAlg.cc.
00154 { 00155 // Look for pre-existing header object or make new one, creating 00156 // the supporting path as we go. 00157 std::string::size_type ind = location.find("/"); // skip initial "/". 00158 while (true) { 00159 ind = location.find("/",ind+1); 00160 if (ind == std::string::npos) { 00161 debug() << "Putting final: " << location << endreq; 00162 put(obj,location); 00163 break; 00164 } 00165 else { 00166 // make the supporting path from simple DataObjects 00167 debug() << "Making intermediate: " << location.substr(0,ind) 00168 << endreq; 00169 getOrCreate<DataObject,DataObject>(location.substr(0,ind)); 00170 } 00171 } 00172 }
TYPE * DybBaseAlg::getTES | ( | std::string | location | ) | const |
Access data from the TES.
As a side effect, if this data is a HeaderObject it will be recorded into the current header objects list of input header objects.
Definition at line 123 of file DybBaseAlg.h.
00124 { 00125 TYPE* obj = get<TYPE>(location); 00126 // If object happens to be a HeaderObject, save it in the intputHeaders 00127 DayaBay::HeaderObject* header = dynamic_cast<DayaBay::HeaderObject*>(obj); 00128 if (header) { 00129 if (std::find(m_inputHeaders.begin(),m_inputHeaders.end(),header) == m_inputHeaders.end()) { 00130 this->AppendInputHeader(header); 00131 debug() << "Saved " << m_inputHeaders.size() 00132 << " input headers from TES, latest: " 00133 << header->name() 00134 << endreq; 00135 } 00136 } 00137 return obj; 00138 }
TYPE * DybBaseAlg::getAES | ( | std::string | location, | |
int | index | |||
) | const |
Access data from the Archive Event service at the given index.
Index==0 is the most recent. As a side effect, if this data is a HeaderObject it will be recorded into the current header objects list of input header objects.
Definition at line 141 of file DybBaseAlg.h.
00142 { 00143 if (index<0) return 0; 00144 00145 std::vector<DataObject*> vec = this->getAEScollection(location); 00146 if (!vec.size() || index >= vec.size()) return 0; 00147 DataObject* dobj = vec[index]; 00148 TYPE* obj = dynamic_cast<TYPE*>(dobj); 00149 if (!obj) return 0; 00150 00151 DayaBay::HeaderObject* header = dynamic_cast<DayaBay::HeaderObject*>(obj); 00152 if (header) { 00153 if (std::find(m_inputHeaders.begin(),m_inputHeaders.end(),header) == m_inputHeaders.end()) { 00154 this->AppendInputHeader(header); 00155 debug() << "Saved " << m_inputHeaders.size() 00156 << " input headers from TES, latest: " 00157 << header->name() 00158 << endreq; 00159 } 00160 } 00161 00162 return obj; 00163 }
std::vector< DataObject * > DybBaseAlg::getAEScollection | ( | std::string | location | ) | const |
Return the list of archived data objects at the given location.
Note: this does NOT automatically add anything into the list of input headers for this algorithm's output. If your subclass uses anything from this list you MUST add it to the input headers manually or people will not know what when in to your output.
Definition at line 175 of file DybBaseAlg.cc.
00176 { 00177 DybArchiveList* lst = get<DybArchiveList>(arcSvc(),location); 00178 if (!lst) return std::vector<DataObject*>(); 00179 return std::vector<DataObject*>(lst->begin(),lst->end()); 00180 }
int DybBaseAlg::getExecNum | ( | ) | [inline] |
Access current execution ("event") number.
Definition at line 75 of file DybBaseAlg.h.
00075 { return m_execNum; }
std::string DybBaseAlg::Location | ( | ) | const [inline] |
void DybBaseAlg::InitializeHeader | ( | DayaBay::HeaderObject * | header | ) | [protected] |
Initialize new header object. Set exec number, job id, etc.
Definition at line 120 of file DybBaseAlg.cc.
00121 { 00122 // Set some standard parameters for this header 00123 00124 // Set execution number 00125 header->setExecNumber(m_execNum); 00126 00127 // Document the ID of the job which made this header 00128 if(!m_jobInfoSvc){ 00129 // Get the job information service 00130 m_jobInfoSvc = svc<IJobInfoSvc>("JobInfoSvc",true); 00131 } 00132 if(m_jobInfoSvc){ 00133 header->setJobId(m_jobInfoSvc->currentJobInfo()->jobId()); 00134 }else{ 00135 warning() << "MakeHeaderObject, failed to get current job ID" << endreq; 00136 } 00137 // Set the header time range 00138 header->setEarliest(TimeStamp::GetBOT()); 00139 header->setLatest(TimeStamp::GetBOT()); 00140 }
void DybBaseAlg::AppendInputHeader | ( | const DayaBay::HeaderObject * | header | ) | const [protected] |
Explicitly add an input header that was retrieved directly instead of through this classes get* methods.
Definition at line 142 of file DybBaseAlg.cc.
00143 { 00144 m_inputHeaders.push_back(header); 00145 }
DayaBay::HeaderObject* DybBaseAlg::m_headerObject [protected] |
Definition at line 89 of file DybBaseAlg.h.
bool DybBaseAlg::m_pullMode [protected] |
int DybBaseAlg::m_execNum [private] |
Property: ExecutionNumber.
Set the starting execution number (like a generic event number). Starts at 1 (yes, 1, not 0) by default. This is incremented in the MakeHeader()
Definition at line 99 of file DybBaseAlg.h.
int DybBaseAlg::m_saveRandomState [private] |
Property: SaveRandomState.
Set true/false to save / not save the random state into the header object. Set to FALSE by default.
Definition at line 104 of file DybBaseAlg.h.
std::vector<const DayaBay::HeaderObject*> DybBaseAlg::m_inputHeaders [mutable, private] |
Definition at line 106 of file DybBaseAlg.h.
std::vector<unsigned long> DybBaseAlg::m_state [private] |
IJobInfoSvc* DybBaseAlg::m_jobInfoSvc [private] |
std::string DybBaseAlg::m_location [protected] |
Property: Location.
Set non-standard TES location for the object this algorithm produces. Default is result of class method HeaderType::defaultLocation().
Definition at line 118 of file DybBaseAlg.h.