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() 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 Gaudi::Property<std::vector<int>> m_selectMuonWPs{
144 this, "SelectMuonWorkingPoints", {xAOD::Muon::Loose, xAOD::Muon::Medium, xAOD::Muon::Tight}};
145 Gaudi::Property<std::vector<unsigned int>> m_selectMuonAuthors{
146 this,
147 "SelectMuonAuthors",
148 {xAOD::Muon::MuidCo, xAOD::Muon::MuTagIMO, xAOD::Muon::MuidSA, xAOD::Muon::MuGirl, xAOD::Muon::CaloTag, xAOD::Muon::CaloScore}};
149
150 Gaudi::Property<bool> m_selectComissioning{this, "SelectComissioningMuons", false};
151 Gaudi::Property<std::vector<std::vector<std::string>>> m_selectHLTMuonItems{this, "SelectHLTMuonItems", {}};
152 Gaudi::Property<std::vector<std::string>> m_L1MuonItems{this, "SelectL1MuonItems", {}};
153 Gaudi::Property<std::vector<unsigned int>> m_selectMuonCategories{
154 this,
155 "SelectMuonCategories",
157
158 Gaudi::Property<bool> m_doBinnedResolutionPlots{this, "DoBinnedResolutionPlots", true};
159 Gaudi::Property<bool> m_doTrigMuonValidation{this, "DoTrigMuonValidation", false};
160 Gaudi::Property<bool> m_doTrigMuonL1Validation{this, "DoTrigMuonL1Validation", false};
161 Gaudi::Property<bool> m_doTrigMuonL2Validation{this, "DoTrigMuonL2Validation", false};
162 Gaudi::Property<bool> m_doTrigMuonEFValidation{this, "DoTrigMuonEFValidation", false};
163 Gaudi::Property<bool> m_isData{this, "IsData", false};
164
165 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfo", "EventInfo", "event info"};
166
167 // Tools
168 ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool{this, "MuonSelector", "CP::MuonSelectionTool/MuonSelectionTool"};
169 ToolHandle<Rec::IMuonPrintingTool> m_muonPrinter{this, "MuonPrinter", "Rec::MuonPrintingTool/MuonPrintingTool"};
170 ToolHandle<Trig::TrigDecisionTool> m_trigDec{this, "TrigDecTool", "Trig::TrigDecisionTool/TrigDecisionTool"};
171 ToolHandle<Trk::ITrackSelectorTool> m_trackSelector{this, "TrackSelector", "InDet::InDetDetailedTrackSelectorTool/MuonCombinedInDetDetailedTrackSelectorTool"};
172 ToolHandle<CP::IIsolationSelectionTool> m_isoTool{this, "IsoTool", ""};
173
174 std::vector<std::string> m_selectMuonCategoriesStr;
176 const xAOD::TruthParticleContainer* muonTruthContainer);
178 bool passesAcceptanceCuts(const xAOD::IParticle* prt);
179 void SplitString(TString x, const TString& delim, std::vector<TString>& v);
180
181 // Hists
182 std::vector<std::unique_ptr<MuonValidationPlots>> m_muonValidationPlots;
183 std::vector<std::unique_ptr<TriggerMuonValidationPlots>> m_TriggerMuonValidationPlots;
184 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMSTrackValidationPlots;
185 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMETrackValidationPlots;
186 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonMSOnlyMETrackValidationPlots;
187 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDTrackValidationPlots;
188 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDSelectedTrackValidationPlots;
189 std::vector<std::unique_ptr<MuonTrackValidationPlots>> m_muonIDForwardTrackValidationPlots;
190 std::vector<std::unique_ptr<MuonSegmentValidationPlots>> m_muonSegmentValidationPlots;
191 std::unique_ptr<Muon::RecoMuonPlotOrganizer> m_oUnmatchedRecoMuonPlots;
192 std::unique_ptr<Muon::TruthMuonPlotOrganizer> m_oUnmatchedTruthMuonPlots;
193 std::unique_ptr<Muon::RecoMuonTrackPlotOrganizer> m_oUnmatchedRecoMuonTrackPlots;
194 std::unique_ptr<Muon::MuonSegmentPlots> m_oUnmatchedRecoMuonSegmentPlots;
195
196 std::vector<std::unique_ptr<SlowMuonValidationPlots>> m_slowMuonValidationPlots;
197
198 // overview hists
199 std::vector<TH1F*> m_h_overview_nObjects;
201 std::vector<TH1F*> m_h_overview_reco_authors;
202
203 TH1F* m_h_overview_Z_mass{nullptr};
206
207 std::vector<const xAOD::TruthParticle*> m_vMatchedTruthMuons;
208 std::vector<const xAOD::Muon*> m_vMatchedMuons;
209 std::vector<const xAOD::SlowMuon*> m_vMatchedSlowMuons;
210 std::vector<const xAOD::TrackParticle*> m_vMatchedMuonTracks;
211 std::vector<const xAOD::MuonSegment*> m_vMatchedMuonSegments;
212 std::vector<const xAOD::TrackParticle*> m_vZmumuIDTracks;
213 std::vector<const xAOD::TrackParticle*> m_vZmumuMETracks;
214 std::vector<const xAOD::Muon*> m_vZmumuMuons;
215 std::vector<const xAOD::Muon*> m_vEFMuons;
216 std::vector<const xAOD::Muon*> m_vEFMuonsSelected;
217 std::vector<const xAOD::L2StandAloneMuon*> m_vL2SAMuons;
218 std::vector<const xAOD::L2StandAloneMuon*> m_vL2SAMuonsSelected;
219 std::vector<const xAOD::L2CombinedMuon*> m_vL2CBMuons;
220 std::vector<const xAOD::L2CombinedMuon*> m_vL2CBMuonsSelected;
221 std::vector<const xAOD::Muon*> m_vRecoMuons;
222 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen_CB;
223 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen_MS;
224 std::vector<const xAOD::Muon*> m_vRecoMuons_EffDen;
225
226 template <class ContType> StatusCode retrieveContainer(const EventContext& ctx,
228 const ContType* & container) const;
229 };
230
231
232
233} // namespace MuonPhysValMonitoring
234
235#endif //> !MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
Property holding a SG store/key/clid from which a ReadHandle is made.
#define x
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)
Gaudi::Property< bool > m_selectComissioning
Flag to tell whether muons with the comissioning author will be selected or not.
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
void SplitString(TString x, const TString &delim, std::vector< TString > &v)
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
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
Gaudi::Property< std::vector< unsigned int > > m_selectMuonAuthors
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< int > > m_selectMuonWPs
Gaudi::Property< std::vector< std::vector< std::string > > > m_selectHLTMuonItems
std::vector< const xAOD::L2CombinedMuon * > m_vL2CBMuons
SG::ReadHandleKey< xAOD::TruthParticleContainer > TruthPartKey_t
StatusCode retrieveContainer(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&container) const
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
virtual StatusCode fillHistograms() override
An inheriting class should either override this function or fillHists().
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.