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

#include <PndHypIdealRecoTask.h>

Inheritance diagram for PndHypIdealRecoTask:

Public Member Functions

 PndHypIdealRecoTask ()
 
 PndHypIdealRecoTask (Double_t sx, Double_t sy, Double_t sz)
 
 ~PndHypIdealRecoTask ()
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 

Private Member Functions

void InitTransMat ()
 
void smear (TVector3 &pos)
 
void smearLocal (TVector3 &pos)
 
void CalcDetPlane (TVector3 &o, TVector3 &u, TVector3 &v)
 
void Register ()
 
void Reset ()
 
void ProduceHits ()
 
 ClassDef (PndHypIdealRecoTask, 2)
 

Private Attributes

TString fBranchName
 
PndHypGeoHandlingfGeoH
 
TClonesArray * fPointArray
 
TClonesArray * fMctruthArray
 
TClonesArray * fHitOutputArray
 
Double_t fSigmaX
 
Double_t fSigmaY
 
Double_t fSigmaZ
 
PndHypPointfCurrentHypPoint
 
TGeoHMatrix * fCurrentTransMat
 
TMatrixT< double > fHitCovMatrix
 

Detailed Description

Definition at line 33 of file PndHypIdealRecoTask.h.

Constructor & Destructor Documentation

PndHypIdealRecoTask::PndHypIdealRecoTask ( )

Default constructor

Definition at line 30 of file PndHypIdealRecoTask.cxx.

References fBranchName, fSigmaX, fSigmaY, and fSigmaZ.

30  :
31  FairTask("Ideal reconstruction task for PANDA Hyp"),
32  fHitCovMatrix(3,3)
33 {
34  fSigmaX=0.;
35  fSigmaY=0.;
36  fSigmaZ=0.;
37  fBranchName = "HypPoint";
38 }
TMatrixT< double > fHitCovMatrix
PndHypIdealRecoTask::PndHypIdealRecoTask ( Double_t  sx,
Double_t  sy,
Double_t  sz 
)

Definition at line 42 of file PndHypIdealRecoTask.cxx.

References fBranchName, fSigmaX, fSigmaY, and fSigmaZ.

42  :
43  FairTask("Ideal reconstruction task for PANDA Hyp"),
44  fHitCovMatrix(3,3)
45 {
46  fSigmaX=sx;
47  fSigmaY=sy;
48  fSigmaZ=sz;
49  fBranchName = "HypPoint";
50 }
TMatrixT< double > fHitCovMatrix
PndHypIdealRecoTask::~PndHypIdealRecoTask ( )

Destructor

Definition at line 55 of file PndHypIdealRecoTask.cxx.

References fGeoH.

56 {
57 delete fGeoH;
58 }
PndHypGeoHandling * fGeoH

Member Function Documentation

void PndHypIdealRecoTask::CalcDetPlane ( TVector3 &  o,
TVector3 &  u,
TVector3 &  v 
)
private

Definition at line 244 of file PndHypIdealRecoTask.cxx.

References Double_t, fCurrentHypPoint, fCurrentTransMat, fVerbose, PndHypPoint::GetDetName(), and v.

Referenced by Exec().

245 {
246  Double_t O[3], U[3], V[3], o[3], u[3], v[3];
247  O[0]=oVect.x(); O[1]=oVect.y(); O[2]=oVect.z();
248  U[0]=uVect.x(); U[1]=uVect.y(); U[2]=uVect.z();
249  V[0]=vVect.x(); V[1]=vVect.y(); V[2]=vVect.z();
250 
251  if (fVerbose > 1) {
252  std::cout<<"PndHypIdealRecoTask::CalcDetPlane from Detector "
253  <<fCurrentHypPoint->GetDetName()<<std::endl;
254  }
255  //make transformation
256  fCurrentTransMat->LocalToMaster(O,o);
257  fCurrentTransMat->LocalToMaster(U,u);
258  fCurrentTransMat->LocalToMaster(V,v);
259  oVect.SetXYZ(o[0],o[1],o[2]);
260  uVect.SetXYZ(u[0],u[1],u[2]);
261  vVect.SetXYZ(v[0],v[1],v[2]);
262 }
int fVerbose
Definition: poormantracks.C:24
PndHypPoint * fCurrentHypPoint
__m128 v
Definition: P4_F32vec4.h:4
Double_t
TGeoHMatrix * fCurrentTransMat
TString GetDetName() const
Definition: PndHypPoint.h:119
PndHypIdealRecoTask::ClassDef ( PndHypIdealRecoTask  ,
 
)
private
void PndHypIdealRecoTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 106 of file PndHypIdealRecoTask.cxx.

