FairRoot/PandaRoot
PndGemRecoHit.cxx
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 // File and Version Information:
3 // $Id$
4 //
5 // Description:
6 // Implementation of class PndGemRecoHit
7 // see PndGemRecoHit.h for details
8 //
9 // Environment:
10 // Software developed for the PANDA Detector at FAIR.
11 //
12 // Author List:
13 // Sebastian Neubert TUM (original author)
14 // Ralf Kliemt TUD (application to PndMvd)
15 // Radoslaw Karabowicz GSI (conversion to GEM)
16 //
17 //-----------------------------------------------------------
18 
19 // C/C++ Headers ----------------------
20 // root Headers ----------------------
21 #include "TMatrixT.h"
22 #include "TMath.h"
23 // Collaborating Class Headers --------
24 #include "FairMCPoint.h"
25 #include "RKTrackRep.h"
26 #include "GeaneTrackRep.h"
27 #include "GFDetPlane.h"
28 // This Class' Header ------------------
29 #include "PndGemRecoHit.h"
30 #include "PndGemMCPoint.h"
31 #include "PndGemHit.h"
32 //#include "PndGemGeoHandling.h"
33 #include "TGeoManager.h"
34 #include "FairRootManager.h"
35 
36 // Class Member definitions -----------
37 
39 
40 
42 {
43 // if(fGeoH!=0)
44 // delete (fGeoH);
45 }
46 
48  : GFRecoHitIfc<GFPlanarHitPolicy>(fNparHitRep)
49 {
50  // fGeoH = new PndGemGeoHandling(gGeoManager);
51 }
52 
53 
55  : GFRecoHitIfc<GFPlanarHitPolicy>(fNparHitRep)
56 {
57  // std::cout<<" -I- PndGemRecoHit::PndGemRecoHit(PndGemMCPoint*) called."<<std::endl;
58 
59  fHitCoord[0][0] = point->GetX();
60  fHitCoord[1][0] = point->GetY();
61 
62  fHitCov[0][0] = 0.01;
63  fHitCov[1][1] = 0.01;
64 
65  TVector3 o(0.,0.,point->GetZ()),
66  u(1.,0.,0.),
67  v(0.,1.,0.);
68 
70 
71 }
72 /*
73 PndGemRecoHit::PndGemRecoHit(PndGemHit* hit)
74  : GFRecoHitIfc<GFPlanarHitPolicy>(fNparHitRep)
75 {
76 
77  std::cout<<" -I- PndGemRecoHit::PndGemRecoHit(PndGemHit*) called for hit in detector "<< hit->GetDetName() << std::endl;
78  // std::cout<<*hit<<std::endl;
79 
80  TString id = hit->GetDetName();
81 
82  FairRootManager* ioman = FairRootManager::Instance();
83  TString fGeoFile = ioman->GetInFile()->GetName();
84  // PndGemGeoHandling* fGeoH = new PndGemGeoHandling(fGeoFile.Data());
85  //TString path = fGeoH->GetPath(id);
86 
87  Double_t hitX = hit->GetX();
88  Double_t hitY = hit->GetY();
89 
90  TVector3 oo (0.,0.,hit->GetZ()),
91  uu ( 1.0, 0.0, 0.0),
92  vv ( 0.0, 1.0, 0.0);
93 
94  fHitCoord[0][0] = hitX;
95  fHitCoord[1][0] = hitY;
96 
97  fHitCov[0][0] = 0.0001;
98  fHitCov[1][1] = 0.0001;
99 
100  fPolicy.setDetPlane(DetPlane(oo,uu,vv));
101 //============================================================================
102 }
103 */
104 
106  : GFRecoHitIfc<GFPlanarHitPolicy>(fNparHitRep)
107 {
108 
109  // std::cout<<" -I- PndGemRecoHit::PndGemRecoHit(PndGemHit*) called."<<std::endl;
110  // std::cout<<*hit<<std::endl;
111 
112  FairRootManager* ioman = FairRootManager::Instance();
113  TString fGeoFile = ioman->GetInFile()->GetName();
114  // PndGemGeoHandling* fGeoH = new PndGemGeoHandling(fGeoFile.Data());
115  //TString path = fGeoH->GetPath(id);
116 
117  Double_t hitX = hit->GetX(), hitY = hit->GetY();
118  Double_t phiAValue = TMath::ATan(hitX/hitY);
119  if ( hitY < 0 ) phiAValue += TMath::Pi();
120  else if ( hitX < 0 ) phiAValue += 2.*TMath::Pi();
121 
122  TVector3 oo (0.,0.,hit->GetZ()),
123  // uu ( TMath::Cos(phiAValue),TMath::Sin(phiAValue),0),
124  // vv (-TMath::Sin(phiAValue),TMath::Cos(phiAValue),0);
125  uu ( TMath::Sin(phiAValue), TMath::Cos(phiAValue),0),
126  vv ( TMath::Cos(phiAValue),-TMath::Sin(phiAValue),0);
127 
128  fHitCoord[0][0] = TMath::Sqrt(hitX*hitX+hitY*hitY);
129  fHitCoord[1][0] = 0.;
130 
131  fHitCov[0][0] = hit->GetDr()*hit->GetDr();
132  fHitCov[1][1] = hit->GetDp()*hit->GetDp();
133 
134  if ( hit->GetDp() < 1.e-8 ) {
135  uu.SetXYZ (1.,0.,0.);
136  vv.SetXYZ (0.,1.,0.);
137 
138  fHitCoord[0][0] = hitX;
139  fHitCoord[1][0] = hitY;
140 
141  fHitCov[0][0] = hit->GetDx()*hit->GetDx();
142  fHitCov[1][1] = hit->GetDy()*hit->GetDy();
143  }
144 
145  fPolicy.setDetPlane(GFDetPlane(oo,uu,vv));
146  //============================================================================
147 }
148 
149 
150 TMatrixT<double>
152 {
153 
154  if (dynamic_cast<const RKTrackRep*>(stateVector) != NULL) {
155  // Uses TrackParP (q/p,v',w',v,w)
156  // coordinates are defined by detplane!
157  TMatrixT<double> HMatrix(2,5);
158 
159  HMatrix[0][0] = 0.;
160  HMatrix[0][1] = 0.;
161  HMatrix[0][2] = 0.;
162  HMatrix[0][3] = 1.;
163  HMatrix[0][4] = 0.;
164 
165  HMatrix[1][0] = 0.;
166  HMatrix[1][1] = 0.;
167  HMatrix[1][2] = 0.;
168  HMatrix[1][3] = 0.;
169  HMatrix[1][4] = 1.;
170 
171  return HMatrix;
172  }
173 
174  // !! TODO I copied this from the DemoRecoHit - check validity!!!
175  if (dynamic_cast<const GeaneTrackRep*>(stateVector) != NULL) {
176  // Uses TrackParP (q/p,v',w',v,w)
177  // coordinates are defined by detplane!
178  TMatrixT<double> HMatrix(fNparHitRep,5);
179 
180  HMatrix[0][0] = 0.;
181  HMatrix[0][1] = 0.;
182  HMatrix[0][2] = 0.;
183  HMatrix[0][3] = 1.;
184  HMatrix[0][4] = 0.;
185 
186  HMatrix[1][0] = 0.;
187  HMatrix[1][1] = 0.;
188  HMatrix[1][2] = 0.;
189  HMatrix[1][3] = 0.;
190  HMatrix[1][4] = 1.;
191  return HMatrix;
192  }
193  else {
194  std::cerr << "DemoRecoHit can only handle state"
195  << " vectors of type GeaneTrackRep -> abort"
196  << std::endl;
197  throw;
198  }
199 
200 }
201 
202 Double_t
204  const TMatrixT<Double_t>& ) // stateVector state // [R.K.03/2017] unused variable(s)
205 {
206  throw;
207 }
208 
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
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
virtual TMatrixT< double > getHMatrix(const GFAbsTrackRep *stateVector)
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
TMatrixT< double > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:76
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
static T Sin(const T &x)
Definition: PndCAMath.h:42
void setDetPlane(const GFDetPlane &p)
Set physical detector plane. Needs to be called before hit can be used.
static T Cos(const T &x)
Definition: PndCAMath.h:43
virtual Double_t residualScalar(GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state)
__m128 v
Definition: P4_F32vec4.h:4
Double_t
Double_t GetDp() const
Definition: PndGemHit.h:76
static const Int_t fNparHitRep
Definition: PndGemRecoHit.h:64
Policy class implementing a planar hit geometry.
virtual ~PndGemRecoHit()
ClassImp(PndAnaContFact)
PndSdsMCPoint * hit
Definition: anasim.C:70
Double_t GetDr() const
Definition: PndGemHit.h:75
TString fGeoFile
Double_t Pi
PndSdsMCPoint * point
Definition: anaLmdCluster.C:72
TMatrixT< double > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:79