CMS 3D CMS Logo

HitRCheck.h
Go to the documentation of this file.
1 #ifndef HitRCheck_H
2 #define HitRCheck_H
3 
9 
10 class HitRCheck final : public HitRZCompatibility {
11 public:
12  static constexpr Algo me = rAlgo;
13 
15 
19 
20  bool operator()(const float& r, const float& z) const override { return range(z).inside(r); }
21 
22  inline Range range(const float& z) const override;
23 
24  HitRCheck* clone() const override { return new HitRCheck(*this); }
25 
27 
28 private:
31 };
32 
33 HitRCheck::Range HitRCheck::range(const float& z) const {
34  constexpr float rBig = 150.; //something above the detector ranges
35  const auto& lineLeft = theRZ.lineLeft();
36  const auto& lineRight = theRZ.lineRight();
37 
38  float rR = lineRight.rAtZ(z);
39  float rL = lineLeft.rAtZ(z);
40  float rMin = (rR < rL) ? rR : rL;
41  float rMax = (rR < rL) ? rL : rR;
42  // in reality all this never happens!
43  float aMin = (rMin > 0) ? rMin : rMax;
44  float aMax = (rMin > 0) ? rMax : rBig;
45  aMin = (rMax > 0) ? aMin : rBig;
46  return Range(aMin - theTolerance.left(), aMax + theTolerance.right());
47 
48  /* check
49  Range v(aMin-theTolerance.left(),aMax+theTolerance.right());
50  Range ori;
51  if (z > 0.) {
52  if (lineRight.cotLine() <= 0.) ori = Range(rBig, 0); //empty
53  else {
54  float rMin = lineRight.rAtZ(z);
55  if (lineLeft.cotLine() <= 0) ori= Range(rMin-theTolerance.left(),rBig);
56  else {
57  float rMax = lineLeft.rAtZ(z);
58  ori = Range(rMin-theTolerance.left(),rMax+theTolerance.right());
59  }
60  }
61  } else {
62  if (lineLeft.cotLine() >= 0.) ori = Range(rBig, 0); //empty
63  else {
64  float rMin = lineLeft.rAtZ(z);
65  if (lineRight.cotLine()>= 0) ori = Range(rMin-theTolerance.left(),rBig);
66  else {
67  float rMax = lineRight.rAtZ(z);
68  ori= Range(rMin-theTolerance.left(),rMax+theTolerance.right());
69  }
70  }
71  }
72 
73  if (ori!=v)
74  std::cout << "v,ori " << v.first << ',' << v.second <<" "
75  << ori.first << ',' << ori.second << std::endl;
76  return ori;
77  */
78 
79  /* original code
80  if (z > 0.) {
81  if (lineRight.cotLine() <= 0.) return Range(rBig, 0); //empty
82  float rMin = lineRight.rAtZ(z);
83  if (lineLeft.cotLine() <= 0) return Range(rMin-theTolerance.left(),rBig);
84  float rMax = lineLeft.rAtZ(z);
85  return Range(rMin-theTolerance.left(),rMax+theTolerance.right());
86  } else {
87  if (lineLeft.cotLine() >= 0.) return Range(rBig, 0); //empty
88  float rMin = lineLeft.rAtZ(z);
89  if (lineRight.cotLine()>= 0) return Range(rMin-theTolerance.left(),rBig);
90  float rMax = lineRight.rAtZ(z);
91  return Range(rMin-theTolerance.left(),rMax+theTolerance.right());
92  }
93  */
94 }
95 #endif
HitRZConstraint theRZ
Definition: HitRCheck.h:29
bool inside(const T &value) const
TkTrackingRegionsMargin< float > Margin
Definition: HitRCheck.h:14
HitRCheck * clone() const override
Definition: HitRCheck.h:24
const double tolerance
const Line & lineLeft() const
HitRCheck(const HitRZConstraint &rz, Margin margin=Margin(0, 0))
Definition: HitRCheck.h:17
static constexpr Algo me
Definition: HitRCheck.h:12
Double_t margin
HitRCheck()
Definition: HitRCheck.h:16
float rAtZ(float z) const
PixelRecoRange< float > Range
Range range(const float &z) const override
Definition: HitRCheck.h:33
const Line & lineRight() const
void setTolerance(const Margin &tolerance)
Definition: HitRCheck.h:26
Margin theTolerance
Definition: HitRCheck.h:30
bool operator()(const float &r, const float &z) const override
Definition: HitRCheck.h:20
Definition: fakeMenu.h:6