| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# DataOnDemandSvc Class Reference

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

`#include <DataOnDemandSvc.h>`

Inheritance diagram for DataOnDemandSvc:

[legend]
Collaboration diagram for DataOnDemandSvc:

[legend]

List of all members.

## Public Types
typedef std::vector< std::string > | Setup
typedef ROOT::Reflex::Type | ClassH
typedef GaudiUtils::HashMap < Gaudi::StringKey, Node > | NodeMap
typedef GaudiUtils::HashMap < Gaudi::StringKey, Leaf > | AlgMap
## Public Member Functions
virtual StatusCode | initialize ()
| Inherited Service overrides: Service initialization.
virtual StatusCode | finalize ()
| Inherited Service overrides: Service finalization.
virtual StatusCode | reinitialize ()
| Inherited Service overrides: Service reinitialization.
virtual void | handle (const Incident &incident)
| IIncidentListener interfaces overrides: incident handling.
| DataOnDemandSvc (const std::string &name, ISvcLocator *svc)
| Standard initializing service constructor.
virtual | ~DataOnDemandSvc ()
| Standard destructor.
void | update_1 (Property &p)
void | update_2 (Property &p)
void | update_3 (Property &p)
void | update_dump (Property &)
| update handler for 'Dump' property
## Protected Member Functions
StatusCode | configureHandler (Leaf &leaf)
| Configure handler for leaf.
StatusCode | execHandler (const std::string &tag, Leaf &leaf)
| Execute leaf handler (algorithm).
StatusCode | execHandler (const std::string &tag, Node &node)
| Execute node handler (simple object creation using seal reflection).
StatusCode | setupNodeHandlers ()
| Initialize node handlers.
StatusCode | setupAlgHandlers ()
| Initialize leaf handlers.
StatusCode | setup ()
| Setup routine (called by (re-) initialize.
StatusCode | update ()
| update the handlers
MsgStream & | stream () const
| get the message stream
void | dump (const MSG::Level level, const bool mode=true) const
| dump the content of DataOnDemand service
## Private Types
typedef std::map< std::string, std::string > | Map
## Private Attributes
IIncidentSvc * | m_incSvc
| Incident service.
IAlgManager * | m_algMgr
| Algorithm manager.
IDataProviderSvc * | m_dataSvc
| Data provider reference.
std::string | m_trapType
| Trap name.
std::string | m_dataSvcName
| Data service name.
bool | m_partialPath
| Flag to allow for the creation of partial leaves.
bool | m_dump
| flag to force the printout
bool | m_init
| flag to warm up the configuration
Setup | m_algMapping
| Mapping to algorithms.
Setup | m_nodeMapping
| Mapping to nodes.
AlgMap | m_algs
| Map of algorithms to handle incidents.
NodeMap | m_nodes
| Map of "empty" objects to be placed as intermediate nodes.
Map | m_algMap
| the major configuration property { 'data' : 'algorithm' }
Map | m_nodeMap
| the major configuration property { 'data' : 'type' }
bool | m_updateRequired
std::string | m_prefix
MsgStream * | m_log
ChronoEntity | m_total
ulonglong | m_statAlg
ulonglong | m_statNode
ulonglong | m_stat
ChronoEntity | m_timer_nodes
ChronoEntity | m_timer_algs
ChronoEntity | m_timer_all
bool | m_locked_nodes
bool | m_locked_algs
bool | m_locked_all
## Classes
struct | Leaf
struct | Node
| Helper class of the DataOnDemandSvc. More...
struct | Protection
| Helper class of the DataOnDemandSvc. 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 mathes. In the event already the partial path to any handler is missing a leaf handler may be triggered, which includes the partal pathes ( DataOnDemandSvc.UsePreceedingPath = true )

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

        DataOnDemandSvc.AlgMap  +=
       { "Phys/StdLoosePions/Particles" : "PreLoadParticles/StdLoosePions" ,
         "Phys/StdLoosePions/Vertioces" : "PreLoadParticles/StdLoosePions" } ;

        DataOnDemandSvc.NodeMap +=
       { "Phys" : "DataObject" ,
         "MC"   : "DataObject" } ;

New treatment of preceeding 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/" ) coudl be omitted from any data-item. It will be added automatically.

Author:
  M.Frank

Version:
  1.0

Definition at line 90 of file DataOnDemandSvc.h.

## Member Typedef Documentation

typedef std::vector<std::string> DataOnDemandSvc::Setup

Definition at line 95 of file DataOnDemandSvc.h.

typedef ROOT::Reflex::Type DataOnDemandSvc::ClassH

Definition at line 96 of file DataOnDemandSvc.h.

typedef GaudiUtils::HashMap<Gaudi::StringKey, Node> DataOnDemandSvc::NodeMap

Definition at line 171 of file DataOnDemandSvc.h.

typedef GaudiUtils::HashMap<Gaudi::StringKey, Leaf> DataOnDemandSvc::AlgMap

Definition at line 172 of file DataOnDemandSvc.h.

typedef std::map<std::string,std::string> DataOnDemandSvc::Map`[private]`

Definition at line 274 of file DataOnDemandSvc.h.

## Constructor & Destructor Documentation

DataOnDemandSvc::DataOnDemandSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard initializing service constructor.

Parameters:

  | name | [IN] Service instance name
  | svc | [IN] Pointer to service locator

Returns:
  Reference to DataOnDemandSvc object.

Definition at line 47 of file DataOnDemandSvc.cpp.

    00048   : base_class(name, svc)
    00049   , m_incSvc   ( 0 )
    00050   , m_algMgr   ( 0 )
    00051   , m_dataSvc  ( 0 )
    00052   //
    00053   , m_trapType    ( "DataFault")
    00054   , m_dataSvcName ( "EventDataSvc" )
    00055   , m_partialPath ( true  )
    00056   , m_dump        ( false )
    00057   , m_init        ( false )
    00058   //
    00059   , m_algMapping  ()
    00060   , m_nodeMapping ()
    00061   //
    00062   , m_algMap   (   )
    00063   , m_nodeMap  (   )
    00064   //
    00065   , m_updateRequired ( true )
    00066   , m_prefix         ( "/Event/" )
    00067   , m_log      ( 0 )
    00068   , m_total    (   )
    00069   , m_statAlg  ( 0 )
    00070   , m_statNode ( 0 )
    00071   , m_stat     ( 0 )
    00072   //
    00073   , m_timer_nodes  ()
    00074   , m_timer_algs   ()
    00075   , m_timer_all    ()
    00076   , m_locked_nodes ( false )
    00077   , m_locked_algs  ( false )
    00078   , m_locked_all   ( false )
    00079   //
    00080 {
    00081   // ==========================================================================
    00082   declareProperty
    00083     ( "IncidentName"       ,
    00084       m_trapType           ,
    00085       "The type of handled Incident" ) ;
    00086   //
    00087   declareProperty ( "DataSvc"            , m_dataSvcName ) ;
    00088   //
    00089   declareProperty ( "UsePreceedingPath"  , m_partialPath ) ;
    00090   declareProperty
    00091     ( "Dump"        ,
    00092       m_dump        ,
    00093       "Dump the configuration and stastics" )  ->
    00094     declareUpdateHandler ( &DataOnDemandSvc::update_dump , this ) ;
    00095   //
    00096   declareProperty
    00097     ( "PreInitialize" ,
    00098       m_init          ,
    00099       "Flag to (pre)initialize all algorithms" ) ;
    00100   //
    00101   declareProperty ( "Algorithms"         , m_algMapping  )  ->
    00102     declareUpdateHandler ( &DataOnDemandSvc::update_2 , this ) ;
    00103   declareProperty ( "Nodes"              , m_nodeMapping ) ->
    00104     declareUpdateHandler ( &DataOnDemandSvc::update_3 , this ) ;
    00105   //
    00106   declareProperty ( "AlgMap"  , m_algMap  ) ->
    00107     declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ;
    00108   declareProperty ( "NodeMap" , m_nodeMap ) ->
    00109     declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ;
    00110   //
    00111   declareProperty ( "Prefix"             , m_prefix      ) ;
    00112   // ==========================================================================
    00113 }

DataOnDemandSvc::~DataOnDemandSvc | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 316 of file DataOnDemandSvc.cpp.

    00317 { if ( 0 != m_log      ) { delete m_log      ; m_log      = 0 ; } }

## Member Function Documentation

StatusCode DataOnDemandSvc::initialize | ( |  | ) | `[virtual]`

Inherited Service overrides: Service initialization.

Reimplemented from Service.

Definition at line 321 of file DataOnDemandSvc.cpp.

    00322 {
    00323   // initialize the Service Base class
    00324   StatusCode sc = Service::initialize();
    00325   if ( sc.isFailure() )  { return sc; }
    00326   sc = setup();
    00327   if ( sc.isFailure() )  { return sc; }
    00328   //
    00329   if      ( m_dump )                      { dump ( MSG::INFO  ) ; }
    00330   else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG ) ; }
    00331   //
    00332   if ( m_init ) { return update () ; }
    00333   //
    00334   return StatusCode::SUCCESS ;
    00335 }

