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 101 of file SpacePointMakerAlg.h.

Member Typedef Documentation

◆ StatMap_t

Definition at line 140 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.

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

251  {
252  std::lock_guard guard{m_mutex};
253  for (const SpacePoint& sp : spacePoints){
254  FieldKey key{};
255  key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
256  key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
257  key.eta = m_idHelperSvc->stationEta(sp.identify());
258  StatField & stats = m_map[key];
259  if (sp.measuresEta() && sp.measuresPhi()) {
260  ++stats.measEtaPhi;
261  } else {
262  stats.measEta += sp.measuresEta();
263  stats.measPhi += sp.measuresPhi();
264  }
265  }
266 }

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

267  {
268  using KeyVal = std::pair<FieldKey, StatField>;
269  std::vector<KeyVal> sortedstats{};
270  sortedstats.reserve(m_map.size());
272  for (const auto & [key, stats] : m_map){
273  sortedstats.emplace_back(std::make_pair(key, stats));
274  }
275  std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
276  return a.second.allHits() > b.second.allHits();
277  });
278  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
279  for (const auto & [key, stats] : sortedstats) {
281  <<" "<<Muon::MuonStationIndex::stName(key.stIdx)
282  <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
283  <<" "<<std::setw(8)<<stats.measEtaPhi
284  <<" "<<std::setw(8)<<stats.measEta
285  <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
286  }
287  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
288 
289 }

Member Data Documentation

◆ m_idHelperSvc

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

Definition at line 138 of file SpacePointMakerAlg.h.

◆ m_map

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

Definition at line 141 of file SpacePointMakerAlg.h.

◆ m_mutex

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

Definition at line 139 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:139
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:138
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:141
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