| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
StoreExplorerAlg Class Reference

Small algorith, which traverses the data store and prints generic information about all leaves, which can be loaded/accessed. More...

Inheritance diagram for StoreExplorerAlg:
[legend]
Collaboration diagram for StoreExplorerAlg:
[legend]

## Public Member Functions
| StoreExplorerAlg (const std::string &name, ISvcLocator *pSvcLocator)
| Standard algorithm constructor.
virtual | ~StoreExplorerAlg ()
| Standard Destructor.
template<class T >
std::string | access (T *p)
void | printObj (IRegistry *pReg, std::vector< bool > &flg)
| Print datastore leaf.
void | explore (IRegistry *pObj, std::vector< bool > &flg)
virtual StatusCode | initialize ()
| Initialize.
virtual StatusCode | finalize ()
| Finalize.
virtual StatusCode | execute ()
| Execute procedure.
Public Member Functions inherited from Algorithm
| Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
| Constructor.
virtual | ~Algorithm ()
| Destructor.
virtual StatusCode | sysStart ()
| Reinitialization method invoked by the framework.
virtual StatusCode | sysInitialize ()
| Initialization method invoked by the framework.
virtual StatusCode | sysReinitialize ()
| Reinitialization method invoked by the framework.
virtual StatusCode | sysRestart ()
| Restart method invoked by the framework.
virtual StatusCode | sysExecute ()
| The actions to be performed by the algorithm on an event.
virtual StatusCode | sysStop ()
| System stop.
virtual StatusCode | sysFinalize ()
| System finalization.
virtual StatusCode | sysBeginRun ()
| beginRun method invoked by the framework.
virtual StatusCode | sysEndRun ()
| endRun method invoked by the framework.
virtual const std::string & | name () const
| The identifying name of the algorithm object.
virtual const std::string & | version () const
virtual StatusCode | configure ()
| Dummy implementation of IStateful::configure() method.
virtual StatusCode | terminate ()
| Dummy implementation of IStateful::terminate() method.
virtual StatusCode | start ()
| the default (empty) implementation of IStateful::start() method
virtual StatusCode | stop ()
| the default (empty) implementation of IStateful::stop() method
virtual StatusCode | reinitialize ()
| the default (empty) implementation of IStateful::reinitialize() method
virtual StatusCode | restart ()
| the default (empty) implementation of IStateful::restart() method
virtual bool | isExecuted () const
| Has this algorithm been executed since the last reset?
virtual void | setExecuted (bool state)
| Set the executed flag to the specified state.
virtual void | resetExecuted ()
| Reset the executed state of the Algorithm for the duration of the current event.
virtual StatusCode | beginRun ()
| Algorithm begin run.
virtual StatusCode | endRun ()
| Algorithm end run. This method is called at the end of the event loop.
virtual Gaudi::StateMachine::State | FSMState () const
| returns the current state of the algorithm
virtual Gaudi::StateMachine::State | targetFSMState () const
| returns the state the algorithm will be in after the ongoing transition
virtual bool | isEnabled () const
| Is this algorithm enabled or disabled?
virtual bool | filterPassed () const
| Did this algorithm pass or fail its filter criterion for the last event?
virtual void | setFilterPassed (bool state)
| Set the filter passed flag to the specified state.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
SmartIF< IService > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const
| Return a pointer to the service identified by name (or "type/name")
void | setOutputLevel (int level)
| Set the output level for current algorithm.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
SmartIF< IChronoStatSvc > & | chronoSvc () const
| The standard Chrono & Stat service, Return a pointer to the service if present.
SmartIF< IChronoStatSvc > & | chronoStatService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IDataProviderSvc > & | detSvc () const
| The standard detector data service.
SmartIF< IDataProviderSvc > & | detDataService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IConversionSvc > & | detCnvSvc () const
| The standard detector data persistency conversion service.
SmartIF< IConversionSvc > & | detDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IDataProviderSvc > & | eventSvc () const
| The standard event data service.
SmartIF< IDataProviderSvc > & | evtSvc () const
| shortcut for method eventSvc
SmartIF< IDataProviderSvc > & | eventDataService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IConversionSvc > & | eventCnvSvc () const
| The standard event data persistency conversion service.
SmartIF< IConversionSvc > & | eventDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IHistogramSvc > & | histoSvc () const
| The standard histogram service.
SmartIF< IHistogramSvc > & | histogramDataService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
SmartIF< IMessageSvc > & | messageService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< INTupleSvc > & | ntupleSvc () const
| The standard N tuple service.
SmartIF< INTupleSvc > & | ntupleService () const
| Obsoleted name, kept due to the backwards compatibility.
SmartIF< IRndmGenSvc > & | randSvc () const
| AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.
SmartIF< IToolSvc > & | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present.
SmartIF< IExceptionSvc > & | exceptionSvc () const
| Get the exception Service.
SmartIF< IAlgContextSvc > & | contextSvc () const
| get Algorithm Context Service
SmartIF< ISvcLocator > & | serviceLocator () const
| The standard service locator.
SmartIF< ISvcLocator > & | svcLoc () const
| shortcut for method serviceLocator
bool | registerContext () const
| register for Algorithm Context Service?
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
| Create a sub algorithm.
std::vector< Algorithm * > * | subAlgorithms () const
| List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
virtual StatusCode | setProperty (const Property &p)
| Implementation of IProperty::setProperty.
virtual StatusCode | setProperty (const std::string &s)
| Implementation of IProperty::setProperty.
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
| Implementation of IProperty::setProperty.
virtual StatusCode | getProperty (Property *p) const
| Implementation of IProperty::getProperty.
virtual const Property & | getProperty (const std::string &name) const
| Implementation of IProperty::getProperty.
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
| Implementation of IProperty::getProperty.
virtual const std::vector < Property * > & | getProperties () const
| Implementation of IProperty::getProperties.
StatusCode | setProperties ()
| Set the algorithm's properties.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IMonitorSvc > & | monitorSvc () const
| Access the monitor service.
template<class T >
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const
| Declare monitoring information.
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
| Declare monitoring information (special case)
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value

