|
ATLAS Offline Software
|
Algorithm to handle segment fits
More...
#include <SegmentFittingAlg.h>
|
| SegmentFittingAlg (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual | ~SegmentFittingAlg () |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
virtual StatusCode | finalize () override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
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 . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
template<class ContainerType > |
StatusCode | retrieveContainer (const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const |
| Helper method to fetch data from StoreGate. More...
|
|
SegmentFitResult | fitSegmentHits (const EventContext &ctx, const ActsGeometryContext &gctx, const Parameters &startPars, SegmentFitResult::HitVec &&calibHits) const |
| Executes the segment fit with start parameters. More...
|
|
const xAOD::MuonSegment * | getTruthSegment (const EventContext &ctx, const std::unordered_set< const xAOD::MuonSimHit * > &matchedSeedHits) const |
|
More...
|
|
std::vector< std::unique_ptr< Segment > > | fitSegmentSeed (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed *seed) const |
|
bool | removeOutliers (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &fitResult) const |
| Spot hits with large discrepancy from the estimated parameters and remove them from the list. More...
|
|
bool | plugHoles (const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &toRecover) const |
| Recovery of missed hits. More...
|
|
void | eraseWrongHits (const ActsGeometryContext &gctx, SegmentFitResult &candidate) const |
| Removes all hits from the segment which are obvious outliers. More...
|
|
void | resolveAmbiguities (const ActsGeometryContext &gctx, std::vector< std::unique_ptr< Segment >> &segmentCandidates) const |
|
void | visualizeFit (const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel, std::vector< std::unique_ptr< TObject >> primitives={}) const |
|
void | visualizeFitPhi (const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel) const |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
SG::ReadHandleKey< SegmentSeedContainer > | m_seedKey {this, "ReadKey", "MuonHoughStationSegmentSeeds"} |
| ReadHandle of the seeds. More...
|
|
SG::ReadHandleKey< xAOD::MuonSegmentContainer > | m_truthSegKey {this, "TruthSegKey", "TruthSegmentsR4"} |
| ReadHandle for the truth segments (For validation purposes) More...
|
|
SG::WriteHandleKey< SegmentContainer > | m_outSegments {this, "MuonSegmentContainer", "R4MuonSegments"} |
|
SG::ReadHandleKey< ActsGeometryContext > | m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"} |
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
|
ToolHandle< ISpacePointCalibrator > | m_calibTool {this, "Calibrator", "" } |
|
Gaudi::Property< bool > | m_useMinuit {this, "useMinuit", false} |
| Toggle the fitter. More...
|
|
Gaudi::Property< bool > | m_doT0Fit {this, "fitSegmentT0", true} |
|
Gaudi::Property< bool > | m_doBeamspotConstraint {this, "doBeamspotConstraint", false} |
| Add beamline constraint. More...
|
|
Gaudi::Property< double > | m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm} |
|
Gaudi::Property< double > | m_beamSpotL {this, "BeamSpotLength", 20. * Gaudi::Units::m} |
|
Gaudi::Property< double > | m_seedTanThetaReso {this, "ResoSeedTanTheta", 250. * Gaudi::Units::mrad} |
| Two mdt seeds are the same if their defining parameters match wihin. More...
|
|
Gaudi::Property< double > | m_seedY0Reso {this, "ResoSeedY0", 500.*Gaudi::Units::micrometer} |
|
Gaudi::Property< double > | m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. } |
|
Gaudi::Property< double > | m_outlierRemovalCut {this, "OutlierRemoval", 5.} |
| Cut on the segment chi2 / nDoF to launch the outlier removal. More...
|
|
Gaudi::Property< double > | m_recoveryPull {this, "RecoveryPull", 5.} |
|
std::unique_ptr< TCanvas > | m_allCan {} |
|
Gaudi::Property< std::string > | m_allCanName {this, "AllCanName", "AllSegmentFits"} |
|
std::atomic< unsigned int > m_canvCounter | ATLAS_THREAD_SAFE {0} |
|
Gaudi::Property< unsigned int > | m_nDrawCanvases {this, "MaxCanvases", 5000} |
| Draw maximally 5000 segment fit visualizations. More...
|
|
const MuonGMR4::MuonDetectorManager * | m_detMgr {nullptr} |
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Algorithm to handle segment fits
This is currently a placeholder to test ideas!
Definition at line 42 of file SegmentFittingAlg.h.
◆ HitVec
◆ Parameters
◆ StoreGateSvc_t
◆ SegmentFittingAlg()
MuonR4::SegmentFittingAlg::SegmentFittingAlg |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~SegmentFittingAlg()
MuonR4::SegmentFittingAlg::~SegmentFittingAlg |
( |
| ) |
|
|
virtualdefault |
◆ cardinality()
unsigned int AthReentrantAlgorithm::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.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ eraseWrongHits()
Removes all hits from the segment which are obvious outliers.
E.g. tubes which cannot be crossed by the segment.
- Parameters
-
gctx | Geometry context needed to calculate the nominal time of arrival, if the time fit is activated |
candidate | Reference of the segment candidate to prune. |
The segment has never crossed the tube
Definition at line 918 of file SegmentFittingAlg.cxx.
919 auto [segPos, segDir] =
makeLine(candidate.segmentPars);
920 candidate.calibMeasurements.erase(std::remove_if(candidate.calibMeasurements.begin(), candidate.calibMeasurements.end(),
921 [&segPos, &segDir](
const HitVec::value_type& hit){
922 if (hit->fitState() != CalibratedSpacePoint::State::Outlier) {
927 const double dist = Amg::lineDistance(segPos, segDir, hit->positionInChamber(), hit->directionInChamber());
928 const auto* dc = static_cast<const xAOD::MdtDriftCircle*>(hit->spacePoint()->primaryMeasurement());
929 return dist >= dc->readoutElement()->innerTubeRadius();
932 }), candidate.calibMeasurements.end());
934 for (
const auto& hit : candidate.calibMeasurements) {
936 chamber = hit->spacePoint()->chamber();
940 std::optional<double> timeOfFlight = candidate.timeFit ? std::make_optional<double>((
chamber->localToGlobalTrans(gctx)*segPos).mag() *
inv_c)
943 candidate.calibMeasurements, msgStream());
944 ATH_MSG_VERBOSE(
"The measurements before "<<candidate.chi2PerMeasurement<<
", after: "<<updatedMeasChi2<<
", chi2: "<<updateChi2);
945 candidate.chi2PerMeasurement = std::move(updatedMeasChi2);
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode MuonR4::SegmentFittingAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 113 of file SegmentFittingAlg.cxx.
121 ATH_CHECK(writeSegments.record(std::make_unique<SegmentContainer>()));
122 std::vector<std::unique_ptr<Segment>> allSegments{};
123 for (
const SegmentSeed* seed : *segmentSeeds) {
124 std::vector<std::unique_ptr<Segment>> segments =
fitSegmentSeed(ctx, *gctx, seed);
125 allSegments.insert(allSegments.end(), std::make_move_iterator(segments.begin()),
126 std::make_move_iterator(segments.end()));
129 writeSegments->insert(writeSegments->end(),
130 std::make_move_iterator(allSegments.begin()),
131 std::make_move_iterator(allSegments.end()));
132 ATH_MSG_VERBOSE(
"Found in total "<<writeSegments->size()<<
" segments. ");
133 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
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 & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ finalize()
StatusCode MuonR4::SegmentFittingAlg::finalize |
( |
| ) |
|
|
overridevirtual |
◆ fitSegmentHits()
Executes the segment fit with start parameters.
The returned fit result indicates whether the fit was a success and all relevant output parameters
ctx: Event context needed to access the calibration constants of the hits
gctx: Geometry context needed to place the segment globally within ATLAS to calculate the nominal time of arrival
startPars: Segment parameters preestimated from the SegmentSeed (either hough pattern or two drift circle seed)
calibHits: Vector of strip & mdt hits to consider for the fit
Add beamspot if neccessary
placeholder for a very generous beam spot: 300mm in X,Y (tracking volume), 20000 along Z
Configure the minimizer
Assumption that the particle travels at the speed of light
Execute fit
Definition at line 182 of file SegmentFittingAlg.cxx.
186 SegmentFitResult
data{};
187 if (calibHits.empty()) {
194 unsigned int numPhi =
std::accumulate(calibHits.begin(), calibHits.end(),0,
195 [](
unsigned int n,
const HitVec::value_type& hit){
196 return n + (hit->fitState() == CalibratedSpacePoint::State::Valid &&
200 const Amg::Transform3D globToLoc{calibHits[0]->spacePoint()->chamber()->globalToLocalTrans(gctx)};
208 covariance = jacobian * covariance * jacobian.transpose();
209 AmgSymMatrix(2) beamSpotCov{covariance.block<2,2>(0,0)};
211 beamSpotSP->setCovariance<2>(std::move(beamSpotCov));
213 calibHits.push_back(std::move(beamSpotSP));
217 const Amg::Transform3D& locToGlob{calibHits[0]->spacePoint()->chamber()->localToGlobalTrans(gctx)};
220 MdtSegmentFitter::Config fitCfg{};
224 MdtSegmentFitter
fitter{
name(), std::move(fitCfg)};
225 return fitter.fitSegment(ctx, std::move(calibHits), startPars, locToGlob);
228 data.segmentPars = startPars;
231 data.hasPhi = c2f.hasPhiMeas();
232 data.timeFit = c2f.doTimeFit();
233 data.nDoF = c2f.nDoF();
234 if (
data.nDoF <= 0) {
238 ROOT::Minuit2::Minuit2Minimizer minimizer((
name() +
std::to_string(ctx.eventID().event_number())).c_str());
240 minimizer.SetMaxFunctionCalls(100000);
241 minimizer.SetTolerance(0.0001);
242 minimizer.SetPrintLevel(-1);
243 minimizer.SetStrategy(1);
276 minimizer.SetFunction(c2f);
278 if (!minimizer.Minimize() || !minimizer.Hesse()) {
279 data.calibMeasurements = std::move(calibHits);
281 const double* xs = minimizer.X();
282 const double* errs = minimizer.Errors();
284 for (
unsigned int p = 0;
p <
toInt(ParamDefs::nPars); ++
p) {
285 data.segmentPars[
p] = xs[
p];
286 data.segmentParErrs(
p,
p) = errs[
p];
288 std::optional<double> timeOfArrival{std::nullopt};
289 const auto [locPos,
locDir] =
data.makeLine();
291 timeOfArrival = std::make_optional<double>((locToGlob*locPos).
mag() *
inv_c);
293 data.nIter = minimizer.NCalls();
294 data.calibMeasurements = c2f.release(xs);
297 data.calibMeasurements, msgStream());
298 data.chi2PerMeasurement = std::move(chiPerMeas);
299 data.chi2 = finalChi2;
300 data.converged =
true;
◆ fitSegmentSeed()
At very high inclanation angles, the muon may traverse 3 hits in the same layer (E.g. BEE)
Draw the pattern with all possible seeds
Draw the prefit
Definition at line 305 of file SegmentFittingAlg.cxx.
309 const Amg::Transform3D& locToGlob{patternSeed->chamber()->localToGlobalTrans(gctx)};
310 std::vector<std::unique_ptr<Segment>> segments{};
312 MdtSegmentSeedGenerator::Config genCfg{};
321 SegmentFitResult
data{};
322 data.segmentPars = patternSeed->parameters();
323 const Amg::Vector3D seedPos{patternSeed->positionInChamber()};
324 const Amg::Vector3D seedDir{patternSeed->directionInChamber()};
326 data.calibMeasurements =
m_calibTool->calibrate(ctx, patternSeed->getHitsInMax(), seedPos, seedDir,
329 for (
const std::unique_ptr<CalibratedSpacePoint>& meas :
data.calibMeasurements) {
336 std::vector<std::unique_ptr<TObject>> seedLines{};
337 MdtSegmentSeedGenerator drawMe{
name(), patternSeed, genCfg};
338 while(
auto s = drawMe.nextSeed(ctx)) {
339 seedLines.push_back(
drawLine(
s->parameters));
342 visualizeFit(ctx,
data, patternSeed->parentBucket(),
"pattern", std::move(seedLines));
344 MdtSegmentSeedGenerator seedGen{
name(),patternSeed, std::move(genCfg)};
346 while (
auto seed = seedGen.nextSeed(ctx)) {
348 SegmentFitResult
data{};
349 data.segmentPars =
seed->parameters;
350 data.calibMeasurements = std::move(
seed->measurements);
355 for (
const std::unique_ptr<CalibratedSpacePoint>& meas :
data.calibMeasurements) {
360 std::vector<std::unique_ptr<TObject>> primitives{};
364 std::format(
"Pre fit {:d}", seedGen.numGenerated()), std::move(primitives));
368 if (
data.converged) {
370 std::format(
"Intermediate fit {:d}", seedGen.numGenerated()));
380 std::format(
"Final fit {:d}", seedGen.numGenerated()));
382 const auto [locPos,
locDir] =
data.makeLine();
387 auto finalSeg = std::make_unique<Segment>(std::move(globPos), std::move(globDir),
389 std::move(
data.calibMeasurements),
392 finalSeg->setCallsToConverge(
data.nIter);
393 finalSeg->setChi2PerMeasurement(std::move(
data.chi2PerMeasurement));
394 finalSeg->setParUncertainties(std::move(
data.segmentParErrs));
398 segments.push_back(std::move(finalSeg));
◆ getTruthSegment()
Definition at line 151 of file SegmentFittingAlg.cxx.
163 unsigned int mostHits{0};
168 const unsigned matchedHits =
std::accumulate(truthHits.begin(), truthHits.end(),0 ,
170 return n + truthRecoHits.count(simHit);
172 if (matchedHits > mostHits) {
173 mostHits = matchedHits;
◆ initialize()
StatusCode MuonR4::SegmentFittingAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
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()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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.
◆ plugHoles()
Recovery of missed hits.
Hits in the space point bucket that are maximally <RecoveryPull> away from the fitted segment are put onto the segment candidate and the candidate is refitted. If the refitted candidate has a chi2/nDoF < <OutlierRemoval> the canidate is automatically choosen otherwise, its chi needs to be better.
- Parameters
-
ctx | EventContext needed for calibration of the hits |
gctx | Geometry context needed if the beamspot constaint will be packed onto the segment |
seed | Segment seed from the pattern recognition to access the underlying bucket |
toRecover | Fit result with parameters & hits to recover.
|
We've the first estimator of the segment fit
Setup a map to replace space points if they better suite
Hit is already used in the segment fit
Remove the beamspot constraint measurement
Nothing has been recovered. Just bail out
If the chi2 is less than 5, no outlier rejection is launched. So also accept any recovered segment below that threshold
Next check whether the recovery made measurements marked as outlier feasable for the hole recovery
Finally remove all hits from the calib measurements which are obvious outliers
Definition at line 798 of file SegmentFittingAlg.cxx.
804 <<
", chi2: "<<beforeRecov.chi2<<
", nDoF: "<<beforeRecov.nDoF<<
", "
805 <<beforeRecov.chi2 /
std::max(beforeRecov.nDoF, 1) );
807 std::unordered_set<const SpacePoint*> usedSpacePoint{};
808 for (
const HitVec::value_type& hit : beforeRecov.calibMeasurements) {
809 usedSpacePoint.insert(hit->spacePoint());
813 SpacePointPerLayerSorter hitLayers{*
seed.parentBucket()};
814 bool hasCandidate{
false};
815 const auto [locPos,
locDir] = beforeRecov.makeLine();
816 for (
const std::vector<HoughHitType>& mdtLayer : hitLayers.mdtHits()) {
819 if (usedSpacePoint.count(mdtHit)) {
822 const double dist =
Amg::lineDistance(locPos,
locDir, mdtHit->positionInChamber(), mdtHit->directionInChamber());
824 if (dist >= dc->readoutElement()->innerTubeRadius()) {
832 candidateHits.push_back(std::move(calibHit));
835 candidateHits.push_back(std::move(calibHit));
841 beforeRecov.calibMeasurements.insert(beforeRecov.calibMeasurements.end(),
842 std::make_move_iterator(candidateHits.begin()),
843 std::make_move_iterator(candidateHits.end()));
845 return beforeRecov.nDoF > 0;
848 HitVec copied =
copy(beforeRecov.calibMeasurements), copiedCandidates =
copy(candidateHits);
854 candidateHits.insert(candidateHits.end(), std::make_move_iterator(copied.begin()), std::make_move_iterator(copied.end()));
856 SegmentFitResult recovered =
fitSegmentHits(ctx, gctx, beforeRecov.segmentPars, std::move(candidateHits));
857 if (!recovered.converged) {
861 if (recovered.nDoF + recovered.timeFit <= beforeRecov.nDoF + beforeRecov.timeFit) {
862 for (HitVec::value_type& hit : copiedCandidates) {
864 beforeRecov.calibMeasurements.push_back(std::move(hit));
869 ATH_MSG_VERBOSE(
"Chi2, nDOF before:"<<beforeRecov.chi2<<
", "<<beforeRecov.nDoF<<
" after recovery: "<<recovered.chi2<<
", "<<recovered.nDoF);
870 double redChi2 = recovered.chi2 /
std::max(recovered.nDoF,1);
872 if (redChi2 <
m_outlierRemovalCut || (beforeRecov.nDoF == 0) || redChi2 < beforeRecov.chi2 / beforeRecov.nDoF) {
873 ATH_MSG_VERBOSE(
"Accept segment with recovered "<<(recovered.nDoF + recovered.timeFit) - (beforeRecov.nDoF + beforeRecov.timeFit)<<
" hits.");
874 recovered.nIter += beforeRecov.nIter;
875 beforeRecov = std::move(recovered);
878 bool runAnotherTrial =
false;
879 copied =
copy(beforeRecov.calibMeasurements);
883 for (
unsigned int m = 0;
m < beforeRecov.calibMeasurements.size(); ++
m) {
887 runAnotherTrial =
true;
890 if (!runAnotherTrial) {
893 recovered =
fitSegmentHits(ctx, gctx, beforeRecov.segmentPars, std::move(copied));
894 if (!recovered.converged) {
897 if (recovered.nDoF + recovered.timeFit <= beforeRecov.nDoF + beforeRecov.timeFit) {
900 redChi2 = recovered.chi2 /
std::max(recovered.nDoF, 1);
902 recovered.nIter += beforeRecov.nIter;
903 beforeRecov = std::move(recovered);
911 for (HitVec::value_type& hit : copiedCandidates) {
913 beforeRecov.calibMeasurements.push_back(std::move(hit));
◆ removeOutliers()
Spot hits with large discrepancy from the estimated parameters and remove them from the list.
- Parameters
-
ctx | EventContext needed for hit calibration |
gctx | Geometry context needed if the beamspot constaint will be packed onto the segment |
fitResult | Data structure carrying the fit parameters & calibrated hits |
If no degree of freedom is in the segment fit then try to plug the holes
Remove a priori the beamspot constaint as it never should pose any problem and another one will be added anyway in the next iteration
Next sort the measurements by chi2
Declare the hit with the largest chi2 as outlier.
Remove the last measurement as it has the largest discrepancy
Definition at line 404 of file SegmentFittingAlg.cxx.
410 if (
data.nDoF<=0 ||
data.calibMeasurements.empty()) {
411 ATH_MSG_VERBOSE(
"No degree of freedom available. What shall be removed?!");
415 const auto [segPos, segDir] =
data.makeLine();
420 <<
". Don't remove outliers");
432 [&,
this](
const HitVec::value_type&
a,
const HitVec::value_type&
b){
433 return SegmentFitHelpers::chiSqTerm(segPos, segDir, data.segmentPars[toInt(ParamDefs::time)], std::nullopt, *a, msgStream()) <
434 SegmentFitHelpers::chiSqTerm(segPos, segDir, data.segmentPars[toInt(ParamDefs::time)], std::nullopt, *b, msgStream());
439 data.nDoF -=
data.calibMeasurements.back()->measuresEta();
440 data.nDoF -=
data.calibMeasurements.back()->measuresPhi();
441 if (
m_doT0Fit &&
data.calibMeasurements.back()->measuresTime() &&
446 std::vector<HoughHitType> uncalib{};
447 for (
const HitVec::value_type&
calib :
data.calibMeasurements) {
448 uncalib.push_back(
calib->spacePoint());
450 SegmentFitResult newAttempt =
fitSegmentHits(ctx, gctx,
data.segmentPars, std::move(
data.calibMeasurements));
451 if (newAttempt.converged) {
452 newAttempt.nIter+=
data.nIter;
453 data = std::move(newAttempt);
456 data.calibMeasurements = std::move(newAttempt.calibMeasurements);
◆ renounce()
◆ renounceArray()
◆ resolveAmbiguities()
void MuonR4::SegmentFittingAlg::resolveAmbiguities |
( |
const ActsGeometryContext & |
gctx, |
|
|
std::vector< std::unique_ptr< Segment >> & |
segmentCandidates |
|
) |
| const |
|
private |
Definition at line 947 of file SegmentFittingAlg.cxx.
949 using SegmentVec = std::vector<std::unique_ptr<Segment>>;
950 ATH_MSG_VERBOSE(
"Resolve ambiguities amongst "<<segmentCandidates.size()<<
" segment candidates. ");
951 std::unordered_map<const MuonGMR4::MuonChamber*, SegmentVec> candidatesPerChamber{};
953 for (std::unique_ptr<Segment>& sortMe : segmentCandidates) {
955 candidatesPerChamber[chamb].push_back(std::move(sortMe));
957 SegmentAmbiSolver ambiSolver{
name()};
958 segmentCandidates.clear();
959 for (
auto& [
chamber, resolveMe] : candidatesPerChamber) {
960 SegmentVec resolvedSegments = ambiSolver.resolveAmbiguity(gctx, std::move(resolveMe));
961 segmentCandidates.insert(segmentCandidates.end(),
962 std::make_move_iterator(resolvedSegments.begin()),
963 std::make_move_iterator(resolvedSegments.end()));
◆ retrieveContainer()
template<class ContainerType >
StatusCode MuonR4::SegmentFittingAlg::retrieveContainer |
( |
const EventContext & |
ctx, |
|
|
const SG::ReadHandleKey< ContainerType > & |
key, |
|
|
const ContainerType *& |
contToPush |
|
) |
| const |
|
private |
Helper method to fetch data from StoreGate.
If the key is empty, a nullptr is assigned to the container ptr Failure is returned in cases, of non-empty keys and failed retrieval
Definition at line 137 of file SegmentFittingAlg.cxx.
140 contToPush =
nullptr;
143 return StatusCode::SUCCESS;
147 contToPush = readHandle.cptr();
148 return StatusCode::SUCCESS;
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::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 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::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 InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ visualizeFit()
Definition at line 591 of file SegmentFittingAlg.cxx.
600 std::lock_guard guard{
mutex};
605 std::unordered_set<const SpacePoint*> usedSpacePoint{}, outliers{};
606 for (
const HitVec::value_type& hit : fitResult.calibMeasurements) {
607 usedSpacePoint.insert(hit->spacePoint());
609 outliers.insert(hit->spacePoint());
613 std::unordered_set<const xAOD::MuonSimHit*> truthSpHits{};
617 const auto [locPos,
locDir] = fitResult.makeLine();
620 <<
", counter: "<<m_canvCounter<<
", chi2: "<<fitResult.chi2<<
", nDoF: "<<fitResult.nDoF<<
", "
621 <<fitResult.chi2 /
std::max(fitResult.nDoF, 1));
627 for (
const SpacePointBucket::value_type& spInBucket : *bucket) {
629 if (usedSpacePoint.count(spInBucket.get())) {
632 const Amg::Vector3D& hitPos{spInBucket->positionInChamber()};
633 if (refId ==
m_idHelperSvc->chamberId(spInBucket->identify())) {
640 switch (spInBucket->type()) {
642 auto circle = std::make_unique<TEllipse>(hitPos.y(), hitPos.z(), spInBucket->driftRadius());
644 circle->SetFillColor(kOrange +1);
645 circle->SetLineColor(kOrange +1);
647 circle->SetFillColor(kBlue);
648 circle->SetLineColor(kBlue);
651 circle->SetFillStyle(0);
652 circle->SetFillColorAlpha(circle->GetFillColor(), 0.8);
653 if (outliers.count(spInBucket.get())) {
654 circle->SetFillStyle(3344);
655 }
else if (usedSpacePoint.count(spInBucket.get())) {
656 circle->SetFillStyle(1001);
658 primitives.insert(primitives.begin(), std::move(circle));
660 circle = std::make_unique<TEllipse>(hitPos.y(), hitPos.z(), prd->readoutElement()->innerTubeRadius());
661 circle->SetLineStyle(2);
662 circle->SetLineColor(kBlack);
663 primitives.insert(primitives.begin(), std::move(circle));
667 const double boxY = 0.5*std::sqrt(12)*spInBucket->uncertainty().y();
669 auto stripBox = std::make_unique<TBox>(hitPos.y() - boxY, hitPos.z() - boxZ,
670 hitPos.y() + boxY, hitPos.z() + boxZ);
671 stripBox->SetFillColor(kGreen +2);
672 stripBox->SetLineColor(kGreen +2);
673 stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
674 stripBox->SetFillStyle(0);
675 if (outliers.count(spInBucket.get())) {
676 stripBox->SetFillStyle(3344);
677 }
else if (usedSpacePoint.count(spInBucket.get())) {
678 stripBox->SetFillStyle(1001);
680 primitives.insert(primitives.begin(), std::move(stripBox));
683 const auto* prd =
static_cast<const xAOD::TgcStrip*
>(spInBucket->primaryMeasurement());
684 const double boxY = 0.5*std::sqrt(12)*spInBucket->uncertainty().y();
686 auto stripBox = std::make_unique<TBox>(hitPos.y() - boxY, hitPos.z() - boxZ,
687 hitPos.y() + boxY, hitPos.z() + boxZ);
688 stripBox->SetFillColor(kCyan +2);
689 stripBox->SetLineColor(kCyan +2);
690 stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
691 stripBox->SetFillStyle(0);
692 if (outliers.count(spInBucket.get())) {
693 stripBox->SetFillStyle(3344);
694 }
else if (usedSpacePoint.count(spInBucket.get())) {
695 stripBox->SetFillStyle(1001);
697 primitives.insert(primitives.begin(), std::move(stripBox));
709 auto myCanvas = std::make_unique<TCanvas>(
"can",
"can",800,600);
712 double width = (yMax - yMin)*1.3;
713 double height = (zMax - zMin)*1.3;
717 const double midPointY = 0.5 * (yMax + yMin);
718 const double midPointZ = 0.5 * (zMax + zMin);
719 const double y0 = midPointY - 0.5 *
width;
720 const double z0 = midPointZ - 0.5 * height;
721 const double y1 = midPointY + 0.5 *
width;
722 const double z1 = midPointZ + 0.5 * height;
723 auto frame = myCanvas->DrawFrame(y0,
z0,
y1,z1);
724 frame->GetXaxis()->SetTitle(
"y [mm]");
725 frame->GetYaxis()->SetTitle(
"z [mm]");
727 primitives.push_back(
drawLine(fitResult.segmentPars,
z0, z1, kRed));
734 std::stringstream legendLabel{};
735 legendLabel<<
"Event: "<<ctx.eventID().event_number()<<
", chamber : "<<
m_idHelperSvc->toStringChamber(bucket->at(0)->identify())
737 <<
", nDoF: "<<fitResult.nDoF;
738 if (!extraLabel.empty()) {
739 legendLabel<<
" ("<<extraLabel<<
")";
741 primitives.push_back(
drawLabel(legendLabel.str(), 0.1, 0.96));
748 for (
size_t ihit = 0; ihit < fitResult.calibMeasurements.size(); ++ihit) {
749 const HitVec::value_type& hit{fitResult.calibMeasurements[ihit]};
751 std::stringstream legendstream{};
753 legendstream<<
"ML: "<<idHelper.multilayer(hit->spacePoint()->identify());
754 legendstream<<
", TL: "<<idHelper.tubeLayer(hit->spacePoint()->identify());
755 legendstream<<
", T: "<<idHelper.tube(hit->spacePoint()->identify());
756 legendstream<<
", #chi^{2}: "<<
std::format(
"{:.2f}", fitResult.chi2PerMeasurement[ihit]);
758 primitives.push_back(
drawLabel(legendstream.str(), legX, legY, 14));
760 std::stringstream legendstream{};
762 legendstream<<
" DR: "<<idHelper.doubletR(hit->spacePoint()->identify());
763 legendstream<<
" DZ: "<<idHelper.doubletZ(hit->spacePoint()->identify());
764 legendstream<<
", GAP: "<<idHelper.gasGap(hit->spacePoint()->identify());
765 legendstream<<
", #eta/#phi: "<<(hit->measuresEta() ?
"si" :
"nay")
766 <<
"/"<<(hit->measuresPhi() ?
"si" :
"nay");
767 legendstream<<
", #chi^{2}: "<<
std::format(
"{:.2f}",fitResult.chi2PerMeasurement[ihit]);
768 primitives.push_back(
drawLabel(legendstream.str(), legX, legY, 14));
770 std::stringstream legendstream{};
772 legendstream<<
"ST: "<<
m_idHelperSvc ->stationNameString(hit->spacePoint()->identify());
773 legendstream<<
", GAP: "<<idHelper.gasGap(hit->spacePoint()->identify());
774 legendstream<<
", #eta/#phi: "<<(hit->measuresEta() ?
"si" :
"nay")
775 <<
"/"<<(hit->measuresPhi() ?
"si" :
"nay");
776 legendstream<<
", #chi^{2}: "<<
std::format(
"{:.2f}", fitResult.chi2PerMeasurement[ihit]);
777 primitives.push_back(
drawLabel(legendstream.str(), legX, legY, 14));
783 for (
auto& drawMe: primitives) {
786 std::stringstream canvasName;
787 canvasName<<
"SegmenFitDisplays_"<<ctx.eventID().event_number()<<
"_"<<(m_canvCounter++)<<
"E_"
794 myCanvas->SaveAs(canvasName.str().c_str());
◆ visualizeFitPhi()
Definition at line 460 of file SegmentFittingAlg.cxx.
465 std::vector<std::unique_ptr<TObject>> primitives{};
467 std::unordered_set<const SpacePoint*> usedSpacePoint{}, outliers{};
468 for (
const HitVec::value_type& hit : fitResult.calibMeasurements) {
469 usedSpacePoint.insert(hit->spacePoint());
471 outliers.insert(hit->spacePoint());
480 unsigned int updated{0};
481 for (
const SpacePointBucket::value_type& spInBucket : *bucket) {
482 if (!spInBucket->measuresPhi()) {
485 if (usedSpacePoint.count(spInBucket.get())) {
488 const Amg::Vector3D& hitPos{spInBucket->positionInChamber()};
489 if (refId ==
m_idHelperSvc->chamberId(spInBucket->identify())) {
496 switch (spInBucket->type()) {
499 const double boxX = 0.5*std::sqrt(12)*spInBucket->uncertainty().x();
501 auto stripBox = std::make_unique<TBox>(hitPos.x() - boxX, hitPos.z() - boxZ,
502 hitPos.x() + boxX, hitPos.z() + boxZ);
503 stripBox->SetFillColor(kGreen +2);
504 stripBox->SetLineColor(kGreen +2);
505 stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
506 stripBox->SetFillStyle(0);
507 if (outliers.count(spInBucket.get())) {
508 stripBox->SetFillStyle(3344);
509 }
else if (usedSpacePoint.count(spInBucket.get())) {
510 stripBox->SetFillStyle(1001);
512 primitives.insert(primitives.begin(), std::move(stripBox));
515 const auto* prd =
static_cast<const xAOD::TgcStrip*
>(spInBucket->primaryMeasurement());
516 const double boxX = 0.5*std::sqrt(12)*spInBucket->uncertainty().x();
518 auto stripBox = std::make_unique<TBox>(hitPos.x() - boxX, hitPos.z() - boxZ,
519 hitPos.x() + boxX, hitPos.z() + boxZ);
520 stripBox->SetFillColor(kCyan +2);
521 stripBox->SetLineColor(kCyan +2);
522 stripBox->SetFillColorAlpha(stripBox->GetFillColor(), 0.8);
523 stripBox->SetFillStyle(0);
524 if (outliers.count(spInBucket.get())) {
525 stripBox->SetFillStyle(3344);
526 }
else if (usedSpacePoint.count(spInBucket.get())) {
527 stripBox->SetFillStyle(1001);
529 primitives.insert(primitives.begin(), std::move(stripBox));
539 auto myCanvas = std::make_unique<TCanvas>(
"can",
"can",800,600);
547 const double midPointX = 0.5 * (xMax + xMin);
548 const double midPointZ = 0.5 * (zMax + zMin);
549 const double x0 = midPointX - 0.5 *
width;
550 const double z0 = midPointZ - 0.5 * height;
551 const double x1 = midPointX + 0.5 *
width;
552 const double z1 = midPointZ + 0.5 * height;
553 auto frame = myCanvas->DrawFrame(x0,
z0,
x1,z1);
554 frame->GetXaxis()->SetTitle(
"x [mm]");
555 frame->GetYaxis()->SetTitle(
"z [mm]");
565 std::stringstream legendLabel{};
566 legendLabel<<
"Event: "<<ctx.eventID().event_number()<<
", chamber : "<<
m_idHelperSvc->toStringChamber(bucket->at(0)->identify())
568 <<
", nDoF: "<<fitResult.nDoF;
569 if (!extraLabel.empty()) {
570 legendLabel<<
" ("<<extraLabel<<
")";
572 primitives.push_back(
drawLabel(legendLabel.str(), 0.1, 0.96));
576 for (
auto& drawMe: primitives) {
579 std::stringstream canvasName;
580 canvasName<<
"SegmenFitDisplays_"<<ctx.eventID().event_number()<<
"_"<<(m_canvCounter)<<
"P_"
587 myCanvas->SaveAs(canvasName.str().c_str());
◆ ATLAS_THREAD_SAFE
std::atomic<unsigned int> m_canvCounter MuonR4::SegmentFittingAlg::ATLAS_THREAD_SAFE {0} |
|
mutableprivate |
◆ m_allCan
std::unique_ptr<TCanvas> MuonR4::SegmentFittingAlg::m_allCan {} |
|
private |
◆ m_allCanName
Gaudi::Property<std::string> MuonR4::SegmentFittingAlg::m_allCanName {this, "AllCanName", "AllSegmentFits"} |
|
private |
◆ m_beamSpotL
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotL {this, "BeamSpotLength", 20. * Gaudi::Units::m} |
|
private |
◆ m_beamSpotR
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_beamSpotR {this, "BeamSpotRadius", 30.* Gaudi::Units::cm} |
|
private |
◆ m_calibTool
◆ m_detMgr
◆ m_detStore
◆ m_doBeamspotConstraint
Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doBeamspotConstraint {this, "doBeamspotConstraint", false} |
|
private |
◆ m_doT0Fit
Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_doT0Fit {this, "fitSegmentT0", true} |
|
private |
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_geoCtxKey
◆ m_idHelperSvc
◆ m_nDrawCanvases
Gaudi::Property<unsigned int> MuonR4::SegmentFittingAlg::m_nDrawCanvases {this, "MaxCanvases", 5000} |
|
private |
◆ m_outlierRemovalCut
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_outlierRemovalCut {this, "OutlierRemoval", 5.} |
|
private |
◆ m_outSegments
◆ m_recoveryPull
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_recoveryPull {this, "RecoveryPull", 5.} |
|
private |
◆ m_seedHitChi2
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedHitChi2 {this, "ResoSeedHitAssoc", 5. } |
|
private |
◆ m_seedKey
◆ m_seedTanThetaReso
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedTanThetaReso {this, "ResoSeedTanTheta", 250. * Gaudi::Units::mrad} |
|
private |
Two mdt seeds are the same if their defining parameters match wihin.
Definition at line 148 of file SegmentFittingAlg.h.
◆ m_seedY0Reso
Gaudi::Property<double> MuonR4::SegmentFittingAlg::m_seedY0Reso {this, "ResoSeedY0", 500.*Gaudi::Units::micrometer} |
|
private |
◆ m_truthSegKey
ReadHandle for the truth segments (For validation purposes)
Definition at line 124 of file SegmentFittingAlg.h.
◆ m_useMinuit
Gaudi::Property<bool> MuonR4::SegmentFittingAlg::m_useMinuit {this, "useMinuit", false} |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
const ShapeFitter * fitter
char data[hepevt_bytes_allocation_ATLAS]
Gaudi::Property< double > m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
SG::WriteHandleKey< SegmentContainer > m_outSegments
RpcMeasurement_v1: Class storing the geneic.
const MuonGMR4::RpcReadoutElement * readoutElement() const
Retrieve the associated RpcReadoutElement.
Gaudi::Property< double > m_recoveryPull
Gaudi::Property< double > m_beamSpotL
std::pair< std::vector< double >, double > postFitChi2PerMas(const SegmentFit::Parameters &segPars, std::optional< double > arrivalTime, std::vector< std::unique_ptr< CalibratedSpacePoint >> &hits, MsgStream &msg)
Calculates the chi2 per measurement and the chi2 itself after the fit is finished.
std::unordered_set< const xAOD::MuonSimHit * > getTruthMatchedHits(const xAOD::MuonSegment &segment)
: Returns all truth hits matched to a xAOD::MuonSegment
std::string removeNonAlphaNum(std::string str)
Gaudi::Property< double > m_seedY0Reso
void eraseWrongHits(const ActsGeometryContext &gctx, SegmentFitResult &candidate) const
Removes all hits from the segment which are obvious outliers.
const MuonGMR4::MuonDetectorManager * m_detMgr
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
SegmentFitResult fitSegmentHits(const EventContext &ctx, const ActsGeometryContext &gctx, const Parameters &startPars, SegmentFitResult::HitVec &&calibHits) const
Executes the segment fit with start parameters.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
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)
Gaudi::Property< bool > m_useMinuit
Toggle the fitter.
Gaudi::Property< double > m_beamSpotR
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
Class describing a MuonSegment.
SegmentFitResult::HitVec HitVec
Gaudi::Property< bool > m_doT0Fit
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, unsigned int fontSize=18)
#define ATH_MSG_VERBOSE(x)
#define THROW_EXCEPTION(MSG)
void resolveAmbiguities(const ActsGeometryContext &gctx, std::vector< std::unique_ptr< Segment >> &segmentCandidates) const
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
std::string toString(const CalibratedSpacePoint::Covariance_t &mat)
Returns the matrix in string.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
ToolHandle< ISpacePointCalibrator > m_calibTool
MuonR4::SegmentFitResult::HitVec copy(const MuonR4::SegmentFitResult::HitVec &hits)
std::unique_ptr< TLine > drawLine(const MuonR4::SegmentFit::Parameters &pars, const double z1=300.*Gaudi::Units::mm, const double z2=-300.*Gaudi::Units::mm, const int color=kViolet, unsigned int coord=toInt(AxisDefs::eta))
std::vector< std::unique_ptr< Segment > > fitSegmentSeed(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed *seed) const
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegKey
ReadHandle for the truth segments (For validation purposes)
AthReentrantAlgorithm()
Default constructor:
bool plugHoles(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &toRecover) const
Recovery of missed hits.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
Gaudi::Property< double > m_seedHitChi2
bool removeOutliers(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &fitResult) const
Spot hits with large discrepancy from the estimated parameters and remove them from the list.
::StatusCode StatusCode
StatusCode definition for legacy code.
Eigen::Affine3d Transform3D
Parameters truthPars(const xAOD::MuonSegment &truthSeg)
double gasGapPitch() const
Returns the thickness of the gasGap.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool removeBeamSpot(MuonR4::SegmentFitResult::HitVec &hits)
const MuonGMR4::TgcReadoutElement * readoutElement() const
Retrieve the associated TgcReadoutElement.
Include the GeoPrimitives which need to be put first.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
const xAOD::MuonSegment * getTruthSegment(const EventContext &ctx, const std::unordered_set< const xAOD::MuonSimHit * > &matchedSeedHits) const
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Gaudi::Property< bool > m_doBeamspotConstraint
Add beamline constraint.
SG::ReadHandleKey< SegmentSeedContainer > m_seedKey
ReadHandle of the seeds.
std::string to_string(const DetectorType &type)
constexpr int toInt(const ParamDefs p)
virtual StatusCode sysInitialize() override
Override sysInitialize.
int driftSign(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &uncalibHit, MsgStream &msg)
Calculates whether a segement line travereses the tube measurement on the left (-1) or right (1) side...
Gaudi::Property< std::string > m_allCanName
DataVector< SegmentSeed > SegmentSeedContainer
StatusCode retrieveContainer(const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const
Helper method to fetch data from StoreGate.
double lineDistance(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the shortest distance between two lines posA: offset point of line A dirA: orientation of ...
Eigen::Matrix< double, 3, 1 > Vector3D
SegmentAmbiSolver::SegmentVec SegmentVec
std::unique_ptr< TCanvas > m_allCan
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
Gaudi::Property< double > m_seedTanThetaReso
Two mdt seeds are the same if their defining parameters match wihin.
double chiSqTerm(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated measurement.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
std::string makeLabel(const Parameters &pars)
const xAOD::MuonSimHit * getTruthMatchedHit(const xAOD::UncalibratedMeasurement &prdHit)
Returns the MuonSimHit, if there's any, matched to the uncalibrated muon measurement.
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
void visualizeFit(const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel, std::vector< std::unique_ptr< TObject >> primitives={}) const
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Gaudi::Property< unsigned int > m_nDrawCanvases
Draw maximally 5000 segment fit visualizations.
const AmgSymMatrix(2) &SpacePoint
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
void visualizeFitPhi(const EventContext &ctx, const SegmentFitResult &fitResult, const SpacePointBucket *bucket, const std::string &extraLabel) const
Scalar mag() const
mag method
double chiSqTermMdt(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const HoughHitType &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated Mdt measurement.
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
double gasGapPitch() const
Returns the thickness of a RPC gasgap.