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

The SegmentFittingAlg fits straight lines to the Mdt/Rpc/Tgc hits associated with the SegmentSeedPatterns. More...

#include <SegmentFittingAlg.h>

Inheritance diagram for MuonR4::SegmentFittingAlg:
Collaboration diagram for MuonR4::SegmentFittingAlg:

Public Member Functions

virtual ~SegmentFittingAlg ()
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
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

using SegmentVec_t = std::vector<std::unique_ptr<Segment>>
using Parameters = SegmentFit::Parameters
typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

SegmentVec_t fitSegmentSeed (const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const SegmentSeed *seed) const
 Fit the hits from the pattern seed to segment candidates.
void resolveAmbiguities (const ActsTrk::GeometryContext &gctx, SegmentVec_t &segmentCandidates) const
 Resolve the ambiguity amongst the segment candidates within a spectrometer sector.
std::optional< SpacePointPerLayerSplitter::HitVec > makeBilRecoveryHits (const SegmentSeed &seed) const
 For BIL (specifically around eta3 chambers), there are cases where only a single multilayer is crossed by the muon trajectory (because of the instrumentation gap) This function returns a set of recovery hits that are only from a multilayer which is crossed by the pattern seed.
std::optional< SpacePointPerLayerSplitter::HitVec > makeBimBirRecoveryHits (const SegmentSeed &seed) const
 BIM/BIR chambers are treated as the same sector, however, they don't overlap in many instances.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< SegmentSeedContainer > m_seedKey {this, "ReadKey", "MuonHoughStationSegmentSeeds"}
 ReadHandle of the seeds.
SG::WriteHandleKey< SegmentContainer > m_outSegments {this, "OutSegmentContainer", "R4MuonSegments"}
ActsTrk::GeoContextReadKey_t m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 IdHelperSvc.
ToolHandle< ISpacePointCalibrator > m_calibTool {this, "Calibrator", "" }
 Handle to the space point calibrator.
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool {this, "VisualizationTool", ""}
 Pattern visualization tool.
Gaudi::Property< bool > m_doT0Fit {this, "fitSegmentT0", true}
Gaudi::Property< bool > m_recalibInFit {this, "recalibInFit" , false}
Gaudi::Property< bool > m_tryPatternPars {this, "tryPatternPars", false}
 Try first to fit the pattern parameters. Then proceed with the straw line tangents.
Gaudi::Property< bool > m_hessianResidual {this, "useHessianResidual", false}
 Use the expliciit Hessian in the residual calculation.
Gaudi::Property< bool > m_doBeamspotConstraint {this, "doBeamspotConstraint", false}
 Add beamline constraint.
Gaudi::Property< double > m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm}
 Radial covariance on th beam spot measurment.
Gaudi::Property< double > m_beamSpotL {this, "BeamSpotLength", 2. * Gaudi::Units::m}
 Longitudinal covariance on the beam spo measurement.
Gaudi::Property< std::vector< double > > m_seedMaxBsR
 Maximum allowed distance of the segment seed line to the beam spot measurement expressed in relative units of the beamspot radius.
Gaudi::Property< std::vector< double > > m_seedMaxBsL
Gaudi::Property< double > m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. }
 Two mdt seeds are the same if their defining parameters match wihin.
Gaudi::Property< bool > m_recalibSeed {this, "SeedRecalibrate", false}
 Toggle seed recalibration.
Gaudi::Property< double > m_outlierRemovalCut {this, "OutlierRemoval", 5.}
 Cut on the segment chi2 / nDoF to launch the outlier removal.
Gaudi::Property< double > m_recoveryPull {this, "RecoveryPull", 5.}
Gaudi::Property< unsigned > m_precHitCut {this, "PrecHitCut" , 3}
 Minimum number of precision hits to accept the segment.
Gaudi::Property< bool > m_useFastFitter {this, "useFastFitter", true}
 Use the fast Mdt fitter where possible.
Gaudi::Property< bool > m_fastPreFitter {this, "useFastPreFitter", false}
 The fast fitter is treated as a pre fitter.
Gaudi::Property< bool > m_ignoreFailedPreFit {this, "ignoreFailedPreFit", false}
 Switch to try the full fit when the fast pre-fitter fails.
Gaudi::Property< unsigned > m_maxIter {this, "maxIterations", 50}
 Tune the number of iterations.
Gaudi::Property< unsigned > m_busyLayerLimit {this, "busyLayerLimit", 4}
 Cut on the number of hits per layer to use the layer for seeding.
std::unique_ptr< SegmentFit::SegmentAmbiSolver > m_ambiSolver {}
 Pointer to the ambiguity reosolution.
std::unique_ptr< SegmentFit::SegmentLineFitter > m_fitter {}
 Pointer to the actual segment fitter.
std::unique_ptr< SegmentFit::MdtSegmentSeedGenerator > m_seeder {}
 Pointer to the L-R segment seeder.
Gaudi::Property< bool > m_allowSegmentSeedingFallback {this, "allowSegmentSeedingFallback", true}
 Allow single multilayer fallback when standard segment reconstruction fails.
