ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimRoad Class Reference

#include <FPGATrackSimRoad.h>

Collaboration diagram for FPGATrackSimRoad:

Public Member Functions

 FPGATrackSimRoad ()=default
 FPGATrackSimRoad (unsigned nLayers)
 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)
 FPGATrackSimRoad (FPGATrackSimRoad &&) noexcept=default
FPGATrackSimRoadoperator= (FPGATrackSimRoad &&) noexcept=default
 FPGATrackSimRoad (const FPGATrackSimRoad &)=default
FPGATrackSimRoadoperator= (const FPGATrackSimRoad &)=default
virtual ~FPGATrackSimRoad ()=default
void setRoadID (int roadID)
void setPID (pid_t pid)
void setSector (sector_t sector)
void setSectorBin (int sectorbin)
void setHitLayers (layer_bitmask_t hit_layers)
void setWCLayers (layer_bitmask_t wc_layers)
void setNLayers (unsigned layers)
void setHits (std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > &&hits)
void setHits (unsigned layer, std::vector< std::shared_ptr< const FPGATrackSimHit > > &&hits)
void repopulateTransHits ()
void setEtaPatternID (int patternID)
void setSubRegion (int v)
void setXBin (unsigned v)
void setYBin (unsigned v)
void setX (float v)
void setY (float v)
void setFitParams (const FPGATrackSimTrackPars &v)
void setFitChi2 (double v)
void setFitChi2_2d (double chi2_phi, double chi2_eta)
int getSubRegion () const
unsigned getXBin () const
unsigned getYBin () const
float getX () const
float getY () const
int getRoadID () const
pid_t getPID () const
sector_t getSector () const
int getSectorBin () const
layer_bitmask_t getHitLayers () const
layer_bitmask_t getWCLayers () const
int getEtaPatternID () const
const std::vector< std::shared_ptr< const FPGATrackSimHit > > & getHits (size_t layer) const
const std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > & getAllHits () const
std::unordered_set< std::shared_ptr< const FPGATrackSimHit > > getHits_flat () const
const FPGATrackSimTrackParsgetFitParams () const
double getFitChi2 () const
double getFitChi2Phi () const
double getFitChi2Eta () const
size_t getNLayers () const
size_t getNHitLayers () const
size_t getNWCLayers () const
size_t getNHits () const
std::vector< size_t > getNHits_layer () const
size_t getNHitCombos () const
void setBinIdx (std::vector< unsigned > x)
const std::vector< unsigned > & getBinIdx () const
FPGATrackSimMultiTruth getTruth () const

Private Member Functions

 ClassDefNV (FPGATrackSimRoad, 8)

Private Attributes

int m_roadID = 0
pid_t m_pid = 0
sector_t m_sector = 0
int m_sectorbin = -1
layer_bitmask_t m_hit_layers = 0
layer_bitmask_t m_wildcard_layers = 0
int m_etaPatternID = -1
int m_subRegion = 0
unsigned m_xBin = 0
unsigned m_yBin = 0
float m_x = 0
float m_y = 0
FPGATrackSimTrackPars m_fitTrackPars
double m_fitChi2 = 0
double m_fitChi2_phi = 0
double m_fitChi2_eta = 0
std::vector< std::vector< FPGATrackSimHit > > m_hits
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > m_hits_trans
std::vector< unsigned > m_binIdx
 (transient) [layer, hit#]

Friends

std::ostream & operator<< (std::ostream &os, const FPGATrackSimRoad &road)

Detailed Description

Definition at line 30 of file FPGATrackSimRoad.h.

Constructor & Destructor Documentation

◆ FPGATrackSimRoad() [1/5]

FPGATrackSimRoad::FPGATrackSimRoad ( )
default

◆ FPGATrackSimRoad() [2/5]

FPGATrackSimRoad::FPGATrackSimRoad ( unsigned nLayers)
inline

Definition at line 39 of file FPGATrackSimRoad.h.

39: m_hits_trans(nLayers) { }
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > m_hits_trans

◆ FPGATrackSimRoad() [3/5]

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 )
inline

