LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::PointHit Class Reference

#include "PointHit.h"

Inheritance diagram for genf::PointHit:
genf::GFRecoHitIfc< HitPolicy > genf::GFAbsRecoHit

Public Member Functions

 PointHit ()
 
 PointHit (TVector3 point, double res)
 
 PointHit (TVector3 point, std::vector< double > &ref)
 
 PointHit (TVector3 point, TVector3 res)
 
virtual ~PointHit ()
 
virtual GFAbsRecoHitclone ()
 Get clone of this object. More...
 
virtual TMatrixT< Double_t > getHMatrix (const GFAbsTrackRep *stateVector)
 Get transformation matrix. Transformation between hit coordinates and track representation coordinates. More...
 
virtual TMatrixT< Double_t > getHMatrix (const GFAbsTrackRep *stateVector, const Double_t &, const Double_t &)
 
virtual const GFDetPlanegetDetPlane (GFAbsTrackRep *rep)
 Returns the detector plane object for this hit and a given track representation. More...
 
virtual TMatrixT< Double_t > getHitCoord (const GFDetPlane &plane, const GFDetPlane &planePrev)
 Get hit coordinates in a specific detector plane. More...
 
virtual TMatrixT< Double_t > getHitCoord (const GFDetPlane &plane)
 
virtual TMatrixT< Double_t > getHitCov (const GFDetPlane &plane)
 Get hit covariances in a specific detector plane. More...
 
virtual TMatrixT< Double_t > getHitCov (const GFDetPlane &plane, const GFDetPlane &planePrev, const TMatrixT< Double_t > &state, const Double_t &mass)
 
const std::string & getPolicyName ()
 
virtual TMatrixT< Double_t > residualVector (const GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state, const GFDetPlane &d)
 Calculate residual with respect to a track representation. More...
 
virtual TMatrixT< Double_t > residualVector (const GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state, const GFDetPlane &d, const GFDetPlane &dPrev, const double &mass)
 
TMatrixT< Double_t > getRawHitCov () const
 Get raw hit covariances. More...
 
TMatrixT< Double_t > getRawHitCoord () const
 Get raw hit coordinates. More...
 
virtual void Print (std::ostream &out=std::cout) const
 Print raw hit coordinates. More...
 
int getNparHit ()
 

Protected Attributes

HitPolicy fPolicy
 
TMatrixT< Double_t > fHitCoord
 Vector of raw coordinates of hit. More...
 
TMatrixT< Double_t > fHitCov
 Covariance of raw hit coordinates. More...
 

Static Private Attributes

static const int NparHitRep = 3
 

Detailed Description

Definition at line 14 of file PointHit.h.

Constructor & Destructor Documentation

genf::PointHit::PointHit ( )

Definition at line 18 of file PointHit.cxx.

Referenced by clone().

GFRecoHitIfc< GFSpacepointHitPolicy > SpacepointRecoHit
Definition: PointHit.h:12
static const int NparHitRep
Definition: PointHit.h:34
genf::PointHit::PointHit ( TVector3  point,
double  res 
)

Definition at line 20 of file PointHit.cxx.

References d, genf::GFAbsRecoHit::fHitCoord, and genf::GFAbsRecoHit::fHitCov.

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 }
TMatrixT< Double_t > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:81
GFRecoHitIfc< GFSpacepointHitPolicy > SpacepointRecoHit
Definition: PointHit.h:12
Float_t d
Definition: plot.C:235
static const int NparHitRep
Definition: PointHit.h:34
TMatrixT< Double_t > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:84
genf::PointHit::PointHit ( TVector3  point,
std::vector< double > &  ref 
)

Definition at line 33 of file PointHit.cxx.

References d, genf::GFAbsRecoHit::fHitCoord, and genf::GFAbsRecoHit::fHitCov.

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 }
TMatrixT< Double_t > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:81
GFRecoHitIfc< GFSpacepointHitPolicy > SpacepointRecoHit
Definition: PointHit.h:12
Float_t d
Definition: plot.C:235
static const int NparHitRep
Definition: PointHit.h:34
TMatrixT< Double_t > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:84
genf::PointHit::PointHit ( TVector3  point,
TVector3  res 
)
genf::PointHit::~PointHit ( )
virtual

Definition at line 16 of file PointHit.cxx.

16 {}

Member Function Documentation

genf::GFAbsRecoHit * genf::PointHit::clone ( )
virtual

Get clone of this object.

Virtual abstract method. Has to be implemented by inherting classes. Creates a deep copy of this object. Ownership is trandsferred to the caller!

Implements genf::GFAbsRecoHit.

Definition at line 51 of file PointHit.cxx.

References PointHit().