Gaudi::Property< double > m_singleMlEdgeTolerance { this, "SingleMlEdgeTolerance", 50. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local precision coordinate"}
 Tolerance for the single multilayer edge crossing test, if the trajectory only slighty nicks the second ML still consider as one ML case.
Gaudi::Property< double > m_singleMlPhiEdgeTolerance { this, "SingleMlPhiEdgeTolerance", 0. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local phi coordinate"}
 Tolerance for the single multilayer edge crossing test in the phi projection in case the trajectory only slightly nicks one of the ML.
int m_bilStation {-1}
 Cached BIL station index for quick access.
int m_bimStation {-1}
 Cached BIM station index for quick access.
int m_birStation {-1}
 Cached BIR station index for quick access.
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

Static Private Attributes

static constexpr auto s_stIdxMax = Acts::toUnderlying(Muon::MuonStationIndex::StIndex::StIndexMax)

Detailed Description

The SegmentFittingAlg fits straight lines to the Mdt/Rpc/Tgc hits associated with the SegmentSeedPatterns.

The pattern parameters in the bending direction are refined by constructing the tangent to two Mdt measurements and then by associating other measurements to the seed. If the procedure succeeds, the hits are passed through the straight line procedure. At the end of the fit, ambiguities amongst the segment candidates are removed based on the degrees of freedom and the chi2 fit quality

Definition at line 35 of file SegmentFittingAlg.h.

Member Typedef Documentation

◆ Parameters

◆ SegmentVec_t

using MuonR4::SegmentFittingAlg::SegmentVec_t = std::vector<std::unique_ptr<Segment>>
private

Definition at line 42 of file SegmentFittingAlg.h.

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~SegmentFittingAlg()

MuonR4::SegmentFittingAlg::~SegmentFittingAlg ( )
virtualdefault

Member Function Documentation

◆ 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::SegmentFittingAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 129 of file SegmentFittingAlg.cxx.

129 {
130 const ActsTrk::GeometryContext* gctx{nullptr};
131 const SegmentSeedContainer* segmentSeeds{nullptr};
132
133 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
134 ATH_CHECK(SG::get(segmentSeeds, m_seedKey, ctx));
135
136 SG::WriteHandle writeSegments{m_outSegments, ctx};
137 ATH_CHECK(writeSegments.record(std::make_unique<SegmentContainer>()));
138 SegmentVec_t allSegments{};
139 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - execute() - Start processing " << segmentSeeds->size() << " pattern seeds.");
140 for (const SegmentSeed* seed : *segmentSeeds) {
141 SegmentVec_t segments = fitSegmentSeed(ctx, *gctx, seed);
142 if (m_visionTool.isEnabled() && segments.size() > 1) {
143 auto drawFinalReco = [this, &segments, &gctx, &ctx,&seed](const std::string& nameTag) {
144 PrimitiveVec segmentLines{};
145 double yLegend{0.85};
146 segmentLines.push_back(drawLabel(std::format("# segments: {:d}", segments.size()), 0.2, yLegend, 14));
147 yLegend-=0.04;
148 for (const std::unique_ptr<Segment>& seg : segments) {
149 const Parameters pars = localSegmentPars(*gctx, *seg);
150 const auto [pos, dir] = makeLine(pars);
151 segmentLines.emplace_back(drawLine(pars, -Gaudi::Units::m, Gaudi::Units::m, kRed));
152 std::stringstream signStream{};
153 const auto& cov = seg->covariance();
154 signStream<<std::format("#chi^{{2}}/nDoF: {:.2f} ({:}), ", seg->chi2() / seg->nDoF(), seg->nDoF());
155 signStream<<std::format("y_{{0}}={:.2f}#pm{:.2f}",
156 pars[toUnderlying(ParamDefs::y0)],
157 Amg::error(cov, toUnderlying(ParamDefs::y0)))<<", ";
158 signStream<<std::format("#theta={:.2f}#pm{:.2f}^{{#circ}}",
159 pars[toUnderlying(ParamDefs::theta)]/ 1._degree,
160 Amg::error(cov, toUnderlying(ParamDefs::theta)) / 1._degree )<<", ";
161 for (const Segment::MeasType& m : seg->measurements()) {
163 m->fitState() == CalibratedSpacePoint::State::Valid) {
164 signStream<<(SeedingAux::strawSign(pos, dir, *m) == -1 ? "L" : "R");
165 }
166 }
167 segmentLines.push_back(drawLabel(signStream.str(), 0.2, yLegend, 13));
168 yLegend-=0.03;
169 }
170
171 m_visionTool->visualizeBucket(ctx, *seed->parentBucket(), nameTag, std::move(segmentLines));
172 };
173 drawFinalReco("all segments");
174 const unsigned int nBeforeAmbi = segments.size();
175 segments = m_ambiSolver->resolveAmbiguity(*gctx, std::move(segments));
176 if (nBeforeAmbi != segments.size()) {
177 drawFinalReco("post ambiguity");
178 }
179 } else if (m_visionTool.isEnabled() && segments.empty() &&
180 std::ranges::any_of(seed->getHitsInMax(),[this](const SpacePoint* hit){
181 return m_visionTool->isLabeled(*hit);
182 })) {
183 m_visionTool->visualizeSeed(ctx, *seed, "Failed fit");
184 }
185 allSegments.insert(allSegments.end(), std::make_move_iterator(segments.begin()),
186 std::make_move_iterator(segments.end()));
187 }
188 resolveAmbiguities(*gctx, allSegments);
189 writeSegments->insert(writeSegments->end(),
190 std::make_move_iterator(allSegments.begin()),
191 std::make_move_iterator(allSegments.end()));
192 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Found in total "<<writeSegments->size()<<" segments. ");
193 return StatusCode::SUCCESS;
194 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x,...)
bool hit(const Container &ids, int pdgId)
std::unique_ptr< SegmentFit::SegmentAmbiSolver > m_ambiSolver
Pointer to the ambiguity reosolution.
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool
Pattern visualization tool.
SG::WriteHandleKey< SegmentContainer > m_outSegments
SegmentVec_t fitSegmentSeed(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const SegmentSeed *seed) const
Fit the hits from the pattern seed to segment candidates.
void resolveAmbiguities(const ActsTrk::GeometryContext &gctx, SegmentVec_t &segmentCandidates) const
Resolve the ambiguity amongst the segment candidates within a spectrometer sector.
std::vector< std::unique_ptr< Segment > > SegmentVec_t
SegmentFit::Parameters Parameters
SG::ReadHandleKey< SegmentSeedContainer > m_seedKey
ReadHandle of the seeds.
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Acts::CloneablePtr< CalibratedSpacePoint > MeasType
Calibrated space point type.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
MuonValR4::IPatternVisualizationTool::PrimitiveVec PrimitiveVec
DataVector< SegmentSeed > SegmentSeedContainer
std::unique_ptr< TLine > drawLine(const MuonR4::SegmentFit::Parameters &pars, const double lowEnd, const double highEnd, const int color=kRed+1, const int lineStyle=kDashed, const int view=objViewEta)
Draws a line from the segment fit parameters.
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const double textSize=18, const bool useNDC=true, const int color=kBlack)
Create a TLatex label,.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

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

