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
 
double avgZofUV (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< std::unique_ptr< MMT_Hit > > & getHitVector () const
 
int getRoadSize () const
 
int getRoadSizeUpX () const
 
int getRoadSizeDownX () const
 
int getRoadSizeUpUV () const
 
int getRoadSizeDownUV () 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

int m_iroadx
 
int m_iroadu
 
int m_iroadv
 
char m_sector
 
int m_xthr
 
int m_uvthr
 
int m_roadSize
 
int m_roadSizeUpX
 
int m_roadSizeDownX
 
int m_roadSizeUpUV
 
int m_roadSizeDownUV
 
std::vector< std::unique_ptr< MMT_Hit > > m_road_hits
 

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.

8  {
9  m_sector = sector;
10  m_iroadx = iroadx;
11  m_iroadu = (iroadu != -1) ? iroadu : iroadx;
12  m_iroadv = (iroadv != -1) ? iroadv : iroadx;
13  m_xthr = xthr;
14  m_uvthr = uvthr;
15 
16  m_roadSize = roadSize;
17  m_roadSizeUpX = UpX;
18  m_roadSizeDownX = DownX;
19  m_roadSizeUpUV = UpUV;
20  m_roadSizeDownUV = DownUV;
21 }

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

23  {
24  for (const auto &hit_i : hits) {
25  if (m_sector != hit_i->getSector()) continue;
26 
27  int iroad = 0;
28  unsigned short int olow = 0, ohigh = 0;
29  if (hit_i->isX()) {
30  iroad = m_iroadx;
31  olow = m_roadSizeDownX;
32  ohigh = m_roadSizeUpX;
33  }
34  else if (hit_i->isU()) {
35  iroad = m_iroadu;
36  olow = m_roadSizeDownUV;
37  ohigh = m_roadSizeUpUV;
38  }
39  else if (hit_i->isV()) {
40  iroad = m_iroadv;
41  olow = m_roadSizeDownUV;
42  ohigh = m_roadSizeUpUV;
43  }
44  else continue;
45 
46  double val = hit_i->getShift();
47  double slow = val + (m_roadSize*iroad + 0.5 - olow )*hit_i->getPitchOverZ();
48  double shigh = val + (m_roadSize*(iroad+1) + 0.5 + ohigh)*hit_i->getPitchOverZ();
49 
50  val = hit_i->getRZSlope();
51  bool has_hit = (val > 0.) ? (val > slow && val < shigh) : (val > shigh && val < slow);
52  if (!has_hit) continue;
53 
54  has_hit = false;
55  unsigned short int bo = hit_i->getPlane();
56  auto it = std::find_if(m_road_hits.begin(), m_road_hits.end(), [&bo](const auto &hit) { return (hit->getPlane() == bo); });
57  if (it != m_road_hits.end()) {
58  has_hit = true;
59  if (!hit_i->isNoise() && (*it)->isNoise()) {
60  m_road_hits.erase(it);
61  has_hit = false;
62  }
63  }
64 
65  if (has_hit) continue;
66  m_road_hits.emplace_back(std::make_unique<MMT_Hit>(hit_i.get()));
67  m_road_hits.back()->setAge(0);
68  }
69 }

◆ avgSofUV()

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

Definition at line 81 of file MMT_Road.cxx.

81  {
82  std::vector<double> sl;
83  for (const auto &hit : m_road_hits) {
84  int bo = hit->getPlane();
85  if (bo == uv1 || bo == uv2) sl.push_back(hit->getRZSlope());
86  }
87  double avg_uv = std::accumulate(sl.begin(), sl.end(), 0.0)/(double)sl.size();
88  return avg_uv;
89 }

◆ avgSofX()

double MMT_Road::avgSofX ( ) const

Definition at line 71 of file MMT_Road.cxx.

71  {
72  std::vector<double> sl;
73  for (const auto &hit : m_road_hits) {
74  int bo = hit->getPlane();
75  if (bo < 2 || bo > 5) sl.push_back(hit->getRZSlope());
76  }
77  double avg_x = std::accumulate(sl.begin(), sl.end(), 0.0)/(double)sl.size();
78  return avg_x;
79 }

◆ avgZofUV()

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

Definition at line 91 of file MMT_Road.cxx.

91  {
92  std::vector<double> zs;
93  for (const auto &hit : m_road_hits) {
94  int bo = hit->getPlane();
95  if (bo == uv1 || bo == uv2) zs.push_back(hit->getZ());
96  }
97  double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/(double)zs.size();
98  return avg_z;
99 }

◆ checkCoincidences()

bool MMT_Road::checkCoincidences ( const int  bcwind) const

Definition at line 101 of file MMT_Road.cxx.

101  {
102  bool passHorizontalCheck = this->horizontalCheck();
103  if (!passHorizontalCheck) return false;
104  bool passStereoCheck = this->stereoCheck();
105  if (!passStereoCheck) return false;
106  bool passMatureCheck = this->matureCheck(bcwind);
107  return (passHorizontalCheck && passStereoCheck && passMatureCheck);
108 }

◆ countHits()

unsigned int MMT_Road::countHits ( ) const
inline

Definition at line 23 of file MMT_Road.h.

23 { return m_road_hits.size(); }

◆ countRealHits()

unsigned int MMT_Road::countRealHits ( ) const

Definition at line 110 of file MMT_Road.cxx.

110  {
111  int nreal = 0;
112  for (const auto &hit : m_road_hits) {
113  if (hit->isNoise() == false) nreal++;
114  }
115  return nreal;
116 }

◆ countUVHits()

unsigned int MMT_Road::countUVHits ( bool  flag) const

Definition at line 118 of file MMT_Road.cxx.

118  {
119  unsigned int nuv = 0;
120  for (const auto &hit : m_road_hits) {
121  if (hit->getPlane() == 2 || hit->getPlane() == 4) {
122  if (hit->isNoise() == flag) nuv++;
123  }
124  if (hit->getPlane() == 3 || hit->getPlane() == 5) {
125  if (hit->isNoise() == flag) nuv++;
126  }
127  }
128  return nuv;
129 }

◆ countXHits()

unsigned int MMT_Road::countXHits ( bool  flag) const

Definition at line 131 of file MMT_Road.cxx.

131  {
132  unsigned int nx = 0;
133  for (const auto &hit : m_road_hits) {
134  if (hit->getPlane() < 2 || hit->getPlane() > 5) {
135  if (hit->isNoise() == flag) nx++;
136  }
137  }
138  return nx;
139 }

◆ evaluateLowRes()

bool MMT_Road::evaluateLowRes ( ) const

Definition at line 141 of file MMT_Road.cxx.

141  {
142  unsigned int nhits1 = 0, nhits2 = 0;
143  for (const auto &hit : m_road_hits) {
144  if (hit->getPlane() < 4 && !hit->isNoise()) nhits1++;
145  else if (hit->getPlane() > 3 && !hit->isNoise()) nhits2++;
146  }
147  return (nhits1 < 4 || nhits2 < 4);
148 }

◆ getHitVector()

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

Definition at line 30 of file MMT_Road.h.

30 { return m_road_hits; }

◆ getRoadSize()

int MMT_Road::getRoadSize ( ) const
inline

Definition at line 31 of file MMT_Road.h.

31 { return m_roadSize; }

◆ getRoadSizeDownUV()

int MMT_Road::getRoadSizeDownUV ( ) const
inline

Definition at line 35 of file MMT_Road.h.

35 { return m_roadSizeDownUV; }

◆ getRoadSizeDownX()

int MMT_Road::getRoadSizeDownX ( ) const
inline

Definition at line 33 of file MMT_Road.h.

33 { return m_roadSizeDownX; }

◆ getRoadSizeUpUV()

int MMT_Road::getRoadSizeUpUV ( ) const
inline

Definition at line 34 of file MMT_Road.h.

34 { return m_roadSizeUpUV; }

◆ getRoadSizeUpX()

int MMT_Road::getRoadSizeUpX ( ) const
inline

Definition at line 32 of file MMT_Road.h.

32 { return m_roadSizeUpX; }

◆ getSector()

char MMT_Road::getSector ( ) const
inline

Definition at line 36 of file MMT_Road.h.

36 { return m_sector; }

◆ getUVthreshold()

int MMT_Road::getUVthreshold ( ) const
inline

Definition at line 38 of file MMT_Road.h.

38 { return m_uvthr; }

◆ getXthreshold()

int MMT_Road::getXthreshold ( ) const
inline

Definition at line 37 of file MMT_Road.h.

37 { return m_xthr; }

◆ horizontalCheck()

bool MMT_Road::horizontalCheck ( ) const

Definition at line 150 of file MMT_Road.cxx.

150  {
151  int nx1 = 0, nx2 = 0;
152  for (const auto &hit : m_road_hits) {
153  if (hit->getPlane() >-1 && hit->getPlane() < 2) nx1++;
154  if (hit->getPlane() > 5 && hit->getPlane() < 8) nx2++;
155  }
156  return (nx1 > 0 && nx2 > 0 && (nx1+nx2) >= m_xthr);
157 }

◆ incrementAge()

void MMT_Road::incrementAge ( const int  bcwind)

Definition at line 159 of file MMT_Road.cxx.

159  {
160  std::vector<unsigned int> old_ihits;
161  for (unsigned int j = 0; j < m_road_hits.size(); j++) {
162  m_road_hits[j]->setAge(m_road_hits[j]->getAge() +1);
163  if (m_road_hits[j]->getAge() > (bcwind-1)) old_ihits.push_back(j);
164  }
165  for (int j = old_ihits.size()-1; j > -1; j--) m_road_hits.erase(m_road_hits.begin()+j);
166 }

◆ iRoadu()

int MMT_Road::iRoadu ( ) const
inline

Definition at line 40 of file MMT_Road.h.

40 { return m_iroadu; }

◆ iRoadv()

int MMT_Road::iRoadv ( ) const
inline

Definition at line 41 of file MMT_Road.h.

41 { return m_iroadv; }

◆ iRoadx()

int MMT_Road::iRoadx ( ) const
inline

Definition at line 39 of file MMT_Road.h.

39 { return m_iroadx; }

◆ matureCheck()

bool MMT_Road::matureCheck ( const int  bcwind) const

Definition at line 168 of file MMT_Road.cxx.

168  {
169  for (const auto &hit : m_road_hits) {
170  if (hit->getAge() == (bcwind - 1)) return true;
171  }
172  return false;
173 }

◆ mxl()

double MMT_Road::mxl ( ) const

Definition at line 175 of file MMT_Road.cxx.

175  {
176  std::vector<double> ys, zs;
177  for (const auto &hit : m_road_hits) {
178  int bo = hit->getPlane();
179  if (bo < 2 || bo > 5) {
180  ys.push_back(hit->getR());
181  zs.push_back(hit->getZ());
182  }
183  }
184  double mxl = 0;
185  double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/(double)zs.size();
186  double sum_sq_z = std::inner_product(zs.begin(), zs.end(), zs.begin(), 0.0);
187  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)) );
188 
189  return mxl;
190 }

