ATLAS Offline Software
FPGATrackSimRoad.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimROAD_H
4 #define TRIGFPGATrackSimOBJECTS_FPGATrackSimROAD_H
5 
17 #include <vector>
18 #include <unordered_set>
19 #include <ostream>
20 #include <memory>
21 
22 #include "TObject.h"
23 
27 
28 
30 {
31 public:
32 
34  // Constructors
35 
36  FPGATrackSimRoad() = default;
37 
38  FPGATrackSimRoad(unsigned nLayers) : m_hits_trans(nLayers) { }
39 
40  FPGATrackSimRoad(int roadID, pid_t pid, sector_t sector, layer_bitmask_t hit_layers,
41  layer_bitmask_t wildcard_layers, std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>> && hits)
42  : m_roadID(roadID), m_pid(pid), m_sector(sector), m_hit_layers(hit_layers), m_wildcard_layers(wildcard_layers)/* , m_hits_trans(hits) */
43  {
44  setHits(std::move(hits));
45  }
46  //Move operators
48  FPGATrackSimRoad& operator=(FPGATrackSimRoad&&) noexcept = default;
49  //Copy operators
52  virtual ~FPGATrackSimRoad() = default;
53 
55  // Setters
56 
57  void setRoadID(int roadID) { m_roadID = roadID; }
58  void setPID(pid_t pid) { m_pid = pid; }
59  void setSector(sector_t sector) { m_sector = sector; }
60  void setSectorBin(int sectorbin) { m_sectorbin = sectorbin; }
61 
62  void setHitLayers(layer_bitmask_t hit_layers) { m_hit_layers = hit_layers; }
63  void setWCLayers(layer_bitmask_t wc_layers) { m_wildcard_layers = wc_layers; }
64 
65  void setNLayers(unsigned layers) { m_hits_trans.resize(layers); m_hits.resize(layers); }
66  void setHits(std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>> &&hits);
67  void setHits(unsigned layer, std::vector<std::shared_ptr<const FPGATrackSimHit>> && hits);
68 
69  void repopulateTransHits();
70 
71  void setEtaPatternID(int patternID) { m_etaPatternID = patternID; }
72 
73  void setSubRegion(int v) { m_subRegion = v; }
74  void setXBin(unsigned v) { m_xBin = v; }
75  void setYBin(unsigned v) { m_yBin = v; }
76  void setX(float v) { m_x = v; }
77  void setY(float v) { m_y = v; }
78 
79 
81  // Getters
82 
83  int getSubRegion() const { return m_subRegion; }
84  unsigned getXBin() const { return m_xBin; }
85  unsigned getYBin() const { return m_yBin; }
86  float getX() const { return m_x; }
87  float getY() const { return m_y; }
88 
89  int getRoadID() const { return m_roadID; }
90  pid_t getPID() const { return m_pid; }
91  sector_t getSector() const { return m_sector; }
92  int getSectorBin() const { return m_sectorbin; }
93 
96 
97  int getEtaPatternID() const { return m_etaPatternID; }
98 
99  const std::vector<std::shared_ptr<const FPGATrackSimHit>> &getHits(size_t layer) const { return m_hits_trans.at(layer); }
100 
101  std::unordered_set<std::shared_ptr<const FPGATrackSimHit>> getHits_flat() const;
102 
104  // Utility
105 
106  size_t getNLayers() const { return m_hits_trans.size(); }
107  size_t getNHitLayers() const { return __builtin_popcount(m_hit_layers); }
108  size_t getNWCLayers() const { return __builtin_popcount(m_wildcard_layers); }
109 
110  size_t getNHits() const;
111  std::vector<size_t> getNHits_layer() const;
112  size_t getNHitCombos() const;
113 
114  // Weight of each barcode is the fraction of layers with corresponding hits
115  // where pixels are weighted twice as much
117 
118 private:
119 
120  int m_roadID = 0; // Currently just a count set by RoadFinder.
121  pid_t m_pid = 0; // the pattern ID that fired this road
122  sector_t m_sector = 0; // Sector this road belongs to / should be fitted with
123  int m_sectorbin = -1; // The bin/ID of the sector that this road belongs to.
124 
125  layer_bitmask_t m_hit_layers = 0; // Layers that had hits match the pattern, not including wildcards
126  layer_bitmask_t m_wildcard_layers = 0; // Layers that matched because of a wildcard in the pattern
127 
128  // Eta pattern associated with the road.
129  int m_etaPatternID = -1;
130 
131  int m_subRegion = 0; // slice that the road came from
132  unsigned m_xBin = 0;
133  unsigned m_yBin = 0;
134  float m_x = 0; // x value of Hough bin
135  float m_y = 0; // y value of Hough bin
136 
137  std::vector<std::vector<FPGATrackSimHit>> m_hits; // [layer, hit#] (used for ROOT storing)
138  std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>> m_hits_trans;
139  // A list of hits in the road for each layer.
140  // These pointers are not owned by the road.
141 
142 
144  // Misc
145  friend std::ostream& operator<<(std::ostream& os, const FPGATrackSimRoad& road);
147 };
148 
149 #endif // FPGATrackSimROAD_H
150 
pid_t
int32_t pid_t
Definition: FPGATrackSimTypes.h:19
FPGATrackSimRoad::m_subRegion
int m_subRegion
Definition: FPGATrackSimRoad.h:131
FPGATrackSimRoad::getHitLayers
layer_bitmask_t getHitLayers() const
Definition: FPGATrackSimRoad.h:94
FPGATrackSimRoad::repopulateTransHits
void repopulateTransHits()
Definition: FPGATrackSimRoad.cxx:122
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
FPGATrackSimRoad::getTruth
FPGATrackSimMultiTruth getTruth() const
Definition: FPGATrackSimRoad.cxx:76
FPGATrackSimRoad::m_hits_trans
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > m_hits_trans
Definition: FPGATrackSimRoad.h:138
FPGATrackSimRoad::getSubRegion
int getSubRegion() const
Definition: FPGATrackSimRoad.h:83
FPGATrackSimRoad::getNWCLayers
size_t getNWCLayers() const
Definition: FPGATrackSimRoad.h:108
FPGATrackSimRoad::FPGATrackSimRoad
FPGATrackSimRoad(FPGATrackSimRoad &&) noexcept=default
FPGATrackSimRoad::getHits
const std::vector< std::shared_ptr< const FPGATrackSimHit > > & getHits(size_t layer) const
Definition: FPGATrackSimRoad.h:99
FPGATrackSimRoad::getRoadID
int getRoadID() const
Definition: FPGATrackSimRoad.h:89
FPGATrackSimRoad::m_xBin
unsigned m_xBin
Definition: FPGATrackSimRoad.h:132
FPGATrackSimRoad::getEtaPatternID
int getEtaPatternID() const
Definition: FPGATrackSimRoad.h:97
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
FPGATrackSimRoad::m_yBin
unsigned m_yBin
Definition: FPGATrackSimRoad.h:133
FPGATrackSimRoad::getSectorBin
int getSectorBin() const
Definition: FPGATrackSimRoad.h:92
FPGATrackSimMultiTruth.h
FPGATrackSimRoad::getNHitLayers
size_t getNHitLayers() const
Definition: FPGATrackSimRoad.h:107
FPGATrackSimRoad::m_pid
pid_t m_pid
Definition: FPGATrackSimRoad.h:121
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
FPGATrackSimRoad::m_wildcard_layers
layer_bitmask_t m_wildcard_layers
Definition: FPGATrackSimRoad.h:126
FPGATrackSimRoad::getNHits_layer
std::vector< size_t > getNHits_layer() const
Definition: FPGATrackSimRoad.cxx:27
FPGATrackSimRoad::getX
float getX() const
Definition: FPGATrackSimRoad.h:86
FPGATrackSimRoad::getNHits
size_t getNHits() const
Definition: FPGATrackSimRoad.cxx:20
FPGATrackSimRoad::m_x
float m_x
Definition: FPGATrackSimRoad.h:134
FPGATrackSimRoad::m_hit_layers
layer_bitmask_t m_hit_layers
Definition: FPGATrackSimRoad.h:125
FPGATrackSimRoad::m_y
float m_y
Definition: FPGATrackSimRoad.h:135
FPGATrackSimRoad::getHits_flat
std::unordered_set< std::shared_ptr< const FPGATrackSimHit > > getHits_flat() const
Definition: FPGATrackSimRoad.cxx:113
FPGATrackSimRoad::m_hits
std::vector< std::vector< FPGATrackSimHit > > m_hits
Definition: FPGATrackSimRoad.h:137
FPGATrackSimRoad::setPID
void setPID(pid_t pid)
Definition: FPGATrackSimRoad.h:58
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
FPGATrackSimRoad::getXBin
unsigned getXBin() const
Definition: FPGATrackSimRoad.h:84
FPGATrackSimRoad::setX
void setX(float v)
Definition: FPGATrackSimRoad.h:76
FPGATrackSimRoad::FPGATrackSimRoad
FPGATrackSimRoad()=default
FPGATrackSimRoad::setNLayers
void setNLayers(unsigned layers)
Definition: FPGATrackSimRoad.h:65
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
FPGATrackSimRoad::getYBin
unsigned getYBin() const
Definition: FPGATrackSimRoad.h:85
FPGATrackSimRoad::setSectorBin
void setSectorBin(int sectorbin)
Definition: FPGATrackSimRoad.h:60
sector_t
int32_t sector_t
Definition: FPGATrackSimTypes.h:21
FPGATrackSimRoad::operator<<
friend std::ostream & operator<<(std::ostream &os, const FPGATrackSimRoad &road)
(transient) [layer, hit#]
Definition: FPGATrackSimRoad.cxx:146
FPGATrackSimMultiTruth
Definition: FPGATrackSimMultiTruth.h:46
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
FPGATrackSimRoad::ClassDefNV
ClassDefNV(FPGATrackSimRoad, 6)
FPGATrackSimRoad::setSubRegion
void setSubRegion(int v)
Definition: FPGATrackSimRoad.h:73
FPGATrackSimRoad::getWCLayers
layer_bitmask_t getWCLayers() const
Definition: FPGATrackSimRoad.h:95
FPGATrackSimRoad::m_roadID
int m_roadID
Definition: FPGATrackSimRoad.h:120
FPGATrackSimRoad::FPGATrackSimRoad
FPGATrackSimRoad(unsigned nLayers)
Definition: FPGATrackSimRoad.h:38
FPGATrackSimRoad::getY
float getY() const
Definition: FPGATrackSimRoad.h:87
python.PyAthena.v
v
Definition: PyAthena.py:154
FPGATrackSimRoad::m_etaPatternID
int m_etaPatternID
Definition: FPGATrackSimRoad.h:129
FPGATrackSimRoad::setSector
void setSector(sector_t sector)
Definition: FPGATrackSimRoad.h:59
FPGATrackSimRoad::getNLayers
size_t getNLayers() const
Definition: FPGATrackSimRoad.h:106
layer_bitmask_t
uint32_t layer_bitmask_t
Definition: FPGATrackSimTypes.h:22
FPGATrackSimRoad::setYBin
void setYBin(unsigned v)
Definition: FPGATrackSimRoad.h:75
FPGATrackSimRoad::getNHitCombos
size_t getNHitCombos() const
Definition: FPGATrackSimRoad.cxx:35
FPGATrackSimRoad::getSector
sector_t getSector() const
Definition: FPGATrackSimRoad.h:91
FPGATrackSimRoad::setY
void setY(float v)
Definition: FPGATrackSimRoad.h:77
FPGATrackSimRoad::setRoadID
void setRoadID(int roadID)
Definition: FPGATrackSimRoad.h:57
FPGATrackSimRoad::setEtaPatternID
void setEtaPatternID(int patternID)
Definition: FPGATrackSimRoad.h:71
FPGATrackSimRoad::m_sectorbin
int m_sectorbin
Definition: FPGATrackSimRoad.h:123
FPGATrackSimRoad::getPID
pid_t getPID() const
Definition: FPGATrackSimRoad.h:90
FPGATrackSimRoad::setHitLayers
void setHitLayers(layer_bitmask_t hit_layers)
Definition: FPGATrackSimRoad.h:62
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
FPGATrackSimRoad::m_sector
sector_t m_sector
Definition: FPGATrackSimRoad.h:122
FPGATrackSimTypes.h
FPGATrackSimRoad::setHits
void setHits(std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit >>> &&hits)
Definition: FPGATrackSimRoad.cxx:139
FPGATrackSimRoad
Definition: FPGATrackSimRoad.h:30
FPGATrackSimRoad::setWCLayers
void setWCLayers(layer_bitmask_t wc_layers)
Definition: FPGATrackSimRoad.h:63
FPGATrackSimRoad::setXBin
void setXBin(unsigned v)
Definition: FPGATrackSimRoad.h:74
FPGATrackSimRoad::FPGATrackSimRoad
FPGATrackSimRoad(int roadID, pid_t pid, sector_t sector, layer_bitmask_t hit_layers, layer_bitmask_t wildcard_layers, std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit >>> &&hits)
Definition: FPGATrackSimRoad.h:40