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

#include <PndMvdIdealRecoTask.h>

Inheritance diagram for PndMvdIdealRecoTask:

Public Member Functions

 PndMvdIdealRecoTask ()
 
 PndMvdIdealRecoTask (Double_t sx, Double_t sy, Double_t sz)
 
virtual ~PndMvdIdealRecoTask ()
 
 PndMvdIdealRecoTask (const PndMvdIdealRecoTask &)=delete
 
PndMvdIdealRecoTaskoperator= (const PndMvdIdealRecoTask &)=delete
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void SetPersistance (Bool_t p=kTRUE)
 
Bool_t GetPersistance ()
 

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 (PndMvdIdealRecoTask, 1)
 

Private Attributes

Bool_t fPersistance
 
TString fBranchName
 
PndGeoHandlingfGeoH
 
TClonesArray * fPointArray
 
TClonesArray * fMctruthArray
 
TClonesArray * fHitOutputArray
 
Double_t fSigmaX
 
Double_t fSigmaY
 
Double_t fSigmaZ
 
PndSdsMCPointfCurrentPndMvdMCPoint
 
TGeoHMatrix * fCurrentTransMat
 
TMatrixT< Double_tfHitCovMatrix
 

Detailed Description

Definition at line 33 of file PndMvdIdealRecoTask.h.

Constructor & Destructor Documentation

PndMvdIdealRecoTask::PndMvdIdealRecoTask ( )

Default constructor

Definition at line 29 of file PndMvdIdealRecoTask.cxx.

29  :
30 FairTask("Ideal reconstruction task for PANDA PndMvd"),
31  fPersistance(kTRUE),
32  fBranchName("MVDPoint"),
34  fPointArray(NULL),
35  fMctruthArray(NULL),
36  fHitOutputArray(NULL),
37  fSigmaX(0.),
38  fSigmaY(0.),
39  fSigmaZ(0.),
41  fCurrentTransMat(NULL),
42  fHitCovMatrix(3,3)
43 {
44 }
PndGeoHandling * fGeoH
PndSdsMCPoint * fCurrentPndMvdMCPoint
TMatrixT< Double_t > fHitCovMatrix
TClonesArray * fHitOutputArray
TClonesArray * fPointArray
TClonesArray * fMctruthArray
TGeoHMatrix * fCurrentTransMat
static PndGeoHandling * Instance()
PndMvdIdealRecoTask::PndMvdIdealRecoTask ( Double_t  sx,
Double_t  sy,
Double_t  sz 
)

Definition at line 48 of file PndMvdIdealRecoTask.cxx.

48  :
49 FairTask("Ideal reconstruction task for PANDA PndMvd"),
50  fPersistance(kTRUE),
51  fBranchName("MVDPoint"),
53  fPointArray(NULL),
54  fMctruthArray(NULL),
55  fHitOutputArray(NULL),
56  fSigmaX(sx),
57  fSigmaY(sy),
58  fSigmaZ(sz),
60  fCurrentTransMat(NULL),
61  fHitCovMatrix(3,3)
62 {
63 }
PndGeoHandling * fGeoH
PndSdsMCPoint * fCurrentPndMvdMCPoint
TMatrixT< Double_t > fHitCovMatrix
TClonesArray * fHitOutputArray
TClonesArray * fPointArray
TClonesArray * fMctruthArray
TGeoHMatrix * fCurrentTransMat
static PndGeoHandling * Instance()
PndMvdIdealRecoTask::~PndMvdIdealRecoTask ( )
virtual

Destructor

Definition at line 68 of file PndMvdIdealRecoTask.cxx.

69 {
70 }
PndMvdIdealRecoTask::PndMvdIdealRecoTask ( const PndMvdIdealRecoTask )
delete

Member Function Documentation

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

Definition at line 247 of file PndMvdIdealRecoTask.cxx.

References Double_t, fCurrentPndMvdMCPoint, fCurrentTransMat, fVerbose, PndSdsMCPoint::GetSensorID(), and v.

Referenced by Exec().

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

Virtual method Exec

Definition at line 115 of file PndMvdIdealRecoTask.cxx.

References CalcDetPlane(), fCurrentPndMvdMCPoint, fHitOutputArray, fPointArray, fSigmaX, fSigmaY, fSigmaZ, fVerbose, PndSdsMCPoint::GetSensorID(), InitTransMat(), pos, smearLocal(), and v.

