The Gaudi Framework  master (37c0b60a)
PrintAlgsSequences.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include <Gaudi/Property.h>
13 #include <GaudiKernel/IAlgorithm.h>
15 #include <GaudiKernel/IProperty.h>
16 #include <GaudiKernel/MsgStream.h>
17 
18 namespace {
20  void printAlgsSequences( SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log, int indent ) {
22  log << MSG::ALWAYS;
23  for ( int i = 0; i < indent; ++i ) log << " ";
24  log << algname << endmsg;
25  auto prop = algmgr->algorithm<IProperty>( algname, false );
26  if ( prop ) {
27  // Try to get the property Members
28  Gaudi::Property<std::vector<std::string>> p( "Members", {} );
29  if ( prop->getProperty( &p ).isSuccess() ) {
30  for ( auto& subalgname : p.value() ) { printAlgsSequences( algmgr, subalgname, log, indent + 1 ); }
31  }
32  } else {
33  log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
34  }
35  }
37  void printAlgsSequences( IInterface* app ) {
38  auto prop = SmartIF<IProperty>( app );
39  auto algmgr = SmartIF<IAlgManager>( app );
40  auto msgsvc = SmartIF<IMessageSvc>( app );
41  if ( !prop || !algmgr ) return;
42  Gaudi::Property<std::vector<std::string>> topalg( "TopAlg", {} );
43  if ( prop->getProperty( &topalg ).isSuccess() ) {
44  MsgStream log( msgsvc, "ApplicationMgr" );
45  log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
46  for ( auto& algname : topalg.value() ) { printAlgsSequences( algmgr, algname, log, 0 ); }
47  log << MSG::ALWAYS << "******************************************************************************" << endmsg;
48  }
49  }
50 } // namespace
51 
52 #ifdef GAUDI_HASCLASSVISIBILITY
53 # pragma GCC visibility push( default )
54 #endif
55 extern "C" {
57 void py_helper_printAlgsSequences( IInterface* app ) { printAlgsSequences( app ); }
58 }
59 #ifdef GAUDI_HASCLASSVISIBILITY
60 # pragma GCC visibility pop
61 #endif
IAlgManager.h
std::string
STL class.
Gaudi.Configuration.log
log
Definition: Configuration.py:28
Read.app
app
Definition: Read.py:36
MSG::WARNING
@ WARNING
Definition: IMessageSvc.h:25
IMessageSvc.h
IProperty
Definition: IProperty.h:33
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:20
SmartIF< IAlgManager >
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
MsgStream
Definition: MsgStream.h:33
py_helper_printAlgsSequences
void py_helper_printAlgsSequences(IInterface *app)
Helper to call printAlgsSequences from Pyhton ctypes.
Definition: PrintAlgsSequences.cpp:57
MSG::ALWAYS
@ ALWAYS
Definition: IMessageSvc.h:25
IInterface
Definition: IInterface.h:239
IProperty.h
IAlgorithm.h
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
Property.h
MsgStream.h