◆ fitSegmentSeed()

SegmentFittingAlg::SegmentVec_t MuonR4::SegmentFittingAlg::fitSegmentSeed ( const EventContext & ctx,
const ActsTrk::GeometryContext & gctx,
const SegmentSeed * seed ) const
private

Fit the hits from the pattern seed to segment candidates.

Tangent lines to a pair of drift circles are constructed. The remaining hits are associated based on their chi2 compability. Good seeds are then fitted to segments including an outlier rejection and hole recovery procedure

Parameters
ctxEvent context to access the conditions data needed for calibration
gctxGeometry context to access the transforms of the particular reference surfaces.
seedThe segment seed from which the parameters in non-bending direction & the associated hits are taken

This patch restores the efficiency for muons with pT< 10 GeV in the middle and outer endcap stations, for more details on the derivation of the exact window cuts see MR !91056

MDT-multilayer fallback. Only try this when standard segment reconstruction failed.

Definition at line 197 of file SegmentFittingAlg.cxx.

199 {
200
201 const Acts::Transform3& locToGlob{patternSeed->msSector()->localToGlobalTransform(gctx)};
202 std::vector<std::unique_ptr<Segment>> segments{};
203
204 const Acts::CalibrationContext cctx = ActsTrk::getCalibrationContext(ctx);
205
206 using namespace Muon::MuonStationIndex;
207 using State_t = MdtSegmentSeedGenerator::State_t;
208
209
210 auto seedSelector = [&](const Amg::Vector3D& tangentSeedPos,
211 const Amg::Vector3D& tangentSeedDir) {
213 return true;
214 }
215 const Amg::Vector3D globPos{locToGlob*tangentSeedPos};
216 const Amg::Vector3D globDir{locToGlob.linear()*tangentSeedDir};
217
220 const StIndex stIdx = toStationIndex(patternSeed->msSector()->chamberIndex());
221 switch (stIdx) {
222 using enum StIndex;
223 case EM: {
224 if (std::abs(globPos.eta()) > 2.35 &&
225 std::abs(globPos.theta() - globDir.theta()) < 5.8_degree) {
226 return true;
227 }
228 break;
229 }
230 case EO: {
231 if (std::abs(globPos.eta()) > 2.35 &&
232 std::abs(globPos.theta() - globDir.theta()) < 3._degree) {
233 return true;
234 }
235 break;
236 }
237 default:
238 break;
239 }
240 using namespace Acts::detail::LineHelper;
241 const Acts::Intersection3D bsExtp = lineIntersect<3>(Amg::Vector3D::Zero(),
242 Amg::Vector3D::UnitZ(),
243 globPos, globDir);
244 const Amg::Vector3D closePoint = bsExtp.position();
245 const auto rawStIdx = Acts::toUnderlying(stIdx);
246 //coverity[NEGATIVE_RETURNS]
247 if (closePoint.perp() > m_seedMaxBsR.value().at(rawStIdx) * m_beamSpotR ||
248 std::abs(closePoint.z()) > m_seedMaxBsL.value().at(rawStIdx) * m_beamSpotL){
249 ATH_MSG_DEBUG("fitSegmentSeed() - Reject parameters "<<Amg::toString(tangentSeedPos)
250 <<" + "<<Amg::toString(tangentSeedDir)
251 <<" as extrapolation to beamspot is too far "<<Amg::toString(closePoint)
252 <<", r: "<<closePoint.perp());
253 return false;
254 }
255 return true;
256 };
257
258 // Make sure patternSeed->parameters() are in ACTS units!
259 State_t seedState{patternSeed->parameters(), patternSeed, m_calibTool.get(), m_recalibSeed, seedSelector};
260
261 auto visualizeSegmentSeeds = [&](State_t& state, const std::string_view label) {
262 if (m_visionTool.isEnabled()) {
263 PrimitiveVec seedLines{};
264 State_t drawMe{state};
265 while(auto s = m_seeder->nextSeed(cctx, drawMe)) {
266 seedLines.push_back(drawLine(s->parameters, -Gaudi::Units::m, Gaudi::Units::m, kViolet));
267 }
268 seedLines.push_back(drawLabel(std::format("{} possible seeds: {:d}", label, drawMe.nGenSeeds()), 0.2, 0.85, 14));
269 m_visionTool->visualizeSeed(ctx, *patternSeed, std::format("pattern_{:}{:}{:}",
270 patternSeed->msSector()->chamberIndex(),
271 patternSeed->msSector()->side() ? 'A' : 'C' ,
272 patternSeed->msSector()->sector()), std::move(seedLines));
273 }
274 };
275
276 auto runSeeder = [&](State_t&& state) {
277 while (auto seed = m_seeder->nextSeed(cctx, state)) {
278 seed->parameters[toUnderlying(ParamDefs::t0)] = ActsTrk::timeToAthena( seed->parameters[toUnderlying(ParamDefs::t0)]);
279 auto segment = m_fitter->fitSegment(ctx, patternSeed, seed->parameters, locToGlob, std::move(seed->hits));
280 if (segment) {
281 segments.push_back(std::move(segment));
282 }
283 }
284 };
285
286 visualizeSegmentSeeds(seedState, "Nominal Seeds");
287 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - fitSegmentHits() - Start segment seed search");
288 runSeeder(std::move(seedState));
289
290 //----------------------------------------------------------------------------------------
292 /* Trying to recover certain cases where we either have only one multilayer or where the chambers are not overlapping and there are no hits in the other (e.g. BIM & BIR)*/
293 //----------------------------------------------------------------------------------------
295 segments.empty() && (patternSeed->msSector()->chamberIndex() == ChIndex::BIL) ) {
296 // Implement fallback logic here
297 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - fitSegmentSeed() - Standard MDT seeding failed. " "Trying ML fallback.");
298
299 //For recovery seeding we will have smaller hit collection
300 std::optional<SpacePointPerLayerSplitter::HitVec> recoveryHits{};
301
302 // First try the very restrictive BIL single-ML recovery.
303 recoveryHits = makeBilRecoveryHits(*patternSeed);
304
305 if (!recoveryHits) {
306 ATH_MSG_VERBOSE(__func__<< ":" <<__LINE__<< "- BIL recovery did not succeed. Try BIM/BIR.");
307 recoveryHits = makeBimBirRecoveryHits(*patternSeed);
308 }
309
310 // Both recovery modes ultimately use exactly the same nominal MDT seeder. Only their input hits differ.
311 if (recoveryHits) {
312 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - fitSegmentSeed() - ML seeding fallback has " << recoveryHits->size() << " hits.");
313 State_t fallbackState{patternSeed->parameters(), patternSeed, m_calibTool.get(), m_recalibSeed, *recoveryHits, seedSelector};
314 visualizeSegmentSeeds(fallbackState , "Fallback Seeds");
315 runSeeder(std::move(fallbackState));
316 }
317 }
318 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - fitSegmentHits() - In total "<<segments.size()<<" segment were constructed ");
319 return segments;
320
321 }
#define ATH_MSG_DEBUG(x,...)
SeedingState< HitVec_t, CalibCont_t, SeederStateBase > State_t
Define the state holder object.
Gaudi::Property< bool > m_recalibSeed
Toggle seed recalibration.
std::optional< SpacePointPerLayerSplitter::HitVec > makeBimBirRecoveryHits(const SegmentSeed &seed) const
BIM/BIR chambers are treated as the same sector, however, they don't overlap in many instances.
Gaudi::Property< double > m_beamSpotL
Longitudinal covariance on the beam spo measurement.
Gaudi::Property< bool > m_allowSegmentSeedingFallback
Allow single multilayer fallback when standard segment reconstruction fails.
std::unique_ptr< SegmentFit::MdtSegmentSeedGenerator > m_seeder
Pointer to the L-R segment seeder.
Gaudi::Property< bool > m_doBeamspotConstraint
Add beamline constraint.
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator.
std::unique_ptr< SegmentFit::SegmentLineFitter > m_fitter
Pointer to the actual segment fitter.
std::optional< SpacePointPerLayerSplitter::HitVec > makeBilRecoveryHits(const SegmentSeed &seed) const
For BIL (specifically around eta3 chambers), there are cases where only a single multilayer is crosse...
Gaudi::Property< std::vector< double > > m_seedMaxBsL
Gaudi::Property< std::vector< double > > m_seedMaxBsR
Maximum allowed distance of the segment seed line to the beam spot measurement expressed in relative ...
Gaudi::Property< double > m_beamSpotR
Radial covariance on th beam spot measurment.
std::string label(const std::string &format, int i)
Definition label.h:19
constexpr double timeToAthena(T actsT)
Converts a time unit from Acts to Athena units.
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 1 > Vector3D
StIndex
enum to classify the different station layers in the muon spectrometer
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex

◆ initialize()

StatusCode MuonR4::SegmentFittingAlg::initialize ( )
overridevirtual

Definition at line 66 of file SegmentFittingAlg.cxx.

66 {
67 ATH_CHECK(m_geoCtxKey.initialize());
68 ATH_CHECK(m_seedKey.initialize());
69 ATH_CHECK(m_outSegments.initialize());
70 ATH_CHECK(m_calibTool.retrieve());
71 ATH_CHECK(m_idHelperSvc.retrieve());
72 ATH_CHECK(m_visionTool.retrieve(EnableTool{!m_visionTool.empty()}));
73 SegmentAmbiSolver::Config cfg{};
74 m_ambiSolver = std::make_unique<SegmentAmbiSolver>(name(), std::move(cfg));
75
76 SegmentLineFitter::Config fitCfg{};
77 fitCfg.calibrator = m_calibTool.get();
78 fitCfg.visionTool = m_visionTool.get();
79 fitCfg.idHelperSvc = m_idHelperSvc.get();
80 fitCfg.fitT0 = m_doT0Fit;
81 fitCfg.recalibrate = m_recalibInFit;
82 fitCfg.useFastFitter = m_useFastFitter;
83 fitCfg.fastPreFitter = m_fastPreFitter;
84 fitCfg.ignoreFailedPreFit = m_ignoreFailedPreFit;
85 fitCfg.useHessian = m_hessianResidual;
86
87 fitCfg.doBeamSpot = m_doBeamspotConstraint;
88 fitCfg.beamSpotRadius = m_beamSpotR;
89 fitCfg.beamSpotLength = m_beamSpotL;
90
92 for (const auto* prop :{&m_seedMaxBsR, &m_seedMaxBsL}) {
93 if (prop->value().size() != s_stIdxMax ||
94 std::ranges::min(prop->value()) < 0.) {
95 ATH_MSG_ERROR("Invalid configuratnon of "<<(prop));
96 return StatusCode::FAILURE;
97 }
98 ATH_MSG_DEBUG("Configured "<<(*prop));
99 }
100 }
101 fitCfg.outlierRemovalCut = m_outlierRemovalCut;
102 fitCfg.recoveryPull = m_recoveryPull;
103 fitCfg.nPrecHitCut = m_precHitCut;
104 fitCfg.maxIter = m_maxIter;
105 ATH_MSG_DEBUG("Fitter configuration: \n -- "<<m_doT0Fit<<"\n -- "<<m_recalibInFit<<"\n -- "<<m_useFastFitter
106 <<"\n -- "<<m_fastPreFitter<<"\n -- "<<m_ignoreFailedPreFit<<"\n -- "<<m_hessianResidual
107 <<"\n -- "<<m_doBeamspotConstraint<<"\n -- "<<m_beamSpotR<<"\n -- "<<m_beamSpotL<<"\n -- "<<m_outlierRemovalCut
108 <<"\n -- "<<m_recoveryPull<<"\n -- "<<m_precHitCut<<"\n -- "<<m_maxIter);
109
110 m_fitter = std::make_unique<SegmentFit::SegmentLineFitter>(name(), std::move(fitCfg));
111
112 MdtSegmentSeedGenerator::Config genCfg{};
113 genCfg.hitPullCut = m_seedHitChi2;
114 genCfg.busyLayerLimit = m_busyLayerLimit;
115 genCfg.startWithPattern = m_tryPatternPars;
116 ATH_MSG_DEBUG("Seeder configuration: \n - "<<m_tryPatternPars
117 <<"\n - "<<m_seedHitChi2
118 <<"\n - "<<m_busyLayerLimit);
119 m_seeder = std::make_unique<SegmentFit::MdtSegmentSeedGenerator>(genCfg, makeActsAthenaLogger(this, name()));
120
121 //Cache station indices for quick access
122 const auto& mdtHelper = m_idHelperSvc->mdtIdHelper();
123 m_bilStation = mdtHelper.stationNameIndex("BIL");
124 m_bimStation = mdtHelper.stationNameIndex("BIM");
125 m_birStation = mdtHelper.stationNameIndex("BIR");
126
127 return StatusCode::SUCCESS;
128 }
#define ATH_MSG_ERROR(x,...)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition Logger.cxx:64
Gaudi::Property< unsigned > m_precHitCut
Minimum number of precision hits to accept the segment.
Gaudi::Property< bool > m_hessianResidual
Use the expliciit Hessian in the residual calculation.
Gaudi::Property< double > m_seedHitChi2
Two mdt seeds are the same if their defining parameters match wihin.
Gaudi::Property< bool > m_useFastFitter
Use the fast Mdt fitter where possible.
int m_birStation
Cached BIR station index for quick access.
Gaudi::Property< bool > m_recalibInFit
int m_bimStation
Cached BIM station index for quick access.
int m_bilStation
Cached BIL station index for quick access.
Gaudi::Property< bool > m_fastPreFitter
The fast fitter is treated as a pre fitter.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc.
Gaudi::Property< bool > m_ignoreFailedPreFit
Switch to try the full fit when the fast pre-fitter fails.
Gaudi::Property< bool > m_doT0Fit
static constexpr auto s_stIdxMax
Gaudi::Property< double > m_recoveryPull
Gaudi::Property< unsigned > m_maxIter
Tune the number of iterations.
Gaudi::Property< unsigned > m_busyLayerLimit
Cut on the number of hits per layer to use the layer for seeding.
Gaudi::Property< double > m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
Gaudi::Property< bool > m_tryPatternPars
Try first to fit the pattern parameters. Then proceed with the straw line tangents.

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

