The Gaudi Framework  v33r1 (b1225454)
DataOnDemandSvc Class Reference

The DataOnDemandSvc listens to incidents typically triggered by the data service of the configurable name "IncidentName". More...

#include <src/IncidentSvc/DataOnDemandSvc.h>

Inheritance diagram for DataOnDemandSvc:
Collaboration diagram for DataOnDemandSvc:

Classes

struct  Leaf
 
struct  Node
 Helper class of the DataOnDemandSvc. More...
 
struct  Protection
 Helper class of the DataOnDemandSvc. More...
 

Public Types

typedef std::vector< std::stringSetup
 
typedef TClass * ClassH
 
typedef GaudiUtils::HashMap< Gaudi::StringKey, NodeNodeMap
 
typedef GaudiUtils::HashMap< Gaudi::StringKey, LeafAlgMap
 
- Public Types inherited from extends< Service, IIncidentListener >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

StatusCode initialize () override
 Inherited Service overrides: Service initialization. More...
 
StatusCode finalize () override
 Inherited Service overrides: Service finalization. More...
 
StatusCode reinitialize () override
 Inherited Service overrides: Service reinitialization. More...
 
void handle (const Incident &incident) override
 IIncidentListener interfaces overrides: incident handling. More...
 
- Public Member Functions inherited from extends< Service, IIncidentListener >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service. More...
 
StatusCode sysStart () override
 Initialize Service. More...
 
StatusCode sysStop () override
 Initialize Service. More...
 
StatusCode sysFinalize () override
 Finalize Service. More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
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. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

StatusCode configureHandler (Leaf &leaf)
 Configure handler for leaf. More...
 
StatusCode execHandler (const std::string &tag, Leaf &leaf)
 Execute leaf handler (algorithm) More...
 
StatusCode execHandler (const std::string &tag, Node &node)
 Execute node handler (simple object creation using seal reflection) More...
 
StatusCode setupNodeHandlers ()
 Initialize node handlers. More...
 
StatusCode setupAlgHandlers ()
 Initialize leaf handlers. More...
 
