The Gaudi Framework
v38r0 (2143aa4c)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
GetAlgs.cpp
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
// ============================================================================
12
// Include files
13
// ============================================================================
14
// STD&STL
15
// ============================================================================
16
#include <algorithm>
17
#include <functional>
18
// ============================================================================
19
// GaudiKernel
20
// ============================================================================
21
#include "
GaudiKernel/IAlgContextSvc.h
"
22
#include "
GaudiKernel/IAlgorithm.h
"
23
// ============================================================================
24
// GaudiAlg
25
// ============================================================================
26
#include "
GaudiAlg/GetAlg.h
"
27
#include "
GaudiAlg/GetAlgs.h
"
28
// ============================================================================
29
#include "
GaudiAlg/GaudiAlgorithm.h
"
30
#include "
GaudiAlg/GaudiHistoAlg.h
"
31
#include "
GaudiAlg/GaudiSequencer.h
"
32
#include "
GaudiAlg/GaudiTupleAlg.h
"
33
#include "
GaudiAlg/Sequencer.h
"
34
// ============================================================================
40
// ============================================================================
41
namespace
{
42
template
<
class
TYPE>
43
TYPE* getAlg(
const
IAlgContextSvc
* svc ) {
44
if
( !svc ) {
return
nullptr
; }
// RETURN
45
const
auto
&
algs
= svc->
algorithms
();
46
auto
it =
std::find_if
(
algs
.rbegin(),
algs
.rend(),
Gaudi::Utils::AlgTypeSelector<TYPE>
{} );
47
if
(
algs
.rend() == it ) {
return
nullptr
; }
// RETURN
48
IAlgorithm
*
alg
= *it;
49
return
dynamic_cast<
TYPE*
>
(
alg
);
// RETURN
50
}
51
}
// namespace
52
// ============================================================================
53
/* simple function to extract the last active
54
* GaudiAlgorithm from the context
55
*
56
* @code
57
*
58
* // get the context service:
59
* const IAlgContextSvc* svc = ... ;
60
*
61
* GaudiAlgorithm* ga = getGaudiAlg ( svc ) ;
62
*
63
* @endcode
64
*
65
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
66
* @date 2007-09-07
67
*/
68
// ============================================================================
69
GaudiAlgorithm
*
Gaudi::Utils::getGaudiAlg
(
const
IAlgContextSvc
* svc ) {
return
getAlg<GaudiAlgorithm>( svc ); }
70
// ============================================================================
71
/* simple function to extract the last active
72
* GaudiHistoAlg from the context
73
*
74
* @code
75
*
76
* // get the context service:
77
* const IAlgContextSvc* svc = ... ;
78
*
79
* GaudiHistoAlg* ha = getHistoAlg ( svc ) ;
80
*
81
* @endcode
82
*
83
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
84
* @date 2007-09-07
85
*/
86
// ============================================================================
87
GaudiHistoAlg
*
Gaudi::Utils::getHistoAlg
(
const
IAlgContextSvc
* svc ) {
return
getAlg<GaudiHistoAlg>( svc ); }
88
// ============================================================================
89
/* simple function to extract the last active
90
* GaudiTupleAlg from the context
91
*
92
* @code
93
*
94
* // get the context service:
95
* const IAlgContextSvc* svc = ... ;
96
*
97
* GaudiTupleAlg* ta = getTupleAlg ( svc ) ;
98
*
99
* @endcode
100
*
101
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
102
* @date 2007-09-07
103
*/
104
// ============================================================================
105
GaudiTupleAlg
*
Gaudi::Utils::getTupleAlg
(
const
IAlgContextSvc
* svc ) {
return
getAlg<GaudiTupleAlg>( svc ); }
106
// ============================================================================
107
/* simple function to extract the last active
108
* GaudiSequencer from the context
109
*
110
* @code
111
*
112
* // get the context service:
113
* const IAlgContextSvc* svc = ... ;
114
*
115
* GaudiSequencer* sa = getGaudiSequencer ( svc ) ;
116
*
117
* @endcode
118
*
119
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
120
* @date 2007-09-07
121
*/
122
// ============================================================================
123
GaudiSequencer
*
Gaudi::Utils::getGaudiSequencer
(
const
IAlgContextSvc
* svc ) {
return
getAlg<GaudiSequencer>( svc ); }
124
// ============================================================================
125
/* simple function to extract the last active
126
* Sequencer from the context
127
*
128
* @code
129
*
130
* // get the context service:
131
* const IAlgContextSvc* svc = ... ;
132
*
133
* Sequencer* sa = getSequencerAlg ( svc ) ;
134
*
135
* @endcode
136
*
137
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
138
* @date 2007-09-07
139
*/
140
Sequencer
*
Gaudi::Utils::getSequencerAlg
(
const
IAlgContextSvc
* svc ) {
return
getAlg<Sequencer>( svc ); }
141
// ========================================================================
142
/* simple function to extract the last active
143
* "Sequencer" () GaudiSequencer or Sequencer)
144
* from the context
145
*
146
* @code
147
*
148
* // get the context service:
149
* const IAlgContextSvc* svc = ... ;
150
*
151
* IAlgorithm* a = getSequencer ( svc ) ;
152
*
153
* @endcode
154
*
155
* @author Vanya BELYAEV ibelyaev@physics.syr.edu
156
* @date 2007-09-07
157
*/
158
// ========================================================================
159
IAlgorithm
*
Gaudi::Utils::getSequencer
(
const
IAlgContextSvc
* svc ) {
160
if
( !svc ) {
return
nullptr
; }
// RETURN
161
//
162
AlgTypeSelector<GaudiSequencer>
sel1;
163
AlgTypeSelector<Sequencer>
sel2;
164
165
const
auto
&
algs
= svc->
algorithms
();
166
auto
a =
std::find_if
(
algs
.rbegin(),
algs
.rend(), [&](
IAlgorithm
*
alg
) { return sel1( alg ) || sel2( alg ); } );
167
return
a !=
algs
.rend() ? *a :
nullptr
;
168
}
169
// ========================================================================
170
171
// ============================================================================
172
// The END
173
// ============================================================================
Sequencer.h
Gaudi::Utils::getSequencerAlg
GAUDI_API Sequencer * getSequencerAlg(const IAlgContextSvc *svc)
simple function to extract the last active Sequencer from the context
Definition:
GetAlgs.cpp:140
Gaudi::Utils::AlgTypeSelector
Definition:
GetAlg.h:49
std::find_if
T find_if(T... args)
Gaudi::Utils::getTupleAlg
GAUDI_API GaudiTupleAlg * getTupleAlg(const IAlgContextSvc *svc)
simple function to extract the last active GaudiTupleAlg from the context
Definition:
GetAlgs.cpp:105
IAlgContextSvc::algorithms
virtual const Algorithms & algorithms() const =0
get the stack of executed algorithms
Gaudi::Utils::getGaudiAlg
GAUDI_API GaudiAlgorithm * getGaudiAlg(const IAlgContextSvc *svc)
simple function to extract the last active GaudiAlgorithm from the context
Definition:
GetAlgs.cpp:69
Gaudi::Utils::getHistoAlg
GAUDI_API GaudiHistoAlg * getHistoAlg(const IAlgContextSvc *svc)
simple function to extract the last active GaudiHistoAlg from the context
Definition:
GetAlgs.cpp:87
GaudiTupleAlg
Definition:
GaudiTupleAlg.h:51
Histograms.algs
algs
Definition:
Histograms.py:26
GaudiHistoAlg.h
basic.alg
alg
Definition:
basic.py:15
GaudiTupleAlg.h
Gaudi::Utils::getGaudiSequencer
GAUDI_API GaudiSequencer * getGaudiSequencer(const IAlgContextSvc *svc)
simple function to extract the last active GaudiSequencer from the context
Definition:
GetAlgs.cpp:123
IAlgorithm
Definition:
IAlgorithm.h:38
GaudiAlgorithm
Definition:
GaudiAlgorithm.h:104
GetAlg.h
GaudiSequencer
Definition:
GaudiSequencer.h:38
IAlgContextSvc.h
GaudiAlgorithm.h
GaudiHistoAlg
Definition:
GaudiHistoAlg.h:47
GetAlgs.h
IAlgContextSvc
Definition:
IAlgContextSvc.h:33
Gaudi::Utils::getSequencer
GAUDI_API IAlgorithm * getSequencer(const IAlgContextSvc *svc)
simple function to extract the last active "Sequencer" () GaudiSequencer or simple Sequencer) from th...
Definition:
GetAlgs.cpp:159
IAlgorithm.h
GaudiSequencer.h
Gaudi::Sequencer
A Sequencer is essentially a list of Algorithms and is responsible for their management.
Definition:
Sequencer.h:28
GaudiAlg
src
lib
GetAlgs.cpp
Generated on Thu Jan 25 2024 17:52:18 for The Gaudi Framework by
1.8.18