Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Sequencer.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 #ifndef ALGORITHM_SEQUENCER_H
12 #define ALGORITHM_SEQUENCER_H
13 
14 // Include files
15 #include <Gaudi/Property.h>
16 #include <Gaudi/Sequence.h>
17 
18 #include <mutex>
19 
20 class MsgStream;
21 
36 public:
40  using Gaudi::Sequence::Sequence;
41  /*****************************
42  ** Public Function Members **
43  *****************************/
44 
51  StatusCode initialize() override;
52 
56  StatusCode reinitialize() override;
57 
61  StatusCode start() override;
62 
67  StatusCode execute( const EventContext& ctx ) const override;
68 
72  StatusCode stop() override;
73 
77  StatusCode finalize() override;
78 
86  bool branchFilterPassed( const EventContext& ctx ) const;
87 
91  void setBranchFilterPassed( const EventContext& ctx, bool state ) const;
92 
96  virtual bool isStopOverride() const;
97 
101  StatusCode append( Gaudi::Algorithm* pAlgorithm );
102 
106  StatusCode appendToBranch( Gaudi::Algorithm* pAlgorithm );
107 
117  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
118  const std::string& name, // The name to be given to the algorithm
119  Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
120  );
121 
131  StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
132  const std::string& name, // The name to be given to the algorithm
133  Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm
134  // object
135  );
136 
140  StatusCode remove( Gaudi::Algorithm* pAlgorithm );
141  StatusCode remove( const std::string& name );
142  StatusCode removeFromBranch( Gaudi::Algorithm* pAlgorithm );
143  StatusCode removeFromBranch( const std::string& name );
144 
151  const std::vector<Gaudi::Algorithm*>& branchAlgorithms() const;
152  std::vector<Gaudi::Algorithm*>& branchAlgorithms();
153 
155  StatusCode decodeMemberNames();
156 
158  StatusCode decodeBranchMemberNames();
159 
160 protected:
164  StatusCode append( Gaudi::Algorithm* pAlgorithm, std::vector<Gaudi::Algorithm*>& theAlgs );
165 
175  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
176  const std::string& name, // The name to be given to the algorithm
177  Gaudi::Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
179 
184  std::vector<bool>& theLogic );
185 
190  const std::vector<bool>& theLogic, Gaudi::Algorithm*& lastAlgorithm,
191  std::size_t first = 0 ) const;
192 
196  StatusCode executeMember( Gaudi::Algorithm* theAlgorithm, const EventContext& context ) const;
197 
202  StatusCode remove( const std::string& algname, std::vector<Gaudi::Algorithm*>& theAlgs );
203 
204  // NO COPY / ASSIGNMENT ALLOWED
205  Sequencer( const Sequencer& a ) = delete;
206  Sequencer& operator=( const Sequencer& rhs ) = delete;
207 
208 public:
210  std::ostream& toControlFlowExpression( std::ostream& os ) const override;
211 
212 private:
213  /**************************
214  ** Private Data Members **
215  **************************/
216 
218  "Members",
219  {},
220  [this]( auto& ) {
221  if ( this->isInitialized() ) this->decodeMemberNames().ignore();
222  },
223  "member names" };
225  "BranchMembers",
226  {},
227  [this]( auto& ) {
228  if ( this->isInitialized() )
229  this->decodeBranchMemberNames().ignore();
230  },
231  "branch member names" };
232  Gaudi::Property<bool> m_stopOverride{ this, "StopOverride", false, "stop on filter failure override" };
233 
234  std::vector<bool> m_isInverted; // Member logic inverted list
236  std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
237 
240 };
241 
242 #endif // ALGORITHM_SEQUENCER_H
std::string
STL class.
Gaudi::Sequence::initialize
StatusCode initialize() override
Initialization method invoked by the framework.
Definition: Sequence.cpp:24
Sequencer
ClassName: Sequencer.
Definition: Sequencer.h:35
Gaudi::Algorithm::isInitialized
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:419
std::vector< Gaudi::Algorithm * >
Sequencer::m_branchAlgs
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:235
Gaudi::Sequence::finalize
StatusCode finalize() override
System finalization.
Definition: Sequence.cpp:36
Sequencer::m_branchFilterMutex
std::mutex m_branchFilterMutex
Definition: Sequencer.h:238
Gaudi::Sequence::stop
StatusCode stop() override
System stop.
Definition: Sequence.cpp:66
Gaudi::Sequence::start
StatusCode start() override
System start.
Definition: Sequence.cpp:54
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:234
TimingHistograms.name
name
Definition: TimingHistograms.py:25
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:588
StatusCode
Definition: StatusCode.h:65
GaudiPython.Pythonizations.execute
execute
Definition: Pythonizations.py:588
std::ostream
STL class.
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
Sequencer::m_branchFilterPassed
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:239
Gaudi::Algorithm::toControlFlowExpression
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:663
std::map< EventContext::ContextID_t, bool >
MsgStream
Definition: MsgStream.h:34
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
gaudirun.type
type
Definition: gaudirun.py:162
Sequencer::Sequencer
Sequencer(const Sequencer &a)=delete
EventContext
Definition: EventContext.h:34
Sequence.h
std::mutex
STL class.
std::size_t
Gaudi::Sequence
Definition: Sequence.h:18
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:236
compareRootHistos.state
state
Definition: compareRootHistos.py:498
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:39
Property.h
Gaudi::Sequence::reinitialize
StatusCode reinitialize() override
Reinitialization method invoked by the framework.
Definition: Sequence.cpp:76
Sequencer::operator=
Sequencer & operator=(const Sequencer &rhs)=delete