ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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)
 
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
 
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
 
FPGATrackSimMultiTruth getTruth () const
 

Private Member Functions

 ClassDefNV (FPGATrackSimRoad, 6)
 

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
 
std::vector< std::vector< FPGATrackSimHit > > m_hits
 
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > m_hits_trans
 

Friends

std::ostream & operator<< (std::ostream &os, const FPGATrackSimRoad &road)
 (transient) [layer, hit#] More...
 

Detailed Description

Definition at line 29 of file FPGATrackSimRoad.h.

Constructor & Destructor Documentation

◆ FPGATrackSimRoad() [1/5]

FPGATrackSimRoad::FPGATrackSimRoad ( )
default

◆ FPGATrackSimRoad() [2/5]

FPGATrackSimRoad::FPGATrackSimRoad ( unsigned  nLayers)
inline

Definition at line 38 of file FPGATrackSimRoad.h.

38 : m_hits_trans(nLayers) { }

◆ 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 40 of file FPGATrackSimRoad.h.

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  }

◆ 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  ,
 
)
private

◆ getAllHits()

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

Definition at line 100 of file FPGATrackSimRoad.h.

100 { return m_hits_trans; }

◆ getEtaPatternID()

int FPGATrackSimRoad::getEtaPatternID ( ) const
inline

Definition at line 97 of file FPGATrackSimRoad.h.

97 { return m_etaPatternID; }

◆ getHitLayers()

layer_bitmask_t FPGATrackSimRoad::getHitLayers ( ) const
inline

Definition at line 94 of file FPGATrackSimRoad.h.

94 { return m_hit_layers; }

◆ getHits()

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

Definition at line 99 of file FPGATrackSimRoad.h.

99 { 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  // for (const auto& x : m_hits) hits.insert(x.begin(), x.end());
119  return hits;
120 }

◆ 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 }

◆ getNHitLayers()

size_t FPGATrackSimRoad::getNHitLayers ( ) const
inline

Definition at line 107 of file FPGATrackSimRoad.h.

