ATLAS Offline Software
Loading...
Searching...
No Matches
L1Muon::L1MM::MMT_Road Class Reference

One (X, U, V) road of the MM Diamond Road algorithm: collects the hits whose slope falls in its window, ages them out after the coincidence window, and checks the coincidence. More...

#include <MMT_Road.h>

Collaboration diagram for L1Muon::L1MM::MMT_Road:

Public Member Functions

 MMT_Road (const char sector, const int roadSize, const int UpX, const int DownX, const int UpUV, const int DownUV, const int xthr, const int uvthr, const int iroadx, const int iroadu=-1, const int iroadv=-1)
 ~MMT_Road ()=default
void addHits (const std::vector< const MMT_Hit * > &hits)
 Offer the hits of the current bunch crossing to the road (accepted hits are copied).
double avgSofXUV (const LayerType type) const
 Average R/Z slope of the hits of one layer type.
bool checkCoincidences (const int bcwind) const
unsigned int countHits () const
unsigned int countUHits () const
unsigned int countXHits () const
bool evaluateLowRes () const
bool horizontalCheck () const
void incrementAge (const int bcwind)
const std::vector< MMT_Hit > & getHitVector () const
char getSector () const
int getXthreshold () const
int getUVthreshold () const
int iRoadx () const
int iRoadu () const
int iRoadv () const
bool matureCheck (const int bcwind) const
double mxl () const
bool stereoCheck () const

Private Attributes

std::vector< MMT_Hit > m_road_hits
double m_slopeXlow {0.}
double m_slopeXhigh {0.}
double m_slopeUlow {0.}
double m_slopeUhigh {0.}
double m_slopeVlow {0.}
double m_slopeVhigh {0.}
int m_iroadx {-1}
int m_iroadu {-1}
int m_iroadv {-1}
int m_xthr {0}
int m_uvthr {0}
char m_sector {'-'}

Detailed Description

One (X, U, V) road of the MM Diamond Road algorithm: collects the hits whose slope falls in its window, ages them out after the coincidence window, and checks the coincidence.

Definition at line 20 of file Muon/L1MuonNSW/src/MMT_Road.h.

Constructor & Destructor Documentation

◆ MMT_Road()

MMT_Road::MMT_Road ( const char sector,
const int roadSize,
const int UpX,
const int DownX,
const int UpUV,
const int DownUV,
const int xthr,
const int uvthr,
const int iroadx,
const int iroadu = -1,
const int iroadv = -1 )

Definition at line 11 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

14 :
15 m_iroadx(iroadx),
16 m_iroadu(iroadu != -1 ? iroadu : iroadx),
17 m_iroadv(iroadv != -1 ? iroadv : iroadx),
18 m_xthr(xthr),
19 m_uvthr(uvthr),
20 m_sector(sector)
21{
22 // Pre-calculate slopes
23 m_slopeXlow = roadSize*m_iroadx + 0.5 - DownX;
24 m_slopeXhigh = roadSize*(m_iroadx+1) + 0.5 + UpX;
25
26 m_slopeUlow = roadSize*m_iroadu + 0.5 - DownUV;
27 m_slopeUhigh = roadSize*(m_iroadu+1) + 0.5 + UpUV;
28
29 m_slopeVlow = roadSize*m_iroadv + 0.5 - DownUV;
30 m_slopeVhigh = roadSize*(m_iroadv+1) + 0.5 + UpUV;
31}

◆ ~MMT_Road()

L1Muon::L1MM::MMT_Road::~MMT_Road ( )
default

Member Function Documentation

◆ addHits()

void MMT_Road::addHits ( const std::vector< const MMT_Hit * > & hits)

Offer the hits of the current bunch crossing to the road (accepted hits are copied).

Definition at line 33 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

33 {
34 for (const MMT_Hit* hit_i : hits) {
35 double low{0.}, high{0.};
36 switch (hit_i->getType()) {
37 case LayerType::X:
38 low = m_slopeXlow;
39 high = m_slopeXhigh;
40 break;
41 case LayerType::U:
42 low = m_slopeUlow;
43 high = m_slopeUhigh;
44 break;
45 case LayerType::V:
46 low = m_slopeVlow;
47 high = m_slopeVhigh;
48 break;
49 default:
50 continue;
51 }
52 const double slow = hit_i->getShift() + low * hit_i->getPitchOverZ();
53 const double shigh = hit_i->getShift() + high * hit_i->getPitchOverZ();
54
55 const double val = hit_i->getRZSlope();
56 bool has_hit = (val > 0.) ? (val > slow && val < shigh) : (val > shigh && val < slow);
57 if (!has_hit) continue;
58
59 const int pl = hit_i->getPlane();
60 if (std::ranges::any_of(m_road_hits, [&pl](const auto &hit) { return (hit.getPlane() == pl); })) continue;
61
62 m_road_hits.emplace_back(*hit_i);
63 m_road_hits.back().setAge(0);
64 }
65}
bool hit(const Container &ids, int pdgId)
std::vector< MMT_Hit > m_road_hits

◆ avgSofXUV()

double MMT_Road::avgSofXUV ( const LayerType type) const

Average R/Z slope of the hits of one layer type.

Definition at line 67 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

67 {
68 double sum = 0;
69 unsigned short int N = 0;
70 for (const auto &hit : m_road_hits) {
71 if (hit.getType() != type) continue;
72 sum += hit.getRZSlope();
73 ++N;
74 }
75 if (N == 0)[[unlikely]]{
76 throw std::runtime_error("MMT_Road::avgSofXUV: N is zero.");
77 }
78 return sum/N;
79}
constexpr std::size_t N
#define unlikely(x)

◆ checkCoincidences()

bool L1Muon::L1MM::MMT_Road::checkCoincidences ( const int bcwind) const
inline

Definition at line 30 of file Muon/L1MuonNSW/src/MMT_Road.h.

30 {
31 return horizontalCheck() && stereoCheck() && matureCheck(bcwind);
32 }
bool matureCheck(const int bcwind) const

◆ countHits()

unsigned int L1Muon::L1MM::MMT_Road::countHits ( ) const
inline

Definition at line 33 of file Muon/L1MuonNSW/src/MMT_Road.h.

33{ return m_road_hits.size(); }

◆ countUHits()

unsigned int MMT_Road::countUHits ( ) const

Definition at line 81 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

81 {
82 return std::ranges::count_if(m_road_hits, [](const auto& hit) { return hit.isU(); });
83}

◆ countXHits()

unsigned int MMT_Road::countXHits ( ) const

Definition at line 85 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

85 {
86 return std::ranges::count_if(m_road_hits, [](const auto& hit) { return hit.isX(); });
87}

◆ evaluateLowRes()

bool MMT_Road::evaluateLowRes ( ) const

Definition at line 89 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

89 {
90 unsigned short int nhits1 = 0, nhits2 = 0;
91 for (const auto &hit : m_road_hits) {
92 nhits1 += hit.getPlane() < 4;
93 nhits2 += hit.getPlane() > 3;
94 }
95 return (nhits1 < 4 || nhits2 < 4);
96}

◆ getHitVector()

const std::vector< MMT_Hit > & L1Muon::L1MM::MMT_Road::getHitVector ( ) const
inline

Definition at line 39 of file Muon/L1MuonNSW/src/MMT_Road.h.

39{ return m_road_hits; }

◆ getSector()

char L1Muon::L1MM::MMT_Road::getSector ( ) const
inline

Definition at line 40 of file Muon/L1MuonNSW/src/MMT_Road.h.

40{ return m_sector; }

◆ getUVthreshold()

int L1Muon::L1MM::MMT_Road::getUVthreshold ( ) const
inline

Definition at line 42 of file Muon/L1MuonNSW/src/MMT_Road.h.

42{ return m_uvthr; }

◆ getXthreshold()

int L1Muon::L1MM::MMT_Road::getXthreshold ( ) const
inline

Definition at line 41 of file Muon/L1MuonNSW/src/MMT_Road.h.

41{ return m_xthr; }

◆ horizontalCheck()

bool MMT_Road::horizontalCheck ( ) const

Definition at line 98 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

98 {
99 unsigned short int nx1 = 0, nx2 = 0;
100 for (const auto &hit : m_road_hits) {
101 nx1 += hit.getPlane() < 2;
102 nx2 += hit.getPlane() > 5;
103
104 if (nx1 > 0 && nx2 > 0 && (nx1+nx2) >= m_xthr) return true;
105 }
106 return false;
107}

◆ incrementAge()

void MMT_Road::incrementAge ( const int bcwind)

Definition at line 109 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

109 {
110 unsigned short int old_ihits = 0;
111 for (auto &hit : m_road_hits) {
112 hit.setAge(hit.getAge()+1);
113 if (hit.getAge() > (bcwind-1)) ++old_ihits;
114 }
115 m_road_hits.erase(m_road_hits.begin(), m_road_hits.begin()+old_ihits);
116}

◆ iRoadu()

int L1Muon::L1MM::MMT_Road::iRoadu ( ) const
inline

Definition at line 44 of file Muon/L1MuonNSW/src/MMT_Road.h.

44{ return m_iroadu; }

◆ iRoadv()

int L1Muon::L1MM::MMT_Road::iRoadv ( ) const
inline

