ATLAS Offline Software
Loading...
Searching...
No Matches
MuonQualityUpdaterAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include "xAODMuon/Muon.h"
12
13namespace CP {
14
15 MuonQualityUpdaterAlg::MuonQualityUpdaterAlg(const std::string& name, ISvcLocator* svcloc) :
16 AthAlgorithm(name, svcloc), m_tool("CP::MuonSelectionTool") /*public tool*/ {
17 declareProperty("Input", m_input_muons = "");
18 declareProperty("Output", m_output_muons = "");
19 declareProperty("Tool", m_tool);
20 }
21
23 if (m_input_muons == "") {
24 ATH_MSG_ERROR("You must specify an input muon collection");
25 return StatusCode::FAILURE;
26 }
27 CHECK(m_tool.retrieve());
28
29 return StatusCode::SUCCESS;
30 }
31
33 // fetch input collection
34 const xAOD::MuonContainer* muons = 0;
35 CHECK(evtStore()->retrieve(muons, m_input_muons));
36
37 // create a shallow copy container for the outputs
38 auto OutMuons = xAOD::shallowCopyContainer(*muons, Gaudi::Hive::currentContext());
39
40 for (xAOD::Muon* muon : *OutMuons.first) {
41 m_tool->setQuality(*muon);
42 m_tool->setPassesIDCuts(*muon);
43 // m_tool->setPassesLowPtEfficiencyCuts(*muon);
44 }
45
46 CHECK(evtStore()->record(std::move(OutMuons.first), m_output_muons));
47 CHECK(evtStore()->record(std::move(OutMuons.second), m_output_muons + "Aux."));
48
49 return StatusCode::SUCCESS;
50 }
51
52} // namespace CP
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< CP::IMuonSelectionTool > m_tool
MuonQualityUpdaterAlg(const std::string &name, ISvcLocator *svcloc)
Select isolated Photons, Electrons and Muons.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".