ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::MeasurementMarkerAlg Class Reference

Algorithm that marks the uncalibrated measurements making up a segment, where the segment passes an arbitrary selection requirement. More...

#include <MeasurementMarkerAlg.h>

Inheritance diagram for MuonR4::MeasurementMarkerAlg:
Collaboration diagram for MuonR4::MeasurementMarkerAlg:

Public Member Functions

 ~MeasurementMarkerAlg ()=default
virtual StatusCode initialize () override final
virtual StatusCode execute (const EventContext &ctx) const override final
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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 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

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

SG::ReadHandleKey< xAOD::MuonSegmentContainerm_segKey {this, "SegmentKey", "MuonSegments" }
 Key to the primary muon container to select the muon from.
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainerm_readMarkKey {this, "SelectSegments", m_segKey, ""}
 Key to the decoration to fetch the marked muons.
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainerm_prdLinkKey {this, "PrdAssocKey", m_segKey, "prdLinks"}
 Key to the prd association decoration.
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainerm_measKeys {this, "PrdContainer",{}}
 Key to the segment container to fetch the marked segments.
SG::WriteDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainerm_writeMarkKeys {this, "OutMarkerKeys", {}}
 Key to the decoration.
Gaudi::Property< std::string > m_segLink {this, "SegmentLinkKey", ""}
SG::WriteDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainerm_writeSegLinkKeys {this, "SegLinkKeys", {}}
 Key to the decoration.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Algorithm that marks the uncalibrated measurements making up a segment, where the segment passes an arbitrary selection requirement.

The requirement needs to be decorated by an algorithm upstream with a <bool> decorator. The same decoration is then copied to the measurements. If "SegmentLinkKey" is not empty, the algorithm additionally decorates a link to the segment.

Definition at line 23 of file MeasurementMarkerAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~MeasurementMarkerAlg()

MuonR4::MeasurementMarkerAlg::~MeasurementMarkerAlg ( )
default

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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::Algorithm > >::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::Algorithm > >::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 MuonR4::MeasurementMarkerAlg::execute ( const EventContext & ctx) const
finaloverridevirtual

Ensure that the decoration is actually written

Definition at line 46 of file MeasurementMarkerAlg.cxx.

46 {
47 const xAOD::MuonSegmentContainer* segments{nullptr};
48 ATH_CHECK(SG::get(segments, m_segKey, ctx));
49 SG::ReadDecorHandle<xAOD::MuonSegmentContainer, PrdLinkVec_t> prdLinks{m_prdLinkKey, ctx};
50 SG::ReadDecorHandle<xAOD::MuonSegmentContainer, bool> readDecor{m_readMarkKey, ctx};
52
53 std::unordered_map<const SG::AuxVectorData*, MarkerHandle_t> writeDecorMap{};
54 std::unordered_map<const SG::AuxVectorData*, LinkHandle_t> linkDecorMap{};
55 for (const WriteDecorKey_t& decorKey : m_writeMarkKeys) {
56 const xAOD::UncalibratedMeasurementContainer* measCont{nullptr};
57 ATH_CHECK(SG::get(measCont, decorKey.contHandleKey(), ctx));
58 writeDecorMap.emplace(std::make_pair(measCont, makeHandle(ctx, decorKey, false)));
59 }
60
61 for (const WriteDecorKey_t& key : m_writeSegLinkKeys) {
62 const xAOD::UncalibratedMeasurementContainer* measCont{nullptr};
63 ATH_CHECK(SG::get(measCont, key.contHandleKey(), ctx));
64 linkDecorMap.emplace(std::make_pair(measCont, makeHandle(ctx, key, SegLinkVec_t{})));
65 }
66
67 for (const xAOD::MuonSegment* seg : *segments) {
68 if (!readDecor(*seg)){
69 continue;
70 }
71 SegLink_t segLink{segments, seg->index()};
72 for (const PrdLink_t& link : prdLinks(*seg)) {
73 const auto* prd = (*link);
74 writeDecorMap.at(prd->container())(*prd) = readDecor(*seg);
75 if (m_segLink.value().empty()) {
76 continue;
77 }
78 linkDecorMap.at(prd->container())(*prd).push_back(segLink);
79 }
80 }
81 return StatusCode::SUCCESS;
82 }
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::WriteDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_writeMarkKeys
Key to the decoration.
Gaudi::Property< std::string > m_segLink
SG::WriteDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_writeSegLinkKeys
Key to the decoration.
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_readMarkKey
Key to the decoration to fetch the marked muons.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segKey
Key to the primary muon container to select the muon from.
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_prdLinkKey
Key to the prd association decoration.
SG::WriteDecorHandle< ContType, dType > makeHandle(const EventContext &ctx, const SG::WriteDecorHandleKey< ContType > &key, const dType &defValue=dType{})
ElementLink< MuonR4::SegmentContainer > SegLink_t
Abrivation of the link to the reco segment container.
SG::WriteDecorHandleKey< xAOD::UncalibratedMeasurementContainer > WriteDecorKey_t
std::vector< SegLink_t > SegLinkVec_t
ElementLink< PrdCont_t > PrdLink_t
Abrivation to call the link to an element inside an uncalibrated measurement container.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.
MuonSegment_v1 MuonSegment
Reference the current persistent version:

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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 & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode MuonR4::MeasurementMarkerAlg::initialize ( )
finaloverridevirtual

