ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
FPGATrackSimRoad Class Reference

#include <FPGATrackSimRoad.h>

Inheritance diagram for FPGATrackSimRoad:
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< const FPGATrackSimHit * >> const &hits)
 
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< const FPGATrackSimHit * >> const &hits)
 
void setHits (unsigned layer, std::vector< const FPGATrackSimHit * > const &hits)
 
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
 
std::vector< const FPGATrackSimHit * > constgetHits (size_t layer) const
 
std::unordered_set< 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

 ClassDef (FPGATrackSimRoad, 2)
 

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< const FPGATrackSimHit * > > m_hits
 

Friends

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

Detailed Description

Definition at line 28 of file FPGATrackSimRoad.h.

Constructor & Destructor Documentation

◆ FPGATrackSimRoad() [1/3]

FPGATrackSimRoad::FPGATrackSimRoad ( )
default

◆ FPGATrackSimRoad() [2/3]

FPGATrackSimRoad::FPGATrackSimRoad ( unsigned  nLayers)
inline

Definition at line 37 of file FPGATrackSimRoad.h.

37 : m_hits(nLayers) { }

◆ FPGATrackSimRoad() [3/3]

FPGATrackSimRoad::FPGATrackSimRoad ( int  roadID,
pid_t  pid,
sector_t  sector,
layer_bitmask_t  hit_layers,
layer_bitmask_t  wildcard_layers,
std::vector< std::vector< const FPGATrackSimHit * >> const hits 
)
inline

Definition at line 39 of file FPGATrackSimRoad.h.

41  : m_roadID(roadID), m_pid(pid), m_sector(sector), m_hit_layers(hit_layers), m_wildcard_layers(wildcard_layers), m_hits(hits)
42  { }

Member Function Documentation

◆ ClassDef()

FPGATrackSimRoad::ClassDef ( FPGATrackSimRoad  ,
 
)
private

◆ getEtaPatternID()

int FPGATrackSimRoad::getEtaPatternID ( ) const
inline

Definition at line 85 of file FPGATrackSimRoad.h.

85 { return m_etaPatternID; }

◆ getHitLayers()

layer_bitmask_t FPGATrackSimRoad::getHitLayers ( ) const
inline

Definition at line 82 of file FPGATrackSimRoad.h.

82 { return m_hit_layers; }

◆ getHits()

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

Definition at line 87 of file FPGATrackSimRoad.h.

87 { return m_hits.at(layer); }

◆ getHits_flat()

std::unordered_set<const FPGATrackSimHit*> FPGATrackSimRoad::getHits_flat ( ) const
inline

Definition at line 88 of file FPGATrackSimRoad.h.

89  {
90  std::unordered_set<const FPGATrackSimHit*> hits;
91  for (const auto& x : m_hits) hits.insert(x.begin(), x.end());
92  return hits;
93  }

◆ getNHitCombos()

size_t FPGATrackSimRoad::getNHitCombos ( ) const

Definition at line 32 of file FPGATrackSimRoad.cxx.

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

◆ getNHitLayers()

size_t FPGATrackSimRoad::getNHitLayers ( ) const
inline

Definition at line 99 of file FPGATrackSimRoad.h.

99 { return __builtin_popcount(m_hit_layers); }

◆ getNHits()

size_t FPGATrackSimRoad::getNHits ( ) const

Definition at line 18 of file FPGATrackSimRoad.cxx.

19 {
20  size_t n = 0;
21  for (const auto& l : m_hits) n += l.size();
22  return n;
23 }

◆ getNHits_layer()

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

Definition at line 25 of file FPGATrackSimRoad.cxx.

26 {
27  std::vector<size_t> out;
28  for (const auto& l : m_hits) out.push_back(l.size());
29  return out;
30 }

◆ getNLayers()

size_t FPGATrackSimRoad::getNLayers ( ) const
inline

Definition at line 98 of file FPGATrackSimRoad.h.

98 { return m_hits.size(); }

◆ getNWCLayers()

size_t FPGATrackSimRoad::getNWCLayers ( ) const
inline

Definition at line 100 of file FPGATrackSimRoad.h.

100 { return __builtin_popcount(m_wildcard_layers); }

◆ getPID()

pid_t FPGATrackSimRoad::getPID ( ) const
inline

Definition at line 78 of file FPGATrackSimRoad.h.

78 { return m_pid; }

◆ getRoadID()

int FPGATrackSimRoad::getRoadID ( ) const
inline

Definition at line 77 of file FPGATrackSimRoad.h.

77 { return m_roadID; }

◆ getSector()

