ATLAS Offline Software
Loading...
Searching...
No Matches
TestIsolationAthenaAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: TestIsolationAthenaAlg.cxx 672993 2015-06-06 16:55:34Z dzhang $
6
7// Local include(s):
9
10// EDM include(s):
14
15// other include(s):
16#include <cmath>
17
18namespace CP {
19
20 TestIsolationAthenaAlg::TestIsolationAthenaAlg(const std::string& name, ISvcLocator* svcLoc) :
21 AthAlgorithm(name, svcLoc), m_sgKeyPhotons("Photons"), m_sgKeyElectrons("Electrons"), m_sgKeyMuons("Muons") {
22 declareProperty("sgKeyPhotons", m_sgKeyPhotons);
23 declareProperty("sgKeyElectrons", m_sgKeyElectrons);
24 declareProperty("sgKeyMuons", m_sgKeyMuons);
25 declareProperty("IsoTool", m_isoTool);
26 }
27
29 ATH_CHECK(m_isoTool.retrieve());
30
31 // Return gracefully:
32 return StatusCode::SUCCESS;
33 }
34
36 const xAOD::PhotonContainer* photons(nullptr);
37 ATH_CHECK(evtStore()->retrieve(photons, m_sgKeyPhotons));
38 for (auto x : *photons) {
39 if (x->pt() > 7000.) {
40 if (x->caloCluster() != nullptr) {
41 if (fabs(x->caloCluster()->eta()) < 2.47) {
42 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Photon passes Isolation"); }
43 }
44 }
45 }
46 }
47
48 const xAOD::ElectronContainer* electrons(nullptr);
49 ATH_CHECK(evtStore()->retrieve(electrons, m_sgKeyElectrons));
50 for (auto x : *electrons) {
51 if (x->pt() > 7000.) {
52 if (x->caloCluster() != nullptr) {
53 if (fabs(x->caloCluster()->eta()) < 2.47) {
54 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Electron passes Isolation"); }
55 }
56 }
57 }
58 }
59
60 const xAOD::MuonContainer* muons(nullptr);
61 ATH_CHECK(evtStore()->retrieve(muons, m_sgKeyMuons));
62 for (auto x : *muons) {
63 if (x->pt() > 7000.) {
64 if (fabs(x->eta()) < 2.5) {
65 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Muon passes Isolation"); }
66 }
67 }
68 }
69
70 // Return gracefully:
71 return StatusCode::SUCCESS;
72 }
73} // namespace CP
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< CP::IIsolationSelectionTool > m_isoTool
TestIsolationAthenaAlg(const std::string &name, ISvcLocator *svcLoc)
virtual StatusCode initialize()
Function initialising the algorithm.
virtual StatusCode execute()
Function executing the algorithm.
Select isolated Photons, Electrons and Muons.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".