From 05452da85576d1f18b59a9a3f82690c8ede4763a Mon Sep 17 00:00:00 2001 From: Francesco Giuseppe Gravili <francesco.giuseppe.gravili@cern.ch> Date: Mon, 23 Jan 2023 13:30:31 +0100 Subject: [PATCH] MM L1 Simulation - Private members instead of functions MM L1 Simulation - Private members instead of functions --- .../TrigT1NSWSimTools/MMT_Road.h | 3 +- .../TrigT1NSWSimTools/src/MMT_Diamond.cxx | 56 +++++-------------- .../TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx | 1 + .../TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx | 35 ++++++------ 4 files changed, 33 insertions(+), 62 deletions(-) diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Road.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Road.h index c8fda6792ee..8413ac014f2 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Road.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Road.h @@ -12,7 +12,7 @@ class MMT_Road { public: 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 float pitch, const float eta1, const float eta2, const int iroadx, const int iroadu = -1, const int iroadv = -1); + const double pitch, const double eta1, const double eta2, const int iroadx, const int iroadu = -1, const int iroadv = -1); ~MMT_Road()=default; void addHits(std::vector<std::shared_ptr<MMT_Hit> > &hits); @@ -28,7 +28,6 @@ class MMT_Road { bool evaluateLowRes() const; bool horizontalCheck() const; void incrementAge(const int &bcwind); - double getLowerBound(const int eta) const; double getPitch() const { return m_pitch; } const std::vector<std::unique_ptr<MMT_Hit> >& getHitVector() const { return m_road_hits; } int getRoadSize() const { return m_roadSize; } diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx index c09ac9936a0..1e6b1f0ee89 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx @@ -24,6 +24,7 @@ void MMT_Diamond::createRoads_fillHits(const unsigned int iterator, std::vector< entry.stationPhi = (par->getSector() == 'S') ? phi*2-1 : phi*2-2; std::string sector = (par->getSector() == 'L') ? "MML" : "MMS"; + const double pitch = par->getPitch(), eta1 = par->getLowerBoundEta1(), eta2 = par->getLowerBoundEta2(); /* * The following for-loop merges all plane global coordinates in one single shot: @@ -66,63 +67,36 @@ void MMT_Diamond::createRoads_fillHits(const unsigned int iterator, std::vector< entry.side = (std::all_of(entry.ev_hits.begin(), entry.ev_hits.end(), [] (const auto hit) { return hit->getStationEta() < 0; })) ? 'C' : 'A'; for (int i = 0; i < nroad; i++) { - auto myroad = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), i); + auto myroad = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i); entry.ev_roads.push_back(myroad); int nuv = (this->getUV()) ? this->getUVfactor() : 0; for (int uv = 1; uv <= nuv; uv++) { if (i-uv < 0) continue; - auto myroad_0 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i+uv, i-uv); + auto myroad_0 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i+uv, i-uv); entry.ev_roads.push_back(myroad_0); - auto myroad_1 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i-uv, i+uv); + auto myroad_1 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i-uv, i+uv); entry.ev_roads.push_back(myroad_1); - auto myroad_2 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i+uv-1, i-uv); + auto myroad_2 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i+uv-1, i-uv); entry.ev_roads.push_back(myroad_2); - auto myroad_3 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i-uv, i+uv-1); + auto myroad_3 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i-uv, i+uv-1); entry.ev_roads.push_back(myroad_3); - auto myroad_4 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i-uv+1, i+uv); + auto myroad_4 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i-uv+1, i+uv); entry.ev_roads.push_back(myroad_4); - auto myroad_5 = std::make_shared<MMT_Road>(par->getSector(), this->getRoadSize(), - this->getRoadSizeUpX(), this->getRoadSizeDownX(), - this->getRoadSizeUpUV(), this->getRoadSizeDownUV(), - this->getXthreshold(), this->getUVthreshold(), - par->getPitch(), par->getLowerBoundEta1(), par->getLowerBoundEta2(), - i, i+uv, i-uv+1); + auto myroad_5 = std::make_shared<MMT_Road>(sector[2], m_roadSize, m_roadSizeUpX, m_roadSizeDownX, m_roadSizeUpUV, m_roadSizeDownUV, + m_xthr, m_uvthr, pitch, eta1, eta2, i, i+uv, i-uv+1); entry.ev_roads.push_back(myroad_5); } } diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx index 24257cd8134..ebc346d7134 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx @@ -129,6 +129,7 @@ MMT_Hit::MMT_Hit(const MMT_Hit* hit) m_age (hit->m_age), m_Y (hit->m_Y), m_Z (hit->m_Z), + m_oneOverZ (hit->m_oneOverZ), m_R (hit->m_R), m_Ri (hit->m_Ri), m_isNoise (hit->m_isNoise), diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx index 447d98eb23c..eadb8d53fbf 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx @@ -5,7 +5,7 @@ #include "TrigT1NSWSimTools/MMT_Road.h" 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 float pitch, const float eta1, const float eta2, const int iroadx, const int iroadu, const int iroadv) { + const double pitch, const double eta1, const double eta2, const int iroadx, const int iroadu, const int iroadv) { m_sector = sector; m_iroad = iroadx; m_iroadx = iroadx; @@ -57,29 +57,30 @@ void MMT_Road::addHits(std::vector<std::shared_ptr<MMT_Hit> > &hits) { bool MMT_Road::containsNeighbors(const MMT_Hit* hit) const { - if (this->getSector() != hit->getSector()) return false; + if (m_sector != hit->getSector()) return false; int iroad = 0; unsigned short int olow = 0, ohigh = 0; if (hit->isX()) { - iroad = this->iRoadx(); - olow = this->getRoadSizeDownX(); - ohigh = this->getRoadSizeUpX(); + iroad = m_iroadx; + olow = m_roadSizeDownX; + ohigh = m_roadSizeUpX; } else if (hit->isU()) { - iroad = this->iRoadu(); - olow = this->getRoadSizeDownUV(); - ohigh = this->getRoadSizeUpUV(); + iroad = m_iroadu; + olow = m_roadSizeDownUV; + ohigh = m_roadSizeUpUV; } else if (hit->isV()) { - iroad = this->iRoadv(); - olow = this->getRoadSizeDownUV(); - ohigh = this->getRoadSizeUpUV(); + iroad = m_iroadv; + olow = m_roadSizeDownUV; + ohigh = m_roadSizeUpUV; } else return false; - double slow = (this->getLowerBound(hit->getStationEta()) + (this->getRoadSize()*iroad + 0.5 - olow )*this->getPitch() + hit->getShift())*hit->getOneOverZ(); - double shigh = (this->getLowerBound(hit->getStationEta()) + (this->getRoadSize()*(iroad+1) + 0.5 + ohigh)*this->getPitch() + hit->getShift())*hit->getOneOverZ(); + double R = (std::abs(hit->getStationEta()) == 1) ? m_innerRadiusEta1 : m_innerRadiusEta2; + double slow = (R + (m_roadSize*iroad + 0.5 - olow )*m_pitch + hit->getShift())*hit->getOneOverZ(); + double shigh = (R + (m_roadSize*(iroad+1) + 0.5 + ohigh)*m_pitch + hit->getShift())*hit->getOneOverZ(); if (hit->getRZSlope() > 0.) return (hit->getRZSlope() >= slow && hit->getRZSlope() < shigh); else return (hit->getRZSlope() >= shigh && hit->getRZSlope() < slow); @@ -162,17 +163,13 @@ bool MMT_Road::evaluateLowRes() const { return (nhits1 < 4 || nhits2 < 4); } -double MMT_Road::getLowerBound(const int eta) const { - return (std::abs(eta) == 1) ? m_innerRadiusEta1 : m_innerRadiusEta2; -} - bool MMT_Road::horizontalCheck() const { int nx1 = 0, nx2 = 0; for (const auto &hit : m_road_hits) { if (hit->getPlane() >-1 && hit->getPlane() < 2) nx1++; if (hit->getPlane() > 5 && hit->getPlane() < 8) nx2++; } - return (nx1 > 0 && nx2 > 0 && (nx1+nx2) >= this->getXthreshold()); + return (nx1 > 0 && nx2 > 0 && (nx1+nx2) >= m_xthr); } void MMT_Road::incrementAge(const int &bcwind) { @@ -222,5 +219,5 @@ bool MMT_Road::stereoCheck() const { if (hit->getPlane() == 3 || hit->getPlane() == 5) nv++; } - return (nu > 0 && nv > 0 && (nu+nv) >= this->getUVthreshold()); + return (nu > 0 && nv > 0 && (nu+nv) >= m_uvthr); } -- GitLab