PandaRoot
PndSttCA.h
Go to the documentation of this file.
1 /*
2  * PndSttCA.h
3  *
4  * Created on: May 20, 2014
5  * Author: schumann
6  */
7 
8 #ifndef PndSttCA_H_
9 #define PndSttCA_H_
10 
11 #include "PndTrackCand.h"
12 #include "PndTrack.h"
13 #include "FairLink.h"
14 #include "PndSttCAData.h"
16 #include "PndSttSkewedHit.h"
17 
18 #include <vector>
19 
20 class TClonesArray;
21 
22 class PndSttCA {
23  public:
24  PndSttCA(TClonesArray *tubeArray) : fBz(2.), fUseGPU(kFALSE), fDev_tubeNeighborings(nullptr), fTrackFinderData(nullptr), fTrackletGenerator(nullptr)
25  {
26 
27  // Generate TrackFinderData-Object
28  fTrackFinderData = new PndSttCAData(tubeArray);
29  };
30 
31  virtual ~PndSttCA()
32  {
33  delete fTrackFinderData;
34  delete fTrackletGenerator;
35 
36  for (size_t i = 0; i < fHits.size(); ++i) {
37  delete fHits.at(i);
38  }
39  for (std::multimap<int, PndSttSkewedHit *>::iterator it = fCombinedSkewedHits.begin(); it != fCombinedSkewedHits.end(); ++it) {
40  delete (*it).second;
41  }
42  }
43 
44  void FindTracks();
45  // so far only supports STTHits type of data. Uses the name of the Branch to distinguish between normal and Skewed.
46  void AddHits(TClonesArray *hits, TString branchName);
47 
48  void SetDevTubeNeighboringsPointer(int *dev_pointer) { fDev_tubeNeighborings = dev_pointer; }
49  void SetUseGPU(Bool_t val) { fUseGPU = val; }
50 
51  PndSttCAData *GetTrackFinderDataObject() { return fTrackFinderData; }
52 
53  int GetNumPrimaryTracklets() { return fTrackletGenerator->GetNumPrimaryTracklets(); }
54 
55  // Get TrackCands of start-tracklets before combination
56  PndTrackCand GetFirstTrackCand(int i) { return fFirstTrackCand[i]; };
57 
58  std::vector<std::vector<Double_t>> GetTimeStampsTrackletGen() { return fTimeStampsTrackletGen; };
59 
60  std::vector<std::vector<Double_t>> GetTimeStampsGenerateNeighborhoodData() { return fTimeStampsGenerateNeighborhoodData; };
61 
62  int NumFirstTrackCands() { return fFirstTrackCand.size(); };
63 
64  int NumHits() { return fTrackFinderData->GetNumHits(); }
65 
66  int NumHitsWithoutDouble() { return fTrackFinderData->GetNumHitsWithoutDouble(); }
67 
68  int NumUnambiguousNeighbors() { return fTrackFinderData->GetSeparations()[1].size() + fTrackFinderData->GetSeparations()[2].size(); }
69 
70  void SetCalcFirstTrackletInf(Bool_t val) { fCalcFirstTrackletInf = val; };
71 
72  void SetBz(Double_t val) { fBz = val; };
73 
74  void StoreTrackData() { fFirstTrackCand = fTrackletGenerator->GetFirstTrackCands(); };
75 
76  void Reset()
77  {
78  fHits.clear();
79  fTrackFinderData->clear();
80 
81  fFirstTrackCand.clear();
82 
83  delete fTrackletGenerator;
84  }
85 
86  private:
87  std::vector<std::vector<Double_t>> fTimeStampsTrackletGen;
88  std::vector<std::vector<Double_t>> fTimeStampsGenerateNeighborhoodData;
89 
90  Double_t fBz;
91 
92  Bool_t fUseGPU;
93  int *fDev_tubeNeighborings = nullptr;
94 
95  Bool_t fCalcFirstTrackletInf; // if true, calculate riemannTracks for start-tracklets
96  std::vector<FairHit *> fHits; // vector with all hits of the current event
97  std::multimap<int, PndSttSkewedHit *> fCombinedSkewedHits; //<(inner) Tube-ID of combined stt hits of skewed layers, corresponding hit>
98 
99  std::map<int, FairLink> fMapHitToFairLink; // map< index of hit in fHit, FairLink of SttHit>
100 
101  PndSttCAData *fTrackFinderData = nullptr;
102  PndSttCATrackletGenerator *fTrackletGenerator = nullptr;
103 
104  // for first step of trackfinding
105  std::vector<PndTrackCand> fFirstTrackCand; // for saving trackCands after the use of cellular automaton
106 
107  ClassDef(PndSttCA, 1);
108 };
109 
110 #endif /* PndSttCA_H_ */
void SetDevTubeNeighboringsPointer(int *dev_pointer)
Definition: PndSttCA.h:48
void StoreTrackData()
Definition: PndSttCA.h:74
void FindTracks()
PndTrackCand GetFirstTrackCand(int i)
Definition: PndSttCA.h:56
int NumFirstTrackCands()
Definition: PndSttCA.h:62
virtual ~PndSttCA()
Definition: PndSttCA.h:31
PndSttCA(TClonesArray *tubeArray)
Definition: PndSttCA.h:24
void SetBz(Double_t val)
Definition: PndSttCA.h:72
unsigned int i
Definition: P4_F32vec4.h:21
std::vector< std::vector< Double_t > > GetTimeStampsGenerateNeighborhoodData()
Definition: PndSttCA.h:60
int NumHitsWithoutDouble()
Definition: PndSttCA.h:66
std::vector< PndTrackCand > GetFirstTrackCands()
std::map< int, std::vector< int > > GetSeparations() const
Definition: PndSttCAData.h:77
int GetNumHits()
Definition: PndSttCAData.h:87
int GetNumPrimaryTracklets()
Definition: PndSttCA.h:53
std::vector< std::vector< Double_t > > GetTimeStampsTrackletGen()
Definition: PndSttCA.h:58
void AddHits(TClonesArray *hits, TString branchName)
void Reset()
Definition: PndSttCA.h:76
void clear()
Definition: PndSttCAData.h:41
PndSttCAData * GetTrackFinderDataObject()
Definition: PndSttCA.h:51
int NumHits()
Definition: PndSttCA.h:64
int GetNumHitsWithoutDouble()
Definition: PndSttCAData.h:89
void SetCalcFirstTrackletInf(Bool_t val)
Definition: PndSttCA.h:70
void SetUseGPU(Bool_t val)
Definition: PndSttCA.h:49
int NumUnambiguousNeighbors()
Definition: PndSttCA.h:68