StatusCode setup ()
 Setup routine (called by (re-) initialize. More...
 
void i_setNodeHandler (const std::string &name, const std::string &type)
 Internal method to initialize a node handler. More...
 
StatusCode i_setAlgHandler (const std::string &name, const Gaudi::Utils::TypeNameString &alg)
 Internal method to initialize an algorithm handler. More...
 
StatusCode update ()
 update the handlers More...
 
void dump (const MSG::Level level, const bool mode=true) const
 dump the content of DataOnDemand service More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Types

typedef std::map< std::string, std::stringMap
 

Private Member Functions

void force_update (Gaudi::Details::PropertyBase &p)
 
void deprecated_property (Gaudi::Details::PropertyBase &p)
 

Private Attributes

SmartIF< IIncidentSvcm_incSvc = nullptr
 Incident service. More...
 
SmartIF< IAlgManagerm_algMgr = nullptr
 Algorithm manager. More...
 
SmartIF< IDataProviderSvcm_dataSvc = nullptr
 Data provider reference. More...
 
SmartIF< IToolSvcm_toolSvc
 Data provider reference. More...
 
AlgMap m_algs
 Map of algorithms to handle incidents. More...
 
NodeMap m_nodes
 Map of "empty" objects to be placed as intermediate nodes. More...
 
bool m_updateRequired = true
 
ChronoEntity m_total
 
unsigned long long m_statAlg = 0
 
unsigned long long m_statNode = 0
 
unsigned long long m_stat = 0
 
ChronoEntity m_timer_nodes
 
ChronoEntity m_timer_algs
 
ChronoEntity m_timer_all
 
bool m_locked_nodes = false
 
bool m_locked_algs = false
 
bool m_locked_all = false
 
std::vector< IDODNodeMapper * > m_nodeMappers
 
std::vector< IDODAlgMapper * > m_algMappers
 
Gaudi::Property< std::stringm_trapType {this, "IncidentName", "DataFault", "the type of handled Incident"}
 
Gaudi::Property< std::stringm_dataSvcName {this, "DataSvc", "EventDataSvc", "DataSvc name"}
 
Gaudi::Property< bool > m_partialPath {this, "UsePreceedingPath", true, "allow creation of partial leaves"}
 
Gaudi::Property< bool > m_dump
 
Gaudi::Property< bool > m_init {this, "PreInitialize", false, "(pre)initialize all algorithms"}
 
Gaudi::Property< bool > m_allowInitFailure
 
Gaudi::Property< Setupm_algMapping
 
Gaudi::Property< Setupm_nodeMapping
 
Gaudi::Property< Mapm_algMap {this, "AlgMap", {}, &DataOnDemandSvc::force_update, "mapping {'data': 'algorithm'}"}
 
Gaudi::Property< Mapm_nodeMap {this, "NodeMap", {}, &DataOnDemandSvc::force_update, "mapping {'data': 'type'}"}
 
Gaudi::Property< std::stringm_prefix {this, "Prefix", "/Event/"}
 
Gaudi::Property< std::vector< std::string > > m_nodeMapTools
 
Gaudi::Property< std::vector< std::string > > m_algMapTools
 

Additional Inherited Members

- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::Property< int > m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
 
Gaudi::Property< bool > m_auditInit {this, "AuditServices", false, " unused"}
 
Gaudi::Property< bool > m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
 
Gaudi::Property< bool > m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
 
Gaudi::Property< bool > m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
 
Gaudi::Property< bool > m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
 
Gaudi::Property< bool > m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
 
Gaudi::Property< bool > m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

The DataOnDemandSvc listens to incidents typically triggered by the data service of the configurable name "IncidentName".

In the job options handlers can be declared, which allow to configure this service. Such handlers are either:

  • Node handlers, if objects other than the default object type have to be instantiated. DataOnDemandSvc.Nodes = { "DATA='/Event/Rec' TYPE='DataObject'", "DATA='/Event/Rec/Muon' TYPE='DataObject'" };
  • Leaf handlers (Algorithms), which get instantiated and executed on demand. DataOnDemandSvc.Algorithms = { "DATA='/Event/Rec/Muon/Digits' TYPE='MuonDigitAlg/MyMuonDigits'" }; If the algorithm name is omitted the class name will be the instance name.

The handlers only get called if the exact path matches. In the event already the partial path to any handler is missing a leaf handler may be triggered, which includes the partial paths ( DataOnDemandSvc.UsePreceedingPath = true )

2006-10-15: New options (using map-like semantics:)

{ "Phys/StdLoosePions/Particles" : "PreLoadParticles/StdLoosePions" ,
"Phys/StdLoosePions/Vertioces" : "PreLoadParticles/StdLoosePions" } ;
{ "Phys" : "DataObject" ,
"MC" : "DataObject" } ;

New treatment of preceding paths. for each registered leaf or node the all parent nodes are added into the node-map with default directory type 'DataObject'

The major properties are equipped with handlers (more or less mandatory for interactive work in python)

From now the default prefix ( "/Event/" ) could be omitted from any data-item. It will be added automatically.

Author
M.Frank
Version
1.0

Definition at line 100 of file DataOnDemandSvc.h.

Member Typedef Documentation

◆ AlgMap

◆ ClassH

typedef TClass* DataOnDemandSvc::ClassH

Definition at line 105 of file DataOnDemandSvc.h.

◆ Map

Definition at line 274 of file DataOnDemandSvc.h.

◆ NodeMap

◆ Setup

Definition at line 104 of file DataOnDemandSvc.h.

Member Function Documentation

◆ configureHandler()

StatusCode DataOnDemandSvc::configureHandler ( Leaf leaf)
protected

Configure handler for leaf.

Parameters
leaf[IN] Reference to leaf handler
Returns
StatusCode indicating success or failure

Definition at line 395 of file DataOnDemandSvc.cpp.

395  {
396  if ( l.algorithm ) { return StatusCode::SUCCESS; }
397  if ( !m_algMgr ) { return StatusCode::FAILURE; }
398  l.algorithm = m_algMgr->algorithm( l.name, false );
399  if ( l.algorithm ) { return StatusCode::SUCCESS; }
400  // create it!
401  StatusCode sc = m_algMgr->createAlgorithm( l.type, l.name, l.algorithm, true );
402  if ( sc.isFailure() ) {
403  error() << "Failed to create algorithm " << l.type << "('" << l.name << "')" << endmsg;
404  l.algorithm = nullptr;
405  return sc; // RETURN
406  }
407  if ( l.algorithm->isInitialized() ) { return StatusCode::SUCCESS; }
408  // initialize it!
409  sc = l.algorithm->sysInitialize();
410  if ( sc.isFailure() ) {
411  error() << "Failed to initialize algorithm " << l.type << "('" << l.name << "')" << endmsg;
412  l.algorithm = nullptr;
413  return sc; // RETURN
414  }
415  if ( Gaudi::StateMachine::RUNNING == l.algorithm->FSMState() ) { return StatusCode::SUCCESS; }
416  // run it!
417  sc = l.algorithm->sysStart();
418  if ( sc.isFailure() ) {
419  error() << "Failed to 'run' algorithm " << l.type << "('" << l.name << "')" << endmsg;
420  l.algorithm = nullptr;
421  return sc; // RETURN
422  }
423  return StatusCode::SUCCESS;
424 }
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
dictionary l
Definition: gaudirun.py:543
SmartIF< IAlgManager > m_algMgr
Algorithm manager.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
virtual StatusCode createAlgorithm(std::string algtype, std::string algname, IAlgorithm *&alg, bool managed=false, bool checkIfExists=true)=0
Create an instance of a algorithm type that has been declared beforehand and assigns to it a name.
bool isFailure() const
Definition: StatusCode.h:145
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ deprecated_property()

void DataOnDemandSvc::deprecated_property ( Gaudi::Details::PropertyBase p)
inlineprivate

Definition at line 217 of file DataOnDemandSvc.h.

217  {
218  warning() << p.name() << " " << p.documentation() << endmsg;
219  force_update( p );
220  };
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
const std::string name() const
property name
Definition: Property.h:46
void force_update(Gaudi::Details::PropertyBase &p)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
std::string documentation() const
property documentation
Definition: Property.h:48

◆ dump()

void DataOnDemandSvc::dump ( const MSG::Level  level,
const bool  mode = true 
) const
protected

dump the content of DataOnDemand service

Parameters
levelthe printout level
modethe printout mode

Definition at line 617 of file DataOnDemandSvc.cpp.

617  {
618  if ( m_algs.empty() && m_nodes.empty() ) { return; }
619 
622  for ( auto& alg : m_algs ) {
623  auto check = _m.find( alg.first );
624  if ( _m.end() != check ) {
625  warning() << " The data item is activated for '" << check->first << "' as '" << check->second.first << "'"
626  << endmsg;
627  }
628  const Leaf& l = alg.second;
629  std::string nam = ( l.name == l.type ? l.type : ( l.type + "/" + l.name ) );
630  //
631  if ( !mode && 0 == l.num ) { continue; }
632  //
633  std::string val;
634  if ( mode ) {
635  val = ( !l.algorithm ) ? "F" : "T";
636  } else {
637  val = std::to_string( l.num );
638  }
639  //
640  _m[no_prefix( alg.first, m_prefix )] = {nam, val};
641  }
642  // nodes:
643  for ( const auto& node : m_nodes ) {
644  auto check = _m.find( node.first );
645  if ( _m.end() != check ) {
646  warning() << " The data item is already activated for '" << check->first << "' as '" << check->second.first << "'"
647  << endmsg;
648  }
649  const Node& n = node.second;
650  std::string nam = "'" + n.name + "'";
651  //
652  std::string val;
653 
654  if ( !mode && 0 == n.num ) { continue; }
655 
656  if ( mode ) {
657  val = ( 0 == n.clazz ) ? "F" : "T";
658  } else {
659  val = std::to_string( n.num );
660  }
661  //
662  _m[no_prefix( node.first, m_prefix )] = {nam, val};
663  }
664  //
665  if ( _m.empty() ) { return; }
666 
667  // find the correct formats
668  size_t n1 = 0;
669  size_t n2 = 0;
670  size_t n3 = 0;
671  for ( const auto& i : _m ) {
672  n1 = std::max( n1, i.first.size() );
673  n2 = std::max( n2, i.second.first.size() );
674  n3 = std::max( n3, i.second.second.size() );
675  }
676  if ( 10 > n1 ) { n1 = 10; }
677  if ( 10 > n2 ) { n2 = 10; }
678  if ( 60 < n1 ) { n1 = 60; }
679  if ( 60 < n2 ) { n2 = 60; }
680  //
681 
682  const std::string _f = " | %%1$-%1%.%1%s | %%2$-%2%.%2%s | %%3$%3%.%3%s |";
683  boost::format _ff( _f );
684  _ff % n1 % n2 % n3;
685 
686  const std::string _format = _ff.str();
687 
688  auto& msg = msgStream( level );
689 
690  if ( mode ) {
691  msg << "Data-On-Demand Actions enabled for:";
692  } else {
693  msg << "Data-On-Demand Actions has been used for:";
694  }
695 
696  boost::format fmt1( _format );
697  fmt1 % "Address" % "Creator" % ( mode ? "S" : "#" );
698  //
699  const std::string header = fmt1.str();
700  std::string line = std::string( header.size(), '-' );
701  line[0] = ' ';
702 
703  msg << '\n' << line << '\n' << header << '\n' << line;
704 
705  // make the actual printout:
706  for ( const auto& item : _m ) {
707  boost::format fmt( _format );
708  msg << '\n' << ( fmt % item.first % item.second.first % item.second.second );
709  }
710 
711  msg << '\n' << line << endmsg;
712 }
T empty(T... args)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
T to_string(T... args)
T end(T... args)
STL class.
GAUDI_API std::string header(const int ID=Default)
get the recommended header by enum
STL class.
Gaudi::Property< std::string > m_prefix
NodeMap m_nodes
Map of "empty" objects to be placed as intermediate nodes.
MsgStream & msgStream() const
Return an uninitialized MsgStream.
T max(T... args)
dictionary l
Definition: gaudirun.py:543
T find(T... args)
T size(T... args)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
AlgMap m_algs
Map of algorithms to handle incidents.
bool empty() const
Definition: Map.h:201
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ execHandler() [1/2]

StatusCode DataOnDemandSvc::execHandler ( const std::string tag,
Leaf leaf 
)
protected

Execute leaf handler (algorithm)

Parameters
tag[IN] Path to requested leaf
leaf[IN] Reference to leaf handler
Returns
StatusCode indicating success or failure

Definition at line 581 of file DataOnDemandSvc.cpp.

581  {
583  //
584  if ( l.executing ) { return StatusCode::FAILURE; } // RETURN
585  //
586  if ( !l.algorithm ) {
587  StatusCode sc = configureHandler( l );
588  if ( sc.isFailure() ) {
589  error() << "Failed to configure handler for: " << l.name << "[" << l.type << "] " << tag << endmsg;
590  return sc; // RETURN
591  }
592  }
593  //
594  Chrono atimer( m_total );
595  //
596  Protection p( l.executing );
597  // FIXME: this will cause problems for Hive, as we need to set
598  // the EventContext of the called Algorithm.
599  // if (!l.algorithm->getContext()) {
600  // l.algorithm->setContext( &Gaudi::Hive::currentContext() );
601  // }
602  StatusCode sc = l.algorithm->sysExecute( Gaudi::Hive::currentContext() );
603  if ( sc.isFailure() ) {
604  error() << "Failed to execute the algorithm:" << l.algorithm->name() << " for location:" << tag << endmsg;
605  return sc; // RETURN
606  }
607  ++l.num;
608  //
609  return StatusCode::SUCCESS;
610 }
ChronoEntity m_timer_algs
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
A small utility class for chronometry of user codes.
Definition: Chrono.h:35
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
GAUDI_API const EventContext & currentContext()
dictionary l
Definition: gaudirun.py:543
Helper object, useful for measurement of CPU-performance of highly-recursive structures,...
Definition: LockedChrono.h:60
constexpr static const auto FAILURE
Definition: StatusCode.h:101
ChronoEntity m_total
bool isFailure() const
Definition: StatusCode.h:145
StatusCode configureHandler(Leaf &leaf)
Configure handler for leaf.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ execHandler() [2/2]

StatusCode DataOnDemandSvc::execHandler ( const std::string tag,
Node node 
)
protected

Execute node handler (simple object creation using seal reflection)

Parameters
tag[IN] Path to requested leaf
node[IN] Reference to node handler
Returns
StatusCode indicating success or failure

Definition at line 541 of file DataOnDemandSvc.cpp.

541  {
542 
544 
545  if ( n.executing ) { return StatusCode::FAILURE; } // RETURN
546 
547  Protection p( n.executing );
548 
550 
551  if ( n.dataObject ) {
552  object.reset( new DataObject() );
553  } else {
554  // try to recover the handler
555  if ( !n.clazz ) { n.clazz = TClass::GetClass( n.name.c_str() ); }
556  if ( !n.clazz ) {
557  error() << "Failed to get dictionary for class '" << n.name << "' for location:" << tag << endmsg;
558  return StatusCode::FAILURE; // RETURN
559  }
560 
561  object.reset( reinterpret_cast<DataObject*>( n.clazz->New() ) );
562 
563  if ( !object ) {
564  error() << "Failed to create an object of type:" << n.clazz->GetName() << " for location:" << tag << endmsg;
565  return StatusCode::FAILURE; // RETURN
566  }
567  }
568  //
569  StatusCode sc = m_dataSvc->registerObject( tag, object.release() );
570  if ( sc.isFailure() ) {
571  error() << "Failed to register an object of type:" << n.name << " at location:" << tag << endmsg;
572  return sc; // RETURN
573  }
574  ++n.num;
575  //
576  return StatusCode::SUCCESS;
577 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
SmartIF< IDataProviderSvc > m_dataSvc
Data provider reference.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
T reset(T... args)
STL class.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Helper object, useful for measurement of CPU-performance of highly-recursive structures,...
Definition: LockedChrono.h:60
ChronoEntity m_timer_nodes
constexpr static const auto FAILURE
Definition: StatusCode.h:101
bool isFailure() const
Definition: StatusCode.h:145
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ finalize()

StatusCode DataOnDemandSvc::finalize ( )
override

Inherited Service overrides: Service finalization.

Definition at line 211 of file DataOnDemandSvc.cpp.

211  {
212  //
213  info() << "Handled \"" << m_trapType.value() << "\" incidents: " << m_statAlg << "/" << m_statNode << "/" << m_stat
214  << "(Alg/Node/Total)." << endmsg;
215  if ( m_dump || msgLevel( MSG::DEBUG ) ) {
216  info() << m_total.outputUserTime( "Algorithm timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] ",
218  << m_total.outputUserTime( "Total:%2%[s]", System::Sec ) << endmsg;
219  info() << m_timer_nodes.outputUserTime( "Nodes timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] ",
221  << m_timer_nodes.outputUserTime( "Total:%2%[s]", System::Sec ) << endmsg;
222  info() << m_timer_algs.outputUserTime( "Algs timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] ",
224  << m_timer_algs.outputUserTime( "Total:%2%[s]", System::Sec ) << endmsg;
225  info() << m_timer_all.outputUserTime( "All timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] ",
227  << m_timer_all.outputUserTime( "Total:%2%[s]", System::Sec ) << endmsg;
228  }
229  // dump it!
230  if ( m_dump ) {
231  dump( MSG::INFO, false );
232  } else if ( msgLevel( MSG::DEBUG ) ) {
233  dump( MSG::DEBUG, false );
234  }
235  //
236  if ( m_incSvc ) {
238  m_incSvc.reset();
239  }
240  m_algMgr.reset();
241  m_dataSvc.reset();
242  if ( m_toolSvc ) { // we may not have retrieved the ToolSvc
243  // Do not call releaseTool if the ToolSvc was already finalized.
245  for ( const auto& i : m_nodeMappers ) m_toolSvc->releaseTool( i ).ignore();
246  for ( const auto& i : m_algMappers ) m_toolSvc->releaseTool( i ).ignore();
247  } else {
248  warning() << "ToolSvc already finalized: cannot release tools. Check options." << endmsg;
249  }
252  m_toolSvc.reset();
253  }
254  return Service::finalize();
255 }
ChronoEntity m_timer_all
StatusCode finalize() override
Definition: Service.cpp:174
ChronoEntity m_timer_algs
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
SmartIF< IIncidentSvc > m_incSvc
Incident service.
Gaudi::Property< std::string > m_trapType
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
void dump(const MSG::Level level, const bool mode=true) const
dump the content of DataOnDemand service
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
SmartIF< IDataProviderSvc > m_dataSvc
Data provider reference.
unsigned long long m_stat
T clear(T... args)
std::vector< IDODNodeMapper * > m_nodeMappers
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:168
SmartIF< IAlgManager > m_algMgr
Algorithm manager.
SmartIF< IToolSvc > m_toolSvc
Data provider reference.
ChronoEntity m_timer_nodes
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
ChronoEntity m_total
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:96
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
Gaudi::Property< bool > m_dump
std::vector< IDODAlgMapper * > m_algMappers
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
unsigned long long m_statNode
unsigned long long m_statAlg
std::string outputUserTime() const
print the chrono ;

◆ force_update()

void DataOnDemandSvc::force_update ( Gaudi::Details::PropertyBase p)
inlineprivate

Definition at line 213 of file DataOnDemandSvc.h.

213  {
214  verbose() << "updated property " << p.name() << ", forcing update" << endmsg;
215  m_updateRequired = true;
216  };
const std::string name() const
property name
Definition: Property.h:46
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ handle()

void DataOnDemandSvc::handle ( const Incident incident)
override

IIncidentListener interfaces overrides: incident handling.

Definition at line 477 of file DataOnDemandSvc.cpp.

477  {
478 
480 
481  ++m_stat;
482  // proper incident type?
483  if ( incident.type() != m_trapType ) { return; } // RETURN
484  const DataIncident* inc = dynamic_cast<const DataIncident*>( &incident );
485  if ( !inc ) { return; } // RETURN
486  // update if needed!
487  if ( m_updateRequired ) {
488  if ( !update() ) throw GaudiException( "Failed to update", name(), StatusCode::FAILURE );
489  }
490 
491  if ( msgLevel( MSG::VERBOSE ) ) {
492  verbose() << "Incident: [" << incident.type() << "] "
493  << " = " << incident.source() << " Location:" << inc->tag() << endmsg;
494  }
495  // ==========================================================================
496  Gaudi::StringKey tag( inc->tag() );
497  // ==========================================================================
498  auto icl = m_nodes.find( tag );
499  if ( icl != m_nodes.end() ) {
500  StatusCode sc = execHandler( tag, icl->second );
501  if ( sc.isSuccess() ) { ++m_statNode; }
502  return; // RETURN
503  }
504  // ==========================================================================
505  auto ialg = m_algs.find( tag );
506  if ( ialg != m_algs.end() ) {
507  StatusCode sc = execHandler( tag, ialg->second );
508  if ( sc.isSuccess() ) { ++m_statAlg; }
509  return; // RETURN
510  }
511  // ==========================================================================
512  // Fall back on the tools
513  if ( m_toolSvc ) {
514  if ( msgLevel( MSG::VERBOSE ) ) verbose() << "Try to find mapping with mapping tools" << endmsg;
515  Finder finder( no_prefix( inc->tag(), m_prefix ), m_nodeMappers, m_algMappers );
516  // - try the node mappers
517  std::string node = finder.node();
518  if ( isGood( node ) ) {
519  // if one is found update the internal node mapping and try again.
520  if ( msgLevel( MSG::VERBOSE ) ) verbose() << "Found Node handler: " << node << endmsg;
521  i_setNodeHandler( inc->tag(), node );
522  handle( incident );
523  --m_stat; // avoid double counting because of recursion
524  return;
525  }
526  // - try alg mappings
527  Gaudi::Utils::TypeNameString alg = finder.alg();
528  if ( isGood( alg ) ) {
529  // we got an algorithm, update alg map and try to handle again
530  if ( msgLevel( MSG::VERBOSE ) ) verbose() << "Found Algorithm handler: " << alg << endmsg;
531  i_setAlgHandler( inc->tag(), alg ).ignore();
532  handle( incident );
533  --m_stat; // avoid double counting because of recursion
534  return;
535  }
536  }
537 }
void i_setNodeHandler(const std::string &name, const std::string &type)
Internal method to initialize a node handler.
ChronoEntity m_timer_all
Define general base for Gaudi exception.
const std::string & type() const
Access to the incident type.
Definition: Incident.h:48
void handle(const Incident &incident) override
IIncidentListener interfaces overrides: incident handling.
Gaudi::Property< std::string > m_trapType
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:44
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:54
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
Gaudi::Property< std::string > m_prefix
unsigned long long m_stat
iterator end()
Definition: Map.h:140
Helper class to parse a string of format "type/name".
StatusCode execHandler(const std::string &tag, Leaf &leaf)
Execute leaf handler (algorithm)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
iterator find(const key_type &key)
Definition: Map.h:157
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
NodeMap m_nodes
Map of "empty" objects to be placed as intermediate nodes.
bool isSuccess() const
Definition: StatusCode.h:365
std::vector< IDODNodeMapper * > m_nodeMappers
SmartIF< IToolSvc > m_toolSvc
Data provider reference.
Helper object, useful for measurement of CPU-performance of highly-recursive structures,...
Definition: LockedChrono.h:60
AlgMap m_algs
Map of algorithms to handle incidents.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Data service incident class.
StatusCode i_setAlgHandler(const std::string &name, const Gaudi::Utils::TypeNameString &alg)
Internal method to initialize an algorithm handler.
std::vector< IDODAlgMapper * > m_algMappers
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
unsigned long long m_statNode
unsigned long long m_statAlg
StatusCode update()
update the handlers

◆ i_setAlgHandler()

StatusCode DataOnDemandSvc::i_setAlgHandler ( const std::string name,
const Gaudi::Utils::TypeNameString alg 
)
protected

Internal method to initialize an algorithm handler.

Definition at line 122 of file DataOnDemandSvc.cpp.

122  {
123  Leaf leaf( alg.type(), alg.name() );
124  if ( m_init ) {
125  StatusCode sc = configureHandler( leaf );
126  if ( sc.isFailure() ) {
127  if ( m_allowInitFailure ) {
128  // re-store the content of the leaf object to try again to initialize
129  // the algorithm later (on demand)
130  leaf = Leaf( alg.type(), alg.name() );
131  } else
132  return sc;
133  }
134  }
135  m_algs[name] = leaf;
136  return StatusCode::SUCCESS;
137 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< bool > m_init
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
AlgMap m_algs
Map of algorithms to handle incidents.
bool isFailure() const
Definition: StatusCode.h:145
StatusCode configureHandler(Leaf &leaf)
Configure handler for leaf.
Gaudi::Property< bool > m_allowInitFailure

◆ i_setNodeHandler()

void DataOnDemandSvc::i_setNodeHandler ( const std::string name,
const std::string type 
)
protected

Internal method to initialize a node handler.

Definition at line 116 of file DataOnDemandSvc.cpp.

116  {
117  ClassH cl = TClass::GetClass( type.c_str() );
118  if ( !cl ) { warning() << "Failed to access dictionary class for " << name << " of type:" << type << endmsg; }
119  m_nodes[name] = Node( cl, false, type );
120 }
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
NodeMap m_nodes
Map of "empty" objects to be placed as intermediate nodes.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ initialize()

StatusCode DataOnDemandSvc::initialize ( )
override

Inherited Service overrides: Service initialization.

Definition at line 191 of file DataOnDemandSvc.cpp.

191  {
192  // initialize the Service Base class
194  if ( sc.isFailure() ) { return sc; }
195  sc = setup();
196  if ( sc.isFailure() ) { return sc; }
197  //
198  if ( m_dump ) {
199  dump( MSG::INFO );
200  } else if ( msgLevel( MSG::DEBUG ) ) {
201  dump( MSG::DEBUG );
202  }
203  //
204  if ( m_init ) { return update(); }
205  //
206  return StatusCode::SUCCESS;
207 }
StatusCode initialize() override
Definition: Service.cpp:70
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< bool > m_init
void dump(const MSG::Level level, const bool mode=true) const
dump the content of DataOnDemand service
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode setup()
Setup routine (called by (re-) initialize.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isFailure() const
Definition: StatusCode.h:145
Gaudi::Property< bool > m_dump
StatusCode update()
update the handlers

◆ reinitialize()

StatusCode DataOnDemandSvc::reinitialize ( )
override

Inherited Service overrides: Service reinitialization.

re-initialization of the service

Definition at line 259 of file DataOnDemandSvc.cpp.

259  {
260  // reinitialize the Service Base class
261  if ( m_incSvc ) {
263  m_incSvc.reset();
264  }
265  m_algMgr.reset();
266  m_dataSvc.reset();
267  for ( const auto& i : m_nodeMappers ) m_toolSvc->releaseTool( i ).ignore();
269  for ( const auto& i : m_algMappers ) m_toolSvc->releaseTool( i ).ignore();
271  m_toolSvc.reset();
272  //
274  if ( sc.isFailure() ) { return sc; }
275  //
276  sc = setup();
277  if ( sc.isFailure() ) { return sc; }
278  //
279  if ( m_dump ) {
280  dump( MSG::INFO );
281  } else if ( msgLevel( MSG::DEBUG ) ) {
282  dump( MSG::DEBUG );
283  }
284  //
285  return StatusCode::SUCCESS;
286 }
SmartIF< IIncidentSvc > m_incSvc
Incident service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< std::string > m_trapType
void dump(const MSG::Level level, const bool mode=true) const
dump the content of DataOnDemand service
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
SmartIF< IDataProviderSvc > m_dataSvc
Data provider reference.
StatusCode setup()
Setup routine (called by (re-) initialize.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
StatusCode reinitialize() override
Definition: Service.cpp:247
T clear(T... args)
std::vector< IDODNodeMapper * > m_nodeMappers
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:168
SmartIF< IAlgManager > m_algMgr
Algorithm manager.
SmartIF< IToolSvc > m_toolSvc
Data provider reference.
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:96
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
bool isFailure() const
Definition: StatusCode.h:145
Gaudi::Property< bool > m_dump
std::vector< IDODAlgMapper * > m_algMappers

◆ setup()

StatusCode DataOnDemandSvc::setup ( )
protected

Setup routine (called by (re-) initialize.

Definition at line 290 of file DataOnDemandSvc.cpp.

290  {
291  if ( !( m_algMgr = serviceLocator() ) ) // assignment meant
292  {
293  error() << "Failed to retrieve the IAlgManager interface." << endmsg;
294  return StatusCode::FAILURE;
295  }
296 
297  if ( !( m_incSvc = serviceLocator()->service( "IncidentSvc" ) ) ) // assignment meant
298  {
299  error() << "Failed to retrieve Incident service." << endmsg;
300  return StatusCode::FAILURE;
301  }
302  m_incSvc->addListener( this, m_trapType );
303 
304  if ( !( m_dataSvc = serviceLocator()->service( m_dataSvcName ) ) ) // assignment meant
305  {
306  error() << "Failed to retrieve the data provider interface of " << m_dataSvcName << endmsg;
307  return StatusCode::FAILURE;
308  }
309 
310  // No need to get the ToolSvc if we are not using tools
311  if ( !( m_nodeMapTools.empty() && m_algMapTools.empty() ) ) {
312  if ( !( m_toolSvc = serviceLocator()->service( "ToolSvc" ) ) ) // assignment meant
313  {
314  error() << "Failed to retrieve ToolSvc" << endmsg;
315  return StatusCode::FAILURE;
316  }
317 
318  // load the node mapping tools
319  IDODNodeMapper* nodetool = nullptr;
320  for ( const auto& i : m_nodeMapTools ) {
321  const StatusCode sc = m_toolSvc->retrieveTool( i, nodetool );
322  if ( sc.isFailure() ) return sc;
323  m_nodeMappers.push_back( nodetool );
324  }
325  IDODAlgMapper* algtool = nullptr;
326  for ( const auto& i : m_algMapTools ) {
327  const StatusCode sc = m_toolSvc->retrieveTool( i, algtool );
328  if ( sc.isFailure() ) return sc;
329  m_algMappers.push_back( algtool );
330  }
331  }
332  return update();
333 }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:287
SmartIF< IIncidentSvc > m_incSvc
Incident service.
Gaudi::Property< std::string > m_trapType
SmartIF< IDataProviderSvc > m_dataSvc
Data provider reference.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:86
Gaudi::Property< std::vector< std::string > > m_algMapTools
T push_back(T... args)
Interface of tools used by the DataOnDemandSvc to choose the type of node to be created at a path.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Gaudi::Property< std::vector< std::string > > m_nodeMapTools
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
std::vector< IDODNodeMapper * > m_nodeMappers
Interface of tools used by the DataOnDemandSvc to choose the algorithm to be run to produce the data ...
Definition: IDODAlgMapper.h:27
SmartIF< IAlgManager > m_algMgr
Algorithm manager.
SmartIF< IToolSvc > m_toolSvc
Data provider reference.
StatusCode retrieveTool(std::string_view type, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
Retrieve specified tool sub-type with tool dependent part of the name automatically assigned.
Definition: IToolSvc.h:148
Gaudi::Property< std::string > m_dataSvcName
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:93
bool isFailure() const
Definition: StatusCode.h:145
std::vector< IDODAlgMapper * > m_algMappers
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
StatusCode update()
update the handlers

◆ setupAlgHandlers()

StatusCode DataOnDemandSvc::setupAlgHandlers ( )
protected

Initialize leaf handlers.

Definition at line 366 of file DataOnDemandSvc.cpp.

366  {
367  std::string typ, tag;
368 
369  for ( auto alg : m_algMapping ) {
370  using Parser = Gaudi::Utils::AttribStringParser;
371  for ( auto attrib : Parser( alg ) ) {
372  switch ( ::toupper( attrib.tag[0] ) ) {
373  case 'D':
374  tag = std::move( attrib.value );
375  break;
376  case 'T':
377  typ = std::move( attrib.value );
378  break;
379  }
380  }
381  Gaudi::Utils::TypeNameString item( typ );
382  if ( m_algMap.end() != m_algMap.find( tag ) || m_nodeMap.end() != m_nodeMap.find( tag ) ) {
383  warning() << "The obsolete property 'Algorithms' redefines the action for '" + tag + "' to be '" + item.type() +
384  "/" + item.name() + "'"
385  << endmsg;
386  }
387  m_algMap[tag] = item.type() + "/" + item.name();
388  }
389  m_updateRequired = true;
390  return StatusCode::SUCCESS;
391 }
Parse attribute strings allowing iteration over the various attributes.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< Map > m_nodeMap
STL class.
Gaudi::Property< Setup > m_algMapping
Helper class to parse a string of format "type/name".
Gaudi::Property< Map > m_algMap
T move(T... args)
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ setupNodeHandlers()

StatusCode DataOnDemandSvc::setupNodeHandlers ( )
protected

Initialize node handlers.

Definition at line 337 of file DataOnDemandSvc.cpp.

337  {
338  std::string nam, typ, tag;
340  // Setup for node leafs, where simply a constructor is called...
341  for ( auto node : m_nodeMapping ) {
342  using Parser = Gaudi::Utils::AttribStringParser;
343  for ( auto attrib : Parser( node ) ) {
344  switch ( ::toupper( attrib.tag[0] ) ) {
345  case 'D':
346  tag = std::move( attrib.value );
347  break;
348  case 'T':
349  nam = std::move( attrib.value );
350  break;
351  }
352  }
353  if ( m_algMap.end() != m_algMap.find( tag ) || m_nodeMap.end() != m_nodeMap.find( tag ) ) {
354  warning() << "The obsolete property 'Nodes' redefines the action for '" + tag + "' to be '" + nam + "'" << endmsg;
355  }
356  m_nodeMap[tag] = nam;
357  }
358  //
359  m_updateRequired = true;
360  //
361  return sc;
362 }
Parse attribute strings allowing iteration over the various attributes.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< Map > m_nodeMap
STL class.
Gaudi::Property< Map > m_algMap
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
T move(T... args)
Gaudi::Property< Setup > m_nodeMapping
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ update()

StatusCode DataOnDemandSvc::update ( )
protected

update the handlers

convert obsolete "Nodes" into new "NodeMap"

convert obsolete "Algorithms" into new "AlgMap"

add the default prefix

add the default prefix

get all directories

setup algorithms

setup nodes

Definition at line 142 of file DataOnDemandSvc.cpp.

142  {
143  if ( !m_updateRequired ) { return StatusCode::SUCCESS; }
144 
146  StatusCode sc = setupNodeHandlers(); // convert "Nodes" new "NodeMap"
147  if ( sc.isFailure() ) {
148  error() << "Failed to setup old \"Nodes\"" << endmsg;
149  return sc;
150  }
152  sc = setupAlgHandlers(); // convert "Algorithms" into "AlgMap"
153  if ( sc.isFailure() ) {
154  error() << "Failed to setup old \"Algorithms\"" << endmsg;
155  return sc;
156  }
158  add_prefix( m_algMap, m_prefix );
160  add_prefix( m_nodeMap, m_prefix );
163  if ( m_partialPath ) { get_dirs( m_algMap, dirs ); }
164  if ( m_partialPath ) { get_dirs( m_nodeMap, dirs ); }
165  //
166  auto _e = dirs.find( "/Event" );
167  if ( dirs.end() != _e ) { dirs.erase( _e ); }
168  // add all directories as nodes
169  for ( const auto& dir : dirs ) {
170  if ( m_algMap.end() == m_algMap.find( dir ) && m_nodeMap.end() == m_nodeMap.find( dir ) )
171  m_nodeMap[dir] = "DataObject";
172  }
173  //
174  m_algs.clear();
175  m_nodes.clear();
176  //
178  for ( const auto& alg : m_algMap ) {
179  if ( i_setAlgHandler( alg.first, alg.second ).isFailure() ) return StatusCode::FAILURE;
180  }
182  for ( const auto& node : m_nodeMap ) { i_setNodeHandler( node.first, node.second ); }
184  m_updateRequired = false;
185  //
186  return StatusCode::SUCCESS;
187 }
void i_setNodeHandler(const std::string &name, const std::string &type)
Internal method to initialize a node handler.
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property< Map > m_nodeMap
T end(T... args)
Gaudi::Property< std::string > m_prefix
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Gaudi::Property< Map > m_algMap
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
StatusCode setupNodeHandlers()
Initialize node handlers.
T erase(T... args)
NodeMap m_nodes
Map of "empty" objects to be placed as intermediate nodes.
Gaudi::Property< bool > m_partialPath
T find(T... args)
AlgMap m_algs
Map of algorithms to handle incidents.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
void clear()
Definition: Map.h:195
bool isFailure() const
Definition: StatusCode.h:145
StatusCode setupAlgHandlers()
Initialize leaf handlers.
StatusCode i_setAlgHandler(const std::string &name, const Gaudi::Utils::TypeNameString &alg)
Internal method to initialize an algorithm handler.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

Member Data Documentation

◆ m_algMap

Gaudi::Property<Map> DataOnDemandSvc::m_algMap {this, "AlgMap", {}, &DataOnDemandSvc::force_update, "mapping {'data': 'algorithm'}"}
private

Definition at line 275 of file DataOnDemandSvc.h.

◆ m_algMappers

std::vector<IDODAlgMapper*> DataOnDemandSvc::m_algMappers
private

Definition at line 251 of file DataOnDemandSvc.h.

◆ m_algMapping

Gaudi::Property<Setup> DataOnDemandSvc::m_algMapping
private
Initial value:
{
this, "Algorithms", {}, &DataOnDemandSvc::deprecated_property, " use AlgMap"}

Definition at line 269 of file DataOnDemandSvc.h.

◆ m_algMapTools

Gaudi::Property<std::vector<std::string> > DataOnDemandSvc::m_algMapTools
private
Initial value:
{
this, "AlgMappingTools", {}, "list of tools of type IDODAlgMapper"}

Definition at line 282 of file DataOnDemandSvc.h.

◆ m_algMgr

SmartIF<IAlgManager> DataOnDemandSvc::m_algMgr = nullptr
private

Algorithm manager.

Definition at line 226 of file DataOnDemandSvc.h.

◆ m_algs

AlgMap DataOnDemandSvc::m_algs
private

Map of algorithms to handle incidents.

Definition at line 232 of file DataOnDemandSvc.h.

◆ m_allowInitFailure

Gaudi::Property<bool> DataOnDemandSvc::m_allowInitFailure
private
Initial value:
{
this, "AllowPreInitializeFailure", false,
"allow (pre)initialization of algorithms to fail without stopping the application"}

Definition at line 265 of file DataOnDemandSvc.h.

◆ m_dataSvc

SmartIF<IDataProviderSvc> DataOnDemandSvc::m_dataSvc = nullptr
private

Data provider reference.

Definition at line 228 of file DataOnDemandSvc.h.

◆ m_dataSvcName

Gaudi::Property<std::string> DataOnDemandSvc::m_dataSvcName {this, "DataSvc", "EventDataSvc", "DataSvc name"}
private

Definition at line 255 of file DataOnDemandSvc.h.

◆ m_dump

Gaudi::Property<bool> DataOnDemandSvc::m_dump
private
Initial value:
{
this, "Dump", false,
[this]( auto& ) {
},
"dump configuration and stastics, if set to True after initialize it triggers a dump immediately"}

Definition at line 258 of file DataOnDemandSvc.h.

◆ m_incSvc

SmartIF<IIncidentSvc> DataOnDemandSvc::m_incSvc = nullptr
private

Incident service.

Definition at line 224 of file DataOnDemandSvc.h.

◆ m_init

Gaudi::Property<bool> DataOnDemandSvc::m_init {this, "PreInitialize", false, "(pre)initialize all algorithms"}
private

Definition at line 264 of file DataOnDemandSvc.h.

◆ m_locked_algs

bool DataOnDemandSvc::m_locked_algs = false
private

Definition at line 247 of file DataOnDemandSvc.h.

◆ m_locked_all

bool DataOnDemandSvc::m_locked_all = false
private

Definition at line 248 of file DataOnDemandSvc.h.

◆ m_locked_nodes

bool DataOnDemandSvc::m_locked_nodes = false
private

Definition at line 246 of file DataOnDemandSvc.h.

◆ m_nodeMap

Gaudi::Property<Map> DataOnDemandSvc::m_nodeMap {this, "NodeMap", {}, &DataOnDemandSvc::force_update, "mapping {'data': 'type'}"}
private

Definition at line 276 of file DataOnDemandSvc.h.

◆ m_nodeMappers

std::vector<IDODNodeMapper*> DataOnDemandSvc::m_nodeMappers
private

Definition at line 250 of file DataOnDemandSvc.h.

◆ m_nodeMapping

Gaudi::Property<Setup> DataOnDemandSvc::m_nodeMapping
private
Initial value:
{
this, "Nodes", {}, &DataOnDemandSvc::deprecated_property, " use NodeMap"}

Definition at line 271 of file DataOnDemandSvc.h.

◆ m_nodeMapTools

Gaudi::Property<std::vector<std::string> > DataOnDemandSvc::m_nodeMapTools
private
Initial value:
{
this, "NodeMappingTools", {}, "list of tools of type IDODNodeMapper"}

Definition at line 280 of file DataOnDemandSvc.h.

◆ m_nodes

NodeMap DataOnDemandSvc::m_nodes
private

Map of "empty" objects to be placed as intermediate nodes.

Definition at line 234 of file DataOnDemandSvc.h.

◆ m_partialPath

Gaudi::Property<bool> DataOnDemandSvc::m_partialPath {this, "UsePreceedingPath", true, "allow creation of partial leaves"}
private

Definition at line 257 of file DataOnDemandSvc.h.

◆ m_prefix

Gaudi::Property<std::string> DataOnDemandSvc::m_prefix {this, "Prefix", "/Event/"}
private

Definition at line 278 of file DataOnDemandSvc.h.

◆ m_stat

unsigned long long DataOnDemandSvc::m_stat = 0
private

Definition at line 241 of file DataOnDemandSvc.h.

◆ m_statAlg

unsigned long long DataOnDemandSvc::m_statAlg = 0
private

Definition at line 239 of file DataOnDemandSvc.h.

◆ m_statNode

unsigned long long DataOnDemandSvc::m_statNode = 0
private

Definition at line 240 of file DataOnDemandSvc.h.

◆ m_timer_algs

ChronoEntity DataOnDemandSvc::m_timer_algs
private

Definition at line 244 of file DataOnDemandSvc.h.

◆ m_timer_all

ChronoEntity DataOnDemandSvc::m_timer_all
private

Definition at line 245 of file DataOnDemandSvc.h.

◆ m_timer_nodes

ChronoEntity DataOnDemandSvc::m_timer_nodes
private

Definition at line 243 of file DataOnDemandSvc.h.

◆ m_toolSvc

SmartIF<IToolSvc> DataOnDemandSvc::m_toolSvc
private

Data provider reference.

Definition at line 230 of file DataOnDemandSvc.h.

◆ m_total

ChronoEntity DataOnDemandSvc::m_total
private

Definition at line 238 of file DataOnDemandSvc.h.

◆ m_trapType

Gaudi::Property<std::string> DataOnDemandSvc::m_trapType {this, "IncidentName", "DataFault", "the type of handled Incident"}
private

Definition at line 254 of file DataOnDemandSvc.h.

◆ m_updateRequired

bool DataOnDemandSvc::m_updateRequired = true
private

Definition at line 236 of file DataOnDemandSvc.h.


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