sector_t FPGATrackSimRoad::getSector ( ) const
inline

Definition at line 79 of file FPGATrackSimRoad.h.

79 { return m_sector; }

◆ getSectorBin()

int FPGATrackSimRoad::getSectorBin ( ) const
inline

Definition at line 80 of file FPGATrackSimRoad.h.

80 { return m_sectorbin; }

◆ getSubRegion()

int FPGATrackSimRoad::getSubRegion ( ) const
inline

Definition at line 71 of file FPGATrackSimRoad.h.

71 { return m_subRegion; }

◆ getTruth()

FPGATrackSimMultiTruth FPGATrackSimRoad::getTruth ( ) const

Definition at line 73 of file FPGATrackSimRoad.cxx.

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

◆ getWCLayers()

layer_bitmask_t FPGATrackSimRoad::getWCLayers ( ) const
inline

Definition at line 83 of file FPGATrackSimRoad.h.

83 { return m_wildcard_layers; }

◆ getX()

float FPGATrackSimRoad::getX ( ) const
inline

Definition at line 74 of file FPGATrackSimRoad.h.

74 { return m_x; }

◆ getXBin()

unsigned FPGATrackSimRoad::getXBin ( ) const
inline

Definition at line 72 of file FPGATrackSimRoad.h.

72 { return m_xBin; }

◆ getY()

float FPGATrackSimRoad::getY ( ) const
inline

Definition at line 75 of file FPGATrackSimRoad.h.

75 { return m_y; }

◆ getYBin()

unsigned FPGATrackSimRoad::getYBin ( ) const
inline

Definition at line 73 of file FPGATrackSimRoad.h.

73 { return m_yBin; }

◆ setEtaPatternID()

void FPGATrackSimRoad::setEtaPatternID ( int  patternID)
inline

Definition at line 59 of file FPGATrackSimRoad.h.

59 { m_etaPatternID = patternID; }

◆ setHitLayers()

void FPGATrackSimRoad::setHitLayers ( layer_bitmask_t  hit_layers)
inline

Definition at line 53 of file FPGATrackSimRoad.h.

53 { m_hit_layers = hit_layers; }

◆ setHits() [1/2]

void FPGATrackSimRoad::setHits ( std::vector< std::vector< const FPGATrackSimHit * >> const hits)
inline

Definition at line 57 of file FPGATrackSimRoad.h.

57 { m_hits = hits; }

◆ setHits() [2/2]

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

Definition at line 58 of file FPGATrackSimRoad.h.

58 { m_hits.at(layer) = hits; } // ensure setNLayers is called first

◆ setNLayers()

void FPGATrackSimRoad::setNLayers ( unsigned  layers)
inline

Definition at line 56 of file FPGATrackSimRoad.h.

56 { m_hits.resize(layers); }

◆ setPID()

void FPGATrackSimRoad::setPID ( pid_t  pid)
inline

Definition at line 49 of file FPGATrackSimRoad.h.

49 { m_pid = pid; }

◆ setRoadID()

void FPGATrackSimRoad::setRoadID ( int  roadID)
inline

Definition at line 48 of file FPGATrackSimRoad.h.

48 { m_roadID = roadID; }

◆ setSector()

void FPGATrackSimRoad::setSector ( sector_t  sector)
inline

Definition at line 50 of file FPGATrackSimRoad.h.

50 { m_sector = sector; }

◆ setSectorBin()

void FPGATrackSimRoad::setSectorBin ( int  sectorbin)
inline

Definition at line 51 of file FPGATrackSimRoad.h.

51 { m_sectorbin = sectorbin; }

◆ setSubRegion()

void FPGATrackSimRoad::setSubRegion ( int  v)
inline

Definition at line 61 of file FPGATrackSimRoad.h.

61 { m_subRegion = v; }

◆ setWCLayers()

void FPGATrackSimRoad::setWCLayers ( layer_bitmask_t  wc_layers)
inline

Definition at line 54 of file FPGATrackSimRoad.h.

54 { m_wildcard_layers = wc_layers; }

◆ setX()

void FPGATrackSimRoad::setX ( float  v)
inline

Definition at line 64 of file FPGATrackSimRoad.h.

64 { m_x = v; }

◆ setXBin()

void FPGATrackSimRoad::setXBin ( unsigned  v)
inline

Definition at line 62 of file FPGATrackSimRoad.h.

62 { m_xBin = v; }

◆ setY()

void FPGATrackSimRoad::setY ( float  v)
inline

Definition at line 65 of file FPGATrackSimRoad.h.

65 { m_y = v; }

◆ setYBin()

