FairRoot/PandaRoot
Public Member Functions | Protected Attributes | Private Attributes | List of all members
GFDafHit Class Reference

Wrapper class for use with GFDaf. More...

#include <GFDafHit.h>

Inheritance diagram for GFDafHit:
GFAbsRecoHit

Public Member Functions

 GFDafHit ()
 
 ~GFDafHit ()
 
 GFDafHit (std::vector< GFAbsRecoHit * > HitsInPlane)
 Constructor adding hits. More...
 
TMatrixT< double > getHitCoord (const GFDetPlane &pl)
 Get the hit coordinates. More...
 
TMatrixT< double > getHitCov (const GFDetPlane &pl)
 Get the hit covariance. More...
 
TMatrixT< double > getHMatrix (const GFAbsTrackRep *rep)
 Get the H matrix. More...
 
GFDafHitclone ()
 Get clone of this object. More...
 
const GFDetPlanegetDetPlane (GFAbsTrackRep *rep)
 Get the detector plane. More...
 
void setWeights (std::vector< double > weights)
 Set the weights. More...
 
void setBlowUp (double blow_up)
 Set the \(\beta\) blow up factor for the covariance matrices. More...
 
unsigned int getNumHits ()
 Get the number of hits in the GFDafHit. More...
 
GFAbsRecoHitgetHit (unsigned int ihit)
 Get at hit from the GFDafHit. More...
 
const std::string & getPolicyName ()
 Get the name of the hit policy. More...
 
virtual TMatrixT< double > residualVector (const GFAbsTrackRep *stateVector, const TMatrixT< double > &state, const GFDetPlane &d)
 Calculate residual with respect to a track representation. More...
 
TMatrixT< double > getRawHitCov () const
 Get raw hit covariances. More...
 
TMatrixT< double > getRawHitCoord () const
 Get raw hit coordinates. More...
 
virtual void Print ()
 Print raw hit coordinates. More...
 
int getNparHit ()
 

Protected Attributes

TMatrixT< double > fHitCoord
 Vector of raw coordinates of hit. More...
 
TMatrixT< double > fHitCov
 Covariance of raw hit coordinates. More...
 

Private Attributes

bool fHitCoordUpd
 
bool fHitCovUpd
 
GFDetPlane fPl
 
double fBlow
 
std::vector< TMatrixT< double > > fCovInvs
 
std::vector< GFAbsRecoHit * > fRawHits
 
std::vector< double > fWeights
 

Detailed Description

Wrapper class for use with GFDaf.

The GFDafHit is a hit class which acts as an effective hit. As the DAF is capable of handling multiple hits in one plane, but GFKalman cannot handle this, the GFDafHit combines all hits in one plane.

Definition at line 40 of file GFDafHit.h.

Constructor & Destructor Documentation

GFDafHit::GFDafHit ( )
inline

Definition at line 43 of file GFDafHit.h.

Referenced by clone().

43 {};
GFDafHit::~GFDafHit ( )
inline

Definition at line 45 of file GFDafHit.h.

References fRawHits.

45 { fRawHits.clear(); };
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
GFDafHit::GFDafHit ( std::vector< GFAbsRecoHit * >  HitsInPlane)

Constructor adding hits.

With this constructor, the GFDafHit is normally initialized. All the hits of the argument should be in one plane.

Definition at line 22 of file GFDafHit.cxx.

References fBlow, fHitCoordUpd, fHitCovUpd, fRawHits, and fWeights.

22  {
23 
24  fRawHits = HitsInPlane;
25  fWeights.assign(fRawHits.size(),1.);
26  fBlow = 1;
27  fHitCovUpd = false;
28  fHitCoordUpd = false;
29 
30 }
bool fHitCovUpd
Definition: GFDafHit.h:135
std::vector< double > fWeights
Definition: GFDafHit.h:140
double fBlow
Definition: GFDafHit.h:137
bool fHitCoordUpd
Definition: GFDafHit.h:135
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139

Member Function Documentation

GFDafHit * GFDafHit::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 GFAbsRecoHit.

Definition at line 135 of file GFDafHit.cxx.

References fBlow, fRawHits, fWeights, GFDafHit(), setBlowUp(), and setWeights().

