PandaRoot
PndSttCAData.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  * PndSttCAData.h
15  *
16  * Created on: May 8, 2014
17  * Author: schumann
18  */
19 
20 #ifndef PNDSttCADATA_H_
21 #define PNDSttCADATA_H_
22 
23 #include <vector>
24 #include <map>
25 
26 #include "TVector3.h"
27 #include "PndSttGeometryMap.h"
28 #include "PndSttStrawMap.h"
29 #include "FairHit.h"
30 
31 class TClonesArray;
32 class PndSttSkewedHit;
33 
34 class PndSttCAData {
35 
36  public:
37  PndSttCAData(TClonesArray *fTubeArray);
38 
39  virtual ~PndSttCAData()
40  {
41  delete fStrawMap;
42  delete fGeometryMap;
43  for (size_t i = 0; i < fHits.size(); ++i)
44  delete fHits.at(i);
45  for (size_t i = 0; i < fHitsOrig.size(); ++i)
46  delete fHitsOrig.at(i);
47  }
48  // only support STTHits , uses brachNAme to distinguish between normal and skewed straws
49  void AddHits(TClonesArray *hits, TString branchName);
50 
52 
53  void clear()
54  {
55  fHits.clear();
56  fHitsOrig.clear();
57  fMapHitToFairLink.clear();
58  fMapTubeIdToHit.clear();
59  fHitNeighbors.clear();
60  fSeparations.clear();
61  fHitNeighborsWithoutEdges.clear();
62  fSeparationsWithoutEdges.clear();
63  fHitNeighborsWithoutSkewed.clear();
64  fSeparationsWithoutSkewed.clear();
65  }
66 
67  void PrintInfo();
68 
69  void SetAllowDoubleHits(Bool_t value) { fAllowDoubleHits = value; }
70 
71  Bool_t GetAllowDoubleHits() { return fAllowDoubleHits; }
72 
73  std::vector<FairHit *> GetHits() const { return fHits; }
74 
75  std::multimap<int, PndSttSkewedHit *> GetCombinedSkewedHits() const { return fCombinedSkewedHits; }
76 
77  PndSttStrawMap *GetStrawMap() const { return fStrawMap; }
78 
79  PndSttGeometryMap *GetGeometryMap() const { return fGeometryMap; }
80 
81  std::map<int, FairLink> GetMapHitToFairLink() const { return fMapHitToFairLink; }
82 
83  std::map<int, int> GetMapTubeIdToHit() const { return fMapTubeIdToHit; }
84 
85  std::map<int, TVector3> GetMapTubeIdToPos() const { return fMapTubeIdToPos; }
86 
87  std::map<int, std::vector<int>> GetHitNeighbors() const { return fHitNeighbors; }
88 
89  std::map<int, std::vector<int>> GetSeparations() const { return fSeparations; }
90 
91  std::map<int, std::vector<int>> GetHitNeighborsWithoutEdges() const { return fHitNeighborsWithoutEdges; }
92 
93  std::map<int, std::vector<int>> GetSeparationsWithoutEdges() const { return fSeparationsWithoutEdges; }
94 
95  std::map<int, std::vector<int>> GetHitNeighborsWithoutSkewed() const { return fHitNeighborsWithoutSkewed; }
96 
97  std::map<int, std::vector<int>> GetSeparationsWithoutSkewed() const { return fSeparationsWithoutSkewed; }
98 
99  int GetNumHits() { return fNumHits; }
100 
101  int GetNumHitsWithoutDouble() { return fNumHitsWithoutDouble; }
102 
103  private:
104  std::map<int, FairLink> fMapHitToFairLink; // map< index of hit in fHit, FairLink of SttHit>
105  std::map<int, FairLink> fMapHitToFairLinkOrig; // map< index of hit in fHitOrig, FairLink of SttHit>
106  std::vector<FairHit *> fHits; // vector with selected hits of an event
107  std::vector<FairHit *> fHitsOrig; // vector with all originally hits of an event
108  std::multimap<int, PndSttSkewedHit *> fCombinedSkewedHits; //<(inner) Tube-ID of combined stt hits of skewed layers, corresponding hit>
109 
110  Bool_t fAllowDoubleHits;
111  int fNumHits;
112  int fNumHitsWithoutDouble;
113 
114  PndSttStrawMap *fStrawMap; // for getting more information about the tubes
115  PndSttGeometryMap *fGeometryMap; // for initializing the neighbors of each tube
116  std::map<int, TVector3> fMapTubeIdToPos; // map<straw id, position of the center of the tube>
117  std::map<int, int> fMapTubeIdToHit; // map< id of straw tube, index of hit in fHit>
118 
119  std::map<int, std::vector<int>> fHitNeighbors; // map<straw id, vector<ids of hit-neighbors>>
120  std::map<int, std::vector<int>> fSeparations; // map<#active neighbors, vector<straw ids>>
121 
122  std::map<int, std::vector<int>> fHitNeighborsWithoutEdges; // map<straw id, vector<ids of hit-neighbors>>
123  std::map<int, std::vector<int>> fSeparationsWithoutEdges; // map<#active neighbors, vector<straw ids>>
124 
125  std::map<int, std::vector<int>> fHitNeighborsWithoutSkewed; // map<straw id, vector<ids of hit-neighbors>>
126  std::map<int, std::vector<int>> fSeparationsWithoutSkewed; // map<#active neighbors, vector<straw ids>>
127 
128  /* Method grades the active cells according to the number of hit-neighbors.*/
129  void SeparateNeighbors();
130 
131  /* Method searches for hit-neighbors of each cell.*/
132  void FindHitNeighbors();
133 
134  ClassDef(PndSttCAData, 1);
135 };
136 
137 #endif /* PNDSttCADATA_H_ */
PndSttGeometryMap * GetGeometryMap() const
Definition: PndSttCAData.h:79
void GenerateNeighborhoodData()
std::map< int, std::vector< int > > GetHitNeighborsWithoutSkewed() const
Definition: PndSttCAData.h:95
std::map< int, int > GetMapTubeIdToHit() const
Definition: PndSttCAData.h:83
PndSttStrawMap * GetStrawMap() const
Definition: PndSttCAData.h:77
std::map< int, FairLink > GetMapHitToFairLink() const
Definition: PndSttCAData.h:81
PndSttCAData(TClonesArray *fTubeArray)
virtual ~PndSttCAData()
Definition: PndSttCAData.h:39
unsigned int i
Definition: P4_F32vec4.h:33
void AddHits(TClonesArray *hits, TString branchName)
std::map< int, std::vector< int > > GetSeparationsWithoutEdges() const
Definition: PndSttCAData.h:93
std::map< int, TVector3 > GetMapTubeIdToPos() const
Definition: PndSttCAData.h:85
std::map< int, std::vector< int > > GetSeparationsWithoutSkewed() const
Definition: PndSttCAData.h:97
Bool_t GetAllowDoubleHits()
Definition: PndSttCAData.h:71
std::map< int, std::vector< int > > GetSeparations() const
Definition: PndSttCAData.h:89
int GetNumHits()
Definition: PndSttCAData.h:99
std::map< int, std::vector< int > > GetHitNeighbors() const
Definition: PndSttCAData.h:87
std::vector< FairHit * > GetHits() const
Definition: PndSttCAData.h:73
std::multimap< int, PndSttSkewedHit * > GetCombinedSkewedHits() const
Definition: PndSttCAData.h:75
void clear()
Definition: PndSttCAData.h:53
std::map< int, std::vector< int > > GetHitNeighborsWithoutEdges() const
Definition: PndSttCAData.h:91
int GetNumHitsWithoutDouble()
Definition: PndSttCAData.h:101
void PrintInfo()
void SetAllowDoubleHits(Bool_t value)
Definition: PndSttCAData.h:69