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

#include <PndHypIdealTrackFinderTask.h>

Inheritance diagram for PndHypIdealTrackFinderTask:

Public Member Functions

 PndHypIdealTrackFinderTask ()
 
virtual ~PndHypIdealTrackFinderTask ()
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual InitStatus ReInit ()
 
virtual void Exec (Option_t *opt)
 
void PrintResult ()
 
void SetVerbose (Int_t verbose)
 

Private Member Functions

void ClearTrackCandMap ()
 
void AddAndExpand (Int_t trackID, Int_t detnum, Int_t iHit)
 
Double_t GetTrackDip (PndMCTrack *myTrack)
 
Double_t GetTrackCurvature (PndMCTrack *myTrack)
 
void Register ()
 
void Reset ()
 
void ProduceHits ()
 
 ClassDef (PndHypIdealTrackFinderTask, 2)
 

Private Attributes

TString fHitBranchStrip
 
TString fMcBranch
 
TString fTrackBranch
 
TClonesArray * fStripHitArray
 
TClonesArray * fMcArray
 
TClonesArray * fTrackArray
 
TClonesArray * fTrackCandArray
 
std::map< Int_t, GFTrackCand * > fTrackCandMap
 
Int_t fVerbose
 

Detailed Description

Definition at line 26 of file PndHypIdealTrackFinderTask.h.

Constructor & Destructor Documentation

PndHypIdealTrackFinderTask::PndHypIdealTrackFinderTask ( )

Default constructor

Definition at line 21 of file PndHypIdealTrackFinderTask.cxx.

References fHitBranchStrip, fMcBranch, and fTrackBranch.

21  :
22  FairTask("HYP Ideal Track Finding Task")
23 {
24  fHitBranchStrip = "HypHit";
25  //fHitBranchPixel = "MVDHitsPixel";
26  /* fClusterBranchStrip = "MVDStripClusterCand";
27  //fClusterBranchPixel = "MVDClusterCand";
28  fDigiBranchStrip = "MVDStripDigis";
29  //fDigiBranchPixel = "MVDPixelDigis";*/
30 
31  fMcBranch = "HypPoint";
32  fTrackBranch = "MCTrack";
33 }
PndHypIdealTrackFinderTask::~PndHypIdealTrackFinderTask ( )
virtual

Destructor

Definition at line 40 of file PndHypIdealTrackFinderTask.cxx.

41 {
42 }

Member Function Documentation

void PndHypIdealTrackFinderTask::AddAndExpand ( Int_t  trackID,
Int_t  detnum,
Int_t  iHit 
)
private

Definition at line 167 of file PndHypIdealTrackFinderTask.cxx.

References fTrackArray, fTrackCandMap, GetTrackCurvature(), GetTrackDip(), GFTrackCand::setCurv(), GFTrackCand::setDip(), and GFTrackCand::setInverted().

Referenced by Exec().

167  {
168  if (fTrackCandMap[trackID] == 0){
169  GFTrackCand *myTCand = new GFTrackCand();
170  PndMCTrack* myMCTrack = (PndMCTrack*)fTrackArray->At(trackID);
171  myTCand->setCurv(GetTrackCurvature(myMCTrack));
172  myTCand->setDip(GetTrackDip(myMCTrack));
173  myTCand->setInverted(false);
174  //myTCand->setMCID(trackID);
175  fTrackCandMap[trackID] = myTCand;
176  }
177  fTrackCandMap[trackID]->addHit(detnum,iHit);
178 }
void setDip(double d)
Definition: GFTrackCand.h:145
void setInverted(bool f=true)
Definition: GFTrackCand.h:146
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
void setCurv(double c)
Definition: GFTrackCand.h:144
Double_t GetTrackCurvature(PndMCTrack *myTrack)
std::map< Int_t, GFTrackCand * > fTrackCandMap
Double_t GetTrackDip(PndMCTrack *myTrack)
PndHypIdealTrackFinderTask::ClassDef ( PndHypIdealTrackFinderTask  ,
 
)
private
void PndHypIdealTrackFinderTask::ClearTrackCandMap ( )
private

Definition at line 212 of file PndHypIdealTrackFinderTask.cxx.

References fTrackCandMap.

Referenced by Exec().

213 {
214  for (std::map<Int_t,GFTrackCand*>::const_iterator ci=fTrackCandMap.begin();
215  ci != fTrackCandMap.end(); ci++){
216  delete(ci->second);
217  }
218  fTrackCandMap.clear();
219 }
std::map< Int_t, GFTrackCand * > fTrackCandMap
void PndHypIdealTrackFinderTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 130 of file PndHypIdealTrackFinderTask.cxx.

References AddAndExpand(), ClearTrackCandMap(), fMcArray, fStripHitArray, fTrackArray, fTrackCandArray, fTrackCandMap, fVerbose, i, and PrintResult().

