ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
MuonR4::HitSummary Struct Reference

Summary struct to hold the hit counts on the track per MS layer. More...

#include <HitSummary.h>

Collaboration diagram for MuonR4::HitSummary:

Public Types

enum  HitCategory : std::uint8_t { HitCategory::Precision =0, HitCategory::TriggerEta, HitCategory::TriggerPhi, HitCategory::nCategories }
 Category of the hit. More...
 
enum  Status { Status::OnTrack = 0, Status::Outlier, Status::Hole, Status::MaxValue }
 Contribution to the track fit. More...
 
using value_type = std::uint8_t
 
using LayerIndex = Muon::MuonStationIndex::LayerIndex
 Abrivation of the layer index. More...
 

Public Member Functions

 HitSummary ()=default
 Default constructor. More...
 
value_type value (const HitCategory cat, const Status status, const LayerIndex layer, const bool isSmall) const
 Returns the value type for a defined hit category & layer. More...
 
value_typevalue (const HitCategory cat, const Status status, const LayerIndex layer, const bool isSmall)
 Returns the value type for a defined hit category & layer to modify the summary value. More...
 

Static Public Member Functions

static std::string toString (const HitCategory c)
 Converts the hit category to a string. More...
 
static std::string toString (const Status s)
 Converts the status to a string. More...
 

Private Types

using Counter_t = std::array< value_type, Acts::toUnderlying(HitCategory::nCategories) *(Acts::toUnderlying(LayerIndex::LayerIndexMax) -1) *Acts::toUnderlying(Status::MaxValue) *2 >
 Abrivation to store the hits per layer. More...
 

Private Member Functions

unsigned translate (const HitCategory cat, const Status status, LayerIndex layer, const bool isSmall) const
 Translates the 4 classification indices to a unique consecutive number (used for storage access) More...
 
void print (std::ostream &ostr) const
 Print the summary as an ASCII table. More...
 

Private Attributes

Counter_t m_counts {}
 

Friends

std::ostream & operator<< (std::ostream &ostr, const HitSummary &sum)
 Output string stream operator. More...
 

Detailed Description

Summary struct to hold the hit counts on the track per MS layer.

Summaries are categorized by MS layer (Inner / Middle / Outer / Extended), by whether the hit is a precision, trigger eta or trigger phi hit & by their contribution to the track fit. Note: Barrel extended is counted under the Extended category

Definition at line 21 of file HitSummary.h.

Member Typedef Documentation

◆ Counter_t

using MuonR4::HitSummary::Counter_t = std::array<value_type, Acts::toUnderlying(HitCategory::nCategories) * (Acts::toUnderlying(LayerIndex::LayerIndexMax) -1)* Acts::toUnderlying(Status::MaxValue) * 2>
private

Abrivation to store the hits per layer.

Definition at line 84 of file HitSummary.h.

◆ LayerIndex

Abrivation of the layer index.

Definition at line 24 of file HitSummary.h.

◆ value_type

using MuonR4::HitSummary::value_type = std::uint8_t

Definition at line 22 of file HitSummary.h.

Member Enumeration Documentation

◆ HitCategory

enum MuonR4::HitSummary::HitCategory : std::uint8_t
strong

Category of the hit.

Enumerator
Precision 
TriggerEta 

Precision hits (Mdt, NSW) on track.

TriggerPhi 

Trigger eta hits (Tgc, Rpc)

nCategories 

Trigger phi hits (Tgc, Rpc)

Definition at line 28 of file HitSummary.h.

28  : std::uint8_t{
29  Precision=0,
30  TriggerEta,
31  TriggerPhi,
33  };

◆ Status

Contribution to the track fit.

Enumerator
OnTrack 
Outlier 

Added to the trajectory & contributing to the fit.

Hole 

Added to the trajectory but rejected.

MaxValue 

Expected hit but missing.

Definition at line 35 of file HitSummary.h.

35  {
36  OnTrack = 0,
37  Outlier,
38  Hole,
39  MaxValue
40  };

Constructor & Destructor Documentation

◆ HitSummary()

MuonR4::HitSummary::HitSummary ( )
default

Default constructor.

Member Function Documentation

◆ print()

void MuonR4::HitSummary::print ( std::ostream &  ostr) const
private

