FairRoot/PandaRoot
PndSdsRecoHit2.cxx
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 // File and Version Information:
3 // $Id$
4 //
5 // Description:
6 // Implementation of class PndSdsRecoHit
7 // see PndSdsRecoHit.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 PndSds)
15 //
16 //-----------------------------------------------------------
17 
18 // C/C++ Headers ----------------------
19 // root Headers ----------------------
20 #include "TMatrixT.h"
21 #include "TMath.h"
22 // Collaborating Class Headers --------
23 #include "FairMCPoint.h"
24 #include "DetPlane.h"
25 // This Class' Header ------------------
26 #include "PndSdsRecoHit2.h"
27 #include "PndSdsMCPoint.h"
28 #include "PndSdsHit.h"
29 #include "PndGeoHandling.h"
30 #include "TGeoManager.h"
31 #include "FairRootManager.h"
32 
33 // Class Member definitions -----------
34 
36 
37 
39 {
40 }
41 
43 : PlanarMeasurement(fNparHitRep)
44 {
45 }
46 
47 
49 : PlanarMeasurement(fNparHitRep)
50 {
51  std::cout<<" -I- PndSdsRecoHit2::PndSdsRecoHit2(PndSdsMCPoint*) called."<<std::endl;
52 
53  rawHitCoords_[0] = point->GetX();
54  rawHitCoords_[1] = point->GetY();
55 
56  // we set the covariances to (50mu)^2 by hand.
57  rawHitCov_[0][0] = 0.0050 * 0.0050;//cm //TODO: cm is rigt?
58  rawHitCov_[1][1] = 0.0050 * 0.0050;//cm //TODO: cm is rigt?
59 
60  TVector3 o(0.,0.,point->GetZ()),
61  u(1.,0.,0.),
62  v(0.,1.,0.);
63 
64  genfit::SharedPlanePtr plane(new genfit::DetPlane(o,u,v));
65  setPlane(plane);
66 
67 }
68 
70 : PlanarMeasurement(fNparHitRep)
71 {
72 
73  // std::cout<<" -I- PndSdsRecoHit::PndSdsRecoHit(PndSdsHit*) called."<<std::endl;
74  // std::cout<<*hit<<std::endl;
75 
76  setDetId(candHit->getDetId());
77  setHitId(candHit->getHitId());
78 
79  Int_t id = hit->GetSensorID();
80 
81  // FairRootManager* ioman = FairRootManager::Instance();
82  // TString fGeoFile = ioman->GetInFile()->GetName();
84  TString path = fGeoH->GetPath(id);
85  // std::cout<<"Detector path: "<<path.Data()<<std::endl;
86  TVector3 oo, uu, vv;
87  fGeoH->GetOUVShortId(id, oo,uu,vv);
88 
89  TVector3 position = hit->GetPosition();
90  TVector3 localpos = fGeoH->MasterToLocalShortId(position, id);
91 
92  rawHitCoords_[0] = localpos.X();
93  rawHitCoords_[1] = localpos.Y();
94 
95  TMatrixD cova = fGeoH->MasterToLocalErrorsShortId(hit->GetCov(), id);
96  // project only the 2 dimensions of cov.
97  rawHitCov_[0][0] = cova[0][0];
98  rawHitCov_[0][1] = cova[0][1];
99  rawHitCov_[1][0] = cova[1][0];
100  rawHitCov_[1][1] = cova[1][1];
101 
102 // std::cout<<" -I- PndSdsRecoHit::PndSdsRecoHit: Wrote a hit with"
103 // <<"\n(x,y) = ("<<localpos.X()<<","<<localpos.Y()<<")."
104 // <<"\nCovariance Matrix is";
105 // rawHitCov_.Print();
106 // std::cout<<"From 3D hit matrix";
107 // cova.Print();
108 
109  genfit::SharedPlanePtr plane(new genfit::DetPlane(oo,uu,vv));
110  setPlane(plane, candHit->getPlaneId());
111 }
112 //============================================================================
113 
114 
int getDetId() const
Definition: TrackCandHit.h:48
int getPlaneId() const
Definition: TrackCandHit.h:50
Detector plane.
Definition: DetPlane.h:61
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
void GetOUVShortId(Int_t shortId, TVector3 &o, TVector3 &u, TVector3 &v)
virtual ~PndSdsRecoHit2()
TVector3 GetPosition() const
Definition: PndSdsHit.h:93
PndGeoHandling * fGeoH
int getHitId() const
Definition: TrackCandHit.h:49
TMatrixD MasterToLocalErrorsShortId(const TMatrixD &master, const Int_t &shortId)
TString GetPath(Int_t shortID)
for a given shortID the path is returned
__m128 v
Definition: P4_F32vec4.h:4
void setDetId(int detId)
Hit object for use in TrackCand. Provides IDs and sorting parameters.
Definition: TrackCandHit.h:34
TMatrixD GetCov() const
Definition: PndSdsHit.h:98
static PndGeoHandling * Instance()
TVector3 MasterToLocalShortId(const TVector3 &master, const Int_t &shortId)
void setHitId(int hitId)
ClassImp(PndAnaContFact)
PndSdsMCPoint * hit
Definition: anasim.C:70
Int_t GetSensorID() const
Definition: PndSdsHit.h:90
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
PndSdsMCPoint * point
Definition: anaLmdCluster.C:72
virtual void setPlane(const SharedPlanePtr &physicalPlane, int planeId=-1)