CMS 3D CMS Logo

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:
15 
17 
19  : theTIP2(initTIP2(p1.x(), p1.y(), p2.x(), p2.y())),
21  theCotLine(initCot(p2.z() - theOrigin.z(), subTIP(p2.perp()) - theOrigin.r())) {}
22 
23  PixelRecoLineRZ(const LineOrigin& aOrigin, float aCotLine, float transverseIP = 0.f)
24  : theTIP2(transverseIP * transverseIP), theOrigin(subTIP(aOrigin.r()), aOrigin.z()), theCotLine(aCotLine) {}
25 
26  PixelRecoLineRZ(const LineOrigin& aOrigin, const PixelRecoPointRZ& aPoint, float transverseIP = 0.f)
28  theOrigin(subTIP(aOrigin.r()), aOrigin.z()),
29  theCotLine(initCot(aPoint.z() - theOrigin.z(), subTIP(aPoint.r()) - theOrigin.r())) {}
30 
31  float cotLine() const { return theCotLine; }
32  float transverseIP() const { return std::sqrt(theTIP2); }
33  float transverseIP2() const { return theTIP2; }
34  LineOrigin origin() const { return LineOrigin(addTIP(theOrigin.r()), theOrigin.z()); }
35 
36  float zAtR(float r) const { return theOrigin.z() + (subTIP(r) - theOrigin.r()) * theCotLine; }
37  float rAtZ(float z) const {
38  return (std::abs(theCotLine) > 1.e-4f) ? addTIP(theOrigin.r() + (z - theOrigin.z()) / theCotLine) : 99999.f;
39  }
40 
41 private:
42  static float initCot(float dz, float dr) { return (std::abs(dr) > 1.e-4f) ? dz / dr : 99999.f; }
43  static float initTIP2(float x1, float y1, float x2, float y2) {
44  double l = y1 * (x2 - x1) - x1 * (y2 - y1);
45  return l * l / ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
46  }
47 
48  inline float addTIP(float val) const { return theTIP2 ? std::sqrt(val * val + theTIP2) : val; }
49  inline float subTIP(float val) const {
50  if (!theTIP2)
51  return val;
52  float val2 = val * val;
53  return val2 > theTIP2 ? std::sqrt(val2 - theTIP2) : 0.;
54  }
55 
56 private:
57  float theTIP2;
59  float theCotLine;
60 };
61 
62 // simpler version (no tip)
63 class SimpleLineRZ {
64 public:
66 
68 
69  SimpleLineRZ(const Point& aOrigin, float aCotLine) : theOrigin(aOrigin), theCotLine(aCotLine) {}
70 
71  SimpleLineRZ(const Point& aOrigin, const Point& aPoint)
72  : theOrigin(aOrigin), theCotLine((aPoint.z() - theOrigin.z()) / (aPoint.r() - theOrigin.r())) {}
73 
74  float cotLine() const { return theCotLine; }
75  Point const& origin() const { return theOrigin; }
76 
77  float zAtR(float r) const { return theOrigin.z() + (r - theOrigin.r()) * theCotLine; }
78  float rAtZ(float z) const { return theOrigin.r() + (z - theOrigin.z()) / theCotLine; }
79 
80 private:
82  float theCotLine = 0;
83 };
84 
85 #endif
PixelRecoPointRZ.h
PixelRecoPointRZ::r
float r() const
Definition: PixelRecoPointRZ.h:10
DDAxes::y
PixelRecoLineRZ::PixelRecoLineRZ
PixelRecoLineRZ()
Definition: PixelRecoLineRZ.h:16
PixelRecoLineRZ::theCotLine
float theCotLine
Definition: PixelRecoLineRZ.h:59
PixelRecoLineRZ::PixelRecoLineRZ
PixelRecoLineRZ(const LineOrigin &aOrigin, const PixelRecoPointRZ &aPoint, float transverseIP=0.f)
Definition: PixelRecoLineRZ.h:26
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
SimpleLineRZ::Point
PixelRecoPointRZ Point
Definition: PixelRecoLineRZ.h:65
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
SimpleLineRZ::rAtZ
float rAtZ(float z) const
Definition: PixelRecoLineRZ.h:78
SimpleLineRZ::cotLine
float cotLine() const
Definition: PixelRecoLineRZ.h:74
SimpleLineRZ::SimpleLineRZ
SimpleLineRZ()
Definition: PixelRecoLineRZ.h:67
DDAxes::x
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
PixelRecoLineRZ::theTIP2
float theTIP2
Definition: PixelRecoLineRZ.h:57
PixelRecoPointRZ::z
float z() const
Definition: PixelRecoPointRZ.h:11
PixelRecoLineRZ::LineOrigin
PixelRecoPointRZ LineOrigin
Definition: PixelRecoLineRZ.h:14
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
PixelRecoLineRZ::initTIP2
static float initTIP2(float x1, float y1, float x2, float y2)
Definition: PixelRecoLineRZ.h:43
PixelRecoLineRZ::zAtR
float zAtR(float r) const
Definition: PixelRecoLineRZ.h:36
SimpleLineRZ::SimpleLineRZ
SimpleLineRZ(const Point &aOrigin, float aCotLine)
Definition: PixelRecoLineRZ.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
p2
double p2[4]
Definition: TauolaWrapper.h:90
Point3DBase< float, GlobalTag >
PixelRecoLineRZ::transverseIP2
float transverseIP2() const
Definition: PixelRecoLineRZ.h:33
PixelRecoLineRZ::subTIP
float subTIP(float val) const
Definition: PixelRecoLineRZ.h:49
PixelRecoLineRZ::PixelRecoLineRZ
PixelRecoLineRZ(const GlobalPoint &p1, const GlobalPoint &p2)
Definition: PixelRecoLineRZ.h:18
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
PixelRecoLineRZ::initCot
static float initCot(float dz, float dr)
Definition: PixelRecoLineRZ.h:42
PixelRecoLineRZ::transverseIP
float transverseIP() const
Definition: PixelRecoLineRZ.h:32
PixelRecoLineRZ
Definition: PixelRecoLineRZ.h:12
p1
double p1[4]
Definition: TauolaWrapper.h:89
PixelRecoLineRZ::origin
LineOrigin origin() const
Definition: PixelRecoLineRZ.h:34
SimpleLineRZ::zAtR
float zAtR(float r) const
Definition: PixelRecoLineRZ.h:77
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
PixelRecoPointRZ
Definition: PixelRecoPointRZ.h:6
alignCSCRings.r
r
Definition: alignCSCRings.py:93
SimpleLineRZ
Definition: PixelRecoLineRZ.h:63
SimpleLineRZ::origin
Point const & origin() const
Definition: PixelRecoLineRZ.h:75
PixelRecoLineRZ::theOrigin
LineOrigin theOrigin
Definition: PixelRecoLineRZ.h:58
SimpleLineRZ::theOrigin
Point theOrigin
Definition: PixelRecoLineRZ.h:81
heppy_batch.val
val
Definition: heppy_batch.py:351
PVValHelper::dz
Definition: PVValidationHelpers.h:51
PixelRecoLineRZ::cotLine
float cotLine() const
Definition: PixelRecoLineRZ.h:31
SimpleLineRZ::SimpleLineRZ
SimpleLineRZ(const Point &aOrigin, const Point &aPoint)
Definition: PixelRecoLineRZ.h:71
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
PixelRecoLineRZ::PixelRecoLineRZ
PixelRecoLineRZ(const LineOrigin &aOrigin, float aCotLine, float transverseIP=0.f)
Definition: PixelRecoLineRZ.h:23
SimpleLineRZ::theCotLine
float theCotLine
Definition: PixelRecoLineRZ.h:82
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PixelRecoLineRZ::rAtZ
float rAtZ(float z) const
Definition: PixelRecoLineRZ.h:37
PixelRecoLineRZ::addTIP
float addTIP(float val) const
Definition: PixelRecoLineRZ.h:48
GlobalPoint.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37