8 #include "GaudiKernel/ObjectContainerBase.h"
9 #include "GaudiKernel/ObjectList.h"
10 #include "GaudiKernel/ObjectVector.h"
11 #include "GaudiKernel/KeyedContainer.h"
12 #include "GaudiKernel/IDataProviderSvc.h"
13 #include "GaudiKernel/IDataManagerSvc.h"
14 #include "GaudiKernel/IOpaqueAddress.h"
15 #include "GaudiKernel/SmartDataPtr.h"
16 #include "GaudiKernel/Algorithm.h"
17 #include "GaudiKernel/IRegistry.h"
18 #include "GaudiKernel/MsgStream.h"
19 #include "GaudiKernel/SmartIF.h"
75 if ( !p )
return "Access FAILED.";
77 [&](std::string
s,
typename T::const_reference
i) {
78 return s+std::to_string(p->index(
i)) +
":" + std::to_string(
i->clID()) +
",";
80 return result.substr(0, result.length()-2);
88 for (
size_t j = 1; j < flg.size(); j++ ) {
89 if ( !flg[j-1] && flg[j] ) log <<
"| ";
90 else if ( flg[j] ) log <<
" ";
93 log <<
"+--> " << pReg->
name();
95 log <<
" [Address: CLID="
96 << std::showbase << std::hex << pReg->
address()->
clID()
100 log <<
" [No Address]";
106 if ( m_testAccess ) p->
clID();
107 log <<
" " << typ.substr(0,32);
110 log <<
"Access test FAILED";
114 log <<
" (Unloaded) ";
121 log <<
" [" << numObj <<
"]";
122 if ( m_testAccess ) {
125 case CLID_ObjectList>>16:
128 case CLID_ObjectVector>>16:
131 case (CLID_ObjectVector+0x00030000)>>16:
134 case (CLID_ObjectVector+0x00040000)>>16:
137 case (CLID_ObjectVector+0x00050000)>>16:
144 log <<
"Access test FAILED";
155 std::vector<IRegistry*> leaves;
157 const std::string* par0 =
nullptr;
160 for (
auto i=leaves.begin();
i != leaves.end();
i++ ) {
161 const std::string&
id = (*i)->identifier();
163 if ( !m_accessForeign && (*i)->address() ) {
165 const std::string* par1 = (*i)->address()->par();
166 if ( par1 && par0[0] != par1[0] )
continue;
175 if (
id !=
"/Event/Rec/Relations" || m_exploreRelations ) {
176 flg.push_back(
i+1 == leaves.end());
181 flg.push_back(
i+1 == leaves.end());
195 m_dataSvc =
service(m_dataSvcName,
true);
197 log <<
MSG::ERROR <<
"Failed to access service \""
198 << m_dataSvcName <<
"\"." <<
endmsg;
203 log <<
MSG::ERROR <<
"Failed to retrieve IDataManagerSvc interface." <<
endmsg;
206 m_rootName = mgr->rootName();
220 if ( ((m_print > m_total++) || (m_frequency*m_total > m_frqPrint)) &&
root ) {
221 if ( m_frequency*m_total > m_frqPrint ) m_frqPrint++;
222 std::string store_name =
"Unknown";
226 if ( isvc ) store_name = isvc->name();
228 log <<
MSG::INFO <<
"========= " << m_rootName <<
"["
229 <<
"0x" << std::hex << (
unsigned long)
root.ptr() << std::dec
230 <<
"@" << store_name <<
"]:" <<
endmsg;
231 std::vector<bool> flg(1,
true);
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
Initialize.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
long m_printMissing
Flag to indicate if missing entities should be printed.
SmartIF< IDataProviderSvc > m_dataSvc
Reference to data provider service.
bool m_accessForeign
Flag to indicate if foreign files should be opened.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
auto begin(reverse_wrapper< T > &w)
bool isSuccess() const
Test for a status code of SUCCESS.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
virtual size_type numberOfObjects() const =0
Number of objects in the container.
ObjectVector is one of the basic Gaudi container classes capable of being registered in Data Stores...
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
template class KeyedContainer, KeyedContainer.h
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode execute() override
Execute procedure.
bool m_load
Flag to load non existing items.
virtual long svcType() const =0
Retrieve service type.
long m_total
Internal counter to trigger printouts.
double m_frequency
Job option to set the printout frequency.
ObjectList is one of the basic Gaudi container classes capable of being registered in Data Stores...
long m_print
Job option to limit printout to first nnn events.
const std::string & name() const override
The identifying name of the algorithm object.
TYPE * get() const
Get interface pointer.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
virtual const CLID & clID() const
Retrieve reference to class definition structure.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
virtual StatusCode findObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Find object identified by its directory entry.
virtual const CLID & clID() const =0
Retrieve class information from link.
#define DECLARE_COMPONENT(type)
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
std::string m_rootName
Name of the root leaf (obtained at initialize)
StoreExplorerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
void printObj(IRegistry *pReg, std::vector< bool > &flg)
Print datastore leaf.
unsigned int CLID
Class ID definition.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual DataObject * object() const =0
Retrieve object behind the link.
std::string m_dataSvcName
Name of the data provider service.
void explore(IRegistry *pObj, std::vector< bool > &flg)
Base class from which all concrete algorithm classes should be derived.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
StatusCode finalize() override
Finalize.
bool m_exploreRelations
Flag to check if relations should be followed.
KeyedObjectManager Class to manage keyed objects.
A small class used to access easily (and efficiently) data items residing in data stores...
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
~StoreExplorerAlg() override=default
Standard Destructor.
Small algorith, which traverses the data store and prints generic information about all leaves...
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
ObjectContainerBase is the base class for Gaudi container classes.
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.
long m_frqPrint
Internal counter to adjust printout frequency.
A DataObject is the base class of any identifiable object on any data store.
bool m_testAccess
Flag to test access to objects (DataObject and ContainedObject)
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.