References CalcDetPlane(), fCurrentHypPoint, fHitOutputArray, fPointArray, fSigmaX, fSigmaY, fSigmaZ, fVerbose, PndHypPoint::GetDetName(), PndHypPoint::GetVolumeID(), PndHypPoint::GetXin(), PndHypPoint::GetYin(), PndHypPoint::GetZin(), InitTransMat(), pos, smearLocal(), and v.

107 {
108  // Fills HypClusters with the MC Truth
109  // TODO filling of RecoHits, together with the sensor plane
110 
111 
112  if ( ! fHitOutputArray ) Fatal("Exec", "No fClusterOutputArray");
113  fHitOutputArray->Delete();
114 
115  //std::map<int, PndHypHit*> clusterMap;
116  std::cout << "-I- fPointArray Exec = "<<fPointArray<< std::endl;
117  Int_t nHypHits=fPointArray->GetEntries();
118  std::cout<<" entries "<<nHypHits<<std::endl;
119 
120  for(Int_t iHypHit=0;iHypHit<nHypHits;++iHypHit)
121  {
123  //int trackid=fCurrentHypPoint->GetTrackID(); //[R.K. 01/2017] unused variable
124  int size = fHitOutputArray->GetEntriesFast();
125  InitTransMat();
126 
127  // cut on secondaries (deltas) etc
128  //if(trackid<0)continue;
129 
130  cout<<fCurrentHypPoint->GetVolumeID()<<endl;
131  //set the plane definition inside the local frame
132  //sensor origin in the middle, u^ and v^ are xy plane
133  TVector3 o(0.,0.,0.),u(1.,0.,0.),v(0.,1.,0.);
134  CalcDetPlane(o,u,v);
135  TVector3 pos;
136  //fCurrentHypPoint->Position(pos);
137  cout<<fCurrentHypPoint->GetXin()<<endl;
138  pos.SetXYZ(fCurrentHypPoint->GetXin(),
141  cout<<pos.x()<<" "<<pos.y()<<" "<<pos.z()<<endl;
142 
143  smearLocal(pos);
144  TVector3 dposLocal(fSigmaX,fSigmaY,fSigmaZ);
145 
146  // TODO here we shall distinguish between strip and pixel sensors
147  // Now the 3D Info is smared inside the FairHit part of HypCluster
148  new ((*fHitOutputArray)[size]) PndHypHit(fCurrentHypPoint->GetVolumeID(),
149  (fCurrentHypPoint->GetDetName()).Data(),
150  pos,dposLocal,
151  iHypHit,
152  fCurrentHypPoint->GetEnergyLoss(),1);
153 
154  }//end for HypiHypHit
155 
156  if (fVerbose > 0) {
157  std::cout<<fHitOutputArray->GetEntriesFast() <<" hitss created out of "
158  <<fPointArray->GetEntriesFast() <<" Points"<<std::endl;
159  }
160  fPointArray->Delete();
161 
162 
163 }
TVector3 pos
Double_t GetZin() const
Definition: PndHypPoint.h:94
int fVerbose
Definition: poormantracks.C:24
Double_t GetXin() const
Definition: PndHypPoint.h:92
PndHypPoint * fCurrentHypPoint
TClonesArray * fPointArray
Int_t GetVolumeID() const
Definition: PndHypPoint.h:91
__m128 v
Definition: P4_F32vec4.h:4
Double_t GetYin() const
Definition: PndHypPoint.h:93
TClonesArray * fHitOutputArray
TString GetDetName() const
Definition: PndHypPoint.h:119
void CalcDetPlane(TVector3 &o, TVector3 &u, TVector3 &v)
void smearLocal(TVector3 &pos)
InitStatus PndHypIdealRecoTask::Init ( )
virtual

Definition at line 61 of file PndHypIdealRecoTask.cxx.

References fBranchName, fGeoH, fHitOutputArray, fMctruthArray, fPointArray, and gGeoManager.

Referenced by QAmacro_hyp_2().

62 {
63  // Get RootManager
64  FairRootManager* ioman = FairRootManager::Instance();
65  if ( ! ioman ) {
66  std::cout << "-E- PndHypIdealRecoTask::Init: "
67  << "RootManager not instantiated!" << std::endl;
68  return kFATAL; }
69 
70  // Get input array
71  fPointArray = (TClonesArray*) ioman->GetObject(fBranchName);
72  if ( ! fPointArray ) {
73  std::cout << "-W- PndHypIdealRecoTask::Init: "<< "No "<<fBranchName
74  <<" array!" << std::endl;
75  return kERROR; }
76 
77  // Get MCTruth collection
78  fMctruthArray=(TClonesArray*) ioman->GetObject("MCTrack");
79  if(fMctruthArray==0) {
80  std::cout << "-W- PndHypIdealRecoTask::Init: No McTruth array!" << std::endl;
81  return kERROR; }
82 
83  // Create and register output array
84  fHitOutputArray = new TClonesArray("PndHypHit");
85  ioman->Register("HypHit", "Hyp ideal Clusters",
86  fHitOutputArray, kTRUE);
87 
88  std::cout << "-I- gGeoManager = "<<gGeoManager << std::endl;
89 
91 
92  return kSUCCESS;
93 }
TClonesArray * fPointArray
Class to access the naming information of the MVD.
TGeoManager * gGeoManager
TClonesArray * fHitOutputArray
TClonesArray * fMctruthArray
PndHypGeoHandling * fGeoH
void PndHypIdealRecoTask::InitTransMat ( )
private

smearing and geometry access

Definition at line 165 of file PndHypIdealRecoTask.cxx.

References fCurrentHypPoint, fCurrentTransMat, fGeoH, fVerbose, PndHypPoint::GetDetName(), PndHypGeoHandling::GetPath(), and gGeoManager.

Referenced by Exec().

166 {
168  fCurrentTransMat = gGeoManager->GetCurrentMatrix();
169  if (fVerbose > 1) {
170  fCurrentTransMat->Print("");
171  }
172 }
int fVerbose
Definition: poormantracks.C:24
PndHypPoint * fCurrentHypPoint
TGeoManager * gGeoManager
TString GetPath(TString id)
for a given ID the path is returned
TGeoHMatrix * fCurrentTransMat
PndHypGeoHandling * fGeoH
TString GetDetName() const
Definition: PndHypPoint.h:119
void PndHypIdealRecoTask::ProduceHits ( )
private
void PndHypIdealRecoTask::Register ( )
private
void PndHypIdealRecoTask::Reset ( )
private
void PndHypIdealRecoTask::SetParContainers ( )
virtual

Virtual method Init

Definition at line 95 of file PndHypIdealRecoTask.cxx.

References rtdb.

96 {
97  // Get Base Container
98  FairRun* ana = FairRun::Instance();
99  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
100  std::cout << "-I- rtdb = "<<rtdb << std::endl;
101 
102 }
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndHypIdealRecoTask::smear ( TVector3 &  pos)
private

smear a 3d vector

Definition at line 175 of file PndHypIdealRecoTask.cxx.

References fSigmaX, fSigmaY, fSigmaZ, fVerbose, x, y, and z.

Referenced by smearLocal().

176 {
178 
179  double sigx=gRandom->Gaus(0,fSigmaX);
180  double sigy=gRandom->Gaus(0,fSigmaY);
181  double sigz=gRandom->Gaus(0,fSigmaZ);
182 
183  double x = pos.x() + sigx;
184  double y = pos.y() + sigy;
185  double z = pos.z() + sigz;
186 
187  if (fVerbose > 1) {
188  std::cout<<"PndHypIdealRecoTask::smear Point (x,y,z)=("
189  <<pos.x()<<","<<pos.y()<<","<<pos.z()<<") by ("
190  <<fSigmaX<<","<<fSigmaY<<","<<fSigmaZ<<") to ";
191  }
192  pos.SetXYZ(x,y,z);
193  if (fVerbose > 1) {
194  std::cout<<"("<<pos.x()<<","<<pos.y()<<","<<pos.z()<<")"<<std::endl;
195  }
196  return;
197 }
TVector3 pos
int fVerbose
Definition: poormantracks.C:24
Double_t z
Double_t x
Double_t y
void PndHypIdealRecoTask::smearLocal ( TVector3 &  pos)
private

smear a 3d vector in the local sensor plane

Definition at line 200 of file PndHypIdealRecoTask.cxx.

References Double_t, fCurrentTransMat, fVerbose, and smear().

Referenced by Exec().

201 {
203  if (fVerbose > 1) {
204  std::cout<<"PndHypIdealRecoTask::smearLocal"<<std::endl;
205  }
206  Double_t posLab[3], posSens[3];
207 
208  posLab[0]=pos.x(); posLab[1]=pos.y(); posLab[2]=pos.z();
209  fCurrentTransMat->MasterToLocal(posLab,posSens);
210 
211  pos.SetXYZ(posSens[0],posSens[1],posSens[2]);
212 
213  smear(pos); // apply a gaussian
214 
215  posSens[0]=pos.x(); posSens[1]=pos.y(); posSens[2]=pos.z();
216  fCurrentTransMat->LocalToMaster(posSens,posLab);
217  pos.SetXYZ(posLab[0],posLab[1],posLab[2]);
218 
219 
220 // TMatrixT<double> cov(3,3);
221 // cov[0][0]=fSigmaX; cov[0][1]=0.; cov[0][2]=0.;
222 // cov[1][0]=0.; cov[1][1]=fSigmaY; cov[1][2]=0.;
223 // cov[2][0]=0.; cov[2][1]=0.; cov[2][2]=fSigmaZ;
224 
225 // TMatrixT<double> rot(3,3);
226 // rot[0][0] = fCurrentTransMat->GetRotationMatrix()[0];
227 // rot[0][1] = fCurrentTransMat->GetRotationMatrix()[1];
228 // rot[0][2] = fCurrentTransMat->GetRotationMatrix()[2];
229 // rot[1][0] = fCurrentTransMat->GetRotationMatrix()[3];
230 // rot[1][1] = fCurrentTransMat->GetRotationMatrix()[4];
231 // rot[1][2] = fCurrentTransMat->GetRotationMatrix()[5];
232 // rot[2][0] = fCurrentTransMat->GetRotationMatrix()[6];
233 // rot[2][1] = fCurrentTransMat->GetRotationMatrix()[7];
234 // rot[2][2] = fCurrentTransMat->GetRotationMatrix()[8];
235 
236 // fHitCovMatrix = cov;
237 // fHitCovMatrix *= rot;
238 
239  return;
240 }
TVector3 pos
int fVerbose
Definition: poormantracks.C:24
Double_t
void smear(TVector3 &pos)
TGeoHMatrix * fCurrentTransMat

Member Data Documentation

TString PndHypIdealRecoTask::fBranchName
private

Definition at line 59 of file PndHypIdealRecoTask.h.

Referenced by Init(), and PndHypIdealRecoTask().

PndHypPoint* PndHypIdealRecoTask::fCurrentHypPoint
private

Definition at line 71 of file PndHypIdealRecoTask.h.

Referenced by CalcDetPlane(), Exec(), and InitTransMat().

TGeoHMatrix* PndHypIdealRecoTask::fCurrentTransMat
private

Definition at line 72 of file PndHypIdealRecoTask.h.

Referenced by CalcDetPlane(), InitTransMat(), and smearLocal().

PndHypGeoHandling* PndHypIdealRecoTask::fGeoH
private

Definition at line 60 of file PndHypIdealRecoTask.h.

Referenced by Init(), InitTransMat(), and ~PndHypIdealRecoTask().

TMatrixT<double> PndHypIdealRecoTask::fHitCovMatrix
private

Definition at line 73 of file PndHypIdealRecoTask.h.

TClonesArray* PndHypIdealRecoTask::fHitOutputArray
private

Output array of Hits

Definition at line 66 of file PndHypIdealRecoTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealRecoTask::fMctruthArray
private

Definition at line 63 of file PndHypIdealRecoTask.h.

Referenced by Init().

TClonesArray* PndHypIdealRecoTask::fPointArray
private

Input array of Points

Definition at line 62 of file PndHypIdealRecoTask.h.

Referenced by Exec(), and Init().

Double_t PndHypIdealRecoTask::fSigmaX
private

Properties

Definition at line 68 of file PndHypIdealRecoTask.h.

Referenced by Exec(), PndHypIdealRecoTask(), and smear().

Double_t PndHypIdealRecoTask::fSigmaY
private

Definition at line 69 of file PndHypIdealRecoTask.h.

Referenced by Exec(), PndHypIdealRecoTask(), and smear().

Double_t PndHypIdealRecoTask::fSigmaZ
private

Definition at line 70 of file PndHypIdealRecoTask.h.

Referenced by Exec(), PndHypIdealRecoTask(), and smear().


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