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

#include <MMT_Road.h>

Collaboration diagram for 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< std::shared_ptr< MMT_Hit > > &hits)
double avgSofXUV (const char type) const
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_Hitm_road_hits
double m_slopeXlow
double m_slopeXhigh
double m_slopeUlow
double m_slopeUhigh
double m_slopeVlow
double m_slopeVhigh
int m_iroadx
int m_iroadu
int m_iroadv
int m_xthr
int m_uvthr
char m_sector

Detailed Description

Definition at line 12 of file 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 8 of file MMT_Road.cxx.

11 :
12 m_iroadx(iroadx),
13 m_iroadu(iroadu != -1 ? iroadu : iroadx),
14 m_iroadv(iroadv != -1 ? iroadv : iroadx),
15 m_xthr(xthr),
16 m_uvthr(uvthr),
17 m_sector(sector)
18{
19 // Pre-calculate slopes
20 m_slopeXlow = roadSize*m_iroadx + 0.5 - DownX;
21 m_slopeXhigh = roadSize*(m_iroadx+1) + 0.5 + UpX;
22
23 m_slopeUlow = roadSize*m_iroadu + 0.5 - DownUV;
24 m_slopeUhigh = roadSize*(m_iroadu+1) + 0.5 + UpUV;
25
26 m_slopeVlow = roadSize*m_iroadv + 0.5 - DownUV;
27 m_slopeVhigh = roadSize*(m_iroadv+1) + 0.5 + UpUV;
28}
double m_slopeUlow
Definition MMT_Road.h:42
double m_slopeXhigh
Definition MMT_Road.h:42
int m_xthr
Definition MMT_Road.h:44
double m_slopeXlow
Definition MMT_Road.h:42
int m_iroadu
Definition MMT_Road.h:43
int m_iroadv
Definition MMT_Road.h:43
double m_slopeVlow
Definition MMT_Road.h:42
double m_slopeUhigh
Definition MMT_Road.h:42
double m_slopeVhigh
Definition MMT_Road.h:42
char m_sector
Definition MMT_Road.h:45
int m_uvthr
Definition MMT_Road.h:44
int m_iroadx
Definition MMT_Road.h:43

◆ ~MMT_Road()

MMT_Road::~MMT_Road ( )
default

Member Function Documentation

◆ addHits()

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

Definition at line 30 of file MMT_Road.cxx.

30 {
31 for (const auto &hit_i : hits) {
32 double slow, shigh;
33 if (hit_i->isX()) {
34 slow = hit_i->getShift() + m_slopeXlow * hit_i->getPitchOverZ();
35 shigh = hit_i->getShift() + m_slopeXhigh * hit_i->getPitchOverZ();
36 }
37 else if (hit_i->isU()) {
38 slow = hit_i->getShift() + m_slopeUlow * hit_i->getPitchOverZ();
39 shigh = hit_i->getShift() + m_slopeUhigh * hit_i->getPitchOverZ();
40 }
41 else {
42 slow = hit_i->getShift() + m_slopeVlow * hit_i->getPitchOverZ();
43 shigh = hit_i->getShift() + m_slopeVhigh * hit_i->getPitchOverZ();
44 }
45
46 const double val = hit_i->getRZSlope();
47 bool has_hit = (val > 0.) ? (val > slow && val < shigh) : (val > shigh && val < slow);
48 if (!has_hit) continue;
49
50 const int pl = hit_i->getPlane();
51 if (std::ranges::any_of(m_road_hits, [&pl](const auto &hit) { return (hit.getPlane() == pl); })) continue;
52
53 m_road_hits.emplace_back(*hit_i.get());
54 m_road_hits.back().setAge(0);
55 }
56}
bool hit(const Container &ids, int pdgId)
std::vector< MMT_Hit > m_road_hits
Definition MMT_Road.h:41

◆ avgSofXUV()

double MMT_Road::avgSofXUV ( const char type) const

Definition at line 58 of file MMT_Road.cxx.

58 {
59 double sum = 0;
60 unsigned short int N = 0;
61 for (const auto &hit : m_road_hits) {
62 if (hit.isX() && type == 'X') {
63 sum += hit.getRZSlope();
64 ++N;
65 }
66 else if (hit.isU() && type == 'U') {
67 sum += hit.getRZSlope();
68 ++N;
69 }
70 else if (hit.isV() && type == 'V') {
71 sum += hit.getRZSlope();
72 ++N;
73 }
74 else continue;
75 }
76 if (N == 0)[[unlikely]]{
77 throw std::runtime_error("MMT_Road::avgSofXUV: N is zero.");
78 }
79 return sum/N;
80}
constexpr std::size_t N
#define unlikely(x)

◆ checkCoincidences()

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

Definition at line 20 of file MMT_Road.h.

20 {
21 return horizontalCheck() && stereoCheck() && matureCheck(bcwind);
22 }
bool stereoCheck() const
Definition MMT_Road.cxx:144
bool matureCheck(const int bcwind) const
Definition MMT_Road.cxx:121
bool horizontalCheck() const
Definition MMT_Road.cxx:101

◆ countHits()

unsigned int MMT_Road::countHits ( ) const
inline

Definition at line 23 of file MMT_Road.h.

23{ return m_road_hits.size(); }

◆ countUHits()

unsigned int MMT_Road::countUHits ( ) const

Definition at line 82 of file MMT_Road.cxx.

82 {
83 return std::count_if(m_road_hits.begin(), m_road_hits.end(),
84 [](const auto& hit) { return hit.isU(); });
85}

◆ countXHits()

unsigned int MMT_Road::countXHits ( ) const

Definition at line 87 of file MMT_Road.cxx.

87 {
88 return std::count_if(m_road_hits.begin(), m_road_hits.end(),
89 [](const auto& hit) { return hit.isX(); });
90}

◆ evaluateLowRes()

bool MMT_Road::evaluateLowRes ( ) const

Definition at line 92 of file MMT_Road.cxx.

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

◆ getHitVector()

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

Definition at line 29 of file MMT_Road.h.

29{ return m_road_hits; }

◆ getSector()

char MMT_Road::getSector ( ) const
inline

Definition at line 30 of file MMT_Road.h.

30{ return m_sector; }

◆ getUVthreshold()

int MMT_Road::getUVthreshold ( ) const
inline

Definition at line 32 of file MMT_Road.h.

32{ return m_uvthr; }

◆ getXthreshold()

int MMT_Road::getXthreshold ( ) const
inline

Definition at line 31 of file MMT_Road.h.

31{ return m_xthr; }

◆ horizontalCheck()

bool MMT_Road::horizontalCheck ( ) const

Definition at line 101 of file MMT_Road.cxx.

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

◆ incrementAge()

void MMT_Road::incrementAge ( const int bcwind)

Definition at line 112 of file MMT_Road.cxx.

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

◆ iRoadu()

int MMT_Road::iRoadu ( ) const
inline

Definition at line 34 of file MMT_Road.h.

34{ return m_iroadu; }

◆ iRoadv()

int MMT_Road::iRoadv ( ) const
inline

Definition at line 35 of file MMT_Road.h.

35{ return m_iroadv; }

◆ iRoadx()

int MMT_Road::iRoadx ( ) const
inline

Definition at line 33 of file MMT_Road.h.

33{ return m_iroadx; }

◆ matureCheck()

bool MMT_Road::matureCheck ( const int bcwind) const

Definition at line 121 of file MMT_Road.cxx.

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

◆ mxl()

double MMT_Road::mxl ( ) const

Definition at line 128 of file MMT_Road.cxx.

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

◆ stereoCheck()

bool MMT_Road::stereoCheck ( ) const

Definition at line 144 of file MMT_Road.cxx.

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

Member Data Documentation

◆ m_iroadu

int MMT_Road::m_iroadu
private

Definition at line 43 of file MMT_Road.h.

◆ m_iroadv

int MMT_Road::m_iroadv
private

Definition at line 43 of file MMT_Road.h.

◆ m_iroadx

int MMT_Road::m_iroadx
private

Definition at line 43 of file MMT_Road.h.

◆ m_road_hits

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

Definition at line 41 of file MMT_Road.h.

◆ m_sector

char MMT_Road::m_sector
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeUhigh

double MMT_Road::m_slopeUhigh
private

Definition at line 42 of file MMT_Road.h.

◆ m_slopeUlow

double MMT_Road::m_slopeUlow
private

Definition at line 42 of file MMT_Road.h.

◆ m_slopeVhigh

double MMT_Road::m_slopeVhigh
private

Definition at line 42 of file MMT_Road.h.

◆ m_slopeVlow

double MMT_Road::m_slopeVlow
private

Definition at line 42 of file MMT_Road.h.

◆ m_slopeXhigh

double MMT_Road::m_slopeXhigh
private

Definition at line 42 of file MMT_Road.h.

◆ m_slopeXlow

double MMT_Road::m_slopeXlow
private

Definition at line 42 of file MMT_Road.h.

◆ m_uvthr

int MMT_Road::m_uvthr
private

Definition at line 44 of file MMT_Road.h.

◆ m_xthr

int MMT_Road::m_xthr
private

Definition at line 44 of file MMT_Road.h.


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