PandaRoot
PndSttCellTrackFinder.h
Go to the documentation of this file.
1 /*
2  * PndSttCellTrackFinder.h
3  *
4  * Created on: May 20, 2014
5  * Author: schumann
6  */
7 
8 #ifndef PndSttCellTrackFinder_H_
9 #define PndSttCellTrackFinder_H_
10 
11 #include "PndTrackCand.h"
12 #include "PndRiemannTrack.h"
13 #include "PndTrack.h"
14 #include "FairLink.h"
17 #include "PndSttHitCorrector.h"
18 #include "PndSttSkewedHit.h"
19 
20 #include <vector>
21 
22 class TClonesArray;
23 
25  public:
26  PndSttCellTrackFinder(TClonesArray *tubeArray)
27  : fVerbose(0), fBz(2.), fClusterTime(250.0), fUseGPU(kFALSE), fRunTimeBased(kFALSE), fDev_tubeNeighborings(nullptr), fCalcWithCorrectedIsochrones(kFALSE),
28  fCalcFirstTrackletInf(kFALSE), fTrackFinderData(nullptr), fTrackletGenerator(nullptr), fHitCorrector(nullptr)
29  {
30 
31  // Generate TrackFinderData-Object
32  fTrackFinderData = new PndSttCellTrackFinderData(tubeArray);
33  };
34 
36  {
37  delete fTrackFinderData;
38  delete fHitCorrector;
39  delete fTrackletGenerator;
40 
41  for (size_t i = 0; i < fHits.size(); ++i) {
42  delete fHits.at(i);
43  }
44  for (std::multimap<int, PndSttSkewedHit *>::iterator it = fCombinedSkewedHits.begin(); it != fCombinedSkewedHits.end(); ++it) {
45  delete (*it).second;
46  }
47  }
48 
49  void FindTracks();
50  // so far only supports STTHits type of data. Uses the name of the Branch to distinguish between normal and Skewed.
51  void AddHits(TClonesArray *hits, TString branchName);
52 
53  void SetUseGPU(Bool_t val) { fUseGPU = val; }
54  void SetRunTimeBased(Bool_t val) { fRunTimeBased = val; }
55  void SetClusterTime(double val) { fClusterTime = val; }; // J.R. 20/04-2018
56  void SetDevTubeNeighboringsPointer(int *dev_pointer) { fDev_tubeNeighborings = dev_pointer; }
57 
58  void SetCalcWithCorrectedIsochrones(Bool_t val) { fCalcWithCorrectedIsochrones = val; }
59 
60  PndSttCellTrackFinderData *GetTrackFinderDataObject() { return fTrackFinderData; }
61 
62  std::map<Int_t, FairHit *> GetCorrectedIsochrones() { return fHitCorrector->GetCorrectedHits(); }
63 
64  int GetNumPrimaryTracklets() { return fTrackletGenerator->GetNumPrimaryTracklets(); }
65 
66  // Get TrackCands of start-tracklets before combination
67  PndTrackCand GetFirstTrackCand(int i) { return fFirstTrackCand[i]; };
68 
69  // Get RiemannTracks before combination of tracklets
70  PndRiemannTrack GetFirstRiemannTrack(int i) { return fFirstRiemannTrack[i]; };
71 
72  // Get TrackCands of combinated tracklets
73  PndTrackCand GetCombiTrackCand(int i) { return fCombiTrackCand[i]; };
74 
75  // Get PndTrack of combinated tracklets
76  PndTrack GetCombiTrack(int i) { return fCombiTrack[i]; };
77 
78  PndRiemannTrack GetCombiRiemannTrack(int i) { return fCombiRiemannTrack[i]; };
79 
80  std::vector<std::vector<Double_t>> GetTimeStampsTrackletGen() { return fTimeStampsTrackletGen; };
81 
82  std::vector<std::vector<Double_t>> GetTimeStampsGenerateNeighborhoodData() { return fTimeStampsGenerateNeighborhoodData; };
83 
84  int NumFirstTrackCands() { return fFirstTrackCand.size(); };
85 
86  int NumFirstRiemannTracks() { return fFirstRiemannTrack.size(); };
87 
88  int NumCombinedTracks() { return fCombiTrackCand.size(); };
89 
90  int NumCombinedRiemannTracks() { return fCombiRiemannTrack.size(); };
91 
92  int NumHits() { return fTrackFinderData->GetNumHits(); }
93 
94  int NumHitsWithoutDouble() { return fTrackFinderData->GetNumHitsWithoutDouble(); }
95 
96  int NumUnambiguousNeighbors() { return fTrackFinderData->GetSeparations()[1].size() + fTrackFinderData->GetSeparations()[2].size(); }
97 
98  void SetCalcFirstTrackletInf(Bool_t val) { fCalcFirstTrackletInf = val; };
99 
100  void SetVerbose(Int_t val) { fVerbose = val; };
101 
102  void SetBz(Double_t val) { fBz = val; };
103 
105  {
106  fFirstTrackCand = fTrackletGenerator->GetFirstTrackCands();
107 
108  if (fCalcFirstTrackletInf)
109  fFirstRiemannTrack = fTrackletGenerator->GetFirstRiemannTracks();
110 
111  fCombiTrackCand = fTrackletGenerator->GetCombiTrackCands();
112  fCombiRiemannTrack = fTrackletGenerator->GetCombiRiemannTracks();
113  fCombiTrack = fTrackletGenerator->GetCombiTracks();
114  };
115 
116  void Reset()
117  {
118  fHits.clear();
119  fTrackFinderData->clear();
120 
121  fFirstTrackCand.clear();
122  fFirstRiemannTrack.clear();
123 
124  fCombiTrackCand.clear();
125  fCombiTrack.clear();
126  fCombiRiemannTrack.clear();
127 
128  delete fHitCorrector;
129  delete fTrackletGenerator;
130  }
131 
132  private:
133  std::vector<std::vector<Double_t>> fTimeStampsTrackletGen;
134  std::vector<std::vector<Double_t>> fTimeStampsGenerateNeighborhoodData;
135 
136  Int_t fVerbose;
137  Double_t fBz;
138 
139  double fClusterTime;
140 
141  Bool_t fUseGPU;
142  Bool_t fRunTimeBased;
143  int *fDev_tubeNeighborings;
144 
145  Bool_t fCalcWithCorrectedIsochrones;
146 
147  Bool_t fCalcFirstTrackletInf; // if true, calculate riemannTracks for start-tracklets
148  std::vector<FairHit *> fHits; // vector with all hits of the current event
149  std::multimap<int, PndSttSkewedHit *> fCombinedSkewedHits; //<(inner) Tube-ID of combined stt hits of skewed layers, corresponding hit>
150 
151  std::map<int, FairLink> fMapHitToFairLink; // map< index of hit in fHit, FairLink of SttHit>
152 
153  PndSttCellTrackFinderData *fTrackFinderData;
154  PndSttCellTrackletGenerator *fTrackletGenerator;
155  PndSttHitCorrector *fHitCorrector;
156 
157  // for first step of trackfinding
158  std::vector<PndTrackCand> fFirstTrackCand; // for saving trackCands after the use of cellular automaton
159  std::vector<PndRiemannTrack> fFirstRiemannTrack; // for saving + plotting the riemann-tracks after the first step
160 
161  std::vector<PndTrackCand> fCombiTrackCand; // resulting tracks of combined tracklets
162  std::vector<PndTrack> fCombiTrack; // resulting PndTrack
163  std::vector<PndRiemannTrack> fCombiRiemannTrack;
164 
165  ClassDef(PndSttCellTrackFinder, 1);
166 };
167 
168 #endif /* PndSttCellTrackFinder_H_ */
PndSttCellTrackFinder(TClonesArray *tubeArray)
std::map< Int_t, FairHit * > GetCorrectedIsochrones()
std::vector< PndTrackCand > GetFirstTrackCands()
void SetClusterTime(double val)
std::vector< PndRiemannTrack > GetCombiRiemannTracks()
void SetDevTubeNeighboringsPointer(int *dev_pointer)
void SetRunTimeBased(Bool_t val)
PndRiemannTrack GetCombiRiemannTrack(int i)
void SetCalcFirstTrackletInf(Bool_t val)
std::map< int, FairHit * > GetCorrectedHits()
unsigned int i
Definition: P4_F32vec4.h:21
std::map< int, std::vector< int > > GetSeparations() const
std::vector< std::vector< Double_t > > GetTimeStampsTrackletGen()
PndRiemannTrack GetFirstRiemannTrack(int i)
PndSttCellTrackFinderData * GetTrackFinderDataObject()
std::vector< PndTrackCand > GetCombiTrackCands()
void AddHits(TClonesArray *hits, TString branchName)
PndTrackCand GetFirstTrackCand(int i)
void SetCalcWithCorrectedIsochrones(Bool_t val)
std::vector< std::vector< Double_t > > GetTimeStampsGenerateNeighborhoodData()
std::vector< PndRiemannTrack > GetFirstRiemannTracks()
PndTrackCand GetCombiTrackCand(int i)
std::vector< PndTrack > GetCombiTracks()