◆ makeBilRecoveryHits()

std::optional< SpacePointPerLayerSplitter::HitVec > MuonR4::SegmentFittingAlg::makeBilRecoveryHits ( const SegmentSeed & seed) const
private

For BIL (specifically around eta3 chambers), there are cases where only a single multilayer is crossed by the muon trajectory (because of the instrumentation gap) This function returns a set of recovery hits that are only from a multilayer which is crossed by the pattern seed.

Definition at line 352 of file SegmentFittingAlg.cxx.

352 {
353
354 const auto& mdtHelper = m_idHelperSvc->mdtIdHelper();
355
356 const MuonGMR4::MuonReadoutElement* crossedRE{nullptr};
357
358 // Find BIL readout elements crossed by the Hough trajectory.
359 for (const auto& chamber : seed.parentBucket()->chamberLocations()) {
360
361 const auto* readoutEle = chamber.readoutEle();
362 if (readoutEle->detectorType() != ActsTrk::DetectorType::Mdt) {
363 continue;
364 }
365 const Identifier id = readoutEle->identify();
366 //For now do this only for BIL stations (technically could be even more specific, BIL eta 3 or 4), choose int comparison instead?
367 if (mdtHelper.stationName(id) != m_bilStation) {
368 continue;
369 }
370
372 continue;
373 }
374
375 crossedRE = readoutEle;
376
377 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIL recovery: Hough trajectory crosses "
378 << m_idHelperSvc->toStringDetEl(id));
379 }
380
381 // BIL recovery is strictly a single crossed-ML recovery.
382 if (!crossedRE) {
383 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIL recovery rejected: trajectory crosses no BIL readout elements.");
384 return std::nullopt;
385 }
386
388 recoveryHits.reserve(seed.getHitsInMax().size());
389
390 std::size_t nMdtHits{0};
391
392 for (const SpacePoint* hit : seed.getHitsInMax()) {
393
394 // Preserve non-MDT hits.
396 recoveryHits.push_back(hit);
397 continue;
398 }
399 // Only MDT hits from the single geometrically crossed BIL RE.
400 if (hit->primaryMeasurement()->readoutElement() != crossedRE) {
401 continue;
402 }
403 recoveryHits.push_back(hit);
404 ++nMdtHits;
405 }
406
407 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIL recovery: keeping " << nMdtHits << " MDT hits from " << m_idHelperSvc->toStringDetEl( crossedRE->identify()));
408 return recoveryHits;
409}
Identifier identify() const override final
Return the ATLAS identifier.
Gaudi::Property< double > m_singleMlEdgeTolerance
Tolerance for the single multilayer edge crossing test, if the trajectory only slighty nicks the seco...
Gaudi::Property< double > m_singleMlPhiEdgeTolerance
Tolerance for the single multilayer edge crossing test in the phi projection in case the trajectory o...
std::vector< const SpacePoint * > HitVec
@ Mdt
MuonSpectrometer.
bool trajectoryPassesThroughChamber(const SpacePointBucket::chamberLocation &loc, const SegmentSeed &seed, double etaEdgeTolerance=25. *Gaudi::Units::mm, double phiEdgeTolerance=0.)
brief checks if the trajectory passes through the given chamber in local y,z plane if phiExtension is...

