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