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

35  :
36  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 38 of file SpacePointMakerAlg.cxx.

38  {
39  std::lock_guard guard{m_mutex};
40  for (const SpacePoint& sp : spacePoints){
41  FieldKey key{};
42  key.stIdx = m_idHelperSvc->stationIndex(sp.identify());
43  key.techIdx = m_idHelperSvc->technologyIndex(sp.identify());
44  key.eta = m_idHelperSvc->stationEta(sp.identify());
45  StatField & stats = m_map[key];
46  if (sp.measuresEta() && sp.measuresPhi()) {
47  ++stats.measEtaPhi;
48  } else {
49  stats.measEta += sp.measuresEta();
50  stats.measPhi += sp.measuresPhi();
51  }
52  }
53 }

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

54  {
55  using KeyVal = std::pair<FieldKey, StatField>;
56  std::vector<KeyVal> sortedstats{};
57  sortedstats.reserve(m_map.size());
59  for (const auto & [key, stats] : m_map){
60  sortedstats.emplace_back(std::make_pair(key, stats));
61  }
62  std::stable_sort(sortedstats.begin(), sortedstats.end(), [](const KeyVal& a, const KeyVal&b) {
63  return a.second.allHits() > b.second.allHits();
64  });
65  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
66  for (const auto & [key, stats] : sortedstats) {
69  <<" "<<std::abs(key.eta)<<(key.eta < 0 ? "A" : "C")
70  <<" "<<std::setw(8)<<stats.measEtaPhi
71  <<" "<<std::setw(8)<<stats.measEta
72  <<" "<<std::setw(8)<<stats.measPhi<<endmsg;
73  }
74  msg<<MSG::ALWAYS<<"###########################################################################"<<endmsg;
75 
76 }

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
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::IMuonIdHelperSvc::technologyIndex
virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier &id) const =0
calculate layer index from Identifier
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Muon::MuonStationIndex::stName
static const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:141
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Muon::MuonStationIndex::technologyName
static const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:209