◆ makeBimBirRecoveryHits()

std::optional< SpacePointPerLayerSplitter::HitVec > MuonR4::SegmentFittingAlg::makeBimBirRecoveryHits ( const SegmentSeed & seed) const
private

BIM/BIR chambers are treated as the same sector, however, they don't overlap in many instances.

Therefore, Mdt segment seeding might fail in these cases. This function returns a set of recovery hits that are only either from BIM or BIR multilayers (and the neighbouring ones) compatible with the pattern seed.

Definition at line 412 of file SegmentFittingAlg.cxx.

412 {
413
414 // For BIM/BIR we rely on the phi extension to distinguish
415 // readout elements which overlap in the eta projection.
416 if (!seed.hasPhiExtension()) {
417 ATH_MSG_VERBOSE("BIM/BIR recovery rejected: seed has no phi extension.");
418 return std::nullopt;
419 }
420
421 const auto& mdtHelper = m_idHelperSvc->mdtIdHelper();
422 /*
423 * Use the geometrical crossing only to identify the recovery
424 * station family (BIM/BIR) and stationPhi.
425 *
426 * Do NOT use the crossed REs themselves for hit filtering:
427 * the Hough trajectory can be biased in eta by high occupancy.
428 */
429 std::optional<int> recoveryStation{};
430
431 for (const auto& chamber : seed.parentBucket()->chamberLocations()) {
432
433 const auto* readoutEle = chamber.readoutEle();
434 if (readoutEle->detectorType() != ActsTrk::DetectorType::Mdt) {
435 continue;
436 }
437
438 const Identifier id = readoutEle->identify();
439 const int station = mdtHelper.stationName(id);
440
441 //Don't care about other stations for now
442 if (station != m_bimStation && station != m_birStation) {
443 continue;
444 }
445 //Don't need any tolerance here
446 if (!trajectoryPassesThroughChamber(chamber, seed, 0., 0.)) {
447 continue;
448 }
449
450 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIM/BIR recovery: Hough trajectory crosses " << m_idHelperSvc->toStringDetEl(id));
451
452 // First crossed BIM/BIR RE defines the recovery region.
453 if (!recoveryStation) {
454 recoveryStation = station;
455 continue;
456 }
457
458 /*
459 * All geometrically crossed BIM/BIR REs must be compatible
460 * with the same station family
461 * Different eta and multilayer are explicitly allowed.
462 */
463 if (*recoveryStation != station){
464 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIM/BIR recovery rejected: crossed readout " "elements belong to different station/phi regions.");
465 return std::nullopt;
466 }
467 }
468 // No geometrically compatible BIM/BIR region.
469 if (!recoveryStation) {
470 return std::nullopt;
471 }
472
473 /*
474 * Now construct the recovery collection.
475 * Selection:
476 * - same BIM/BIR station family
477 * - ANY stationEta
478 * - ANY multilayer
479 * Only hits already belonging to this Hough seed are considered.
480 */
482 recoveryHits.reserve(seed.getHitsInMax().size());
483
484 std::size_t nMdtHits{0};
485 for (const SpacePoint* hit : seed.getHitsInMax()) {
486 //Preserve the non-MDT content of the original seed.
488 recoveryHits.push_back(hit);
489 continue;
490 }
491
492 const Identifier hitId = hit->identify();
493 if (mdtHelper.stationName(hitId) != *recoveryStation) {
494 continue;
495 }
496 recoveryHits.push_back(hit);
497 ++nMdtHits;
498
499 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIM/BIR recovery keeps MDT hit " << m_idHelperSvc->toString(hitId));
500 }
501
502 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - BIM/BIR recovery selected " << nMdtHits << " MDT hits from station " << mdtHelper.stationNameString(*recoveryStation));
503
504 if (nMdtHits == 0) {
505 return std::nullopt;
506 }
507
508 return recoveryHits;
509}

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

◆ resolveAmbiguities()

void MuonR4::SegmentFittingAlg::resolveAmbiguities ( const ActsTrk::GeometryContext & gctx,
SegmentVec_t & segmentCandidates ) const
private

Resolve the ambiguity amongst the segment candidates within a spectrometer sector.

Segments are rejected if they share hits with other segments and if they have poorer quality.

Parameters
gctxGeometryContext to compare the local parameters
segmentCandidatesThe list of segments to be resolved

Definition at line 323 of file SegmentFittingAlg.cxx.