52 {
53  return new PointHit(*this);
54 }
template<class HitPolicy >
virtual const GFDetPlane& genf::GFRecoHitIfc< HitPolicy >::getDetPlane ( GFAbsTrackRep rep)
inlinevirtualinherited

Returns the detector plane object for this hit and a given track representation.

The actutal code for this method depends on the hit geometry and is implemented in the HitPolicy

See also
PlanarHitPolicy
SpacepointHitPolicy
WirepointHitPolicy

Implements genf::GFAbsRecoHit.

Definition at line 79 of file GFRecoHitIfc.h.

80  {
81  return fPolicy.detPlane(this, rep);
82  }
template<class HitPolicy >
virtual TMatrixT<Double_t> genf::GFRecoHitIfc< HitPolicy >::getHitCoord ( const GFDetPlane plane,
const GFDetPlane planePrev 
)
inlinevirtualinherited

Get hit coordinates in a specific detector plane.

Implementation in the HitPolicy

Implements genf::GFAbsRecoHit.

Definition at line 88 of file GFRecoHitIfc.h.

89  {
90  return fPolicy.hitCoord(this, plane, planePrev);
91  }
template<class HitPolicy >
virtual TMatrixT<Double_t> genf::GFRecoHitIfc< HitPolicy >::getHitCoord ( const GFDetPlane plane)
inlinevirtualinherited

Implements genf::GFAbsRecoHit.

Definition at line 92 of file GFRecoHitIfc.h.

93  {
94  return fPolicy.hitCoord(this, plane);
95  }
template<class HitPolicy >
virtual TMatrixT<Double_t> genf::GFRecoHitIfc< HitPolicy >::getHitCov ( const GFDetPlane plane)
inlinevirtualinherited

Get hit covariances in a specific detector plane.

Implementation in the HitPolicy

Implements genf::GFAbsRecoHit.

Definition at line 101 of file GFRecoHitIfc.h.

102  {
103  return fPolicy.hitCov(this, plane);
104  }
template<class HitPolicy >
virtual TMatrixT<Double_t> genf::GFRecoHitIfc< HitPolicy >::getHitCov ( const GFDetPlane plane,
const GFDetPlane planePrev,
const TMatrixT< Double_t > &  state,
const Double_t &  mass 
)
inlinevirtualinherited

Implements genf::GFAbsRecoHit.

Definition at line 105 of file GFRecoHitIfc.h.

109  {
110  return fPolicy.hitCov(this, plane, planePrev, state, mass);
111  }
TMatrixT< Double_t > genf::PointHit::getHMatrix ( const GFAbsTrackRep stateVector)
virtual

Get transformation matrix. Transformation between hit coordinates and track representation coordinates.

This is a virtual abstract method which has to be implemented in the child classes.

In general there is a linear transformation between the coordinate system of the hit (which is defined by the detector plane) and the coordinates of the track representation in that plane. In the most simple case the track representation has 5 parameters (space + momentum) while a hit usually has less (one to three space coordinates).

The transformation matrix is then simply projecting out the space-components of the track representation.

Its dimensions are NxM. Where N is the number of dimensions of the hit in the detector plane (usually 2 or 1) and M is the dimension of the track representation.

In this method a hit has to define with which track representations it can work together. It should be the only point where this explicit coordination is necessary.

For example code see implementing classes below:

Implements genf::GFAbsRecoHit.

Definition at line 128 of file PointHit.cxx.

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 > genf::PointHit::getHMatrix ( const GFAbsTrackRep stateVector,
const Double_t &  betac,
const Double_t &  dist 
)
virtual

Implements genf::GFAbsRecoHit.

Definition at line 56 of file PointHit.cxx.

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 }
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
int genf::GFAbsRecoHit::getNparHit ( )
inlineinherited

Definition at line 240 of file GFAbsRecoHit.h.

References genf::GFAbsRecoHit::fNparHit.

240 { return fNparHit; }
template<class HitPolicy >
const std::string& genf::GFRecoHitIfc< HitPolicy >::getPolicyName ( )
inlinevirtualinherited

Reimplemented from genf::GFAbsRecoHit.

Definition at line 113 of file GFRecoHitIfc.h.

113 { return fPolicy.getName(); }
TMatrixT<Double_t> genf::GFAbsRecoHit::getRawHitCov ( ) const
inlineinherited

Get raw hit covariances.

Definition at line 180 of file GFAbsRecoHit.h.

References genf::GFAbsRecoHit::fHitCov.

Referenced by genf::GFWireHitPolicy::hitCov(), genf::GFWirepointHitPolicy::hitCov(), genf::GFSpacepointHitPolicy::hitCov(), and genf::GFPlanarHitPolicy::hitCov().

