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

109 :
110 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 112 of file SpacePointMakerAlg.cxx.

112 {
113 std::lock_guard guard{m_mutex};
114 for (const SpacePoint& sp : spacePoints){
115 FieldKey key{};
116 key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
117 key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
118 key.eta = m_idHelperSvc->stationEta(sp.identify());
120 if (sp.measuresEta() && sp.measuresPhi()) {
121 ++stats.measEtaPhi;
122 } else {
123 stats.measEta += sp.measuresEta();
124 stats.measPhi += sp.measuresPhi();
125 }
126 }
127}
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 128 of file SpacePointMakerAlg.cxx.

128 {
129 using KeyVal = std::pair<FieldKey, StatField>;
130 std::vector<KeyVal> sortedstats{};
131 sortedstats.reserve(m_map.size());
133 for (const auto & [key, stats] : m_map){
134 sortedstats.emplace_back(std::make_pair(key, stats));
135 }
136 std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
137 return a.second.allHits() > b.second.allHits();
138 });
139 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
140 for (const auto & [key, stats] : sortedstats) {
141 msg<<MSG::ALWAYS<<" "<<Muon::MuonStationIndex::technologyName(key.techIdx)
143 <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
144 <<" "<<std::setw(8)<<stats.measEtaPhi
145 <<" "<<std::setw(8)<<stats.measEta
146 <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
147 }
148 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
149
150}
#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: