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

#include <SegmentActsRefitAlg.h>

Inheritance diagram for MuonR4::SegmentActsRefitAlg:

Public Types

using Propagator_t = Acts::Propagator<Acts::StraightLineStepper, Acts::Navigator>
 Type erased track fitter function.
using Fitter_t = Acts::Experimental::Gx2Fitter<Propagator_t, ActsTrk::MutableTrackStateBackend>
using Gx2FitterOptions_t = Acts::Experimental::Gx2FitterOptions<ActsTrk::MutableTrackStateBackend>
 Abbrivation of the configuration to launch the fit.
using Gx2FitterExtension_t = Acts::Experimental::Gx2FitterExtensions<ActsTrk::MutableTrackStateBackend>
 Abbrivation of the fitter extensions.

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 unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

const Acts::Surface * portalSurface (const xAOD::UncalibratedMeasurement *measurement, bool entrance) const
 Returns the entrance / exit portal surface of the tracking volume associated with the measurement surface.
std::tuple< Amg::Vector3D, Amg::Vector3DsmearSegment (const ActsTrk::GeometryContext &gctx, const MuonR4::Segment &segment, CLHEP::HepRandomEngine *engine) const
 Smear the segment's position and direction by one sigma defined by the segment's covariance.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::MuonSegmentContainerm_readKey {this, "SegmentContainer", "MuonSegmentsFromR4"}
 Declare the data dependency on the standard Mdt+Rpc+Tgc segment container.
SG::WriteHandleKey< xAOD::MuonSegmentContainerm_writeKey {this, "OutContainer", "ActsRefitSegments"}
 Declare the key for the refitted segment container.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainerm_linkKey {this, "LinkKey", m_writeKey, "prefitSegmentLink"}
 Construct a link from the refitted segment to the input segment.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainerm_localParsKey {this, "LocalParsKey", m_writeKey, "localSegPars"}
 Decorate directly the local segment parameters on to the object.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainerm_seedParsKey {this, "SeedParsKey", m_readKey, "seedSegPars"}
 Decorate the seed parameters entering the fit.
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 IdHelperSvc to decode the Identifiers.
PublicToolHandle< ActsTrk::ITrackingGeometryToolm_trackingGeometryTool {this, "TrackingGeometryTool", ""}
 Tracking geometry tool.
ToolHandle< ActsTrk::IExtrapolationToolm_extrapolationTool {this, "ExtrapolationTool" ,"" }
 Track extrapolation tool.
ToolHandle< MuonR4::ISegmentSelectionToolm_segSelector {this, "SegmentSelectionTool" , "" }
 Segment selection tool to pick the good quality segments.
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc", ""}
 Range service to smear the segment parameters.
Gaudi::Property< double > m_smearRange {this, "SmearRange", 1.}
 Smear interval in terms of standard deviations.
ToolHandle< ISpacePointCalibratorm_calibTool {this, "Calibrator", "" }
 Handle to the space point calibrator.
Gaudi::Property< bool > m_drawEvent {this , "drawEvent", false }
 Dump the segment line in obj files.
ActsTrk::AuxiliaryMeasurementHandler m_auxMeasProv {this}
const MuonGMR4::MuonDetectorManagerm_detMgr {nullptr}
 Detector manager to access the spectrometer sector surfaces.
Gaudi::Property< bool > m_smearSegPars {this, "smearSegPars", true}
Gaudi::Property< unsigned > m_maxPropSteps {this,"maxPropagationSteps", 100000}
 Maximum number of propagation steps.
Gaudi::Property< unsigned > m_maxTargetSurfSkip {this, "maxTargetSurfSkip", 100000}
 Maximum number of target surfaces.
Gaudi::Property< unsigned > m_maxIter {this, "maxIter", 50}
 Maximum number of iterations.
Gaudi::Property< bool > m_doJacobianCorr {this,"freeToBoundJacobian", true}
 Free to bound Jacobian correction.
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfAccessor {}
 Surface accessor delegate for xAOD::UncalibratedMeasurement objects.
Gx2FitterExtension_t m_fitExtension {}
 Fitter setup.
std::unique_ptr< Fitter_tm_fitter {}
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 45 of file SegmentActsRefitAlg.h.

Member Typedef Documentation

◆ Fitter_t

Definition at line 54 of file SegmentActsRefitAlg.h.

◆ Gx2FitterExtension_t

Abbrivation of the fitter extensions.

Definition at line 59 of file SegmentActsRefitAlg.h.

◆ Gx2FitterOptions_t

Abbrivation of the configuration to launch the fit.

Definition at line 57 of file SegmentActsRefitAlg.h.

◆ Propagator_t

using MuonR4::SegmentActsRefitAlg::Propagator_t = Acts::Propagator<Acts::StraightLineStepper, Acts::Navigator>

Type erased track fitter function.

Definition at line 53 of file SegmentActsRefitAlg.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ cardinality()

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

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

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonR4::SegmentActsRefitAlg::execute ( const EventContext & ctx) const
finaloverridevirtual

Create the context object

Random engine to smear the segment parameters

Loop over the segment container

Fetch a smeared segment position & direction

Decorate the initial seed parameters to the segment

Fetch the measurements

We add two pseudo measurements above & beneath the segment to stabilize the fit

Draw the reference segment as a red line

