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