◆ reset()

void MMT_Road::reset ( )

Definition at line 192 of file MMT_Road.cxx.

192  {
193  if (!m_road_hits.empty()) m_road_hits.clear();
194 }

◆ stereoCheck()

bool MMT_Road::stereoCheck ( ) const

Definition at line 196 of file MMT_Road.cxx.

196  {
197 
198  if (this->getUVthreshold() == 0) return true;
199 
200  int nu = 0, nv = 0;
201  for (const auto &hit : m_road_hits) {
202  if (hit->getPlane() == 2 || hit->getPlane() == 4) nu++;
203  if (hit->getPlane() == 3 || hit->getPlane() == 5) nv++;
204  }
205 
206  return (nu > 0 && nv > 0 && (nu+nv) >= m_uvthr);
207 }

Member Data Documentation

◆ m_iroadu

int MMT_Road::m_iroadu
private

Definition at line 49 of file MMT_Road.h.

◆ m_iroadv

int MMT_Road::m_iroadv
private

Definition at line 50 of file MMT_Road.h.

◆ m_iroadx

int MMT_Road::m_iroadx
private

Definition at line 48 of file MMT_Road.h.

◆ m_road_hits

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

Definition at line 54 of file MMT_Road.h.

◆ m_roadSize

int MMT_Road::m_roadSize
private

Definition at line 53 of file MMT_Road.h.

◆ m_roadSizeDownUV

int MMT_Road::m_roadSizeDownUV
private

Definition at line 53 of file MMT_Road.h.

◆ m_roadSizeDownX

int MMT_Road::m_roadSizeDownX
private

Definition at line 53 of file MMT_Road.h.

◆ m_roadSizeUpUV

int MMT_Road::m_roadSizeUpUV
private

Definition at line 53 of file MMT_Road.h.

◆ m_roadSizeUpX

int MMT_Road::m_roadSizeUpX
private

Definition at line 53 of file MMT_Road.h.

◆ m_sector

char MMT_Road::m_sector
private

Definition at line 51 of file MMT_Road.h.

◆ m_uvthr

int MMT_Road::m_uvthr
private

Definition at line 52 of file MMT_Road.h.

◆ m_xthr

int MMT_Road::m_xthr
private

Definition at line 52 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:196
MMT_Road::mxl
double mxl() const
Definition: MMT_Road.cxx:175
MMT_Road::m_road_hits
std::vector< std::unique_ptr< MMT_Hit > > m_road_hits
Definition: MMT_Road.h:54
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
MMT_Road::m_sector
char m_sector
Definition: MMT_Road.h:51
MMT_Road::m_roadSize
int m_roadSize
Definition: MMT_Road.h:53
MMT_Road::m_uvthr
int m_uvthr
Definition: MMT_Road.h:52
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MMT_Road::m_iroadx
int m_iroadx
Definition: MMT_Road.h:48
MMT_Road::matureCheck
bool matureCheck(const int bcwind) const
Definition: MMT_Road.cxx:168
MMT_Road::m_roadSizeUpX
int m_roadSizeUpX
Definition: MMT_Road.h:53
lumiFormat.i
int i
Definition: lumiFormat.py:85
master.flag
bool flag
Definition: master.py:29
MMT_Road::m_roadSizeDownUV
int m_roadSizeDownUV
Definition: MMT_Road.h:53
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
MMT_Road::m_xthr
int m_xthr
Definition: MMT_Road.h:52
MMT_Road::m_roadSizeUpUV
int m_roadSizeUpUV
Definition: MMT_Road.h:53
MMT_Road::m_iroadv
int m_iroadv
Definition: MMT_Road.h:50
MMT_Road::horizontalCheck
bool horizontalCheck() const
Definition: MMT_Road.cxx:150
MMT_Road::m_roadSizeDownX
int m_roadSizeDownX
Definition: MMT_Road.h:53
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
MMT_Road::m_iroadu
int m_iroadu
Definition: MMT_Road.h:49
MMT_Road::getUVthreshold
int getUVthreshold() const
Definition: MMT_Road.h:38