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