ATLAS Offline Software
AthSequencer.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // AthSequencer.h
8 // Header file for class AthSequencer
9 // Author: S.Binet<binet@cern.ch>
10 // Stolen from Gaudi repository
12 #ifndef GAUDISEQUENCER_ATHSEQUENCER_H
13 #define GAUDISEQUENCER_ATHSEQUENCER_H
14 
15 // Include files
18 
19 #include "Gaudi/Property.h"
20 #include "Gaudi/Sequence.h"
21 #include "GaudiKernel/ServiceHandle.h"
22 #include "GaudiKernel/IClassIDSvc.h"
23 
24 
39  : public AthCommonDataStore<AthCommonMsg<Gaudi::Sequence>>
40 {
41 public:
42 
46  AthSequencer( const std::string& name, // The path object's name
47  ISvcLocator* svcloc // A pointer to a service location service
48  );
49 
53  virtual ~AthSequencer( );
54 
55  /*****************************
56  ** Public Function Members **
57  *****************************/
58 
59 
66  virtual StatusCode initialize( ) override;
67 
71  virtual StatusCode reinitialize( ) override;
72 
77  virtual StatusCode execute( const EventContext& ctx ) const override;
78 
81  virtual StatusCode start () override;
82 
85  virtual StatusCode stop () override;
86 
90  virtual void resetExecuted( const EventContext& ctx ) const;
91 
95  virtual bool isStopOverride( ) const;
96 
100  StatusCode append( Gaudi::Algorithm* pAlgorithm );
101 
112  const std::string& type, // The concrete algorithm class of the algorithm
113  const std::string& name, // The name to be given to the algorithm
114  Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
115  );
116 
120  StatusCode remove( Gaudi::Algorithm* pAlgorithm );
121  StatusCode remove( const std::string& name );
122 
125 
127  void membershipHandler( Gaudi::Details::PropertyBase& theProp );
128 
131 
133  void branchMembershipHandler( Gaudi::Details::PropertyBase& theProp );
134 
135 protected:
136 
140  StatusCode append( Gaudi::Algorithm* pAlgorithm,
141  std::vector<Gaudi::Algorithm*>* theAlgs );
142 
153  const std::string& type, // The concrete algorithm class of the algorithm
154  const std::string& name, // The name to be given to the algorithm
155  Gaudi::Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
156  std::vector<Gaudi::Algorithm*>* theAlgs
157  );
158 
162  StatusCode decodeNames( Gaudi::Property<std::vector<std::string>>& theNames,
163  std::vector<Gaudi::Algorithm*>* theAlgs );
164 
168  StatusCode remove( const std::string& algname, std::vector<Gaudi::Algorithm*>* theAlgs );
169 
170 private:
172  StatusCode executeAlgorithm (Gaudi::Algorithm* theAlgorithm, const EventContext& ctx) const;
173 
174  /**************************
175  ** Private Data Members **
176  **************************/
177 
178  Gaudi::Property<std::vector<std::string>> m_names{this, "Members",{},
179  "Algorithm names (of the form '<cppType>/<instanceName>')","SubAlgorithm"};
180 
181  Gaudi::Property<bool> m_modeOR{this, "ModeOR", false,
182  "Use OR logic instead of AND"};
183 
184  Gaudi::Property<bool> m_ignoreFilter{this, "IgnoreFilterPassed", false,
185  "Always continue sequence ignoring filterPassed of member algorithms"};
186 
187  Gaudi::Property<bool> m_stopOverride{this, "StopOverride", false,
188  "Continue even if algorithm filter fails"};
189 
190  Gaudi::Property<bool> m_sequential{this, "Sequential", false,
191  "Concurrent or (strict) Sequential ordering of algorithms"};
192 
193  Gaudi::Property<double> m_timeout{this, "TimeOut", 0,
194  "Abort job after one algorithm or sequence reaches the time out. Timeout given in Nanoseconds "
195  "(official ATLAS units), despite its millisecond resolution"};
196 
197  Gaudi::Property<std::vector<std::string>> m_undeclaredOutputData{this, "ExtraDataForDynamicConsumers", {},
198  "Pass these extra output data IDs, which are not declared by any of the algorithms or tools, to dynamic data consumers."};
199 
200  Gaudi::Property<bool> m_runPostInitialize{this, "ProcessDynamicDataDependencies", false,
201  "Run the post initialization step, to dynamically create and gather extra data dependencies. "
202  "Should be enabled for the top most sequence."};
203 
205 
206  unsigned int m_timeoutMilliseconds{0};
207  const unsigned int m_maxPass{100}; //<! maximum number of iterations to process dynamic data dependencies
208 };
209 
210 #endif //GAUDISEQUENCER_ATHSEQUENCER_H
211 
AthSequencer::append
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: AthSequencer.cxx:247
AthSequencer::~AthSequencer
virtual ~AthSequencer()
Destructor.
Definition: AthSequencer.cxx:47
AthSequencer::AthSequencer
AthSequencer(const std::string &name, ISvcLocator *svcloc)
Constructor(s)
Definition: AthSequencer.cxx:35
getMenu.algname
algname
Definition: getMenu.py:54
AthSequencer::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: AthSequencer.h:204
AthCommonMsg.h
Templated class that provides backwards compatibility for legacy MsgService manipulation methods.
AthSequencer
ClassName: AthSequencer.
Definition: AthSequencer.h:40
AthSequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: AthSequencer.cxx:273
AthSequencer::m_maxPass
const unsigned int m_maxPass
Definition: AthSequencer.h:207
AthSequencer::initialize
virtual StatusCode initialize() override
Initialization of a sequencer.
Definition: AthSequencer.cxx:51
AthSequencer::m_modeOR
Gaudi::Property< bool > m_modeOR
Definition: AthSequencer.h:181
AthSequencer::m_runPostInitialize
Gaudi::Property< bool > m_runPostInitialize
Definition: AthSequencer.h:200
AthSequencer::m_sequential
Gaudi::Property< bool > m_sequential
Definition: AthSequencer.h:190
AthSequencer::m_undeclaredOutputData
Gaudi::Property< std::vector< std::string > > m_undeclaredOutputData
Definition: AthSequencer.h:197
AthCommonDataStore
Definition: AthCommonDataStore.h:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthCommonDataStore.h
Templated class that provides access to Athena event stores and ability to set data dependencies via ...
AthSequencer::m_ignoreFilter
Gaudi::Property< bool > m_ignoreFilter
Definition: AthSequencer.h:184
AthSequencer::resetExecuted
virtual void resetExecuted(const EventContext &ctx) const
Reset the AthSequencer executed state for the current event.
Definition: AthSequencer.cxx:229
AthSequencer::execute
virtual StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
Definition: AthSequencer.cxx:114
AthSequencer::membershipHandler
void membershipHandler(Gaudi::Details::PropertyBase &theProp)
"Members" property handler
Definition: AthSequencer.cxx:280
AthSequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: AthSequencer.cxx:241
AthSequencer::remove
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: AthSequencer.cxx:261
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthSequencer::m_names
Gaudi::Property< std::vector< std::string > > m_names
Definition: AthSequencer.h:178
AthSequencer::start
virtual StatusCode start() override
Start (from INITIALIZED to RUNNING).
Definition: AthSequencer.cxx:197
AthSequencer::executeAlgorithm
StatusCode executeAlgorithm(Gaudi::Algorithm *theAlgorithm, const EventContext &ctx) const
Run one algorithm.
Definition: AthSequencer.cxx:172
AthSequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: AthSequencer.cxx:253
AthSequencer::decodeNames
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > *theAlgs)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: AthSequencer.cxx:326
AthSequencer::m_timeoutMilliseconds
unsigned int m_timeoutMilliseconds
timeout converted to ms
Definition: AthSequencer.h:206
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthSequencer::reinitialize
virtual StatusCode reinitialize() override
AthSequencer Reinitialization.
Definition: AthSequencer.cxx:91
AthSequencer::branchMembershipHandler
void branchMembershipHandler(Gaudi::Details::PropertyBase &theProp)
"BranchMembers" propertry handler
AthSequencer::m_stopOverride
Gaudi::Property< bool > m_stopOverride
Definition: AthSequencer.h:187
AthSequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member naem list.
ServiceHandle< IClassIDSvc >
AthSequencer::m_timeout
Gaudi::Property< double > m_timeout
Definition: AthSequencer.h:193
AthSequencer::stop
virtual StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
Definition: AthSequencer.cxx:213