ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 (std::vector< std::shared_ptr< MMT_Hit > > &hits)
 
double avgSofX () const
 
double avgSofUV (const int uv1, const int uv2) const
 
bool checkCoincidences (const int bcwind) const
 
unsigned int countHits () const
 
unsigned int countRealHits () const
 
unsigned int countUVHits (bool flag) const
 
unsigned int countXHits (bool flag) 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
 
void reset ()
 
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 }

◆ ~MMT_Road()

MMT_Road::~MMT_Road ( )
default

Member Function Documentation

◆ addHits()

void MMT_Road::addHits ( 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  if (m_sector != hit_i->getSector()) continue;
32 
33  double slow, shigh;
34  if (hit_i->isX()) {
35  slow = hit_i->getShift() + m_slopeXlow * hit_i->getPitchOverZ();
36  shigh = hit_i->getShift() + m_slopeXhigh * hit_i->getPitchOverZ();
37  }
38  else if (hit_i->isU()) {
39  slow = hit_i->getShift() + m_slopeUlow * hit_i->getPitchOverZ();
40  shigh = hit_i->getShift() + m_slopeUhigh * hit_i->getPitchOverZ();
41  }
42  else if (hit_i->isV()) {
43  slow = hit_i->getShift() + m_slopeVlow * hit_i->getPitchOverZ();
44  shigh = hit_i->getShift() + m_slopeVhigh * hit_i->getPitchOverZ();
45  }
46  else continue;
47 
48  const double val = hit_i->getRZSlope();
49  bool has_hit = (val > 0.) ? (val > slow && val < shigh) : (val > shigh && val < slow);
50 
51  if (!has_hit) continue;
52 
53  has_hit = false;
54  const int bo = hit_i->getPlane();
55  auto it = std::find_if(m_road_hits.begin(), m_road_hits.end(), [&bo](const auto &hit) { return (hit.getPlane() == bo); });
56  if (it != m_road_hits.end()) {
57  has_hit = true;
58  if (!hit_i->isNoise() && it->isNoise()) {
59  m_road_hits.erase(it);
60  has_hit = false;
61  }
62  }
63 
64  if (has_hit) continue;
65  m_road_hits.emplace_back(*hit_i.get());
66  m_road_hits.back().setAge(0);
67  }
68 }

◆ avgSofUV()

double MMT_Road::avgSofUV ( const int  uv1,
const int  uv2 
) const

Definition at line 82 of file MMT_Road.cxx.

82  {
83  double sum = 0;
84  int N = 0;
85  for (const auto &hit : m_road_hits) {
86  const int bo = hit.getPlane();
87  if (bo == uv1 || bo == uv2) {
88  sum += hit.getRZSlope();
89  ++N;
90  }
91  }
92  return sum/N;
93 }

◆ avgSofX()

double MMT_Road::avgSofX ( ) const

Definition at line 70 of file MMT_Road.cxx.

70  {
71  double sum = 0;
72  int N = 0;
73  for (const auto &hit : m_road_hits) {
74  if (hit.isX()) {
75  sum += hit.getRZSlope();
76  ++N;
77  }
78  }
79  return sum/N;
80 }

◆ checkCoincidences()

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

Definition at line 21 of file MMT_Road.h.

21  {
22  return horizontalCheck() && stereoCheck() && matureCheck(bcwind);
23  }

◆ countHits()

unsigned int MMT_Road::countHits ( ) const
inline

Definition at line 24 of file MMT_Road.h.

24 { return m_road_hits.size(); }

◆ countRealHits()

unsigned int MMT_Road::countRealHits ( ) const

Definition at line 95 of file MMT_Road.cxx.

95  {
96  return std::count_if(m_road_hits.begin(), m_road_hits.end(),
97  [&](auto& hit) { return hit.isNoise()==false; });
98 }

◆ countUVHits()

unsigned int MMT_Road::countUVHits ( bool  flag) const

Definition at line 100 of file MMT_Road.cxx.

100  {
101  return std::count_if(m_road_hits.begin(), m_road_hits.end(),
102  [&](auto& hit) { return (hit.isU() || hit.isV()) && hit.isNoise()==flag; });
103 }

◆ countXHits()

unsigned int MMT_Road::countXHits ( bool  flag) const

Definition at line 105 of file MMT_Road.cxx.

105  {
106  return std::count_if(m_road_hits.begin(), m_road_hits.end(),
107  [&](auto& hit) { return hit.isX() && hit.isNoise()==flag; });
108 }

◆ evaluateLowRes()

bool MMT_Road::evaluateLowRes ( ) const

Definition at line 110 of file MMT_Road.cxx.

110  {
111  unsigned int nhits1 = 0, nhits2 = 0;
112  for (const auto &hit : m_road_hits) {
113  nhits1 += hit.getPlane() < 4 && !hit.isNoise();
114  nhits2 += hit.getPlane() > 3 && !hit.isNoise();
115  }
116  return (nhits1 < 4 || nhits2 < 4);
117 }

◆ getHitVector()

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

Definition at line 31 of file MMT_Road.h.

31 { return m_road_hits; }

◆ getSector()

char MMT_Road::getSector ( ) const
inline

Definition at line 32 of file MMT_Road.h.

32 { return m_sector; }

◆ getUVthreshold()

int MMT_Road::getUVthreshold ( ) const
inline

Definition at line 34 of file MMT_Road.h.

34 { return m_uvthr; }

◆ getXthreshold()

int MMT_Road::getXthreshold ( ) const
inline

Definition at line 33 of file MMT_Road.h.

33 { return m_xthr; }

◆ horizontalCheck()

bool MMT_Road::horizontalCheck ( ) const

Definition at line 119 of file MMT_Road.cxx.

119  {
120  int nx1 = 0, nx2 = 0;
121  for (const auto &hit : m_road_hits) {
122  nx1 += hit.getPlane() >-1 && hit.getPlane() < 2;
123  nx2 += hit.getPlane() > 5 && hit.getPlane() < 8;
124 
125  if (nx1 > 0 && nx2 > 0 && (nx1+nx2) >= m_xthr) return true;
126  }
127  return false;
128 }

◆ incrementAge()

void MMT_Road::incrementAge ( const int  bcwind)

Definition at line 130 of file MMT_Road.cxx.

130  {
131  std::vector<unsigned int> old_ihits;
132  for (unsigned int j = 0; j < m_road_hits.size(); j++) {
133  m_road_hits[j].setAge(m_road_hits[j].getAge() +1);
134  if (m_road_hits[j].getAge() > (bcwind-1)) old_ihits.push_back(j);
135  }
136  for (int j = old_ihits.size()-1; j > -1; j--) m_road_hits.erase(m_road_hits.begin()+j);
137 }

◆ iRoadu()

int MMT_Road::iRoadu ( ) const
inline

Definition at line 36 of file MMT_Road.h.

36 { return m_iroadu; }

◆ iRoadv()

int MMT_Road::iRoadv ( ) const
inline

Definition at line 37 of file MMT_Road.h.

37 { return m_iroadv; }

◆ iRoadx()

int MMT_Road::iRoadx ( ) const
inline

Definition at line 35 of file MMT_Road.h.

35 { return m_iroadx; }

◆ matureCheck()

bool MMT_Road::matureCheck ( const int  bcwind) const

Definition at line 139 of file MMT_Road.cxx.

139  {
140  for (const auto &hit : m_road_hits) {
141  if (hit.getAge() == (bcwind - 1)) return true;
142  }
143  return false;
144 }

◆ mxl()

double MMT_Road::mxl ( ) const

Definition at line 146 of file MMT_Road.cxx.

146  {
147  std::vector<double> ys, zs;
148  for (const auto &hit : m_road_hits) {
149  if (hit.isX()) {
150  ys.push_back(hit.getR());
151  zs.push_back(hit.getZ());
152  }
153  }
154  double mxl = 0;
155  double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/(double)zs.size();
156  double sum_sq_z = std::inner_product(zs.begin(), zs.end(), zs.begin(), 0.0);
157  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)) );
158 
159  return mxl;
160 }

