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 7 of file MMT_Road.cxx.

10 :
11 m_iroadx(iroadx),
12 m_iroadu(iroadu != -1 ? iroadu : iroadx),
13 m_iroadv(iroadv != -1 ? iroadv : iroadx),
14 m_xthr(xthr),
15 m_uvthr(uvthr),
16 m_sector(sector)
17{
18 // Pre-calculate slopes
19 m_slopeXlow = roadSize*m_iroadx + 0.5 - DownX;
20 m_slopeXhigh = roadSize*(m_iroadx+1) + 0.5 + UpX;
21
22 m_slopeUlow = roadSize*m_iroadu + 0.5 - DownUV;
23 m_slopeUhigh = roadSize*(m_iroadu+1) + 0.5 + UpUV;
24
25 m_slopeVlow = roadSize*m_iroadv + 0.5 - DownUV;
26 m_slopeVhigh = roadSize*(m_iroadv+1) + 0.5 + UpUV;
27}
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 29 of file MMT_Road.cxx.

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

◆ avgSofXUV()

double MMT_Road::avgSofXUV ( const char type) const

Definition at line 57 of file MMT_Road.cxx.

57 {
58 double sum = 0;
59 unsigned short int N = 0;
60 for (const auto &hit : m_road_hits) {
61 if (hit.isX() && type == 'X') {
62 sum += hit.getRZSlope();
63 ++N;
64 }
65 else if (hit.isU() && type == 'U') {
66 sum += hit.getRZSlope();
67 ++N;
68 }
69 else if (hit.isV() && type == 'V') {
70 sum += hit.getRZSlope();
71 ++N;
72 }
73 else continue;
74 }
75 return sum/N;
76}

◆ 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:140
bool matureCheck(const int bcwind) const
Definition MMT_Road.cxx:117
bool horizontalCheck() const
Definition MMT_Road.cxx:97

◆ 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 78 of file MMT_Road.cxx.

78 {
79 return std::count_if(m_road_hits.begin(), m_road_hits.end(),
80 [](const auto& hit) { return hit.isU(); });
81}

◆ countXHits()

unsigned int MMT_Road::countXHits ( ) const

Definition at line 83 of file MMT_Road.cxx.

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

◆ evaluateLowRes()

bool MMT_Road::evaluateLowRes ( ) const

Definition at line 88 of file MMT_Road.cxx.

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

◆ 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 97 of file MMT_Road.cxx.

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

◆ incrementAge()

void MMT_Road::incrementAge ( const int bcwind)

Definition at line 108 of file MMT_Road.cxx.

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

◆ 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 117 of file MMT_Road.cxx.

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

◆ mxl()

double MMT_Road::mxl ( ) const

Definition at line 124 of file MMT_Road.cxx.

124 {
125 std::vector<double> ys, zs;
126 for (const auto &hit : m_road_hits) {
127 if (hit.isX()) {
128 ys.push_back(hit.getR());
129 zs.push_back(hit.getZ());
130 }
131 }
132 double mxl = 0;
133 double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/(double)zs.size();
134 double sum_sq_z = std::inner_product(zs.begin(), zs.end(), zs.begin(), 0.0);
135 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)) );
136
137 return mxl;
138}
double mxl() const
Definition MMT_Road.cxx:124

◆ stereoCheck()

bool MMT_Road::stereoCheck ( ) const

Definition at line 140 of file MMT_Road.cxx.

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

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: