ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AthSequencer Class Reference

ClassName: AthSequencer. More...

#include <AthSequencer.h>

Inheritance diagram for AthSequencer:
Collaboration diagram for AthSequencer:

Public Member Functions

 AthSequencer (const std::string &name, ISvcLocator *svcloc)
 Constructor(s) More...
 
virtual ~AthSequencer ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Initialization of a sequencer. More...
 
virtual StatusCode reinitialize () override
 AthSequencer Reinitialization. More...
 
virtual StatusCode execute (const EventContext &ctx) const override
 The actions to be performed by the sequencer on an event. More...
 
virtual StatusCode start () override
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop () override
 Stop (from RUNNING to INITIALIZED). More...
 
virtual void resetExecuted (const EventContext &ctx) const
 Reset the AthSequencer executed state for the current event. More...
 
virtual bool isStopOverride () const
 Has the StopOverride mode been set? More...
 
StatusCode append (Gaudi::Algorithm *pAlgorithm)
 Append an algorithm to the sequencer. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode remove (Gaudi::Algorithm *pAlgorithm)
 Remove the specified algorithm from the sequencer. More...
 
StatusCode remove (const std::string &name)
 
StatusCode decodeMemberNames ()
 Decode Member Name list. More...
 
void membershipHandler (Gaudi::Details::PropertyBase &theProp)
 "Members" property handler More...
 
StatusCode decodeBranchMemberNames ()
 Decode branch member naem list. More...
 
void branchMembershipHandler (Gaudi::Details::PropertyBase &theProp)
 "BranchMembers" propertry handler More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

StatusCode append (Gaudi::Algorithm *pAlgorithm, std::vector< Gaudi::Algorithm * > *theAlgs)
 Append an algorithm to the sequencer. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm, std::vector< Gaudi::Algorithm * > *theAlgs)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode decodeNames (Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > *theAlgs)
 Decode algorithm names, creating or appending algorithms as appropriate. More...
 
StatusCode remove (const std::string &algname, std::vector< Gaudi::Algorithm * > *theAlgs)
 Remove the specified algorithm from the sequencer. More...
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode executeAlgorithm (Gaudi::Algorithm *theAlgorithm, const EventContext &ctx) const
 Run one algorithm. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_names
 
Gaudi::Property< bool > m_modeOR
 
Gaudi::Property< bool > m_ignoreFilter
 
Gaudi::Property< bool > m_stopOverride
 
Gaudi::Property< bool > m_sequential
 
Gaudi::Property< double > m_timeout
 
Gaudi::Property< std::vector< std::string > > m_undeclaredOutputData
 
Gaudi::Property< bool > m_runPostInitialize
 
ServiceHandle< IClassIDSvc > m_clidSvc
 
unsigned int m_timeoutMilliseconds {0}
 timeout converted to ms More...
 
const unsigned int m_maxPass {100}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

ClassName: AthSequencer.

Description: An AthSequencer is essentially a list of Algorithms and is responsible for their management. Note that Sequences may themselves contain other Sequences. The default execute( ) implementation loops over the members of the sequence, calling their execute( ) methods. However, this can be modified if a member is disabled, has already been executed, or a member indicates that it's filter fails. The the former two cases the execution of the member is bypassed. In the latter case, the loop is terminated and the AthSequencer assumes the same filtered state as the last member.

Definition at line 38 of file AthSequencer.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AthSequencer()

AthSequencer::AthSequencer ( const std::string &  name,
ISvcLocator *  svcloc 
)

Constructor(s)

Definition at line 35 of file AthSequencer.cxx.

36  :
38  m_clidSvc("ClassIDSvc/ClassIDSvc", name),
40 {
41  m_names.declareUpdateHandler( &AthSequencer::membershipHandler, this );
42 }

◆ ~AthSequencer()

AthSequencer::~AthSequencer ( )
virtual

Destructor.

Definition at line 47 of file AthSequencer.cxx.

48 {}

Member Function Documentation

◆ append() [1/2]

StatusCode AthSequencer::append ( Gaudi::Algorithm *  pAlgorithm)

Append an algorithm to the sequencer.

Definition at line 247 of file AthSequencer.cxx.

248 {
249  return append( pAlgorithm, subAlgorithms( ) );
250 }

◆ append() [2/2]

StatusCode AthSequencer::append ( Gaudi::Algorithm *  pAlgorithm,
std::vector< Gaudi::Algorithm * > *  theAlgs 
)
protected

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 290 of file AthSequencer.cxx.

