All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointHit.cxx
Go to the documentation of this file.
1 // This Class' Header ------------------
3 
4 // C/C++ Headers ----------------------
5 
6 
7 // Collaborating Class Headers --------
11 #include <math.h>
12 
13 // Class Member definitions -----------
14 
15 //ClassImp(PointHit)
16 
17 
19 {}
20 
22  : SpacepointRecoHit(NparHitRep)
23 {}
24 
25 genf::PointHit::PointHit(TVector3 point,double res)
26  : SpacepointRecoHit(NparHitRep){
27 
28  fHitCov[0][0] = res*res;
29  fHitCov[1][1] = res*res;
30  fHitCov[2][2] = res*res;
31  GFDetPlane d;
32 
33  fHitCoord[0][0] = point.X();
34  fHitCoord[1][0] = point.Y();
35  fHitCoord[2][0] = point.Z();
36 
37 }
38 
39 
40 genf::PointHit::PointHit(TVector3 point, std::vector<double> &res)
41  : SpacepointRecoHit(NparHitRep){
42 
43  //assert (res.size()==4);
44 
45  fHitCov[0][0] = res.at(0);
46  fHitCov[1][1] = res.at(1);
47  fHitCov[2][2] = res.at(3);
48  fHitCov[1][2] = res.at(2); // yz cov element.
49  fHitCov[2][1] = res.at(2); // yz cov element.
50 
51  GFDetPlane d;
52 
53  fHitCoord[0][0] = point.X();
54  fHitCoord[1][0] = point.Y();
55  fHitCoord[2][0] = point.Z();
56 }
57 
59  return new PointHit(*this);
60 }
61 
62 
63 TMatrixT<Double_t>
64 genf::PointHit::getHMatrix(const GFAbsTrackRep* stateVector, const Double_t& betac, const Double_t& dist)
65 {
66  if (dynamic_cast<const genf::RKTrackRep*>(stateVector) != nullptr){
67  //I know, since this is the same everytime, it could be done in the
68  //the constructor, but I do it here anyway, to make clear that in the
69  //case of several track-reps per hit, it would have to be done here
70  // fHMatrix.ResizeTo(NparHitRep,5);
71 
72 
73  // TMatrixT<Double_t> HMatrix(2,6);
74  // WTF? Making this 2,5 not 2,6. EC, 3-Jan-2011.
75  // TMatrixT<Double_t> HMatrix(2,5);
76  TMatrixT<Double_t> HMatrix(5,5);
77 
78  Double_t C = 0.0136/betac*sqrt(dist/14.0)*(1+0.038*log(dist/14.0)); // EC, 2-Jan-2012.
79 
80  HMatrix[0][0] = C;
81  HMatrix[0][1] = 0.;
82  HMatrix[0][2] = 0.;
83  HMatrix[0][3] = 0.;
84  HMatrix[0][4] = 0.;
85 
86  HMatrix[1][0] = 0.;
87  HMatrix[1][1] = 1.;
88  HMatrix[1][2] = 0.;
89  HMatrix[1][3] = 0.;
90  HMatrix[1][4] = 0.;
91 
92  HMatrix[2][0] = 0.;
93  HMatrix[2][1] = 0.;
94  HMatrix[2][2] = 1.;
95  HMatrix[2][3] = 0.;
96  HMatrix[2][4] = 0.;
97 
98  HMatrix[3][0] = 0.;
99  HMatrix[3][1] = 0.;
100  HMatrix[3][2] = 0.;
101  HMatrix[3][3] = 1.;
102  HMatrix[3][4] = 0.;
103 
104  HMatrix[4][0] = 0.;
105  HMatrix[4][1] = 0.;
106  HMatrix[4][2] = 0.;
107  HMatrix[4][3] = 0.;
108  HMatrix[4][4] = 1.;
109 
110 
111  return HMatrix;
112  }
113  else if(dynamic_cast<const genf::SlTrackRep*>(stateVector)){
114  TMatrixT<Double_t> HMatrix(2,4);
115 
116  HMatrix[0][0] = 1.;
117  HMatrix[0][1] = 0.;
118  HMatrix[0][2] = 0.;
119  HMatrix[0][3] = 0.;
120 
121 
122  HMatrix[1][0] = 0.;
123  HMatrix[1][1] = 1.;
124  HMatrix[1][2] = 0.;
125  HMatrix[1][3] = 0.;
126  return HMatrix;
127  }
128 
129  else {
130  std::cerr << "PointHit can only handle state"
131  << " vectors of type genf::RKTrackRep or genf::SlTrackRep -> throw" << std::endl;
132  throw;
133  }
134 
135 }
136 
137 TMatrixT<Double_t>
139 {
140  if (dynamic_cast<const genf::RKTrackRep*>(stateVector) != nullptr){
141  //I know, since this is the same everytime, it could be done in the
142  //the constructor, but I do it here anyway, to make clear that in the
143  //case of several track-reps per hit, it would have to be done here
144  // fHMatrix.ResizeTo(NparHitRep,5);
145 
146 
147  // TMatrixT<Double_t> HMatrix(2,6);
148  // WTF? Making this 2,5 not 2,6. EC, 3-Jan-2011.
149  TMatrixT<Double_t> HMatrix(2,5);
150 
151  HMatrix[0][0] = 0.;
152  HMatrix[0][1] = 0.;
153  HMatrix[0][2] = 0.;
154  HMatrix[0][3] = 1.;
155  HMatrix[0][4] = 0.;
156  //HMatrix[0][5] = 0.;
157 
158  HMatrix[1][0] = 0.;
159  HMatrix[1][1] = 0.;
160  HMatrix[1][2] = 0.;
161  HMatrix[1][3] = 0.;
162  HMatrix[1][4] = 1.;
163  //HMatrix[1][5] = 0.;
164 
165  return HMatrix;
166  }
167  else if(dynamic_cast<const genf::SlTrackRep*>(stateVector)){
168  TMatrixT<Double_t> HMatrix(2,4);
169 
170  HMatrix[0][0] = 1.;
171  HMatrix[0][1] = 0.;
172  HMatrix[0][2] = 0.;
173  HMatrix[0][3] = 0.;
174 
175 
176  HMatrix[1][0] = 0.;
177  HMatrix[1][1] = 1.;
178  HMatrix[1][2] = 0.;
179  HMatrix[1][3] = 0.;
180  return HMatrix;
181  }
182 
183  else {
184  std::cerr << "PointHit can only handle state"
185  << " vectors of type genf::RKTrackRep or genf::SlTrackRep -> throw" << std::endl;
186  throw;
187  }
188 
189 }
BEGIN_PROLOG could also be cerr
TMatrixT< Double_t > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:81
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:83
virtual ~PointHit()
Definition: PointHit.cxx:18
virtual TMatrixT< Double_t > getHMatrix(const GFAbsTrackRep *stateVector)
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
Definition: PointHit.cxx:138
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
virtual GFAbsRecoHit * clone()
Get clone of this object.
Definition: PointHit.cxx:58
TMatrixT< Double_t > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:84