131 {
132 // Reset output array
133  if ( ! fTrackCandArray )
134  Fatal("Exec", "No trackCandArray");
135  fTrackCandArray->Delete();
136 
137  Int_t
138  nStripHits = fStripHitArray->GetEntriesFast();
139 
140  for (Int_t iHit = 0; iHit < nStripHits; iHit++){
141  PndHypHit* myHit = (PndHypHit*)(fStripHitArray->At(iHit));
142 
143  /*PndHypCluster* myCluster =(PndHypCluster*)(fStripClusterArray->At(myHit->GetRefIndex()));
144  PndHypDigiStrip* astripdigi = (PndHypDigiStrip*)fStripDigiArray->At(myCluster->GetDigiIndex(0));*/
145 
146  PndHypPoint* myPoint = (PndHypPoint*)(fMcArray->At(myHit->GetRefIndex()));
147 
148  AddAndExpand(myPoint->GetTrackID(),2,iHit);
149  }
150 
151 
152  if(fVerbose>0) PrintResult();
153 
154  Int_t i = 0;
155  for (std::map<Int_t,GFTrackCand*>::const_iterator ci=fTrackCandMap.begin();
156  ci != fTrackCandMap.end(); ci++){
157  new((*fTrackCandArray)[i]) GFTrackCand(*(ci->second));
158  i++;
159  }
161  fMcArray->Delete();
162  fTrackArray->Delete();
163 
164 }
Int_t i
Definition: run_full.C:25
void AddAndExpand(Int_t trackID, Int_t detnum, Int_t iHit)
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
std::map< Int_t, GFTrackCand * > fTrackCandMap
Double_t PndHypIdealTrackFinderTask::GetTrackCurvature ( PndMCTrack myTrack)
private

Definition at line 181 of file PndHypIdealTrackFinderTask.cxx.

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

Referenced by AddAndExpand().

182 {
183  TVector3 p = myTrack->GetMomentum();
184  return (2/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py()));
185 }
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 PndHypIdealTrackFinderTask::GetTrackDip ( PndMCTrack myTrack)
private

Definition at line 187 of file PndHypIdealTrackFinderTask.cxx.

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

Referenced by AddAndExpand().

188 {
189  TVector3 p= myTrack->GetMomentum();
190  return (p.Mag()/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py()));
191 }
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 PndHypIdealTrackFinderTask::Init ( )
virtual

Definition at line 72 of file PndHypIdealTrackFinderTask.cxx.

References fHitBranchStrip, fMcArray, fMcBranch, fStripHitArray, fTrackArray, fTrackBranch, and fTrackCandArray.

73 {
74 
75  FairRootManager* ioman = FairRootManager::Instance();
76 
77  if ( ! ioman )
78  {
79  std::cout << "-E- PndHypIdealTrackFinderTask::Init: "
80  << "RootManager not instantiated!" << std::endl;
81  return kFATAL;
82  }
83 
84 
85 // Get input array
86  fStripHitArray = (TClonesArray*) ioman->GetObject(fHitBranchStrip);
87  if ( !fStripHitArray){
88  std::cout << "-W- PndHypIdealTrackFinderTask::Init: " << "No hitArray!" << std::endl;
89  return kERROR;
90  }
91 
92  /* fStripClusterArray = (TClonesArray*) ioman->GetObject(fClusterBranchStrip);
93  if ( !fStripClusterArray){
94  std::cout << "-W- PndHypIdealTrackFinderTask::Init: " << "No clusterArray!" << std::endl;
95  return kERROR;
96  }
97 
98  fStripDigiArray = (TClonesArray*) ioman->GetObject(fDigiBranchStrip);
99  if ( !fStripDigiArray){
100  std::cout << "-W- PndHypIdealTrackFinderTask::Init: " << "No digiArray!" << std::endl;
101  return kERROR;
102  }
103 
104 */
105  fMcArray = (TClonesArray*) ioman->GetObject(fMcBranch);
106  if ( !fMcArray){
107  std::cout << "-W- PndHypIdealTrackFinderTask::Init: " << "No mcArray!" << std::endl;
108  return kERROR;
109  }
110 
111  fTrackArray = (TClonesArray*) ioman->GetObject(fTrackBranch);
112  if ( !fTrackArray){
113  std::cout << "-W- PndHypIdealTrackFinderTask::Init: " << "No trackArray!" << std::endl;
114  return kERROR;
115  }
116 
117 
118 
119  fTrackCandArray = new TClonesArray("GFTrackCand");
120  ioman->Register("HypTrackCand", "HYP", fTrackCandArray, kTRUE);
121 
122  std::cout << "-I- PndHypIdealTrackFinderTask: Initialisation successfull" << std::endl;
123  return kSUCCESS;
124 }
void PndHypIdealTrackFinderTask::PrintResult ( )

Definition at line 193 of file PndHypIdealTrackFinderTask.cxx.

References fStripHitArray, fTrackCandMap, GFTrackCand::getHit(), GFTrackCand::getNHits(), and i.

Referenced by Exec().

194 {
195  std::cout << "**** TrackFinding *****" << std::endl;
196  Int_t nStripHits = fStripHitArray->GetEntriesFast();
197  for (std::map<Int_t, GFTrackCand*>::const_iterator ci=fTrackCandMap.begin();
198  ci != fTrackCandMap.end(); ci++){
199  std::cout << "TrackID: " << ci->first << std::endl;
200  GFTrackCand* trackCand = ci->second;
201  for (unsigned int i = 0; i < trackCand->getNHits(); i++){
202  unsigned int detId, hitId;
203  trackCand->getHit(i, detId, hitId);
204  PndHypHit* myHit;
205  myHit = (PndHypHit*)fStripHitArray->At(hitId);
206  std::cout << "Detector no. " << detId <<": "<< *myHit;
207  }
208  }
209  std::cout << std::endl;
210 }
Int_t i
Definition: run_full.C:25
unsigned int getNHits() const
Definition: GFTrackCand.h:113
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
Definition: GFTrackCand.h:84
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
std::map< Int_t, GFTrackCand * > fTrackCandMap
void PndHypIdealTrackFinderTask::ProduceHits ( )
private
void PndHypIdealTrackFinderTask::Register ( )
private
InitStatus PndHypIdealTrackFinderTask::ReInit ( )
virtual

Definition at line 56 of file PndHypIdealTrackFinderTask.cxx.

57 {
58 
59  InitStatus stat=kERROR;
60  return stat;
61 
62  /*
63  FairRunAna* ana = FairRunAna::Instance();
64  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
65  fGeoPar=(PndHypGeoPar*)(rtdb->getContainer("PndHypGeoPar"));
66 
67  return kSUCCESS;
68  */
69 }
void PndHypIdealTrackFinderTask::Reset ( )
private
void PndHypIdealTrackFinderTask::SetParContainers ( )
virtual

Virtual method Init

Definition at line 46 of file PndHypIdealTrackFinderTask.cxx.

47 {
48  // Get Base Container
49 /*
50  FairRunAna* ana = FairRunAna::Instance();
51  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
52  fGeoPar = (PndHypGeoPar*)(rtdb->getContainer("PndHypGeoPar"));
53 */
54 }
void PndHypIdealTrackFinderTask::SetVerbose ( Int_t  verbose)
inline

Definition at line 45 of file PndHypIdealTrackFinderTask.h.

References fVerbose, and verbose.

Member Data Documentation

TString PndHypIdealTrackFinderTask::fHitBranchStrip
private

Definition at line 56 of file PndHypIdealTrackFinderTask.h.

Referenced by Init(), and PndHypIdealTrackFinderTask().

TClonesArray* PndHypIdealTrackFinderTask::fMcArray
private

Definition at line 66 of file PndHypIdealTrackFinderTask.h.

Referenced by Exec(), and Init().

TString PndHypIdealTrackFinderTask::fMcBranch
private

Definition at line 59 of file PndHypIdealTrackFinderTask.h.

Referenced by Init(), and PndHypIdealTrackFinderTask().

TClonesArray* PndHypIdealTrackFinderTask::fStripHitArray
private

Input array of PndHypDigis

Definition at line 63 of file PndHypIdealTrackFinderTask.h.

Referenced by Exec(), Init(), and PrintResult().

TClonesArray* PndHypIdealTrackFinderTask::fTrackArray
private

Definition at line 67 of file PndHypIdealTrackFinderTask.h.

Referenced by AddAndExpand(), Exec(), and Init().

TString PndHypIdealTrackFinderTask::fTrackBranch
private

Definition at line 60 of file PndHypIdealTrackFinderTask.h.

Referenced by Init(), and PndHypIdealTrackFinderTask().

TClonesArray* PndHypIdealTrackFinderTask::fTrackCandArray
private

Output array of PndHypHits

Definition at line 70 of file PndHypIdealTrackFinderTask.h.

Referenced by Exec(), and Init().

std::map<Int_t, GFTrackCand*> PndHypIdealTrackFinderTask::fTrackCandMap
private

Definition at line 71 of file PndHypIdealTrackFinderTask.h.

Referenced by AddAndExpand(), ClearTrackCandMap(), Exec(), and PrintResult().

Int_t PndHypIdealTrackFinderTask::fVerbose
private

Definition at line 73 of file PndHypIdealTrackFinderTask.h.

Referenced by Exec(), and SetVerbose().


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