ATLAS Offline Software
Loading...
Searching...
No Matches
TrackSummaryModule.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
7
8#include <format>
9using namespace MuonR4;
10using namespace Muon::MuonStationIndex;
11
12namespace MuonValR4{
13
16 inline std::string nameBr(Category cat, Status status,
17 LayerIndex layer, bool isSmall) {
18 std::string lName = layerName(layer);
19 lName[0] = std::tolower(lName[0]);
20 return std::format("{:}{:}{:}{:}",
21 lName, (isSmall ? "Small" :"Large"), cat,
22 (status == Status::OnTrack ? std::string{"Hits"}
23 : HitSummary::toString(status) +"s"));
24 }
25
27 const std::string& collName,
28 Category cat, Status status,
29 LayerIndex layer, bool isSmall):
30 VectorBranch<std::uint8_t>(tree,
31 std::format("{:}_{:}",
32 collName, nameBr(cat, status, layer, isSmall))),
33 m_cat{cat}, m_status{status}, m_layer{layer}, m_isSmall{isSmall}{}
37
38
40 const std::string& collName,
41 const MuonR4::ITrackSummaryTool* summaryTool):
42 MuonTesterBranch{parent, " track summary " + collName},
43 m_summaryTool{summaryTool} {
44 for (const auto layer : {LayerIndex::Inner, LayerIndex::Middle,
46 for (const auto cat : {Category::Precision, Category::TriggerEta, Category::TriggerPhi}){
48 if ( (layer == LayerIndex::BarrelExtended || layer == LayerIndex::Extended) &&
49 (cat != Category::Precision)){
50 continue;
51 }
52 for (const auto status : {Status::OnTrack, Status::Outlier, Status::Hole}) {
53 for (const bool small : {false, true}) {
54 if (layer == LayerIndex::BarrelExtended && !small){
55 continue;
56 }
57 m_values.emplace_back(std::make_shared<TrackSummaryValueBranch>(parent.tree(), collName,
58 cat, status, layer,
59 small));
60 }
61 }
62 }
63 }
64 for (const auto& br : m_values){
65 parent.addBranch(br);
66 }
67 }
68 bool TrackSummaryModule::fill(const EventContext& /*ctx*/) {
69 return true;
70 }
72 return true;
73 }
74
75 void TrackSummaryModule::push_back(const EventContext& ctx, const ConstTrack_t track) {
76 push_back(m_summaryTool->makeSummary(ctx, track));
77 }
78 void TrackSummaryModule::push_back(const EventContext& ctx, const MsTrackSeed& seed) {
79 push_back(m_summaryTool->makeSummary(ctx, seed.segments()));
80 }
82 for(const auto& br : m_values){
83 br->push_back(summary);
84 }
85 }
86}
Interface tool to calculate the hit summary of tracks & track seeds in the MuonSpectrometer.
bool fill(const EventContext &ctx) override
Clears vector in cases that it has not been updated in this event Returns false if the vector has not...
std::vector< ValuePtr_t > m_values
void push_back(const EventContext &ctx, const ConstTrack_t track)
TrackSummaryModule(MuonVal::MuonTesterTree &parent, const std::string &collName, const MuonR4::ITrackSummaryTool *summaryTool)
Constructor.
MuonR4::ITrackSummaryTool::ConstTrack_t ConstTrack_t
bool init() override
Initialized the Branch.
const MuonR4::ITrackSummaryTool * m_summaryTool
MuonR4::HitSummary::HitCategory Category
TrackSummaryValueBranch(TTree *tree, const std::string &collName, Category cat, Status status, LayerIndex layer, bool isSmall)
Constructor taking the reference to the tree & the summary values together with an overall collection...
MuonR4::HitSummary::LayerIndex LayerIndex
MuonR4::HitSummary::Status Status
void push_back(const MuonR4::HitSummary &summary)
push back the assigned hit summary value
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
MuonTesterTree & parent()
Returns the reference to the MuonTesterTree parent.
VectorBranch(TTree *tree, const std::string &name)
This header ties the generic definitions in this package.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
std::string nameBr(Category cat, Status status, LayerIndex layer, bool isSmall)
MuonR4::HitSummary::HitCategory Category
MuonR4::HitSummary::Status Status
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
LayerIndex
enum to classify the different layers in the muon spectrometer
STL namespace.
Summary struct to hold the hit counts on the track per MS layer.
Definition HitSummary.h:23
static std::string toString(const HitCategory c)
Converts the hit category to a string.
HitCategory
Category of the hit.
Definition HitSummary.h:30
Status
Contribution to the track fit.
Definition HitSummary.h:39