Definition at line 26 of file MeasurementMarkerAlg.cxx.

26 {
27 ATH_CHECK(m_segKey.initialize());
28 ATH_CHECK(m_readMarkKey.initialize());
29 ATH_CHECK(m_prdLinkKey.initialize());
30 ATH_CHECK(m_measKeys.initialize());
31 if (m_measKeys.empty()) {
32 ATH_MSG_FATAL("Please configure the measurement containers to decorate.");
33 return StatusCode::FAILURE;
34 }
35 const std::string decor = SG::decorKeyFromKey(m_readMarkKey.key());
36 for (const auto& key : m_measKeys) {
37 m_writeMarkKeys.emplace_back(key, decor);
38 if (m_segLink.value().size()) {
39 m_writeSegLinkKeys.emplace_back(key, m_segLink);
40 }
41 }
42 ATH_CHECK(m_writeMarkKeys.initialize());
43 ATH_CHECK(m_writeSegLinkKeys.initialize());
44 return StatusCode::SUCCESS;
45 }
#define ATH_MSG_FATAL(x)
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_measKeys
Key to the segment container to fetch the marked segments.
std::string decorKeyFromKey(const std::string &key, const std::string &deflt)
Extract the decoration part of key.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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.

◆ isClonable()

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::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::Algorithm > >::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::Algorithm > >::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::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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::Algorithm > >::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_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_measKeys

SG::ReadHandleKeyArray<xAOD::UncalibratedMeasurementContainer> MuonR4::MeasurementMarkerAlg::m_measKeys {this, "PrdContainer",{}}
private

Key to the segment container to fetch the marked segments.

Definition at line 38 of file MeasurementMarkerAlg.h.

38{this, "PrdContainer",{}};

◆ m_prdLinkKey

SG::ReadDecorHandleKey<xAOD::MuonSegmentContainer> MuonR4::MeasurementMarkerAlg::m_prdLinkKey {this, "PrdAssocKey", m_segKey, "prdLinks"}
private

Key to the prd association decoration.

Definition at line 36 of file MeasurementMarkerAlg.h.

36{this, "PrdAssocKey", m_segKey, "prdLinks"};

◆ m_readMarkKey

SG::ReadDecorHandleKey<xAOD::MuonSegmentContainer> MuonR4::MeasurementMarkerAlg::m_readMarkKey {this, "SelectSegments", m_segKey, ""}
private

Key to the decoration to fetch the marked muons.

Definition at line 34 of file MeasurementMarkerAlg.h.

34{this, "SelectSegments", m_segKey, ""};

◆ m_segKey

SG::ReadHandleKey<xAOD::MuonSegmentContainer> MuonR4::MeasurementMarkerAlg::m_segKey {this, "SegmentKey", "MuonSegments" }
private

Key to the primary muon container to select the muon from.

Definition at line 32 of file MeasurementMarkerAlg.h.

32{this, "SegmentKey", "MuonSegments" };

◆ m_segLink

Gaudi::Property<std::string> MuonR4::MeasurementMarkerAlg::m_segLink {this, "SegmentLinkKey", ""}
private

Definition at line 42 of file MeasurementMarkerAlg.h.

42{this, "SegmentLinkKey", ""};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeMarkKeys

SG::WriteDecorHandleKeyArray<xAOD::UncalibratedMeasurementContainer> MuonR4::MeasurementMarkerAlg::m_writeMarkKeys {this, "OutMarkerKeys", {}}
private

Key to the decoration.

Will be copied from m_readMarkKey

Definition at line 40 of file MeasurementMarkerAlg.h.

40{this, "OutMarkerKeys", {}};

◆ m_writeSegLinkKeys

SG::WriteDecorHandleKeyArray<xAOD::UncalibratedMeasurementContainer> MuonR4::MeasurementMarkerAlg::m_writeSegLinkKeys {this, "SegLinkKeys", {}}
private

Key to the decoration.

Will be copied from m_segLink

Definition at line 44 of file MeasurementMarkerAlg.h.

44{this, "SegLinkKeys", {}};

The documentation for this class was generated from the following files: