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