PandaRoot
PndHoughData.h
Go to the documentation of this file.
1 // PndHoughData
3 // Data structure for fast access to STT data
5 
16 /*
17 This class is similar to the data structure of the CellTrackFinder.
18 */
19 
20 #ifndef PndHoughData_H_
21 #define PndHoughData_H_
22 
23 #include <vector>
24 #include <map>
25 
26 #include "PndSttGeometryMap.h"
27 #include "PndSttStrawMap.h"
28 #include "FairHit.h"
29 #include "PndHoughSpace.h"
30 
31 class PndHoughData {
32 
33  public:
34  PndHoughData(TClonesArray *fTubeArray);
35 
36  virtual ~PndHoughData()
37  {
38  delete fGeometryMap;
39  delete fPndHoughSpace;
40  for (size_t i = 0; i < fHits.size(); ++i)
41  delete fHits.at(i);
42  }
43 
45  void AddHits(TClonesArray *hits, TString branchName);
47  void AddHit(FairLink link);
53  void Init(int NBins1 = 450, int NBins2 = 450)
54  {
55  fNbins1 = NBins1;
56  fNbins2 = NBins2;
57  fPndHoughSpace->SetNBins1(fNbins1);
58  fPndHoughSpace->SetNBins2(fNbins2);
59  fPndHoughSpace->Init();
60  }
62  void clear()
63  {
64  fHits.clear();
65  fLinks.clear();
66  fSTTLinks.clear();
67  fGEMLinks.clear();
68  fhittedTubes.clear();
69 
70  fMapFairLinktoFairHit.clear();
71  fMapFairLinktoIsochrone.clear();
72  fMapFairLinktoIsochroneError.clear();
73  fMapFairLinktoTubeId.clear();
74  fMapTubetoHit.clear();
75 
76  fGEMNeighbors.clear();
77  fMapNumberhittedSTTNeighbors.clear();
78 
79  fPndHoughSpace->clear();
80  }
82  std::vector<FairHit *> GetHits() const { return fHits; }
84  std::vector<FairLink> GetLinks() const { return fLinks; }
86  PndSttGeometryMap *GetGeometryMap() const { return fGeometryMap; }
88  PndSttStrawMap *GetStrawMap() const { return fStrawMap; }
90  std::map<FairLink, FairHit *> GetMapFairLinktoFairHit() const { return fMapFairLinktoFairHit; }
92  std::map<FairLink, Double_t> GetMapFairLinktoIsochrone() const { return fMapFairLinktoIsochrone; }
94  std::map<FairLink, Double_t> GetMapFairLinktoIsochroneError() const { return fMapFairLinktoIsochroneError; }
96  std::map<FairLink, Int_t> GetMapFairLinktoTubeId() const { return fMapFairLinktoTubeId; }
98  std::map<int, FairHit *> GetMapTubetoHit() const { return fMapTubetoHit; }
100  std::vector<int> GetHittedTubes() { return fhittedTubes; };
102  std::vector<FairLink> GetGEMNeighbors(FairLink link) { return fGEMNeighbors[link]; };
104  int GetNumOfGEMNeighbors(FairLink link) { return fGEMNeighbors[link].size(); };
106  double GetNumOfSTTNeighbors(FairLink link) { return fMapNumberhittedSTTNeighbors[link]; };
108  PndHoughSpace *GetHoughSpace() { return fPndHoughSpace; };
109 
110  private:
111  PndSttStrawMap *fStrawMap = nullptr; // for getting more information about the tubes
112  PndSttGeometryMap *fGeometryMap = nullptr; // for initializing the neighbors of each tube
113  PndHoughSpace *fPndHoughSpace = nullptr;
114 
115  std::map<FairLink, FairHit *> fMapFairLinktoFairHit;
116  std::map<FairLink, Double_t> fMapFairLinktoIsochrone;
117  std::map<FairLink, Double_t> fMapFairLinktoIsochroneError;
118  std::map<FairLink, Int_t> fMapFairLinktoTubeId;
119  std::map<FairLink, std::vector<FairLink>> fGEMNeighbors;
120  std::map<FairLink, double> fMapNumberhittedSTTNeighbors;
121  std::map<int, FairHit *> fMapTubetoHit; // maps hitted tube to FairHit
122 
123  std::vector<FairHit *> fHits;
124  std::vector<FairLink> fGEMLinks;
125  std::vector<FairLink> fSTTLinks;
126  std::vector<FairLink> fLinks; // vector with selected hits of an event
127  std::vector<int> fhittedTubes;
128 
129  int fNbins1;
130  int fNbins2;
131 
132  ClassDef(PndHoughData, 1);
133 };
134 
135 #endif /* PndHoughData_H_ */
void AddHit(FairLink link)
Adds a sigle hit to the used data structure for faster access. Data are stored in different maps...
void AddHits(TClonesArray *hits, TString branchName)
Adds hits to the used data structure for faster access. Data are stored in different maps...
std::map< FairLink, Int_t > GetMapFairLinktoTubeId() const
Returns the map linking FairLinks to corresponding tubeId.
Definition: PndHoughData.h:96
std::map< FairLink, Double_t > GetMapFairLinktoIsochroneError() const
Returns the map linking FairLinks to isochrone radius errors.
Definition: PndHoughData.h:94
virtual ~PndHoughData()
Definition: PndHoughData.h:36
void CreateSTTNeighborhoodData()
For all STT hits all other STT neighbors are counted and stored in a map.
std::vector< FairHit * > GetHits() const
Returns a vector of all hits in the event.
Definition: PndHoughData.h:82
void Init()
Initializes the Hough space.
std::map< FairLink, FairHit * > GetMapFairLinktoFairHit() const
Returns the map linking FairLinks to FairHits.
Definition: PndHoughData.h:90
unsigned int i
Definition: P4_F32vec4.h:21
PndSttStrawMap * GetStrawMap() const
Returns the straw map for a fast access.
Definition: PndHoughData.h:88
PndHoughData(TClonesArray *fTubeArray)
int GetNumOfGEMNeighbors(FairLink link)
Returns the number of GEM hits in a distance d < 1.5 cm.
Definition: PndHoughData.h:104
virtual void SetNBins1(double n)
Sets the number of bins in x direction of the Hough space.
Definition: PndHoughSpace.h:35
PndSttGeometryMap * GetGeometryMap() const
Returns the geometry map for a fast access.
Definition: PndHoughData.h:86
std::map< int, FairHit * > GetMapTubetoHit() const
Returns the map linking a tube to a FairHit.
Definition: PndHoughData.h:98
std::map< FairLink, Double_t > GetMapFairLinktoIsochrone() const
Returns the map linking FairLinks to isochrone radii.
Definition: PndHoughData.h:92
PndHoughSpace * GetHoughSpace()
Returns the Hough space.
Definition: PndHoughData.h:108
void Init(int NBins1=450, int NBins2=450)
Initializes the Hough space.
Definition: PndHoughData.h:53
void clear()
Clears all data maps.
Definition: PndHoughData.h:62
std::vector< int > GetHittedTubes()
Returns a vector of all hitted tubes.
Definition: PndHoughData.h:100
double GetNumOfSTTNeighbors(FairLink link)
Returns the number of neighbored STT hits. The return value is a double (not a int) to avoid a necess...
Definition: PndHoughData.h:106
virtual void SetNBins2(double n)
Sets the number of bins in y direction of the Hough space.
Definition: PndHoughSpace.h:37
std::vector< FairLink > GetGEMNeighbors(FairLink link)
Returns a vector of all GEM hits in a distance d < 1.5 cm from a certain GEM hit. ...
Definition: PndHoughData.h:102
std::vector< FairLink > GetLinks() const
Returns a vector of all FairLinks in the event.
Definition: PndHoughData.h:84
void CreateGEMNeighborhoodData()
For all GEM hits all other GEM hits in a certain distance (hier 1.5 cm) are counted and stored as nei...
void clear()
Clears the Hough space.
Definition: PndHoughSpace.h:49