ATLAS Offline Software
Loading...
Searching...
No Matches
TBAlgoSequencer Class Reference

#include <TBAlgoSequencer.h>

Inheritance diagram for TBAlgoSequencer:
Collaboration diagram for TBAlgoSequencer:

Public Member Functions

 TBAlgoSequencer (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TBAlgoSequencer ()
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
 AthLegacySequenceAdapter (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
const EventContext & getContext () const
virtual const DataObjIDColl & extraOutputDeps () const override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

bool isReEntrant () const override final
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef std::string KeyType
typedef std::vector< Gaudi::Algorithm * > AlgoStore
typedef AlgoStore::iterator AlgoIterator
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< std::string > m_subAlgoNames
AlgoStore m_subAlgos
std::vector< std::string > m_algoNameStore
bool m_timingOn
unsigned int m_eventPrintFreq
unsigned int m_eventCounter
unsigned int m_rejectCounter
unsigned int m_rejectNoEvent
std::map< std::string, unsigned int > m_rejectPattern
std::map< std::string, unsigned int > m_acceptPattern
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 21 of file TBAlgoSequencer.h.

Member Typedef Documentation

◆ AlgoIterator

typedef AlgoStore::iterator TBAlgoSequencer::AlgoIterator
private

Definition at line 26 of file TBAlgoSequencer.h.

◆ AlgoStore

typedef std::vector<Gaudi::Algorithm*> TBAlgoSequencer::AlgoStore
private

Definition at line 25 of file TBAlgoSequencer.h.

◆ KeyType

typedef std::string TBAlgoSequencer::KeyType
private

Definition at line 24 of file TBAlgoSequencer.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TBAlgoSequencer()

TBAlgoSequencer::TBAlgoSequencer ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 17 of file TBAlgoSequencer.cxx.

18 :
19 ::AthLegacySequence ( name, pSvcLocator )
20 , m_timingOn(true)
21 , m_eventPrintFreq(100)
25 {
26 // job options
27 declareProperty("SubAlgorithms", m_subAlgoNames);
28 declareProperty("PrintFrequency", m_eventPrintFreq);
29 declareProperty("TimingOn", m_timingOn);
30}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
unsigned int m_rejectCounter
unsigned int m_rejectNoEvent
unsigned int m_eventPrintFreq
unsigned int m_eventCounter
std::vector< std::string > m_subAlgoNames

◆ ~TBAlgoSequencer()

TBAlgoSequencer::~TBAlgoSequencer ( )
virtual

Definition at line 32 of file TBAlgoSequencer.cxx.

33{ }

Member Function Documentation

◆ AthLegacySequenceAdapter()

Athena::details::AthLegacySequenceAdapter::AthLegacySequenceAdapter ( const std::string & name,
ISvcLocator * pSvcLocator )
inherited

Constructor with parameters:

Definition at line 31 of file AthLegacySequence.cxx.

14 :
16 {
17 StatusCode sc = setProperty("Cardinality", 1);
18 if ( sc.isFailure() ) {
19 throw GaudiException("Failed to set property Cardinality",
20 "AthLegacySequenceAdapter", sc);
21 }
22 m_updateDataHandles =
23 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
25 std::move (m_updateDataHandles));
26 }
static Double_t sc
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
AthCommonDataStore(const std::string &name, T... args)
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ 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.

◆ evtStore()

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.

◆ execute()

StatusCode TBAlgoSequencer::execute ( )
overridevirtual

Implements AthLegacySequence.

Definition at line 110 of file TBAlgoSequencer.cxx.

111{
112 IChronoStatSvc* theTicker = chronoSvc();
113
114 m_timingOn = theTicker != 0 && m_timingOn;
115
117 // Event Statistics //
119
121
123 {
125 ( "Number of events processed: "
126 << std::setw(9)
127 << m_eventCounter );
128 // << ", this event: Run "
129 // << setw(6)
130 // << theEvent->getRunNumber()
131 // << " Event "
132 // << setw(6)
133 // << theEvent->getEventNumber()
134 // << endmsg;
135 }
136
138 // Algorithm Loop //
140
141 AlgoIterator algoCounter = m_subAlgos.begin();
142 StatusCode executeAlgs;
143
144 const EventContext& ctx = getContext();
145
146 unsigned int algoIndex = 0;
147 while ( ! executeAlgs.isFailure() && algoCounter != m_subAlgos.end() )
148 {
149 // execute the algorithm
150 if ( m_timingOn ) theTicker->chronoStart(m_algoNameStore[algoIndex]);
151 executeAlgs = (*algoCounter)->execute(ctx);
152 if ( m_timingOn ) theTicker->chronoStop(m_algoNameStore[algoIndex]);
153 // failure/reject
154 if ( executeAlgs.isFailure() )
155 {
156 m_rejectPattern[m_algoNameStore[algoIndex]]++;
158 }
159 else
160 {
161 m_acceptPattern[m_algoNameStore[algoIndex]]++;
162 }
163 // iterator and counter increments
164 algoIndex++;
165 ++algoCounter;
166 }
167 // this is the trick - catch it before the framework terminates the job!
168 return StatusCode::SUCCESS;
169}
#define ATH_MSG_INFO(x)
const EventContext & getContext() const
std::map< std::string, unsigned int > m_rejectPattern
std::map< std::string, unsigned int > m_acceptPattern
AlgoStore::iterator AlgoIterator
std::vector< std::string > m_algoNameStore

◆ 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

◆ extraOutputDeps()

const DataObjIDColl & Athena::details::AthLegacySequenceAdapter::extraOutputDeps ( ) const
overridevirtualinherited

Definition at line 30 of file AthLegacySequence.cxx.

30 {
31 if (!m_extendedExtraObjects.empty()) {
33 }
34 return Gaudi::Sequence::extraOutputDeps();
35 }

◆ finalize()

StatusCode TBAlgoSequencer::finalize ( )
overridevirtual

Definition at line 176 of file TBAlgoSequencer.cxx.

177{
179 // Summary on Accepts/Rejects //
181
182 double allReject = m_eventCounter > 0
183 ? ((double)m_rejectCounter)/((double)m_eventCounter)*100.
184 : 100.;
185 double noEvtReject = m_eventCounter > 0
186 ? ((double)m_rejectNoEvent)/((double)m_eventCounter)*100.
187 : 100;
188
190 ( "======================================================== " );
192 ( "Total events analyzed .................: "
193 << std::setw(6)
194 << m_eventCounter );
196 ( "Total events rejected .................: "
197 << std::setw(6)
199 << " ("
200 // << fixed()
201 << allReject
202 << " %)" );
204 ( "Events without EventHeader (rejected) .: "
205 << std::setw(6)
207 << " ("
208 // << fixed()
209 << noEvtReject
210 << " %)" );
212 ( "-------------------------------------------------------- " );
214 ( "Reject patterns: " );
216 ( "-------------------------------------------------------- " );
217
218 for (const std::pair<const std::string, unsigned int>& p : m_rejectPattern)
219 {
220 double percentReject = m_eventCounter > 0
221 ? ((double)p.second)/((double)m_eventCounter)*100.
222 : 100;
223 msg() << MSG::INFO
224 << "Algorithm ";
225 msg().width(20);
226 msg() << MSG::INFO
227 << p.first
228 << " rejected "
229 << std::setw(6)
230 << p.second
231 << " events (";
232 msg() << MSG::INFO
233 << std::setprecision(5)
234 << percentReject
235 << " %)"
236 << endmsg;
237 }
239 ( "-------------------------------------------------------- " );
241 ( "Accept patterns: " );
243 ( "-------------------------------------------------------- " );
244 for (const std::pair<const std::string, unsigned int>& p : m_acceptPattern)
245 {
246 double percentAccept = m_eventCounter > 0
247 ? ((double)p.second)/((double)m_eventCounter)*100.
248 : 100;
249 msg() << MSG::INFO
250 << "Algorithm ";
251 msg().width(20);
252 msg() << MSG::INFO
253 << p.first
254 << " accepted "
255 << std::setw(6)
256 << p.second
257 << " events (";
258 msg().setf(std::ios::fixed);
259 msg() << MSG::INFO
260 << std::setprecision(5)
261 << percentAccept
262 << " %)"
263 << endmsg;
264 }
266 ( "======================================================== " );
267
268
269 return AthLegacySequence::finalize();
270
271}
#define endmsg
MsgStream & msg
Definition testRead.cxx:32

◆ getContext()

const EventContext & Athena::details::AthLegacySequenceAdapter::getContext ( ) const
inlineinherited

Definition at line 36 of file AthLegacySequence.h.

36{ return Gaudi::Hive::currentContext(); }

◆ initialize()

StatusCode TBAlgoSequencer::initialize ( )
overridevirtual

Definition at line 40 of file TBAlgoSequencer.cxx.

41{
42 ATH_MSG_INFO ( "initialize..." );
43
45 // Register and Initialize (Sub)Algorithms //
47
48 m_algoNameStore.resize(m_subAlgoNames.size());
49 m_subAlgos.resize(m_subAlgoNames.size());
50
51 std::vector<std::string>::iterator subAlgos = m_subAlgoNames.begin();
52 StatusCode registerAlgs;
53 unsigned int numberOfAlgorithms = 0;
54 unsigned int acceptedAlgos = 0;
55 while ( numberOfAlgorithms < m_subAlgoNames.size() &&
56 ! registerAlgs.isFailure() )
57 {
58 Gaudi::Utils::TypeNameString theAlgItem(*subAlgos);
59 Gaudi::Algorithm* theAlgo;
60 registerAlgs = createSubAlgorithm(theAlgItem.type(),theAlgItem.name(),
61 theAlgo);
62 if ( ! registerAlgs.isFailure() && theAlgo != 0 )
63 {
64 // store sub-algo
65 m_subAlgos[acceptedAlgos] = theAlgo;
66 m_algoNameStore[acceptedAlgos] = theAlgItem.name();
68 ( "Subalgorithm ("
69 << std::setw(2)
70 << acceptedAlgos
71 << ") ... created type/name ... "
72 << theAlgItem.type()
73 << "/"
74 << theAlgItem.name() );
75 // set common properties
76 // theAlgo->
77 // setProperty(StringProperty("EventHeaderKey",m_eventHeaderKey));
78 // theAlgo->initialize();
79 // register algorithm with accumulators
80 m_rejectPattern[m_algoNameStore[acceptedAlgos]] = 0;
81 m_acceptPattern[m_algoNameStore[acceptedAlgos]] = 0;
82 // increment accepted algo counter
83 acceptedAlgos++;
84 }
85 numberOfAlgorithms++;
86 ++subAlgos;
87 }
88
90 // Prepare Statistics //
92
93 m_rejectPattern.clear();
94
95 // return numberOfAlgorithms > 0
96 // ? StatusCode::SUCCESS
97 // : StatusCode::FAILURE;
98
99 if (numberOfAlgorithms == 0) return StatusCode::FAILURE;
100
101 return AthLegacySequence::initialize();
102
103}

◆ 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.

◆ isReEntrant()

bool Athena::details::AthLegacySequenceAdapter::isReEntrant ( ) const
inlinefinaloverrideprotectedinherited

Definition at line 41 of file AthLegacySequence.h.

41{ return false; }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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.

◆ 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();
384 }
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)

