ATLAS Offline Software
Loading...
Searching...
No Matches
MdtMathSegmentFinder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
12
13
14
15namespace Muon {
16
17 MdtMathSegmentFinder::MdtMathSegmentFinder(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p) {
18 declareInterface<IMdtSegmentFinder>(this);
19 }
20
22 if (!m_dcslFitProvider.empty()) {
23 ATH_CHECK(m_dcslFitProvider.retrieve());
24 ATH_MSG_INFO(" Using fitter from " << m_dcslFitProvider);
25 }
26 ATH_CHECK(m_idHelperSvc.retrieve());
27 return StatusCode::SUCCESS;
28 }
29
31 const TrkDriftCircleMath::CLVec& clvec,
32 const TrkDriftCircleMath::Road& road,
34 const TrkDriftCircleMath::ChamberGeometry* multiGeo) const {
35 // setup finder
37
38 // set debug level
39 segmentFinder.debugLevel(m_finderDebugLevel);
40
41 // configure uasge of chamber position for angular seeding
43
44 // enable dropping of hits
45 segmentFinder.setDropHits(m_doDrop);
46
47 // enable seed cleaing
49
50 // do single multilayer scan?
52
53 // set chi2/ndof threshold for cleaning of segments
54 segmentFinder.setChi2DropCut(m_chi2PerDofDrop);
55
56 // set ratio for dropping segments with many empty tubes
58
59 // set sort mode segment finder
61
62 // set RPC pull cut
64
65 // set TGC pull cut
67
68 // set MDT outlier recovery
70
71 // set removal of single outliers
73
74 // set the curved segment finder
76
77 // set removal of single outliers
78 segmentFinder.setDeltaCutT0(m_deltaCutT0Segments); // reset defaults
79
80 // set removal of single outliers
82
83 // set use of segment quality
85
86 if (!m_dcslFitProvider.empty()) {
87 std::shared_ptr<const TrkDriftCircleMath::DCSLFitter> fitter(m_dcslFitProvider->getFitter(), Muon::IDCSLFitProvider::Unowned{});
88 segmentFinder.setFitter(fitter);
89 } else {
90 segmentFinder.setFitter(std::make_shared<TrkDriftCircleMath::DCSLFitter>());
91 }
92
93 // set angle prediction from road
94 segmentFinder.setPhiRoad(road.angle(), road.chamberAngle(), road.width(), m_doRoadAngleSeeding, m_doIPAngleSeeding);
95
96 // set pointer to geometry
97 segmentFinder.setMdtGeometry(multiGeo);
98
99 // set seed cleaning
100 bool highOccupancy = false;
101 bool aboveOccupancyCut = false;
102 double occupancyMax = 0.;
103 unsigned int nmdtHits = 0;
104 // calculate multi layer occupancy
105 TrkDriftCircleMath::DCStatCit mit = dcstats.begin();
106 TrkDriftCircleMath::DCStatCit mit_end = dcstats.end();
107 for (; mit != mit_end; ++mit) {
108 unsigned int channels = mit->first->getNLayers() * mit->first->getNtubesperlayer();
109 double occupancy = (double)mit->second / (double)channels;
110
111 nmdtHits += mit->second;
112
113 occupancyMax = std::max(occupancy, occupancyMax);
114
115 if (occupancy > m_occupancyThreshold) highOccupancy = true;
116
117 if (occupancy > m_occupancyCutOff) aboveOccupancyCut = true;
118 }
119
120 // sanity check
121 if (nmdtHits != dcvec.size()) {
122 ATH_MSG_WARNING(" inconsistent number of mdt hits " << nmdtHits << " from vec " << dcvec.size());
123 nmdtHits = dcvec.size();
124 }
125
126 if (aboveOccupancyCut) {
127 ATH_MSG_DEBUG(" layer with occupancy above threshold, aborting segment finding "
128 << occupancyMax << " cut " << m_occupancyCutOff << " nhits " << nmdtHits << " cut " << m_maxHitsPerFullSearch);
129 return {};
130 }
131
132 // enable seed cleaning
133 if (highOccupancy || nmdtHits > m_maxHitsPerFullSearch) {
134 ATH_MSG_DEBUG(" switch to fast search: occupancy " << occupancyMax << " cut " << m_occupancyThreshold << " nhits " << nmdtHits
135 << " cut " << m_maxHitsPerFullSearch);
136
137 // to speed up reconstruction use default fitter
138 if (!m_dcslFitProvider.empty()) {
139 segmentFinder.setFitter(std::make_shared<TrkDriftCircleMath::DCSLFitter>());
140 }
141
142 // use tight road cuts and only look for pointing segments
143 segmentFinder.setPhiRoad(road.chamberAngle(), road.chamberAngle(), m_tightRoadCut);
144 }
145
146 return segmentFinder.findSegments(dcvec, clvec);
147 }
148
149} // namespace Muon
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< double > m_occupancyCutOff
Gaudi::Property< bool > m_enableSeedCleaning
Gaudi::Property< double > m_rpcAssociationPullCut
Gaudi::Property< bool > m_useChamberTheta
Gaudi::Property< double > m_tightRoadCut
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< IDCSLFitProvider > m_dcslFitProvider
Gaudi::Property< double > m_chi2PerDofDrop
Gaudi::Property< bool > m_useSegmentQuality
virtual const TrkDriftCircleMath::SegVec findSegments(const TrkDriftCircleMath::DCVec &dcvec, const TrkDriftCircleMath::CLVec &clvec, const TrkDriftCircleMath::Road &road, const TrkDriftCircleMath::DCStatistics &dcstats, const TrkDriftCircleMath::ChamberGeometry *multiGeo) const
IMdtMdtMathSegmentFinder interface implementation.
MdtMathSegmentFinder(const std::string &t, const std::string &n, const IInterface *p)
Gaudi::Property< unsigned int > m_maxHitsPerFullSearch
Gaudi::Property< int > m_finderDebugLevel
Gaudi::Property< double > m_mdtAssociationPullCut
Gaudi::Property< bool > m_doCurvedSegmentFinder
Gaudi::Property< double > m_residualCutT0Segments
Gaudi::Property< double > m_tgcAssociationPullCut
Gaudi::Property< bool > m_doAllHitSort
Gaudi::Property< bool > m_recoverMdtOutliers
Gaudi::Property< double > m_ratioEmptyTubesCut
Gaudi::Property< bool > m_doRoadAngleSeeding
Gaudi::Property< bool > m_removeSingleOutliers
Gaudi::Property< bool > m_doDrop
Gaudi::Property< bool > m_doSingleMultiLayerScan
Gaudi::Property< double > m_deltaCutT0Segments
Gaudi::Property< double > m_occupancyThreshold
Gaudi::Property< bool > m_doIPAngleSeeding
Gaudi::Property< double > m_roadWidth
This class offers no functionality, but to define a standard device for the maker to transfer to the ...
TrkDriftCircleMath::Road - encodes the road given to the segment finder in station coordinates.
Definition Road.h:15
double chamberAngle() const
returns the angle of the line from the chamber center to the IP in local AMDB chamber coordinates
Definition Road.h:35
double width() const
returns the width angle of the road
Definition Road.h:38
double angle() const
returns the angle of the road in local coordinates
Definition Road.h:32
void setDeltaCutT0(double deltaCut)
void setMdtGeometry(const ChamberGeometry *mdtGeo)
SegVec findSegments(const DCVec &dcs) const
void setRemoveSingleOutliers(bool removeSingleOutliers)
void setPhiRoad(double phiRoad, double phiChamber, double sinPhiCut=0.2, bool useRoadPhi=true, bool useChamberPhi=true)
void setRatioEmptyTubesCut(double ratioEmptyTubesCut)
void setUseChamberPhi(bool useChamberPhi)
void debugLevel(int debugLevel)
void setSeedCleaning(bool doCleanup)
void setSortSegmentsUsingAllHits(bool doAllHitsSort)
void setFitter(std::shared_ptr< const DCSLFitter > fitter)
void setCurvedSegmentFinder(bool doCurvedSegmentFinder)
void setSingleMultiLayerScan(bool doScan)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::vector< DriftCircle > DCVec
DCStatistics::const_iterator DCStatCit
Helper struct to overload the destructors of smart pointers.