Place the target surface close to the entrance portal

Bounds are purely for visualization purposes.

Fetch the measurements from the track state

Direction is always expressed in global frame -> transform to local

Express the parameters at the reference surface of the original segment

Straight line extension to plane

Definition at line 124 of file SegmentActsRefitAlg.cxx.

124 {
125
126 const xAOD::MuonSegmentContainer* segments{nullptr};
127 ATH_CHECK(SG::get(segments, m_readKey, ctx));
129 const ActsTrk::GeometryContext& gctx{m_trackingGeometryTool->getGeometryContext(ctx)};
130 const std::shared_ptr<const Acts::TrackingGeometry> trackingGeo = m_trackingGeometryTool->trackingGeometry();
131 const Acts::GeometryContext tgContext = gctx.context();
132 const Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
133 const Acts::CalibrationContext calContext = ActsTrk::getCalibrationContext(ctx);
134
136 ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, name());
137 rngWrapper->setSeed(name(), ctx);
138 CLHEP::HepRandomEngine* randEngine = rngWrapper->getEngine(ctx);
139
140 SG::WriteHandle outHandle{m_writeKey, ctx};
141 ATH_CHECK(outHandle.record(std::make_unique<xAOD::MuonSegmentContainer>(),
142 std::make_unique<xAOD::MuonSegmentAuxContainer>()));
143
144
145 auto handleCreation = m_auxMeasProv.makeHandle(ctx, tgContext);
146 if (!handleCreation.ok()){
147 ATH_MSG_ERROR("Auxiliary measurement containers cannot be made");
148 return StatusCode::FAILURE;
149 }
150 auto& auxMeasHandle{*handleCreation};
151 using Link_t = ElementLink<xAOD::MuonSegmentContainer>;
152 SG::WriteDecorHandle<xAOD::MuonSegmentContainer, Link_t> dec_segLink{m_linkKey, ctx};
153 using ParDecor_t = SG::WriteDecorHandle<xAOD::MuonSegmentContainer,
154 xAOD::MeasVector<Acts::toUnderlying(ParamDefs::nPars)>>;
155
156 ParDecor_t dec_locPars{m_localParsKey, ctx};
157 ParDecor_t dec_seedPars{m_seedParsKey, ctx};
158
159 SeedingAux::Config cfg{};
160 cfg.parsToUse.clear();
161 SeedingAux pullCalculator{cfg, makeActsAthenaLogger(this, "PullCalculator")};
162
163 SeedingAux::Line_t line{};
164
165 Acts::PropagatorPlainOptions propagationOption{tgContext, mfContext};
166 propagationOption.maxSteps = m_maxPropSteps;
167 propagationOption.maxTargetSkipping = m_maxTargetSurfSkip;
168 constexpr bool doScat = false;
169 constexpr bool doEloss = false;
170 Gx2FitterOptions_t fitOptions{tgContext, mfContext, calContext, m_fitExtension,
171 std::move(propagationOption),
172 nullptr, doScat, doEloss,
173 Acts::FreeToBoundCorrection{m_doJacobianCorr},
174 m_maxIter};
175
179 Acts::ObjVisualization3D visualHelper{};
180
181
182 for (const xAOD::MuonSegment* reFitMe: *segments){
183 auto saveDisplay = [&](const std::string& state) {
184 if (!m_drawEvent) {
185 return;
186 }
187 const auto objFile = std::format("SegmentReFitTest_{:}_{:}_{:}_{:}.obj",
188 state, ctx.eventID().event_number(), reFitMe->index(),
189 MuonR4::printID(*reFitMe));
190 visualHelper.write(objFile);
191 ATH_MSG_DEBUG("Save event display under "<<objFile);
192 visualHelper = Acts::ObjVisualization3D{};
193 };
194
195 const MuonGMR4::SpectrometerSector* msSector =
196 m_detMgr->getSectorEnvelope(reFitMe->chamberIndex(),
197 reFitMe->sector(),
198 reFitMe->etaIndex());
199 const Amg::Transform3D& sectorTrf{msSector->localToGlobalTransform(gctx)};
200 const Amg::Vector3D planeNormal = sectorTrf.linear().col(2);
201
202 m_calibTool->stampSignsOnMeasurements(*reFitMe);
203 line.updateParameters(localSegmentPars(gctx, *MuonR4::detailedSegment(*reFitMe)));
205 const auto [seedPos, seedDir] = smearSegment(gctx, *MuonR4::detailedSegment(*reFitMe), randEngine);
207 {
208 const Amg::Transform3D invTrf = sectorTrf.inverse();
209 const Amg::Vector3D locSeedPos = invTrf * seedPos;
210 const Amg::Vector3D locSeedDir = invTrf.linear() * seedDir;
211 auto& seedPars = dec_seedPars(*reFitMe);
212 seedPars[Acts::toUnderlying(ParamDefs::x0)] = locSeedPos.x();
213 seedPars[Acts::toUnderlying(ParamDefs::y0)] = locSeedPos.y();
214 seedPars[Acts::toUnderlying(ParamDefs::theta)] = locSeedDir.theta();
215 seedPars[Acts::toUnderlying(ParamDefs::phi)] = locSeedDir.phi();
216 }
217
218 const GeoTrf::CoordEulerAngles sectorAngles = GeoTrf::getCoordRotationAngles(sectorTrf);
220 std::vector<const xAOD::UncalibratedMeasurement*> hitsToFit = MuonR4::collectMeasurements(*reFitMe);
221
222 // Identify the first measurement in the chamber volume. Skip the first one if it
223 // is the beamspot
224 const xAOD::UncalibratedMeasurement* entrance =
225 hitsToFit.front()->type() != xAOD::UncalibMeasType::Other ?
226 hitsToFit.front() : hitsToFit.at(1);
227 // Fetch the entrance & exit portals from the geometry
228 const Acts::Surface* entrancePortal = portalSurface(entrance, true);
229 const Acts::Surface* exitPortal = portalSurface(hitsToFit.back(), false);
230 ATH_MSG_DEBUG("Entrance portal: "
231 <<entrancePortal->geometryId()<<"/"<<m_idHelperSvc->toString(xAOD::identify(entrance))
232 <<", exit portal: "<<exitPortal->geometryId()<<"/"<<m_idHelperSvc->toString(xAOD::identify(hitsToFit.back())));
233
234 using namespace Acts::PlanarHelper;
235
236 const Acts::Intersection3D isectEntrance = intersectPlane(seedPos, seedDir, planeNormal,
237 entrancePortal->center(tgContext));
238 const Acts::Intersection3D isectFirst = intersectPlane(seedPos, seedDir, planeNormal,
239 m_surfAccessor.get(hitsToFit.front())->center(tgContext));
240
241 if (reFitMe->nPhiLayers() < 1) {
242
243 const Acts::Intersection3D isectExit = intersectPlane(seedPos, seedDir, planeNormal,
244 exitPortal->center(tgContext));
245 const Acts::Intersection3D isectLast = intersectPlane(seedPos, seedDir, planeNormal,
246 m_surfAccessor.get(hitsToFit.back())->center(tgContext));
247
249
250 const Amg::Transform3D trfBeneath = GeoTrf::GeoTransformRT{sectorAngles, 0.5*isectFirst.position() +
251 0.5*isectEntrance.position()};
252 const Amg::Transform3D trfAbove = GeoTrf::GeoTransformRT{sectorAngles, 0.85*isectExit.position() +
253 0.15*isectLast.position() };
254
255 auto surfBeneath = Acts::Surface::makeShared<Acts::PlaneSurface>(trfBeneath);
256 auto surfAbove = Acts::Surface::makeShared<Acts::PlaneSurface>(trfAbove);
257 ATH_MSG_DEBUG("Add auxiliary measurements @ "<<Amg::toString(surfBeneath->center(tgContext))
258 <<" and @"<<Amg::toString(surfAbove->center(tgContext)));
259
260 constexpr double covVal = Acts::square(1._cm);
261 hitsToFit.push_back(auxMeasHandle.newMeasurement<1>(surfBeneath, ProjectorType::e1DimNoTime, AmgSymMatrix(1){covVal}));
262 if (m_drawEvent) {
263 MuonValR4::drawMeasurement(gctx, hitsToFit.back(), visualHelper, Acts::s_viewGrid);
264 }
265 hitsToFit.push_back(auxMeasHandle.newMeasurement<1>(surfAbove, ProjectorType::e1DimNoTime, AmgSymMatrix(1){covVal}));
266 if (m_drawEvent) {
267 MuonValR4::drawMeasurement(gctx, hitsToFit.back(), visualHelper, Acts::s_viewGrid);
268 }
269 }
270
271 if (m_drawEvent) {
272 Acts::GeometryView3D::drawSurface(visualHelper, *entrancePortal, tgContext,
273 Amg::Transform3D::Identity(), Acts::s_viewPortal);
274 Acts::GeometryView3D::drawSurface(visualHelper, *exitPortal, tgContext,
275 Amg::Transform3D::Identity(), Acts::s_viewPortal);
276
278 MuonValR4::drawSegmentLine(gctx, *reFitMe, visualHelper,
279 Acts::ViewConfig{.color = {220, 0, 0}});
280 MuonValR4::drawSegmentMeasurements(gctx, *reFitMe, visualHelper, Acts::s_viewSurface);
281 }
282 ATH_MSG_VERBOSE("Entrance position "<<Amg::toString(isectEntrance.position())
283 <<", path length: "<<isectEntrance.pathLength()<<", "
284 <<" - First surface position: "<<Amg::toString(isectFirst.position())
285 <<", path length: "<<isectFirst.pathLength());
287
288 Amg::Vector3D refPos = 0.85 * isectEntrance.position()
289 + 0.15 * isectFirst.position();
290 const Amg::Transform3D trf{GeoTrf::GeoTransformRT{sectorAngles, refPos}};
291 if (msgLvl(MSG::VERBOSE)) {
292 const auto [locPos, locDir] = makeLine(localSegmentPars(*reFitMe));
293
294 std::stringstream sstr{};
295 sstr<<"pos: "<<Amg::toString(seedPos)<<", dir: "<<Amg::toString(seedDir)<<", chi2/nDoF: "
296 <<reFitMe->chiSquared() / reFitMe->numberDoF()<<", nDoF: "<<reFitMe->numberDoF()
297 <<", prec: "<<reFitMe->nPrecisionHits()<<", phi: "<<reFitMe->nPhiLayers()<<std::endl;
298 for (const auto& meas : MuonR4::detailedSegment(*reFitMe)->measurements()) {
299 pullCalculator.updateSpatialResidual(line, *meas);
300 const Acts::Surface* surface = meas->spacePoint() ? m_surfAccessor.get(meas->spacePoint()->primaryMeasurement()) : nullptr;
301 const Acts::GeometryIdentifier geoId = surface ? surface->geometryId() : Acts::GeometryIdentifier{};
302 sstr<<" **** "<<(*meas)<<", chi2: "<<SeedingAux::chi2Term(locPos, locDir, *meas)
303 <<", sign: "<<(meas->isStraw() ?
304 (SeedingAux::strawSign(locPos,locDir, *meas) == 1 ? "R" : "L") : "X")
305 <<", geoId: "<<geoId;
306 if (geoId != Acts::GeometryIdentifier{}){
307 const Amg::Vector3D globPos = meas->spacePoint()->msSector()->localToGlobalTransform(gctx) *
308 meas->localPosition();
309 const Acts::GeometryIdentifier volId = geoId.withSensitive(0);
310 const Acts::TrackingVolume* volume = m_trackingGeometryTool->trackingGeometry()->findVolume(volId);
311 const Acts::Vector2 lPos = (*surface->globalToLocal(tgContext,globPos, reFitMe->direction()));
312 sstr<<", inside volume: "<<volume->inside(tgContext, globPos);
313 sstr<<", inside surface: "<<surface->bounds().inside(lPos);
314
315 }
316 sstr<<std::endl;
317 }
318
319 sstr<<" Target surf: "<<Amg::toString(trf)<<", firstSurf: "
320 << Amg::toString(trf.inverse()*isectFirst.position())
321 <<", refPoint: "<<Amg::toString(trf.inverse()*refPos)<<std::endl;
322 ATH_MSG_VERBOSE("Run G2F fit on "<<msSector->identString()<<std::endl<<sstr.str());
323 }
324 // Specify the surface on which the segment will be expressed.
325 std::shared_ptr<const Acts::Surface> target{};
326 if (hitsToFit.front()->type() == xAOD::UncalibMeasType::Other) {
327 target = m_surfAccessor.get(hitsToFit.front())->getSharedPtr();
328 using namespace Acts::detail::LineHelper;
329 const Acts::Intersection3D lineIsect =
330 lineIntersect<3>(target->center(tgContext),
331 Amg::Vector3D::UnitZ(),
332 seedPos, seedDir);
333 // Also update the start position to be the closest point of approach
334 // to the beamspot
335 refPos = lineIsect.position();
336 } else {
338 target = Acts::Surface::makeShared<Acts::PlaneSurface>(trf,
339 std::make_unique<Acts::RectangleBounds>(1._m, 1._m));
340 }
341 if (m_drawEvent) {
342 Acts::GeometryView3D::drawSurface(visualHelper, *target,
343 tgContext, Amg::Transform3D::Identity(),
344 Acts::ViewConfig{.color={0,0,220}});
345 }
346
347 Acts::Vector<4> fourPos{ActsTrk::convertPosToActs(refPos, refPos.mag() / Gaudi::Units::c_light)};
348 Acts::BoundMatrix initialCov{Acts::BoundMatrix::Identity()};
349
350 auto initialPars = Acts::BoundTrackParameters::create(tgContext, target, fourPos, seedDir, straightQoverP,
351 initialCov, Acts::ParticleHypothesis::muon());
352 if (!initialPars.ok()) {
353 ATH_MSG_WARNING("Initial estimate of the parameters failed");
354 saveDisplay("invalidPars");
355 continue;
356 }
357 if (m_drawEvent) {
358 MuonValR4::drawBoundParameters(gctx, *initialPars, visualHelper,
359 Acts::ViewConfig{.color={0,220,0}});
360 }
361 ATH_MSG_DEBUG("Initial parameters -- (loc0, loc1): "<<Amg::toString((*initialPars).localPosition())
362 <<", "<<std::format("theta: {:.2f}, ", (*initialPars).theta() / 1._degree)
363 <<std::format("phi: {:.2f}", (*initialPars).phi() / 1._degree));
364
365 std::vector<Acts::SourceLink> sourceLinks{};
366 std::ranges::transform(hitsToFit, std::back_inserter(sourceLinks),
367 [](const xAOD::UncalibratedMeasurement* meas) {
369 });
370 fitOptions.referenceSurface = target.get();
371
372 auto fitTraject = m_fitter->fit(sourceLinks.begin(), sourceLinks.end(),
373 *initialPars, fitOptions, tracks);
374 if (!fitTraject.ok()) {
375 saveDisplay("failed");
376 if (m_smearSegPars) {
377 ATH_MSG_WARNING("Track fit failed.");
378 continue;
379 } else {
380 ATH_MSG_ERROR("Segment refit failed. Albeit start parameters are taken from segment");
381 return StatusCode::FAILURE;
382 }
383 }
384
385 auto track = *fitTraject;
386 ATH_MSG_DEBUG("Track fit succeeded. ");
387
388 Acts::BoundTrackParameters parameters = track.createParametersAtReference();
389 if (m_drawEvent) {
390 MuonValR4::drawBoundParameters(gctx, parameters, visualHelper,
391 Acts::ViewConfig{.color={0,220,220}});
392
393 }
394 saveDisplay("goodone");
395
396 MuonR4::Segment::HitSummary summary{};
398 std::vector<const xAOD::UncalibratedMeasurement*> goodMeas{};
399 unsigned int itr{0};
400 tracks.trackStateContainer().visitBackwards(track.tipIndex(),[&](const auto& state){
401 if (!state.hasUncalibratedSourceLink()){
402 return;
403 }
404 goodMeas.insert(goodMeas.begin(),
405 ActsTrk::detail::xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink()));
406
407 ATH_MSG_VERBOSE("Loop over track state: "<<(itr++)<<", "<<m_idHelperSvc->toString(xAOD::identify(goodMeas.front()))
408 <<", id: "<<m_surfAccessor.get(goodMeas.front())->geometryId());
409
410 const xAOD::UncalibratedMeasurement* m = goodMeas.front();
411 const bool isPrecHit = (m->type() == xAOD::UncalibMeasType::MdtDriftCircleType ||
414 !m_idHelperSvc->measuresPhi(xAOD::identify(m))));
415
416 summary.nPrecHits += isPrecHit;
417 if (m->type() == xAOD::UncalibMeasType::Other ||
418 m_idHelperSvc->measuresPhi(xAOD::identify(m))){
419 ++summary.nPhiHits;
420 } else {
421 summary.nEtaTrigHits += !isPrecHit;
422 }
423 });
424
426 const Amg::Vector3D globDir = parameters.direction();
428 const Amg::Transform3D globToLoc{sectorTrf.inverse()};
429 const Amg::Vector3D refitPos = globToLoc * parameters.position(tgContext);
430 const Amg::Vector3D refitDir = globToLoc.linear() * globDir;
432 const Amg::Vector3D refitSeg = refitPos + Amg::intersect<3>(refitPos, refitDir, Amg::Vector3D::UnitZ(), 0).value_or(0.) * refitDir;
433 const Amg::Vector3D globPos{msSector->localToGlobalTransform(gctx) * refitSeg};
434
435 xAOD::MuonSegment* newSegment = outHandle->push_back(std::make_unique<xAOD::MuonSegment>());
436 dec_segLink(*newSegment) = Link_t{*segments, reFitMe->index(), ctx};
437
438 newSegment->setDirection(globDir.x(), globDir.y(), globDir.z());
439 newSegment->setPosition(globPos.x(), globPos.y(), globPos.z());
440
441 newSegment->setFitQuality(track.chi2(), track.nDoF());
442 newSegment->setNHits(summary.nPrecHits, summary.nPhiHits, summary.nEtaTrigHits);
443 auto& locFitPars = dec_locPars(*newSegment);
444 locFitPars[Acts::toUnderlying(ParamDefs::x0)] = refitSeg.x();
445 locFitPars[Acts::toUnderlying(ParamDefs::y0)] = refitSeg.y();
446 locFitPars[Acts::toUnderlying(ParamDefs::theta)] = refitDir.theta();
447 locFitPars[Acts::toUnderlying(ParamDefs::phi)] = refitDir.phi();
448 }
449 return StatusCode::SUCCESS;
450 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define AmgSymMatrix(dim)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
Acts::GeometryContext context() const
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
static Acts::SourceLink pack(const xAOD::UncalibratedMeasurement *meas)
Helper method to pack an uncalibrated measurement to an Acts source link.
bool msgLvl(const MSG::Level lvl) const
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the local -> global tarnsformation from the sector.
std::string identString() const
Returns a string encoding the chamber index & the sector of the MS sector.
ServiceHandle< IAthRNGSvc > m_rndmSvc
Range service to smear the segment parameters.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_localParsKey
Decorate directly the local segment parameters on to the object.
const MuonGMR4::MuonDetectorManager * m_detMgr
Detector manager to access the spectrometer sector surfaces.
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator.
std::tuple< Amg::Vector3D, Amg::Vector3D > smearSegment(const ActsTrk::GeometryContext &gctx, const MuonR4::Segment &segment, CLHEP::HepRandomEngine *engine) const
Smear the segment's position and direction by one sigma defined by the segment's covariance.
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfAccessor
Surface accessor delegate for xAOD::UncalibratedMeasurement objects.
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_writeKey
Declare the key for the refitted segment container.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_seedParsKey
Decorate the seed parameters entering the fit.
std::unique_ptr< Fitter_t > m_fitter
Gaudi::Property< bool > m_drawEvent
Dump the segment line in obj files.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_linkKey
Construct a link from the refitted segment to the input segment.
Gaudi::Property< unsigned > m_maxPropSteps
Maximum number of propagation steps.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_readKey
Declare the data dependency on the standard Mdt+Rpc+Tgc segment container.
Gaudi::Property< bool > m_smearSegPars
ActsTrk::AuxiliaryMeasurementHandler m_auxMeasProv
Gaudi::Property< unsigned > m_maxTargetSurfSkip
Maximum number of target surfaces.
Acts::Experimental::Gx2FitterOptions< ActsTrk::MutableTrackStateBackend > Gx2FitterOptions_t
Abbrivation of the configuration to launch the fit.
Gaudi::Property< bool > m_doJacobianCorr
Free to bound Jacobian correction.
Gx2FitterExtension_t m_fitExtension
Fitter setup.
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
Tracking geometry tool.
const Acts::Surface * portalSurface(const xAOD::UncalibratedMeasurement *measurement, bool entrance) const
Returns the entrance / exit portal surface of the tracking volume associated with the measurement sur...
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
Gaudi::Property< unsigned > m_maxIter
Maximum number of iterations.
const MeasVec & measurements() const
Returns the associated measurements.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setDirection(float px, float py, float pz)
Sets the direction.
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
void setNHits(int nPrecisionHits, int nPhiLayers, int nTrigEtaLayers)
Set the number of hits/layers.
void setPosition(float x, float y, float z)
Sets the global position.
Acts::VectorMultiTrajectory MutableTrackStateBackend
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...
Acts::VectorTrackContainer MutableTrackBackend
Acts::Vector4 convertPosToActs(const Amg::Vector3D &athenaPos, const double athenaTime=0.)
Converts a position vector & time from Athena units into Acts units.
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
SpacePoint::SeedingAux SeedingAux
Abrivation of the CompSpacePointAuxiliaries.
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.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
std::vector< const xAOD::UncalibratedMeasurement * > collectMeasurements(const xAOD::MuonSegment &segment, bool skipOutlier=true)
Helper function to extract the measurements from the segment.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
void drawBoundParameters(const ActsTrk::GeometryContext &gctx, const Acts::BoundTrackParameters &pars, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=3.*Gaudi::Units::cm)
Draw a line representing the bound track parameters.
bool isPrecHit(const SpType &sp)
Define a spacepoint as precision hit if it's a Mdt or NSW eta hit.
void drawMeasurement(const ActsTrk::GeometryContext &gctx, const xAOD::UncalibratedMeasurement *meas, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw an uncalibrated measurement inside the obj file.
void drawSegmentMeasurements(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw all uncalibrated measurements associated to the segment.
void drawSegmentLine(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=1.*Gaudi::Units::m)
Draw a segment line inside the obj file.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

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

◆ filterPassed()

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

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

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

◆ initialize()

StatusCode MuonR4::SegmentActsRefitAlg::initialize ( )
finaloverridevirtual

Definition at line 46 of file SegmentActsRefitAlg.cxx.

46 {
47 ATH_CHECK(m_readKey.initialize());
48 ATH_CHECK(m_writeKey.initialize());
49 ATH_CHECK(m_linkKey.initialize());
50 ATH_CHECK(m_localParsKey.initialize());
51 ATH_CHECK(m_seedParsKey.initialize());
52 ATH_CHECK(m_auxMeasProv.initialize(m_writeKey.key()));
53 ATH_CHECK(m_calibTool.retrieve());
54
55 ATH_CHECK(m_idHelperSvc.retrieve());
58 ATH_CHECK(m_segSelector.retrieve());
59 ATH_CHECK(detStore()->retrieve(m_detMgr));
60
61 auto logger = makeActsAthenaLogger(this, "Fitter");
62
63 Acts::StraightLineStepper stepper{};
64 Acts::Navigator::Config navConfig{m_trackingGeometryTool->trackingGeometry()};
65 Acts::Navigator navigator(std::move(navConfig), logger->clone());
66
67 Propagator_t propagator{std::move(stepper), std::move(navigator), logger->clone()};
68
69 m_fitter = std::make_unique<Fitter_t>(std::move(propagator), logger->clone());
70
71 m_surfAccessor = ActsTrk::detail::xAODUncalibMeasSurfAcc{m_trackingGeometryTool.get()};
72 m_fitExtension.surfaceAccessor.connect<&ActsTrk::detail::xAODUncalibMeasSurfAcc::operator()>(&m_surfAccessor);
74 return StatusCode::SUCCESS;
75 }
const ServiceHandle< StoreGateSvc > & detStore() const
virtual void calibrateSourceLink(const Acts::GeometryContext &geoctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &link, ActsTrk::MutableTrackStateBackend::TrackStateProxy state) const =0
Function that's hooked to the calibration delegate of the implemented Acts fitters.
Acts::Propagator< Acts::StraightLineStepper, Acts::Navigator > Propagator_t
Type erased track fitter function.
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector
Segment selection tool to pick the good quality segments.
static Root::TMsgLogger logger("iLumiCalc")

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ portalSurface()

const Acts::Surface * MuonR4::SegmentActsRefitAlg::portalSurface ( const xAOD::UncalibratedMeasurement * measurement,
bool entrance ) const
private

Returns the entrance / exit portal surface of the tracking volume associated with the measurement surface.

Parameters
measurementReference to the measurement which portal is to be fetched
entranceFlag toggling whether the entrance or exit portal shall be returned

Definition at line 117 of file SegmentActsRefitAlg.cxx.

118 {
119
120 const Acts::GeometryIdentifier volId = m_surfAccessor.get(measurement)->geometryId().withSensitive(0);
121 const Acts::TrackingVolume* volume = m_trackingGeometryTool->trackingGeometry()->findVolume(volId);
122 return entrance ? MuonGMR4::bottomBoundary(*volume) : MuonGMR4::topBoundary(*volume);
123 }
const Acts::Surface * bottomBoundary(const Acts::TrackingVolume &volume)
Returns the boundary surface parallel to the x-y plane at negative local z.
const Acts::Surface * topBoundary(const Acts::TrackingVolume &volume)
Returns the boundary surface parallel to the x-y plane at positive local z.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

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

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

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

◆ smearSegment()

std::tuple< Amg::Vector3D, Amg::Vector3D > MuonR4::SegmentActsRefitAlg::smearSegment ( const ActsTrk::GeometryContext & gctx,
const MuonR4::Segment & segment,
CLHEP::HepRandomEngine * engine ) const
private

Smear the segment's position and direction by one sigma defined by the segment's covariance.

Returns a tuple of smeared position & direction.

Parameters
gctxGeometry context to fetch the alignment of the segment
segmentReference to the segment to smear
engineRandom engine to pass through the random number sequence

Smear the parameters

Ensure that the left-right ambiguity is preserved

Definition at line 77 of file SegmentActsRefitAlg.cxx.

79 {
80 if (!m_smearSegPars) {
81 return std::make_pair(segment.position(), segment.direction());
82 }
83 const SegmentFit::Parameters segPars = localSegmentPars(gctx, segment);
84 SegmentFit::Parameters smearedPars = segPars;
86 for (ParamDefs precPar : {ParamDefs::y0, ParamDefs::theta,
87 ParamDefs::x0, ParamDefs::phi}) {
88 if (precPar == ParamDefs::phi && !segment.summary().nPhiHits) {
89 break;
90 }
91 const unsigned idx = Acts::toUnderlying(precPar);
92 const double uncert = Amg::error(segment.covariance(), idx) * m_smearRange;
93 smearedPars[idx] = CLHEP::RandGaussZiggurat::shoot(engine, segPars[idx], uncert);
94 ATH_MSG_VERBOSE("Apply smearing to "<<SeedingAux::parName(precPar)
95 <<" parameter -- cov: "<<uncert
96 <<", original: "<<segPars[idx]<<", smeared: "<<smearedPars[idx]
97 <<", deviation: "
98 <<(smearedPars[idx] - segPars[idx]) / uncert );
99 }
100 auto [smearLocPos, smearLocDir] = makeLine(smearedPars);
101 const auto [locPos, locDir] = makeLine(segPars);
103 if (SeedingAux::strawSigns(locPos,locDir, segment.measurements()) !=
104 SeedingAux::strawSigns(smearLocPos, smearLocDir, segment.measurements())) {
105 ATH_MSG_DEBUG("Parameter smearng from "<<toString(segPars)<<" -> "<<toString(smearedPars)
106 <<" changes the L/R ambiguity -> avoid for this test");
107 return smearSegment(gctx, segment, engine);
108 }
109
110 const Amg::Transform3D& locToGlob{segment.msSector()->localToGlobalTransform(gctx)};
111 if (smearLocDir.z() < 0) {
112 smearLocDir = -smearLocDir;
113 }
114 return std::make_tuple(locToGlob * smearLocPos, locToGlob.linear() * smearLocDir);
115 }
Gaudi::Property< double > m_smearRange
Smear interval in terms of standard deviations.
const SegmentFit::Covariance & covariance() const
Returns the uncertainties of the defining parameters.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
const Amg::Vector3D & position() const
Returns the global segment position.
const Amg::Vector3D & direction() const
Returns the global segment direction.
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 ...
SeedingAux::FitParIndex ParamDefs
Use the same parameter indices as used by the CompSpacePointAuxiliaries.
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
std::string toString(const Parameters &pars)
Dumps the parameters into a string with labels in front of each number.

◆ sysExecute()

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

Execute an algorithm.

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

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

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

◆ sysInitialize()

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

Override sysInitialize.

Override sysInitialize from the base class.

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

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

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

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

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

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_auxMeasProv

ActsTrk::AuxiliaryMeasurementHandler MuonR4::SegmentActsRefitAlg::m_auxMeasProv {this}
private

Definition at line 104 of file SegmentActsRefitAlg.h.

104{this};

◆ m_calibTool

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

Handle to the space point calibrator.

Definition at line 100 of file SegmentActsRefitAlg.h.

100{this, "Calibrator", "" };

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonR4::SegmentActsRefitAlg::m_detMgr {nullptr}
private

Detector manager to access the spectrometer sector surfaces.

Definition at line 106 of file SegmentActsRefitAlg.h.

106{nullptr};

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doJacobianCorr

Gaudi::Property<bool> MuonR4::SegmentActsRefitAlg::m_doJacobianCorr {this,"freeToBoundJacobian", true}
private

Free to bound Jacobian correction.

Definition at line 116 of file SegmentActsRefitAlg.h.

116{this,"freeToBoundJacobian", true};

◆ m_drawEvent

Gaudi::Property<bool> MuonR4::SegmentActsRefitAlg::m_drawEvent {this , "drawEvent", false }
private

Dump the segment line in obj files.

Definition at line 102 of file SegmentActsRefitAlg.h.

102{this , "drawEvent", false };

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

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

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

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_extrapolationTool

ToolHandle<ActsTrk::IExtrapolationTool> MuonR4::SegmentActsRefitAlg::m_extrapolationTool {this, "ExtrapolationTool" ,"" }
private

Track extrapolation tool.

Definition at line 92 of file SegmentActsRefitAlg.h.

92{this, "ExtrapolationTool" ,"" };

◆ m_fitExtension

Gx2FitterExtension_t MuonR4::SegmentActsRefitAlg::m_fitExtension {}
private

Fitter setup.

Definition at line 121 of file SegmentActsRefitAlg.h.

121{};

◆ m_fitter

std::unique_ptr<Fitter_t> MuonR4::SegmentActsRefitAlg::m_fitter {}
private

Definition at line 123 of file SegmentActsRefitAlg.h.

123{};

◆ m_idHelperSvc

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

IdHelperSvc to decode the Identifiers.

Definition at line 88 of file SegmentActsRefitAlg.h.

88{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_linkKey

SG::WriteDecorHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentActsRefitAlg::m_linkKey {this, "LinkKey", m_writeKey, "prefitSegmentLink"}
private

Construct a link from the refitted segment to the input segment.

Definition at line 81 of file SegmentActsRefitAlg.h.

81{this, "LinkKey", m_writeKey, "prefitSegmentLink"};

◆ m_localParsKey

SG::WriteDecorHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentActsRefitAlg::m_localParsKey {this, "LocalParsKey", m_writeKey, "localSegPars"}
private

Decorate directly the local segment parameters on to the object.

Definition at line 83 of file SegmentActsRefitAlg.h.

83{this, "LocalParsKey", m_writeKey, "localSegPars"};

◆ m_maxIter

Gaudi::Property<unsigned> MuonR4::SegmentActsRefitAlg::m_maxIter {this, "maxIter", 50}
private

Maximum number of iterations.

Definition at line 114 of file SegmentActsRefitAlg.h.

114{this, "maxIter", 50};

◆ m_maxPropSteps

Gaudi::Property<unsigned> MuonR4::SegmentActsRefitAlg::m_maxPropSteps {this,"maxPropagationSteps", 100000}
private

Maximum number of propagation steps.

Definition at line 110 of file SegmentActsRefitAlg.h.

110{this,"maxPropagationSteps", 100000};

◆ m_maxTargetSurfSkip

Gaudi::Property<unsigned> MuonR4::SegmentActsRefitAlg::m_maxTargetSurfSkip {this, "maxTargetSurfSkip", 100000}
private

Maximum number of target surfaces.

Definition at line 112 of file SegmentActsRefitAlg.h.

112{this, "maxTargetSurfSkip", 100000};

◆ m_readKey

SG::ReadHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentActsRefitAlg::m_readKey {this, "SegmentContainer", "MuonSegmentsFromR4"}
private

Declare the data dependency on the standard Mdt+Rpc+Tgc segment container.

Definition at line 77 of file SegmentActsRefitAlg.h.

77{this, "SegmentContainer", "MuonSegmentsFromR4"};

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> MuonR4::SegmentActsRefitAlg::m_rndmSvc {this, "RndmSvc", "AthRNGSvc", ""}
private

Range service to smear the segment parameters.

Definition at line 96 of file SegmentActsRefitAlg.h.

96{this, "RndmSvc", "AthRNGSvc", ""};

◆ m_seedParsKey

SG::WriteDecorHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentActsRefitAlg::m_seedParsKey {this, "SeedParsKey", m_readKey, "seedSegPars"}
private

Decorate the seed parameters entering the fit.

Definition at line 85 of file SegmentActsRefitAlg.h.

85{this, "SeedParsKey", m_readKey, "seedSegPars"};

◆ m_segSelector

ToolHandle<MuonR4::ISegmentSelectionTool> MuonR4::SegmentActsRefitAlg::m_segSelector {this, "SegmentSelectionTool" , "" }
private

Segment selection tool to pick the good quality segments.

Definition at line 94 of file SegmentActsRefitAlg.h.

94{this, "SegmentSelectionTool" , "" };

◆ m_smearRange

Gaudi::Property<double> MuonR4::SegmentActsRefitAlg::m_smearRange {this, "SmearRange", 1.}
private

Smear interval in terms of standard deviations.

Definition at line 98 of file SegmentActsRefitAlg.h.

98{this, "SmearRange", 1.};

◆ m_smearSegPars

Gaudi::Property<bool> MuonR4::SegmentActsRefitAlg::m_smearSegPars {this, "smearSegPars", true}
private

Definition at line 108 of file SegmentActsRefitAlg.h.

108{this, "smearSegPars", true};

◆ m_surfAccessor

ActsTrk::detail::xAODUncalibMeasSurfAcc MuonR4::SegmentActsRefitAlg::m_surfAccessor {}
private

Surface accessor delegate for xAOD::UncalibratedMeasurement objects.

Definition at line 119 of file SegmentActsRefitAlg.h.

119{};

◆ m_trackingGeometryTool

PublicToolHandle<ActsTrk::ITrackingGeometryTool> MuonR4::SegmentActsRefitAlg::m_trackingGeometryTool {this, "TrackingGeometryTool", ""}
private

Tracking geometry tool.

Definition at line 90 of file SegmentActsRefitAlg.h.

90{this, "TrackingGeometryTool", ""};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeKey

SG::WriteHandleKey<xAOD::MuonSegmentContainer> MuonR4::SegmentActsRefitAlg::m_writeKey {this, "OutContainer", "ActsRefitSegments"}
private

Declare the key for the refitted segment container.

Definition at line 79 of file SegmentActsRefitAlg.h.

79{this, "OutContainer", "ActsRefitSegments"};

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