| The Gaudi Framework v32r1 (f65d50dc)

Sequencer.h
Go to the documentation of this file.
1 #ifndef ALGORITHM_SEQUENCER_H
2 #define ALGORITHM_SEQUENCER_H
3
4 // Include files
5 #include "GaudiKernel/Property.h"
6 #include <Gaudi/Sequence.h>
7
8 #include <mutex>
9
10 class MsgStream;
11
25 class GAUDI_API Sequencer : public Gaudi::Sequence {
26 public:
30 using Gaudi::Sequence::Sequence;
31 /*****************************
32 ** Public Function Members **
33 *****************************/
34
41 StatusCode initialize() override;
42
46 StatusCode reinitialize() override;
47
51 StatusCode start() override;
52
57 StatusCode execute( const EventContext& ctx ) const override;
58
62 StatusCode stop() override;
63
67 StatusCode finalize() override;
68
76 bool branchFilterPassed( const EventContext& ctx ) const;
77
81 void setBranchFilterPassed( const EventContext& ctx, bool state ) const;
82
86 virtual bool isStopOverride() const;
87
91 StatusCode append( Gaudi::Algorithm* pAlgorithm );
92
96 StatusCode appendToBranch( Gaudi::Algorithm* pAlgorithm );
97
107 StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
108 const std::string& name, // The name to be given to the algorithm
109 Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
110 );
111
121 StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
122 const std::string& name, // The name to be given to the algorithm
123 Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm
124 // object
125 );
126
130 StatusCode remove( Gaudi::Algorithm* pAlgorithm );
131 StatusCode remove( const std::string& name );
132 StatusCode removeFromBranch( Gaudi::Algorithm* pAlgorithm );
133 StatusCode removeFromBranch( const std::string& name );
134
141 const std::vector<Gaudi::Algorithm*>& branchAlgorithms() const;
142 std::vector<Gaudi::Algorithm*>& branchAlgorithms();
143
145 StatusCode decodeMemberNames();
146
148 StatusCode decodeBranchMemberNames();
149
150 protected:
154 StatusCode append( Gaudi::Algorithm* pAlgorithm, std::vector<Gaudi::Algorithm*>& theAlgs );
155
165 StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
166 const std::string& name, // The name to be given to the algorithm
167 Gaudi::Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
168 std::vector<Gaudi::Algorithm*>& theAlgs );
169
173 StatusCode decodeNames( Gaudi::Property<std::vector<std::string>>& theNames, std::vector<Gaudi::Algorithm*>& theAlgs,
174 std::vector<bool>& theLogic );
175
179 StatusCode execute( const EventContext& ctx, const std::vector<Gaudi::Algorithm*>& theAlgs,
180 const std::vector<bool>& theLogic, Gaudi::Algorithm*& lastAlgorithm,
181 std::size_t first = 0 ) const;
182
186 StatusCode executeMember( Gaudi::Algorithm* theAlgorithm, const EventContext& context ) const;
187
192 StatusCode remove( const std::string& algname, std::vector<Gaudi::Algorithm*>& theAlgs );
193
194 // NO COPY / ASSIGNMENT ALLOWED
195 Sequencer( const Sequencer& a ) = delete;
196 Sequencer& operator=( const Sequencer& rhs ) = delete;
197
198 public:
200 std::ostream& toControlFlowExpression( std::ostream& os ) const override;
201
202 private:
203 /**************************
204 ** Private Data Members **
205 **************************/
206
207 Gaudi::Property<std::vector<std::string>> m_names{this,
208 "Members",
209 {},
210 [this]( auto& ) {
211 if ( this->isInitialized() ) this->decodeMemberNames().ignore();
212 },
213 "member names"};
214 Gaudi::Property<std::vector<std::string>> m_branchNames{this,
215 "BranchMembers",
216 {},
217 [this]( auto& ) {
218 if ( this->isInitialized() )
219 this->decodeBranchMemberNames().ignore();
220 },
221 "branch member names"};
222 Gaudi::Property<bool> m_stopOverride{this, "StopOverride", false, "stop on filter failure override"};
223
224 std::vector<bool> m_isInverted; // Member logic inverted list
225 std::vector<Gaudi::Algorithm*> m_branchAlgs; // Branch algorithms
226 std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
227
228 mutable std::mutex m_branchFilterMutex;
229 mutable std::map<EventContext::ContextID_t, bool> m_branchFilterPassed; // Branch filter passed flag
230 };
231
232 #endif // ALGORITHM_SEQUENCER_H
Gaudi::Sequence::initialize
StatusCode initialize() override
Initialization method invoked by the framework.
Definition: Sequence.cpp:17
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
Sequence.h
Sequencer::m_branchAlgs
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225
Gaudi::Algorithm::toControlFlowExpression
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:823
Gaudi::Sequence::stop
StatusCode stop() override
System stop.
Definition: Sequence.cpp:59
std::size_t
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::map< EventContext::ContextID_t, bool >
std::mutex
Sequencer::m_branchFilterMutex
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
std::string
STL class.
Gaudi::Sequence::reinitialize
StatusCode reinitialize() override
Reinitialization method invoked by the framework.
Definition: Sequence.cpp:69
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Algorithm::operator=
Algorithm & operator=(const Algorithm &rhs)=delete
Private assignment operator: NO ASSIGNMENT ALLOWED.
gaudirun.type
type
Definition: gaudirun.py:142
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
Gaudi::Sequence::finalize
StatusCode finalize() override
System finalization.
Definition: Sequence.cpp:29
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
Gaudi::Algorithm::isInitialized
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:456
std::vector< Gaudi::Algorithm * >
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
Gaudi::Sequence::start
StatusCode start() override
System start.
Definition: Sequence.cpp:47
Property.h
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
Sequencer::m_branchFilterPassed
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229
Sequencer
ClassName: Sequencer.
Definition: Sequencer.h:25
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
std::ostream
STL class.
Gaudi::Sequence
Definition: Sequence.h:8
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226