ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCombinedR4::CombinedFitAlg Class Reference

#include <CombinedFitAlg.h>

Inheritance diagram for MuonCombinedR4::CombinedFitAlg:
Collaboration diagram for MuonCombinedR4::CombinedFitAlg:

Classes

struct  DataShip
 Helper struct to ship the input output data during the combined track fit. More...

Public Member Functions

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 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
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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< StoreGateSvc > StoreGateSvc_t

Private Member Functions

StatusCode prepareDataShip (const EventContext &ctx, DataShip &ship) const
 Load the input containers from store gate and setup the write Handles for the output.
MuonR4::MuonTag * fitMuonTag (const MuonR4::MuonTag &tag, DataShip &ship) const
 Attempt to fit the muon tag to a combined track particle.
void buildMETrack (MuonR4::MuonTag &combinedTag, DataShip &ship) const
StatusCode writeTracksToStoreGate (const EventContext &ctx, const SG::WriteHandleKey< ActsTrk::TrackContainer > &key, const SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > &decorKey, xAOD::TrackParticleContainer &particleContainer, ActsTrk::MutableTrackContainer &&fittedTracks) const
 Convert the ActsTracks to track particles and write the Acts track container to store gate.
std::vector< Acts::SourceLink > extractMeasurements (const MuonR4::MuonTag &muonTag) const
 Retrieve the ID & Muon measurements from the associated ID & MS track particles.
std::vector< Acts::SourceLink > extractMeasurements (const xAOD::TrackParticle &trackPart) const
 Retrieve the uncalibrated measurements from the associated Acts::Track.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ActsTrk::ITrackToTrackParticleCnvTool > m_cnvTool {this, "TrackToTrackParticleCnvTool", ""}
 Conversion tool from Acts -> xAOD:TrackParticle.
ToolHandle< ActsTrk::IFitterTool > m_trackFitTool {this, "FittingTool", ""}
 Track fitting tool.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool {this, "ExtrapolationTool" ,"" }
 Track extrapolation tool.
ActsTrk::ContextUtility m_ctxProvider {this}
 Context provider for geometry, magnetic field and calibration contexts.
SG::ReadHandleKey< MuonR4::MuonTagContainer > m_stacoKey {this, "StacoKey", "MuonTagsSTACO"}
 Use STACO as input to the MuidCo chain as the track pair is already done upstream.
SG::WriteHandleKey< MuonR4::MuonTagContainer > m_outTagKey {this, "MuonTagKey" , "MuonTagsMuidCo"}
 Write key of the created combined tags.
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer > m_beamSpotKey {this, "BeamSpotKey", "BeamSpotMeasurements"}
 Data dependency on the beam spot.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_CmbParticleKey
 Write key of the created combined track particles.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_MeParticleKey
 Write key of the created ME track particles.
SG::WriteHandleKey< ActsTrk::TrackContainer > m_cmbTrackKey {this, "CombinedTrackKey", "MuonCmbTracks"}
 Write key to store the fitted Acts combined tracks.
SG::WriteHandleKey< ActsTrk::TrackContainer > m_meTrackKey {this, "MeTrackKey", "MuonMeTracks"}
 Write key to store the fitted Acts ME tracks.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_cmbTrackLinkKey
 Element link to the produced extrapolated Acts track.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_meTrackLinkKey
Gaudi::Property< bool > m_fitMEtrack {this, "fitMETracks" , false}
 Toggle whether the ME track is formed after the combined fit.
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

Definition at line 31 of file CombinedFitAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Member Function Documentation

◆ buildMETrack()

void MuonCombinedR4::CombinedFitAlg::buildMETrack ( MuonR4::MuonTag & combinedTag,
DataShip & ship ) const
private

Fetch the combined track from the data ship

Collect the muon measurements from the combined track

Todo
: Add the beamspot if neccessary

Create the output track particle

Definition at line 123 of file CombinedFitAlg.cxx.

124 {
125 if (!m_fitMEtrack) {
126 return;
127 }
129 auto combinedTrk = ship.actsCmbTracks.at(combinedTag.cbTrack()->index());
131 std::vector<Acts::SourceLink> measurements{};
132 for (const auto state : combinedTrk.trackStates()) {
133 if (!state.hasUncalibratedSourceLink()) {
134 continue;
135 }
136 Acts::SourceLink sl = state.getUncalibratedSourceLink();
138 measurements.push_back(std::move(sl));
139 }
140 }
142 Acts::BoundTrackParameters startPars = combinedTrk.createParametersAtReference();
143
144 auto fitResult = m_trackFitTool->fit(measurements, startPars,
145 ship.tgContext, ship.mfContext,
146 ship.calContext, &startPars.referenceSurface());
147 if (!fitResult) {
148 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Fit failed");
149 return;
150 }
151 ship.actsMeTracks.ensureDynamicColumns(*fitResult);
152 auto destProxy = ship.actsMeTracks.getTrack(ship.actsMeTracks.addTrack());
153 destProxy.copyFrom(fitResult->getTrack(0));
155 auto* meParticle = ship.meParticles->push_back(std::make_unique<xAOD::TrackParticle>());
156 combinedTag.setMeTrack(meParticle);
157 }
#define ATH_MSG_DEBUG(x,...)
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
ToolHandle< ActsTrk::IFitterTool > m_trackFitTool
Track fitting tool.
Gaudi::Property< bool > m_fitMEtrack
Toggle whether the ME track is formed after the combined fit.
void setMeTrack(const xAOD::TrackParticle *meTrack)
Sets the extrapolated MS track particle.
Definition MuonTag.cxx:54
const xAOD::TrackParticle * cbTrack() const
Returns the combined track candidate from which the tag was built.
Definition MuonTag.cxx:18
bool isMuon(const xAOD::UncalibratedMeasurement *meas)
Returns whether the measurement is from a muon detector.

◆ 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 MuonCombinedR4::CombinedFitAlg::execute ( const EventContext & ctx) const
finaloverridevirtual

Fill the track particles into the output containers

Definition at line 70 of file CombinedFitAlg.cxx.

70 {
71 DataShip ship{};
72 ATH_CHECK(prepareDataShip(ctx, ship));
73
74 for (const auto& [msTrack, tags] : ship.preMatchedTags) {
75 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Process MS track "<<print(*msTrack));
76 for (const MuonR4::MuonTag* candiate: tags) {
77 if (!fitMuonTag(*candiate, ship)) {
78 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Fit failed.");
79 continue;
80 }
81 }
82 }
83
86 *ship.cmbParticles, std::move(ship.actsCmbTracks)));
88 *ship.meParticles, std::move(ship.actsMeTracks)));
89 return StatusCode::SUCCESS;
90 }
#define ATH_CHECK
Evaluate an expression and check for errors.
void print(char *figname, TCanvas *c1)
SG::WriteHandleKey< ActsTrk::TrackContainer > m_cmbTrackKey
Write key to store the fitted Acts combined tracks.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_cmbTrackLinkKey
Element link to the produced extrapolated Acts track.
SG::WriteHandleKey< ActsTrk::TrackContainer > m_meTrackKey
Write key to store the fitted Acts ME tracks.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_meTrackLinkKey
StatusCode prepareDataShip(const EventContext &ctx, DataShip &ship) const
Load the input containers from store gate and setup the write Handles for the output.
StatusCode writeTracksToStoreGate(const EventContext &ctx, const SG::WriteHandleKey< ActsTrk::TrackContainer > &key, const SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > &decorKey, xAOD::TrackParticleContainer &particleContainer, ActsTrk::MutableTrackContainer &&fittedTracks) const
Convert the ActsTracks to track particles and write the Acts track container to store gate.
MuonR4::MuonTag * fitMuonTag(const MuonR4::MuonTag &tag, DataShip &ship) const
Attempt to fit the muon tag to a combined track particle.
std::vector< std::string > tags
Definition hcg.cxx:107
Helper struct to ship the input output data during the combined track fit.