180 { return fHitCov; }
TMatrixT< Double_t > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:84
virtual void genf::GFAbsRecoHit::Print ( std::ostream &  out = std::cout) const
inlinevirtualinherited

Print raw hit coordinates.

Definition at line 236 of file GFAbsRecoHit.h.

References genf::GFAbsRecoHit::getPolicyName(), and genf::PrintROOTobject().

236 { PrintROOTobject(out, fHitCoord); }
TMatrixT< Double_t > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:81
void PrintROOTobject(std::ostream &, const ROOTOBJ &)
Small utility functions which print some ROOT objects into an output stream.
Definition: GFException.h:127
virtual TMatrixT<Double_t> genf::GFAbsRecoHit::residualVector ( const GFAbsTrackRep stateVector,
const TMatrixT< Double_t > &  state,
const GFDetPlane d 
)
inlinevirtualinherited

Calculate residual with respect to a track representation.

Returns the N-dimensional residual of this vector to a given track representation.

This method is not doing any extrapolation. But it creates the necessary detector plane object. See GFAbsRecoHit::getGFDetPlane

Parameters
stateVectorpointer to track representation - used to synchronize with the track repesentation
stateparameter vector of the track representation
See also
setHMatrix
getGFDetPlane

Definition at line 149 of file GFAbsRecoHit.h.

References genf::GFAbsRecoHit::getHitCoord(), and genf::GFAbsRecoHit::getHMatrix().

Referenced by genf::GFKalman::getChi2Hit(), genf::GFTrack::getResiduals(), and genf::GFKalman::processHit().

152  {
153  std::cout << "GFAbsRecoHit::residualVector(3args) Not correctly Using theta -- multiple "
154  "scattering -- information !!! Fix this if you really want to use getChi2Hit"
155  << std::endl;
156  TMatrixT<Double_t> H = getHMatrix(stateVector);
157  return (getHitCoord(d) - (H * state));
158  }
virtual TMatrixT< Double_t > getHitCoord(const GFDetPlane &, const GFDetPlane &)=0
Get hit coordinates in a specific detector plane.
virtual TMatrixT< Double_t > getHMatrix(const GFAbsTrackRep *stateVector)=0
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
Float_t d
Definition: plot.C:235
virtual TMatrixT<Double_t> genf::GFAbsRecoHit::residualVector ( const GFAbsTrackRep stateVector,
const TMatrixT< Double_t > &  state,
const GFDetPlane d,
const GFDetPlane dPrev,
const double &  mass 
)
inlinevirtualinherited

Definition at line 160 of file GFAbsRecoHit.h.

References larg4::dist(), genf::GFAbsRecoHit::getHitCoord(), genf::GFAbsRecoHit::getHMatrix(), and genf::GFDetPlane::getO().

165  {
166  Double_t dist = (d.getO() - dPrev.getO()).Mag();
167  // Double_t mass = 0.104; // close enough for muons, pions, I think.
168  Double_t mom = fabs(1.0 / state[0][0]);
169  Double_t beta = mom / sqrt(mass * mass + mom * mom);
170  if (std::isnan(dist) || dist < 0.2) dist = 0.2; // don't allow 0s here.
171  if (std::isnan(beta) || beta < 0.04) beta = 0.04;
172 
173  TMatrixT<Double_t> H = getHMatrix(stateVector, beta, dist);
174  return (getHitCoord(d, dPrev) - (H * state));
175  }
virtual TMatrixT< Double_t > getHitCoord(const GFDetPlane &, const GFDetPlane &)=0
Get hit coordinates in a specific detector plane.
virtual TMatrixT< Double_t > getHMatrix(const GFAbsTrackRep *stateVector)=0
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
Float_t d
Definition: plot.C:235
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)

Member Data Documentation

TMatrixT<Double_t> genf::GFAbsRecoHit::fHitCoord
protectedinherited

Vector of raw coordinates of hit.

Definition at line 81 of file GFAbsRecoHit.h.

Referenced by genf::GFAbsRecoHit::getRawHitCoord(), and PointHit().

TMatrixT<Double_t> genf::GFAbsRecoHit::fHitCov
protectedinherited

Covariance of raw hit coordinates.

Definition at line 84 of file GFAbsRecoHit.h.

Referenced by genf::GFAbsRecoHit::getRawHitCov(), and PointHit().

template<class HitPolicy >
HitPolicy genf::GFRecoHitIfc< HitPolicy >::fPolicy
protectedinherited

Definition at line 62 of file GFRecoHitIfc.h.

const int genf::PointHit::NparHitRep = 3
staticprivate

Definition at line 34 of file PointHit.h.


The documentation for this class was generated from the following files: