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

#include <PndHypIdealTrackingTask.h>

Inheritance diagram for PndHypIdealTrackingTask:

Public Member Functions

 PndHypIdealTrackingTask ()
 
 ~PndHypIdealTrackingTask ()
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
Double_t GetTrackDip (PndMCTrack *myTrack)
 
Double_t GetTrackCurvature (PndMCTrack *myTrack)
 

Private Member Functions

void Register ()
 
void Reset ()
 
void ProduceHits ()
 
 ClassDef (PndHypIdealTrackingTask, 1)
 

Private Attributes

TString fBranchName
 
TClonesArray * fHitArray
 
TClonesArray * fDigiStripArray
 
TClonesArray * fMctruthArray
 
TClonesArray * fClusterStripArray
 
TClonesArray * fPointArray
 
TClonesArray * fTrackOutputArray
 

Detailed Description

Definition at line 28 of file PndHypIdealTrackingTask.h.

Constructor & Destructor Documentation

PndHypIdealTrackingTask::PndHypIdealTrackingTask ( )

Default constructor

Definition at line 33 of file PndHypIdealTrackingTask.cxx.

References fBranchName.

33  :
34 FairTask("Digitization task for PANDA PndHyp")
35 {
36  //fBranchName = "HYPStripClusterHit";
37  fBranchName = "";
38 }
PndHypIdealTrackingTask::~PndHypIdealTrackingTask ( )

Destructor

Definition at line 44 of file PndHypIdealTrackingTask.cxx.

45 {
46 }

Member Function Documentation

PndHypIdealTrackingTask::ClassDef ( PndHypIdealTrackingTask  ,
 
)
private
void PndHypIdealTrackingTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

detector number hardcoded TODO: convention

Definition at line 105 of file PndHypIdealTrackingTask.cxx.

References Double_t, fClusterStripArray, fDigiStripArray, fHitArray, fMctruthArray, fPointArray, fTrackOutputArray, fVerbose, PndHypHit::GetBotIndex(), GetTrackCurvature(), GetTrackDip(), hit(), mom, point, and pos.

106 {
107  if ( ! fTrackOutputArray ) Fatal("Exec", "No fTrackOutputArray");
108  fTrackOutputArray->Delete();
109 
110  // CREATE MONTECARLO MAP
111  std::map<Int_t, PndMCTrack*> mcmap;
112  Int_t nmc=fMctruthArray->GetEntriesFast();
113  for(Int_t imc=0;imc<nmc;++imc){
114  PndMCTrack* mc=(PndMCTrack*)fMctruthArray->At(imc);
115  mcmap[imc]=mc;
116  //if(mc->GetPdgCode()>100)cout<<imc<<" "<<mc->GetPdgCode()<<endl;
117 
118  }
119 
120  // BUILD TRACK Candidates
121  std::map<Int_t, GFTrackCand*> trackMap;
122 
123  Int_t nPndHypHits=fHitArray->GetEntriesFast();
124  cout<<nPndHypHits<<endl;
125 
126 
127  for(Int_t iHit=0;iHit<nPndHypHits;++iHit)
128  {
129  PndHypHit* hit=(PndHypHit*)fHitArray->At(iHit);
130  Int_t clustid=hit->GetRefIndex();
131  Int_t digiid,pointid,MCid;
132 
133 
134  if(hit->GetBotIndex()>0)
135  {
136  digiid=((PndHypCluster*)fClusterStripArray->At(clustid))->GetDigiIndex(0);
137  pointid=((PndHypDigi*)fDigiStripArray->At(digiid))->GetIndex();
138  }
139 
140  //cout<<iHit<<" "<<pointid<<" "<<fPointArray->GetEntriesFast()<<endl;
141 
142 
143  //if(pointid >fPointArray->GetEntriesFast())continue;
144 
145 
146  PndHypPoint* point = (PndHypPoint*)fPointArray->At(pointid);
147  MCid = point->GetTrackID();
148 
149  //if(point)cout<<point->GetVolumeID()<<endl;
150 
151  // cut on secondaries (deltas) etc
152  if(MCid<0)continue;
153 
154  cout<<MCid<<endl;
155  TVector3 pos;
156  hit->Position(pos);
157 
158  // build tracks here:
159 
160  // check if track already candidated:
161  if(trackMap[MCid]==0)
162  {Int_t size = fTrackOutputArray->GetEntriesFast();
163  //caution this should be an intrinsic assignment, so trackMap and
164  //fTrackOutputArray contain the same pointers.
165  trackMap[MCid]=new ((*fTrackOutputArray)[size]) GFTrackCand();
166 
167  Int_t pdgcode;
168  if( mcmap[MCid]==0)continue;
169 
170  pdgcode = mcmap[MCid]->GetPdgCode();
171  cout<<pdgcode<<endl;
172 
173  TParticlePDG pdgpart(pdgcode);
174  Int_t mcCharge = (Int_t)pdgpart.Charge();
175 
176  TVector3 vtx = mcmap[MCid]->GetStartVertex();
177  TVector3 mom = mcmap[MCid]->GetMomentum();
178 
179 
180  Double_t invp = 1 / mom.Mag();
181  Double_t dxdz = invp*mom.x()*mom.z();
182  Double_t dydz = invp*mom.y()*mom.z();
183  Double_t sigx = 0.01, sigy = 0.01, sigdxdz = 0.01, sigdydz = 0.01, siginvp = 0.01;
184 
185  sigx*=vtx.x();
186  sigy*=vtx.y();
187  sigdxdz*=dxdz;
188  sigdydz*=dydz;
189  siginvp*=invp;
190 
191  if(fVerbose>1) std::cout<<"PndHypIdealTrackingTask::Exec(), Particle Info: "
192  <<pdgpart.GetName()<<" ("<<pdgcode<<") Q="<<mcCharge<<std::endl;
193 
194  trackMap[MCid]->setCurv(GetTrackCurvature(mcmap[MCid]));
195  trackMap[MCid]->setDip(GetTrackDip(mcmap[MCid]));
196  trackMap[MCid]->setInverted(false);
197 
198 
199 
200  }
201 
202  // add the hit index
203  // trackMap[MCid]->addHit(,hit->GetDetectorID(),iHit);
204  // PndHypRecoHit arecohit(hit);
205 
207  trackMap[MCid]->addHit(3,iHit);
208  cout<<iHit<<endl;
209 
210 
211 
212  }//end for hit
213 
214 
215  std::cout<<fTrackOutputArray->GetEntriesFast()
216  <<" Tracks created"<<std::endl;
217 
218 
219 
220 
221 }
TVector3 pos
int fVerbose
Definition: poormantracks.C:24
Class to store the Digis which belong to one cluster This class holds the information which Digi belo...
Definition: PndHypCluster.h:18
Double_t mom
Definition: plot_dirc.C:14
Double_t
Int_t GetBotIndex() const
Definition: PndHypHit.h:88
TClonesArray * point
Definition: anaLmdDigi.C:29
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Double_t GetTrackDip(PndMCTrack *myTrack)
Base class for Digi information.
Definition: PndHypDigi.h:23
Double_t GetTrackCurvature(PndMCTrack *myTrack)
Double_t PndHypIdealTrackingTask::GetTrackCurvature ( PndMCTrack myTrack)

Definition at line 223 of file PndHypIdealTrackingTask.cxx.

References PndMCTrack::GetMomentum(), p, and CAMath::Sqrt().

Referenced by Exec().

224 {
225  TVector3 p = myTrack->GetMomentum();
226  return (2/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py()));
227 }
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
Double_t p
Definition: anasim.C:58
Double_t PndHypIdealTrackingTask::GetTrackDip ( PndMCTrack myTrack)

Definition at line 229 of file PndHypIdealTrackingTask.cxx.

References PndMCTrack::GetMomentum(), p, and CAMath::Sqrt().

Referenced by Exec().

230 {
231  TVector3 p= myTrack->GetMomentum();
232  return (p.Mag()/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py()));
233 }
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
Double_t p
Definition: anasim.C:58
InitStatus PndHypIdealTrackingTask::Init ( )
virtual

Definition at line 49 of file PndHypIdealTrackingTask.cxx.

References fClusterStripArray, fDigiStripArray, fHitArray, fMctruthArray, fPointArray, and fTrackOutputArray.

50 {
51  // Get RootManager
52  FairRootManager* ioman = FairRootManager::Instance();
53  if ( ! ioman ) {
54  std::cout << "-E- PndHypIdealTrackingTask::Init: "<< "RootManager not instantiated!" << std::endl;
55  return kFATAL; }
56 
57  // Get input array
58  fHitArray = (TClonesArray*) ioman->GetObject("HYPHit");
59  if ( ! fHitArray ) {
60  std::cout << "-W- PndHypIdealTrackingTask::Init: "<< "No fHitarray!" << std::endl;
61  return kERROR; }
62 
63  fClusterStripArray = (TClonesArray*) ioman->GetObject("HYPStripClusterCand");
64  if ( ! fClusterStripArray ) {
65  std::cout << "-W- PndMvdIdealTrackingTask::Init: "<< "No fClusterStripArray!" << std::endl;
66  return kERROR; }
67 
68  fDigiStripArray = (TClonesArray*) ioman->GetObject("HypStripDigis");
69  if ( ! fDigiStripArray ) {
70  std::cout << "-W- PndMvdIdealTrackingTask::Init: "<< "No fDigiStripArray array!" << std::endl;
71  return kERROR; }
72 
73  fPointArray = (TClonesArray*) ioman->GetObject("HypPoint");
74  if ( ! fPointArray )
75  {
76  std::cout << "-W- PndHypStripHitProducer::Init: "
77  << "No MVDPoint array!" << std::endl;
78  return kERROR;
79  }
80 
81  // Get MCTruth collection
82  fMctruthArray=(TClonesArray*) ioman->GetObject("MCTrack");
83  if(fMctruthArray==0) {
84  std::cout << "-W- PndHypIdealTrackingTask::Init: "<< "No McTruth array!" << std::endl;
85  return kERROR; }
86 
87  // Create and register output array
88  fTrackOutputArray = new TClonesArray("GFTrackCand");
89  ioman->Register("HypTrackCand", "PndHyp ideal tracklets", fTrackOutputArray, kTRUE);
90 
91 
92  return kSUCCESS;
93 }
void PndHypIdealTrackingTask::ProduceHits ( )
private
void PndHypIdealTrackingTask::Register ( )
private
void PndHypIdealTrackingTask::Reset ( )
private
void PndHypIdealTrackingTask::SetParContainers ( )
virtual

Virtual method Init

Definition at line 95 of file PndHypIdealTrackingTask.cxx.

References rtdb.

96 {
97  // Get Base Container
98  FairRunAna* ana = FairRunAna::Instance();
99  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
100 
101 }
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66

Member Data Documentation

TString PndHypIdealTrackingTask::fBranchName
private

Definition at line 53 of file PndHypIdealTrackingTask.h.

Referenced by PndHypIdealTrackingTask().

TClonesArray* PndHypIdealTrackingTask::fClusterStripArray
private

Definition at line 56 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealTrackingTask::fDigiStripArray
private

Definition at line 55 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealTrackingTask::fHitArray
private

Input array of Points

Definition at line 55 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealTrackingTask::fMctruthArray
private

Definition at line 56 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealTrackingTask::fPointArray
private

Definition at line 57 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypIdealTrackingTask::fTrackOutputArray
private

Output array of Hits

Definition at line 60 of file PndHypIdealTrackingTask.h.

Referenced by Exec(), and Init().


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