StatusCode DataOnDemandSvc::finalize | ( | void |  | ) | `[virtual]`

Inherited Service overrides: Service finalization.

Reimplemented from Service.

Definition at line 339 of file DataOnDemandSvc.cpp.

    00340 {
    00341   //
    00342   stream ()
    00343     << MSG::INFO
    00344     << "Handled \"" << m_trapType << "\" incidents: "
    00345     << m_statAlg  << "/" << m_statNode << "/" << m_stat << "(Alg/Node/Total)."
    00346     << endmsg ;
    00347   if ( m_dump || MSG::DEBUG >= outputLevel() )
    00348   {
    00349     stream ()
    00350       << MSG::INFO
    00351       << m_total.outputUserTime
    00352       ( "Algorithm timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] " , System::milliSec )
    00353       << m_total.outputUserTime ( "Total:%2%[s]" , System::Sec ) << endmsg ;
    00354     stream ()
    00355       << MSG::INFO
    00356       << m_timer_nodes.outputUserTime
    00357       ( "Nodes     timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] " , System::milliSec )
    00358       << m_timer_nodes.outputUserTime ( "Total:%2%[s]" , System::Sec ) << endmsg ;
    00359     stream ()
    00360       << MSG::INFO
    00361       << m_timer_algs .outputUserTime
    00362       ( "Algs      timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] " , System::milliSec )
    00363       << m_timer_algs .outputUserTime ( "Total:%2%[s]" , System::Sec ) << endmsg ;
    00364     stream ()
    00365       << MSG::INFO
    00366       << m_timer_all  .outputUserTime
    00367       ( "All       timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] " , System::milliSec )
    00368       << m_timer_all  .outputUserTime ( "Total:%2%[s]" , System::Sec ) << endmsg ;
    00369   }
    00370   // dump it!
    00371   if      ( m_dump )                      { dump ( MSG::INFO  , false ) ; }
    00372   else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG , false ) ; }
    00373   //
    00374   if ( m_incSvc )
    00375   {
    00376     m_incSvc->removeListener(this, m_trapType);
    00377     m_incSvc->release();
    00378     m_incSvc = 0;
    00379   }
    00380   if ( 0 != m_algMgr  ) { m_algMgr   -> release () ; m_algMgr  = 0 ; }
    00381   if ( 0 != m_dataSvc ) { m_dataSvc  -> release () ; m_dataSvc = 0 ; }
    00382   //
    00383   return Service::finalize();
    00384 }

StatusCode DataOnDemandSvc::reinitialize | ( |  | ) | `[virtual]`

Inherited Service overrides: Service reinitialization.

re-initialization of the service

Reimplemented from Service.

Definition at line 388 of file DataOnDemandSvc.cpp.

    00389 {
    00390   // reinitialize the Service Base class
    00391   if ( 0 != m_incSvc )
    00392   {
    00393     m_incSvc -> removeListener ( this , m_trapType );
    00394     m_incSvc -> release ();
    00395     m_incSvc = 0;
    00396   }
    00397   if ( 0 != m_algMgr  ) { m_algMgr   -> release() ; m_algMgr  = 0 ; }
    00398   if ( 0 != m_dataSvc ) { m_dataSvc  -> release() ; m_dataSvc = 0 ; }
    00399   if ( 0 != m_log     ) { delete m_log ; m_log = 0 ; }
    00400   //
    00401   StatusCode sc = Service::reinitialize();
    00402   if ( sc.isFailure() )  { return sc; }
    00403   //
    00404   sc = setup() ;
    00405   if ( sc.isFailure() )  { return sc; }
    00406   //
    00407   if ( m_dump ) { dump ( MSG::INFO ) ; }
    00408   else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG  ) ; }
    00409   //
    00410   return StatusCode::SUCCESS ;
    00411 }

void DataOnDemandSvc::handle | ( | const Incident & | incident | ) | `[virtual]`

IIncidentListener interfaces overrides: incident handling.

Implements IIncidentListener.

Definition at line 577 of file DataOnDemandSvc.cpp.

    00578 {
    00579
    00580   Gaudi::Utils::LockedChrono timer ( m_timer_all , m_locked_all ) ;
    00581
    00582   ++m_stat ;
    00583   // proper incident type?
    00584   if ( incident.type() != m_trapType ) { return ; }             // RETURN
    00585   const DataIncident* inc = dynamic_cast<const DataIncident*>(&incident);
    00586   if ( 0 == inc                      ) { return ; }             // RETURN
    00587   // update if needed!
    00588   if ( m_updateRequired ) { update() ; }
    00589
    00590   if ( MSG::VERBOSE >= outputLevel() )
    00591   {
    00592     stream()
    00593       << MSG::VERBOSE
    00594       << "Incident: [" << incident.type   () << "] "
    00595       << " = "         << incident.source ()
    00596       << " Location:"  << inc->tag()         << endmsg;
    00597   }
    00598   // ==========================================================================
    00599   // const std::string& tag = inc->tag();
    00600   Gaudi::StringKey tag ( inc->tag() ) ;
    00601   // ==========================================================================
    00602   NodeMap::iterator icl = m_nodes.find ( tag ) ;
    00603   if ( icl != m_nodes.end() )
    00604   {
    00605     StatusCode sc = execHandler ( tag , icl->second ) ;
    00606     if ( sc.isSuccess() ) { ++m_statNode ; }
    00607     return ;                                                        // RETURN
    00608   }
    00609   // ==========================================================================
    00610   AlgMap::iterator ialg = m_algs.find ( tag ) ;
    00611   if ( ialg != m_algs.end() )
    00612   {
    00613     StatusCode sc = execHandler ( tag , ialg->second ) ;
    00614     if ( sc.isSuccess() ) { ++m_statAlg ; }
    00615     return ;                                                        // RETURN
    00616   }
    00617 }

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 530 of file DataOnDemandSvc.cpp.

    00531 {
    00532   if ( 0 != l.algorithm ) { return StatusCode::SUCCESS ; }
    00533   if ( 0 == m_algMgr  ) { return StatusCode::FAILURE ; }
    00534   l.algorithm = m_algMgr->algorithm(l.name, false);
    00535   if ( 0 != l.algorithm ) { return StatusCode::SUCCESS ; }
    00536   // create it!
    00537   StatusCode sc = m_algMgr->createAlgorithm ( l.type , l.name , l.algorithm , true ) ;
    00538   if ( sc.isFailure() )
    00539   {
    00540     stream()
    00541       << MSG::ERROR
    00542       << "Failed to create algorithm "
    00543       << l.type << "('" << l.name<< "')" << endmsg;
    00544     l.algorithm = 0 ;
    00545     return sc ;                                                    // RETURN
    00546   }
    00547   if ( l.algorithm->isInitialized() ) { return StatusCode:: SUCCESS ;}
    00548   // initialize it!
    00549   sc = l.algorithm -> sysInitialize () ;
    00550   if ( sc.isFailure() )
    00551   {
    00552     stream()
    00553       << MSG::ERROR
    00554       << "Failed to initialize algorithm "
    00555       << l.type << "('" << l.name<< "')" << endmsg;
    00556     l.algorithm = 0 ;
    00557     return sc ;                                                    // RETURN
    00558   }
    00559   if ( Gaudi::StateMachine::RUNNING == l.algorithm->FSMState() )
    00560   { return StatusCode::SUCCESS ; }
    00561   // run it!
    00562   sc = l.algorithm->sysStart() ;
    00563   if ( sc.isFailure() )
    00564   {
    00565     stream()
    00566       << MSG::ERROR
    00567       << "Failed to 'run'      algorithm "
    00568       << l.type << "('" << l.name<< "')" << endmsg;
    00569     l.algorithm = 0 ;
    00570     return sc ;                                                    // RETURN
    00571   }
    00572   return StatusCode::SUCCESS  ;
    00573 }

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 680 of file DataOnDemandSvc.cpp.

    00681 {
    00682   Gaudi::Utils::LockedChrono timer ( m_timer_algs ,  m_locked_algs ) ;
    00683   //
    00684   if ( l.executing ) { return StatusCode::FAILURE ; }             // RETURN
    00685   //
    00686   if ( 0 == l.algorithm )
    00687   {
    00688     StatusCode sc = configureHandler ( l ) ;
    00689     if ( sc.isFailure() )
    00690     {
    00691       stream()
    00692         << MSG::ERROR
    00693         << "Failed to configure handler for: "
    00694         << l.name << "[" << l.type << "] " << tag << endmsg;
    00695       return sc ;                                                 // RETURN
    00696     }
    00697   }
    00698   //
    00699   Chrono atimer ( m_total ) ;
    00700   //
    00701   Protection p(l.executing);
    00702   StatusCode sc = l.algorithm->sysExecute();
    00703   if ( sc.isFailure() )
    00704   {
    00705     stream() << MSG::ERROR
    00706              << "Failed to execute the algorithm:"
    00707              << l.algorithm->name() << " for location:" << tag << endmsg;
    00708     return sc ;                                                       // RETURN
    00709   }
    00710   ++l.num ;
    00711   //
    00712   return StatusCode::SUCCESS ;
    00713 }

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 622 of file DataOnDemandSvc.cpp.

    00623 {
    00624
    00625   Gaudi::Utils::LockedChrono timer ( m_timer_nodes ,  m_locked_nodes ) ;
    00626
    00627   if ( n.executing ) { return StatusCode::FAILURE ; }            // RETURN
    00628
    00629   Protection p(n.executing);
    00630
    00631   DataObject* object= 0 ;
    00632
    00633   if ( n.dataObject )  { object = new DataObject() ; }
    00634   else
    00635   {
    00636     // try to recover the handler
    00637     if ( !n.clazz  ) { n.clazz = ROOT::Reflex::Type::ByName(n.name) ; }
    00638     if ( !n.clazz  )
    00639     {
    00640       stream()
    00641         << MSG::ERROR
    00642         << "Failed to get dictionary for class '"
    00643         << n.name
    00644         << "' for location:" << tag << endmsg;
    00645       return StatusCode::FAILURE ;                               // RETURN
    00646     }
    00647     //
    00648     ROOT::Reflex::Object obj = n.clazz.Construct();
    00649
    00650     object = (DataObject*) obj.Address();
    00651
    00652     if ( !object )
    00653     {
    00654       stream()
    00655         << MSG::ERROR
    00656         << "Failed to create an object of type:"
    00657         << n.clazz.Name(ROOT::Reflex::SCOPED) << " for location:" << tag
    00658         << endmsg;
    00659       return StatusCode::FAILURE  ;                               // RETURN
    00660     }
    00661   }
    00662   //
    00663   StatusCode sc = m_dataSvc->registerObject(tag, object );
    00664   if ( sc.isFailure() )
    00665   {
    00666     stream()
    00667       << MSG::ERROR << "Failed to register an object of type:"
    00668       << n.name << " at location:" << tag
    00669       << endmsg;
    00670     return sc ;                                                  // RETURN
    00671   }
    00672   ++n.num ;
    00673   //
    00674   return StatusCode::SUCCESS ;
    00675 }