Definition at line 41 of file FPGATrackSimRoad.h.

43 : m_roadID(roadID), m_pid(pid), m_sector(sector), m_hit_layers(hit_layers), m_wildcard_layers(wildcard_layers)/* , m_hits_trans(hits) */
44 {
45 setHits(std::move(hits));
46 }
layer_bitmask_t m_wildcard_layers
layer_bitmask_t m_hit_layers
void setHits(std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > &&hits)

◆ FPGATrackSimRoad() [4/5]

FPGATrackSimRoad::FPGATrackSimRoad ( FPGATrackSimRoad && )
defaultnoexcept

◆ FPGATrackSimRoad() [5/5]

FPGATrackSimRoad::FPGATrackSimRoad ( const FPGATrackSimRoad & )
default

◆ ~FPGATrackSimRoad()

virtual FPGATrackSimRoad::~FPGATrackSimRoad ( )
virtualdefault

Member Function Documentation

◆ ClassDefNV()

FPGATrackSimRoad::ClassDefNV ( FPGATrackSimRoad ,
8  )
private

◆ getAllHits()

const std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > & FPGATrackSimRoad::getAllHits ( ) const
inline

Definition at line 104 of file FPGATrackSimRoad.h.

104{ return m_hits_trans; }

◆ getBinIdx()

const std::vector< unsigned > & FPGATrackSimRoad::getBinIdx ( ) const
inline

Definition at line 125 of file FPGATrackSimRoad.h.

