ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentFinder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef DCMATH_SEGMENTFINDER_H
6#define DCMATH_SEGMENTFINDER_H
7
8#include <cmath>
9#include <memory>
10#include <mutex>
11#include <vector>
12
29
30namespace TrkDriftCircleMath {
31
33 public:
36 SegmentFinder(const SegmentFinder&) = delete;
39 //
40 SegmentFinder(double roadWidth, double deltaCut, bool fullScan);
42 void handleHits(const DCVec& dcs, const CLVec& clusters, ResolvedCollection<Segment, IsSubsetSegment<SortDcsByY>>& segments) const;
43
44 SegVec findSegments(const DCVec& dcs) const;
45 SegVec findSegments(const DCVec& dcs, const CLVec& clusters) const;
46 SegVec cleanSegments(const SegVec& segments) const;
47 SegVec refitSegments(const SegVec& segs) const;
48 bool dropHits(Segment& segment, bool& hasDroppedHit, unsigned int& dropDepth) const;
49
50 void setTGCPullCut(double cut);
51 void setRPCPullCut(double cut);
52 void setRecoverMDT(bool doRecover);
53 void setDropHits(bool doDrop);
54 void setSeedCleaning(bool doCleanup);
55 void setSingleMultiLayerScan(bool doScan);
56 void setChi2DropCut(double chi2);
57 void setDeltaCut(double cut);
58 void setRatioEmptyTubesCut(double ratioEmptyTubesCut);
59 void setMdtGeometry(const ChamberGeometry* mdtGeo) { m_mdtGeometry = mdtGeo; }
60 void setPhiRoad(double phiRoad, double phiChamber, double sinPhiCut = 0.2, bool useRoadPhi = true, bool useChamberPhi = true);
61 void setSortSegmentsUsingAllHits(bool doAllHitsSort);
62 void setUseChamberPhi(bool useChamberPhi);
63 void setRemoveSingleOutliers(bool removeSingleOutliers);
64 void setCurvedSegmentFinder(bool doCurvedSegmentFinder);
65 void setFitter(std::shared_ptr<const DCSLFitter> fitter) { m_fitter = fitter; }
66 void setMaxDropDepth(int max);
67 void setResidualCutT0(double resCut);
68 void setDeltaCutT0(double deltaCut);
69 void setUseSegmentQuality(bool useQ);
70
72
73 protected:
74 static DCVec selectSeeds(const DCVec& dcs, int maxSerie) ;
75 static std::pair<DCVec, DCVec> splitInMulitlayers(const DCVec& dcs) ;
76 static DCVec removeDCOnSegments(const DCVec& dcs, const SegVec& segs) ;
77
78 unsigned int emptyCrossedTubes(const Line& line, const DCVec& closeEmptyTubes) const;
79 DCVec emptyNeighbours(const DCVec& dcs) const;
80
81 void handleSeedPair(const DriftCircle& seed1, const DriftCircle& seeds2, const DCVec& dcs, const CLVec& cls,
83 void fullScan(const DCVec& seeds, const DCVec& dcs, const CLVec& cls,
85 void twoMultiLayerScan(const DCVec& seeds_ml1, const DCVec& seeds_ml2, const DCVec& dcs, const CLVec& cls,
87
88 bool directionCheck(const LocVec2D& LocVec2D) const;
89
90 void associateClusters(SegVec& segs, const CLVec& cls) const;
91 void associateClusters(Segment& seg, const CLVec& cls) const;
92
93 void crossedTubes(Segment& seg) const;
94 static void updateMatch(Segment& seg, MatchDCWithLine& matchWithLine) ;
95
96 bool goodHitRatio(Segment& seg) const;
97
99 void updateDirections();
100
102 void printSettings() const;
103
104 double tubeRadius() const { return m_mdtGeometry ? m_mdtGeometry->tubeRadius() : 14.6; }
105
106 double m_deltaCut{5.};
107 double m_roadWidth{1.5};
108 double m_phiRoad{M_PI_2};
110 double m_phiChamber{M_PI_2};
112
113 double m_phiDifCut{0.5};
115 double m_chi2Cut{10};
116 double m_tgcPullCut{5};
117 double m_rpcPullCut{5};
118 double m_resCutT0{1.};
119 double m_deltaCutT0{5.};
122
123 std::shared_ptr<const DCSLFitter> m_fitter;
126
128 bool m_fullScan{false};
130 bool m_seedCleaning{false};
131 bool m_doDrop{true};
132 unsigned int m_dropDepthMax{4};
133 bool m_doAllHitSort{false};
135 bool m_useChamberPhi{true};
136 bool m_useRoadPhi{true};
139
140 mutable std::vector<int> m_dropDepthAcceptCounts ATLAS_THREAD_SAFE{(int)m_dropDepthMax + 2, 0}; // Guarded by m_mutex
141 mutable std::vector<int> m_dropDepthRejectCounts ATLAS_THREAD_SAFE{(int)m_dropDepthMax + 1, 0}; // Guarded by m_mutex
142 mutable std::mutex m_mutex;
143 };
144
145 inline bool SegmentFinder::directionCheck(const LocVec2D& lineDir) const {
146 // check whether the
147 if (m_useRoadPhi) {
148 double prodRoad = lineDir * m_roadDir;
149 if (prodRoad < 0.) prodRoad *= -1.;
150 if (prodRoad > m_phiDifCut) return true;
151 }
152 if (m_useChamberPhi) {
153 double prodChamber = lineDir * m_chamberDir;
154 if (prodChamber < 0.) prodChamber *= -1.;
155 if (prodChamber > m_phiDifCut) return true;
156 }
157 return false;
158 }
159
160} // namespace TrkDriftCircleMath
161
162#endif
#define max(a, b)
Definition cfImp.cxx:41
Define macros for attributes used to control the static checker.
This class represents a drift time measurement.
Definition DriftCircle.h:22
Implementation of 2 dimensional vector class.
Definition LocVec2D.h:16
void setDeltaCutT0(double deltaCut)
void fullScan(const DCVec &seeds, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
void printSettings() const
print settings
SegmentFinder(const SegmentFinder &)=delete
copy c'tor deleted to prevent ownership/leak issues
std::shared_ptr< const DCSLFitter > m_fitter
SegmentFinder & operator=(const SegmentFinder &)=delete
assignment deleted to prevent ownership/leak issues
void associateClusters(SegVec &segs, const CLVec &cls) const
void setMdtGeometry(const ChamberGeometry *mdtGeo)
bool dropHits(Segment &segment, bool &hasDroppedHit, unsigned int &dropDepth) const
SegVec findSegments(const DCVec &dcs) const
static DCVec selectSeeds(const DCVec &dcs, int maxSerie)
void setRemoveSingleOutliers(bool removeSingleOutliers)
void handleSeedPair(const DriftCircle &seed1, const DriftCircle &seeds2, const DCVec &dcs, const CLVec &cls, MatchDCWithLine &matchWithLine, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
void setPhiRoad(double phiRoad, double phiChamber, double sinPhiCut=0.2, bool useRoadPhi=true, bool useChamberPhi=true)
void setRatioEmptyTubesCut(double ratioEmptyTubesCut)
void setUseChamberPhi(bool useChamberPhi)
DCVec emptyNeighbours(const DCVec &dcs) const
static std::pair< DCVec, DCVec > splitInMulitlayers(const DCVec &dcs)
void debugLevel(int debugLevel)
bool goodHitRatio(Segment &seg) const
void handleHits(const DCVec &dcs, const CLVec &clusters, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
static void updateMatch(Segment &seg, MatchDCWithLine &matchWithLine)
void setSeedCleaning(bool doCleanup)
void updateDirections()
update the cached values for the phi road and chamber road
bool directionCheck(const LocVec2D &LocVec2D) const
void twoMultiLayerScan(const DCVec &seeds_ml1, const DCVec &seeds_ml2, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
void setSortSegmentsUsingAllHits(bool doAllHitsSort)
unsigned int emptyCrossedTubes(const Line &line, const DCVec &closeEmptyTubes) const
const ChamberGeometry * m_mdtGeometry
std::vector< int > m_dropDepthAcceptCounts ATLAS_THREAD_SAFE
SegVec cleanSegments(const SegVec &segments) const
SegVec refitSegments(const SegVec &segs) const
static DCVec removeDCOnSegments(const DCVec &dcs, const SegVec &segs)
void setFitter(std::shared_ptr< const DCSLFitter > fitter)
void setCurvedSegmentFinder(bool doCurvedSegmentFinder)
void crossedTubes(Segment &seg) const
void setSingleMultiLayerScan(bool doScan)
double chi2(TH1 *h0, TH1 *h1)
Function object to check whether two Segments are sub/super sets or different.
std::vector< DriftCircle > DCVec