324 {
325 if (segmentCandidates.empty()) {
326 return;
327 }
328 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - resolveAmbiguities() - Resolve ambiguities amongst "
329 <<segmentCandidates.size()<<" segment candidates.");
330 std::map<const MuonGMR4::SpectrometerSector*, SegmentVec_t,
331 MuonGMR4::MuonDetectorManager::MSEnvelopeSorter> candidatesPerChamber{};
332
333 for (std::unique_ptr<Segment>& sortMe : segmentCandidates) {
334 const MuonGMR4::SpectrometerSector* chamb = sortMe->msSector();
335 candidatesPerChamber[chamb].push_back(std::move(sortMe));
336 }
337 segmentCandidates.clear();
338 for (auto& [chamber, resolveMe] : candidatesPerChamber) {
339 const std::size_t nBefore = resolveMe.size();
340 SegmentVec_t resolvedSegments = m_ambiSolver->resolveAmbiguity(gctx, std::move(resolveMe));
341 ATH_MSG_DEBUG("resolveAmbiguities() - "<<resolvedSegments.size()<<"/"<<nBefore
342 <<" segments survived ambiguity solving in "<<chamber->identString()<<".");
343 segmentCandidates.insert(segmentCandidates.end(),
344 std::make_move_iterator(resolvedSegments.begin()),
345 std::make_move_iterator(resolvedSegments.end()));
346 }
347 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Ambiguity solving done "<<segmentCandidates.size()<<" survived.");
348 }

◆ 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_WARNING(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 }

Member Data Documentation

◆ m_allowSegmentSeedingFallback

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_allowSegmentSeedingFallback {this, "allowSegmentSeedingFallback", true}
private

Allow single multilayer fallback when standard segment reconstruction fails.

Definition at line 135 of file SegmentFittingAlg.h.

135{this, "allowSegmentSeedingFallback", true};

◆ m_ambiSolver

std::unique_ptr<SegmentFit::SegmentAmbiSolver> MuonR4::SegmentFittingAlg::m_ambiSolver {}
private

Pointer to the ambiguity reosolution.

Definition at line 128 of file SegmentFittingAlg.h.

128{};

◆ m_beamSpotL

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotL {this, "BeamSpotLength", 2. * Gaudi::Units::m}
private

Longitudinal covariance on the beam spo measurement.

Definition at line 97 of file SegmentFittingAlg.h.

97{this, "BeamSpotLength", 2. * Gaudi::Units::m};

◆ m_beamSpotR

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm}
private

Radial covariance on th beam spot measurment.

Definition at line 95 of file SegmentFittingAlg.h.

95{this, "BeamSpotRadius", 30.* Gaudi::Units::cm};

◆ m_bilStation

int MuonR4::SegmentFittingAlg::m_bilStation {-1}
private

Cached BIL station index for quick access.

Definition at line 144 of file SegmentFittingAlg.h.

144{-1};

◆ m_bimStation

int MuonR4::SegmentFittingAlg::m_bimStation {-1}
private

Cached BIM station index for quick access.

Definition at line 146 of file SegmentFittingAlg.h.

146{-1};

◆ m_birStation

int MuonR4::SegmentFittingAlg::m_birStation {-1}
private

Cached BIR station index for quick access.

Definition at line 148 of file SegmentFittingAlg.h.

148{-1};

◆ m_busyLayerLimit

Gaudi::Property<unsigned> MuonR4::SegmentFittingAlg::m_busyLayerLimit {this, "busyLayerLimit", 4}
private

Cut on the number of hits per layer to use the layer for seeding.

Definition at line 126 of file SegmentFittingAlg.h.

126{this, "busyLayerLimit", 4};

◆ m_calibTool

ToolHandle<ISpacePointCalibrator> MuonR4::SegmentFittingAlg::m_calibTool {this, "Calibrator", "" }
private

Handle to the space point calibrator.

Definition at line 82 of file SegmentFittingAlg.h.

82{this, "Calibrator", "" };

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

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doBeamspotConstraint {this, "doBeamspotConstraint", false}
private

Add beamline constraint.

Definition at line 93 of file SegmentFittingAlg.h.

93{this, "doBeamspotConstraint", false};

◆ m_doT0Fit

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doT0Fit {this, "fitSegmentT0", true}
private

Definition at line 86 of file SegmentFittingAlg.h.

86{this, "fitSegmentT0", true};

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

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_fastPreFitter {this, "useFastPreFitter", false}
private

The fast fitter is treated as a pre fitter.

Definition at line 120 of file SegmentFittingAlg.h.

120{this, "useFastPreFitter", false};

◆ m_fitter

std::unique_ptr<SegmentFit::SegmentLineFitter> MuonR4::SegmentFittingAlg::m_fitter {}
private

Pointer to the actual segment fitter.

Definition at line 130 of file SegmentFittingAlg.h.

130{};

◆ m_geoCtxKey

ActsTrk::GeoContextReadKey_t MuonR4::SegmentFittingAlg::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
private

Definition at line 78 of file SegmentFittingAlg.h.

78{this, "AlignmentKey", "ActsAlignment", "cond handle key"};

◆ m_hessianResidual

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_hessianResidual {this, "useHessianResidual", false}
private

Use the expliciit Hessian in the residual calculation.

Definition at line 91 of file SegmentFittingAlg.h.

91{this, "useHessianResidual", false};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::SegmentFittingAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

IdHelperSvc.

Definition at line 80 of file SegmentFittingAlg.h.