◆ extractMeasurements() [1/2]

std::vector< Acts::SourceLink > MuonCombinedR4::CombinedFitAlg::extractMeasurements ( const MuonR4::MuonTag & muonTag) const
private

Retrieve the ID & Muon measurements from the associated ID & MS track particles.

Parameters
muonTagThe STACO tag carrying the pointers to the MS & IDtracks to be combined

Definition at line 189 of file CombinedFitAlg.cxx.

189 {
190 std::vector<Acts::SourceLink> measurements{};
191 measurements.append_range(extractMeasurements(*muonTag.idTrack()));
192 measurements.append_range(extractMeasurements(*muonTag.msTrack()));
193 return measurements;
194 }
std::vector< Acts::SourceLink > extractMeasurements(const MuonR4::MuonTag &muonTag) const
Retrieve the ID & Muon measurements from the associated ID & MS track particles.
const xAOD::TrackParticle * idTrack() const
Returns the id track candidate from which the tag was built.
Definition MuonTag.cxx:17
const xAOD::TrackParticle * msTrack() const
Returns the ms track candidate from which the tag was built.
Definition MuonTag.cxx:19

◆ extractMeasurements() [2/2]

std::vector< Acts::SourceLink > MuonCombinedR4::CombinedFitAlg::extractMeasurements ( const xAOD::TrackParticle & trackPart) const
private

Retrieve the uncalibrated measurements from the associated Acts::Track.

Parameters
trackPartReference to the track particle of interest

Filter out the auxiliary external constraints

Definition at line 196 of file CombinedFitAlg.cxx.

196 {
197 std::vector<Acts::SourceLink> measurements{};
198 auto track = ActsTrk::getActsTrack(trackPart);
199 if (!track) {
200 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - Failed to retrieve the associated ACTS track from "
201 <<print(trackPart));
202 return measurements;
203 }
204 for (const auto state : track->trackStates()) {
205 if (!state.hasUncalibratedSourceLink()) {
206 continue;
207 }
208 Acts::SourceLink sl = state.getUncalibratedSourceLink();
212 continue;
213 }
214 measurements.push_back(std::move(sl));
215 }
216 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Extracted "<<measurements.size()<<" measurments from "
217 <<print(trackPart));
218 return measurements;
219 }
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
Definition Decoration.cxx:9

◆ 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 & AthCommonAlgorithm< 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 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

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

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ fitMuonTag()

MuonR4::MuonTag * MuonCombinedR4::CombinedFitAlg::fitMuonTag ( const MuonR4::MuonTag & tag,
DataShip & ship ) const
private

Attempt to fit the muon tag to a combined track particle.

Parameters
tagThe STACO tag to use
shipThe dataship to save the output track and track particles

Use the Id tack parameters as start parameters

Copy the fit result to the output container

Create the output track particle

Definition at line 92 of file CombinedFitAlg.cxx.

93 {
94 std::vector<Acts::SourceLink> measurements = extractMeasurements(tag);
95 if (measurements.empty()) {
96 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - No associated measurmeents");
97 return nullptr;
98 }
99 auto idTrack = ActsTrk::getActsTrack(*tag.idTrack());
101 Acts::BoundTrackParameters startPars = idTrack->createParametersAtReference();
102
103 auto fitResult = m_trackFitTool->fit(measurements, startPars,
104 ship.tgContext, ship.mfContext,
105 ship.calContext, &startPars.referenceSurface());
106 if (!fitResult) {
107 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Fit failed");
108 return nullptr;
109 }
111 ship.actsCmbTracks.ensureDynamicColumns(*fitResult);
112 auto destProxy = ship.actsCmbTracks.getTrack(ship.actsCmbTracks.addTrack());
113 destProxy.copyFrom(fitResult->getTrack(0));
115 auto* combParticle = ship.cmbParticles->push_back(std::make_unique<xAOD::TrackParticle>());
116 auto* combTag = ship.outputTags->push_back(std::make_unique<MuonR4::MuonTag>());
117 combTag->setAuthor(MuonR4::MuonTag::Author::MuidCo);
118 combTag->setCbTrack(combParticle);
119 combTag->setIdTrack(tag.idTrack());
120 combTag->setMsTrack(tag.msTrack());
121 return combTag;
122 }

◆ initialize()

StatusCode MuonCombinedR4::CombinedFitAlg::initialize ( )
finaloverridevirtual

Definition at line 24 of file CombinedFitAlg.cxx.

24 {
25 ATH_CHECK(m_cnvTool.retrieve());
26 ATH_CHECK(m_trackFitTool.retrieve());
28
29 ATH_CHECK(m_ctxProvider.initialize());
30 ATH_CHECK(m_stacoKey.initialize());
31 ATH_CHECK(m_outTagKey.initialize());
32 ATH_CHECK(m_beamSpotKey.initialize(false));
33
34 ATH_CHECK(m_CmbParticleKey.initialize());
36
37 ATH_CHECK(m_cmbTrackKey.initialize());
39
41 ATH_CHECK(m_cmbTrackLinkKey.initialize());
42 return StatusCode::SUCCESS;
43 }
SG::WriteHandleKey< MuonR4::MuonTagContainer > m_outTagKey
Write key of the created combined tags.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_MeParticleKey
Write key of the created ME track particles.
SG::ReadHandleKey< MuonR4::MuonTagContainer > m_stacoKey
Use STACO as input to the MuidCo chain as the track pair is already done upstream.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_CmbParticleKey
Write key of the created combined track particles.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
ToolHandle< ActsTrk::ITrackToTrackParticleCnvTool > m_cnvTool
Conversion tool from Acts -> xAOD:TrackParticle.
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer > m_beamSpotKey
Data dependency on the beam spot.

◆ 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()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

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

◆ prepareDataShip()

StatusCode MuonCombinedR4::CombinedFitAlg::prepareDataShip ( const EventContext & ctx,
DataShip & ship ) const
private

Load the input containers from store gate and setup the write Handles for the output.

Parameters
ctxEventContext for StoreGate access
shipDataShip carrying the needed data containers

Sort the tags by their MS track particle

Sort all candidates per MS track according to their matching chi2

Definition at line 44 of file CombinedFitAlg.cxx.

44 {
45 const MuonR4::MuonTagContainer* stacoTags{nullptr};
46 ATH_CHECK(SG::get(stacoTags, m_stacoKey, ctx));
48 for (const MuonR4::MuonTag* tag : *stacoTags) {
49 ship.preMatchedTags[tag->msTrack()].push_back(tag);
50 }
51 for (auto & [_, assocTags] : ship.preMatchedTags) {
53 std::ranges::sort(assocTags, [](const MuonR4::MuonTag* a,
54 const MuonR4::MuonTag* b) {
56 constexpr float max = std::numeric_limits<float>::max();
57 return a->parameter<float>(msInnerMatchChi2).value_or(max) <
58 b->parameter<float>(msInnerMatchChi2).value_or(max);
59 });
60 }
61 ATH_CHECK(ship.outputTags.record(m_outTagKey, ctx));
62 ATH_CHECK(ship.cmbParticles.record(m_CmbParticleKey, ctx));
63 ATH_CHECK(ship.meParticles.record(m_MeParticleKey, ctx));
64
65 ship.calContext = m_ctxProvider.getCalibrationContext(ctx);
66 ship.mfContext = m_ctxProvider.getMagneticFieldContext(ctx);
67 ship.tgContext = m_ctxProvider.getGeometryContext(ctx);
68 return StatusCode::SUCCESS;
69 }
static Double_t a
#define max(a, b)
Definition cfImp.cxx:41
xAOD::Muon::ParamDef ParamDef
Recylce the Parameter definition enum from the Muon.
Definition MuonTag.h:33
DataVector< MuonTag > MuonTagContainer
Definition MuonTag.h:125
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

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

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< 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.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< 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 AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_ERROR(x,...)
virtual StatusCode sysInitialize() override
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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

◆ writeTracksToStoreGate()

StatusCode MuonCombinedR4::CombinedFitAlg::writeTracksToStoreGate ( const EventContext & ctx,
const SG::WriteHandleKey< ActsTrk::TrackContainer > & key,
const SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > & decorKey,
xAOD::TrackParticleContainer & particleContainer,
ActsTrk::MutableTrackContainer && fittedTracks ) const
private

Convert the ActsTracks to track particles and write the Acts track container to store gate.

Also establish the link to the track from the filled track particle

Parameters
ctxEvent Context to access StoreGate to write the container to create the element links
keyThe key to write the Acts::Track container to StoreGate
decorKeyDecorHandleKey to establish the link to the Acts::Tracks
particleContainerMutable reference to the track particle which particles are filled with the track information
fittedTracksThe fitted track to write to store gate

Definition at line 160 of file CombinedFitAlg.cxx.

164 {
165 if (key.empty()) {
166 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Empty key do nothing");
167 return StatusCode::SUCCESS;
168 }
169 Acts::ConstVectorTrackContainer ctrackBackend{std::move(fittedTracks.container())};
170 Acts::ConstVectorMultiTrajectory ctrackStateBackend{std::move(fittedTracks.trackStateContainer())};
171 auto ctc = std::make_unique<ActsTrk::TrackContainer>(std::move(ctrackBackend),
172 std::move(ctrackStateBackend));
173
174 SG::WriteHandle writeHandle{key, ctx};
175 ATH_CHECK(writeHandle.record(std::move(ctc)));
176
177 xAOD::ContainerDecorator dec_trackLink{decorKey, ctx,
179 for (std::size_t trk = 0 ; trk < particleContainer.size(); ++trk) {
180 const ActsTrk::TrackContainer::ConstTrackProxy convMe = writeHandle->getTrack(trk);
181 xAOD::TrackParticle* convTo = particleContainer.at(trk);
182 ATH_CHECK(m_cnvTool->convert(*convTo, ctx, convMe, convMe.referenceSurface()));
183 dec_trackLink(*convTo) = ElementLink<ActsTrk::TrackContainer>(*writeHandle, convMe.index(), ctx);
184 }
185 return StatusCode::SUCCESS;
186 }
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

Member Data Documentation

◆ m_beamSpotKey

SG::ReadHandleKey<xAOD::UncalibratedMeasurementContainer> MuonCombinedR4::CombinedFitAlg::m_beamSpotKey {this, "BeamSpotKey", "BeamSpotMeasurements"}
private

Data dependency on the beam spot.

Definition at line 115 of file CombinedFitAlg.h.

115{this, "BeamSpotKey", "BeamSpotMeasurements"};

◆ m_CmbParticleKey

SG::WriteHandleKey<xAOD::TrackParticleContainer> MuonCombinedR4::CombinedFitAlg::m_CmbParticleKey
private
Initial value:
{this, "CombinedParticleKey",
"MuonCmbTrackParticles"}

Write key of the created combined track particles.

Definition at line 117 of file CombinedFitAlg.h.

117 {this, "CombinedParticleKey",
118 "MuonCmbTrackParticles"};

◆ m_cmbTrackKey

SG::WriteHandleKey<ActsTrk::TrackContainer> MuonCombinedR4::CombinedFitAlg::m_cmbTrackKey {this, "CombinedTrackKey", "MuonCmbTracks"}
private

Write key to store the fitted Acts combined tracks.

Definition at line 123 of file CombinedFitAlg.h.

123{this, "CombinedTrackKey", "MuonCmbTracks"};

◆ m_cmbTrackLinkKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> MuonCombinedR4::CombinedFitAlg::m_cmbTrackLinkKey
private
Initial value:
{this, "CombinedTrackLinkKey",
m_CmbParticleKey, "actsTrack"}

Element link to the produced extrapolated Acts track.

Definition at line 128 of file CombinedFitAlg.h.

128 {this, "CombinedTrackLinkKey",
129 m_CmbParticleKey, "actsTrack"};

◆ m_cnvTool

ToolHandle<ActsTrk::ITrackToTrackParticleCnvTool> MuonCombinedR4::CombinedFitAlg::m_cnvTool {this, "TrackToTrackParticleCnvTool", ""}
private

Conversion tool from Acts -> xAOD:TrackParticle.

Definition at line 103 of file CombinedFitAlg.h.

103{this, "TrackToTrackParticleCnvTool", ""};

◆ m_ctxProvider

ActsTrk::ContextUtility MuonCombinedR4::CombinedFitAlg::m_ctxProvider {this}
private

Context provider for geometry, magnetic field and calibration contexts.

Definition at line 109 of file CombinedFitAlg.h.

109{this};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 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 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

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

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

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_extrapolationTool

ToolHandle<ActsTrk::IExtrapolationTool> MuonCombinedR4::CombinedFitAlg::m_extrapolationTool {this, "ExtrapolationTool" ,"" }
private

Track extrapolation tool.

Definition at line 107 of file CombinedFitAlg.h.

107{this, "ExtrapolationTool" ,"" };

◆ m_fitMEtrack

Gaudi::Property<bool> MuonCombinedR4::CombinedFitAlg::m_fitMEtrack {this, "fitMETracks" , false}
private

Toggle whether the ME track is formed after the combined fit.

Definition at line 134 of file CombinedFitAlg.h.

134{this, "fitMETracks" , false};

◆ m_MeParticleKey

SG::WriteHandleKey<xAOD::TrackParticleContainer> MuonCombinedR4::CombinedFitAlg::m_MeParticleKey
private
Initial value:
{this, "MeParticleKey",
"MuonMeTrackParticles"}

Write key of the created ME track particles.

Definition at line 120 of file CombinedFitAlg.h.

120 {this, "MeParticleKey",
121 "MuonMeTrackParticles"};

◆ m_meTrackKey

SG::WriteHandleKey<ActsTrk::TrackContainer> MuonCombinedR4::CombinedFitAlg::m_meTrackKey {this, "MeTrackKey", "MuonMeTracks"}
private

Write key to store the fitted Acts ME tracks.

Definition at line 125 of file CombinedFitAlg.h.

125{this, "MeTrackKey", "MuonMeTracks"};

◆ m_meTrackLinkKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> MuonCombinedR4::CombinedFitAlg::m_meTrackLinkKey
private
Initial value:
{this, "MeTrackLinKey",
m_MeParticleKey, "actsTrack"}

Definition at line 131 of file CombinedFitAlg.h.

131 {this, "MeTrackLinKey",
132 m_MeParticleKey, "actsTrack"};

◆ m_outTagKey

SG::WriteHandleKey<MuonR4::MuonTagContainer> MuonCombinedR4::CombinedFitAlg::m_outTagKey {this, "MuonTagKey" , "MuonTagsMuidCo"}
private

Write key of the created combined tags.

Definition at line 113 of file CombinedFitAlg.h.

113{this, "MuonTagKey" , "MuonTagsMuidCo"};

◆ m_stacoKey

SG::ReadHandleKey<MuonR4::MuonTagContainer> MuonCombinedR4::CombinedFitAlg::m_stacoKey {this, "StacoKey", "MuonTagsSTACO"}
private

Use STACO as input to the MuidCo chain as the track pair is already done upstream.

Definition at line 111 of file CombinedFitAlg.h.

111{this, "StacoKey", "MuonTagsSTACO"};

◆ m_trackFitTool

ToolHandle<ActsTrk::IFitterTool> MuonCombinedR4::CombinedFitAlg::m_trackFitTool {this, "FittingTool", ""}
private

Track fitting tool.

Definition at line 105 of file CombinedFitAlg.h.

105{this, "FittingTool", ""};

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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