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  FieldKey
 Helper struct to define the counting categories. More...
struct  StatField
 Helper struct to count the space-points in each detector category. 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 56 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 107 of file SpacePointMakerAlg.cxx.

107 :
108 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 110 of file SpacePointMakerAlg.cxx.

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

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

91{};

◆ m_map

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

Definition at line 94 of file SpacePointMakerAlg.h.

94{};

◆ m_mutex

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

Definition at line 92 of file SpacePointMakerAlg.h.

92{};

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