FairRoot/PandaRoot
PndSttRecoHit.cxx
Go to the documentation of this file.
1 // The STT point is not defined by the (x, y, z) coordinates, but we ONLY know the
2 // (x, y) coordinates of the wire center (not the z!); moreover we know the drift
3 // radius. In order to find the MEASURED POINT to be used in the GFKalman fit a
4 // preliminary propagation must be performed to the point of closest approach to
5 // the firing wire.
6 // The plane is a virtual detector plane defined via:
7 // dj = wvi - vpf (U coordinate in GFDetPlane)
8 // dk = wiredirection (V coordinate in GFDetPlane)
9 // (see GFWireHitPolicy.cxx)
10 //
11 // input: 8 entries
12 // 0-1-2 ==> x,y,z of the 1st extremity of the firing wire;
13 // 3-4-5 ==> x,y,z of the 2nd extremity of the firing wire;
14 // 6 ==> drift radius;
15 
16 
17 // This Class' Header ------------------
18 #include "PndSttRecoHit.h"
19 
20 // C/C++ Headers ----------------------
21 
22 // Collaborating Class Headers --------
23 #include "GeaneTrackRep.h"
24 #include "RKTrackRep.h"
25 #include "PndSttHit.h"
26 #include "PndSttTube.h"
27 #include "PndSttMapCreator.h"
28 #include "PndGeoSttPar.h"
29 #include "FairRuntimeDb.h"
30 #include "FairRunAna.h"
31 
32 #include "TMath.h"
33 
34 // Class Member definitions -----------
35 using namespace std;
36 
38 
39 
41 {}
42 
44  : WireHitRecoHit(NparHitRep)
45 {
46 
47 }
48 
49 // TO BE CHANGED TO USE TUBE ARRAY
51 
52  FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
53  PndGeoSttPar *sttParameters = (PndGeoSttPar*) rtdb->getContainer("PndGeoSttPar");
54  Int_t tubeID = currenthit->GetTubeID();
55  PndSttMapCreator *mapper = new PndSttMapCreator(sttParameters);
56  PndSttTube *tube = (PndSttTube*) mapper->GetTubeFromTubeID(tubeID);
57 
58  // wire1(3), wire2(3), rdrift
59  TVector3 wiredirection = tube->GetWireDirection();
60  TVector3 wiredirection2 = tube->GetHalfLength() * wiredirection;
61  TVector3 cenposition = tube->GetPosition();
62  TVector3 wire1, wire2;
63  wire1 = cenposition - wiredirection2;
64  wire2 = cenposition + wiredirection2;
65  // cout << "Wiredirection, wire1, wire2 " << endl;
66  // wiredirection.Print();
67  // wire1.Print();
68  // wire2.Print();
69  fHitCoord[0][0] = wire1.X();
70  fHitCoord[1][0] = wire1.Y();
71  fHitCoord[2][0] = wire1.Z();
72  fHitCoord[3][0] = wire2.X();
73  fHitCoord[4][0] = wire2.Y();
74  fHitCoord[5][0] = wire2.Z();
75  fHitCoord[6][0] = currenthit->GetIsochrone();
76 
77  // errors on drift radius
78  for(int i = 0; i < NparHitRep; i++) for(int j = 0; j < NparHitRep; j++) fHitCov[i][j] = 0.;
79  // fHitCov[6][6] = 0.0100 * 0.0100;
80  fHitCov[6][6] = pow(currenthit->GetIsochroneError(), 2);
81 
82  // cut on distance
83  fPolicy.setMaxDistance(0.5);
84 }
85 
86 // TO BE CHANGED TO USE TUBE ARRAY
87 PndSttRecoHit::PndSttRecoHit(PndSttHit *currenthit, TClonesArray *tubeArray) : WireHitRecoHit(NparHitRep){
88 
89  Int_t tubeID = currenthit->GetTubeID();
90  PndSttTube *tube = (PndSttTube *) tubeArray->At(tubeID);
91 
92  // wire1(3), wire2(3), rdrift
93  TVector3 wiredirection = tube->GetWireDirection();
94  TVector3 wiredirection2 = tube->GetHalfLength() * wiredirection;
95  TVector3 cenposition = tube->GetPosition();
96  TVector3 wire1, wire2;
97  wire1 = cenposition - wiredirection2;
98  wire2 = cenposition + wiredirection2;
99  // cout << "Wiredirection, wire1, wire2 " << endl;
100  // wiredirection.Print();
101  // wire1.Print();
102  // wire2.Print();
103  fHitCoord[0][0] = wire1.X();
104  fHitCoord[1][0] = wire1.Y();
105  fHitCoord[2][0] = wire1.Z();
106  fHitCoord[3][0] = wire2.X();
107  fHitCoord[4][0] = wire2.Y();
108  fHitCoord[5][0] = wire2.Z();
109  fHitCoord[6][0] = currenthit->GetIsochrone();
110 
111  // errors on drift radius
112  for(int i = 0; i < NparHitRep; i++) for(int j = 0; j < NparHitRep; j++) fHitCov[i][j] = 0.;
113  // fHitCov[6][6] = 0.0100 * 0.0100;
114  fHitCov[6][6] = pow(currenthit->GetIsochroneError(), 2);
115 
116  // cut on distance
117  fPolicy.setMaxDistance(0.5);
118 }
119 
120 TMatrixT<double>
122 {
123  if (dynamic_cast<const GeaneTrackRep*>(stateVector) != NULL) {
124  TMatrixT<double> HMatrix(1,5);
125 
126  HMatrix[0][0] = 0.;
127  HMatrix[0][1] = 0.;
128  HMatrix[0][2] = 0.;
129  HMatrix[0][3] = 1.;
130  HMatrix[0][4] = 0.;
131 
132  return HMatrix;
133  }
134  else if (dynamic_cast<const RKTrackRep*>(stateVector) != NULL) { // CHECK this has been added but not tested: if you are not going to use it for testing purposes, please use GeaneTrackRep
135  TMatrixT<double> HMatrix(1,5);
136 
137  HMatrix[0][0] = 0.;
138  HMatrix[0][1] = 0.;
139  HMatrix[0][2] = 0.;
140  HMatrix[0][3] = 1.;
141  HMatrix[0][4] = 0.;
142 
143  return HMatrix;
144  }
145  else {
146  std::cerr << "PndSttRecoHit can only handle state"
147  << " vectors of type GeaneTrackRep -> abort" << std::endl;
148  throw;
149  }
150 
151 }
152 
153 
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80
RecoHit interface template class. Provides comfortable interface to create RecoHits.
Definition: GFRecoHitIfc.h:60
Int_t i
Definition: run_full.C:25
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
ClassImp(PndSttRecoHit) PndSttRecoHit
static const int NparHitRep
Definition: PndSttRecoHit.h:39
PndSttTube * GetTubeFromTubeID(Int_t tubeid)
HitPolicy fPolicy
Definition: GFRecoHitIfc.h:62
Double_t GetIsochrone() const
Definition: PndSttHit.h:62
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
Int_t GetTubeID() const
Definition: PndSttHit.h:75
Double_t GetIsochroneError() const
Definition: PndSttHit.h:63
virtual TMatrixT< double > getHMatrix(const GFAbsTrackRep *stateVector)
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79