ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhysValMonitoringTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// MuonPhysValMonitoringTool.cxx
6// Implementation file for class MuonPhysValMonitoringTool
7// Author: Felix Socher <Felix.Socher@cern.ch>
9
10#ifndef MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
11#define MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
12
13
14
19
20
24
27
35
36#include "MuonSegmentValidationPlots.h" //needed for unique_ptr access to deleter
37#include "MuonHistUtils/MuonSegmentPlots.h" //needed for unique_ptr access to deleter
38#include "MuonValidationPlots.h" //needed for unique_ptr access to deleter
39#include "MuonHistUtils/RecoMuonPlotOrganizer.h" //needed for unique_ptr access to deleter
40#include "MuonHistUtils/TruthMuonPlotOrganizer.h" //needed for unique_ptr access to deleter
41#include "TrkValHistUtils/PlotBase.h" //for PlotBase, also for typedef of HistData
42#include "SlowMuonValidationPlots.h" //needed for unique_ptr access to deleter
43#include "MuonTrackValidationPlots.h" //needed for unique_ptr access to deleter
44#include "TriggerMuonValidationPlots.h" //needed for unique_ptr access to deleter
45
46#include <string>
47#include <vector>
48#include <memory>
49
50class TString;
51class TH1F;
52
53
54
55namespace MuonPhysValMonitoring {
56
59 // Public methods:
61 public:
62
65
67 virtual ~MuonPhysValMonitoringTool() = default;
68
69 // Athena algtool's Hooks
70 virtual StatusCode initialize() override;
71 virtual StatusCode bookHistograms() override;
72 virtual StatusCode fillHistograms(const EventContext& ctx) override;
73 virtual StatusCode procHistograms() override;
74
76 // Private data:
78 private:
80
81 void handleMuon(const xAOD::Muon* mu, const xAOD::SlowMuon* smu = nullptr, float weight = 1.0);
82 void handleSlowMuon(const xAOD::SlowMuon* smu, float weight = 1.0);
83 void handleTruthMuon(const xAOD::TruthParticle* truthMu, float weight = 1.0);
84 void handleMuonTrack(const xAOD::TrackParticle* tp, xAOD::Muon::TrackParticleType type, float weight = 1.0);
85 void handleMuonSegment(const xAOD::MuonSegment* muSeg, float weight = 1.0);
86 void handleTruthMuonSegment(const xAOD::MuonSegment* truthMuSeg, const xAOD::TruthParticleContainer* muonTruthContainer,
87 float weight = 1.0);
88
89 void handleMuonL1Trigger(const xAOD::MuonRoI* TrigL1mu);
91 void handleMuonL2Trigger(const xAOD::L2CombinedMuon* L2CBMu);
92 void handleMuonTrigger(const xAOD::Muon* mu);
96
97 void printMuonDebug(const xAOD::Muon* mu);
98 void printTruthMuonDebug(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu);
99
100 StatusCode bookValidationPlots(PlotBase& valPlots);
101 const xAOD::Muon* findRecoMuon(const xAOD::TruthParticle* truthMu);
104 std::unique_ptr<xAOD::Muon> getCorrectedMuon(const xAOD::Muon& mu);
105
107 std::map<std::string, int> m_counterBits;
108 std::vector<std::string> m_muonItems;
109 std::vector<std::string> m_L1Seed;
111
112 TH1F* findHistogram(const std::vector<HistData>& hists, const std::string& hnameTag, const std::string& hdirTag,
113 const std::string& hNewName);
114 void modifyHistogram(TH1* hist);
123
124 TrackContKey_t m_tracksName{this, "TrackContainerName", "InDetTrackParticles"};
125 TrackContKey_t m_fwdtracksName{this, "FwdTrackContainerName", ""};
126 MuonContKey_t m_muonsName{this, "MuonContainerName", "Muons"};
127 SlowContKey_t m_slowMuonsName{this, "SlowMuonContainerName", "SlowMuons"};
128 TruthPartKey_t m_muonsTruthName{this, "MuonTruthParticleContainerName", "MuonTruthParticles"};
129 TrackContKey_t m_muonTracksName{this, "MuonTrackContainerName", "MuonSpectrometerTrackParticles"};
130 TrackContKey_t m_muonExtrapolatedTracksName{this, "MuonExtrapolatedTrackContainerName", "ExtrapolatedMuonTrackParticles"};
131 TrackContKey_t m_muonMSOnlyExtrapolatedTracksName{this, "MuonOnlyExtrapolatedTrackContainerName",
132 "MSOnlyExtrapolatedMuonTrackParticles"};
133
134 SegmentContKey_t m_muonSegmentsName{this, "MuonSegmentContainerName", "MuonSegments"};
135 SegmentContKey_t m_muonSegmentsTruthName{this, "MuonTruthSegmentContainerName", "MuonTruthSegments"};
136 MuonROIContKey_t m_muonL1TrigName{this, "L1TrigMuonContainerName", "LVL1MuonRoIs"};
137 L2SAContKey_t m_muonL2SAName{this, "L2SAMuonContainerName", "HLT_xAOD__L2StandAloneMuonContainer_MuonL2SAInfo"};
138 L2CBContKey_t m_muonL2CBName{this, "L2CBMuonContainerName", "HLT_xAOD__L2CombinedMuonContainer_MuonL2CBInfo"};
139 MuonContKey_t m_muonEFCombTrigName{this, "EFCombTrigMuonContainerName", "HLT_xAOD__MuonContainer_MuonEFInfo"};
140
142
143 using Quality = xAOD::Muon::Quality;
144 Gaudi::Property<std::set<int>> m_selectMuonWPs{
145 this, "SelectMuonWorkingPoints", {static_cast<int>(Quality::Loose),
146 static_cast<int>(Quality::Medium),
147 static_cast<int>(Quality::Tight)}};
148 using Author= xAOD::Muon::Author;
149 Gaudi::Property<std::set<int>> m_selectMuonAuthors{
150 this,
151 "SelectMuonAuthors",
152 { static_cast<int>(Author::MuidCo),
153 static_cast<int>(Author::MuTagIMO),
154 static_cast<int>(Author::MuidSA),
155 static_cast<int>(Author::MuGirl),
156 static_cast<int>(Author::CaloTag),
157 static_cast<int>(Author::CaloScore)}};
158 Gaudi::Property<std::vector<std::vector<std::string>>> m_selectHLTMuonItems{this, "SelectHLTMuonItems", {}};
159 Gaudi::Property<std::vector<std::string>> m_L1MuonItems{this, "SelectL1MuonItems", {}};
160 Gaudi::Property<std::vector<unsigned int>> m_selectMuonCategories{
161 this,
162 "SelectMuonCategories",
164
165 Gaudi::Property<bool> m_doBinnedResolutionPlots{this, "DoBinnedResolutionPlots", true};
166 Gaudi::Property<bool> m_doTrigMuonValidation{this, "DoTrigMuonValidation", false};
167 Gaudi::Property<bool> m_doTrigMuonL1Validation{this, "DoTrigMuonL1Validation", false};
168 Gaudi::Property<bool> m_doTrigMuonL2Validation{this, "DoTrigMuonL2Validation", false};
169 Gaudi::Property<bool> m_doTrigMuonEFValidation{this, "DoTrigMuonEFValidation", false};
170 Gaudi::Property<bool> m_isData{this, "IsData", false};
171
172 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfo", "EventInfo", "event info"};
173
174 // Tools
175 ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool{this, "MuonSelector", "CP::MuonSelectionTool/MuonSelectionTool"};
176 ToolHandle<Rec::IMuonPrintingTool> m_muonPrinter{this, "MuonPrinter", "Rec::MuonPrintingTool/MuonPrintingTool"};
177 ToolHandle<Trig::TrigDecisionTool> m_trigDec{this, "TrigDecTool", "Trig::TrigDecisionTool/TrigDecisionTool"};
178 ToolHandle<Trk::ITrackSelectorTool> m_trackSelector{this, "TrackSelector", "InDet::InDetDetailedTrackSelectorTool/MuonCombinedInDetDetailedTrackSelectorTool"};
179 ToolHandle<CP::IIsolationSelectionTool> m_isoTool{this, "IsoTool", ""};
180
181 std::vector<std::string> m_selectMuonCategoriesStr;
183 const xAOD::TruthParticleContainer* muonTruthContainer);
185 bool passesAcceptanceCuts(const xAOD::IParticle* prt);
186
187 // Hists
188 std::vector<std::unique_ptr<MuonValidationPlots>> m_muonValidationPlots;
189 std::vector<std::unique_ptr<TriggerMuonValidationPlots>> m_TriggerMuonValidationPlots;
190 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMSTrackValidationPlots;
191 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMETrackValidationPlots;
192 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMSOnlyMETrackValidationPlots;
193 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDTrackValidationPlots;
194 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDSelectedTrackValidationPlots;
195 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDForwardTrackValidationPlots;
196 std::vector<std::unique_ptr<MuonSegmentValidationPlots>> m_muonSegmentValidationPlots;
197 std::unique_ptr<Muon::RecoMuonPlotOrganizer> m_oUnmatchedRecoMuonPlots;
198 std::unique_ptr<Muon::TruthMuonPlotOrganizer> m_oUnmatchedTruthMuonPlots;
199 std::unique_ptr<Muon::RecoMuonTrackPlotOrganizer> m_oUnmatchedRecoMuonTrackPlots;
200 std::unique_ptr<Muon::MuonSegmentPlots> m_oUnmatchedRecoMuonSegmentPlots;
201
202 std::vector<std::unique_ptr<SlowMuonValidationPlots>> m_slowMuonValidationPlots;
203
204 // overview hists
205 std::vector<TH1F*> m_h_overview_nObjects;
207 std::vector<TH1F*> m_h_overview_reco_authors;
208
209 TH1F* m_h_overview_Z_mass{nullptr};
212
213 std::vector<const xAOD::TruthParticle*> m_vMatchedTruthMuons;
214 std::vector<const xAOD::Muon*> m_vMatchedMuons;
215 std::vector<const xAOD::SlowMuon*> m_vMatchedSlowMuons;
216 std::vector<const xAOD::TrackParticle*> m_vMatchedMuonTracks;
217 std::vector<const xAOD::MuonSegment*> m_vMatchedMuonSegments;
218 std::vector<const xAOD::TrackParticle*> m_vZmumuIDTracks;
219 std::vector<const xAOD::TrackParticle*> m_vZmumuMETracks;
220 std::vector<const xAOD::Muon*> m_vZmumuMuons;
221 std::vector<const xAOD::Muon*> m_vEFMuons;
222 std::vector<const xAOD::Muon*> m_vEFMuonsSelected;
223 std::vector<const xAOD::L2StandAloneMuon*> m_vL2SAMuons;
224 std::vector<const xAOD::L2StandAloneMuon*> m_vL2SAMuonsSelected;
225 std::vector<const xAOD::L2CombinedMuon*> m_vL2CBMuons;
226 std::vector<const xAOD::L2CombinedMuon*> m_vL2CBMuonsSelected;
227 std::vector<const xAOD::Muon*> m_vRecoMuons;
228 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen_CB;
229 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen_MS;
230 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen;
231
232 };
233
234
235
236} // namespace MuonPhysValMonitoring
237
238#endif //> !MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
Property holding a SG store/key/clid from which a ReadHandle is made.
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::vector< const xAOD::TrackParticle * > m_vZmumuMETracks
std::vector< const xAOD::L2CombinedMuon * > m_vL2CBMuonsSelected
std::unique_ptr< Muon::MuonSegmentPlots > m_oUnmatchedRecoMuonSegmentPlots
void handleTruthMuon(const xAOD::TruthParticle *truthMu, float weight=1.0)
std::unique_ptr< xAOD::Muon > getCorrectedMuon(const xAOD::Muon &mu)
MuonPhysValMonitoringTool::MUCATEGORY getMuonSegmentTruthCategory(const xAOD::MuonSegment *truthMuSeg, const xAOD::TruthParticleContainer *muonTruthContainer)
std::vector< const xAOD::TruthParticle * > m_vMatchedTruthMuons
std::vector< const xAOD::L2StandAloneMuon * > m_vL2SAMuonsSelected
std::vector< const xAOD::SlowMuon * > m_vMatchedSlowMuons
void handleMuonL2Trigger(const xAOD::L2StandAloneMuon *L2SAMu)
ToolHandle< Trk::ITrackSelectorTool > m_trackSelector
std::vector< std::unique_ptr< MuonSegmentValidationPlots > > m_muonSegmentValidationPlots
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_decorDep
std::unique_ptr< Muon::TruthMuonPlotOrganizer > m_oUnmatchedTruthMuonPlots
SG::ReadHandleKey< xAOD::SlowMuonContainer > SlowContKey_t
virtual ~MuonPhysValMonitoringTool()=default
Destructor:
std::vector< std::unique_ptr< SlowMuonValidationPlots > > m_slowMuonValidationPlots
std::vector< const xAOD::L2StandAloneMuon * > m_vL2SAMuons
void handleTruthMuonSegment(const xAOD::MuonSegment *truthMuSeg, const xAOD::TruthParticleContainer *muonTruthContainer, float weight=1.0)
const xAOD::MuonSegment * findRecoMuonSegment(const xAOD::MuonSegment *truthMuSeg)
std::unique_ptr< Muon::RecoMuonPlotOrganizer > m_oUnmatchedRecoMuonPlots
ToolHandle< CP::IIsolationSelectionTool > m_isoTool
std::vector< const xAOD::MuonSegment * > m_vMatchedMuonSegments
std::unique_ptr< Muon::RecoMuonTrackPlotOrganizer > m_oUnmatchedRecoMuonTrackPlots
virtual StatusCode procHistograms() override
An inheriting class should either override this function or finalHists().
SG::ReadHandleKey< xAOD::TrackParticleContainer > TrackContKey_t
MuonPhysValMonitoringTool::MUCATEGORY getMuonTruthCategory(const xAOD::IParticle *prt)
std::vector< const xAOD::TrackParticle * > m_vZmumuIDTracks
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonIDForwardTrackValidationPlots
virtual StatusCode fillHistograms(const EventContext &ctx) override
An inheriting class should either override this function or fillHists().
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonMETrackValidationPlots
void handleMuonTrack(const xAOD::TrackParticle *tp, xAOD::Muon::TrackParticleType type, float weight=1.0)
const xAOD::SlowMuon * findRecoSlowMuon(const xAOD::TruthParticle *truthMu)
std::vector< std::unique_ptr< TriggerMuonValidationPlots > > m_TriggerMuonValidationPlots
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonMSTrackValidationPlots
void handleMuonSegment(const xAOD::MuonSegment *muSeg, float weight=1.0)
SG::ReadHandleKey< xAOD::L2StandAloneMuonContainer > L2SAContKey_t
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< std::vector< std::string > > m_L1MuonItems
std::vector< const xAOD::TrackParticle * > m_vMatchedMuonTracks
void handleSlowMuon(const xAOD::SlowMuon *smu, float weight=1.0)
Gaudi::Property< std::vector< unsigned int > > m_selectMuonCategories
SG::ReadHandleKey< xAOD::MuonSegmentContainer > SegmentContKey_t
TH1F * findHistogram(const std::vector< HistData > &hists, const std::string &hnameTag, const std::string &hdirTag, const std::string &hNewName)
const xAOD::Muon * findRecoMuon(const xAOD::TruthParticle *truthMu)
SG::ReadHandleKey< xAOD::MuonRoIContainer > MuonROIContKey_t
std::vector< std::unique_ptr< MuonValidationPlots > > m_muonValidationPlots
SG::ReadHandleKey< xAOD::MuonContainer > MuonContKey_t
Gaudi::Property< std::vector< std::vector< std::string > > > m_selectHLTMuonItems
std::vector< const xAOD::L2CombinedMuon * > m_vL2CBMuons
SG::ReadHandleKey< xAOD::TruthParticleContainer > TruthPartKey_t
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonMSOnlyMETrackValidationPlots
void printTruthMuonDebug(const xAOD::TruthParticle *truthMu, const xAOD::Muon *mu)
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonIDTrackValidationPlots
virtual StatusCode bookHistograms() override
An inheriting class should either override this function or bookHists().
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
void handleMuon(const xAOD::Muon *mu, const xAOD::SlowMuon *smu=nullptr, float weight=1.0)
std::vector< std::unique_ptr< MuonTrackValidationPlots > > m_muonIDSelectedTrackValidationPlots
SG::ReadHandleKey< xAOD::L2CombinedMuonContainer > L2CBContKey_t
Property holding a SG store/key/clid from which a ReadHandle is made.
Class providing the definition of the 4-vector interface.
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
SlowMuon_v1 SlowMuon
Reference the current persistent version:
Definition SlowMuon.h:13
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
MuonRoI_v1 MuonRoI
Definition MuonRoI.h:15
MuonSegment_v1 MuonSegment
Reference the current persistent version:
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.