107 { return __builtin_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 106 of file FPGATrackSimRoad.h.

106 { return m_hits_trans.size(); }

◆ getNWCLayers()

size_t FPGATrackSimRoad::getNWCLayers ( ) const
inline

Definition at line 108 of file FPGATrackSimRoad.h.

108 { return __builtin_popcount(m_wildcard_layers); }

◆ getPID()

pid_t FPGATrackSimRoad::getPID ( ) const
inline

Definition at line 90 of file FPGATrackSimRoad.h.

90 { return m_pid; }

◆ getRoadID()

int FPGATrackSimRoad::getRoadID ( ) const
inline

Definition at line 89 of file FPGATrackSimRoad.h.

89 { return m_roadID; }

◆ getSector()

sector_t FPGATrackSimRoad::getSector ( ) const
inline

Definition at line 91 of file FPGATrackSimRoad.h.

91 { return m_sector; }

◆ getSectorBin()

int FPGATrackSimRoad::getSectorBin ( ) const
inline

Definition at line 92 of file FPGATrackSimRoad.h.

92 { return m_sectorbin; }

◆ getSubRegion()

int FPGATrackSimRoad::getSubRegion ( ) const
inline

Definition at line 83 of file FPGATrackSimRoad.h.

83 { 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 
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 }

◆ getWCLayers()

layer_bitmask_t FPGATrackSimRoad::getWCLayers ( ) const
inline

Definition at line 95 of file FPGATrackSimRoad.h.

95 { return m_wildcard_layers; }

◆ getX()

float FPGATrackSimRoad::getX ( ) const
inline

Definition at line 86 of file FPGATrackSimRoad.h.

86 { return m_x; }

◆ getXBin()

unsigned FPGATrackSimRoad::getXBin ( ) const
inline

Definition at line 84 of file FPGATrackSimRoad.h.

84 { return m_xBin; }

◆ getY()

float FPGATrackSimRoad::getY ( ) const
inline

Definition at line 87 of file FPGATrackSimRoad.h.

87 { return m_y; }

◆ getYBin()

unsigned FPGATrackSimRoad::getYBin ( ) const
inline

Definition at line 85 of file FPGATrackSimRoad.h.

85 { 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 122 of file FPGATrackSimRoad.cxx.

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

◆ setEtaPatternID()

void FPGATrackSimRoad::setEtaPatternID ( int  patternID)
inline

Definition at line 71 of file FPGATrackSimRoad.h.

71 { m_etaPatternID = patternID; }

◆ setHitLayers()

void FPGATrackSimRoad::setHitLayers ( layer_bitmask_t  hit_layers)
inline

Definition at line 62 of file FPGATrackSimRoad.h.

62 { m_hit_layers = hit_layers; }

◆ setHits() [1/2]

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

Definition at line 139 of file FPGATrackSimRoad.cxx.

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

◆ setHits() [2/2]

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

Definition at line 132 of file FPGATrackSimRoad.cxx.

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

◆ setNLayers()

void FPGATrackSimRoad::setNLayers ( unsigned  layers)
inline

Definition at line 65 of file FPGATrackSimRoad.h.

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

◆ setPID()

void FPGATrackSimRoad::setPID ( pid_t  pid)
inline

Definition at line 58 of file FPGATrackSimRoad.h.

58 { m_pid = pid; }

◆ setRoadID()

void FPGATrackSimRoad::setRoadID ( int  roadID)
inline

Definition at line 57 of file FPGATrackSimRoad.h.

57 { m_roadID = roadID; }

◆ setSector()

void FPGATrackSimRoad::setSector ( sector_t  sector)
inline

Definition at line 59 of file FPGATrackSimRoad.h.

59 { m_sector = sector; }

◆ setSectorBin()

void FPGATrackSimRoad::setSectorBin ( int  sectorbin)
inline

Definition at line 60 of file FPGATrackSimRoad.h.

60 { m_sectorbin = sectorbin; }

◆ setSubRegion()

void FPGATrackSimRoad::setSubRegion ( int  v)
inline

Definition at line 73 of file FPGATrackSimRoad.h.

73 { m_subRegion = v; }

◆ setWCLayers()

void FPGATrackSimRoad::setWCLayers ( layer_bitmask_t  wc_layers)
inline

Definition at line 63 of file FPGATrackSimRoad.h.

63 { m_wildcard_layers = wc_layers; }

◆ setX()

void FPGATrackSimRoad::setX ( float  v)
inline

Definition at line 76 of file FPGATrackSimRoad.h.

76 { m_x = v; }

◆ setXBin()

void FPGATrackSimRoad::setXBin ( unsigned  v)
inline

Definition at line 74 of file FPGATrackSimRoad.h.

74 { m_xBin = v; }

◆ setY()

void FPGATrackSimRoad::setY ( float  v)
inline

Definition at line 77 of file FPGATrackSimRoad.h.

77 { m_y = v; }

◆ setYBin()

void FPGATrackSimRoad::setYBin ( unsigned  v)
inline

Definition at line 75 of file FPGATrackSimRoad.h.

75 { m_yBin = v; }

Friends And Related Function Documentation

◆ operator<<

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

(transient) [layer, hit#]

Definition at line 146 of file FPGATrackSimRoad.cxx.

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

Member Data Documentation

◆ m_etaPatternID

int FPGATrackSimRoad::m_etaPatternID = -1
private

Definition at line 129 of file FPGATrackSimRoad.h.

◆ m_hit_layers

layer_bitmask_t FPGATrackSimRoad::m_hit_layers = 0
private

Definition at line 125 of file FPGATrackSimRoad.h.

◆ m_hits

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

Definition at line 137 of file FPGATrackSimRoad.h.

◆ m_hits_trans

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

Definition at line 138 of file FPGATrackSimRoad.h.

◆ m_pid

pid_t FPGATrackSimRoad::m_pid = 0
private

Definition at line 121 of file FPGATrackSimRoad.h.

◆ m_roadID

int FPGATrackSimRoad::m_roadID = 0
private

Definition at line 120 of file FPGATrackSimRoad.h.

◆ m_sector

sector_t FPGATrackSimRoad::m_sector = 0
private

Definition at line 122 of file FPGATrackSimRoad.h.

◆ m_sectorbin

int FPGATrackSimRoad::m_sectorbin = -1
private

Definition at line 123 of file FPGATrackSimRoad.h.

◆ m_subRegion

int FPGATrackSimRoad::m_subRegion = 0
private

Definition at line 131 of file FPGATrackSimRoad.h.

◆ m_wildcard_layers

layer_bitmask_t FPGATrackSimRoad::m_wildcard_layers = 0
private

Definition at line 126 of file FPGATrackSimRoad.h.

◆ m_x

float FPGATrackSimRoad::m_x = 0
private

Definition at line 134 of file FPGATrackSimRoad.h.

◆ m_xBin

unsigned FPGATrackSimRoad::m_xBin = 0
private

Definition at line 132 of file FPGATrackSimRoad.h.

◆ m_y

float FPGATrackSimRoad::m_y = 0
private

Definition at line 135 of file FPGATrackSimRoad.h.

◆ m_yBin

unsigned FPGATrackSimRoad::m_yBin = 0
private

Definition at line 133 of file FPGATrackSimRoad.h.


The documentation for this class was generated from the following files:
FPGATrackSimRoad::m_subRegion
int m_subRegion
Definition: FPGATrackSimRoad.h:131
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
FPGATrackSimRoad::m_hits_trans
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > m_hits_trans
Definition: FPGATrackSimRoad.h:138
FPGATrackSimRoad::m_xBin
unsigned m_xBin
Definition: FPGATrackSimRoad.h:132
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
FPGATrackSimRoad::m_yBin
unsigned m_yBin
Definition: FPGATrackSimRoad.h:133
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
HitType::spacepoint
@ spacepoint
FPGATrackSimRoad::m_pid
pid_t m_pid
Definition: FPGATrackSimRoad.h:121
x
#define x
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
FPGATrackSimRoad::m_wildcard_layers
layer_bitmask_t m_wildcard_layers
Definition: FPGATrackSimRoad.h:126
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
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
h
beamspotman.n
n
Definition: beamspotman.py:731
FPGATrackSimRoad::m_hits
std::vector< std::vector< FPGATrackSimHit > > m_hits
Definition: FPGATrackSimRoad.h:137
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FPGATrackSimMultiTruth::add
void add(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
Definition: FPGATrackSimMultiTruth.cxx:22
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
FPGATrackSimRoad::setNLayers
void setNLayers(unsigned layers)
Definition: FPGATrackSimRoad.h:65
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
dumpTgcDigiThreshold.isStrip
list isStrip
Definition: dumpTgcDigiThreshold.py:33
FPGATrackSimMultiTruth
Definition: FPGATrackSimMultiTruth.h:46
FPGATrackSimRoad::m_roadID
int m_roadID
Definition: FPGATrackSimRoad.h:120
python.PyAthena.v
v
Definition: PyAthena.py:154
FPGATrackSimRoad::m_etaPatternID
int m_etaPatternID
Definition: FPGATrackSimRoad.h:129
FPGATrackSimRoad::m_sectorbin
int m_sectorbin
Definition: FPGATrackSimRoad.h:123
skip
bool skip
Definition: TrigGlobEffCorrValidation.cxx:190
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
FPGATrackSimRoad::m_sector
sector_t m_sector
Definition: FPGATrackSimRoad.h:122
FPGATrackSimRoad::setHits
void setHits(std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit >>> &&hits)
Definition: FPGATrackSimRoad.cxx:139
fitman.k
k
Definition: fitman.py:528