ATLAS Offline Software
Loading...
Searching...
No Matches
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 class  HitCategory : std::uint8_t { Precision =0 , TriggerEta , TriggerPhi , nCategories }
 Category of the hit. More...
enum class  Status { OnTrack = 0 , Outlier , Hole , MaxValue }
 Contribution to the track fit. More...
using value_type = std::uint8_t
using LayerIndex = Muon::MuonStationIndex::LayerIndex
 Abrivation of the layer index.

Public Member Functions

 HitSummary ()=default
 Default constructor.
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.
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.

Static Public Member Functions

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

Private Types

using Counter_t
 Abrivation to store the hits per layer.

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)
void print (std::ostream &ostr) const
 Print the summary as an ASCII table.

Private Attributes

Counter_t m_counts {}

Friends

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

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 22 of file HitSummary.h.

Member Typedef Documentation

◆ Counter_t

Initial value:
std::array<value_type, Acts::toUnderlying(HitCategory::nCategories) *
(Acts::toUnderlying(LayerIndex::LayerIndexMax) -1)*
Acts::toUnderlying(Status::MaxValue) * 2>
std::uint8_t value_type
Definition HitSummary.h:23
@ nCategories
Trigger phi hits (Tgc, Rpc)
Definition HitSummary.h:33

Abrivation to store the hits per layer.

Definition at line 85 of file HitSummary.h.

◆ LayerIndex

Abrivation of the layer index.

Definition at line 25 of file HitSummary.h.

◆ value_type

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

Definition at line 23 of file HitSummary.h.

Member Enumeration Documentation

◆ HitCategory

enum class 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 29 of file HitSummary.h.

29 : std::uint8_t{
30 Precision=0,
31 TriggerEta,
32 TriggerPhi,
34 };

◆ Status

enum class MuonR4::HitSummary::Status
strong

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 36 of file HitSummary.h.

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,
66 LayerIndex::Outer}){
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 }
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
row
Appending html table to final .html summary file.
static std::string toString(const HitCategory c)
Converts the hit category to a string.
@ TriggerPhi
Trigger eta hits (Tgc, Rpc)
Definition HitSummary.h:32
@ TriggerEta
Precision hits (Mdt, NSW) on track.
Definition HitSummary.h:31
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.

◆ 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 }
HitCategory
Category of the hit.
Definition HitSummary.h:29

◆ 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 }
Status
Contribution to the track fit.
Definition HitSummary.h:36
@ Hole
Added to the trajectory but rejected.
Definition HitSummary.h:39
@ Outlier
Added to the trajectory & contributing to the fit.
Definition HitSummary.h:38
@ MaxValue
Expected hit but missing.
Definition HitSummary.h:40

◆ 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 }
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
constexpr int toInt(const EnumType enumVal)
@ layer
Definition HitInfo.h:79
Counter_t m_counts
Definition HitSummary.h:89

◆ 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 }
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)

◆ 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 }

◆ operator<<

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

Output string stream operator.

Definition at line 67 of file HitSummary.h.

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

Member Data Documentation

◆ m_counts

Counter_t MuonR4::HitSummary::m_counts {}
private

Definition at line 89 of file HitSummary.h.

89{};

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