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"),
23 (status == Status::OnTrack ? std::string{"Hits"}
24 : HitSummary::toString(status) +"s"));
25 }
26
28 const std::string& collName,
29 Category cat, Status status,
30 LayerIndex layer, bool isSmall):
31 VectorBranch<std::uint8_t>(tree,
32 std::format("{:}_{:}",
33 collName, nameBr(cat, status, layer, isSmall))),
34 m_cat{cat}, m_status{status}, m_layer{layer}, m_isSmall{isSmall}{}
38
39
41 const std::string& collName,
42 const MuonR4::ITrackSummaryTool* summaryTool):
43 MuonTesterBranch{parent, " track summary " + collName},
44 m_summaryTool{summaryTool} {
45 for (const auto layer : {LayerIndex::Inner, LayerIndex::Middle,
47 for (const auto cat : {Category::Precision, Category::TriggerEta, Category::TriggerPhi}){
49 if ( (layer == LayerIndex::BarrelExtended || layer == LayerIndex::Extended) &&
50 (cat != Category::Precision)){
51 continue;
52 }
53 for (const auto status : {Status::OnTrack, Status::Outlier, Status::Hole}) {
54 for (const bool small : {false, true}) {
55 if (layer == LayerIndex::BarrelExtended && !small){
56 continue;
57 }
58 m_values.emplace_back(std::make_shared<TrackSummaryValueBranch>(parent.tree(), collName,
59 cat, status, layer,
60 small));
61 }
62 }
63 }
64 }
65 for (const auto& br : m_values){
66 parent.addBranch(br);
67 }
68 }
69 bool TrackSummaryModule::fill(const EventContext& /*ctx*/) {
70 return true;
71 }
73 return true;
74 }
75
76 void TrackSummaryModule::push_back(const EventContext& ctx, const ConstTrack_t track) {
77 push_back(m_summaryTool->makeSummary(ctx, track));
78 }
79 void TrackSummaryModule::push_back(const EventContext& ctx, const MsTrackSeed& seed) {
80 push_back(m_summaryTool->makeSummary(ctx, seed.segments()));
81 }
83 for(const auto& br : m_values){
84 br->push_back(summary);
85 }
86 }
87}
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:22
static std::string toString(const HitCategory c)
Converts the hit category to a string.
HitCategory
Category of the hit.
Definition HitSummary.h:29
Status
Contribution to the track fit.
Definition HitSummary.h:36