◆ 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 {
366 }

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_acceptPattern

std::map<std::string,unsigned int> TBAlgoSequencer::m_acceptPattern
private

Definition at line 57 of file TBAlgoSequencer.h.

◆ m_algoNameStore

std::vector<std::string> TBAlgoSequencer::m_algoNameStore
private

Definition at line 45 of file TBAlgoSequencer.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_eventCounter

unsigned int TBAlgoSequencer::m_eventCounter
private

Definition at line 53 of file TBAlgoSequencer.h.

◆ m_eventPrintFreq

unsigned int TBAlgoSequencer::m_eventPrintFreq
private

Definition at line 52 of file TBAlgoSequencer.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_extendedExtraObjects

DataObjIDColl Athena::details::AthLegacySequenceAdapter::m_extendedExtraObjects
privateinherited

Definition at line 51 of file AthLegacySequence.h.

◆ m_rejectCounter

unsigned int TBAlgoSequencer::m_rejectCounter
private

Definition at line 54 of file TBAlgoSequencer.h.

◆ m_rejectNoEvent

unsigned int TBAlgoSequencer::m_rejectNoEvent
private

Definition at line 55 of file TBAlgoSequencer.h.

◆ m_rejectPattern

std::map<std::string,unsigned int> TBAlgoSequencer::m_rejectPattern
private

Definition at line 56 of file TBAlgoSequencer.h.

◆ m_subAlgoNames

std::vector<std::string> TBAlgoSequencer::m_subAlgoNames
private

Definition at line 43 of file TBAlgoSequencer.h.

◆ m_subAlgos

AlgoStore TBAlgoSequencer::m_subAlgos
private

Definition at line 44 of file TBAlgoSequencer.h.

◆ m_timingOn

bool TBAlgoSequencer::m_timingOn
private

Definition at line 46 of file TBAlgoSequencer.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: