| # 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
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
StoreSnifferAlg Class Reference

Small algorithm, which traverses the data store and prints a summary of the leafs accessed during the run. More...

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

## Classes
struct | LeafInfo

## Public Types
typedef map< string, LeafInfo > | SniffInfo
typedef map< string, map< int, int > > | Correlations
Public Types inherited from Algorithm
typedef Gaudi::PluginService::Factory2 < IAlgorithm *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 | base_class
| Typedef to this class.
typedef extend_interfaces3 < IAlgorithm, IProperty, IStateful > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from extend_interfaces3< I1, I2, I3 >
typedef mpl::fold< typename I1::iid::iids::type, typename mpl::fold< typename I2::iid::iids::type, typename I3::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type | ext_iids
| MPL set of interfaces extended by this one.

## Public Member Functions
| StoreSnifferAlg (const string &name, ISvcLocator *pSvc)
| Standard algorithm constructor.
virtual | ~StoreSnifferAlg ()
| Standard Destructor.
size_t | explore (IRegistry *pObj)
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

## Public Attributes
SmartIF< IDataManagerSvc > | m_mgr
SniffInfo | m_info
SniffInfo | m_curr
Correlations | m_corr
Correlations | m_links

## Additional Inherited Members
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 algorithm, which traverses the data store and prints a summary of the leafs accessed during the run.

Author
  : M.Frank

Version
  : 1.0

Definition at line 28 of file StoreSnifferAlg.cpp.

## Member Typedef Documentation

typedef map<string,map<int,int> > StoreSnifferAlg::Correlations

Definition at line 39 of file StoreSnifferAlg.cpp.

typedef map<string, LeafInfo> StoreSnifferAlg::SniffInfo

Definition at line 38 of file StoreSnifferAlg.cpp.

## Constructor & Destructor Documentation

StoreSnifferAlg::StoreSnifferAlg | ( | const string & | name,
|  | ISvcLocator * | pSvc
| ) |  |
| inline

Standard algorithm constructor.

Definition at line 45 of file StoreSnifferAlg.cpp.

: Algorithm(name, pSvc) {
}

virtual StoreSnifferAlg::~StoreSnifferAlg | ( |  | ) |
| inline virtual

Standard Destructor.

Definition at line 48 of file StoreSnifferAlg.cpp.

{
}

## Member Function Documentation

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

Execute procedure.

Definition at line 139 of file StoreSnifferAlg.cpp.

{
SmartDataPtr<DataObject> root(eventSvc(),"/Event");
if ( root ) {
m_curr.clear();
m_curr["/Event"].count = explore(root->registry());
m_curr["/Event"].clid = root->clID();
m_curr["/Event"].id = m_curr.size();
for(SniffInfo::const_iterator i=m_curr.begin(); i!=m_curr.end();++i) {
LeafInfo& li = m_info[(*i).first];
li.count++;
}
for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
const string& nam = (*i).first;
// const LeafInfo& leaf = (*i).second;
Correlations::iterator c=m_corr.find(nam);
if ( c == m_corr.end() ) {
m_corr[nam] = map<int,int>();
c = m_corr.find(nam);
}
for(SniffInfo::const_iterator l=m_curr.begin(); l!=m_curr.end();++l) {
const LeafInfo& li = (*l).second;
map<int,int>::iterator k = (*c).second.find(li.id);
if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
++((*c).second[li.id]);
}
c=m_links.find(nam);
if ( c == m_links.end() ) {
m_links[nam] = map<int,int>();
c = m_links.find(nam);
}
if ( m_curr.find(nam) != m_curr.end() ) {
SmartDataPtr<DataObject> obj(eventSvc(),nam);
if ( obj ) {
LinkManager* m = obj->linkMgr();
for(long l=0; l<m->size(); ++l) {
LinkManager::Link* lnk=m->link(l);
SniffInfo::const_iterator il=m_curr.find(lnk->path());
// cout << "Link:" << lnk->path() << " " << (char*)(il != m_curr.end() ? "Found" : "Not there") << endl;
if ( il != m_curr.end() ) {
if ( lnk->object() ) {
const LeafInfo& li = (*il).second;
map<int,int>::iterator k = (*c).second.find(li.id);
if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
++((*c).second[li.id]);
}
}
}
}
}
}
return StatusCode::SUCCESS;
}
return StatusCode::SUCCESS;
}

size_t StoreSnifferAlg::explore | ( | IRegistry * | pObj | ) |
| inline

We are only interested in leaves with an object

Definition at line 51 of file StoreSnifferAlg.cpp.

{
if ( 0 != pObj ) {
SmartIF<IDataManagerSvc> mgr(eventSvc());
if ( mgr ) {
typedef vector<IRegistry*> Leaves;
Leaves leaves;
StatusCode sc = m_mgr->objectLeaves(pObj, leaves);
if ( sc.isSuccess() ) {
for (Leaves::const_iterator i=leaves.begin(); i != leaves.end(); i++ ) {
IRegistry* pReg = *i;
const string& id = pReg->identifier();
if ( pReg->address() && pReg->object() ) {
SniffInfo::iterator j=m_info.find(id);
if ( j == m_info.end() ) {
m_info[id] = LeafInfo();
j = m_info.find(id);
(*j).second.count = 0;
(*j).second.id = m_info.size();
(*j).second.clid = pReg->object()->clID();
}
m_curr[id].id = m_info[id].id;
m_curr[id].count = explore(pReg);
}
}
return leaves.size();
}
}
}
return 0;
}

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

Finalize.

Reimplemented from Algorithm.

Definition at line 91 of file StoreSnifferAlg.cpp.

{
MsgStream log(msgSvc(), name());
log << MSG::ALWAYS << "== BEGIN ============= Access list content:" << m_info.size() << endmsg;
for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
const LeafInfo& info = (*i).second;
log << "== ITEM == " << right << setw(4) << dec << info.id << " clid:"
<< right << setw(8) << hex << info.clid << " Count:"
<< right << setw(6) << dec << info.count << " "
<< (*i).first+":"
<< endmsg;
Correlations::const_iterator c=m_corr.find((*i).first);
if ( c != m_corr.end() ) {
int cnt = 0;
log << "== CORRELATIONS:" << (*c).second.size() << endmsg;
for(map<int,int>::const_iterator k=(*c).second.begin(); k!=(*c).second.end();++k) {
if ( (*k).second > 0 ) {
log << dec << (*k).first << ":" << (*k).second << " ";
if ( ++cnt == 10 ) {
cnt = 0;
log << endmsg;
}
}
}
if ( cnt > 0 ) log << endmsg;
}
Correlations::const_iterator l=m_links.find((*i).first);
if ( l != m_links.end() ) {
int cnt = 0;
log << "== LINKS:" << (*l).second.size() << endmsg;
for(map<int,int>::const_iterator k=(*l).second.begin(); k!=(*l).second.end();++k) {
if ( (*k).second > 0 ) {
log << dec << (*k).first << ":" << (*k).second << " ";
if ( ++cnt == 10 ) {
cnt = 0;
log << endmsg;
}
}
}
if ( cnt > 0 ) log << endmsg;
}
}
log << MSG::ALWAYS << "== END =============== Access list content:" << m_info.size() << endmsg;
m_info.clear();
m_mgr = 0;
return StatusCode::SUCCESS;
}

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

Initialize.

Reimplemented from Algorithm.

Definition at line 84 of file StoreSnifferAlg.cpp.

{
m_info.clear();
m_mgr = eventSvc();
return StatusCode::SUCCESS;
}

## Member Data Documentation

Correlations StoreSnifferAlg::m_corr

Definition at line 42 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_curr

Definition at line 41 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_info

Definition at line 41 of file StoreSnifferAlg.cpp.

Correlations StoreSnifferAlg::m_links

Definition at line 42 of file StoreSnifferAlg.cpp.

SmartIF<IDataManagerSvc> StoreSnifferAlg::m_mgr

Definition at line 31 of file StoreSnifferAlg.cpp.

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

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