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