ATLAS Offline Software
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
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. More...
 
void addToStat (const std::vector< SpacePoint > &spacePoints)
 Adds the vector of space points to the overall statistics. More...
 
void dumpStatisics (MsgStream &msg) const
 Print the statistics table of the built space points per category into the log-file / console. More...
 

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

Definition at line 80 of file SpacePointMakerAlg.h.

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

116  :
117  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 119 of file SpacePointMakerAlg.cxx.

119  {
120  std::lock_guard guard{m_mutex};
121  for (const SpacePoint& sp : spacePoints){
122  FieldKey key{};
123  key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
124  key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
125  key.eta = m_idHelperSvc->stationEta(sp.identify());
126  StatField & stats = m_map[key];
127  if (sp.measuresEta() && sp.measuresPhi()) {
128  ++stats.measEtaPhi;
129  } else {
130  stats.measEta += sp.measuresEta();
131  stats.measPhi += sp.measuresPhi();
132  }
133  }
134 }

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

135  {
136  using KeyVal = std::pair<FieldKey, StatField>;
137  std::vector<KeyVal> sortedstats{};
138  sortedstats.reserve(m_map.size());
140  for (const auto & [key, stats] : m_map){
141  sortedstats.emplace_back(std::make_pair(key, stats));
142  }
143  std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
144  return a.second.allHits() > b.second.allHits();
145  });
146  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
147  for (const auto & [key, stats] : sortedstats) {
149  <<" "<<Muon::MuonStationIndex::stName(key.stIdx)
150  <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
151  <<" "<<std::setw(8)<<stats.measEtaPhi
152  <<" "<<std::setw(8)<<stats.measEta
153  <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
154  }
155  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
156 
157 }

Member Data Documentation

◆ m_idHelperSvc

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

Definition at line 78 of file SpacePointMakerAlg.h.

◆ m_map

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

Definition at line 81 of file SpacePointMakerAlg.h.

◆ m_mutex

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

Definition at line 79 of file SpacePointMakerAlg.h.


The documentation for this class was generated from the following files:
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_mutex
std::mutex m_mutex
Definition: SpacePointMakerAlg.h:79
Muon::IMuonIdHelperSvc::stationIndex
virtual MuonStationIndex::StIndex stationIndex(const Identifier &id) const =0
calculate station index from Identifier
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:104
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: SpacePointMakerAlg.h:78
Muon::IMuonIdHelperSvc::stationEta
virtual int stationEta(const Identifier &id) const =0
Return stationEta for all technologies.
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
std::stable_sort
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Definition: DVL_algorithms.h:711
SpacePoint
Definition: Trigger/TrigAccel/TrigCudaFitter/src/SpacePoint.h:7
TrigConf::MSGTC::ALWAYS
@ ALWAYS
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:29
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_map
StatMap_t m_map
Definition: SpacePointMakerAlg.h:81
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Muon::MuonStationIndex::technologyName
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:169
F600IntegrationConfig.spacePoints
spacePoints
Definition: F600IntegrationConfig.py:122
Muon::IMuonIdHelperSvc::technologyIndex
virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier &id) const =0
calculate layer index from Identifier
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
a
TList * a
Definition: liststreamerinfos.cxx:10
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37