| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

DataOnDemandSvc.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_DATAONDEMANDSVC_H
2 #define GAUDISVC_DATAONDEMANDSVC_H
3 // ============================================================================
4 // Include Files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <map>
9 #include <vector>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
13 #include "GaudiKernel/ChronoEntity.h"
14 #include "GaudiKernel/IDODAlgMapper.h"
15 #include "GaudiKernel/IDODNodeMapper.h"
16 #include "GaudiKernel/IIncidentListener.h"
17 #include "GaudiKernel/Service.h"
18 #include "GaudiKernel/StatEntity.h"
19 #include "GaudiKernel/StringKey.h"
20 // ============================================================================
21 // ROOT TClass
22 // ============================================================================
23 #include "TClass.h"
24 // ============================================================================
25 // Forward declarations
26 // ============================================================================
27 class IAlgTool;
28 class IAlgorithm;
29 class IAlgManager;
30 class IIncidentSvc;
31 class IDataProviderSvc;
32 class IToolSvc;
33 // ============================================================================
90 class DataOnDemandSvc : public extends<Service, IIncidentListener>
91 {
92 public:
93 // ==========================================================================
94 // Typedefs
95 typedef std::vector<std::string> Setup;
96 typedef TClass* ClassH;
97 // ==========================================================================
102 struct Protection {
103 bool& m_bool;
104 Protection( bool& b ) : m_bool( b ) { m_bool = true; }
105 ~Protection() { m_bool = false; }
106 };
107 // ==========================================================================
113 struct Node {
114 // ========================================================================
116 ClassH clazz; // the actual class
117 std::string name;
118 unsigned long num = 0;
119 bool executing = false;
121 bool dataObject = false; // trivial object? DataObject?
122 // =======================================================================
123 Node() = default;
124 // ========================================================================
125 Node( ClassH c, bool e, std::string n )
126 : clazz( c ), name( std::move( n ) ), executing( e ), dataObject( "DataObject" == name )
127 {
128 }
129 //
130 Node( const Node& c )
131 : clazz( c.clazz ), name( c.name ), num( c.num ), executing( c.executing ), dataObject( c.dataObject )
132 {
133 }
134 // ========================================================================
135 };
136 // ==========================================================================
138 struct Leaf {
139 IAlgorithm* algorithm = nullptr;
140 std::string name;
141 std::string type;
142 unsigned long num = 0;
143 bool executing = false;
144 Leaf() = default;
145 Leaf( const Leaf& l ) = default;
146 Leaf( std::string t, std::string n ) : name( std::move( n ) ), type( std::move( t ) ) {}
147 };
148 // ==========================================================================
149 public:
150 // ==========================================================================
151 typedef GaudiUtils::HashMap<Gaudi::StringKey, Node> NodeMap;
152 typedef GaudiUtils::HashMap<Gaudi::StringKey, Leaf> AlgMap;
154 StatusCode initialize() override;
156 StatusCode finalize() override;
158 StatusCode reinitialize() override;
160 void handle( const Incident& incident ) override;
166 DataOnDemandSvc( const std::string& name, // Service instance name
167 ISvcLocator* svc ); // Pointer to service locator
169 ~DataOnDemandSvc() override = default; // Standard destructor
170 // ==========================================================================
171 protected:
172 // ==========================================================================
177 StatusCode configureHandler( Leaf& leaf );
178 // ==========================================================================
184 StatusCode execHandler( const std::string& tag, Leaf& leaf );
185 // ==========================================================================
191 StatusCode execHandler( const std::string& tag, Node& node );
192 // ==========================================================================
194 StatusCode setupNodeHandlers();
195 // ==========================================================================
197 StatusCode setupAlgHandlers();
198 // ==========================================================================
200 StatusCode setup();
202 void i_setNodeHandler( const std::string& name, const std::string& type );
204 StatusCode i_setAlgHandler( const std::string& name, const Gaudi::Utils::TypeNameString& alg );
205 // ==========================================================================
206 protected:
207 // ==========================================================================
209 StatusCode update();
214 void dump( const MSG::Level level, const bool mode = true ) const;
215 // ==========================================================================
216 private:
217 // ==========================================================================
219 SmartIF<IIncidentSvc> m_incSvc = nullptr;
221 SmartIF<IAlgManager> m_algMgr = nullptr;
223 SmartIF<IDataProviderSvc> m_dataSvc = nullptr;
225 SmartIF<IToolSvc> m_toolSvc;
227 AlgMap m_algs;
229 NodeMap m_nodes;
230
231 bool m_updateRequired = true;
232 // ==========================================================================
233 ChronoEntity m_total;
234 ulonglong m_statAlg = 0;
235 ulonglong m_statNode = 0;
236 ulonglong m_stat = 0;
237 // ==========================================================================
238 ChronoEntity m_timer_nodes;
239 ChronoEntity m_timer_algs;
240 ChronoEntity m_timer_all;
241 bool m_locked_nodes = false;
242 bool m_locked_algs = false;
243 bool m_locked_all = false;
244 // ==========================================================================
245 std::vector<IDODNodeMapper*> m_nodeMappers;
246 std::vector<IDODAlgMapper*> m_algMappers;
247 // ==========================================================================
248 // Properties
249 Gaudi::Property<std::string> m_trapType{this, "IncidentName", "DataFault", "the type of handled Incident"};
250 Gaudi::Property<std::string> m_dataSvcName{this, "DataSvc", "EventDataSvc", "DataSvc name"};
251
252 Gaudi::Property<bool> m_partialPath{this, "UsePreceedingPath", true, "allow creation of partial leaves"};
253 Gaudi::Property<bool> m_dump{
254 this, "Dump", false,
255 "dump configuration and stastics, if set to True after initialize it triggers a dump immediately"};
256 Gaudi::Property<bool> m_init{this, "PreInitialize", false, "(pre)initialize all algorithms"};
257 Gaudi::Property<bool> m_allowInitFailure{
258 this, "AllowPreInitializeFailure", false,
259 "allow (pre)initialization of algorithms to fail without stopping the application"};
260
261 Gaudi::Property<Setup> m_algMapping{this, "Algorithms", {}, "[[deprecated]] use AlgMap"};
262 Gaudi::Property<Setup> m_nodeMapping{this, "Nodes", {}, "[[deprecated]] use NodeMap"};
263
264 typedef std::map<std::string, std::string> Map;
265 Gaudi::Property<Map> m_algMap{this, "AlgMap", {}, "mapping {'data': 'algorithm'}"};
266 Gaudi::Property<Map> m_nodeMap{this, "NodeMap", {}, "mapping {'data': 'type'}"};
267
268 Gaudi::Property<std::string> m_prefix{this, "Prefix", "/Event/"};
269
270 Gaudi::Property<std::vector<std::string>> m_nodeMapTools{
271 this, "NodeMappingTools", {}, "list of tools of type IDODNodeMapper"};
272 Gaudi::Property<std::vector<std::string>> m_algMapTools{
273 this, "AlgMappingTools", {}, "list of tools of type IDODAlgMapper"};
274 };
275 // ============================================================================
276
277 // ============================================================================
278 // The END
279 // ============================================================================
280 #endif // GAUDISVC_DATAONDEMANDSVC_H
281 // ============================================================================
DataOnDemandSvc::i_setNodeHandler
void i_setNodeHandler(const std::string &name, const std::string &type)
Internal method to initialize a node handler.
Definition: DataOnDemandSvc.cpp:145
IToolSvc
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:19
DataOnDemandSvc::m_timer_all
ChronoEntity m_timer_all
Definition: DataOnDemandSvc.h:240
SmartIF< IIncidentSvc >
DataOnDemandSvc::Node::name
std::string name
Definition: DataOnDemandSvc.h:117
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudirun.c
c
Definition: gaudirun.py:407
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
DataOnDemandSvc::ClassH
TClass * ClassH
Definition: DataOnDemandSvc.h:96
DataOnDemandSvc
The DataOnDemandSvc listens to incidents typically triggered by the data service of the configurable ...
Definition: DataOnDemandSvc.h:90
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
DataOnDemandSvc::m_timer_algs
ChronoEntity m_timer_algs
Definition: DataOnDemandSvc.h:239
DataOnDemandSvc::m_stat
ulonglong m_stat
Definition: DataOnDemandSvc.h:236
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
DataOnDemandSvc::Leaf::type
std::string type
Definition: DataOnDemandSvc.h:141
DataOnDemandSvc::m_incSvc
SmartIF< IIncidentSvc > m_incSvc
Incident service.
Definition: DataOnDemandSvc.h:219
DataOnDemandSvc::handle
void handle(const Incident &incident) override
IIncidentListener interfaces overrides: incident handling.
Definition: DataOnDemandSvc.cpp:553
DataOnDemandSvc::Setup
std::vector< std::string > Setup
Definition: DataOnDemandSvc.h:95
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
DataOnDemandSvc::m_trapType
Gaudi::Property< std::string > m_trapType
Definition: DataOnDemandSvc.h:249
std
STL namespace.
DataOnDemandSvc::m_locked_nodes
bool m_locked_nodes
Definition: DataOnDemandSvc.h:241
DataOnDemandSvc::Leaf
Definition: DataOnDemandSvc.h:138
DataOnDemandSvc::m_nodeMap
Gaudi::Property< Map > m_nodeMap
Definition: DataOnDemandSvc.h:266
DataOnDemandSvc::Protection::m_bool
bool & m_bool
Definition: DataOnDemandSvc.h:103
DataOnDemandSvc::m_init
Gaudi::Property< bool > m_init
Definition: DataOnDemandSvc.h:256
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
DataOnDemandSvc::m_statAlg
ulonglong m_statAlg
Definition: DataOnDemandSvc.h:234
DataOnDemandSvc::initialize
StatusCode initialize() override
Inherited Service overrides: Service initialization.
Definition: DataOnDemandSvc.cpp:235
std::map< std::string, std::string >
std::string
STL class.
DataOnDemandSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Data provider reference.
Definition: DataOnDemandSvc.h:223
Service.h
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
DataOnDemandSvc::m_statNode
ulonglong m_statNode
Definition: DataOnDemandSvc.h:235
DataOnDemandSvc::m_algMapping
Gaudi::Property< Setup > m_algMapping
Definition: DataOnDemandSvc.h:261
DataOnDemandSvc::m_algMapTools
Gaudi::Property< std::vector< std::string > > m_algMapTools
Definition: DataOnDemandSvc.h:272
DataOnDemandSvc::Node::clazz
ClassH clazz
the actual class
Definition: DataOnDemandSvc.h:116
MSG::Level
Level
Definition: IMessageSvc.h:16
DataOnDemandSvc::m_prefix
Gaudi::Property< std::string > m_prefix
Definition: DataOnDemandSvc.h:268
DataOnDemandSvc::m_nodeMapTools
Gaudi::Property< std::vector< std::string > > m_nodeMapTools
Definition: DataOnDemandSvc.h:270
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
DataOnDemandSvc::m_algMap
Gaudi::Property< Map > m_algMap
Definition: DataOnDemandSvc.h:265
DataOnDemandSvc::setup
StatusCode setup()
Setup routine (called by (re-) initialize.
Definition: DataOnDemandSvc.cpp:347
__longlong
Definition: Kernel.h:56
DataOnDemandSvc::Node::Node
Node(const Node &c)
Definition: DataOnDemandSvc.h:130
DataOnDemandSvc::execHandler
StatusCode execHandler(const std::string &tag, Leaf &leaf)
Execute leaf handler (algorithm)
Definition: DataOnDemandSvc.cpp:671
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
DataOnDemandSvc::setupNodeHandlers
StatusCode setupNodeHandlers()
Initialize node handlers.
Definition: DataOnDemandSvc.cpp:395
gaudirun.type
type
Definition: gaudirun.py:133
DataOnDemandSvc::Protection
Helper class of the DataOnDemandSvc.
Definition: DataOnDemandSvc.h:102
StringKey.h
DataOnDemandSvc::m_nodes
NodeMap m_nodes
Map of "empty" objects to be placed as intermediate nodes.
Definition: DataOnDemandSvc.h:229
DataOnDemandSvc::Protection::~Protection
~Protection()
Definition: DataOnDemandSvc.h:105
DataOnDemandSvc::dump
void dump(const MSG::Level level, const bool mode=true) const
dump the content of DataOnDemand service
Definition: DataOnDemandSvc.cpp:710
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
gaudirun.l
dictionary l
Definition: gaudirun.py:440
DataOnDemandSvc::m_partialPath
Gaudi::Property< bool > m_partialPath
Definition: DataOnDemandSvc.h:252
DataOnDemandSvc::m_nodeMappers
std::vector< IDODNodeMapper * > m_nodeMappers
Definition: DataOnDemandSvc.h:245
DataOnDemandSvc::Leaf::name
std::string name
Definition: DataOnDemandSvc.h:140
DataOnDemandSvc::Protection::Protection
Protection(bool &b)
Definition: DataOnDemandSvc.h:104
std::vector< std::string >
DataOnDemandSvc::m_algMgr
SmartIF< IAlgManager > m_algMgr
Algorithm manager.
Definition: DataOnDemandSvc.h:221
DataOnDemandSvc::Node::Node
Node(ClassH c, bool e, std::string n)
Definition: DataOnDemandSvc.h:125
DataOnDemandSvc::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Data provider reference.
Definition: DataOnDemandSvc.h:225
DataOnDemandSvc::m_algs
AlgMap m_algs
Map of algorithms to handle incidents.
Definition: DataOnDemandSvc.h:227
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
DataOnDemandSvc::m_nodeMapping
Gaudi::Property< Setup > m_nodeMapping
Definition: DataOnDemandSvc.h:262
DataOnDemandSvc::Leaf::Leaf
Leaf(std::string t, std::string n)
Definition: DataOnDemandSvc.h:146
DataOnDemandSvc::m_timer_nodes
ChronoEntity m_timer_nodes
Definition: DataOnDemandSvc.h:238
DataOnDemandSvc::m_dataSvcName
Gaudi::Property< std::string > m_dataSvcName
Definition: DataOnDemandSvc.h:250
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
DataOnDemandSvc::m_updateRequired
bool m_updateRequired
Definition: DataOnDemandSvc.h:231
StatEntity.h
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
DataOnDemandSvc::DataOnDemandSvc
DataOnDemandSvc(const std::string &name, ISvcLocator *svc)
Standard initializing service constructor.
Definition: DataOnDemandSvc.cpp:41
DataOnDemandSvc::finalize
StatusCode finalize() override
Inherited Service overrides: Service finalization.
Definition: DataOnDemandSvc.cpp:262
GaudiUtils::HashMap< Gaudi::StringKey, Node >
IIncidentListener.h
gaudirun.level
level
Definition: gaudirun.py:271
DataOnDemandSvc::NodeMap
GaudiUtils::HashMap< Gaudi::StringKey, Node > NodeMap
Definition: DataOnDemandSvc.h:151
DataOnDemandSvc::~DataOnDemandSvc
~DataOnDemandSvc() override=default
Standard destructor.
DataOnDemandSvc::m_total
ChronoEntity m_total
Definition: DataOnDemandSvc.h:233
DataOnDemandSvc::setupAlgHandlers
StatusCode setupAlgHandlers()
Initialize leaf handlers.
Definition: DataOnDemandSvc.cpp:425
DataOnDemandSvc::Node
Helper class of the DataOnDemandSvc.
Definition: DataOnDemandSvc.h:113
ChronoEntity.h
DataOnDemandSvc::i_setAlgHandler
StatusCode i_setAlgHandler(const std::string &name, const Gaudi::Utils::TypeNameString &alg)
Internal method to initialize an algorithm handler.
Definition: DataOnDemandSvc.cpp:154
DataOnDemandSvc::m_dump
Gaudi::Property< bool > m_dump
Definition: DataOnDemandSvc.h:253
DataOnDemandSvc::configureHandler
StatusCode configureHandler(Leaf &leaf)
Configure handler for leaf.
Definition: DataOnDemandSvc.cpp:455
DataOnDemandSvc::m_allowInitFailure
Gaudi::Property< bool > m_allowInitFailure
Definition: DataOnDemandSvc.h:257
DataOnDemandSvc::m_algMappers
std::vector< IDODAlgMapper * > m_algMappers
Definition: DataOnDemandSvc.h:246
DataOnDemandSvc::Map
std::map< std::string, std::string > Map
Definition: DataOnDemandSvc.h:264
DataOnDemandSvc::m_locked_algs
bool m_locked_algs
Definition: DataOnDemandSvc.h:242
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
IDODNodeMapper.h
DataOnDemandSvc::reinitialize
StatusCode reinitialize() override
Inherited Service overrides: Service reinitialization.
Definition: DataOnDemandSvc.cpp:311
DataOnDemandSvc::update
StatusCode update()
update the handlers
Definition: DataOnDemandSvc.cpp:175
DataOnDemandSvc::AlgMap
GaudiUtils::HashMap< Gaudi::StringKey, Leaf > AlgMap
Definition: DataOnDemandSvc.h:152
IDODAlgMapper.h
DataOnDemandSvc::m_locked_all
bool m_locked_all
Definition: DataOnDemandSvc.h:243