292 {
293  bool all_good = true;
294  // Check that the specified algorithm doesn't already exist
295  // in the membership list
296  for (Gaudi::Algorithm* theAlgorithm : *theAlgs) {
297  if ( theAlgorithm == pAlgorithm ) {
298  all_good = false;
299  break;
300  }
301  }
302  if ( all_good ) {
303  theAlgs->push_back( pAlgorithm );
304  pAlgorithm->addRef();
305  }
306  return all_good ? StatusCode::SUCCESS : StatusCode::FAILURE;
307 }

◆ branchMembershipHandler()

void AthSequencer::branchMembershipHandler ( Gaudi::Details::PropertyBase &  theProp)

"BranchMembers" propertry handler

◆ createAndAppend() [1/2]

StatusCode AthSequencer::createAndAppend ( const std::string &  type,
const std::string &  name,
Gaudi::Algorithm *&  pAlgorithm 
)

Create a algorithm and append it to the sequencer.

A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the algorithm's properties. Using this mechanism instead of creating algorithms directly via the new operator is preferred since then the framework may take care of all of the necessary book-keeping.

Definition at line 253 of file AthSequencer.cxx.

256 {
257  return createAndAppend( type, name, pAlgorithm, subAlgorithms( ) );
258 }

◆ createAndAppend() [2/2]

StatusCode AthSequencer::createAndAppend ( const std::string &  type,
const std::string &  name,
Gaudi::Algorithm *&  pAlgorithm,
std::vector< Gaudi::Algorithm * > *  theAlgs 
)
protected

Create a algorithm and append it to the sequencer.

A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the algorithm's properties. Using this mechanism instead of creating algorithms directly via the new operator is preferred since then the framework may take care of all of the necessary book-keeping.

Definition at line 310 of file AthSequencer.cxx.