◆ reset()

void MMT_Road::reset ( )

Definition at line 162 of file MMT_Road.cxx.

162  {
163  m_road_hits.clear();
164 }

◆ stereoCheck()

bool MMT_Road::stereoCheck ( ) const

Definition at line 166 of file MMT_Road.cxx.

166  {
167 
168  if (m_uvthr == 0) return true;
169 
170  int nu = 0, nv = 0;
171  for (const auto &hit : m_road_hits) {
172  nu += hit.isU();
173  nv += hit.isV();
174 
175  if (nu > 0 && nv > 0 && (nu+nv) >= m_uvthr) return true;
176  }
177  return false;
178 }

Member Data Documentation

◆ m_iroadu

int MMT_Road::m_iroadu
private

Definition at line 46 of file MMT_Road.h.

◆ m_iroadv

int MMT_Road::m_iroadv
private

Definition at line 46 of file MMT_Road.h.

◆ m_iroadx

int MMT_Road::m_iroadx
private

Definition at line 46 of file MMT_Road.h.

◆ m_road_hits

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

Definition at line 44 of file MMT_Road.h.

◆ m_sector

char MMT_Road::m_sector
private

Definition at line 48 of file MMT_Road.h.

◆ m_slopeUhigh

double MMT_Road::m_slopeUhigh
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeUlow

double MMT_Road::m_slopeUlow
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeVhigh

double MMT_Road::m_slopeVhigh
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeVlow

double MMT_Road::m_slopeVlow
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeXhigh

double MMT_Road::m_slopeXhigh
private

Definition at line 45 of file MMT_Road.h.

◆ m_slopeXlow

double MMT_Road::m_slopeXlow
private

Definition at line 45 of file MMT_Road.h.

◆ m_uvthr

int MMT_Road::m_uvthr
private

Definition at line 47 of file MMT_Road.h.

◆ m_xthr

int MMT_Road::m_xthr
private

Definition at line 47 of file MMT_Road.h.


The documentation for this class was generated from the following files:
MMT_Road::stereoCheck
bool stereoCheck() const
Definition: MMT_Road.cxx:166
MMT_Road::mxl
double mxl() const
Definition: MMT_Road.cxx:146
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
MMT_Road::m_sector
char m_sector
Definition: MMT_Road.h:48
MMT_Road::m_uvthr
int m_uvthr
Definition: MMT_Road.h:47
skel.it
it
Definition: skel.GENtoEVGEN.py:407
MMT_Road::m_iroadx
int m_iroadx
Definition: MMT_Road.h:46
MMT_Road::m_slopeUhigh
double m_slopeUhigh
Definition: MMT_Road.h:45
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
MMT_Road::matureCheck
bool matureCheck(const int bcwind) const
Definition: MMT_Road.cxx:139
MMT_Road::m_slopeVlow
double m_slopeVlow
Definition: MMT_Road.h:45
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
MMT_Road::m_slopeXhigh
double m_slopeXhigh
Definition: MMT_Road.h:45
MMT_Road::m_xthr
int m_xthr
Definition: MMT_Road.h:47
MMT_Road::m_iroadv
int m_iroadv
Definition: MMT_Road.h:46
MMT_Road::horizontalCheck
bool horizontalCheck() const
Definition: MMT_Road.cxx:119
MMT_Road::m_road_hits
std::vector< MMT_Hit > m_road_hits
Definition: MMT_Road.h:44
runIDAlign.accumulate
accumulate
Update flags based on parser line args.
Definition: runIDAlign.py:107
MMT_Road::m_slopeUlow
double m_slopeUlow
Definition: MMT_Road.h:45
MMT_Road::m_slopeVhigh
double m_slopeVhigh
Definition: MMT_Road.h:45
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
MMT_Road::m_iroadu
int m_iroadu
Definition: MMT_Road.h:46
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
MMT_Road::m_slopeXlow
double m_slopeXlow
Definition: MMT_Road.h:45