Definition at line 45 of file Muon/L1MuonNSW/src/MMT_Road.h.

45{ return m_iroadv; }

◆ iRoadx()

int L1Muon::L1MM::MMT_Road::iRoadx ( ) const
inline

Definition at line 43 of file Muon/L1MuonNSW/src/MMT_Road.h.

43{ return m_iroadx; }

◆ matureCheck()

bool MMT_Road::matureCheck ( const int bcwind) const

Definition at line 118 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

118 {
119 for (const auto &hit : m_road_hits) {
120 if (hit.getAge() == (bcwind - 1)) return true;
121 }
122 return false;
123}

◆ mxl()

double MMT_Road::mxl ( ) const

Definition at line 125 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

125 {
126 std::vector<double> ys, zs;
127 for (const auto &hit : m_road_hits) {
128 if (hit.isX()) {
129 ys.push_back(hit.getR());
130 zs.push_back(hit.getZ());
131 }
132 }
133 double mxl = 0;
134 double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/static_cast<double>(zs.size());
135 double sum_sq_z = std::inner_product(zs.begin(), zs.end(), zs.begin(), 0.0);
136 for (unsigned int i = 0; i < ys.size(); i++) {
137 mxl += ys[i]*( (zs[i]-avg_z) / (sum_sq_z - zs.size()*std::pow(avg_z,2)) );
138 }
139
140 return mxl;
141}

◆ stereoCheck()

bool MMT_Road::stereoCheck ( ) const

Definition at line 143 of file Muon/L1MuonNSW/src/MMT_Road.cxx.

143 {
144 unsigned short int nu = 0, nv = 0;
145 for (const auto &hit : m_road_hits) {
146 nu += hit.isU();
147 nv += hit.isV();
148
149 if (nu > 0 && nv > 0 && (nu+nv) >= m_uvthr) return true;
150 }
151 return false;
152}

Member Data Documentation

◆ m_iroadu

int L1Muon::L1MM::MMT_Road::m_iroadu {-1}
private

Definition at line 59 of file Muon/L1MuonNSW/src/MMT_Road.h.

59{-1};

◆ m_iroadv

int L1Muon::L1MM::MMT_Road::m_iroadv {-1}
private

Definition at line 60 of file Muon/L1MuonNSW/src/MMT_Road.h.

60{-1};

◆ m_iroadx

int L1Muon::L1MM::MMT_Road::m_iroadx {-1}
private

Definition at line 58 of file Muon/L1MuonNSW/src/MMT_Road.h.

58{-1};

◆ m_road_hits

std::vector<MMT_Hit> L1Muon::L1MM::MMT_Road::m_road_hits
private

Definition at line 51 of file Muon/L1MuonNSW/src/MMT_Road.h.

◆ m_sector

char L1Muon::L1MM::MMT_Road::m_sector {'-'}
private

Definition at line 63 of file Muon/L1MuonNSW/src/MMT_Road.h.

63{'-'};

◆ m_slopeUhigh

double L1Muon::L1MM::MMT_Road::m_slopeUhigh {0.}
private

Definition at line 55 of file Muon/L1MuonNSW/src/MMT_Road.h.

55{0.};

◆ m_slopeUlow

double L1Muon::L1MM::MMT_Road::m_slopeUlow {0.}
private

Definition at line 54 of file Muon/L1MuonNSW/src/MMT_Road.h.

54{0.};

◆ m_slopeVhigh

double L1Muon::L1MM::MMT_Road::m_slopeVhigh {0.}
private

Definition at line 57 of file Muon/L1MuonNSW/src/MMT_Road.h.

57{0.};

◆ m_slopeVlow

double L1Muon::L1MM::MMT_Road::m_slopeVlow {0.}
private

Definition at line 56 of file Muon/L1MuonNSW/src/MMT_Road.h.

56{0.};

◆ m_slopeXhigh

double L1Muon::L1MM::MMT_Road::m_slopeXhigh {0.}
private

Definition at line 53 of file Muon/L1MuonNSW/src/MMT_Road.h.

53{0.};

◆ m_slopeXlow

double L1Muon::L1MM::MMT_Road::m_slopeXlow {0.}
private

Definition at line 52 of file Muon/L1MuonNSW/src/MMT_Road.h.

52{0.};

◆ m_uvthr

int L1Muon::L1MM::MMT_Road::m_uvthr {0}
private

Definition at line 62 of file Muon/L1MuonNSW/src/MMT_Road.h.

62{0};

◆ m_xthr

int L1Muon::L1MM::MMT_Road::m_xthr {0}
private

Definition at line 61 of file Muon/L1MuonNSW/src/MMT_Road.h.

61{0};

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