135  {
136 
137  GFDafHit* retval = new GFDafHit(fRawHits);
138  retval->setWeights(fWeights);
139  retval->setBlowUp(fBlow);
140  return retval;
141 
142 }
void setWeights(std::vector< double > weights)
Set the weights.
Definition: GFDafHit.cxx:46
std::vector< double > fWeights
Definition: GFDafHit.h:140
Wrapper class for use with GFDaf.
Definition: GFDafHit.h:40
void setBlowUp(double blow_up)
Set the blow up factor for the covariance matrices.
Definition: GFDafHit.cxx:38
double fBlow
Definition: GFDafHit.h:137
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
GFDafHit()
Definition: GFDafHit.h:43
const GFDetPlane & GFDafHit::getDetPlane ( GFAbsTrackRep rep)
virtual

Get the detector plane.

Returns the plane as returned by GFDetPlan() of the first hit in the GFDafHit. This is valid because all hits are on the same plane.

Implements GFAbsRecoHit.

Definition at line 54 of file GFDafHit.cxx.

References fRawHits.

54  {
55 
56  return fRawHits.at(0)->getDetPlane(rep);
57 
58 }
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
GFAbsRecoHit * GFDafHit::getHit ( unsigned int  ihit)

Get at hit from the GFDafHit.

Definition at line 32 of file GFDafHit.cxx.

References fRawHits.

Referenced by GFDaf::calcWeights().

32  {
33 
34  return fRawHits.at(ihit);
35 
36 }
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
TMatrixT< double > GFDafHit::getHitCoord ( const GFDetPlane pl)
virtual

Get the hit coordinates.

Due to the nature of the GFDafHit, the coordinates returned are not necessarily the coordinates of the real hits. There are two cases: if the GFDafHit contains only one hit, then the hit coordinates of this hit are returned. If however, the GFDafHit contains several hits, then the following formula is used to obtain the hit coordinates:

\[ \mathbf{m} = \mathbf{V} \cdot \sum_{i}p_{i}\cdot \mathbf{V}_{i}^{-1}\cdot \mathbf{m}_{i} \]

with \(\mathbf{m_{i}}\) the real hit coordinates, \(\mathbf{V}_{i}\) the real hit covariance and \(p_{i}\) the weights. The sum runs over all real hits in the GFDafHit. \(\mathbf{V}\) is the effective hit covariance as returned by getHitCov(). This calculation is only done, if the plane has changed from the last time gitHitCoord() was called.

Implements GFAbsRecoHit.

Definition at line 60 of file GFDafHit.cxx.

References fCovInvs, GFAbsRecoHit::fHitCoord, fHitCoordUpd, GFAbsRecoHit::fHitCov, fHitCovUpd, fPl, fRawHits, fWeights, getHitCov(), and i.

60  {
61 
62  if(fHitCoordUpd && fPl == pl) return fHitCoord;
63 
64  if(fRawHits.size() == 1) {
65 
66  if(fHitCoord.GetNrows() ==0) fHitCoord.ResizeTo(fRawHits.at(0)->getHitCoord(pl));
67  fHitCoord = fRawHits.at(0)->getHitCoord(pl);
68 
69  } else {
70 
71  if(fHitCovUpd != true || fPl != pl) getHitCov(pl);
73  for(unsigned int i=0;i<fRawHits.size();i++) {
74 
75  fHitCoord += fWeights.at(i) * fCovInvs.at(i) * fRawHits.at(i)->getHitCoord(pl);
76 
77  }
78 
80  }
81 
82  fPl = pl;
83  fHitCoordUpd = true;
84  return fHitCoord;
85 
86 }
TMatrixT< double > getHitCov(const GFDetPlane &pl)
Get the hit covariance.
Definition: GFDafHit.cxx:88
bool fHitCovUpd
Definition: GFDafHit.h:135
Int_t i
Definition: run_full.C:25
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
GFDetPlane fPl
Definition: GFDafHit.h:136
std::vector< double > fWeights
Definition: GFDafHit.h:140
bool fHitCoordUpd
Definition: GFDafHit.h:135
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
std::vector< TMatrixT< double > > fCovInvs
Definition: GFDafHit.h:138
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79
TMatrixT< double > GFDafHit::getHitCov ( const GFDetPlane pl)
virtual

Get the hit covariance.