116 {
117  // Fills PndMvdHits with the MC Truth
118  // TODO filling of RecoHits, together with the sensor plane
119 
120 
121  if ( ! fHitOutputArray ) Fatal("Exec", "No fHitOutputArray");
122  fHitOutputArray->Delete();
123 
124  std::map<Int_t, PndSdsHit*> clusterMap;
125 
126  Int_t nPndMvdHits=fPointArray->GetEntriesFast();
127  for(Int_t iMvdPoint=0;iMvdPoint<nPndMvdHits;++iMvdPoint)
128  {
130  Int_t trackid=fCurrentPndMvdMCPoint->GetTrackID();
131  Int_t size = fHitOutputArray->GetEntriesFast();
132  InitTransMat();
133 
134  // cut on secondaries (deltas) etc
135  if(trackid<0)continue;
136 
137  //set the plane definition inside the local frame
138  //sensor origin in the middle, u^ and v^ are xy plane
139  TVector3 o(0.,0.,0.),u(1.,0.,0.),v(0.,1.,0.);
140  CalcDetPlane(o,u,v);
141  TVector3 pos;
142  fCurrentPndMvdMCPoint->Position(pos);
143  smearLocal(pos);
144  TVector3 dposLocal(fSigmaX,fSigmaY,fSigmaZ);
145 
146  // TODO here we shall distinguish between strip and pixel sensors
147  // TODO How to handle the covariance matrix? OR do we really use local point
148  // errors. this would avoid two conversations, myabe overload the FairHit
149  // functions for the global error points.
150 
151  // Now the 3D Info is smared inside the FairHit part of PndSdsHit
152  new ((*fHitOutputArray)[size]) PndSdsHit(fCurrentPndMvdMCPoint->GetDetectorID(),
154  pos,dposLocal,-1,fCurrentPndMvdMCPoint->GetEnergyLoss(),1,iMvdPoint);
155 
156  }//end for PndMvdiMvdPoint
157 
158  if (fVerbose > 0) {
159  std::cout<<fHitOutputArray->GetEntriesFast() <<" Hits created out of "
160  <<fPointArray->GetEntriesFast() <<" Points"<<std::endl;
161  }
162 
163 }
TVector3 pos
int fVerbose
Definition: poormantracks.C:24
PndSdsMCPoint * fCurrentPndMvdMCPoint
void CalcDetPlane(TVector3 &o, TVector3 &u, TVector3 &v)
Int_t GetSensorID() const
Definition: PndSdsMCPoint.h:89
__m128 v
Definition: P4_F32vec4.h:4
TClonesArray * fHitOutputArray
TClonesArray * fPointArray
void smearLocal(TVector3 &pos)
Bool_t PndMvdIdealRecoTask::GetPersistance ( )
inline

Definition at line 59 of file PndMvdIdealRecoTask.h.

References fPersistance.

59 {return fPersistance;};
InitStatus PndMvdIdealRecoTask::Init ( )
virtual

Definition at line 73 of file PndMvdIdealRecoTask.cxx.

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

74 {
75  // Get RootManager
76  FairRootManager* ioman = FairRootManager::Instance();
77  if ( ! ioman ) {
78  std::cout << "-E- PndMvdIdealRecoTask::Init: "
79  << "RootManager not instantiated!" << std::endl;
80  return kFATAL; }
81 
82  // Get input array
83  fPointArray = (TClonesArray*) ioman->GetObject(fBranchName);
84  if ( ! fPointArray ) {
85  std::cout << "-W- PndMvdIdealRecoTask::Init: "<< "No "<<fBranchName
86  <<" array!" << std::endl;
87  return kERROR; }
88 
89  // Get MCTruth collection
90  fMctruthArray=(TClonesArray*) ioman->GetObject("MCTrack");
91  if(fMctruthArray==0) {
92  std::cout << "-W- PndMvdIdealRecoTask::Init: No McTruth array!" << std::endl;
93  return kERROR; }
94 
95  // Create and register output array
96  fHitOutputArray = new TClonesArray("PndSdsHit");
97  ioman->Register("MVDHit", "PndMvd ideal Hits",
99 
100  std::cout << "-I- gGeoManager = "<<gGeoManager << std::endl;
101  return kSUCCESS;
102 }
TGeoManager * gGeoManager
TClonesArray * fHitOutputArray
TClonesArray * fPointArray
TClonesArray * fMctruthArray
void PndMvdIdealRecoTask::InitTransMat ( )
private

smearing and geometry access

Definition at line 165 of file PndMvdIdealRecoTask.cxx.

References fCurrentPndMvdMCPoint, fCurrentTransMat, fGeoH, fVerbose, PndGeoHandling::GetPath(), PndSdsMCPoint::GetSensorID(), and gGeoManager.

Referenced by Exec().

166 {
167  // std::cout<<"InitTransMat() with "<<fCurrentPndMvdMCPoint->GetDetName()<<std::endl;
168  gGeoManager->cd(
170  );
171  fCurrentTransMat = gGeoManager->GetCurrentMatrix();
172  if (fVerbose > 1) {
173  fCurrentTransMat->Print("");
174  }
175 }
int fVerbose
Definition: poormantracks.C:24
PndGeoHandling * fGeoH
PndSdsMCPoint * fCurrentPndMvdMCPoint
TGeoManager * gGeoManager
Int_t GetSensorID() const
Definition: PndSdsMCPoint.h:89
TString GetPath(Int_t shortID)
for a given shortID the path is returned
TGeoHMatrix * fCurrentTransMat
PndMvdIdealRecoTask& PndMvdIdealRecoTask::operator= ( const PndMvdIdealRecoTask )
delete
void PndMvdIdealRecoTask::ProduceHits ( )
private
void PndMvdIdealRecoTask::Register ( )
private
void PndMvdIdealRecoTask::Reset ( )
private
void PndMvdIdealRecoTask::SetParContainers ( )
virtual

Virtual method Init

Definition at line 104 of file PndMvdIdealRecoTask.cxx.

References fGeoH, and PndGeoHandling::SetParContainers().

105 {
106  // Get Base Container
107  // FairRun* ana = FairRun::Instance();
108  // FairRuntimeDb* rtdb=ana->GetRuntimeDb();
109  // PndSdsIdealRecoTask::SetParContainers();
111 }
PndGeoHandling * fGeoH
virtual void SetParContainers()
void PndMvdIdealRecoTask::SetPersistance ( Bool_t  p = kTRUE)
inline

Definition at line 58 of file PndMvdIdealRecoTask.h.

References fPersistance, and p.

58 {fPersistance=p;};
Double_t p
Definition: anasim.C:58
void PndMvdIdealRecoTask::smear ( TVector3 &  pos)
private

smear a 3d vector

Definition at line 178 of file PndMvdIdealRecoTask.cxx.

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

Referenced by smearLocal().

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

smear a 3d vector in the local sensor plane

Definition at line 203 of file PndMvdIdealRecoTask.cxx.

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

Referenced by Exec().

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

Member Data Documentation

TString PndMvdIdealRecoTask::fBranchName
private

Definition at line 64 of file PndMvdIdealRecoTask.h.

Referenced by Init().

PndSdsMCPoint* PndMvdIdealRecoTask::fCurrentPndMvdMCPoint
private

Definition at line 76 of file PndMvdIdealRecoTask.h.

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

TGeoHMatrix* PndMvdIdealRecoTask::fCurrentTransMat
private

Definition at line 77 of file PndMvdIdealRecoTask.h.

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

PndGeoHandling* PndMvdIdealRecoTask::fGeoH
private

Definition at line 65 of file PndMvdIdealRecoTask.h.

Referenced by InitTransMat(), and SetParContainers().

TMatrixT<Double_t> PndMvdIdealRecoTask::fHitCovMatrix
private

Definition at line 78 of file PndMvdIdealRecoTask.h.

TClonesArray* PndMvdIdealRecoTask::fHitOutputArray
private

Output array of Hits

Definition at line 71 of file PndMvdIdealRecoTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndMvdIdealRecoTask::fMctruthArray
private

Definition at line 68 of file PndMvdIdealRecoTask.h.

Referenced by Init().

Bool_t PndMvdIdealRecoTask::fPersistance
private

Definition at line 59 of file PndMvdIdealRecoTask.h.

Referenced by GetPersistance(), Init(), and SetPersistance().

TClonesArray* PndMvdIdealRecoTask::fPointArray
private

Input array of Points

Definition at line 67 of file PndMvdIdealRecoTask.h.

Referenced by Exec(), and Init().

Double_t PndMvdIdealRecoTask::fSigmaX
private

Properties

Definition at line 73 of file PndMvdIdealRecoTask.h.

Referenced by Exec(), and smear().

Double_t PndMvdIdealRecoTask::fSigmaY
private

Definition at line 74 of file PndMvdIdealRecoTask.h.

Referenced by Exec(), and smear().

Double_t PndMvdIdealRecoTask::fSigmaZ
private

Definition at line 75 of file PndMvdIdealRecoTask.h.

Referenced by Exec(), and smear().


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