ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhysValMonitoringTool.cxx
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: S.Binet<binet@cern.ch>
9
10// PhysVal includes
12
14
16
17
18#include "xAODTrigger/MuonRoI.h"
20
24
25#include "TString.h"
27#include <cmath>
28#include <limits>
29#include <format>
30
31namespace{
34 using MuonSegmentLink = ElementLink<xAOD::MuonSegmentContainer>;
36
37}
38using namespace xAOD::P4Helpers;
39
41
42 // Athena algtool's Hooks
45 ATH_MSG_INFO("Initializing " << name() << "...");
47
48 for (unsigned int i = 0; i < m_selectHLTMuonItems.size(); i++) {
49 if (m_selectHLTMuonItems[i][0] == "" || m_selectHLTMuonItems[i][1] == "") continue;
50 m_muonItems.emplace_back(m_selectHLTMuonItems[i][0]);
51 m_L1Seed.emplace_back(m_selectHLTMuonItems[i][1]);
52 }
53
54 // setup flags
55 if (m_doTrigMuonValidation == false) {
59 }
60 ATH_CHECK(m_trigDec.retrieve(DisableTool{!m_doTrigMuonValidation}));
61
62 ATH_CHECK(m_eventInfo.initialize());
64 ATH_CHECK(m_trackSelector.retrieve());
65 ATH_CHECK(m_isoTool.retrieve());
66
67 ATH_CHECK(m_tracksName.initialize());
68 ATH_CHECK(m_fwdtracksName.initialize(!m_fwdtracksName.empty()));
69 ATH_CHECK(m_muonsName.initialize());
70 ATH_CHECK(m_slowMuonsName.initialize(!m_slowMuonsName.empty()));
71
72 ATH_CHECK(m_muonTracksName.initialize());
75
76 ATH_CHECK(m_muonSegmentsName.initialize());
83
84 if (!m_isData) {
85 const std::vector<std::string> truthDecors{"truthOrigin", "truthType", "truthParticleLink"};
86 const std::vector<std::string> keys{m_tracksName.key(), m_fwdtracksName.key(), m_muonsName.key(),
89 for (const std::string& key : keys) {
90 if (key.empty()) continue;
91 for (const std::string& decor : truthDecors){
92 m_decorDep.emplace_back(std::format("{:}.{:}", key , decor));
93 }
94 }
95 const std::vector<std::string> truthPartDecors{"MuonEntryLayer_px", "nprecLayers",
96 "truthOrigin", "truthType"};
97
98 for (const std::string& decor: truthPartDecors) {
99 m_decorDep.emplace_back(m_muonsTruthName, decor);
100 }
101
102
103
104 }
105
106 ATH_CHECK(m_decorDep.initialize());
107 return StatusCode::SUCCESS;
108 }
109
110
111
113 ATH_MSG_INFO("Booking hists " << name() << "...");
114
115
116 static const std::map<int,std::string> theMuonCategories = {
117 {ALL, "All"},
118 {PROMPT, "Prompt"},
119 {INFLIGHT, "InFlight"},
120 {NONISO, "NonIsolated"},
121 {REST, "Rest"}
122 };
123
124 for (const auto& category : m_selectMuonCategories) m_selectMuonCategoriesStr.emplace_back(theMuonCategories.at(category));
125
126 // no such muons in case of SlowMuon reco
127 bool separateSAFMuons = m_slowMuonsName.empty();
128
129 std::string muonContainerName = m_muonsName.key();
130 for (const auto& category : m_selectMuonCategoriesStr) {
131 std::string categoryPath = muonContainerName + "/" + category + "/";
132
133 m_muonValidationPlots.emplace_back(std::make_unique<MuonValidationPlots>(
134 nullptr, categoryPath, m_selectMuonWPs, m_selectMuonAuthors, m_isData,
135 (category == theMuonCategories.at(ALL) ? false : m_doBinnedResolutionPlots.value()), separateSAFMuons));
136
137 if (!m_slowMuonsName.empty()) m_slowMuonValidationPlots.emplace_back(std::make_unique<SlowMuonValidationPlots>(nullptr, categoryPath, m_isData));
139 if (category == "All") {
140 m_TriggerMuonValidationPlots.emplace_back(std::make_unique<TriggerMuonValidationPlots>(
143 }
144 }
145 if (!m_muonTracksName.empty()) {
146 m_muonMSTrackValidationPlots.emplace_back(std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "MSTrackParticles", m_isData));
147 if (!m_isData)
148 m_oUnmatchedRecoMuonTrackPlots = std::make_unique<Muon::RecoMuonTrackPlotOrganizer>(nullptr, muonContainerName + "/UnmatchedRecoMuonTracks/");
149 }
150 if (!m_muonExtrapolatedTracksName.empty())
151 m_muonMETrackValidationPlots.emplace_back(std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "METrackParticles", m_isData));
154 std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "MSOnlyMETrackParticles", m_isData));
155
156 if (!m_tracksName.empty()) {
157 m_muonIDTrackValidationPlots.emplace_back(std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "IDTrackParticles", m_isData));
159 std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "IDSelectedTrackParticles", m_isData));
160 }
161 if (!m_fwdtracksName.empty())
163 std::make_unique<MuonTrackValidationPlots>(nullptr, categoryPath, "IDForwardTrackParticles", m_isData));
164
165 if (!m_muonSegmentsName.empty()) {
166 if (category != theMuonCategories.at(ALL)) continue; // cannot identify the truth origin of segments...
167 m_muonSegmentValidationPlots.emplace_back(std::make_unique<MuonSegmentValidationPlots>(nullptr, categoryPath, m_isData));
168 if (!m_isData)
170 new Muon::MuonSegmentPlots(nullptr, Form("%s/UnmatchedRecoMuonSegments/", muonContainerName.c_str())));
171 }
172 }
173
174 if (!m_isData) {
175 m_oUnmatchedRecoMuonPlots = std::make_unique<Muon::RecoMuonPlotOrganizer>(nullptr, muonContainerName +"/UnmatchedRecoMuons/");
176 m_oUnmatchedTruthMuonPlots = std::make_unique<Muon::TruthMuonPlotOrganizer>(nullptr, muonContainerName +"/UnmatchedTruthMuons/");
177 }
178
179 for (const auto& plots : m_muonValidationPlots) bookValidationPlots(*plots).ignore();
180 for (const auto& plots : m_slowMuonValidationPlots) bookValidationPlots(*plots).ignore();
181 for (const auto& plots : m_TriggerMuonValidationPlots) bookValidationPlots(*plots).ignore();
182 for (const auto& plots : m_muonIDTrackValidationPlots) bookValidationPlots(*plots).ignore();
183 for (const auto& plots : m_muonIDSelectedTrackValidationPlots) bookValidationPlots(*plots).ignore();
184 for (const auto& plots : m_muonIDForwardTrackValidationPlots) bookValidationPlots(*plots).ignore();
185 for (const auto& plots : m_muonMSTrackValidationPlots) bookValidationPlots(*plots).ignore();
186 for (const auto& plots : m_muonMETrackValidationPlots) bookValidationPlots(*plots).ignore();
187 for (const auto& plots : m_muonMSOnlyMETrackValidationPlots) bookValidationPlots(*plots).ignore();
188 if (!m_isData) {
189 bookValidationPlots(*m_oUnmatchedRecoMuonPlots).ignore();
190 bookValidationPlots(*m_oUnmatchedTruthMuonPlots).ignore();
191 if (m_oUnmatchedRecoMuonTrackPlots) bookValidationPlots(*m_oUnmatchedRecoMuonTrackPlots).ignore();
192 for (const auto& plots : m_muonSegmentValidationPlots) bookValidationPlots(*plots).ignore();
193 if (m_oUnmatchedRecoMuonSegmentPlots) bookValidationPlots(*m_oUnmatchedRecoMuonSegmentPlots).ignore();
194 }
195 // book overview hists
196 m_h_overview_Z_mass = new TH1F(Form("%s_Overview_Z_mass", muonContainerName.c_str()), "", 20, 76, 106);
197 ATH_CHECK(regHist(m_h_overview_Z_mass, Form("%s/Overview", muonContainerName.c_str()), all));
198 m_h_overview_Z_mass_ME = new TH1F(Form("%s_Overview_Z_mass_ME", muonContainerName.c_str()), "", 20, 76, 106);
199 ATH_CHECK(regHist(m_h_overview_Z_mass_ME, Form("%s/Overview", muonContainerName.c_str()), all));
200 m_h_overview_Z_mass_ID = new TH1F(Form("%s_Overview_Z_mass_ID", muonContainerName.c_str()), "", 20, 76, 106);
201 ATH_CHECK(regHist(m_h_overview_Z_mass_ID, Form("%s/Overview", muonContainerName.c_str()), all));
202
203 m_h_overview_nObjects.clear();
204 m_h_overview_nObjects.emplace_back(new TH1F(Form("%s_Overview_N_perevent_truth_muons", muonContainerName.c_str()),
205 "Number of truth Muons per event", 20, -0.5, 19.5));
206 m_h_overview_nObjects.emplace_back(
207 new TH1F(Form("%s_Overview_N_perevent_muons", muonContainerName.c_str()), "Number of Muons per event", 20, -0.5, 19.5));
208 m_h_overview_nObjects.emplace_back(
209 new TH1F(Form("%s_Overview_N_perevent_tracks", muonContainerName.c_str()), "Number of Tracks per event", 50, -0.5, 49.5));
210 m_h_overview_nObjects.emplace_back(new TH1F(Form("%s_Overview_N_perevent_truth_segments", muonContainerName.c_str()),
211 "Number of truth Segments per event", 200, -0.5, 199.5));
212 m_h_overview_nObjects.emplace_back(
213 new TH1F(Form("%s_Overview_N_perevent_segments", muonContainerName.c_str()), "Number of Segments per event", 200, -0.5, 199.5));
214 for (const auto& hist : m_h_overview_nObjects) {
215 if (hist) ATH_CHECK(regHist(hist, Form("%s/Overview", muonContainerName.c_str()), all));
216 }
217
219 new TH1F(Form("%s_Overview_reco_category", muonContainerName.c_str()), "", 4, 0, 4); // prompt/in-flight/non-isolated/other
220 for (int i = 1; i < 4; i++) { // skip 'All'
221 m_h_overview_reco_category->GetXaxis()->SetBinLabel(i, theMuonCategories.at(i).c_str());
222 }
223 m_h_overview_reco_category->GetXaxis()->SetBinLabel(4, "Other"); // of some other origin or fakes
224 ATH_CHECK(regHist(m_h_overview_reco_category, Form("%s/Overview", muonContainerName.c_str()), all));
225
226 int nAuth = static_cast<int>(xAOD::Muon::Author::NumberOfMuonAuthors);
227 for (int i = 1; i < 4; i++) {
228 m_h_overview_reco_authors.emplace_back(new TH1F((muonContainerName + "_" + theMuonCategories.at(i) + "_reco_authors").c_str(),
229 (muonContainerName + "_" + theMuonCategories.at(i) + "_reco_authors").c_str(),
230 nAuth + 1, -0.5, nAuth + 0.5));
231 }
232 m_h_overview_reco_authors.emplace_back(new TH1F((muonContainerName + "_Overview_Other_reco_authors").c_str(),
233 (muonContainerName + "_Other_reco_authors").c_str(), nAuth + 1, -0.5, nAuth + 0.5));
234
235 for (const auto& hist : m_h_overview_reco_authors) {
236 if (hist) ATH_CHECK(regHist(hist, Form("%s/Overview", muonContainerName.c_str()), all));
237 }
238
239 return StatusCode::SUCCESS;
240 }//bookHistograms*/
241
243 valPlots.initialize();
244 std::vector<HistData> hists = valPlots.retrieveBookedHistograms();
245
246 for (auto& hist : hists) {
247 TString sHistName = hist.first->GetName();
248 ATH_MSG_VERBOSE("Initializing " << hist.first << " " << sHistName << " " << hist.second << "...");
249
250 // check for histograms that are useless and skip regHist:
251 if (sHistName.Contains("momentumPulls")) {
252 if (sHistName.Contains(xAOD::Muon::toString(xAOD::Muon::Author::MuidSA).data())) continue; // empty for standalone muons
253 if (!(sHistName.Contains("Prompt") && (sHistName.Contains("AllMuons") || sHistName.Contains("SiAssocForward"))))
254 continue; // don't need binned eloss plots for separate muon types, keep only for Prompt AllMuons
255 }
256 if ((sHistName.Contains("resolution") || sHistName.Contains("pulls")) && !sHistName.Contains("Prompt"))
257 continue; // don't need resolution plots except for prompt muons
258 if (sHistName.Contains("trigger") && sHistName.Contains("wrt") && sHistName.Contains("Features")) continue;
259 modifyHistogram(hist.first);
260 ATH_CHECK(regHist(hist.first, hist.second, all));
261 }
262
263 // register trees
264 std::vector<TreeData> trees = valPlots.retrieveBookedTrees();
265 for (auto& tree : trees) {
266 std::string sTreeName = tree.first->GetName();
267 ATH_MSG_VERBOSE("Initializing " << tree.first << " " << sTreeName << " " << tree.second << "...");
268 ATH_CHECK(regTree(tree.first, tree.second, all));
269 }
270
271 return StatusCode::SUCCESS;
272 }
273
274 StatusCode MuonPhysValMonitoringTool::fillHistograms(const EventContext& ctx) {
275 ATH_MSG_DEBUG("Filling hists " << name() << "...");
276 m_vMatchedTruthMuons.clear();
277 m_vMatchedMuons.clear();
278 m_vMatchedSlowMuons.clear();
279 m_vMatchedMuonTracks.clear();
281 m_vZmumuIDTracks.clear();
282 m_vZmumuMETracks.clear();
283 m_vZmumuMuons.clear();
284 m_vEFMuons.clear();
285 m_vEFMuonsSelected.clear();
286 m_vL2SAMuons.clear();
287 m_vL2SAMuonsSelected.clear();
288 m_vL2CBMuons.clear();
289 m_vL2CBMuonsSelected.clear();
290 m_vRecoMuons.clear();
291 m_vRecoMuons_EffDen.clear();
294
295 const xAOD::EventInfo* eventInfo{nullptr};
296 ATH_CHECK(SG::get(eventInfo,m_eventInfo, ctx));
297
298 float beamSpotWeight = eventInfo->beamSpotWeight();
299
300 const xAOD::TruthParticleContainer* TruthMuons{nullptr};
301 ATH_CHECK(SG::get(TruthMuons, m_muonsTruthName, ctx));
302
303 if (!m_isData) {
304 m_h_overview_nObjects[0]->Fill(TruthMuons->size(), beamSpotWeight);
305 }
306
307 const xAOD::MuonContainer* Muons = nullptr;
308 const xAOD::SlowMuonContainer* SlowMuons{nullptr};
309 ATH_CHECK(SG::get(SlowMuons, m_slowMuonsName, ctx));
311 if (SlowMuons) {
312 ATH_MSG_DEBUG("Retrieved slow muons " << SlowMuons->size());
313 m_h_overview_nObjects[1]->Fill(SlowMuons->size(), beamSpotWeight);
314 }
315 if (Muons) {
316 ATH_MSG_DEBUG("Retrieved muons " << Muons->size());
317 m_h_overview_nObjects[1]->Fill(Muons->size(), beamSpotWeight);
318 }
319
321 // @@@ Temp hack to get the MuonSpectrometerTrackParticle (@MS Entry, not extrapolated), needed for eloss plots
322 // Remove when the link to the real MuonSpectrometerTrackParticle appears in the xAOD muon
325
326 // Do resonance selection
327 std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > pairs;
328 if (Muons) {
329 // Use iterator loop to avoid double counting
330 for (xAOD::MuonContainer::const_iterator mu1_itr = Muons->begin(); mu1_itr != Muons->end(); ++mu1_itr) {
331 const xAOD::Muon* mu1 = (*mu1_itr);
332 for (xAOD::MuonContainer::const_iterator mu2_itr = Muons->begin(); mu2_itr != mu1_itr; ++mu2_itr) {
333 const xAOD::Muon* mu2 = (*mu2_itr);
334 if (mu1->charge() * mu2->charge() >= 0) continue;
335 pairs.emplace_back(std::make_pair(mu1, mu2));
336 }
337 }
338 }
339
340 float dMmin {1e10}, mZ{0.};
341 for (std::pair<const xAOD::Muon*, const xAOD::Muon*>& x : pairs) {
342 // select best Z
343 const TLorentzVector mu1{x.first->p4()}, mu2{x.second->p4()};
344 const float M = (mu1 + mu2).M();
345 if (M < 66000. || M > 116000.) continue;
346
347 // choose the Z candidate closest to the Z pole - if multiple exist
348 float dM = std::abs(M - 91187.);
349 if (dM > dMmin) continue;
350 dMmin = dM;
351 mZ = M;
352
353 m_vZmumuMuons.clear();
354 m_vZmumuMuons.emplace_back(x.first);
355 m_vZmumuMuons.emplace_back(x.second);
356 }
357
358 if (m_vZmumuMuons.size() == 2) {
359 m_h_overview_Z_mass->Fill(mZ / 1000., beamSpotWeight);
360
361 const xAOD::TrackParticle* metr1 = m_vZmumuMuons[0]->trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
362 const xAOD::TrackParticle* metr2 = m_vZmumuMuons[1]->trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
363 if (metr1 && metr2) {
364 const TLorentzVector mu1ME{metr1->p4()}, mu2ME{metr2->p4()};
365 m_h_overview_Z_mass_ME->Fill((mu1ME + mu2ME).M() / 1000., beamSpotWeight);
366 if (m_isData) {
367 m_vZmumuMETracks.clear();
368 m_vZmumuMETracks.emplace_back(metr1);
369 m_vZmumuMETracks.emplace_back(metr2);
370 }
371 }
372
373 const xAOD::TrackParticle* tr1 = m_vZmumuMuons[0]->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
374 const xAOD::TrackParticle* tr2 = m_vZmumuMuons[1]->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
375 if (tr1 && tr2) {
376 const TLorentzVector mu1ID{tr1->p4()}, mu2ID{tr2->p4()};
377 m_h_overview_Z_mass_ID->Fill((mu1ID + mu2ID).M() / 1000., beamSpotWeight);
378 if (m_isData) {
379 m_vZmumuIDTracks.clear();
380 m_vZmumuIDTracks.emplace_back(tr1);
381 m_vZmumuIDTracks.emplace_back(tr2);
382 }
383 }
384 }
385
386 if (!m_isData) {
387 for (const auto truthMu : *TruthMuons) handleTruthMuon(truthMu, beamSpotWeight);
388 }
389
390 if (SlowMuons) {
391 for (const auto smu : *SlowMuons) {
392 if (!smu) continue;
393 const MuonLink link = smu->muonLink();
394 if (!link.isValid()) continue;
395 handleMuon(*link, smu, beamSpotWeight);
396 }
397 }
398 if (Muons) {
399 for (const xAOD::Muon* mu : *Muons) {
400 handleMuon(mu, nullptr, beamSpotWeight);
401 }
402 }
403
404 const xAOD::TrackParticleContainer* IDTracks{nullptr};
405 ATH_CHECK(SG::get(IDTracks, m_tracksName, ctx));
406 if (IDTracks) {
407 ATH_MSG_DEBUG("handling " << IDTracks->size() << " " << m_tracksName);
408 for (const auto tp : *IDTracks) handleMuonTrack(tp, xAOD::Muon::InnerDetectorTrackParticle, beamSpotWeight);
409 }
410 const xAOD::TrackParticleContainer* FwdIDTracks{nullptr};
411 ATH_CHECK(SG::get(FwdIDTracks, m_fwdtracksName, ctx));
412 if (FwdIDTracks) {
413 ATH_MSG_DEBUG("handling " << FwdIDTracks->size() << " " << m_fwdtracksName);
414 for (const auto tp : *FwdIDTracks) handleMuonTrack(tp, xAOD::Muon::InnerDetectorTrackParticle, beamSpotWeight);
415 }
416 const xAOD::TrackParticleContainer* MuonTracks{nullptr};
417 ATH_CHECK(SG::get(MuonTracks, m_muonTracksName, ctx));
418 if (MuonTracks) {
419 ATH_MSG_DEBUG("handling " << MuonTracks->size() << " " << m_muonTracksName);
420 m_h_overview_nObjects[2]->Fill(MuonTracks->size(), beamSpotWeight);
421 for (const auto tp : *MuonTracks) handleMuonTrack(tp, xAOD::Muon::MuonSpectrometerTrackParticle, beamSpotWeight);
422 }
423 const xAOD::TrackParticleContainer* MuonExtrapolatedTracks{nullptr};
424 ATH_CHECK(SG::get(MuonExtrapolatedTracks, m_muonExtrapolatedTracksName, ctx));
425 if (MuonExtrapolatedTracks) {
426 ATH_MSG_DEBUG("handling " << MuonExtrapolatedTracks->size() << " " << m_muonExtrapolatedTracksName);
427 for (const auto tp : *MuonExtrapolatedTracks)
428 handleMuonTrack(tp, xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle, beamSpotWeight);
429 }
430 const xAOD::TrackParticleContainer* MSOnlyMuonExtrapolatedTracks{nullptr};
431 ATH_CHECK(SG::get(MSOnlyMuonExtrapolatedTracks, m_muonMSOnlyExtrapolatedTracksName, ctx));
432
433 if (MSOnlyMuonExtrapolatedTracks) {
434 ATH_MSG_DEBUG("handling " << MSOnlyMuonExtrapolatedTracks->size() << " " << m_muonMSOnlyExtrapolatedTracksName);
435 for (const auto tp : *MSOnlyMuonExtrapolatedTracks)
436 handleMuonTrack(tp, xAOD::Muon::MSOnlyExtrapolatedMuonSpectrometerTrackParticle, beamSpotWeight);
437 }
438
439 const xAOD::MuonSegmentContainer* TruthMuonSegments{nullptr};
440 ATH_CHECK(SG::get(TruthMuonSegments, m_muonSegmentsTruthName, ctx));
441 if (TruthMuonSegments) {
442 m_h_overview_nObjects[3]->Fill(TruthMuonSegments->size(), beamSpotWeight);
443 ATH_MSG_DEBUG("handling " << TruthMuonSegments->size() << " " << m_muonSegmentsTruthName);
444 for (const auto truthMuSeg : *TruthMuonSegments) handleTruthMuonSegment(truthMuSeg, TruthMuons, beamSpotWeight);
445 }
446
447 const xAOD::MuonSegmentContainer* MuonSegments{nullptr};
448 ATH_CHECK(SG::get(MuonSegments, m_muonSegmentsName, ctx));
449 if (MuonSegments) {
450 m_h_overview_nObjects[4]->Fill(MuonSegments->size(), beamSpotWeight);
451 ATH_MSG_DEBUG("handling " << MuonSegments->size() << " " << m_muonSegmentsName);
452 for (const auto muSeg : *MuonSegments) handleMuonSegment(muSeg, beamSpotWeight);
453 }
454
455 //@@@@@@@@@@@@@@@@ TRIGGER MONITORING IMPLEMENTATION @@@@@@@@@@@@@@@@@
457 auto chainGroups = m_trigDec->getChainGroup("HLT_.*mu.*");
458 for (auto& trig : chainGroups->getListOfTriggers()) {
459 if (m_trigDec->isPassed(trig, TrigDefs::EF_passedRaw)) {
460 ATH_MSG_DEBUG("Chain " << trig << " is passed: YES");
461 } else
462 ATH_MSG_DEBUG("Chain " << trig << " is passed: NO");
463 }
464 auto L1chainGroups = m_trigDec->getChainGroup("L1_MU.*");
465 for (auto& L1trig : L1chainGroups->getListOfTriggers()) {
466 if (m_trigDec->isPassed(L1trig, TrigDefs::EF_passedRaw))
467 ATH_MSG_DEBUG("Chain " << L1trig << " is passed: YES");
468 else
469 ATH_MSG_DEBUG("Chain " << L1trig << " is passed: NO");
470 }
471 for (auto mu : m_vRecoMuons) {
472 if (passesAcceptanceCuts(mu) && std::abs(mu->eta()) < 2.4) {
473 if (mu->author() == xAOD::Muon::Author::MuidCo) {
474 m_vRecoMuons_EffDen_CB.emplace_back(mu);
475 ATH_MSG_DEBUG("##### m_vRecoMuons_EffDen_CB pt:" << mu->pt() << " phi:" << mu->phi() << " eta:" << mu->eta());
476 } else if (mu->author() == xAOD::Muon::Author::MuidSA) {
477 m_vRecoMuons_EffDen_MS.emplace_back(mu);
478 ATH_MSG_DEBUG("##### m_vRecoMuons_EffDen_MS pt:" << mu->pt() << " phi:" << mu->phi() << " eta:" << mu->eta());
479 }
480 }
481 }
482
483 //@@@@@ L1 @@@@@
485 const xAOD::MuonRoIContainer* L1TrigMuons{nullptr};
486 ATH_CHECK(SG::get(L1TrigMuons, m_muonL1TrigName, ctx));
487 ATH_MSG_DEBUG("Retrieved L1 triggered muons " << L1TrigMuons->size());
488 for (const auto TrigL1mu : *L1TrigMuons) handleMuonL1Trigger(TrigL1mu);
489 }
490
491 //@@@@@ L2 @@@@@
493 //@@@@@ L2SA @@@@@
494 const xAOD::L2StandAloneMuonContainer* L2SAMuons{nullptr};
495 ATH_CHECK(SG::get(L2SAMuons, m_muonL2SAName, ctx));
496 ATH_MSG_DEBUG("Retrieved L2 StandAlone triggered muons " << L2SAMuons->size());
497 if (L2SAMuons->size() != 0) {
498 for (const auto L2SAmu : *L2SAMuons) {
499 ATH_MSG_DEBUG("Muon L2SA Trigger: pt " << L2SAmu->pt() << " phi " << L2SAmu->phi() << " eta " << L2SAmu->eta()
500 << " roiWord " << L2SAmu->roiWord() << " sAddress " << L2SAmu->sAddress());
501 m_vL2SAMuons.emplace_back(L2SAmu);
502 }
503 for (const auto& mu : m_vL2SAMuons) {
504 if (mu->pt() != 0.) {
505 m_vL2SAMuonsSelected.emplace_back(mu);
506 break;
507 }
508 }
509 for (unsigned int i = 0; i < m_vL2SAMuons.size(); i++) {
510 unsigned int cont = 0;
511 for (unsigned int j = 0; j < m_vL2SAMuonsSelected.size(); j++) {
512 if (((m_vL2SAMuons.at(i)->pt()) != 0.) && ((deltaR(m_vL2SAMuonsSelected.at(j), m_vL2SAMuons.at(i))) > 0.1))
513 cont++;
514 if (cont == m_vL2SAMuonsSelected.size()) {
515 m_vL2SAMuonsSelected.emplace_back(m_vL2SAMuons.at(i));
516 break;
517 }
518 }
519 }
520 for (unsigned int i = 0; i < m_vL2SAMuonsSelected.size(); i++) { handleMuonL2Trigger(m_vL2SAMuonsSelected.at(i)); }
522 }
523 for (const auto& muonItem : m_muonItems) {
524 std::vector<Trig::Feature<xAOD::L2StandAloneMuonContainer> > vec_muons;
525 TString muonItem_str = (TString)muonItem;
526 if (muonItem_str.Contains("_OR_")) {
527 muonItem_str.ReplaceAll("_OR_", " ");
528 std::vector<std::string> v_subchains = CxxUtils::tokenize(muonItem_str, ' ');
529 for (int i = 0; i < (int)v_subchains.size(); i++) {
530 Trig::FeatureContainer fc1 = m_trigDec->features(v_subchains.at(i));
531 std::vector<Trig::Feature<xAOD::L2StandAloneMuonContainer> > vec_muons_1 =
533 for (const auto& mufeat : vec_muons_1) { vec_muons.emplace_back(mufeat); }
534 }
535 } else {
536 Trig::FeatureContainer fc = m_trigDec->features(muonItem);
537 vec_muons = fc.get<xAOD::L2StandAloneMuonContainer>();
538 }
539 ATH_MSG_DEBUG("Size of vector Trig::Feature<xAOD::L2StandAloneMuonContainer> for chain " << muonItem << " = "
540 << vec_muons.size());
541 for (const auto& mufeat : vec_muons) {
542 ATH_MSG_DEBUG(muonItem << " vec_muons.size() = " << vec_muons.size()
543 << " mufeat.cptr()->size() = " << mufeat.cptr()->size());
544 for (unsigned int i = 0; i < mufeat.cptr()->size(); i++) {
545 ATH_MSG_DEBUG("#####" << muonItem << " L2SA feature pt: " << (*mufeat.cptr())[i]->pt()
546 << " eta: " << (*mufeat.cptr())[i]->eta() << " phi: " << (*mufeat.cptr())[i]->phi());
547 }
548 }
549 }
550
551 //@@@@@ L2CB @@@@@
552
553 const xAOD::L2CombinedMuonContainer* L2CBMuons{nullptr};
554 ATH_CHECK(SG::get(L2CBMuons, m_muonL2CBName, ctx));
555 ATH_MSG_DEBUG("Retrieved L2 Combined triggered muons " << L2CBMuons->size());
556 if (L2CBMuons->size() != 0) {
557 for (const auto L2CBmu : *L2CBMuons) {
558 ATH_MSG_DEBUG("Muon L2CB Trigger: pt " << L2CBmu->pt() << " phi " << L2CBmu->phi() << " eta " << L2CBmu->eta());
559 m_vL2CBMuons.emplace_back(L2CBmu);
560 }
561 for (unsigned int i = 0; i < m_vL2CBMuons.size(); i++) {
562 if ((m_vL2CBMuons.at(i)->pt()) != 0.) {
563 m_vL2CBMuonsSelected.emplace_back(m_vL2CBMuons.at(i));
564 break;
565 }
566 }
567 for (unsigned int i = 0; i < m_vL2CBMuons.size(); i++) {
568 unsigned int cont = 0;
569 for (unsigned int j = 0; j < m_vL2CBMuonsSelected.size(); j++) {
570 if (((m_vL2CBMuons.at(i)->pt()) != 0.) && ((deltaR(m_vL2CBMuonsSelected.at(j), m_vL2CBMuons.at(i))) > 0.1))
571 cont++;
572 if (cont == m_vL2CBMuonsSelected.size()) {
573 m_vL2CBMuonsSelected.emplace_back(m_vL2CBMuons.at(i));
574 break;
575 }
576 }
577 }
578 for (unsigned int i = 0; i < m_vL2CBMuonsSelected.size(); i++) { handleMuonL2Trigger(m_vL2CBMuonsSelected.at(i)); }
580 }
581 for (const auto& muonItem : m_muonItems) {
582 std::vector<Trig::Feature<xAOD::L2CombinedMuonContainer> > vec_muons;
583 TString muonItem_str = (TString)muonItem;
584 if (muonItem_str.Contains("_OR_")) {
585 muonItem_str.ReplaceAll("_OR_", " ");
586 auto v_subchains = CxxUtils::tokenize(muonItem_str, ' ');
587 for (int i = 0; i < (int)v_subchains.size(); i++) {
588 Trig::FeatureContainer fc1 = m_trigDec->features(v_subchains.at(i));
589 std::vector<Trig::Feature<xAOD::L2CombinedMuonContainer> > vec_muons_1 =
591 for (const auto& mufeat : vec_muons_1) { vec_muons.emplace_back(mufeat); }
592 }
593 } else {
594 Trig::FeatureContainer fc = m_trigDec->features(muonItem);
595 vec_muons = fc.get<xAOD::L2CombinedMuonContainer>();
596 }
597 ATH_MSG_DEBUG("Size of vector Trig::Feature<xAOD::L2CombinedMuonContainer> for chain " << muonItem << " = "
598 << vec_muons.size());
599 for (const auto& mufeat : vec_muons) {
600 ATH_MSG_DEBUG(muonItem << " vec_muons.size() = " << vec_muons.size()
601 << " mufeat.cptr()->size() = " << mufeat.cptr()->size());
602 for (unsigned int i = 0; i < mufeat.cptr()->size(); i++) {
603 ATH_MSG_DEBUG("#####" << muonItem << " L2CB feature pt: " << (*mufeat.cptr())[i]->pt()
604 << " eta: " << (*mufeat.cptr())[i]->eta() << " phi: " << (*mufeat.cptr())[i]->phi());
605 }
606 }
607 }
608 } // close if(m_doTrigMuonL2Validation)
609
610 //@@@@@ EF @@@@@
612 const xAOD::MuonContainer* EFCombTrigMuons{nullptr};
613 const xAOD::MuonRoIContainer* L1TrigMuons{nullptr};
614 ATH_CHECK(SG::get(EFCombTrigMuons, m_muonEFCombTrigName, ctx));
615 ATH_CHECK(SG::get(L1TrigMuons, m_muonL1TrigName, ctx));
616 ATH_MSG_DEBUG("Retrieved EF triggered muons " << EFCombTrigMuons->size());
617 if (EFCombTrigMuons->size() != 0) {
618 for (const auto Trigmu : *EFCombTrigMuons) {
619 ATH_MSG_DEBUG("Muon EF Trigger: pt " << Trigmu->pt() << " phi " << Trigmu->phi() << " eta " << Trigmu->eta()
620 << " author" << Trigmu->author());
621 m_vEFMuons.emplace_back(Trigmu);
622 }
623 m_vEFMuonsSelected.emplace_back(m_vEFMuons.at(0));
624 for (unsigned int i = 0; i < m_vEFMuons.size(); i++) {
625 unsigned int cont = 0;
626 for (unsigned int j = 0; j < m_vEFMuonsSelected.size(); j++) {
627 if (deltaR(m_vEFMuonsSelected.at(j), m_vEFMuons.at(i)) > 0.1 ||
628 m_vEFMuons.at(i)->author() != m_vEFMuonsSelected.at(j)->author()){
629 cont++;
630 }
631 if (cont == m_vEFMuonsSelected.size()) {
632 m_vEFMuonsSelected.emplace_back(m_vEFMuons.at(i));
633 break;
634 }
635 }
636 }
637 for (unsigned int i = 0; i < m_vEFMuonsSelected.size(); i++) { handleMuonTrigger(m_vEFMuonsSelected.at(i)); }
639 }
640 if (!m_isData) {
641 for (const auto truthMu : *TruthMuons) {
642 ATH_MSG_DEBUG("TRUTH:: pt=" << truthMu->pt() << " eta=" << truthMu->eta() << " phi=" << truthMu->phi());
643 }
644 }
645 // handleMuonTrigger_ResoWRTTruth(m_vEFMuonsSelected,)
646 //@@@@@ chains efficiency @@@@@
647 for (const auto& muonItem : m_muonItems) {
650 if ((muonItem.find("msonly") != std::string::npos)) {
653 }
654 std::vector<Trig::Feature<xAOD::MuonContainer> > vec_muons;
655 TString muonItem_str = (TString)muonItem;
656 if (muonItem_str.Contains("_OR_")) {
657 muonItem_str.ReplaceAll("_OR_", " ");
658 auto v_subchains = CxxUtils::tokenize(muonItem_str, ' ');
659 for (int i = 0; i < (int)v_subchains.size(); i++) {
660 Trig::FeatureContainer fc1 = m_trigDec->features(v_subchains.at(i));
661 std::vector<Trig::Feature<xAOD::MuonContainer> > vec_muons_1 = fc1.get<xAOD::MuonContainer>();
662 for (const auto& mufeat : vec_muons_1) { vec_muons.emplace_back(mufeat); }
663 }
664 } else {
665 Trig::FeatureContainer fc = m_trigDec->features(muonItem);
666 vec_muons = fc.get<xAOD::MuonContainer>();
667 }
668 ATH_MSG_DEBUG("Size of vector Trig::Feature<xAOD::MuonContainer> for chain " << muonItem << " = " << vec_muons.size());
669 for (const auto& mufeat : vec_muons) {
670 ATH_MSG_DEBUG(muonItem << " vec_muons.size() = " << vec_muons.size()
671 << " mufeat.cptr()->size() = " << mufeat.cptr()->size());
672 for (unsigned int i = 0; i < mufeat.cptr()->size(); i++) {
673 ATH_MSG_DEBUG("#####" << muonItem << " EF feature pt: " << (*mufeat.cptr())[i]->pt()
674 << " eta: " << (*mufeat.cptr())[i]->eta() << " phi: " << (*mufeat.cptr())[i]->phi()
675 << " author: " << (*mufeat.cptr())[i]->author());
676 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
677 if (m_selectMuonCategories[j] == ALL) {
678 if (static_cast<int>((*mufeat.cptr())[i]->author()) == m_SelectedAuthor)
679 m_TriggerMuonValidationPlots[j]->fillFeatPlots(*(*mufeat.cptr())[i], muonItem);
680 } // if categ=ALL
681 } // categories
682 } // mufeat.cptr
683 } // mufeat
684 for (unsigned int k = 0; k < m_vRecoMuons_EffDen.size(); k++) {
685 bool break_flag = false;
686 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
687 if (m_selectMuonCategories[j] == ALL) {
688 m_TriggerMuonValidationPlots[j]->fillDenEff(*m_vRecoMuons_EffDen.at(k), muonItem);
689 }
690 }
691 for (const auto& mufeat : vec_muons) {
692 for (unsigned int i = 0; i < mufeat.cptr()->size(); i++) {
693 if ((static_cast<int>((*mufeat.cptr())[i]->author()) == m_SelectedAuthor) &&
694 (deltaR((*mufeat.cptr())[i], m_vRecoMuons_EffDen.at(k)) < 0.1)) {
695 break_flag = true;
696 ATH_MSG_DEBUG(" $$$ match Reco_EffDen "
697 << muonItem << " pt: " << m_vRecoMuons_EffDen.at(k)->pt() << " eta: "
698 << m_vRecoMuons_EffDen.at(k)->eta() << " phi: " << m_vRecoMuons_EffDen.at(k)->phi()
699 << " author: " << m_vRecoMuons_EffDen.at(k)->author());
700 ATH_MSG_DEBUG(" $$$ match EF MuidCo feature "
701 << muonItem << " pt: " << (*mufeat.cptr())[i]->pt()
702 << " eta: " << (*mufeat.cptr())[i]->eta() << " phi: " << (*mufeat.cptr())[i]->phi()
703 << " author: " << (*mufeat.cptr())[i]->author() << " rel_p "
704 << (std::abs(((*mufeat.cptr())[i]->pt() - m_vRecoMuons_EffDen.at(k)->pt()) /
705 (m_vRecoMuons_EffDen.at(k)->pt()))));
706 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
707 if (m_selectMuonCategories[j] == ALL) {
708 m_TriggerMuonValidationPlots[j]->fillNumEff(*m_vRecoMuons_EffDen.at(k), muonItem);
709 // if (muonItem=="HLT_2mu10") m_TriggerMuonValidationPlots[j]->fill(
710 // *(*mufeat.cptr())[i],*m_vRecoMuons_EffDen.at(k));
711
712 } // if categ=ALL
713 } // categories
714 break;
715 } // if(Delta_R)
716 } // mufeat
717 if (break_flag) break;
718 } // vec_muons
719 } // m_vRecoMuons_EffDen
720 } // m_muonItems
721 //@@@@@ L1 items efficiency @@@@@
722 for (const auto& L1MuonItem : m_L1MuonItems) {
725 float threshold = 0.;
726 if (L1MuonItem == "L1_MU4") threshold = 4000;
727 else if (L1MuonItem == "L1_MU6") threshold = 6000;
728 else if (L1MuonItem == "L1_MU10") threshold = 10000;
729 else if (L1MuonItem == "L1_MU11") threshold = 11000;
730 else if (L1MuonItem == "L1_MU15") threshold = 15000;
731 else if (L1MuonItem == "L1_MU20") threshold = 20000;
732 for (const auto TrigL1mu : *L1TrigMuons) {
733 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
734 if (m_selectMuonCategories[j] == ALL) {
735 if ((TrigL1mu->thrValue()) >= threshold)
736 m_TriggerMuonValidationPlots[j]->fillFeatPlots(*TrigL1mu, L1MuonItem);
737 } // if categ=ALL
738 } // categories
739 } // L1TrigMuons
740 for (unsigned int k = 0; k < m_vRecoMuons_EffDen.size(); k++) {
741 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
742 if (m_selectMuonCategories[j] == ALL) {
743 m_TriggerMuonValidationPlots[j]->fillDenL1Eff(*m_vRecoMuons_EffDen.at(k), L1MuonItem);
744 }
745 }
746 for (const auto TrigL1mu : *L1TrigMuons) {
747 if (((TrigL1mu->thrValue()) >= threshold) &&
748 (sqrt(pow(m_vRecoMuons_EffDen.at(k)->eta() - TrigL1mu->eta(), 2.) +
749 pow(m_vRecoMuons_EffDen.at(k)->phi() - TrigL1mu->phi(), 2.)) < 0.2)) {
750 ATH_MSG_DEBUG(" $$$ match Reco_EffDen "
751 << L1MuonItem << " pt: " << m_vRecoMuons_EffDen.at(k)->pt() << " eta: "
752 << m_vRecoMuons_EffDen.at(k)->eta() << " phi: " << m_vRecoMuons_EffDen.at(k)->phi()
753 << " author: " << m_vRecoMuons_EffDen.at(k)->author());
754 ATH_MSG_DEBUG(" $$$ L1 feature " << L1MuonItem << " pt: " << TrigL1mu->thrValue()
755 << " eta: " << TrigL1mu->eta() << " phi: " << TrigL1mu->phi());
756 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
757 if (m_selectMuonCategories[j] == ALL) {
758 m_TriggerMuonValidationPlots[j]->fillNumL1Eff(*m_vRecoMuons_EffDen.at(k), L1MuonItem);
759 } // if categ=ALL
760 } // categories
761 break;
762 } // if(Delta_R)
763 } // L1TrigMuons
764 } // m_vRecoMuons_EffDen
765 }
766 //@@@@@ chains efficiency w.r.t. L1 @@@@@
767 for (unsigned int m = 0; m < m_muonItems.size(); m++) {
768 std::vector<Trig::Feature<xAOD::MuonContainer> > vec_muons;
769 TString muonItem_str = (TString)m_muonItems[m];
770 if (muonItem_str.Contains("_OR_")) {
771 muonItem_str.ReplaceAll("_OR_", " ");
772 auto v_subchains = CxxUtils::tokenize(muonItem_str, ' ');
773 for (int i = 0; i < (int)v_subchains.size(); i++) {
774 Trig::FeatureContainer fc1 = m_trigDec->features(v_subchains.at(i));
775 std::vector<Trig::Feature<xAOD::MuonContainer> > vec_muons_1 = fc1.get<xAOD::MuonContainer>();
776 for (const auto& mufeat : vec_muons_1) { vec_muons.emplace_back(mufeat); }
777 }
778 } else {
780 vec_muons = fc.get<xAOD::MuonContainer>();
781 }
784 if ((m_muonItems[m].find("msonly") != std::string::npos)) {
787 }
788 float threshold = 0.;
789 if (m_L1Seed[m] == "L1_MU4") threshold = 4000;
790 if (m_L1Seed[m] == "L1_MU6") threshold = 6000;
791 if (m_L1Seed[m] == "L1_MU10") threshold = 10000;
792 if (m_L1Seed[m] == "L1_MU11") threshold = 11000;
793 if (m_L1Seed[m] == "L1_MU15") threshold = 15000;
794 if (m_L1Seed[m] == "L1_MU20") threshold = 20000;
795 for (unsigned int k = 0; k < m_vRecoMuons_EffDen.size(); k++) {
796 bool break_flag = false;
797 for (const auto TrigL1mu : *L1TrigMuons) {
798 if (((TrigL1mu->thrValue()) >= threshold) &&
799 (sqrt(pow(m_vRecoMuons_EffDen.at(k)->eta() - TrigL1mu->eta(), 2.) +
800 pow(m_vRecoMuons_EffDen.at(k)->phi() - TrigL1mu->phi(), 2.)) < 0.2)) {
801 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
802 if (m_selectMuonCategories[j] == ALL) {
804 } // if categ=ALL
805 } // categories
806 for (const auto& mufeat : vec_muons) {
807 for (unsigned int i = 0; i < mufeat.cptr()->size(); i++) {
808 if ((static_cast<int>((*mufeat.cptr())[i]->author()) == m_SelectedAuthor) &&
809 (deltaR((*mufeat.cptr())[i], m_vRecoMuons_EffDen.at(k)) < 0.1)) {
810 break_flag = true;
811 for (unsigned int j = 0; j < m_selectMuonCategories.size(); j++) {
812 if (m_selectMuonCategories[j] == ALL) {
813 m_TriggerMuonValidationPlots[j]->fillNumRELEff(*m_vRecoMuons_EffDen.at(k),
814 m_muonItems[m]);
815 } // if categ=ALL
816 } // categories
817 break;
818 } // if(Delta_R)
819 } // mufeat
820 if (break_flag) break;
821 } // vec_muons
822 break;
823 } // if(Delta_R)
824 } // L1TrigMuons
825 } // m_vRecoMuons_EffDen
826 } // m_muonItems.size()
827 } // m_doTrigMuonEFValidation
828 }
829 return StatusCode::SUCCESS;
830 }//fillHistograms()*/
831
833 const xAOD::TruthParticleContainer* /*muonTruthContainer*/, float weight) {
834 const xAOD::MuonSegment* muSeg = findRecoMuonSegment(truthMuSeg);
836
837 unsigned int thisMuonCategory = ALL; // getMuonSegmentTruthCategory(truthMuSeg, muonTruthContainer) @@@ Does not work...
838
839 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
840 if (m_selectMuonCategories[i] == ALL || m_selectMuonCategories[i] == thisMuonCategory) {
841 m_muonSegmentValidationPlots[i]->fill(truthMuSeg, muSeg,
842 weight); // if no reco muon segment is found a protection inside
843 // MuonSegmentValidationPlots will ensure, its plots won't be filled
844 }
845 }
846 }
847
849 if (!muSeg) {
850 ATH_MSG_WARNING("No muon segment found");
851 return;
852 }
853 if (std::find(std::begin(m_vMatchedMuonSegments), std::end(m_vMatchedMuonSegments), muSeg) != std::end(m_vMatchedMuonSegments))
854 return;
855 if (!m_isData) m_oUnmatchedRecoMuonSegmentPlots->fill(*muSeg, weight);
856 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
857 if (m_selectMuonCategories[i] == ALL) {
858 m_muonSegmentValidationPlots[i]->fill(muSeg, weight);
859 break;
860 }
861 }
862 }
863
864 void MuonPhysValMonitoringTool::handleMuon(const xAOD::Muon* mu, const xAOD::SlowMuon* smu, float weight) {
865 if (!mu) return;
866
867 if (msgLvl(MSG::DEBUG)) printMuonDebug(mu);
868
869 // make deep copy of muon and decorate with quality
870 std::unique_ptr<xAOD::Muon> mu_c;
871 try {
872 mu_c = getCorrectedMuon(*mu);
873 } catch (const SG::ExcBadAuxVar&) {
874 ATH_MSG_ERROR("Cannot retrieve aux-item - rejecting muon");
875 return;
876 }
877
878 if (m_isData) {
879 MUCATEGORY thisMuonCategory = ALL;
880 // for events with a Zmumu candidate, separate Z muons from the rest:
881 if (m_vZmumuMuons.size() > 0) {
882 thisMuonCategory = REST;
883 if (std::find(m_vZmumuMuons.begin(), m_vZmumuMuons.end(), mu) != m_vZmumuMuons.end()) { thisMuonCategory = PROMPT; }
884 }
885 // fill plots
886 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
887 if (m_selectMuonCategories[i] == ALL or m_selectMuonCategories[i] == thisMuonCategory) {
888 if (mu_c){
889 // histos
890 m_muonValidationPlots[i]->fill(*mu_c, weight);
891 if (smu) m_slowMuonValidationPlots[i]->fill(*smu, *mu_c, weight);
892 }
893 }
894 }
895 }
896
898 // SELECT MUON MEDIUM QUALITY FOR TRIGGER VALIDATION
899 xAOD::Muon::Quality my_quality = m_muonSelectionTool->getQuality(*mu_c);
900 if (my_quality <= xAOD::Muon::Quality::Medium && m_isoTool->accept(*mu_c)) m_vRecoMuons.emplace_back(mu);
902
903 if (smu) {
904 if (std::find(std::begin(m_vMatchedSlowMuons), std::end(m_vMatchedSlowMuons), smu) != std::end(m_vMatchedSlowMuons)) { return; }
905 } else {
906 if (std::find(std::begin(m_vMatchedMuons), std::end(m_vMatchedMuons), mu) != std::end(m_vMatchedMuons)) { return; }
907 }
908
909 // unmatched reco muons (not matched with any kind of truth particle, fakes)
910 if (!m_isData) m_oUnmatchedRecoMuonPlots->fill(*mu_c, weight);
911
912 m_h_overview_reco_category->Fill("Other", weight);
913 m_h_overview_reco_authors[3]->Fill(static_cast<int>(mu->author()), weight);
914
915 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
916 if (m_selectMuonCategories[i] == ALL) {
917 if (mu_c){// histos
918 m_muonValidationPlots[i]->fill(*mu_c);
919 if (smu) m_slowMuonValidationPlots[i]->fill(*smu, *mu_c, weight);
920 break;
921 }
922 }
923 }
924 }
925
927 const xAOD::SlowMuon* smu = nullptr;
928 const xAOD::Muon* mu = nullptr;
929 if (!m_slowMuonsName.empty()) {
930 smu = findRecoSlowMuon(truthMu);
931 if (smu) {
932 const MuonLink muLink = smu->muonLink();
933 if (muLink.isValid()) mu = *muLink;
934
935 if (!mu) {
936 ATH_MSG_WARNING("Found SlowMuon without valid muon link");
937 smu = nullptr;
938 }
939 }
940 } else {
941 mu = findRecoMuon(truthMu);
942 }
943
944 if (msgLvl(MSG::DEBUG)) printTruthMuonDebug(truthMu, mu);
945 if (!passesAcceptanceCuts(truthMu)) return;
946
947 std::unique_ptr<xAOD::Muon> mu_c;
948 if (mu) {
949 try {
950 mu_c = getCorrectedMuon(*mu);
951 } catch (const SG::ExcBadAuxVar&) {
952 ATH_MSG_ERROR("Cannot retrieve aux-item - rejecting muon");
953 return;
954 }
955 }
956
957 unsigned int thisMuonCategory = getMuonTruthCategory(truthMu);
958 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
959 if (m_selectMuonCategories[i] == ALL || m_selectMuonCategories[i] == thisMuonCategory) {
960 // histos
961 m_muonValidationPlots[i]->fill(
962 truthMu, mu_c.get(), m_MSTracks,
963 weight); // if no muon is found a protection inside MuonValidationPlots will ensure, its plots won't be filled
964 if (!m_slowMuonsName.empty()) m_slowMuonValidationPlots[i]->fill(truthMu, smu, mu_c.get(), weight);
965 }
966 }
967 if (mu_c) {
968 m_h_overview_reco_category->Fill(thisMuonCategory - 1, weight);
969 m_h_overview_reco_authors[thisMuonCategory - 1]->Fill(static_cast<int>(mu_c->author()), weight);
970 } else if (!m_isData)
971 m_oUnmatchedTruthMuonPlots->fill(*truthMu, weight);
972 }
973
974 void MuonPhysValMonitoringTool::handleMuonTrack(const xAOD::TrackParticle* tp, xAOD::Muon::TrackParticleType type, float weight) {
975 if (!tp) {
976 ATH_MSG_WARNING("No track particle found");
977 return;
978 }
979
980 // if ID track, check that it passes standard combined mu reco selections
981 bool passesMuonTrackSel = false;
982 if (type == xAOD::Muon::InnerDetectorTrackParticle) { passesMuonTrackSel = m_trackSelector->decision(*tp); }
983
984 if (m_isData) {
985 if (type == xAOD::Muon::InnerDetectorTrackParticle) {
986 MUCATEGORY thisTrkCategory = ALL;
987 // for events with a Zmumu candidate, separate Z muon tracks from the rest:
988 if (m_vZmumuIDTracks.size() > 0) {
989 thisTrkCategory = REST;
990 for (const auto& zmu : m_vZmumuIDTracks) {
991 if (deltaR(zmu, tp) < 0.01) {
992 thisTrkCategory = PROMPT;
993 break;
994 }
995 }
996 }
997
998 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
999 if (m_selectMuonCategories[i] == ALL || m_selectMuonCategories[i] == thisTrkCategory) {
1000 m_muonIDTrackValidationPlots[i]->fill(*tp, weight);
1001 if (passesMuonTrackSel) m_muonIDSelectedTrackValidationPlots[i]->fill(*tp, weight);
1002 }
1003 }
1004 } else if (type == xAOD::Muon::MuonSpectrometerTrackParticle)
1005 m_muonMSTrackValidationPlots[ALL]->fill(*tp, weight);
1006 else if (type == xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle)
1007 m_muonMETrackValidationPlots[ALL]->fill(*tp, weight);
1008 else if (type == xAOD::Muon::MSOnlyExtrapolatedMuonSpectrometerTrackParticle)
1009 m_muonMSOnlyMETrackValidationPlots[ALL]->fill(*tp, weight);
1010
1011 return;
1012 }
1013
1014 static const SG::ConstAccessor<TruthLink> truthParticleLinkAcc("truthParticleLink");
1015 TruthLink truthLink = truthParticleLinkAcc.withDefault(*tp, TruthLink());
1016
1017 if (!truthLink.isValid()) {
1018 ATH_MSG_DEBUG("No truth link available");
1019 if (type == xAOD::Muon::InnerDetectorTrackParticle) return;
1020 if (!passesAcceptanceCuts(tp)) return;
1021
1022 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1023 if (m_selectMuonCategories[i] == ALL) {
1024 // ID track plots for any track
1025 // if (type==xAOD::Muon::InnerDetectorTrackParticle) {
1026 // m_muonIDTrackValidationPlots[i]->fill(*tp);
1027 // if (passesMuonTrackSel) m_muonIDSelectedTrackValidationPlots[i]->fill(*tp);
1028 // } else
1029 if (type == xAOD::Muon::MuonSpectrometerTrackParticle) {
1030 if (!m_isData) m_oUnmatchedRecoMuonTrackPlots->fill(*tp, weight);
1031 m_muonMSTrackValidationPlots[i]->fill(*tp, weight);
1032 } else if (type == xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle) {
1033 m_muonMETrackValidationPlots[i]->fill(*tp, weight);
1034 } else if (type == xAOD::Muon::MSOnlyExtrapolatedMuonSpectrometerTrackParticle) {
1035 m_muonMSOnlyMETrackValidationPlots[i]->fill(*tp, weight);
1036 }
1037 break;
1038 }
1039 }
1040 } // end if no valid truth link
1041 else { // here: valid truth link and truthType
1042
1043 if (type ==
1044 xAOD::Muon::InnerDetectorTrackParticle) { // don't fill histograms for any ID track, only for muons; buys a lot of time
1045 if ((*truthLink)->absPdgId() != 13 || !MC::isStable(*truthLink)) return; // not a muon
1046 if (HepMC::uniqueID(*truthLink) == HepMC::UNDEFINED_ID || HepMC::is_simulation_particle((*truthLink))) return; // must have valid barcode
1047 }
1048
1049 if (!passesAcceptanceCuts(*truthLink)) return;
1050 unsigned int thisMuonCategory = getMuonTruthCategory(tp);
1051
1052 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1053 if (m_selectMuonCategories[i] == ALL || m_selectMuonCategories[i] == thisMuonCategory) {
1054 if (type == xAOD::Muon::InnerDetectorTrackParticle) {
1055 if (!m_fwdtracksName.empty() && std::abs((*truthLink)->eta()) > 2.5)
1056 m_muonIDForwardTrackValidationPlots[i]->fill(*truthLink, tp, weight);
1057 else if (!m_tracksName.empty()) {
1058 m_muonIDTrackValidationPlots[i]->fill(*truthLink, tp, weight);
1059 if (passesMuonTrackSel) m_muonIDSelectedTrackValidationPlots[i]->fill(*truthLink, tp, weight);
1060 }
1061 } else if (type == xAOD::Muon::MuonSpectrometerTrackParticle) {
1062 m_muonMSTrackValidationPlots[i]->fill(*truthLink, tp, weight);
1063 } else if (type == xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle) {
1064 m_muonMETrackValidationPlots[i]->fill(*truthLink, tp, weight);
1065 } else if (type == xAOD::Muon::MSOnlyExtrapolatedMuonSpectrometerTrackParticle) {
1066 m_muonMSOnlyMETrackValidationPlots[i]->fill(*truthLink, tp, weight);
1067 }
1068 }
1069 }
1070 }
1071
1072 return;
1073 }
1074
1076 ATH_MSG_DEBUG("MuonRoI L1 Trigger: ptThr " << TrigL1mu->thrValue() << " phi " << TrigL1mu->phi() << " eta " << TrigL1mu->eta());
1077 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1078 if (m_selectMuonCategories[i] == ALL) {
1079 m_TriggerMuonValidationPlots[i]->fill(*TrigL1mu);
1080 break;
1081 }
1082 }
1083 }
1084
1086 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1087 if (m_selectMuonCategories[i] == ALL) {
1088 m_TriggerMuonValidationPlots[i]->fill(*L2SAMu);
1089 break;
1090 }
1091 }
1092 ATH_MSG_DEBUG(" ==> Geometrical selection of Muon L2SA Trigger : pt " << L2SAMu->pt() << " phi " << L2SAMu->phi() << " eta "
1093 << L2SAMu->eta() << " roiWord " << L2SAMu->roiWord()
1094 << " sAddress " << L2SAMu->sAddress());
1095 }
1096
1098 int k_L2SAMu_MinDeltaR = -1;
1099 float MinDeltaR = 0.;
1100 ATH_MSG_DEBUG(" m_vL2SAMuons.size()" << m_vL2SAMuons.size());
1101 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1102 ATH_MSG_DEBUG(":: TEST: listing all Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta() << " phi="
1103 << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1104 }
1105 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1106 if ((m_vRecoMuons.at(i)->author() != xAOD::Muon::Author::MuidCo) || (std::abs(m_vRecoMuons.at(i)->eta()) > 2.4)) continue;
1107 ATH_MSG_DEBUG(":::: TEST: Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta()
1108 << " phi=" << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1109 k_L2SAMu_MinDeltaR = -1;
1110 MinDeltaR = 1000;
1111 ATH_MSG_DEBUG("==============>>>> k_L2SAMu_MinDeltaR=" << k_L2SAMu_MinDeltaR << " MinDeltaR" << MinDeltaR);
1112 for (unsigned int k = 0; k < m_vL2SAMuons.size(); k++) {
1113 ATH_MSG_DEBUG(" :::::::: TEST: L2SA pt=" << m_vL2SAMuons.at(k)->pt() << " eta=" << m_vL2SAMuons.at(k)->eta()
1114 << " phi=" << m_vL2SAMuons.at(k)->phi()
1115 << " DeltaR=" << deltaR(m_vRecoMuons.at(i), m_vL2SAMuons.at(k)));
1116 if ((deltaR(m_vRecoMuons.at(i), m_vL2SAMuons.at(k)) < 0.1 &&
1117 (deltaR(m_vRecoMuons.at(i), m_vL2SAMuons.at(k)) < MinDeltaR))) {
1118 k_L2SAMu_MinDeltaR = k;
1119 MinDeltaR = deltaR(m_vRecoMuons.at(i), m_vL2SAMuons.at(k));
1120 ATH_MSG_DEBUG("==============>>>> taken!!!! k_L2SAMu_MinDeltaR=" << k_L2SAMu_MinDeltaR << " MinDeltaR"
1121 << MinDeltaR);
1122 }
1123 }
1124 if (k_L2SAMu_MinDeltaR == -1) continue;
1125 for (unsigned int c = 0; c < m_selectMuonCategories.size(); c++) {
1126 if (m_selectMuonCategories[c] == ALL) {
1127 m_TriggerMuonValidationPlots[c]->fill(*m_vL2SAMuons.at(k_L2SAMu_MinDeltaR), *m_vRecoMuons.at(i));
1128 }
1129 }
1130 }
1131 }
1132
1134 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1135 if (m_selectMuonCategories[i] == ALL) {
1136 m_TriggerMuonValidationPlots[i]->fill(*L2CBMu);
1137 break;
1138 }
1139 }
1140 ATH_MSG_DEBUG(" ==> Geometrical selection of Muon L2CB Trigger : pt " << L2CBMu->pt() << " phi " << L2CBMu->phi() << " eta "
1141 << L2CBMu->eta());
1142 }
1143
1145 int k_L2CBMu_MinDeltaR = -1;
1146 float MinDeltaR = 0.;
1147 ATH_MSG_DEBUG(" m_vL2CBMuons.size()" << m_vL2CBMuons.size());
1148 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1149 ATH_MSG_DEBUG(":: TEST: listing all Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta() << " phi="
1150 << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1151 }
1152 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1153 if ((m_vRecoMuons.at(i)->author() != xAOD::Muon::Author::MuidCo) || (std::abs(m_vRecoMuons.at(i)->eta()) > 2.4)) continue;
1154 ATH_MSG_DEBUG(":::: TEST: Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta()
1155 << " phi=" << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1156 k_L2CBMu_MinDeltaR = -1;
1157 MinDeltaR = 1000;
1158 ATH_MSG_DEBUG("==============>>>> k_L2CBMu_MinDeltaR=" << k_L2CBMu_MinDeltaR << " MinDeltaR" << MinDeltaR);
1159 for (unsigned int k = 0; k < m_vL2CBMuons.size(); k++) {
1160 ATH_MSG_DEBUG(" :::::::: TEST: L2CB pt=" << m_vL2CBMuons.at(k)->pt() << " eta=" << m_vL2CBMuons.at(k)->eta()
1161 << " phi=" << m_vL2CBMuons.at(k)->phi()
1162 << " DeltaR=" << deltaR(m_vRecoMuons.at(i), m_vL2CBMuons.at(k)));
1163 if ((deltaR(m_vRecoMuons.at(i), m_vL2CBMuons.at(k)) < 0.1 &&
1164 (deltaR(m_vRecoMuons.at(i), m_vL2CBMuons.at(k)) < MinDeltaR))) {
1165 k_L2CBMu_MinDeltaR = k;
1166 MinDeltaR = deltaR(m_vRecoMuons.at(i), m_vL2CBMuons.at(k));
1167 ATH_MSG_DEBUG("==============>>>> taken!!!! k_L2CBMu_MinDeltaR=" << k_L2CBMu_MinDeltaR << " MinDeltaR"
1168 << MinDeltaR);
1169 }
1170 }
1171 if (k_L2CBMu_MinDeltaR == -1) continue;
1172 for (unsigned int c = 0; c < m_selectMuonCategories.size(); c++) {
1173 if (m_selectMuonCategories[c] == ALL) {
1174 m_TriggerMuonValidationPlots[c]->fill(*m_vL2CBMuons.at(k_L2CBMu_MinDeltaR), *m_vRecoMuons.at(i));
1175 }
1176 }
1177 }
1178 }
1179
1181 for (unsigned int i = 0; i < m_selectMuonCategories.size(); i++) {
1182 if (m_selectMuonCategories[i] == ALL) {
1183 m_TriggerMuonValidationPlots[i]->fill(*EFMu);
1184 break;
1185 }
1186 }
1187 ATH_MSG_DEBUG("==> Geometrical selection of EF Trigger muons: pt " << EFMu->pt() << " phi " << EFMu->phi() << " eta " << EFMu->eta()
1188 << " author " << EFMu->author());
1189 }
1190
1192 int k_EFMu_MinDeltaR = -1;
1193 float MinDeltaR = 0.;
1194 std::vector<int> vAvailableAuthors;
1195
1196 vAvailableAuthors.emplace_back(static_cast<int>(m_vEFMuons[0]->author()));
1197 unsigned int iter = 0;
1198 for (unsigned int k = 0; k < m_vEFMuons.size(); k++) {
1199 iter = 0;
1200 for (unsigned int l = 0; l < vAvailableAuthors.size(); l++) {
1201 if (static_cast<int>(m_vEFMuons[k]->author()) != vAvailableAuthors[l]) iter++;
1202 }
1203 if (iter == vAvailableAuthors.size()) vAvailableAuthors.emplace_back(
1204 static_cast<int>(m_vEFMuons[k]->author()));
1205 }
1206 ATH_MSG_DEBUG(" m_vEFMuons.size()" << m_vEFMuons.size());
1207 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1208 ATH_MSG_DEBUG(":: TEST: listing all Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta() << " phi="
1209 << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1210 }
1211 for (unsigned int i = 0; i < m_vRecoMuons.size(); i++) {
1212 if ((m_vRecoMuons.at(i)->author() != xAOD::Muon::Author::MuidCo) || (std::abs(m_vRecoMuons.at(i)->eta()) > 2.4)) continue;
1213 ATH_MSG_DEBUG(":::: TEST: Recomu pt=" << m_vRecoMuons.at(i)->pt() << " eta=" << m_vRecoMuons.at(i)->eta()
1214 << " phi=" << m_vRecoMuons.at(i)->phi() << " auth=" << m_vRecoMuons.at(i)->author());
1215 for (unsigned int l = 0; l < vAvailableAuthors.size(); l++) {
1216 k_EFMu_MinDeltaR = -1;
1217 MinDeltaR = 1000;
1218 for (unsigned int k = 0; k < m_vEFMuons.size(); k++) {
1219 ATH_MSG_DEBUG(" :::::::: TEST: EF pt=" << m_vEFMuons.at(k)->pt() << " eta=" << m_vEFMuons.at(k)->eta()
1220 << " phi=" << m_vEFMuons.at(k)->phi()
1221 << " DeltaR=" << deltaR(m_vRecoMuons.at(i), m_vEFMuons.at(k))
1222 << " author=" << m_vEFMuons.at(k)->author());
1223 if (static_cast<int>(m_vEFMuons.at(k)->author()) == vAvailableAuthors.at(l) &&
1224 (deltaR(m_vRecoMuons.at(i), m_vEFMuons.at(k)) < 0.1 &&
1225 (deltaR(m_vRecoMuons.at(i), m_vEFMuons.at(k)) < MinDeltaR))) {
1226 k_EFMu_MinDeltaR = k;
1227 MinDeltaR = deltaR(m_vRecoMuons.at(i), m_vEFMuons.at(k));
1228 }
1229 }
1230 if (k_EFMu_MinDeltaR == -1) continue;
1231 for (unsigned int c = 0; c < m_selectMuonCategories.size(); c++) {
1232 if (m_selectMuonCategories[c] == ALL) {
1233 m_TriggerMuonValidationPlots[c]->fill(*m_vEFMuons.at(k_EFMu_MinDeltaR), *m_vRecoMuons.at(i));
1234 }
1235 }
1236 }
1237 }
1238 }
1239
1241 const xAOD::TrackParticle* tp = mu->trackParticle(xAOD::Muon::TrackParticleType::Primary);
1242 static const SG::ConstAccessor<TruthLink> truthParticleLinkAcc("truthParticleLink");
1243 TruthLink truthLink;
1244 if (tp) {
1245 truthLink = truthParticleLinkAcc.withDefault(*tp, TruthLink());
1246 }
1247 ATH_MSG_DEBUG("Muon: pt " << mu->pt() << " eta " << mu->eta() << " link " << truthLink.isValid());
1248 }
1249
1251 static const SG::ConstAccessor<MuonLink> acc_muon("recoMuonLink");
1252 if (!acc_muon.isAvailable(*truthMu)) return nullptr;
1253 MuonLink link = acc_muon(*truthMu);
1254 if (!link.isValid()) return nullptr;
1255 const xAOD::Muon* reco_mu = (*link);
1256 m_vMatchedMuons.emplace_back(reco_mu);
1257 return reco_mu;
1258 }
1259
1261 const xAOD::SlowMuonContainer* SlowMuons = nullptr;
1262 SG::get(SlowMuons, m_slowMuonsName, Gaudi::Hive::currentContext()).ignore();
1263 if (!SlowMuons) return nullptr;
1264 for (const auto smu : *SlowMuons) {
1265 const MuonLink muLink = smu->muonLink();
1266 if (!muLink.isValid()) continue;
1267 float DR = deltaR(*muLink , truthMu);
1268 if (DR < 0.005) {
1269 m_vMatchedSlowMuons.emplace_back(smu);
1270 return smu;
1271 }
1272 }
1273
1274 return nullptr;
1275 }
1276
1278 ATH_MSG_DEBUG("Truth muon: " << truthMu->pt() << " eta " << truthMu->eta());
1279 if (!mu) return;
1280 ATH_MSG_DEBUG("Reco muon: " << mu->pt() << " eta " << mu->eta());
1281 }
1282
1284 ATH_MSG_INFO("Finalising hists " << name() << "...");
1285 for (const auto& plots : m_muonValidationPlots) plots->finalize();
1286 for (const auto& plots : m_TriggerMuonValidationPlots) plots->finalize();
1287 if (!m_isData) {
1288 m_oUnmatchedRecoMuonPlots->finalize();
1289 m_oUnmatchedTruthMuonPlots->finalize();
1290 }
1291
1292 for (const auto& plots : m_muonMSTrackValidationPlots) plots->finalize();
1293 for (const auto& plots : m_muonMETrackValidationPlots) plots->finalize();
1294 for (const auto& plots : m_muonMSOnlyMETrackValidationPlots) plots->finalize();
1295 for (const auto& plots : m_muonIDTrackValidationPlots) plots->finalize();
1296 for (const auto& plots : m_muonIDSelectedTrackValidationPlots) plots->finalize();
1297 for (const auto& plots : m_muonIDForwardTrackValidationPlots) plots->finalize();
1298 if (!m_isData)
1300
1301 for (const auto& plots : m_muonSegmentValidationPlots) plots->finalize();
1302 if (!m_isData)
1304
1305 return StatusCode::SUCCESS;
1306 }//procHistograms*/
1307
1309 static const SG::ConstAccessor<MuonSegmentLink> recoSegmentLinkAcc("recoSegmentLink");
1310 if (!recoSegmentLinkAcc.isAvailable(*truthMuSeg)) {
1311 ATH_MSG_DEBUG("recoSegmentLink not found");
1312 return nullptr;
1313 }
1314 MuonSegmentLink link = recoSegmentLinkAcc(*truthMuSeg);
1315 if (!link.isValid()) {
1316 ATH_MSG_DEBUG("recoSegmentLink not valid");
1317 return nullptr;
1318 }
1319 m_vMatchedMuonSegments.emplace_back(*link);
1320 return (*link);
1321 }
1322
1323 TH1F* MuonPhysValMonitoringTool::findHistogram(const std::vector<HistData>& hists, const std::string& hnameTag,
1324 const std::string& hdirTag, const std::string& hNewName) {
1325 TH1F* h = nullptr;
1326 for (const auto& hist : hists) {
1327 if (hist.second.find(hdirTag) != std::string::npos || hdirTag.empty()) {
1328 std::string histname = hist.first->GetName();
1329 if (histname.find(hnameTag) != std::string::npos) {
1330 h = (TH1F*)hist.first->Clone(hNewName.c_str());
1331 return h;
1332 }
1333 }
1334 }
1335 return h;
1336 }
1337
1339 const xAOD::MuonSegment* truthMuSeg, const xAOD::TruthParticleContainer* muonTruthContainer) {
1340 static const SG::ConstAccessor<TruthLink> truthParticleLinkAcc("truthParticleLink");
1341 TruthLink truthLink;
1342 if (truthParticleLinkAcc.isAvailable(*truthMuSeg)) {
1343 truthLink = truthParticleLinkAcc(*truthMuSeg);
1344 if (truthLink.isValid()) {
1345 const int theUniqueID = HepMC::uniqueID(*truthLink);
1346 if (std::abs((*truthLink)->pdgId()) != 13) return REST;
1347
1348 for (const auto muTruthPart : *muonTruthContainer) {
1349 if ( HepMC::uniqueID(muTruthPart) == theUniqueID ) { return getMuonTruthCategory(muTruthPart); }
1350 }
1351 }
1352 } else
1353 ATH_MSG_WARNING("No truth link available for muon truth segment");
1354
1355 return REST;
1356 }
1357
1359 static const SG::ConstAccessor<int> truthTypeAcc("truthType");
1360 static const SG::ConstAccessor<int> truthOriginAcc("truthOrigin");
1361 int truthType = truthTypeAcc(*mu);
1362 if (truthType == 6)
1363 return PROMPT;
1364 else if (truthType == 8 && (truthOriginAcc(*mu) == 34 || truthOriginAcc(*mu) == 35))
1365 return INFLIGHT;
1366 else if (truthType == 7)
1367 return NONISO;
1368 return REST;
1369 }
1370
1371 std::unique_ptr<xAOD::Muon> MuonPhysValMonitoringTool::getCorrectedMuon(const xAOD::Muon& mu) {
1372 std::unique_ptr<xAOD::Muon> mu_c;
1373 if (mu.m() <= 0) return mu_c;
1374 mu_c = std::make_unique<xAOD::Muon>();
1375 mu_c->makePrivateStore(mu);
1376
1377 // add decorations too fool the muon selector tool
1378 const xAOD::TrackParticle* idtrk{mu_c->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)};
1379 const xAOD::TrackParticle* metrk{mu_c->trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle)};
1380 if (idtrk && metrk) {
1381 const static SG::Decorator<float> InnerDetectorPtDec("InnerDetectorPt");
1382 const static SG::Decorator<float> MuonSpectrometerPtDec("MuonSpectrometerPt");
1383 InnerDetectorPtDec(*mu_c) = idtrk->pt();
1384 MuonSpectrometerPtDec(*mu_c) = metrk->pt();
1385 }
1386 m_muonSelectionTool->setQuality(*mu_c);
1387 m_muonSelectionTool->setPassesIDCuts(*mu_c);
1388 return mu_c;
1389 }
1390
1392 std::string histname = hist->GetName();
1393
1394 if(m_muonsName.key() == "Muons"){
1395 if (histname.find("parameters_z0") != std::string::npos) {
1396 hist->GetXaxis()->Set(80, -200., 200.);
1397 }
1398 if (histname.find("parameters_d0") != std::string::npos && histname.find("parameters_d0_small") == std::string::npos) {
1399 hist->GetXaxis()->Set(80, -1., 1.);
1400 hist->GetYaxis()->SetTitle("Entries / 0.025 mm");
1401 }
1402 } else if(m_muonsName.key() == "MuonsLRT"){
1403 if (histname.find("parameters_d0") != std::string::npos && histname.find("parameters_d0_small") == std::string::npos) {
1404 hist->Rebin(100);
1405 hist->GetYaxis()->SetTitle("Entries / 2.5 mm");
1406 }
1407 }
1408
1409
1410 if (histname.find("trigger_L1_pt") != std::string::npos) { // if (histname=="Muons_All_trigger_L1_pt"){
1411 hist->SetTitle("L1Trigger Muons pt threshold");
1412 hist->GetXaxis()->SetTitle("L1Trigger Muons pt threshold [GeV]");
1413 hist->GetXaxis()->Set(30, -0.5, 29.5);
1414 }
1415 if (histname.find("trigger_L1_eta_pt") != std::string::npos) { // if (histname=="Muons_All_trigger_L1_eta_pt") {
1416 hist->SetTitle("L1Trigger Muons pt threshold vs eta");
1417 hist->GetYaxis()->Set(90, -0.5, 29.5);
1418 hist->GetYaxis()->SetTitle("L1Trigger Muons pt threshold [GeV]");
1419 }
1420
1421 if (histname.find("trigger") != std::string::npos &&
1422 ((histname.find("Denom_pt") != std::string::npos) || (histname.find("Numer_pt") != std::string::npos) ||
1423 (histname.find("Features_pt") != std::string::npos)))
1424 hist->GetXaxis()->Set(200, 0., 200.);
1425
1426 if (histname.find("hits") != std::string::npos) {
1427 if (histname.find("etaLayer2") != std::string::npos)
1428 hist->GetXaxis()->Set(15, -0.5, 14.5);
1429 else if (histname.find("etaLayer") != std::string::npos)
1430 hist->GetXaxis()->Set(11, -0.5, 10.5);
1431 }
1432
1434 bool is2D = !(histname.find("_vs_") == std::string::npos);
1436
1437 if (histname.find("METrackParticles") != std::string::npos) {
1438 if (histname.find("Res_eta") != std::string::npos) {
1439 if (is2D)
1440 hist->GetYaxis()->Set(50, -0.025, 0.025);
1441 else
1442 hist->GetXaxis()->Set(50, -0.025, 0.025);
1443 } else if (histname.find("Res_phi") != std::string::npos) {
1444 if (is2D)
1445 hist->GetYaxis()->Set(50, -0.02, 0.02);
1446 else
1447 hist->GetXaxis()->Set(50, -0.02, 0.02);
1448 }
1449 } else if (histname.find("MSTrackParticles") != std::string::npos) {
1450 if (histname.find("Res_eta") != std::string::npos) {
1451 if (is2D)
1452 hist->GetYaxis()->Set(50, -0.025, 0.025);
1453 else
1454 hist->GetXaxis()->Set(50, -0.025, 0.025);
1455 } else if (histname.find("Res_phi") != std::string::npos) {
1456 if (is2D)
1457 hist->GetYaxis()->Set(50, -0.05, 0.05);
1458 else
1459 hist->GetXaxis()->Set(50, -0.05, 0.05);
1460 }
1461 } else {
1462 if (histname.find("Res_eta") != std::string::npos) {
1463 if (is2D)
1464 hist->GetYaxis()->Set(50, -0.005, 0.005);
1465 else
1466 hist->GetXaxis()->Set(50, -0.005, 0.005);
1467 } else if (histname.find("Res_phi") != std::string::npos) {
1468 if (is2D)
1469 hist->GetYaxis()->Set(50, -0.002, 0.002);
1470 else
1471 hist->GetXaxis()->Set(50, -0.002, 0.002);
1472 }
1473 }
1474
1475 if (histname.find("trigger") != std::string::npos) {
1476 // RESO EF - MC
1477 if ((!m_isData) && histname.find("MuidCo") != std::string::npos &&
1478 (histname.find("BARREL") != std::string::npos || histname.find("WHOLE_DETECT") != std::string::npos)) {
1479 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1480 hist->GetXaxis()->Set(100, -0.04, 0.04);
1481 }
1482 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.04, 0.04); }
1483 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1484 hist->GetXaxis()->Set(100, -0.0005, 0.0005);
1485 }
1486 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0005, 0.0005); }
1487
1488 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1489 hist->GetXaxis()->Set(100, -0.0002, 0.0002);
1490 }
1491 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0002, 0.0002); }
1492 }
1493 if ((!m_isData) && histname.find("MuidCo") != std::string::npos && (histname.find("ENDCAPS") != std::string::npos)) {
1494 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1495 hist->GetXaxis()->Set(100, -0.05, 0.05);
1496 }
1497 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.05, 0.05); }
1498 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1499 hist->GetXaxis()->Set(100, -0.001, 0.001);
1500 }
1501 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.001, 0.001); }
1502
1503 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1504 hist->GetXaxis()->Set(100, -0.0003, 0.0003);
1505 }
1506 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0003, 0.0003); }
1507 }
1508 if ((!m_isData) && histname.find("MuidSA") != std::string::npos) {
1509 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1510 hist->GetXaxis()->Set(100, -0.03, 0.03);
1511 }
1512 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1513
1514 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1515 hist->GetXaxis()->Set(100, -0.03, 0.03);
1516 }
1517 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1518 }
1519 if ((!m_isData) && histname.find("MuidSA") != std::string::npos && (histname.find("BARREL") != std::string::npos)) {
1520 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1521 hist->GetXaxis()->Set(100, -0.15, 0.15);
1522 }
1523 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.15, 0.15); }
1524 }
1525 if ((!m_isData) && histname.find("MuidSA") != std::string::npos &&
1526 (histname.find("ENDCAPS") != std::string::npos || histname.find("WHOLE_DETECT") != std::string::npos)) {
1527 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1528 hist->GetXaxis()->Set(100, -0.2, 0.2);
1529 }
1530 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.2, 0.2); }
1531 }
1532
1533 // RESO EF - DATA
1534 if ((m_isData) && histname.find("MuidCo") != std::string::npos &&
1535 (histname.find("BARREL") != std::string::npos || histname.find("WHOLE_DETECT") != std::string::npos)) {
1536 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1537 hist->GetXaxis()->Set(100, -0.06, 0.06);
1538 }
1539 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.06, 0.06); }
1540 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1541 hist->GetXaxis()->Set(100, -0.001, 0.001);
1542 }
1543 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.001, 0.001); }
1544
1545 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1546 hist->GetXaxis()->Set(100, -0.0005, 0.0005);
1547 }
1548 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0005, 0.0005); }
1549 }
1550 if ((m_isData) && histname.find("MuidCo") != std::string::npos && (histname.find("ENDCAPS") != std::string::npos)) {
1551 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1552 hist->GetXaxis()->Set(100, -0.1, 0.1);
1553 }
1554 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.1, 0.1); }
1555 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1556 hist->GetXaxis()->Set(100, -0.0015, 0.0015);
1557 }
1558 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0015, 0.0015); }
1559
1560 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1561 hist->GetXaxis()->Set(100, -0.0005, 0.0005);
1562 }
1563 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.0005, 0.0005); }
1564 }
1565 if ((m_isData) && histname.find("MuidSA") != std::string::npos) {
1566 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1567 hist->GetXaxis()->Set(100, -0.03, 0.03);
1568 }
1569 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1570
1571 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1572 hist->GetXaxis()->Set(100, -0.03, 0.03);
1573 }
1574 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1575 }
1576 if ((m_isData) && histname.find("MuidSA") != std::string::npos && (histname.find("BARREL") != std::string::npos)) {
1577 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1578 hist->GetXaxis()->Set(100, -0.3, 0.3);
1579 }
1580 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.3, 0.3); }
1581 }
1582 if ((m_isData) && histname.find("MuidSA") != std::string::npos &&
1583 (histname.find("ENDCAPS") != std::string::npos || histname.find("WHOLE_DETECT") != std::string::npos)) {
1584 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1585 hist->GetXaxis()->Set(100, -0.5, 0.5);
1586 }
1587 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.5, 0.5); }
1588 }
1589
1590 // LEVEL2
1591 if ((histname.find("L2_StandAlone") != std::string::npos)) {
1592 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1593 hist->GetXaxis()->Set(100, -0.03, 0.03);
1594 }
1595 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1596
1597 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1598 hist->GetXaxis()->Set(100, -0.03, 0.03);
1599 }
1600 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.03, 0.03); }
1601 }
1602 if ((histname.find("L2_StandAlone") != std::string::npos) && (histname.find("BARREL") != std::string::npos)) {
1603 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1604 hist->GetXaxis()->Set(100, -0.3, 0.3);
1605 }
1606 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.3, 0.3); }
1607 }
1608 if ((histname.find("L2_StandAlone") != std::string::npos) &&
1609 ((histname.find("ENDCAPS") != std::string::npos) || (histname.find("WHOLE_DETECT") != std::string::npos))) {
1610 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1611 hist->GetXaxis()->Set(100, -0.5, 0.5);
1612 }
1613 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.5, 0.5); }
1614 }
1615
1616 if ((histname.find("L2_Combined") != std::string::npos)) {
1617 if (histname.find("Res_eta") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1618 hist->GetXaxis()->Set(100, -0.002, 0.002);
1619 }
1620 if (histname.find("Res_eta_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.002, 0.002); }
1621
1622 if (histname.find("Res_phi") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1623 hist->GetXaxis()->Set(100, -0.001, 0.001);
1624 }
1625 if (histname.find("Res_phi_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.001, 0.001); }
1626 if (histname.find("Res_pT") != std::string::npos && histname.find("_vs_") == std::string::npos) {
1627 hist->GetXaxis()->Set(100, -0.2, 0.2);
1628 }
1629 if (histname.find("Res_pT_vs_") != std::string::npos) { hist->GetYaxis()->Set(100, -0.2, 0.2); }
1630 }
1631 }
1632 }
1633
1635 if (prt->pt() < 2000.) return false;
1636 if (std::abs(prt->eta()) > 2.7) return false;
1637 return true;
1638 }
1639
1640} // namespace MuonPhysValMonitoring
Scalar deltaR(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ElementLink< xAOD::MuonContainer > MuonLink
Helper class to provide constant type-safe access to aux data.
ATLAS-specific HepMC functions.
ElementLink< xAOD::TrackParticleContainer > TrackLink
size_t size() const
Number of registered mappings.
ElementLink< xAOD::TruthParticleContainer > TruthLink
#define x
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
virtual StatusCode regTree(TTree *t, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TTree to be included in the output stream using logical parameters that describe it.
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
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().
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)
Gaudi::Property< std::vector< std::string > > m_L1MuonItems
std::vector< const xAOD::TrackParticle * > m_vMatchedMuonTracks
Gaudi::Property< std::vector< unsigned int > > m_selectMuonCategories
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)
std::vector< std::unique_ptr< MuonValidationPlots > > m_muonValidationPlots
Gaudi::Property< std::vector< std::vector< std::string > > > m_selectHLTMuonItems
std::vector< const xAOD::L2CombinedMuon * > m_vL2CBMuons
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
std::vector< HistData > retrieveBookedHistograms()
Retrieve all booked histograms.
Definition PlotBase.cxx:63
void initialize()
Definition PlotBase.cxx:39
std::vector< TreeData > retrieveBookedTrees()
Retrieve all booked trees.
Definition PlotBase.cxx:73
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.
Exception — Attempt to retrieve nonexistent aux data item.
const std::vector< Trig::Feature< T > > get(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
returns flattened vector of Features of given type This method is in fact sullied by 3 arguments.
float beamSpotWeight() const
Weight for beam spot size reweighting.
Class providing the definition of the 4-vector interface.
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
int sAddress() const
Get the station address of the muon.
virtual double pt() const
The transverse momentum ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
uint32_t roiWord() const
Get the RoI ID of the seeding LVL1 muon.
virtual double eta() const
The pseudorapidity ( ) of the particle.
float eta() const
The pseudorapidity ( ) of the muon candidate.
float thrValue() const
The highest threshold value (in MeV) passed by the muon candidate.
float phi() const
The azimuthal angle ( ) of the muon candidate.
virtual double pt() const override
The transverse momentum ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
virtual double phi() const override
The azimuthal angle ( ) of the particle.
float charge() const
Author author() const
const ElementLink< MuonContainer > & muonLink() const
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140
std::vector< std::string > tokenize(std::string_view the_str, std::string_view delimiters)
Splits the string into smaller substrings.
int uniqueID(const T &p)
constexpr int UNDEFINED_ID
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition Muons.py:1
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
EventInfo_v1 EventInfo
Definition of the latest event info version.
MuonRoIContainer_v1 MuonRoIContainer
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
L2CombinedMuonContainer_v1 L2CombinedMuonContainer
Define the latest version of the muon CB container.
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.
L2StandAloneMuonContainer_v2 L2StandAloneMuonContainer
Define the latest version of the muon SA container.
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.
SlowMuonContainer_v1 SlowMuonContainer
Definition of the current "SlowMuon container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
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.
TChain * tree