314 {
315  SmartIF<IAlgManager> theAlgMgr(Gaudi::svcLocator()->as<IAlgManager>());
316  IAlgorithm* tmp = nullptr;
317 
318  ATH_CHECK( theAlgMgr->createAlgorithm( type, algName, tmp ) );
319  pAlgorithm = dynamic_cast<Gaudi::Algorithm*>(tmp);
320  theAlgs->push_back( pAlgorithm );
321 
322  return StatusCode::SUCCESS;
323 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ decodeBranchMemberNames()

StatusCode AthSequencer::decodeBranchMemberNames ( )

Decode branch member naem list.

◆ decodeMemberNames()

StatusCode AthSequencer::decodeMemberNames ( )

Decode Member Name list.

Definition at line 273 of file AthSequencer.cxx.

274 {
275  // Decode the membership list
276  return decodeNames( m_names, subAlgorithms() );
277 }

◆ decodeNames()

StatusCode AthSequencer::decodeNames ( Gaudi::Property< std::vector< std::string >> &  theNames,
std::vector< Gaudi::Algorithm * > *  theAlgs 
)
protected

Decode algorithm names, creating or appending algorithms as appropriate.

Definition at line 326 of file AthSequencer.cxx.

328 {
329  SmartIF<IAlgManager> theAlgMgr(Gaudi::svcLocator()->as<IAlgManager>());
330 
331  // Clear the existing list of algorithms
332  theAlgs->clear( );
333 
334  // Build the list of member algorithms from the contents of the
335  // theNames list.
336  StatusCode result = StatusCode::SUCCESS;
337  for (const std::string& name : theNames.value()) {
338 
339  // Parse the name for a syntax of the form <type>/<name>
340  Gaudi::Utils::TypeNameString tn(name);
341 
342  // Check whether the supplied name corresponds to an existing
343  // Algorithm object.
344  SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm(tn.name(), /*createIf*/false);
345  Gaudi::Algorithm* theAlgorithm = nullptr;
346  if ( theIAlg ) {
347  theAlgorithm = dynamic_cast<Gaudi::Algorithm*>(theIAlg.get());
348  if ( theAlgorithm ) {
349  // The specified Algorithm already exists -
350  // just append it to the membership list.
351  if ( append(theAlgorithm, theAlgs).isSuccess( ) ) {
352  ATH_MSG_DEBUG (tn.name() << " already exists - appended to member list");
353  } else {
354  ATH_MSG_WARNING (tn.name() << " already exists - append failed!!!");
355  result = StatusCode::FAILURE;
356  }
357  }
358  else {
359  ATH_MSG_WARNING (tn.name() << " is not an Algorithm - Failed dynamic cast");
360  result = StatusCode::FAILURE;
361  }
362  } else {
363  // The specified name doesn't exist -
364  // create a new object of the specified type and append it to
365  // the membership list.
366  if ( createAndAppend(tn.type(), tn.name(), theAlgorithm, theAlgs).isSuccess( ) ) {
367  ATH_MSG_DEBUG (tn.name() << " doesn't exist - created and appended to member list");
368  } else {
369  ATH_MSG_WARNING (tn.name() << " doesn't exist - creation failed!!!");
370  result = StatusCode::FAILURE;
371  }
372  }
373  } //> loop over names
374 
375  // Print membership list
376  if (msgLvl(MSG::DEBUG)) {
377  if ( result.isSuccess() && !theAlgs->empty() ) {
378 
379  msg(MSG::DEBUG) << "Member list: ";
380  bool first = true;
381  for (Gaudi::Algorithm* alg : *theAlgs) {
382  if (first)
383  first = false;
384  else
385  msg() << ", ";
386  if ( alg->name() == System::typeinfoName(typeid(*alg)))
387  msg() << alg->name();
388  else
389  msg() << System::typeinfoName(typeid(*alg)) << "/" << alg->name();
390  }
391  msg(MSG::DEBUG) << endmsg;
392  }
393  }
394  return result;
395 }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode AthSequencer::execute ( const EventContext &  ctx) const
overridevirtual

The actions to be performed by the sequencer on an event.

This method is invoked once per event.

Definition at line 114 of file AthSequencer.cxx.

115 {
116  StatusCode sc = StatusCode::SUCCESS;
117  bool seqPass = !m_modeOR;
118 
119  ATH_MSG_DEBUG ("Executing " << name() << "...");
120 
121  auto& state = execState( ctx );
122 
123  // Bypass the loop if this sequencer is disabled or has already been executed
124  if ( isEnabled( ) && state.state() != AlgExecState::State::Done ) {
125 
126  // Prevent multiple executions of this sequencer for the current event
127  state.setState( AlgExecState::State::Executing );
128 
129  // Loop over all algorithms calling their execute functions if they
130  // are (a) not disabled, and (b) aren't already executed. Note that
131  // in the latter case the filter state is still examined. Terminate
132  // the loop if an algorithm indicates that it's filter didn't pass.
133  const std::vector<Gaudi::Algorithm*>* subAlgms = subAlgorithms( );
134  for (auto theAlgorithm : *subAlgms) {
135  if ( theAlgorithm->isEnabled( ) ) {
136  if ( theAlgorithm->execState(ctx).state() == AlgExecState::State::None ) {
137  sc = executeAlgorithm (theAlgorithm, ctx);
138  }
139 
140  if ( sc.isSuccess() ) {
141 
142  if ( !m_ignoreFilter ) {
143  // Take the filter passed status of this algorithm as my own status
144  const bool passed = theAlgorithm->execState( ctx ).filterPassed();
145  state.setFilterPassed( passed );
146 
147  // The behaviour when the filter fails depends on the
148  // StopOverride property.
149  // The default action is to stop processing, but this default can be
150  // overridden by setting the "StopOverride" property to false.
151  if ( m_modeOR ? passed : !passed ) {
152  seqPass = passed;
153  if ( !m_stopOverride ) break;
154  }
155  }
156  } else {
157  ATH_MSG_INFO ("execute of [" << theAlgorithm->name() << "] did NOT succeed");
158  break;
159  }
160  }
161  }
162  }
163 
164  if ( !m_ignoreFilter && !m_names.empty() ) state.setFilterPassed( seqPass );
165 
166  state.setState( AlgExecState::State::Done );
167 
168  return sc;
169 }

◆ executeAlgorithm()

StatusCode AthSequencer::executeAlgorithm ( Gaudi::Algorithm *  theAlgorithm,
const EventContext &  ctx 
) const
private

Run one algorithm.

Definition at line 172 of file AthSequencer.cxx.

174 {
175  // Start timer if enabled
176  if (m_timeoutMilliseconds>0) {
177  // Create thread-specific timer if not done already
178  if (!s_abortTimer) {
179  s_abortTimer = std::make_unique<Athena::AlgorithmTimer>(0);
180  }
182  }
183 
184  // Call the sysExecute() of the method the algorithm
185  StatusCode sc = theAlgorithm->sysExecute( ctx );
186 
187  // Stop timer if enabled
188  if (m_timeoutMilliseconds>0) {
189  const unsigned int remaining = s_abortTimer->stop();
190  ATH_MSG_DEBUG ("Time left before interrupting <"
191  << theAlgorithm->name() << "> : " << remaining);
192  }
193  return sc;
194 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode AthSequencer::initialize ( )
overridevirtual

Initialization of a sequencer.

Typically things like histogram creation, setting up of data structures etc, should be done here. If a sequence has properties specified in the job options file, they will be set to the requested values BEFORE the initialize() method is invoked.

Definition at line 51 of file AthSequencer.cxx.

52 {
53  m_timeoutMilliseconds = static_cast<int>(m_timeout * 1e-6);
54 
55  if ( RUNNING_ON_VALGRIND ) {
56  ATH_MSG_WARNING ("### detected running inside Valgrind, disabling algorithm timeout ###");
58  }
59 
60  if (!decodeMemberNames().isSuccess()) {
61  ATH_MSG_ERROR ("Unable to configure one or more sequencer members ");
62  return StatusCode::FAILURE;
63  }
64 
65  Ath::DynamicDataHelper dynamic_data_helper;
66  StatusCode sc(StatusCode::SUCCESS);
67  // Loop over all sub-algorithms
68  for (Gaudi::Algorithm* theAlgorithm : *subAlgorithms()) {
69  if (!theAlgorithm->sysInitialize( ).isSuccess()) {
70  ATH_MSG_ERROR ("Unable to initialize Algorithm "
71  << theAlgorithm->type() << "/" << theAlgorithm->name());
72  sc= StatusCode::FAILURE;
73  }
74  else if (m_runPostInitialize) {
75  // visit all algorithms and its tools to gather their input, output handles and dynamic data consumers
76  dynamic_data_helper.gatherDataHandlesAndDynamicConsumers(this->name(),theAlgorithm);
77  }
78  }
79  if (sc.isSuccess() && m_runPostInitialize) {
80  ATH_MSG_DEBUG("Allow dynamic data consumers to update their data dependencies.");
81  if (!m_undeclaredOutputData.empty()) {
82  ATH_CHECK( m_clidSvc.retrieve() );
83  ATH_CHECK( dynamic_data_helper.addExtraDependencies(*m_clidSvc, m_undeclaredOutputData.value(), msg() ) );
84  }
85  dynamic_data_helper.updateDataNeeds(m_maxPass, msg());
86  }
87  return sc;
88 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isStopOverride()

bool AthSequencer::isStopOverride ( ) const
virtual

Has the StopOverride mode been set?

Definition at line 241 of file AthSequencer.cxx.

242 {
243  return m_stopOverride.value( );
244 }

◆ membershipHandler()

void AthSequencer::membershipHandler ( Gaudi::Details::PropertyBase &  theProp)

"Members" property handler

Definition at line 280 of file AthSequencer.cxx.

281 {
282  if ( isInitialized() ) decodeMemberNames().ignore();
283 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Gaudi::Sequence >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Sequence >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Sequence >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ reinitialize()

StatusCode AthSequencer::reinitialize ( )
overridevirtual

AthSequencer Reinitialization.

Definition at line 91 of file AthSequencer.cxx.

92 {
93  StatusCode sc(StatusCode::SUCCESS);
94  // Bypass the loop if this sequencer is disabled
95  if ( isEnabled( ) ) {
96 
97  // Loop over all members calling their reinitialize functions
98  // if they are not disabled.
99  for (Gaudi::Algorithm* theAlgorithm : *subAlgorithms()) {
100  if ( theAlgorithm->isEnabled( ) ) {
101  if (theAlgorithm->sysReinitialize( ).isFailure()) {
102  ATH_MSG_ERROR ("Unable to reinitialize Algorithm "
103  << theAlgorithm->type () << "/"
104  << theAlgorithm->name());
105  sc = StatusCode::FAILURE;
106  }
107  }
108  }
109  }
110  return sc;
111 }

◆ remove() [1/3]

StatusCode AthSequencer::remove ( const std::string &  algname,
std::vector< Gaudi::Algorithm * > *  theAlgs 
)
protected

Remove the specified algorithm from the sequencer.

Definition at line 398 of file AthSequencer.cxx.

400 {
401  ATH_MSG_ERROR ("AthSequencer::remove( ) is not supported");
402  return StatusCode::FAILURE;
403 }

◆ remove() [2/3]

StatusCode AthSequencer::remove ( const std::string &  name)

Definition at line 267 of file AthSequencer.cxx.

268 {
269  return remove( algname, subAlgorithms( ) );
270 }

◆ remove() [3/3]

StatusCode AthSequencer::remove ( Gaudi::Algorithm *  pAlgorithm)

Remove the specified algorithm from the sequencer.

Definition at line 261 of file AthSequencer.cxx.

262 {
263  return remove (pAlgorithm->name());
264 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ resetExecuted()

void AthSequencer::resetExecuted ( const EventContext &  ctx) const
virtual

Reset the AthSequencer executed state for the current event.

Definition at line 229 of file AthSequencer.cxx.

230 {
231  execState(ctx).reset();
232 
233  // Loop over all members calling their resetExecuted functions
234  // if they are not disabled.
235  for (Gaudi::Algorithm* theAlgorithm : *subAlgorithms()) {
236  theAlgorithm->execState(ctx).reset();
237  }
238 }

◆ start()

StatusCode AthSequencer::start ( )
overridevirtual

Start (from INITIALIZED to RUNNING).

IStateful::start

Definition at line 197 of file AthSequencer.cxx.

198 {
199  StatusCode sc(StatusCode::SUCCESS);
200  // Loop over all sub-algorithms
201  for (Gaudi::Algorithm* theAlgorithm : *subAlgorithms()) {
202  if (!theAlgorithm->sysStart( ).isSuccess()) {
203  ATH_MSG_ERROR ("Unable to start Algorithm "
204  << theAlgorithm->type () << "/"
205  << theAlgorithm->name());
206  sc = StatusCode::FAILURE;
207  }
208  }
209  return sc;
210 }

◆ stop()

StatusCode AthSequencer::stop ( )
overridevirtual

Stop (from RUNNING to INITIALIZED).

Definition at line 213 of file AthSequencer.cxx.

214 {
215  StatusCode sc(StatusCode::SUCCESS);
216  // Loop over all sub-algorithms if they are not disabled.
217  for (Gaudi::Algorithm* theAlgorithm : *subAlgorithms()) {
218  if (theAlgorithm->sysStop( ).isFailure()) {
219  ATH_MSG_ERROR ("Unable to stop Algorithm "
220  << theAlgorithm->type () << "/"
221  << theAlgorithm->name());
222  sc = StatusCode::FAILURE;
223  }
224  }
225  return sc;
226 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_clidSvc

ServiceHandle<IClassIDSvc> AthSequencer::m_clidSvc
private

Definition at line 204 of file AthSequencer.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_ignoreFilter

Gaudi::Property<bool> AthSequencer::m_ignoreFilter
private
Initial value:
{this, "IgnoreFilterPassed", false,
"Always continue sequence ignoring filterPassed of member algorithms"}

Definition at line 184 of file AthSequencer.h.

◆ m_maxPass

const unsigned int AthSequencer::m_maxPass {100}
private

Definition at line 207 of file AthSequencer.h.

◆ m_modeOR

Gaudi::Property<bool> AthSequencer::m_modeOR
private
Initial value:
{this, "ModeOR", false,
"Use OR logic instead of AND"}

Definition at line 181 of file AthSequencer.h.

◆ m_names

Gaudi::Property<std::vector<std::string> > AthSequencer::m_names
private
Initial value:
{this, "Members",{},
"Algorithm names (of the form '<cppType>/<instanceName>')","SubAlgorithm"}

Definition at line 178 of file AthSequencer.h.

◆ m_runPostInitialize

Gaudi::Property<bool> AthSequencer::m_runPostInitialize
private
Initial value:
{this, "ProcessDynamicDataDependencies", false,
"Run the post initialization step, to dynamically create and gather extra data dependencies. "
"Should be enabled for the top most sequence."}

Definition at line 200 of file AthSequencer.h.

◆ m_sequential

Gaudi::Property<bool> AthSequencer::m_sequential
private
Initial value:
{this, "Sequential", false,
"Concurrent or (strict) Sequential ordering of algorithms"}

Definition at line 190 of file AthSequencer.h.

◆ m_stopOverride

Gaudi::Property<bool> AthSequencer::m_stopOverride
private
Initial value:
{this, "StopOverride", false,
"Continue even if algorithm filter fails"}

Definition at line 187 of file AthSequencer.h.

◆ m_timeout

Gaudi::Property<double> AthSequencer::m_timeout
private
Initial value:
{this, "TimeOut", 0,
"Abort job after one algorithm or sequence reaches the time out. Timeout given in Nanoseconds "
"(official ATLAS units), despite its millisecond resolution"}

Definition at line 193 of file AthSequencer.h.

◆ m_timeoutMilliseconds

unsigned int AthSequencer::m_timeoutMilliseconds {0}
private

timeout converted to ms

Definition at line 206 of file AthSequencer.h.

◆ m_undeclaredOutputData

Gaudi::Property<std::vector<std::string> > AthSequencer::m_undeclaredOutputData
private
Initial value:
{this, "ExtraDataForDynamicConsumers", {},
"Pass these extra output data IDs, which are not declared by any of the algorithms or tools, to dynamic data consumers."}

Definition at line 197 of file AthSequencer.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AthSequencer::append
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: AthSequencer.cxx:247
getMenu.algname
algname
Definition: getMenu.py:54
AthSequencer::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: AthSequencer.h:204
SGout2dot.alg
alg
Definition: SGout2dot.py:243
get_generator_info.result
result
Definition: get_generator_info.py:21
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Ath::DynamicDataHelper
Helper class to gather all declared data IDs and propagate them to components which declare data depe...
Definition: DynamicDataHelper.h:25
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthSequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: AthSequencer.cxx:273
xAOD::JetAlgorithmType::algName
const std::string & algName(ID id)
Converts a JetAlgorithmType::ID into a string.
Definition: JetContainerInfo.cxx:67
AthCommonDataStore::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< Gaudi::Sequence >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthSequencer::m_maxPass
const unsigned int m_maxPass
Definition: AthSequencer.h:207
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
AthSequencer::m_modeOR
Gaudi::Property< bool > m_modeOR
Definition: AthSequencer.h:181
AthSequencer::m_runPostInitialize
Gaudi::Property< bool > m_runPostInitialize
Definition: AthSequencer.h:200
CaloCellPos2Ntuple.None
None
Definition: CaloCellPos2Ntuple.py:23
AthSequencer::m_undeclaredOutputData
Gaudi::Property< std::vector< std::string > > m_undeclaredOutputData
Definition: AthSequencer.h:197
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Athena::typeinfoName
std::string typeinfoName(const std::type_info &ti)
Convert a type_info to a demangled string.
Definition: AthenaKernel/src/ClassName.cxx:23
s_abortTimer
thread_local std::unique_ptr< Athena::AlgorithmTimer > s_abortTimer
timer will abort job once timeout for any algorithm or sequence is reached
Definition: AthSequencer.cxx:29
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthSequencer::m_ignoreFilter
Gaudi::Property< bool > m_ignoreFilter
Definition: AthSequencer.h:184
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Sequence > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
AthSequencer::membershipHandler
void membershipHandler(Gaudi::Details::PropertyBase &theProp)
"Members" property handler
Definition: AthSequencer.cxx:280
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
Ath::DynamicDataHelper::gatherDataHandlesAndDynamicConsumers
void gatherDataHandlesAndDynamicConsumers(const std::string &parent_name, Gaudi::Algorithm *theAlgorithm)
Gather the input and output data declared by the given algorithm, its child algorithms and their tool...
Definition: DynamicDataHelper.cxx:65
AthSequencer::remove
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: AthSequencer.cxx:261
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthSequencer::m_names
Gaudi::Property< std::vector< std::string > > m_names
Definition: AthSequencer.h:178
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
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
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
DeMoScan.first
bool first
Definition: DeMoScan.py:536
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< Gaudi::Sequence >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Ath::DynamicDataHelper::updateDataNeeds
void updateDataNeeds(unsigned int max_pass, MsgStream &out)
Update the data dependencies of all components which dynamically declare tehm.
Definition: DynamicDataHelper.cxx:100
AthSequencer::m_stopOverride
Gaudi::Property< bool > m_stopOverride
Definition: AthSequencer.h:187
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Ath::DynamicDataHelper::addExtraDependencies
StatusCode addExtraDependencies(IClassIDSvc &clid_svc, std::vector< std::string > &undeclared_output_data, MsgStream &out)
Add extra output data which is not declared by any of the gathered components.
Definition: DynamicDataHelper.cxx:26
fitman.k
k
Definition: fitman.py:528
AthSequencer::m_timeout
Gaudi::Property< double > m_timeout
Definition: AthSequencer.h:193