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

#include <PndSdsRecoHit.h>

Inheritance diagram for PndSdsRecoHit:
GFRecoHitIfc< GFPlanarHitPolicy > GFAbsRecoHit

Public Member Functions

 PndSdsRecoHit ()
 
 PndSdsRecoHit (PndSdsMCPoint *point)
 
 PndSdsRecoHit (PndSdsHit *hit)
 
virtual ~PndSdsRecoHit ()
 
virtual GFAbsRecoHitclone ()
 Get clone of this object. More...
 
virtual TMatrixT< double > getHMatrix (const GFAbsTrackRep *stateVector)
 Get transformation matrix. Transformation between hit coordinates and track representation coordinates. More...
 
virtual Double_t residualScalar (GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state)
 
virtual const GFDetPlanegetDetPlane (GFAbsTrackRep *rep)
 Returns the detector plane object for this hit and a given track representation. More...
 
virtual TMatrixT< double > getHitCoord (const GFDetPlane &plane)
 Get hit coordinates in a specific detector plane. More...
 
virtual TMatrixT< double > getHitCov (const GFDetPlane &plane)
 Get hit covariances in a specific detector plane. More...
 
const std::string & getPolicyName ()
 
 ClassDef (GFRecoHitIfc, 1)
 
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

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

Private Member Functions

 ClassDef (PndSdsRecoHit, 2)
 

Private Attributes

PndGeoHandlingfGeoH
 

Static Private Attributes

static const Int_t fNparHitRep = 2
 

Detailed Description

Definition at line 37 of file PndSdsRecoHit.h.

Constructor & Destructor Documentation

PndSdsRecoHit::PndSdsRecoHit ( )

Definition at line 44 of file PndSdsRecoHit.cxx.

Referenced by clone().

PndSdsRecoHit::PndSdsRecoHit ( PndSdsMCPoint point)

Definition at line 50 of file PndSdsRecoHit.cxx.

References GFAbsRecoHit::fHitCoord, GFAbsRecoHit::fHitCov, GFRecoHitIfc< GFPlanarHitPolicy >::fPolicy, GFPlanarHitPolicy::setDetPlane(), and v.

52 {
53  std::cout<<" -I- PndSdsRecoHit::PndSdsRecoHit(PndSdsMCPoint*) called."<<std::endl;
54 
55  fHitCoord[0][0] = point->GetX();
56  fHitCoord[1][0] = point->GetY();
57 
58  // we set the covariances to (50mu)^2 by hand.
59  fHitCov[0][0] = 0.0050 * 0.0050;//cm //TODO: cm is rigt?
60  fHitCov[1][1] = 0.0050 * 0.0050;//cm //TODO: cm is rigt?
61 
62  TVector3 o(0.,0.,point->GetZ()),
63  u(1.,0.,0.),
64  v(0.,1.,0.);
65 
67 
68 }
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
static const Int_t fNparHitRep
Definition: PndSdsRecoHit.h:63
void setDetPlane(const GFDetPlane &p)
Set physical detector plane. Needs to be called before hit can be used.
__m128 v
Definition: P4_F32vec4.h:4
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79
PndSdsRecoHit::PndSdsRecoHit ( PndSdsHit hit)

Definition at line 70 of file PndSdsRecoHit.cxx.

References fGeoH, GFAbsRecoHit::fHitCoord, GFAbsRecoHit::fHitCov, GFRecoHitIfc< GFPlanarHitPolicy >::fPolicy, PndSdsHit::GetCov(), PndGeoHandling::GetOUVShortId(), PndGeoHandling::GetPath(), PndSdsHit::GetPosition(), PndSdsHit::GetSensorID(), PndGeoHandling::Instance(), PndGeoHandling::MasterToLocalErrorsShortId(), PndGeoHandling::MasterToLocalShortId(), GFPlanarHitPolicy::setDetPlane(), and TString.

