CMS 3D CMS Logo

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