Analog to getHitCoord(), there are two cases: if the GFDafHit contains only one hit, the covariance is calculated like:

\[ \mathbf{V} = \frac{1}{p_{1}}\cdot\beta\cdot\mathbf{V}_{1} \]

with \(\beta\) the blow up factor for the temperature annealing as set in setBlowUp() and the rest of the symbols analog to getHitCoord(). If there are several hits in the GFDafHit, the following formula is used:

\[ \mathbf{V} = \left( \sum_{i} p_{i} \cdot \left( \beta \mathbf{V}_{i}\right)^{-1} \right)^{-1} \]

As before, these calculations are only done if the plane is different from the one getHitCov was last called.

Implements GFAbsRecoHit.

Definition at line 88 of file GFDafHit.cxx.

References fBlow, fCovInvs, GFAbsRecoHit::fHitCoord, GFAbsRecoHit::fHitCov, fHitCovUpd, fPl, fRawHits, fWeights, i, and GFTools::invertMatrix().

Referenced by getHitCoord().

88  {
89 
90  if(fHitCovUpd && fPl == pl) return fHitCov;
91 
92  if(fHitCov.GetNrows() == 0) {
93  fHitCov.ResizeTo(fRawHits.at(0)->getHitCov(pl));
94  fHitCoord.ResizeTo(fRawHits.at(0)->getHitCoord(pl));
95  }
96 
97  if(fRawHits.size() == 1) {
98 
99  if(((1/fWeights.at(0)) * fBlow) < pow(10,10)) {
100  fHitCov = (1 / fWeights.at(0)) * fBlow * fRawHits.at(0)->getHitCov(pl);
101  } else {
102  fHitCov = pow(10,10) * fRawHits.at(0)->getHitCov(pl);
103  }
104 
105  } else {
106 
107  fHitCov -= fHitCov;
108  fCovInvs.clear();
109 
110  for(unsigned int i=0;i<fRawHits.size();i++) {
111 
112  TMatrixT<double> CovInv;
113  GFTools::invertMatrix((fBlow * fRawHits.at(i)->getHitCov(pl)), CovInv);
114  fCovInvs.push_back(CovInv);
115  fHitCov += fWeights.at(i) * CovInv;
116  }
117 
118  TMatrixT<double> HitCovTemp(fHitCov);
119  GFTools::invertMatrix(HitCovTemp, fHitCov);
120 
121  }
122 
123  fPl = pl;
124  fHitCovUpd = true;
125  return fHitCov;
126 
127 }
bool fHitCovUpd
Definition: GFDafHit.h:135
Int_t i
Definition: run_full.C:25
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
GFDetPlane fPl
Definition: GFDafHit.h:136
std::vector< double > fWeights
Definition: GFDafHit.h:140
void invertMatrix(const TMatrixT< double > &mat, TMatrixT< double > &inv)
Invert a matrix, throwing GFException when inversion fails.
Definition: GFTools.cxx:334
double fBlow
Definition: GFDafHit.h:137
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
std::vector< TMatrixT< double > > fCovInvs
Definition: GFDafHit.h:138
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79
TMatrixT< double > GFDafHit::getHMatrix ( const GFAbsTrackRep rep)
virtual

Get the H matrix.

Returns the H matrix of the first hit in the GFDafHit. This is valid because all hits are on the same plane.

Implements GFAbsRecoHit.

Definition at line 129 of file GFDafHit.cxx.

References fRawHits.

129  {
130 
131  return fRawHits.at(0)->getHMatrix(rep);
132 
133 }
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
int GFAbsRecoHit::getNparHit ( )
inlineinherited

Definition at line 211 of file GFAbsRecoHit.h.

References GFAbsRecoHit::fNparHit.

211 {return fNparHit;}
unsigned int GFDafHit::getNumHits ( )
inline

Get the number of hits in the GFDafHit.

Definition at line 121 of file GFDafHit.h.

References fRawHits.

Referenced by GFDaf::calcWeights(), and GFDaf::copySmoothing().

121 { return fRawHits.size(); };
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
const std::string & GFDafHit::getPolicyName ( )
virtual

Get the name of the hit policy.

Returns the name of the hit policy of the first hit in the GFDafHit. This is valid because if there are several hits, they all have to be planar hits.