72 {
73 
74  // std::cout<<" -I- PndSdsRecoHit::PndSdsRecoHit(PndSdsHit*) called."<<std::endl;
75  // std::cout<<*hit<<std::endl;
76 
77  Int_t id = hit->GetSensorID();
78 
79  // FairRootManager* ioman = FairRootManager::Instance();
80  // TString fGeoFile = ioman->GetInFile()->GetName();
82  TString path = fGeoH->GetPath(id);
83  // std::cout<<"Detector path: "<<path.Data()<<std::endl;
84  TVector3 oo, uu, vv;
85  fGeoH->GetOUVShortId(id, oo,uu,vv);
86 
87  TVector3 position = hit->GetPosition();
88  TVector3 localpos = fGeoH->MasterToLocalShortId(position, id);
89 
90  fHitCoord[0][0] = localpos.X();
91  fHitCoord[1][0] = localpos.Y();
92 
93  TMatrixD cova = fGeoH->MasterToLocalErrorsShortId(hit->GetCov(), id);
94  // project only the 2 dimensions of cov.
95  fHitCov[0][0] = cova[0][0];
96  fHitCov[0][1] = cova[0][1];
97  fHitCov[1][0] = cova[1][0];
98  fHitCov[1][1] = cova[1][1];
99 
100 // std::cout<<" -I- PndSdsRecoHit::PndSdsRecoHit: Wrote a hit with"
101 // <<"\n(x,y) = ("<<localpos.X()<<","<<localpos.Y()<<")."
102 // <<"\nCovariance Matrix is";
103 // fHitCov.Print();
104 // std::cout<<"From 3D hit matrix";
105 // cova.Print();
106 
107  fPolicy.setDetPlane(GFDetPlane(oo,uu,vv));
108 }
PndGeoHandling * fGeoH
Definition: PndSdsRecoHit.h:64
void GetOUVShortId(Int_t shortId, TVector3 &o, TVector3 &u, TVector3 &v)
TVector3 GetPosition() const
Definition: PndSdsHit.h:93
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
static const Int_t fNparHitRep
Definition: PndSdsRecoHit.h:63
void setDetPlane(const GFDetPlane &p)
Set physical detector plane. Needs to be called before hit can be used.
TMatrixD MasterToLocalErrorsShortId(const TMatrixD &master, const Int_t &shortId)
TString GetPath(Int_t shortID)
for a given shortID the path is returned
TMatrixD GetCov() const
Definition: PndSdsHit.h:98
static PndGeoHandling * Instance()
TVector3 MasterToLocalShortId(const TVector3 &master, const Int_t &shortId)
Int_t GetSensorID() const
Definition: PndSdsHit.h:90
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79
PndSdsRecoHit::~PndSdsRecoHit ( )
virtual

Definition at line 40 of file PndSdsRecoHit.cxx.

41 {
42 }

Member Function Documentation

PndSdsRecoHit::ClassDef ( PndSdsRecoHit  ,
 
)
private
GFRecoHitIfc< GFPlanarHitPolicy >::ClassDef ( GFRecoHitIfc< GFPlanarHitPolicy ,
 
)
inherited
virtual GFAbsRecoHit* PndSdsRecoHit::clone ( )
inlinevirtual

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 48 of file PndSdsRecoHit.h.

References PndSdsRecoHit().

48 {return new PndSdsRecoHit(*this);};
virtual const GFDetPlane& GFRecoHitIfc< GFPlanarHitPolicy >::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 GFAbsRecoHit.

Definition at line 80 of file GFRecoHitIfc.h.

References GFRecoHitIfc< HitPolicy >::fPolicy.

80 {return fPolicy.detPlane(this,rep);}
const GFDetPlane & detPlane(GFAbsRecoHit *, const GFAbsTrackRep *)
Returns the physical detector plane.
virtual TMatrixT<double> GFRecoHitIfc< GFPlanarHitPolicy >::getHitCoord ( const GFDetPlane plane)
inlinevirtualinherited

Get hit coordinates in a specific detector plane.

Implementation in the HitPolicy

Implements GFAbsRecoHit.

Definition at line 86 of file GFRecoHitIfc.h.

References GFRecoHitIfc< HitPolicy >::fPolicy.

87  {return fPolicy.hitCoord(this,plane);}
TMatrixT< double > hitCoord(GFAbsRecoHit *, const GFDetPlane &)
Hit coordinates in detector plane.
virtual TMatrixT<double> GFRecoHitIfc< GFPlanarHitPolicy >::getHitCov ( const GFDetPlane plane)
inlinevirtualinherited