80{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_ignoreFailedPreFit

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_ignoreFailedPreFit {this, "ignoreFailedPreFit", false}
private

Switch to try the full fit when the fast pre-fitter fails.

Definition at line 122 of file SegmentFittingAlg.h.

122{this, "ignoreFailedPreFit", false};

◆ m_maxIter

Gaudi::Property<unsigned> MuonR4::SegmentFittingAlg::m_maxIter {this, "maxIterations", 50}
private

Tune the number of iterations.

Definition at line 124 of file SegmentFittingAlg.h.

124{this, "maxIterations", 50};

◆ m_outlierRemovalCut

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_outlierRemovalCut {this, "OutlierRemoval", 5.}
private

Cut on the segment chi2 / nDoF to launch the outlier removal.

Definition at line 113 of file SegmentFittingAlg.h.

113{this, "OutlierRemoval", 5.};

◆ m_outSegments

SG::WriteHandleKey<SegmentContainer> MuonR4::SegmentFittingAlg::m_outSegments {this, "OutSegmentContainer", "R4MuonSegments"}
private

Definition at line 76 of file SegmentFittingAlg.h.

76{this, "OutSegmentContainer", "R4MuonSegments"};

◆ m_precHitCut

Gaudi::Property<unsigned> MuonR4::SegmentFittingAlg::m_precHitCut {this, "PrecHitCut" , 3}
private

Minimum number of precision hits to accept the segment.

Definition at line 116 of file SegmentFittingAlg.h.

116{this, "PrecHitCut" , 3};

◆ m_recalibInFit

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_recalibInFit {this, "recalibInFit" , false}
private

Definition at line 87 of file SegmentFittingAlg.h.

87{this, "recalibInFit" , false};

◆ m_recalibSeed

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_recalibSeed {this, "SeedRecalibrate", false}
private

Toggle seed recalibration.

The two seed circles are recalibrated using the initial seed

Definition at line 111 of file SegmentFittingAlg.h.

111{this, "SeedRecalibrate", false};

◆ m_recoveryPull

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_recoveryPull {this, "RecoveryPull", 5.}
private

Definition at line 114 of file SegmentFittingAlg.h.

114{this, "RecoveryPull", 5.};

◆ m_seeder

std::unique_ptr<SegmentFit::MdtSegmentSeedGenerator> MuonR4::SegmentFittingAlg::m_seeder {}
private

Pointer to the L-R segment seeder.

Definition at line 132 of file SegmentFittingAlg.h.

132{};

◆ m_seedHitChi2

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. }
private

Two mdt seeds are the same if their defining parameters match wihin.

Definition at line 108 of file SegmentFittingAlg.h.

108{this, "ResoSeedHitAssoc", 5. };

◆ m_seedKey

SG::ReadHandleKey<SegmentSeedContainer> MuonR4::SegmentFittingAlg::m_seedKey {this, "ReadKey", "MuonHoughStationSegmentSeeds"}
private

ReadHandle of the seeds.

Definition at line 74 of file SegmentFittingAlg.h.

74{this, "ReadKey", "MuonHoughStationSegmentSeeds"};

◆ m_seedMaxBsL

Gaudi::Property<std::vector<double> > MuonR4::SegmentFittingAlg::m_seedMaxBsL
private
Initial value:
{this, "SeedMaxDistanceBsLength",
std::vector<double>(s_stIdxMax, 2.)}

Definition at line 104 of file SegmentFittingAlg.h.

104 {this, "SeedMaxDistanceBsLength",
105 std::vector<double>(s_stIdxMax, 2.)};

◆ m_seedMaxBsR

Gaudi::Property<std::vector<double> > MuonR4::SegmentFittingAlg::m_seedMaxBsR
private
Initial value:
{this, "SeedMaxDistanceBsRadius",
std::vector<double>(s_stIdxMax, 2.)}

Maximum allowed distance of the segment seed line to the beam spot measurement expressed in relative units of the beamspot radius.

The threshold may be relaxed for particular station indices.

Definition at line 102 of file SegmentFittingAlg.h.

102 {this, "SeedMaxDistanceBsRadius",
103 std::vector<double>(s_stIdxMax, 2.)};

◆ m_singleMlEdgeTolerance

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_singleMlEdgeTolerance { this, "SingleMlEdgeTolerance", 50. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local precision coordinate"}
private

Tolerance for the single multilayer edge crossing test, if the trajectory only slighty nicks the second ML still consider as one ML case.

Definition at line 138 of file SegmentFittingAlg.h.

138{ this, "SingleMlEdgeTolerance", 50. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local precision coordinate"};

◆ m_singleMlPhiEdgeTolerance

Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_singleMlPhiEdgeTolerance { this, "SingleMlPhiEdgeTolerance", 0. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local phi coordinate"}
private

Tolerance for the single multilayer edge crossing test in the phi projection in case the trajectory only slightly nicks one of the ML.

Definition at line 141 of file SegmentFittingAlg.h.

141{ this, "SingleMlPhiEdgeTolerance", 0. * Gaudi::Units::mm, "For Single-ML fallback to not trigger, the trajectory has to penetrate at least this much into the second multilayer (from either side) in local phi coordinate"};

◆ m_tryPatternPars

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_tryPatternPars {this, "tryPatternPars", false}
private

Try first to fit the pattern parameters. Then proceed with the straw line tangents.

Definition at line 89 of file SegmentFittingAlg.h.

89{this, "tryPatternPars", false};

◆ m_useFastFitter

Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_useFastFitter {this, "useFastFitter", true}
private

Use the fast Mdt fitter where possible.

Definition at line 118 of file SegmentFittingAlg.h.

118{this, "useFastFitter", true};

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

◆ m_visionTool

ToolHandle<MuonValR4::IPatternVisualizationTool> MuonR4::SegmentFittingAlg::m_visionTool {this, "VisualizationTool", ""}
private

Pattern visualization tool.

Definition at line 84 of file SegmentFittingAlg.h.

84{this, "VisualizationTool", ""};

◆ s_stIdxMax

auto MuonR4::SegmentFittingAlg::s_stIdxMax = Acts::toUnderlying(Muon::MuonStationIndex::StIndex::StIndexMax)
staticconstexprprivate

Definition at line 98 of file SegmentFittingAlg.h.


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