125{ return m_binIdx; }
std::vector< unsigned > m_binIdx
(transient) [layer, hit#]

◆ getEtaPatternID()

int FPGATrackSimRoad::getEtaPatternID ( ) const
inline

Definition at line 101 of file FPGATrackSimRoad.h.

101{ return m_etaPatternID; }

◆ getFitChi2()

double FPGATrackSimRoad::getFitChi2 ( ) const
inline

Definition at line 108 of file FPGATrackSimRoad.h.

108{ return m_fitChi2; }

◆ getFitChi2Eta()

double FPGATrackSimRoad::getFitChi2Eta ( ) const
inline

Definition at line 110 of file FPGATrackSimRoad.h.

110{ return m_fitChi2_eta; }

◆ getFitChi2Phi()

double FPGATrackSimRoad::getFitChi2Phi ( ) const
inline

Definition at line 109 of file FPGATrackSimRoad.h.

109{ return m_fitChi2_phi; }

◆ getFitParams()

const FPGATrackSimTrackPars & FPGATrackSimRoad::getFitParams ( ) const
inline

Definition at line 107 of file FPGATrackSimRoad.h.

107{ return m_fitTrackPars; }
FPGATrackSimTrackPars m_fitTrackPars

◆ getHitLayers()

layer_bitmask_t FPGATrackSimRoad::getHitLayers ( ) const
inline

Definition at line 98 of file FPGATrackSimRoad.h.

98{ return m_hit_layers; }

◆ getHits()

const std::vector< std::shared_ptr< const FPGATrackSimHit > > & FPGATrackSimRoad::getHits ( size_t layer) const
inline

Definition at line 103 of file FPGATrackSimRoad.h.

103{ return m_hits_trans.at(layer); }

◆ getHits_flat()

std::unordered_set< std::shared_ptr< const FPGATrackSimHit > > FPGATrackSimRoad::getHits_flat ( ) const

Definition at line 113 of file FPGATrackSimRoad.cxx.

113 {
114 std::unordered_set<std::shared_ptr<const FPGATrackSimHit>> hits;
115 for (const auto& layerHits : m_hits_trans) {
116 for (auto const& hit : layerHits) {
117 hits.insert(hit);
118 }
119 }
120 return hits;
121}

◆ getNHitCombos()

size_t FPGATrackSimRoad::getNHitCombos ( ) const

Definition at line 35 of file FPGATrackSimRoad.cxx.

36{
37 size_t combos = 1;
38 size_t l = m_hits_trans.size();
39 std::vector<unsigned int> skipindices;
40
41 // figure out indices of outer layers of stereo layers, where inner layer is also present to not
42 // double count spacepoints
43 for (size_t i = 1; i < l; ++i) {
44 if (m_hits_trans[i - 1].size() > 0 && m_hits_trans[i].size() > 0) {
45 if ((m_hits_trans[i - 1][0]->isStrip() && m_hits_trans[i][0]->isStrip()) &&
46 (m_hits_trans[i - 1][0]->getPhysLayer() % 2 == 0) &&
47 (m_hits_trans[i][0]->getPhysLayer() - m_hits_trans[i - 1][0]->getPhysLayer() == 1)) {
48 skipindices.push_back(i);
49 ++i;
50 }
51 }
52 }
53
54 // calculate number of combinations
55 for (size_t i = 0; i < l; ++i) {
56 size_t n = 0;
57 for (size_t j = 0; j < m_hits_trans[i].size(); ++j) {
58 // extra handling of spacepoints in combination calculation
59 if (m_hits_trans[i][j]->getHitType() == HitType::spacepoint) {
60 bool skip = false;
61 size_t skipsize = skipindices.size();
62 for (size_t k = 0; k < skipsize; ++k)
63 if (i == skipindices[k]) skip = true;
64
65 if (skip) continue;
66 }
67 ++n;
68 }
69 if (n > 0) combos *= n;
70 }
71
72 return combos;
73}
l
Printing final latex table to .tex output file.

◆ getNHitLayers()

size_t FPGATrackSimRoad::getNHitLayers ( ) const
inline

Definition at line 116 of file FPGATrackSimRoad.h.

116{ return std::popcount(m_hit_layers); }

◆ getNHits()

size_t FPGATrackSimRoad::getNHits ( ) const

Definition at line 20 of file FPGATrackSimRoad.cxx.

21{
22 size_t n = 0;
23 for (const auto& l : m_hits_trans) n += l.size();
24 return n;
25}

◆ getNHits_layer()

std::vector< size_t > FPGATrackSimRoad::getNHits_layer ( ) const

Definition at line 27 of file FPGATrackSimRoad.cxx.

28{
29 std::vector<size_t> out;
30 out.reserve(m_hits_trans.size());
31 for (const auto& l : m_hits_trans) out.push_back(l.size());
32 return out;
33}

◆ getNLayers()

size_t FPGATrackSimRoad::getNLayers ( ) const
inline

Definition at line 115 of file FPGATrackSimRoad.h.

115{ return m_hits_trans.size(); }

◆ getNWCLayers()

size_t FPGATrackSimRoad::getNWCLayers ( ) const
inline

Definition at line 117 of file FPGATrackSimRoad.h.

117{ return std::popcount(m_wildcard_layers); }

◆ getPID()

pid_t FPGATrackSimRoad::getPID ( ) const
inline

Definition at line 94 of file FPGATrackSimRoad.h.

94{ return m_pid; }

◆ getRoadID()

int FPGATrackSimRoad::getRoadID ( ) const
inline

Definition at line 93 of file FPGATrackSimRoad.h.

93{ return m_roadID; }

◆ getSector()

sector_t FPGATrackSimRoad::getSector ( ) const
inline

Definition at line 95 of file FPGATrackSimRoad.h.

95{ return m_sector; }

◆ getSectorBin()

int FPGATrackSimRoad::getSectorBin ( ) const
inline

Definition at line 96 of file FPGATrackSimRoad.h.

96{ return m_sectorbin; }

◆ getSubRegion()

int FPGATrackSimRoad::getSubRegion ( ) const
inline

Definition at line 87 of file FPGATrackSimRoad.h.

87{ return m_subRegion; }

◆ getTruth()

FPGATrackSimMultiTruth FPGATrackSimRoad::getTruth ( ) const

Definition at line 76 of file FPGATrackSimRoad.cxx.

77{
78 // get number of pixel layers from hits. Assumes strips follow pixels,
79 // and all hits in a layer share the same det type
80 unsigned nPixel;
81 for (nPixel = 0; nPixel < m_hits_trans.size(); nPixel++)
82 if (!m_hits_trans[nPixel].empty() && m_hits_trans[nPixel].front()->isStrip())
83 break;
84
85 std::map<FPGATrackSimMultiTruth::Barcode, layer_bitmask_t> layer_map;
86
87 for (auto const& hits : m_hits_trans)
88 for (auto const &h : hits)
89 for (auto const& x : h->getTruth())
90 layer_map[x.first] |= (1 << h->getLayer());
91
92 FPGATrackSimMultiTruth mt;
93 for (auto const& x : layer_map)
94 {
95 int w = 0, n = 0;
96 for (unsigned i = 0; i < m_hits_trans.size(); i++)
97 {
98 if (!m_hits_trans[i].empty())
99 n += (i < nPixel) ? 2 : 1; // double weight pixels
100 if (x.second & (1 << i))
101 w += (i < nPixel) ? 2 : 1; // double weight pixels
102 }
103 if (n == 0){
104 throw std::range_error("divide by zero in FPGATrackSimRoad::getTruth");
105 }
106 mt.add(x.first, static_cast<float>(w) / n);
107 }
108
109 return mt;
110}
#define x
static const Attributes_t empty
void add(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)

◆ getWCLayers()

layer_bitmask_t FPGATrackSimRoad::getWCLayers ( ) const
inline

Definition at line 99 of file FPGATrackSimRoad.h.

99{ return m_wildcard_layers; }

◆ getX()

float FPGATrackSimRoad::getX ( ) const
inline

Definition at line 90 of file FPGATrackSimRoad.h.

90{ return m_x; }

◆ getXBin()

unsigned FPGATrackSimRoad::getXBin ( ) const
inline

Definition at line 88 of file FPGATrackSimRoad.h.

88{ return m_xBin; }

◆ getY()

float FPGATrackSimRoad::getY ( ) const
inline

Definition at line 91 of file FPGATrackSimRoad.h.

91{ return m_y; }

◆ getYBin()

unsigned FPGATrackSimRoad::getYBin ( ) const
inline

Definition at line 89 of file FPGATrackSimRoad.h.

89{ return m_yBin; }

◆ operator=() [1/2]

FPGATrackSimRoad & FPGATrackSimRoad::operator= ( const FPGATrackSimRoad & )
default

◆ operator=() [2/2]

FPGATrackSimRoad & FPGATrackSimRoad::operator= ( FPGATrackSimRoad && )
defaultnoexcept

◆ repopulateTransHits()

void FPGATrackSimRoad::repopulateTransHits ( )

Definition at line 123 of file FPGATrackSimRoad.cxx.

123 { // this is needed if trying to read the hits from the road in a stored output file, call this first, otherwise not in Athena
124 m_hits_trans.resize(m_hits.size());
125 for (unsigned ilayer = 0; ilayer < m_hits.size(); ilayer++) {
126 m_hits_trans[ilayer].resize(m_hits[ilayer].size());
127 for (unsigned ihit = 0; ihit < m_hits[ilayer].size(); ihit++) {
128 m_hits_trans[ilayer][ihit] = std::make_shared<const FPGATrackSimHit>(m_hits[ilayer][ihit]);
129 }
130 }
131}
std::vector< std::vector< FPGATrackSimHit > > m_hits

◆ setBinIdx()

void FPGATrackSimRoad::setBinIdx ( std::vector< unsigned > x)
inline

Definition at line 124 of file FPGATrackSimRoad.h.

124{ m_binIdx = std::move(x); }

◆ setEtaPatternID()

void FPGATrackSimRoad::setEtaPatternID ( int patternID)
inline

Definition at line 72 of file FPGATrackSimRoad.h.

72{ m_etaPatternID = patternID; }

◆ setFitChi2()

void FPGATrackSimRoad::setFitChi2 ( double v)
inline

Definition at line 81 of file FPGATrackSimRoad.h.

◆ setFitChi2_2d()

void FPGATrackSimRoad::setFitChi2_2d ( double chi2_phi,
double chi2_eta )
inline

Definition at line 82 of file FPGATrackSimRoad.h.

82{ m_fitChi2_phi = chi2_phi; m_fitChi2_eta = chi2_eta; }

◆ setFitParams()

void FPGATrackSimRoad::setFitParams ( const FPGATrackSimTrackPars & v)
inline

Definition at line 80 of file FPGATrackSimRoad.h.

80{ m_fitTrackPars = v; }

◆ setHitLayers()

void FPGATrackSimRoad::setHitLayers ( layer_bitmask_t hit_layers)
inline

Definition at line 63 of file FPGATrackSimRoad.h.

63{ m_hit_layers = hit_layers; }

◆ setHits() [1/2]

void FPGATrackSimRoad::setHits ( std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > && hits)

Definition at line 141 of file FPGATrackSimRoad.cxx.

141 {
142 if (hits.size() != m_hits_trans.size()) setNLayers(hits.size());
143 for (unsigned i = 0;i < hits.size();++i) {
144 setHits(i,std::move(hits[i]));
145 }
146}
void setNLayers(unsigned layers)

◆ setHits() [2/2]

void FPGATrackSimRoad::setHits ( unsigned layer,
std::vector< std::shared_ptr< const FPGATrackSimHit > > && hits )

Definition at line 133 of file FPGATrackSimRoad.cxx.

133 {
134 m_hits_trans[layer] = std::move(hits);
135 m_hits[layer].clear();
136 for (const auto& hit : m_hits_trans[layer]) {
137 m_hits[layer].push_back(*hit);
138 }
139} // ensure setNLayers is called first
@ layer
Definition HitInfo.h:79

◆ setNLayers()

void FPGATrackSimRoad::setNLayers ( unsigned layers)
inline

Definition at line 66 of file FPGATrackSimRoad.h.

66{ m_hits_trans.resize(layers); m_hits.resize(layers); }

◆ setPID()

void FPGATrackSimRoad::setPID ( pid_t pid)
inline

◆ setRoadID()

void FPGATrackSimRoad::setRoadID ( int roadID)
inline

Definition at line 58 of file FPGATrackSimRoad.h.

58{ m_roadID = roadID; }

◆ setSector()

void FPGATrackSimRoad::setSector ( sector_t sector)
inline

Definition at line 60 of file FPGATrackSimRoad.h.

60{ m_sector = sector; }

◆ setSectorBin()

void FPGATrackSimRoad::setSectorBin ( int sectorbin)
inline

Definition at line 61 of file FPGATrackSimRoad.h.

61{ m_sectorbin = sectorbin; }

◆ setSubRegion()

void FPGATrackSimRoad::setSubRegion ( int v)
inline

Definition at line 74 of file FPGATrackSimRoad.h.

74{ m_subRegion = v; }

◆ setWCLayers()

void FPGATrackSimRoad::setWCLayers ( layer_bitmask_t wc_layers)
inline

Definition at line 64 of file FPGATrackSimRoad.h.

64{ m_wildcard_layers = wc_layers; }

◆ setX()

void FPGATrackSimRoad::setX ( float v)
inline

Definition at line 77 of file FPGATrackSimRoad.h.

77{ m_x = v; }

◆ setXBin()

void FPGATrackSimRoad::setXBin ( unsigned v)
inline

Definition at line 75 of file FPGATrackSimRoad.h.

75{ m_xBin = v; }

◆ setY()

void FPGATrackSimRoad::setY ( float v)
inline

Definition at line 78 of file FPGATrackSimRoad.h.

78{ m_y = v; }

◆ setYBin()

void FPGATrackSimRoad::setYBin ( unsigned v)
inline

Definition at line 76 of file FPGATrackSimRoad.h.

76{ m_yBin = v; }

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const FPGATrackSimRoad & road )
friend

