14 std::stringstream sstr{};
15 sstr<<
"particle with " <<(
p.pt()*1.e-3)<<
" [GeV], eta: "<<
p.eta()<<
", phi: "
16 <<
p.phi()<<
", q:"<<
p.charge()<<
", author: "<<
p.trackFitter()<<std::endl;
42 return StatusCode::SUCCESS;
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);
68 return StatusCode::SUCCESS;
89 return StatusCode::SUCCESS;
95 if (measurements.empty()) {
96 ATH_MSG_WARNING(__func__<<
"() "<<__LINE__<<
" - No associated measurmeents");
101 Acts::BoundTrackParameters startPars = idTrack->createParametersAtReference();
105 ship.
calContext, &startPars.referenceSurface());
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());
131 std::vector<Acts::SourceLink> measurements{};
132 for (
const auto state : combinedTrk.trackStates()) {
133 if (!state.hasUncalibratedSourceLink()) {
136 Acts::SourceLink sl = state.getUncalibratedSourceLink();
138 measurements.push_back(std::move(sl));
142 Acts::BoundTrackParameters startPars = combinedTrk.createParametersAtReference();
146 ship.
calContext, &startPars.referenceSurface());
153 destProxy.copyFrom(fitResult->getTrack(0));
155 auto* meParticle = ship.
meParticles->push_back(std::make_unique<xAOD::TrackParticle>());
166 ATH_MSG_DEBUG(__func__<<
"() "<<__LINE__<<
" - Empty key do nothing");
167 return StatusCode::SUCCESS;
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));
179 for (std::size_t trk = 0 ; trk < particleContainer.
size(); ++trk) {
180 const ActsTrk::TrackContainer::ConstTrackProxy convMe = writeHandle->getTrack(trk);
185 return StatusCode::SUCCESS;
188 std::vector<Acts::SourceLink>
190 std::vector<Acts::SourceLink> measurements{};
195 std::vector<Acts::SourceLink>
197 std::vector<Acts::SourceLink> measurements{};
200 ATH_MSG_WARNING(__func__<<
"() "<<__LINE__<<
" - Failed to retrieve the associated ACTS track from "
204 for (
const auto state : track->trackStates()) {
205 if (!state.hasUncalibratedSourceLink()) {
208 Acts::SourceLink sl = state.getUncalibratedSourceLink();
214 measurements.push_back(std::move(sl));
216 ATH_MSG_VERBOSE(__func__<<
"() "<<__LINE__<<
" - Extracted "<<measurements.size()<<
" measurments from "
#define ATH_CHECK
Evaluate an expression and check for errors.
ElementLink()
Default constructor.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
void print(char *figname, TCanvas *c1)
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
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.
ElementLink implementation for ROOT usage.
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::WriteHandleKey< ActsTrk::TrackContainer > m_cmbTrackKey
Write key to store the fitted Acts combined tracks.
SG::ReadHandleKey< MuonR4::MuonTagContainer > m_stacoKey
Use STACO as input to the MuidCo chain as the track pair is already done upstream.
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::WriteHandleKey< xAOD::TrackParticleContainer > m_CmbParticleKey
Write key of the created combined track particles.
void buildMETrack(MuonR4::MuonTag &combinedTag, DataShip &ship) const
ToolHandle< ActsTrk::IFitterTool > m_trackFitTool
Track fitting tool.
Gaudi::Property< bool > m_fitMEtrack
Toggle whether the ME track is formed after the combined fit.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
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.
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
virtual StatusCode initialize() override final
ToolHandle< ActsTrk::ITrackToTrackParticleCnvTool > m_cnvTool
Conversion tool from Acts -> xAOD:TrackParticle.
std::vector< Acts::SourceLink > extractMeasurements(const MuonR4::MuonTag &muonTag) const
Retrieve the ID & Muon measurements from the associated ID & MS track particles.
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer > m_beamSpotKey
Data dependency on the beam spot.
virtual StatusCode execute(const EventContext &ctx) const override final
MuonR4::MuonTag * fitMuonTag(const MuonR4::MuonTag &tag, DataShip &ship) const
Attempt to fit the muon tag to a combined track particle.
Baseline EDM object to gather all relevant information about a reconstructed muon candidate which can...
xAOD::Muon::ParamDef ParamDef
Recylce the Parameter definition enum from the Muon.
void setMeTrack(const xAOD::TrackParticle *meTrack)
Sets the extrapolated MS track particle.
const xAOD::TrackParticle * idTrack() const
Returns the id track candidate from which the tag was built.
const xAOD::TrackParticle * cbTrack() const
Returns the combined track candidate from which the tag was built.
const xAOD::TrackParticle * msTrack() const
Returns the ms track candidate from which the tag was built.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
std::vector< std::string > tags
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
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.
DataVector< MuonTag > MuonTagContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
bool isMuon(const xAOD::UncalibratedMeasurement *meas)
Returns whether the measurement is from a muon detector.
Helper struct to ship the input output data during the combined track fit.
xAOD::FillContainer< MuonR4::MuonTagContainer, void * > outputTags
The output combined tag collection.
Acts::MagneticFieldContext mfContext
The magnetic field context.
ActsTrk::MutableTrackContainer actsMeTracks
The ME track container.
std::map< const xAOD::TrackParticle *, std::vector< const MuonR4::MuonTag * >, MuonR4::ParticleSorter > preMatchedTags
The prematched combined muon tags.
xAOD::FillContainer< xAOD::TrackParticleContainer, xAOD::TrackParticleAuxContainer > cmbParticles
The output combined particle container.
Acts::GeometryContext tgContext
The geometry context to align the surfaces during the fit.
Acts::CalibrationContext calContext
The calibration context.
ActsTrk::MutableTrackContainer actsCmbTracks
The combined acts track container.
xAOD::FillContainer< xAOD::TrackParticleContainer, xAOD::TrackParticleAuxContainer > meParticles
The output ME particle container.