void FPGATrackSimRoad::setYBin ( unsigned  v)
inline

Definition at line 63 of file FPGATrackSimRoad.h.

63 { m_yBin = v; }

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 109 of file FPGATrackSimRoad.cxx.

110 {
111  os << "road " << road.m_roadID
112  << ": PID " << road.m_pid
113  << ", sector " << road.m_sector
114  << " hitLayers " << std::showbase << std::hex << road.m_hit_layers
115  << " wcLayers " << std::showbase << std::hex << road.m_wildcard_layers
116  << ", nHits " << road.getNHits();
117  /*
118  for (size_t l=0; l < road.m_hits.size(); l++)
119  {
120  for (FPGATrackSimHit const * hit : road.m_hits[l])
121  os << "\n\t" << *hit;
122  }
123  */
124 
125  return os;
126 }

Member Data Documentation

◆ m_etaPatternID

int FPGATrackSimRoad::m_etaPatternID = -1
private

Definition at line 121 of file FPGATrackSimRoad.h.

◆ m_hit_layers

layer_bitmask_t FPGATrackSimRoad::m_hit_layers = 0
private

Definition at line 117 of file FPGATrackSimRoad.h.

◆ m_hits

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

Definition at line 129 of file FPGATrackSimRoad.h.

◆ m_pid

pid_t FPGATrackSimRoad::m_pid = 0
private

Definition at line 113 of file FPGATrackSimRoad.h.

◆ m_roadID

int FPGATrackSimRoad::m_roadID = 0
private

Definition at line 112 of file FPGATrackSimRoad.h.

◆ m_sector

sector_t FPGATrackSimRoad::m_sector = 0
private

Definition at line 114 of file FPGATrackSimRoad.h.

◆ m_sectorbin

int FPGATrackSimRoad::m_sectorbin = -1
private

Definition at line 115 of file FPGATrackSimRoad.h.

◆ m_subRegion

int FPGATrackSimRoad::m_subRegion = 0
private

Definition at line 123 of file FPGATrackSimRoad.h.

◆ m_wildcard_layers

layer_bitmask_t FPGATrackSimRoad::m_wildcard_layers = 0
private

Definition at line 118 of file FPGATrackSimRoad.h.

◆ m_x

float FPGATrackSimRoad::m_x = 0
private

Definition at line 126 of file FPGATrackSimRoad.h.

◆ m_xBin

unsigned FPGATrackSimRoad::m_xBin = 0
private

Definition at line 124 of file FPGATrackSimRoad.h.

◆ m_y

float FPGATrackSimRoad::m_y = 0
private

Definition at line 127 of file FPGATrackSimRoad.h.

◆ m_yBin

unsigned FPGATrackSimRoad::m_yBin = 0
private

Definition at line 125 of file FPGATrackSimRoad.h.


The documentation for this class was generated from the following files:
FPGATrackSimRoad::m_subRegion
int m_subRegion
Definition: FPGATrackSimRoad.h:123
FPGATrackSimRoad::m_xBin
unsigned m_xBin
Definition: FPGATrackSimRoad.h:124
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
FPGATrackSimRoad::m_yBin
unsigned m_yBin
Definition: FPGATrackSimRoad.h:125
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:113
x
#define x
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
FPGATrackSimRoad::m_wildcard_layers
layer_bitmask_t m_wildcard_layers
Definition: FPGATrackSimRoad.h:118
FPGATrackSimRoad::getNHits
size_t getNHits() const
Definition: FPGATrackSimRoad.cxx:18
FPGATrackSimRoad::m_x
float m_x
Definition: FPGATrackSimRoad.h:126
FPGATrackSimHit
Definition: FPGATrackSimHit.h:38
FPGATrackSimRoad::m_hit_layers
layer_bitmask_t m_hit_layers
Definition: FPGATrackSimRoad.h:117
FPGATrackSimRoad::m_y
float m_y
Definition: FPGATrackSimRoad.h:127
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:92
h
beamspotman.n
n
Definition: beamspotman.py:731
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FPGATrackSimMultiTruth::add
void add(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
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:112
python.PyAthena.v
v
Definition: PyAthena.py:157
FPGATrackSimRoad::m_etaPatternID
int m_etaPatternID
Definition: FPGATrackSimRoad.h:121
FPGATrackSimRoad::m_hits
std::vector< std::vector< const FPGATrackSimHit * > > m_hits
Definition: FPGATrackSimRoad.h:129
FPGATrackSimRoad::m_sectorbin
int m_sectorbin
Definition: FPGATrackSimRoad.h:115
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:114
fitman.k
k
Definition: fitman.py:528