## Private Attributes
long | m_print
| Job option to limit printout to first nnn events.
double | m_frequency
| Job option to set the printout frequency.
bool | m_exploreRelations
| Flag to check if relations should be followed.
long | m_printMissing
| Flag to indicate if missing entities should be printed.
long | m_total
| Internal counter to trigger printouts.
long | m_frqPrint
| Internal counter to adjust printout frequency.
bool | m_load
| Flag to load non existing items.
bool | m_testAccess
| Flag to test access to objects (DataObject and ContainedObject)
bool | m_accessForeign
| Flag to indicate if foreign files should be opened.
IDataProviderSvc * | m_dataSvc
| Reference to data provider service.
std::string | m_dataSvcName
| Name of the data provider service.
std::string | m_rootName
| Name of the root leaf (obtained at initialize)

## Additional Inherited Members
Public Types inherited from Algorithm
typedef Gaudi::PluginService::Factory2 < IAlgorithm *, const std::string &, ISvcLocator * > | Factory
Protected Member Functions inherited from Algorithm
bool | isInitialized () const
| Has the Algorithm already been initialized?
bool | isFinalized () const
| Has the Algorithm already been finalized?
int | outputLevel () const
| retrieve the Algorithm output level
IntegerProperty & | outputLevelProperty ()
| Accessor for the Message level property.
void | initOutputLevel (Property &prop)
| callback for output level property

## Detailed Description

Small algorith, which traverses the data store and prints generic information about all leaves, which can be loaded/accessed.

Author
  : M.Frank

Version
  : 1.0

Definition at line 30 of file StoreExplorerAlg.cpp.

## Constructor & Destructor Documentation

StoreExplorerAlg::StoreExplorerAlg | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator
| ) |  |
| inline

Standard algorithm constructor.

Definition at line 58 of file StoreExplorerAlg.cpp.

: Algorithm(name, pSvcLocator), m_dataSvc(0)
{
m_total = m_frqPrint = 0;
declareProperty("Load", m_load = false);
declareProperty("PrintEvt", m_print = 1);
declareProperty("PrintMissing", m_printMissing = 0);
declareProperty("PrintFreq", m_frequency = 0.0);
declareProperty("ExploreRelations", m_exploreRelations = false);
declareProperty("DataSvc", m_dataSvcName="EventDataSvc");
declareProperty("TestAccess", m_testAccess = false);
declareProperty("AccessForeign", m_accessForeign = false);
}

virtual StoreExplorerAlg::~StoreExplorerAlg | ( |  | ) |
| inline virtual

Standard Destructor.

Definition at line 72 of file StoreExplorerAlg.cpp.

{
}

## Member Function Documentation

template<class T >

std::string StoreExplorerAlg::access | ( | T * | p | ) |
| inline

Definition at line 76 of file StoreExplorerAlg.cpp.

{
if ( p ) {
std::stringstream s;
for (typename T::const_iterator i = p->begin(); i != p->end(); ++i ) {
int idx = p->index(*i);
s << idx << ":" << (*i)->clID() << ",";
}
std::string result = s.str();
return result.substr(0, result.length()-2);
}
return "Access FAILED.";
}

virtual StatusCode StoreExplorerAlg::execute | ( |  | ) |
| inline virtual

Execute procedure.

Definition at line 235 of file StoreExplorerAlg.cpp.

{
MsgStream log(msgSvc(), name());
SmartDataPtr<DataObject> root(m_dataSvc,m_rootName);
if ( ((m_print > m_total++) || (m_frequency*m_total > m_frqPrint)) && root ) {
if ( m_frequency*m_total > m_frqPrint ) {
m_frqPrint++;
}
std::string store_name = "Unknown";
IRegistry* pReg = root->registry();
if ( pReg ) {
SmartIF<IService> isvc(pReg->dataSvc());
if ( isvc ) {
store_name = isvc->name();
}
}
log << MSG::INFO << "========= " << m_rootName << "["
<< "0x" << std::hex << (unsigned long) root.ptr() << std::dec
<< "@" << store_name << "]:" << endmsg;
std::vector<bool> flg;
flg.push_back(true);
explore(root->registry(), flg);
return StatusCode::SUCCESS;
}
else if ( root ) {
return StatusCode::SUCCESS;
}
log << MSG::ERROR << "Cannot retrieve \"/Event\"!" << endmsg;
return StatusCode::FAILURE;
}

void StoreExplorerAlg::explore | ( | IRegistry * | pObj,
|  | std::vector< bool > & | flg
| ) |  |
| inline

Definition at line 158 of file StoreExplorerAlg.cpp.

{
printObj(pObj, flg);
if ( 0 != pObj ) {
SmartIF<IDataManagerSvc> mgr(eventSvc());
if ( mgr ) {
typedef std::vector<IRegistry*> Leaves;
Leaves leaves;
StatusCode sc = mgr->objectLeaves(pObj, leaves);
const std::string* par0 = 0;
if ( pObj->address() ) {
par0 = pObj->address()->par();
}
if ( sc.isSuccess() ) {
for ( Leaves::const_iterator i=leaves.begin(); i != leaves.end(); i++ ) {
const std::string& id = (*i)->identifier();
DataObject* p = 0;
if ( !m_accessForeign && (*i)->address() ) {
if ( par0 ) {
const std::string* par1 = (*i)->address()->par();
if ( par1 ) {
if ( par0[0] != par1[0] ) {
continue;
}
}
}
}
if ( m_load ) {
sc = eventSvc()->retrieveObject(id, p);
}
else {
sc = eventSvc()->findObject(id, p);
}
if ( sc.isSuccess() ) {
if ( id != "/Event/Rec/Relations" || m_exploreRelations ) {
flg.push_back(i+1 == leaves.end());
explore(*i, flg);
flg.pop_back();
}
}
else {
flg.push_back(i+1 == leaves.end());
printObj(*i, flg);
flg.pop_back();
}
}
}
}
}
}

virtual StatusCode StoreExplorerAlg::finalize | ( |  | ) |
| inline virtual

Finalize.

Reimplemented from Algorithm.

Definition at line 228 of file StoreExplorerAlg.cpp.

{
if ( m_dataSvc ) m_dataSvc->release();
m_dataSvc = 0;
return StatusCode::SUCCESS;
}

virtual StatusCode StoreExplorerAlg::initialize | ( |  | ) |
| inline virtual

Initialize.

Reimplemented from Algorithm.

Definition at line 209 of file StoreExplorerAlg.cpp.

{
MsgStream log(msgSvc(), name());
m_rootName = "";
StatusCode sc = service(m_dataSvcName, m_dataSvc, true);
if ( sc.isSuccess() ) {
SmartIF<IDataManagerSvc> mgr(m_dataSvc);
if ( mgr ) {
m_rootName = mgr->rootName();
return sc;
}
log << MSG::ERROR << "Failed to retrieve IDataManagerSvc interface." << endmsg;
return StatusCode::FAILURE;
}
log << MSG::ERROR << "Failed to access service \""
<< m_dataSvcName << "\"." << endmsg;
return StatusCode::FAILURE;
}

