ATLAS Offline Software
Loading...
Searching...
No Matches
MuonQualityUpdaterAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include "xAODMuon/Muon.h"
11
12namespace CP {
13
14 MuonQualityUpdaterAlg::MuonQualityUpdaterAlg(const std::string& name, ISvcLocator* svcloc) :
15 AthAlgorithm(name, svcloc), m_tool("CP::MuonSelectionTool") /*public tool*/ {
16 declareProperty("Input", m_input_muons = "");
17 declareProperty("Output", m_output_muons = "");
18 declareProperty("Tool", m_tool);
19 }
20
22 if (m_input_muons == "") {
23 ATH_MSG_ERROR("You must specify an input muon collection");
24 return StatusCode::FAILURE;
25 }
26 CHECK(m_tool.retrieve());
27
28 return StatusCode::SUCCESS;
29 }
30
32 // fetch input collection
33 const xAOD::MuonContainer* muons = 0;
34 CHECK(evtStore()->retrieve(muons, m_input_muons));
35
36 // create a shallow copy container for the outputs
37 auto OutMuons = xAOD::shallowCopyContainer(*muons);
38 CHECK(evtStore()->record(OutMuons.first, m_output_muons));
39 CHECK(evtStore()->record(OutMuons.second, m_output_muons + "Aux."));
40
41 for (xAOD::Muon* muon : *(OutMuons.first)) {
42 m_tool->setQuality(*muon);
43 m_tool->setPassesIDCuts(*muon);
44 // m_tool->setPassesLowPtEfficiencyCuts(*muon);
45 }
46
47 return StatusCode::SUCCESS;
48 }
49
50} // 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".