Print the summary as an ASCII table.

Definition at line 60 of file HitSummary.cxx.

60  {
61  using ColumnArray_t = std::array<std::string, 6>;
62  std::vector<ColumnArray_t> summaryTable{ColumnArray_t{"layer", "sector", "type",
63  "on-track", "outlier", "hole"}};
64 
65  for (const auto lay: {LayerIndex::Inner, LayerIndex::Middle, LayerIndex::Extended,
67  for (const bool small: {false, true}) {
68  for (const auto cat : {HitCategory::Precision, HitCategory::TriggerEta,
70  const unsigned onTrk = value(cat, Status::OnTrack, lay, small);
71  const unsigned outlier = value(cat, Status::Outlier, lay, small);
72  const unsigned hole = value(cat, Status::Hole, lay, small);
73  if (onTrk + outlier + hole == 0u) {
74  continue;
75  }
76  summaryTable.emplace_back(ColumnArray_t{Muon::MuonStationIndex::layerName(lay),
77  (small ? "small" : "large"),
78  toString(cat), std::to_string(onTrk),
79  std::to_string(outlier), std::to_string(hole)});
80  }
81  }
82  }
83  std::array<std::size_t, 6> widths{};
84  for (const ColumnArray_t& row : summaryTable) {
85  for (std::size_t c = 0 ; c < row.size(); ++c) {
86  widths[c] = std::max(widths[c], row[c].size());
87  }
88  }
89  for (const ColumnArray_t& row : summaryTable) {
90  ostr<<"|";
91  for (std::size_t c = 0; c < row.size(); ++c) {
92  const std::size_t W = widths[c] - row[c].size();
93  const std::size_t nWL = (W - W % 2) / 2;
94  const std::size_t nWR = (W - W % 2) / 2 + W%2;
95  ostr<<" "<<whiteSpaces(nWL)<<row[c]<<whiteSpaces(nWR)<<" |";
96  }
97  ostr<<std::endl;
98  }
99  }

◆ toString() [1/2]

std::string MuonR4::HitSummary::toString ( const HitCategory  c)
static

Converts the hit category to a string.

Definition at line 16 of file HitSummary.cxx.

16  {
17  switch (c) {
18  using enum HitCategory;
19  case Precision: return "Precision";
20  case TriggerEta: return "TriggerEta";
21  case TriggerPhi: return "TriggerPhi";
22  case nCategories: return "nCategories";
23  }
24  return "Unknown";
25  }

◆ toString() [2/2]

std::string MuonR4::HitSummary::toString ( const Status  s)
static

Converts the status to a string.

Definition at line 26 of file HitSummary.cxx.

26  {
27  switch(s) {
28  using enum Status;
29  case OnTrack: return "OnTrack";
30  case Outlier: return "Outlier";
31  case Hole: return "Hole";
32  case MaxValue: return "MaxValue";
33  }
34  return "Unknown";
35  }

◆ translate()

unsigned MuonR4::HitSummary::translate ( const HitCategory  cat,
const Status  status,
LayerIndex  layer,
const bool  isSmall 
) const
private

Translates the 4 classification indices to a unique consecutive number (used for storage access)

Parameters
catHit category
statusContribution to the fit
layerSpectrometer layer
isSmallSmall sectors

Map the barrel extended -> extended index

Definition at line 36 of file HitSummary.cxx.

37  {
38  using namespace Muon::MuonStationIndex;
40  if (layer == LayerIndex::BarrelExtended) {
41  layer = LayerIndex::Extended;
42  }
43  constexpr unsigned A = toInt(Status::MaxValue);
44  constexpr unsigned AxB = A * toInt(HitCategory::nCategories);
45  constexpr unsigned AxBxC = 2 *AxB;
46  const unsigned idx = AxBxC*toInt(layer) + AxB*toInt(isSmall) + A*toInt(cat) + toInt(status);
47  assert(idx < m_counts.size());
48  return idx;
49  }

◆ value() [1/2]

HitSummary::value_type & MuonR4::HitSummary::value ( const HitCategory  cat,
const Status  status,
const LayerIndex  layer,
const bool  isSmall 
)

Returns the value type for a defined hit category & layer to modify the summary value.

Parameters
catHit category
statusContribution to the fit
layerSpectrometer layer
isSmallSmall sectors

Definition at line 56 of file HitSummary.cxx.

57  {
58  return m_counts[translate(cat, status, layer, isSmall)];
59  }

◆ value() [2/2]

HitSummary::value_type MuonR4::HitSummary::value ( const HitCategory  cat,
const Status  status,
const LayerIndex  layer,
const bool  isSmall 
) const

Returns the value type for a defined hit category & layer.

Parameters
catHit category
statusContribution to the fit
layerSpectrometer layer
isSmallSmall sectors

Definition at line 51 of file HitSummary.cxx.

52  {
53  return m_counts[translate(cat, status, layer, isSmall)];
54  }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const HitSummary sum 
)
friend

Output string stream operator.

Definition at line 66 of file HitSummary.h.

66  {
67  sum.print(ostr);
68  return ostr;
69  }

Member Data Documentation

◆ m_counts

Counter_t MuonR4::HitSummary::m_counts {}
private

Definition at line 88 of file HitSummary.h.


The documentation for this struct was generated from the following files:
MuonR4::HitSummary::HitCategory::TriggerPhi
@ TriggerPhi
Trigger eta hits (Tgc, Rpc)
Muon::MuonStationIndex::LayerIndex::Outer
@ Outer
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:553
Muon::MuonStationIndex
Definition: MuonStationIndex.h:13
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
AmbiguityProcessor::nCategories
@ nCategories
Definition: AmbiguityProcessorUtility.h:24
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonR4::HitSummary::HitCategory::Precision
@ Precision
Muon::MuonStationIndex::LayerIndex::Inner
@ Inner
keylayer_zslicemap.row
row
Definition: keylayer_zslicemap.py:155
MuonR4::HitSummary::translate
unsigned translate(const HitCategory cat, const Status status, LayerIndex layer, const bool isSmall) const
Translates the 4 classification indices to a unique consecutive number (used for storage access)
Definition: HitSummary.cxx:36
MuonR4::to_string
std::string to_string(const SectorProjector proj)
Definition: MsTrackSeeder.cxx:66
MuonR4::HitSummary::HitCategory::nCategories
@ nCategories
Trigger phi hits (Tgc, Rpc)
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
A
MuonR4::HitSummary::Status::MaxValue
@ MaxValue
Expected hit but missing.
LArSamples::MaxValue
@ MaxValue
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/MonitorBase.h:27
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
MuonR4::HitSummary::Status::OnTrack
@ OnTrack
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonR4::HitSummary::HitCategory
HitCategory
Category of the hit.
Definition: HitSummary.h:28
MuonR4::HitSummary::toString
static std::string toString(const HitCategory c)
Converts the hit category to a string.
Definition: HitSummary.cxx:16
MuonR4::HitSummary::value
value_type value(const HitCategory cat, const Status status, const LayerIndex layer, const bool isSmall) const
Returns the value type for a defined hit category & layer.
Definition: HitSummary.cxx:51
MuonR4::HitSummary::Status::Hole
@ Hole
Added to the trajectory but rejected.
Muon::MuonStationIndex::layerName
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:153
Muon::MuonStationIndex::LayerIndex::Middle
@ Middle
MuonR4::HitSummary::Status::Outlier
@ Outlier
Added to the trajectory & contributing to the fit.
MuonR4::HitSummary::Status
Status
Contribution to the track fit.
Definition: HitSummary.h:35
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
Trk::hole
@ hole
Definition: MeasurementType.h:36
merge.status
status
Definition: merge.py:16
ActsTrk::detail::HitCategory::Hole
@ Hole
Definition: HitSummaryDataUtils.h:31
MuonR4::HitSummary::m_counts
Counter_t m_counts
Definition: HitSummary.h:88
OfflineHitType::Outlier
@ Outlier
MuonR4::HitSummary::HitCategory::TriggerEta
@ TriggerEta
Precision hits (Mdt, NSW) on track.
python.compressB64.c
def c
Definition: compressB64.py:93
Muon::MuonStationIndex::isSmall
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
Muon::MuonStationIndex::toInt
constexpr int toInt(const EnumType enumVal)
Definition: MuonStationIndex.h:61