File indexing completed on 2024-04-06 12:28:56
0001 #ifndef HitRCheck_H
0002 #define HitRCheck_H
0003
0004
0005
0006
0007 #include "RecoTracker/TkTrackingRegions/interface/HitRZCompatibility.h"
0008 #include "RecoTracker/TkTrackingRegions/interface/HitRZConstraint.h"
0009
0010 class HitRCheck final : public HitRZCompatibility {
0011 public:
0012 static constexpr Algo me = rAlgo;
0013
0014 typedef TkTrackingRegionsMargin<float> Margin;
0015
0016 HitRCheck() : HitRZCompatibility(me) {}
0017 HitRCheck(const HitRZConstraint& rz, Margin margin = Margin(0, 0))
0018 : HitRZCompatibility(me), theRZ(rz), theTolerance(margin) {}
0019
0020 bool operator()(const float& r, const float& z) const override { return range(z).inside(r); }
0021
0022 inline Range range(const float& z) const override;
0023
0024 HitRCheck* clone() const override { return new HitRCheck(*this); }
0025
0026 void setTolerance(const Margin& tolerance) { theTolerance = tolerance; }
0027
0028 private:
0029 HitRZConstraint theRZ;
0030 Margin theTolerance;
0031 };
0032
0033 HitRCheck::Range HitRCheck::range(const float& z) const {
0034 constexpr float rBig = 150.;
0035 const auto& lineLeft = theRZ.lineLeft();
0036 const auto& lineRight = theRZ.lineRight();
0037
0038 float rR = lineRight.rAtZ(z);
0039 float rL = lineLeft.rAtZ(z);
0040 float rMin = (rR < rL) ? rR : rL;
0041 float rMax = (rR < rL) ? rL : rR;
0042
0043 float aMin = (rMin > 0) ? rMin : rMax;
0044 float aMax = (rMin > 0) ? rMax : rBig;
0045 aMin = (rMax > 0) ? aMin : rBig;
0046 return Range(aMin - theTolerance.left(), aMax + theTolerance.right());
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
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
0093
0094 }
0095 #endif