| The Gaudi Framework v32r1 (f65d50dc)

PrintAlgsSequences.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/IAlgManager.h"
2 #include "GaudiKernel/IAlgorithm.h"
3 #include "GaudiKernel/IMessageSvc.h"
4 #include "GaudiKernel/IProperty.h"
5 #include "GaudiKernel/MsgStream.h"
6 #include "GaudiKernel/Property.h"
7
8 namespace {
10 void printAlgsSequences( SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log, int indent ) {
11 using Gaudi::Utils::TypeNameString;
12 log << MSG::ALWAYS;
13 for ( int i = 0; i < indent; ++i ) log << " ";
14 log << algname << endmsg;
15 auto prop = algmgr->algorithm<IProperty>( algname, false );
16 if ( prop ) {
17 // Try to get the property Members
18 Gaudi::Property<std::vector<std::string>> p( "Members", {} );
19 if ( prop->getProperty( &p ).isSuccess() ) {
20 for ( auto& subalgname : p.value() ) { printAlgsSequences( algmgr, subalgname, log, indent + 1 ); }
21 }
22 } else {
23 log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
24 }
25 }
27 void printAlgsSequences( IInterface* app ) {
28 auto prop = SmartIF<IProperty>( app );
29 auto algmgr = SmartIF<IAlgManager>( app );
30 auto msgsvc = SmartIF<IMessageSvc>( app );
31 if ( !prop || !algmgr ) return;
32 Gaudi::Property<std::vector<std::string>> topalg( "TopAlg", {} );
33 if ( prop->getProperty( &topalg ).isSuccess() ) {
34 MsgStream log( msgsvc, "ApplicationMgr" );
35 log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
36 for ( auto& algname : topalg.value() ) { printAlgsSequences( algmgr, algname, log, 0 ); }
37 log << MSG::ALWAYS << "******************************************************************************" << endmsg;
38 }
39 }
40 } // namespace
41
42 #ifdef GAUDI_HASCLASSVISIBILITY
43 # pragma GCC visibility push( default )
44 #endif
45 extern "C" {
47 void py_helper_printAlgsSequences( IInterface* app ) { printAlgsSequences( app ); }
48 }
49 #ifdef GAUDI_HASCLASSVISIBILITY
50 # pragma GCC visibility pop
51 #endif
IAlgManager::algorithm
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IAlgManager >
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
MsgStream.h
IAlgorithm.h
std::string
STL class.
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:10
py_helper_printAlgsSequences
void py_helper_printAlgsSequences(IInterface *app)
Helper to call printAlgsSequences from Pyhton ctypes.
Definition: PrintAlgsSequences.cpp:47
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
IMessageSvc.h
IProperty.h
Property.h
IAlgManager.h
MSG::WARNING
Definition: IMessageSvc.h:15
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:20
MSG::ALWAYS
Definition: IMessageSvc.h:15
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
Gaudi.Configuration.log
log
Definition: Configuration.py:13