StatusCode DataOnDemandSvc::setupNodeHandlers | ( |  | ) | `[protected]`

Initialize node handlers.

Definition at line 449 of file DataOnDemandSvc.cpp.

    00450 {
    00451   Setup::const_iterator j;
    00452   std::string nam, typ, tag;
    00453   StatusCode sc = StatusCode::SUCCESS;
    00454   // Setup for node leafs, where simply a constructor is called...
    00455   for ( j=m_nodeMapping.begin(); j != m_nodeMapping.end(); ++j)
    00456   {
    00457     Tokenizer tok(true);
    00458     tok.analyse(*j, " ", "", "", "=", "'", "'");
    00459     for ( Tokenizer::Items::iterator i = tok.items().begin();
    00460           i != tok.items().end(); i++ )   {
    00461       const std::string& t = (*i).tag();
    00462       const std::string& v = (*i).value();
    00463       switch( ::toupper(t[0]) )    {
    00464       case 'D':
    00465         tag = v;
    00466         break;
    00467       case 'T':
    00468         nam = v;
    00469         break;
    00470       }
    00471     }
    00472     if ( m_algMap  .end () != m_algMap  .find ( tag ) ||
    00473          m_nodeMap .end () != m_nodeMap .find ( tag ) )
    00474     {
    00475       stream()
    00476         << MSG::WARNING
    00477         << "The obsolete property 'Nodes' redefines the action for '"
    00478         + tag + "' to be '" +nam+"'"
    00479         << endmsg ;
    00480     }
    00481     m_nodeMap[tag] = nam ;
    00482   }
    00483   //
    00484   m_updateRequired = true ;
    00485   //
    00486   return sc;
    00487 }

StatusCode DataOnDemandSvc::setupAlgHandlers | ( |  | ) | `[protected]`

Initialize leaf handlers.

Definition at line 491 of file DataOnDemandSvc.cpp.

    00492 {
    00493   Setup::const_iterator j;
    00494   std::string typ, tag;
    00495
    00496   for(j=m_algMapping.begin(); j != m_algMapping.end(); ++j)
    00497   {
    00498     Tokenizer tok(true);
    00499     tok.analyse(*j, " ", "", "", "=", "'", "'");
    00500     for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++ )   {
    00501       const std::string& t = (*i).tag();
    00502       const std::string& v = (*i).value();
    00503       switch( ::toupper(t[0]) )    {
    00504       case 'D':
    00505         tag = v;
    00506         break;
    00507       case 'T':
    00508         typ = v;
    00509         break;
    00510       }
    00511     }
    00512     Gaudi::Utils::TypeNameString item(typ);
    00513     if ( m_algMap  .end () != m_algMap  .find ( tag ) ||
    00514          m_nodeMap .end () != m_nodeMap .find ( tag ) )
    00515     {
    00516       stream()
    00517         << MSG::WARNING
    00518         << "The obsolete property 'Algorithms' redefines the action for '"
    00519         + tag + "' to be '" +item.type() +"/"+item.name()+"'"
    00520         << endmsg ;
    00521     }
    00522     m_algMap[tag] = item.type() + "/" + item.name() ;
    00523   }
    00524   m_updateRequired = true ;
    00525   return StatusCode::SUCCESS;
    00526 }

StatusCode DataOnDemandSvc::setup | ( |  | ) | `[protected]`

Setup routine (called by (re-) initialize.

Definition at line 415 of file DataOnDemandSvc.cpp.

    00416 {
    00417   m_algMgr = 0;
    00418   StatusCode sc =
    00419     serviceLocator()->queryInterface(IAlgManager::interfaceID(), pp_cast<void>(&m_algMgr));
    00420   if ( sc.isFailure () )
    00421   {
    00422     stream()
    00423       << MSG::ERROR
    00424       << "Failed to retrieve the IAlgManager interface." << endmsg;
    00425     return sc;
    00426   }
    00427   sc = service("IncidentSvc", m_incSvc, true);
    00428   if ( sc.isFailure () )
    00429   {
    00430     stream()
    00431       << MSG::ERROR << "Failed to retrieve Incident service." << endmsg;
    00432     return sc;
    00433   }
    00434   m_incSvc->addListener(this, m_trapType);
    00435   sc = service(m_dataSvcName, m_dataSvc, true);
    00436   if ( sc.isFailure () )
    00437   {
    00438     stream()
    00439       << MSG::ERROR
    00440       << "Failed to retrieve the data provider interface of "
    00441       << m_dataSvcName << endmsg;
    00442     return sc;
    00443   }
    00444   return update() ;
    00445 }

void DataOnDemandSvc::update_1 | ( | Property & | p | ) |

Definition at line 117 of file DataOnDemandSvc.cpp.

    00118 {
    00119   stream() << MSG::VERBOSE << " I am update handler for property " << p << endmsg ;
    00120   // force update
    00121   m_updateRequired = true ;
    00122 }

void DataOnDemandSvc::update_2 | ( | Property & | p | ) |

Definition at line 138 of file DataOnDemandSvc.cpp.

    00139 {
    00140   stream() << MSG::WARNING
    00141            << "The property 'Algorithms' is obsolete, switch to map-like 'AlgMap'  "
    00142            << " = { 'data' : 'algorithm' } "
    00143            << endmsg ;
    00144   // force update
    00145   m_updateRequired = true ;
    00146 }

void DataOnDemandSvc::update_3 | ( | Property & | p | ) |

Definition at line 126 of file DataOnDemandSvc.cpp.

    00127 {
    00128   stream() << MSG::WARNING
    00129            << "The property 'Nodes'      is obsolete, switch to map-like 'NodeMap' "
    00130            << " = { 'data' : 'type'      } "
    00131            << endmsg ;
    00132   // force update
    00133   m_updateRequired = true ;
    00134 }

void DataOnDemandSvc::update_dump | ( | Property & |  | ) |

update handler for 'Dump' property

Definition at line 150 of file DataOnDemandSvc.cpp.

    00151 {
    00152   // no action if not yet initialized
    00153   if ( FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
    00154   // dump the configuration:
    00155   if ( m_dump ) { dump ( MSG::ALWAYS ) ; }
    00156 }

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 240 of file DataOnDemandSvc.cpp.

    00241 {
    00242   if ( !m_updateRequired ) { return StatusCode::SUCCESS  ; }
    00243
    00245   StatusCode sc = setupNodeHandlers() ; // convert "Nodes"      new "NodeMap"
    00246   if ( sc.isFailure() )
    00247   {
    00248     stream() << MSG::ERROR << "Failed to setup old \"Nodes\""      << endmsg ;
    00249     return sc ;
    00250   }
    00252   sc = setupAlgHandlers()   ; // convert "Algorithms" into "AlgMap"
    00253   if ( sc.isFailure() )
    00254   {
    00255     stream() << MSG::ERROR << "Failed to setup old \"Algorithms\"" << endmsg ;
    00256     return sc ;
    00257   }
    00259   add_prefix ( m_algMap  , m_prefix ) ;
    00261   add_prefix ( m_nodeMap , m_prefix ) ;
    00263   typedef std::set<std::string> Set ;
    00264   Set dirs ;
    00265   if ( m_partialPath ){ get_dirs ( m_algMap  , dirs ) ; }
    00266   if ( m_partialPath ){ get_dirs ( m_nodeMap , dirs ) ; }
    00267   //
    00268   Set::iterator _e = dirs.find("/Event") ;
    00269   if ( dirs.end() != _e ) { dirs.erase( _e ) ; }
    00270   // add all directories as nodes
    00271   for ( Set::const_iterator dir = dirs.begin() ; dirs.end() != dir ; ++dir )
    00272   {
    00273     if ( m_algMap  .end () != m_algMap  .find ( *dir ) ) { continue ; }
    00274     if ( m_nodeMap .end () != m_nodeMap .find ( *dir ) ) { continue ; }
    00275     m_nodeMap [*dir] = "DataObject" ;
    00276   }
    00277   //
    00278   m_algs  .clear  () ;
    00279   m_nodes .clear  () ;
    00280   //
    00282   for ( Map::const_iterator ialg = m_algMap.begin() ;
    00283         m_algMap.end() != ialg ; ++ialg )
    00284   {
    00285     Gaudi::Utils::TypeNameString alg ( ialg->second ) ;
    00286     Leaf leaf ( alg.type() , alg.name() ) ;
    00287     if  ( m_init )
    00288     {
    00289       if (configureHandler(leaf).isFailure()) {
    00290         leaf = Leaf(alg.type(), alg.name());
    00291       }
    00292     }
    00293     m_algs[ialg->first] =  leaf ;
    00294   }
    00296   for ( Map::const_iterator inode = m_nodeMap.begin() ;
    00297         m_nodeMap.end() != inode ; ++inode )
    00298   {
    00299     ClassH cl = ROOT::Reflex::Type::ByName( inode->second ) ;
    00300     if ( !cl )
    00301     {
    00302       stream() << MSG::WARNING
    00303                << "Failed to access dictionary class for "
    00304                << inode->first << " of type:" << inode->second << endmsg;
    00305     }
    00306     m_nodes[inode->first] = Node ( cl , false , inode->second ) ;
    00307   }
    00309   m_updateRequired = false ;
    00310   //
    00311   return StatusCode::SUCCESS ;
    00312 }

MsgStream& DataOnDemandSvc::stream | ( |  | ) | const`[inline, protected]`

get the message stream

Definition at line 236 of file DataOnDemandSvc.h.

    00237   {
    00238     if ( 0 == m_log ) { m_log = new MsgStream( msgSvc() , name() ) ; }
    00239     return *m_log;
    00240   }

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

dump the content of DataOnDemand service

Parameters:

  | level | the printout level
  | mode | the printout mode

Definition at line 721 of file DataOnDemandSvc.cpp.

    00723 {
    00724   if ( m_algs.empty()  &&  m_nodes.empty() ) { return ; }
    00725
    00726   typedef std::pair<std::string,std::string> Pair ;
    00727   typedef std::map<std::string,Pair>         PMap ;
    00728
    00729   PMap _m ;
    00730   for ( AlgMap::const_iterator alg = m_algs.begin() ;
    00731         m_algs.end() != alg ; ++alg )
    00732   {
    00733     PMap::const_iterator check = _m.find(alg->first) ;
    00734     if ( _m.end() != check )
    00735     {
    00736       stream()
    00737         << MSG::WARNING
    00738         << " The data item is activated for '"
    00739         << check->first << "' as '" << check->second.first << "'" << endmsg ;
    00740     }
    00741     const Leaf& l = alg->second ;
    00742     std::string nam = ( l.name == l.type ? l.type  : (l.type+"/"+l.name) ) ;
    00743     //
    00744     if ( !mode && 0 == l.num ) { continue ; }
    00745     //
    00746     std::string val ;
    00747     if ( mode ) { val = ( 0 == l.algorithm ) ? "F" : "T" ; }
    00748     else { val = boost::lexical_cast<std::string>( l.num ) ; }
    00749     //
    00750     _m[ no_prefix ( alg->first , m_prefix ) ] = std::make_pair ( nam , val ) ;
    00751   }
    00752   // nodes:
    00753   for ( NodeMap::const_iterator node = m_nodes.begin() ;
    00754         m_nodes.end() != node ; ++node )
    00755   {
    00756     PMap::const_iterator check = _m.find(node->first) ;
    00757     if ( _m.end() != check )
    00758     {
    00759       stream()
    00760         << MSG::WARNING
    00761         << " The data item is already activated for '"
    00762         << check->first << "' as '" << check->second.first << "'" << endmsg ;
    00763     }
    00764     const Node& n = node->second ;
    00765     std::string nam = "'" + n.name + "'"  ;
    00766     //
    00767     std::string val ;
    00768
    00769     if ( !mode && 0 == n.num ) { continue ; }
    00770
    00771     if ( mode ) { val = ( 0 == n.clazz ) ? "F" : "T" ; }
    00772     else { val = boost::lexical_cast<std::string>( n.num ) ; }
    00773     //
    00774     _m[ no_prefix ( node->first , m_prefix ) ] = std::make_pair ( nam , val ) ;
    00775   }
    00776   //
    00777   if ( _m.empty() ) { return ; }
    00778
    00779   // find the correct formats
    00780   size_t n1 = 0 ;
    00781   size_t n2 = 0 ;
    00782   size_t n3 = 0 ;
    00783   for  ( PMap::const_iterator it = _m.begin() ; _m.end() != it ; ++it )
    00784   {
    00785     n1 = std::max ( n1 , it->first.size()         ) ;
    00786     n2 = std::max ( n2 , it->second.first.size()  ) ;
    00787     n3 = std::max ( n3 , it->second.second.size() ) ;
    00788   }
    00789   if ( 10 > n1 ) { n1 = 10 ; }
    00790   if ( 10 > n2 ) { n2 = 10 ; }
    00791   if ( 60 < n1 ) { n1 = 60 ; }
    00792   if ( 60 < n2 ) { n2 = 60 ; }
    00793   //
    00794
    00795   const std::string _f = " | %%1$-%1%.%1%s | %%2$-%2%.%2%s | %%3$%3%.%3%s |" ;
    00796   boost::format _ff ( _f ) ;
    00797   _ff % n1 % n2 % n3 ;
    00798
    00799   const std::string _format  = _ff.str() ;
    00800
    00801   MsgStream& msg = stream() << level ;
    00802
    00803   if ( mode ) { msg << "Data-On-Demand Actions enabled for:"       ; }
    00804   else        { msg << "Data-On-Demand Actions has been used for:" ; }
    00805
    00806   boost::format fmt1( _format)  ;
    00807   fmt1 % "Address" % "Creator" % ( mode ? "S" : "#" ) ;
    00808   //
    00809   const std::string header = fmt1.str() ;
    00810   std::string line = std::string( header.size() , '-' ) ;
    00811   line[0] = ' ' ;
    00812
    00813   msg << std::endl << line
    00814       << std::endl << header
    00815       << std::endl << line ;
    00816
    00817   // make the actual printout:
    00818   for ( PMap::const_iterator item = _m.begin() ;
    00819         _m.end() != item ; ++item )
    00820   {
    00821     boost::format fmt( _format)  ;
    00822     msg << std::endl <<
    00823       ( fmt % item->first % item->second.first % item->second.second ) ;
    00824   }
    00825
    00826   msg << std::endl << line << endmsg ;
    00827
    00828 }

## Member Data Documentation

IIncidentSvc* DataOnDemandSvc::m_incSvc`[private]`

Incident service.

Definition at line 250 of file DataOnDemandSvc.h.

IAlgManager* DataOnDemandSvc::m_algMgr`[private]`

Algorithm manager.

Definition at line 252 of file DataOnDemandSvc.h.

IDataProviderSvc* DataOnDemandSvc::m_dataSvc`[private]`

Data provider reference.

Definition at line 254 of file DataOnDemandSvc.h.

std::string DataOnDemandSvc::m_trapType`[private]`

Trap name.

Definition at line 256 of file DataOnDemandSvc.h.

std::string DataOnDemandSvc::m_dataSvcName`[private]`

Data service name.

Definition at line 258 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_partialPath`[private]`

Flag to allow for the creation of partial leaves.

Definition at line 260 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_dump`[private]`

flag to force the printout

Definition at line 262 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_init`[private]`

flag to warm up the configuration

Definition at line 264 of file DataOnDemandSvc.h.

Setup DataOnDemandSvc::m_algMapping`[private]`

Mapping to algorithms.

Definition at line 266 of file DataOnDemandSvc.h.

Setup DataOnDemandSvc::m_nodeMapping`[private]`

Mapping to nodes.

Definition at line 268 of file DataOnDemandSvc.h.

AlgMap DataOnDemandSvc::m_algs`[private]`

Map of algorithms to handle incidents.

Definition at line 270 of file DataOnDemandSvc.h.

NodeMap DataOnDemandSvc::m_nodes`[private]`

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

Definition at line 272 of file DataOnDemandSvc.h.

Map DataOnDemandSvc::m_algMap`[private]`

the major configuration property { 'data' : 'algorithm' }

Definition at line 276 of file DataOnDemandSvc.h.

Map DataOnDemandSvc::m_nodeMap`[private]`

the major configuration property { 'data' : 'type' }

Definition at line 278 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_updateRequired`[private]`

Definition at line 279 of file DataOnDemandSvc.h.

std::string DataOnDemandSvc::m_prefix`[private]`

Definition at line 280 of file DataOnDemandSvc.h.

MsgStream* DataOnDemandSvc::m_log`[mutable, private]`

Definition at line 281 of file DataOnDemandSvc.h.

ChronoEntity DataOnDemandSvc::m_total`[private]`

Definition at line 283 of file DataOnDemandSvc.h.

ulonglong DataOnDemandSvc::m_statAlg`[private]`

Definition at line 284 of file DataOnDemandSvc.h.

ulonglong DataOnDemandSvc::m_statNode`[private]`

Definition at line 285 of file DataOnDemandSvc.h.

ulonglong DataOnDemandSvc::m_stat`[private]`

Definition at line 286 of file DataOnDemandSvc.h.

ChronoEntity DataOnDemandSvc::m_timer_nodes`[private]`

Definition at line 288 of file DataOnDemandSvc.h.

ChronoEntity DataOnDemandSvc::m_timer_algs`[private]`

Definition at line 289 of file DataOnDemandSvc.h.

ChronoEntity DataOnDemandSvc::m_timer_all`[private]`

Definition at line 290 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_locked_nodes`[private]`

Definition at line 291 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_locked_algs`[private]`

Definition at line 292 of file DataOnDemandSvc.h.

bool DataOnDemandSvc::m_locked_all`[private]`

Definition at line 293 of file DataOnDemandSvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r9/GaudiSvc/src/IncidentSvc/DataOnDemandSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r9/GaudiSvc/src/IncidentSvc/DataOnDemandSvc.cpp