ATLAS Offline Software
Loading...
Searching...
No Matches
TestIsolationAthenaAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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):
10#include "PATCore/AcceptInfo.h"
11// EDM include(s):
15
16// other include(s):
17#include <cmath>
18
19namespace CP {
20
21 TestIsolationAthenaAlg::TestIsolationAthenaAlg(const std::string& name, ISvcLocator* svcLoc) :
22 AthAlgorithm(name, svcLoc), m_sgKeyPhotons("Photons"), m_sgKeyElectrons("Electrons"), m_sgKeyMuons("Muons") {
23 declareProperty("sgKeyPhotons", m_sgKeyPhotons);
24 declareProperty("sgKeyElectrons", m_sgKeyElectrons);
25 declareProperty("sgKeyMuons", m_sgKeyMuons);
26 declareProperty("IsoTool", m_isoTool);
27 }
28
30 ATH_CHECK(m_isoTool.retrieve());
31
32 // Return gracefully:
33 return StatusCode::SUCCESS;
34 }
35
36 StatusCode TestIsolationAthenaAlg::execute(const EventContext& /*ctx*/) {
37 const xAOD::PhotonContainer* photons(nullptr);
38 ATH_CHECK(evtStore()->retrieve(photons, m_sgKeyPhotons));
39 for (auto x : *photons) {
40 if (x->pt() > 7000.) {
41 if (x->caloCluster() != nullptr) {
42 if (fabs(x->caloCluster()->eta()) < 2.47) {
43 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Photon passes Isolation"); }
44 }
45 }
46 }
47 }
48
49 const xAOD::ElectronContainer* electrons(nullptr);
50 ATH_CHECK(evtStore()->retrieve(electrons, m_sgKeyElectrons));
51 for (auto x : *electrons) {
52 if (x->pt() > 7000.) {
53 if (x->caloCluster() != nullptr) {
54 if (fabs(x->caloCluster()->eta()) < 2.47) {
55 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Electron passes Isolation"); }
56 }
57 }
58 }
59 }
60
61 const xAOD::MuonContainer* muons(nullptr);
62 ATH_CHECK(evtStore()->retrieve(muons, m_sgKeyMuons));
63 for (auto x : *muons) {
64 if (x->pt() > 7000.) {
65 if (fabs(x->eta()) < 2.5) {
66 if (m_isoTool->accept(*x)) { ATH_MSG_INFO(" Muon passes Isolation"); }
67 }
68 }
69 }
70
71 // Return gracefully:
72 return StatusCode::SUCCESS;
73 }
74} // 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.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
ToolHandle< CP::IIsolationSelectionTool > m_isoTool
TestIsolationAthenaAlg(const std::string &name, ISvcLocator *svcLoc)
virtual StatusCode initialize()
Function initialising the algorithm.
virtual StatusCode execute(const EventContext &ctx)
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".