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

86 :
87 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 89 of file SpacePointMakerAlg.cxx.

89 {
90 std::lock_guard guard{m_mutex};
91 for (const SpacePoint& sp : spacePoints){
92 FieldKey key{};
93 key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
94 key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
95 key.eta = m_idHelperSvc->stationEta(sp.identify());
97 if (sp.measuresEta() && sp.measuresPhi()) {
98 ++stats.measEtaPhi;
99 } else {
100 stats.measEta += sp.measuresEta();
101 stats.measPhi += sp.measuresPhi();
102 }
103 }
104}
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 105 of file SpacePointMakerAlg.cxx.

105 {
106 using KeyVal = std::pair<FieldKey, StatField>;
107 std::vector<KeyVal> sortedstats{};
108 sortedstats.reserve(m_map.size());
110 for (const auto & [key, stats] : m_map){
111 sortedstats.emplace_back(std::make_pair(key, stats));
112 }
113 std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
114 return a.second.allHits() > b.second.allHits();
115 });
116 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
117 for (const auto & [key, stats] : sortedstats) {
118 msg<<MSG::ALWAYS<<" "<<Muon::MuonStationIndex::technologyName(key.techIdx)
120 <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
121 <<" "<<std::setw(8)<<stats.measEtaPhi
122 <<" "<<std::setw(8)<<stats.measEta
123 <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
124 }
125 msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
126
127}
#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 78 of file SpacePointMakerAlg.h.

78{};

◆ m_map

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

Definition at line 81 of file SpacePointMakerAlg.h.

81{};

◆ m_mutex

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

Definition at line 79 of file SpacePointMakerAlg.h.

79{};

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