ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::SpacePointMakerAlg::SpacePointStatistics Class Reference

Helper class to keep track of how many eta+phi, eta and phi only space points are built in various detector regions. More...

Collaboration diagram for MuonR4::SpacePointMakerAlg::SpacePointStatistics:

Classes

struct  StatField
 Helper struct to count the space-points in each detector category. More...
struct  FieldKey
 Helper struct to define the counting categories. More...

Public Member Functions

 SpacePointStatistics (const Muon::IMuonIdHelperSvc *idHelperSvc)
 Standard constructor.
void addToStat (const std::vector< SpacePoint > &spacePoints)
 Adds the vector of space points to the overall statistics.
void dumpStatisics (MsgStream &msg) const
 Print the statistics table of the built space points per category into the log-file / console.

Private Types

using StatMap_t = std::map<FieldKey, StatField>

Private Attributes

const Muon::IMuonIdHelperSvcm_idHelperSvc {}
std::mutex m_mutex {}
StatMap_t m_map {}

Detailed Description

Helper class to keep track of how many eta+phi, eta and phi only space points are built in various detector regions.

The SpacePointStatistics split the counts per muon station layer, i.e., BarrelInner, BarrelMiddle, EndCapInner, etc. are distinct categoriges. Each category is further subdivided into the indivudal stationEtas of the chambers and finally also into the technology type of the hit.

Definition at line 69 of file SpacePointMakerAlg.h.

Member Typedef Documentation

◆ StatMap_t

Constructor & Destructor Documentation

◆ SpacePointStatistics()

MuonR4::SpacePointMakerAlg::SpacePointStatistics::SpacePointStatistics ( const Muon::IMuonIdHelperSvc * idHelperSvc)

Standard constructor.

Parameters
idHelperSvcPointer to the MuonIdHelperSvc needed to sort each hit into a counting category.

Definition at line 149 of file SpacePointMakerAlg.cxx.

149 :
150 m_idHelperSvc{idHelperSvc}{}

Member Function Documentation

◆ addToStat()

void MuonR4::SpacePointMakerAlg::SpacePointStatistics::addToStat ( const std::vector< SpacePoint > & spacePoints)

Adds the vector of space points to the overall statistics.

Definition at line 152 of file SpacePointMakerAlg.cxx.

152 {
153 std::lock_guard guard{m_mutex};
154 for (const SpacePoint& sp : spacePoints){
155 FieldKey key{};
156 key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
157 key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
158 key.eta = m_idHelperSvc->stationEta(sp.identify());
160 if (sp.measuresEta() && sp.measuresPhi()) {
161 ++stats.measEtaPhi;
162 } else {
163 stats.measEta += sp.measuresEta();
164 stats.measPhi += sp.measuresPhi();
165 }
166 }
167}
static Double_t sp
Helper struct to define the counting categories.
Helper struct to count the space-points in each detector category.

◆ dumpStatisics()

void MuonR4::SpacePointMakerAlg::SpacePointStatistics::dumpStatisics ( MsgStream & msg) const

Print the statistics table of the built space points per category into the log-file / console.

Sort statistics from largest to smallest

Definition at line 168 of file SpacePointMakerAlg.cxx.

168 {
169 using KeyVal = std::pair<FieldKey, StatField>;
170 std::vector<KeyVal> sortedstats{};
171 sortedstats.reserve(m_map.size());
173 for (const auto & [key, stats] : m_map){
174 sortedstats.emplace_back(std::make_pair(key, stats));
175 }
176 std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
177 return a.second.allHits() > b.second.allHits();
178 });
179 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
180 for (const auto & [key, stats] : sortedstats) {
181 msg<<MSG::ALWAYS<<" "<<Muon::MuonStationIndex::technologyName(key.techIdx)
183 <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
184 <<" "<<std::setw(8)<<stats.measEtaPhi
185 <<" "<<std::setw(8)<<stats.measEta
186 <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
187 }
188 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
189
190}
#define endmsg
static Double_t a
const std::string & stName(StIndex index)
convert StIndex into a string
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.

Member Data Documentation

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_idHelperSvc {}
private

Definition at line 104 of file SpacePointMakerAlg.h.

104{};

◆ m_map

StatMap_t MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_map {}
private

Definition at line 107 of file SpacePointMakerAlg.h.

107{};

◆ m_mutex

std::mutex MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_mutex {}
private

Definition at line 105 of file SpacePointMakerAlg.h.

105{};

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