CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelRecoLineRZ.h
Go to the documentation of this file.
1 #ifndef PixelRecoLineRZ_H
2 #define PixelRecoLineRZ_H
3 
7 #include <cmath>
8 
11 
13 public:
14 
16 
18 
20  : theTIP2 ( initTIP2( p1.x(), p1.y(), p2.x(), p2.y() ) ),
21  theOrigin ( LineOrigin( subTIP(p1.perp()), p1.z() ) ),
22  theCotLine ( initCot( p2.z()-theOrigin.z(), subTIP(p2.perp())-theOrigin.r() ) )
23  { }
24 
25  PixelRecoLineRZ(const LineOrigin & aOrigin, float aCotLine, float transverseIP = 0.f)
27  theOrigin( subTIP(aOrigin.r()), aOrigin.z() ),
28  theCotLine(aCotLine) { }
29 
30  PixelRecoLineRZ(const LineOrigin & aOrigin, const PixelRecoPointRZ & aPoint, float transverseIP = 0.f)
32  theOrigin( subTIP(aOrigin.r()), aOrigin.z() ),
33  theCotLine( initCot( aPoint.z()-theOrigin.z(), subTIP(aPoint.r())-theOrigin.r() ) )
34  { }
35 
36  float cotLine() const { return theCotLine; }
37  float transverseIP() const { return std::sqrt(theTIP2); }
38  float transverseIP2() const { return theTIP2; }
39  LineOrigin origin() const { return LineOrigin( addTIP(theOrigin.r()), theOrigin.z() ); }
40 
41  float zAtR (float r) const
42  { return theOrigin.z()+(subTIP(r)-theOrigin.r())*theCotLine; }
43  float rAtZ (float z) const
44  { return (std::abs(theCotLine) > 1.e-4f) ? addTIP(theOrigin.r()+(z-theOrigin.z())/theCotLine) : 99999.f; }
45 
46 private:
47  static float initCot (float dz, float dr)
48  { return (std::abs(dr) > 1.e-4f) ? dz/dr : 99999.f; }
49  static float initTIP2 (float x1, float y1, float x2, float y2)
50  {
51  double l = y1 * (x2 - x1) - x1 * (y2 - y1);
52  return l * l / ( (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) );
53  }
54 
55  inline float addTIP (float val) const
56  { return theTIP2 ? std::sqrt(val * val + theTIP2) : val; }
57  inline float subTIP (float val) const
58  {
59  if (!theTIP2) return val;
60  float val2 = val * val;
61  return val2 > theTIP2 ? std::sqrt(val2 - theTIP2) : 0.;
62  }
63 
64 private:
65  float theTIP2;
67  float theCotLine;
68 };
69 
70 // simpler version (no tip)
71 class SimpleLineRZ {
72 public:
73 
75 
77 
78  SimpleLineRZ(const Point & aOrigin, float aCotLine) :
79  theOrigin( aOrigin ),
80  theCotLine(aCotLine) { }
81 
82  SimpleLineRZ(const Point & aOrigin, const Point & aPoint) :
83  theOrigin( aOrigin ),
84  theCotLine( (aPoint.z()-theOrigin.z())/ (aPoint.r()-theOrigin.r()) )
85  { }
86 
87  float cotLine() const { return theCotLine; }
88  Point const & origin() const { return theOrigin; }
89 
90  float zAtR (float r) const { return theOrigin.z()+(r-theOrigin.r())*theCotLine; }
91  float rAtZ (float z) const { return theOrigin.r()+(z-theOrigin.z())/theCotLine; }
92 
93 
94 private:
96  float theCotLine=0;
97 };
98 
99 #endif
float cotLine() const
float transverseIP() const
static float initCot(float dz, float dr)
Point const & origin() const
LineOrigin origin() const
float addTIP(float val) const
SimpleLineRZ(const Point &aOrigin, const Point &aPoint)
float zAtR(float r) const
static float initTIP2(float x1, float y1, float x2, float y2)
float cotLine() const
T sqrt(T t)
Definition: SSEVec.h:48
float subTIP(float val) const
float transverseIP2() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
PixelRecoLineRZ(const LineOrigin &aOrigin, const PixelRecoPointRZ &aPoint, float transverseIP=0.f)
LineOrigin theOrigin
double p2[4]
Definition: TauolaWrapper.h:90
SimpleLineRZ(const Point &aOrigin, float aCotLine)
float z() const
float r() const
T perp() const
Magnitude of transverse component.
PixelRecoPointRZ LineOrigin
float rAtZ(float z) const
double p1[4]
Definition: TauolaWrapper.h:89
float rAtZ(float z) const
PixelRecoLineRZ(const LineOrigin &aOrigin, float aCotLine, float transverseIP=0.f)
PixelRecoLineRZ(const GlobalPoint &p1, const GlobalPoint &p2)
float zAtR(float r) const
PixelRecoPointRZ Point