void StoreExplorerAlg::printObj | ( | IRegistry * | pReg,
|  | std::vector< bool > & | flg
| ) |  |
| inline

Print datastore leaf.

Definition at line 91 of file StoreExplorerAlg.cpp.

{
MsgStream log(msgSvc(), name());
log << MSG::INFO;
for (size_t j = 1; j < flg.size(); j++ ) {
if ( !flg[j-1] && flg[j] ) log << "| ";
else if ( flg[j] ) log << " ";
else log << "| ";
}
log << "+--> " << pReg->name();
if ( pReg->address() ) {
log << " [Address: CLID="
<< std::showbase << std::hex << pReg->address()->clID();
log << " Type=" << (void*)pReg->address()->svcType() << "]";
}
else {
log << " [No Address]";
}
DataObject* p = pReg->object();
if ( p ) {
try {
std::string typ = System::typeinfoName(typeid(*p));
if ( m_testAccess ) {
p->clID();
}
log << " " << typ.substr(0,32);
}
catch (...) {
log << "Access test FAILED";
}
}
else {
log << " (Unloaded) ";
}
ObjectContainerBase* base = dynamic_cast<ObjectContainerBase*>(p);
if ( base ) {
try {
int numObj = base->numberOfObjects();
const CLID id = p->clID();
log << " [" << numObj << "]";
if ( m_testAccess ) {
CLID idd = id>>16;
switch(idd) {
case CLID_ObjectList>>16: /* ObjectList */
access((ObjectList<ContainedObject>*)base);
break;
case CLID_ObjectVector>>16: /* ObjectVector */
access((ObjectVector<ContainedObject>*)base);
break;
case (CLID_ObjectVector+0x00030000)>>16: /* Keyed Map */
access((KeyedContainer<KeyedObject<int>,Containers::Map>*)base);
break;
case (CLID_ObjectVector+0x00040000)>>16: /* Keyed Hashmap */
access((KeyedContainer<KeyedObject<int>,Containers::HashMap>*)base);
break;
case (CLID_ObjectVector+0x00050000)>>16: /* Keyed array */
access((KeyedContainer<KeyedObject<int>,Containers::Array>*)base);
break;
}
}
}
catch (...) {
log << "Access test FAILED";
}
}
log << endmsg;
}

## Member Data Documentation

bool StoreExplorerAlg::m_accessForeign
| private

Flag to indicate if foreign files should be opened.

Definition at line 48 of file StoreExplorerAlg.cpp.

IDataProviderSvc* StoreExplorerAlg::m_dataSvc
| private

Reference to data provider service.

Definition at line 50 of file StoreExplorerAlg.cpp.

std::string StoreExplorerAlg::m_dataSvcName
| private

Name of the data provider service.

Definition at line 52 of file StoreExplorerAlg.cpp.

bool StoreExplorerAlg::m_exploreRelations
| private

Flag to check if relations should be followed.

Definition at line 36 of file StoreExplorerAlg.cpp.

double StoreExplorerAlg::m_frequency
| private

Job option to set the printout frequency.

Definition at line 34 of file StoreExplorerAlg.cpp.

long StoreExplorerAlg::m_frqPrint
| private

Internal counter to adjust printout frequency.

Definition at line 42 of file StoreExplorerAlg.cpp.

bool StoreExplorerAlg::m_load
| private

Flag to load non existing items.

Definition at line 44 of file StoreExplorerAlg.cpp.

long StoreExplorerAlg::m_print
| private

Job option to limit printout to first nnn events.

Definition at line 32 of file StoreExplorerAlg.cpp.

long StoreExplorerAlg::m_printMissing
| private

Flag to indicate if missing entities should be printed.

Definition at line 38 of file StoreExplorerAlg.cpp.

std::string StoreExplorerAlg::m_rootName
| private

Name of the root leaf (obtained at initialize)

Definition at line 54 of file StoreExplorerAlg.cpp.

bool StoreExplorerAlg::m_testAccess
| private

Flag to test access to objects (DataObject and ContainedObject)

Definition at line 46 of file StoreExplorerAlg.cpp.

long StoreExplorerAlg::m_total
| private

Internal counter to trigger printouts.

Definition at line 40 of file StoreExplorerAlg.cpp.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCommonSvc/src/DataSvc/StoreExplorerAlg.cpp