Get hit covariances in a specific detector plane.

Implementation in the HitPolicy

Implements GFAbsRecoHit.

Definition at line 93 of file GFRecoHitIfc.h.

References GFRecoHitIfc< HitPolicy >::fPolicy.

94  {return fPolicy.hitCov(this,plane);}
TMatrixT< double > hitCov(GFAbsRecoHit *, const GFDetPlane &)
Hit covariances in detector plane.
TMatrixT< double > PndSdsRecoHit::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 GFAbsRecoHit.

Definition at line 114 of file PndSdsRecoHit.cxx.

References fNparHitRep.

115 {
116 
117  if (dynamic_cast<const RKTrackRep*>(stateVector) != NULL) {
118  // Uses TrackParP (q/p,v',w',v,w)
119  // coordinates are defined by detplane!
120  TMatrixT<double> HMatrix(2,5);
121 
122  HMatrix[0][0] = 0.;
123  HMatrix[0][1] = 0.;
124  HMatrix[0][2] = 0.;
125  HMatrix[0][3] = 1.;
126  HMatrix[0][4] = 0.;
127 
128  HMatrix[1][0] = 0.;
129  HMatrix[1][1] = 0.;
130  HMatrix[1][2] = 0.;
131  HMatrix[1][3] = 0.;
132  HMatrix[1][4] = 1.;
133 
134  return HMatrix;
135  }
136 
137  // !! TODO I copied this from the DemoRecoHit - check validity!!!
138  if (dynamic_cast<const GeaneTrackRep*>(stateVector) != NULL) {
139  // Uses TrackParP (q/p,v',w',v,w)
140  // coordinates are defined by detplane!
141  TMatrixT<double> HMatrix(fNparHitRep,5);
142 
143  HMatrix[0][0] = 0.;
144  HMatrix[0][1] = 0.;
145  HMatrix[0][2] = 0.;
146  HMatrix[0][3] = 1.;
147  HMatrix[0][4] = 0.;
148 
149  HMatrix[1][0] = 0.;
150  HMatrix[1][1] = 0.;
151  HMatrix[1][2] = 0.;
152  HMatrix[1][3] = 0.;
153  HMatrix[1][4] = 1.;
154  return HMatrix;
155  }
156  else {
157  std::cerr << "PndSdsRecoHit can only handle state"
158  << " vectors of type GeaneTrackRep -> abort"
159  << std::endl;
160  throw;
161  }
162 
163 }
static const Int_t fNparHitRep
Definition: PndSdsRecoHit.h:63
int GFAbsRecoHit::getNparHit ( )
inlineinherited

Definition at line 211 of file GFAbsRecoHit.h.

References GFAbsRecoHit::fNparHit.

211 {return fNparHit;}
const std::string& GFRecoHitIfc< GFPlanarHitPolicy >::getPolicyName ( )
inlinevirtualinherited

Reimplemented from GFAbsRecoHit.

Definition at line 96 of file GFRecoHitIfc.h.

References GFRecoHitIfc< HitPolicy >::fPolicy.

96 {return fPolicy.getName();}
const std::string & getName()
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
Double_t PndSdsRecoHit::residualScalar ( GFAbsTrackRep stateVector,
const TMatrixT< Double_t > &  state 
)
virtual

Definition at line 166 of file PndSdsRecoHit.cxx.

168 {
169  throw;
170 }
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.

Member Data Documentation

PndGeoHandling* PndSdsRecoHit::fGeoH
private

Definition at line 64 of file PndSdsRecoHit.h.

Referenced by PndSdsRecoHit().

TMatrixT<double> GFAbsRecoHit::fHitCoord
protectedinherited
TMatrixT<double> GFAbsRecoHit::fHitCov
protectedinherited
const Int_t PndSdsRecoHit::fNparHitRep = 2
staticprivate

Definition at line 63 of file PndSdsRecoHit.h.

Referenced by getHMatrix().

GFPlanarHitPolicy GFRecoHitIfc< GFPlanarHitPolicy >::fPolicy
protectedinherited

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