Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
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
169 
174  std::vector<bool>& theLogic );
175 
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 
208  "Members",
209  {},
210  [this]( auto& ) {
211  if ( this->isInitialized() ) this->decodeMemberNames().ignore();
212  },
213  "member names"};
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
226  std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
227 
230 };
231 
232 #endif // ALGORITHM_SEQUENCER_H
StatusCode initialize() override
Initialization method invoked by the framework.
Definition: Sequence.cpp:17
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Implementation of property with value of concrete type.
Definition: Property.h:352
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
StatusCode execute() override final
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225
StatusCode stop() override
System stop.
Definition: Sequence.cpp:59
This class represents an entry point to all the event specific data.
Definition: EventContext.h:31
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
STL class.
StatusCode reinitialize() override
Reinitialization method invoked by the framework.
Definition: Sequence.cpp:69
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Algorithm & operator=(const Algorithm &rhs)=delete
Private assignment operator: NO ASSIGNMENT ALLOWED.
StatusCode finalize() override
System finalization.
Definition: Sequence.cpp:29
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:456
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
StatusCode start() override
System start.
Definition: Sequence.cpp:47
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229
ClassName: Sequencer.
Definition: Sequencer.h:25
#define GAUDI_API
Definition: Kernel.h:71
STL class.
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:813
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226