File indexing completed on 2024-04-06 12:28:56
0001 #ifndef RectangularEtaPhiTrackingRegion_H
0002 #define RectangularEtaPhiTrackingRegion_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0012 #include "RecoTracker/TkTrackingRegions/interface/TkTrackingRegionsMargin.h"
0013
0014 #include "RecoTracker/TkTrackingRegions/interface/HitRZConstraint.h"
0015
0016 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0017 #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h"
0018
0019 class OuterHitPhiPrediction;
0020 class BarrelDetLayer;
0021 class ForwardDetLayer;
0022 class MeasurementTrackerEvent;
0023 class MagneticField;
0024 class MultipleScatteringParametrisationMaker;
0025
0026 class RectangularEtaPhiTrackingRegion final : public TrackingRegion {
0027 public:
0028 enum class UseMeasurementTracker { kNever = -1, kForSiStrips = 0, kAlways = 1 };
0029
0030 static UseMeasurementTracker intToUseMeasurementTracker(int value) {
0031 assert(value >= -1 && value <= 1);
0032 return static_cast<UseMeasurementTracker>(value);
0033 }
0034
0035 static UseMeasurementTracker doubleToUseMeasurementTracker(double value) {
0036
0037 if (value > 0.5)
0038 return UseMeasurementTracker::kAlways;
0039 if (value > -0.5)
0040 return UseMeasurementTracker::kForSiStrips;
0041 return UseMeasurementTracker::kNever;
0042 }
0043
0044 static UseMeasurementTracker stringToUseMeasurementTracker(const std::string& name);
0045
0046 RectangularEtaPhiTrackingRegion() {}
0047
0048 RectangularEtaPhiTrackingRegion(RectangularEtaPhiTrackingRegion const& rh)
0049 : TrackingRegion(rh),
0050 theEtaRange(rh.theEtaRange),
0051 theLambdaRange(rh.theLambdaRange),
0052 thePhiMargin(rh.thePhiMargin),
0053 theMeanLambda(rh.theMeanLambda),
0054 theMeasurementTrackerUsage(rh.theMeasurementTrackerUsage),
0055 thePrecise(rh.thePrecise),
0056 theUseEtaPhi(rh.theUseEtaPhi),
0057 theMeasurementTracker(rh.theMeasurementTracker),
0058 theField(rh.theField),
0059 theMSMaker(rh.theMSMaker) {}
0060 RectangularEtaPhiTrackingRegion& operator=(RectangularEtaPhiTrackingRegion const&) = delete;
0061 RectangularEtaPhiTrackingRegion(RectangularEtaPhiTrackingRegion&&) = default;
0062 RectangularEtaPhiTrackingRegion& operator=(RectangularEtaPhiTrackingRegion&&) = delete;
0063
0064 typedef TkTrackingRegionsMargin<float> Margin;
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 RectangularEtaPhiTrackingRegion(const GlobalVector& dir,
0093 const GlobalPoint& vertexPos,
0094 float ptMin,
0095 float rVertex,
0096 float zVertex,
0097 float deltaEta,
0098 float deltaPhi,
0099 const MagneticField& field,
0100 const MultipleScatteringParametrisationMaker* msmaker,
0101 bool precise = true,
0102 UseMeasurementTracker whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
0103 const MeasurementTrackerEvent* measurementTracker = nullptr,
0104 bool etaPhiRegion = false)
0105 : RectangularEtaPhiTrackingRegion(dir,
0106 vertexPos,
0107 Range(-1 / ptMin, 1 / ptMin),
0108 rVertex,
0109 zVertex,
0110 Margin(std::abs(deltaEta), std::abs(deltaEta)),
0111 Margin(std::abs(deltaPhi), std::abs(deltaPhi)),
0112 field,
0113 msmaker,
0114 precise,
0115 whereToUseMeasurementTracker,
0116 measurementTracker,
0117 etaPhiRegion) {}
0118
0119
0120
0121
0122
0123
0124
0125 RectangularEtaPhiTrackingRegion(const GlobalVector& dir,
0126 const GlobalPoint& vertexPos,
0127 float ptMin,
0128 float rVertex,
0129 float zVertex,
0130 Margin etaMargin,
0131 Margin phiMargin,
0132 const MagneticField& field,
0133 const MultipleScatteringParametrisationMaker* msmaker,
0134 bool precise = true,
0135 UseMeasurementTracker whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
0136 const MeasurementTrackerEvent* measurementTracker = nullptr,
0137 bool etaPhiRegion = false)
0138 : RectangularEtaPhiTrackingRegion(dir,
0139 vertexPos,
0140 Range(-1 / ptMin, 1 / ptMin),
0141 rVertex,
0142 zVertex,
0143 etaMargin,
0144 phiMargin,
0145 field,
0146 msmaker,
0147 precise,
0148 whereToUseMeasurementTracker,
0149 measurementTracker,
0150 etaPhiRegion) {}
0151
0152
0153
0154
0155
0156 RectangularEtaPhiTrackingRegion(const GlobalVector& dir,
0157 const GlobalPoint& vertexPos,
0158 Range invPtRange,
0159 float rVertex,
0160 float zVertex,
0161 Margin etaMargin,
0162 Margin phiMargin,
0163 const MagneticField& field,
0164 const MultipleScatteringParametrisationMaker* msmaker,
0165 bool precise = true,
0166 UseMeasurementTracker whereToUseMeasurementTracker = UseMeasurementTracker::kNever,
0167 const MeasurementTrackerEvent* measurementTracker = nullptr,
0168 bool etaPhiRegion = false,
0169 bool useMS = true)
0170 : TrackingRegionBase(dir, vertexPos, invPtRange, rVertex, zVertex),
0171 thePhiMargin(phiMargin),
0172 theMeasurementTrackerUsage(whereToUseMeasurementTracker),
0173 thePrecise(precise),
0174 theUseMS(useMS),
0175 theUseEtaPhi(etaPhiRegion),
0176 theMeasurementTracker(measurementTracker),
0177 theField(&field),
0178 theMSMaker(msmaker) {
0179 initEtaRange(dir, etaMargin);
0180 }
0181
0182
0183 const Range& etaRange() const { return theEtaRange; }
0184 const Range& tanLambdaRange() const { return theLambdaRange; }
0185
0186
0187
0188 const Margin& phiMargin() const { return thePhiMargin; }
0189
0190
0191 bool isPrecise() const { return thePrecise; }
0192
0193 TrackingRegion::Hits hits(const SeedingLayerSetsHits::SeedingLayer& layer) const override;
0194
0195
0196
0197 void checkTracks(reco::TrackCollection const& tracks, std::vector<bool>& mask) const override;
0198
0199 std::unique_ptr<HitRZCompatibility> checkRZ(const DetLayer* layer,
0200 const Hit& outerHit,
0201 const DetLayer* outerlayer = nullptr,
0202 float lr = 0,
0203 float gz = 0,
0204 float dr = 0,
0205 float dz = 0) const override {
0206 return checkRZOld(layer, outerHit, outerlayer);
0207 }
0208
0209 std::unique_ptr<TrackingRegion> clone() const override {
0210 return std::make_unique<RectangularEtaPhiTrackingRegion>(*this);
0211 }
0212
0213 std::string name() const override { return "RectangularEtaPhiTrackingRegion"; }
0214 std::string print() const override;
0215
0216 private:
0217 std::unique_ptr<HitRZCompatibility> checkRZOld(const DetLayer* layer,
0218 const Hit& outerHit,
0219 const DetLayer* outerlayer) const;
0220
0221 std::unique_ptr<MeasurementEstimator> estimator(const BarrelDetLayer* layer) const dso_internal;
0222 std::unique_ptr<MeasurementEstimator> estimator(const ForwardDetLayer* layer) const dso_internal;
0223
0224 OuterHitPhiPrediction phiWindow(const MagneticField& field) const dso_internal;
0225 HitRZConstraint rzConstraint() const dso_internal;
0226
0227 void initEtaRange(const GlobalVector& dir, const Margin& margin);
0228
0229 private:
0230 Range theEtaRange;
0231 Range theLambdaRange;
0232 Margin thePhiMargin;
0233 float theMeanLambda;
0234 const UseMeasurementTracker theMeasurementTrackerUsage = UseMeasurementTracker::kNever;
0235 bool thePrecise = false;
0236 bool theUseMS = false;
0237 bool theUseEtaPhi = false;
0238 const MeasurementTrackerEvent* theMeasurementTracker = nullptr;
0239 const MagneticField* theField = nullptr;
0240 const MultipleScatteringParametrisationMaker* theMSMaker = nullptr;
0241
0242 using cacheHitPointer = mayown_ptr<BaseTrackerRecHit>;
0243 using cacheHits = std::vector<cacheHitPointer>;
0244
0245
0246
0247
0248
0249 mutable cacheHits cache;
0250 };
0251
0252 #endif