Definition at line 149 of file FPGATrackSimRoad.cxx.

150{
151 os << "road " << road.m_roadID
152 << ": PID " << road.m_pid
153 << ", sector " << road.m_sector
154 << " hitLayers " << std::showbase << std::hex << road.m_hit_layers
155 << " wcLayers " << std::showbase << std::hex << road.m_wildcard_layers
156 << ", nHits " << road.getNHits();
157 /*
158 for (size_t l=0; l < road.m_hits.size(); l++)
159 {
160 for (FPGATrackSimHit const * hit : road.m_hits[l])
161 os << "\n\t" << *hit;
162 }
163 */
164
165 return os;
166}
size_t getNHits() const

Member Data Documentation

◆ m_binIdx

std::vector<unsigned> FPGATrackSimRoad::m_binIdx
private

(transient) [layer, hit#]

Definition at line 161 of file FPGATrackSimRoad.h.

◆ m_etaPatternID

int FPGATrackSimRoad::m_etaPatternID = -1
private

Definition at line 142 of file FPGATrackSimRoad.h.

◆ m_fitChi2

double FPGATrackSimRoad::m_fitChi2 = 0
private

Definition at line 151 of file FPGATrackSimRoad.h.

◆ m_fitChi2_eta

double FPGATrackSimRoad::m_fitChi2_eta = 0
private

Definition at line 153 of file FPGATrackSimRoad.h.

◆ m_fitChi2_phi

double FPGATrackSimRoad::m_fitChi2_phi = 0
private

Definition at line 152 of file FPGATrackSimRoad.h.

◆ m_fitTrackPars

FPGATrackSimTrackPars FPGATrackSimRoad::m_fitTrackPars
private

Definition at line 150 of file FPGATrackSimRoad.h.

◆ m_hit_layers

layer_bitmask_t FPGATrackSimRoad::m_hit_layers = 0
private

Definition at line 138 of file FPGATrackSimRoad.h.

◆ m_hits

std::vector<std::vector<FPGATrackSimHit> > FPGATrackSimRoad::m_hits
private

Definition at line 155 of file FPGATrackSimRoad.h.

◆ m_hits_trans

std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit> > > FPGATrackSimRoad::m_hits_trans
private

Definition at line 156 of file FPGATrackSimRoad.h.

◆ m_pid

pid_t FPGATrackSimRoad::m_pid = 0
private

Definition at line 134 of file FPGATrackSimRoad.h.

◆ m_roadID

int FPGATrackSimRoad::m_roadID = 0
private

Definition at line 133 of file FPGATrackSimRoad.h.

◆ m_sector

sector_t FPGATrackSimRoad::m_sector = 0
private

Definition at line 135 of file FPGATrackSimRoad.h.

◆ m_sectorbin

int FPGATrackSimRoad::m_sectorbin = -1
private

Definition at line 136 of file FPGATrackSimRoad.h.

◆ m_subRegion

int FPGATrackSimRoad::m_subRegion = 0
private

Definition at line 144 of file FPGATrackSimRoad.h.

◆ m_wildcard_layers

layer_bitmask_t FPGATrackSimRoad::m_wildcard_layers = 0
private

Definition at line 139 of file FPGATrackSimRoad.h.

◆ m_x

float FPGATrackSimRoad::m_x = 0
private

Definition at line 147 of file FPGATrackSimRoad.h.

◆ m_xBin

unsigned FPGATrackSimRoad::m_xBin = 0
private

Definition at line 145 of file FPGATrackSimRoad.h.

◆ m_y

float FPGATrackSimRoad::m_y = 0
private

Definition at line 148 of file FPGATrackSimRoad.h.

◆ m_yBin

unsigned FPGATrackSimRoad::m_yBin = 0
private

Definition at line 146 of file FPGATrackSimRoad.h.


The documentation for this class was generated from the following files: