The Gaudi Framework
v36r9p1 (5c15b2bb)
HiveDataBroker.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#pragma once
12
#include "
GaudiKernel/IDataBroker.h
"
13
#include "
GaudiKernel/Service.h
"
14
#include <
Gaudi/Algorithm.h
>
15
#include <stdexcept>
16
17
class
HiveDataBrokerSvc
final :
public
extends
<Service, IDataBroker> {
18
public
:
19
using
extends::extends;
20
21
std::vector<Gaudi::Algorithm*>
algorithmsRequiredFor
(
const
DataObjIDColl
& requested,
22
const
std::vector<std::string>
& stoppers = {} )
const
override
;
23
std::vector<Gaudi::Algorithm*>
algorithmsRequiredFor
(
const
Gaudi::Utils::TypeNameString
&
alg
,
24
const
std::vector<std::string>
& stoppers = {} )
const
override
;
25
26
StatusCode
initialize
()
override
;
27
StatusCode
start
()
override
;
28
StatusCode
stop
()
override
;
29
StatusCode
finalize
()
override
;
30
31
private
:
32
Gaudi::Property<std::string>
m_dataLoader
{
this
,
"DataLoader"
,
""
,
33
"Attribute any unmet input dependencies to this Algorithm"
};
34
Gaudi::Property<std::vector<std::string>
>
m_producers
{
35
this
,
"DataProducers"
, {},
"List of algorithms to be used to resolve data dependencies"
};
36
37
struct
AlgEntry
{
38
SmartIF<IAlgorithm>
ialg
;
39
Gaudi::Algorithm
*
alg
;
40
std::set<AlgEntry*>
dependsOn
;
41
int
requestCount
= 0;
42
43
AlgEntry
(
SmartIF<IAlgorithm>
&& p ) :
ialg
{
std::move
( p ) },
alg
{
dynamic_cast<
Gaudi::Algorithm
*
>
(
ialg
.
get
() ) } {
44
if
( !
alg
)
throw
std::runtime_error
(
"algorithm pointer == nullptr???"
);
45
}
46
};
47
48
std::vector<AlgEntry>
49
instantiateAndInitializeAlgorithms
(
const
std::vector<std::string>
& names )
const
;
// algorithms must be fully
50
// initialized first, as
51
// doing so may create
52
// additional data
53
// dependencies...
54
55
std::vector<AlgEntry>
m_algorithms
;
56
57
mutable
std::vector<AlgEntry>
m_cfnodes
;
58
59
std::map<DataObjID, AlgEntry*>
mapProducers
(
std::vector<AlgEntry>
&
algorithms
)
const
;
60
61
std::map<DataObjID, AlgEntry*>
m_dependencies
;
62
};
HiveDataBrokerSvc::initialize
StatusCode initialize() override
Definition:
HiveDataBroker.cpp:72
HiveDataBrokerSvc::m_producers
Gaudi::Property< std::vector< std::string > > m_producers
Definition:
HiveDataBroker.h:34
std::move
T move(T... args)
std::unordered_set< DataObjID, DataObjID_Hasher >
std::vector< Gaudi::Algorithm * >
HiveDataBrokerSvc::AlgEntry::AlgEntry
AlgEntry(SmartIF< IAlgorithm > &&p)
Definition:
HiveDataBroker.h:43
HiveDataBrokerSvc::m_algorithms
std::vector< AlgEntry > m_algorithms
Definition:
HiveDataBroker.h:55
HiveDataBrokerSvc::m_dependencies
std::map< DataObjID, AlgEntry * > m_dependencies
Definition:
HiveDataBroker.h:61
HiveDataBrokerSvc::stop
StatusCode stop() override
Definition:
HiveDataBroker.cpp:122
basic.alg
alg
Definition:
basic.py:15
HiveDataBrokerSvc::m_dataLoader
Gaudi::Property< std::string > m_dataLoader
Definition:
HiveDataBroker.h:32
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition:
TypeNameString.h:20
StatusCode
Definition:
StatusCode.h:65
HiveDataBrokerSvc::instantiateAndInitializeAlgorithms
std::vector< AlgEntry > instantiateAndInitializeAlgorithms(const std::vector< std::string > &names) const
Definition:
HiveDataBroker.cpp:155
Histograms_with_global.algorithms
list algorithms
Definition:
Histograms_with_global.py:19
HiveDataBrokerSvc::start
StatusCode start() override
Definition:
HiveDataBroker.cpp:98
HiveDataBrokerSvc::algorithmsRequiredFor
std::vector< Gaudi::Algorithm * > algorithmsRequiredFor(const DataObjIDColl &requested, const std::vector< std::string > &stoppers={}) const override
Definition:
HiveDataBroker.cpp:270
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition:
Algorithm.h:90
Algorithm.h
std::runtime_error
STL class.
SmartIF< IAlgorithm >
std::map
STL class.
extends
Base class used to extend a class implementing other interfaces.
Definition:
extends.h:20
HiveDataBrokerSvc::mapProducers
std::map< DataObjID, AlgEntry * > mapProducers(std::vector< AlgEntry > &algorithms) const
Definition:
HiveDataBroker.cpp:193
IDataBroker.h
Service.h
HiveDataBrokerSvc::AlgEntry::requestCount
int requestCount
Definition:
HiveDataBroker.h:41
HiveDataBrokerSvc
Definition:
HiveDataBroker.h:17
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition:
SmartIF.h:86
HiveDataBrokerSvc::AlgEntry::ialg
SmartIF< IAlgorithm > ialg
Definition:
HiveDataBroker.h:38
HiveDataBrokerSvc::m_cfnodes
std::vector< AlgEntry > m_cfnodes
Definition:
HiveDataBroker.h:57
HiveDataBrokerSvc::AlgEntry
Definition:
HiveDataBroker.h:37
HiveDataBrokerSvc::AlgEntry::alg
Gaudi::Algorithm * alg
Definition:
HiveDataBroker.h:39
HiveDataBrokerSvc::finalize
StatusCode finalize() override
Definition:
HiveDataBroker.cpp:145
std::set
STL class.
Gaudi::Property< std::string >
HiveDataBrokerSvc::AlgEntry::dependsOn
std::set< AlgEntry * > dependsOn
Definition:
HiveDataBroker.h:40
GaudiHive
src
HiveDataBroker.h
Generated on Fri Feb 3 2023 18:02:55 for The Gaudi Framework by
1.8.18