Reimplemented from GFAbsRecoHit.

Definition at line 144 of file GFDafHit.cxx.

References fRawHits.

144  {
145 
146  return fRawHits.at(0)->getPolicyName();
147 
148 }
std::vector< GFAbsRecoHit * > fRawHits
Definition: GFDafHit.h:139
TMatrixT<double> GFAbsRecoHit::getRawHitCoord ( ) const
inlineinherited
TMatrixT<double> GFAbsRecoHit::getRawHitCov ( ) const
inlineinherited

Get raw hit covariances.

Definition at line 153 of file GFAbsRecoHit.h.

References GFAbsRecoHit::fHitCov.

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

153 {return fHitCov;}
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79
virtual void GFAbsRecoHit::Print ( )
inlinevirtualinherited

Print raw hit coordinates.

Definition at line 207 of file GFAbsRecoHit.h.

References GFAbsRecoHit::fHitCoord.

207 {fHitCoord.Print();}
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
virtual TMatrixT<double> GFAbsRecoHit::residualVector ( const GFAbsTrackRep stateVector,
const TMatrixT< double > &  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 142 of file GFAbsRecoHit.h.

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

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

144  {
145  TMatrixT<double> H = getHMatrix(stateVector);
146  return ( getHitCoord(d) - (H*state ));
147  }
virtual TMatrixT< double > getHMatrix(const GFAbsTrackRep *stateVector)=0
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
virtual TMatrixT< double > getHitCoord(const GFDetPlane &)=0
Get hit coordinates in a specific detector plane.
void GFDafHit::setBlowUp ( double  blow_up)

Set the \(\beta\) blow up factor for the covariance matrices.

Set the \(\beta\) as used by getHitCoord() and getHitCov().

Definition at line 38 of file GFDafHit.cxx.

References fBlow, fHitCoordUpd, and fHitCovUpd.

Referenced by clone(), and GFDaf::processTrack().

38  {
39 
40  fBlow = blow_up;
41  fHitCovUpd = false;
42  fHitCoordUpd = false;
43 
44 }
bool fHitCovUpd
Definition: GFDafHit.h:135
double fBlow
Definition: GFDafHit.h:137
bool fHitCoordUpd
Definition: GFDafHit.h:135
void GFDafHit::setWeights ( std::vector< double >  weights)

Set the weights.

Set the weights as used by getHitCoord() and getHitCov().

Definition at line 46 of file GFDafHit.cxx.

References fHitCoordUpd, fHitCovUpd, and fWeights.

Referenced by clone(), and GFDaf::processTrack().

46  {
47 
48  fWeights = weights;
49  fHitCovUpd = false;
50  fHitCoordUpd = false;
51 
52 }
bool fHitCovUpd
Definition: GFDafHit.h:135
std::vector< double > fWeights
Definition: GFDafHit.h:140
bool fHitCoordUpd
Definition: GFDafHit.h:135

Member Data Documentation

double GFDafHit::fBlow
private

Definition at line 137 of file GFDafHit.h.

Referenced by clone(), getHitCov(), GFDafHit(), and setBlowUp().

std::vector<TMatrixT<double> > GFDafHit::fCovInvs
private

Definition at line 138 of file GFDafHit.h.

Referenced by getHitCoord(), and getHitCov().

TMatrixT<double> GFAbsRecoHit::fHitCoord
protectedinherited
bool GFDafHit::fHitCoordUpd
private

Definition at line 135 of file GFDafHit.h.

Referenced by getHitCoord(), GFDafHit(), setBlowUp(), and setWeights().

TMatrixT<double> GFAbsRecoHit::fHitCov
protectedinherited
bool GFDafHit::fHitCovUpd
private

Definition at line 135 of file GFDafHit.h.

Referenced by getHitCoord(), getHitCov(), GFDafHit(), setBlowUp(), and setWeights().

GFDetPlane GFDafHit::fPl
private

Definition at line 136 of file GFDafHit.h.

Referenced by getHitCoord(), and getHitCov().

std::vector<GFAbsRecoHit*> GFDafHit::fRawHits
private
std::vector<double> GFDafHit::fWeights
private

Definition at line 140 of file GFDafHit.h.

Referenced by clone(), getHitCoord(), getHitCov(), GFDafHit(), and setWeights().


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