ATLAS Offline Software
Loading...
Searching...
No Matches
PhotonOriginCorrectionAlg.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
7//
8// includes
9//
10
13
15//
16// method implementations
17//
18
19namespace CP {
20StatusCode PhotonOriginCorrectionAlg ::initialize() {
24
25 // We do not have systematics in principle from this operation
26 ANA_CHECK(m_systematicsList.initialize());
27 ANA_CHECK(m_primVertices.initialize());
28 return StatusCode::SUCCESS;
29}
30
31StatusCode PhotonOriginCorrectionAlg ::execute(const EventContext &ctx) const {
32
33 // If we can not rely on Event Cleaning or something
34 // else having run before for the PHYSLITE.
35 // We have to see if we have a PriVtx.
37 const xAOD::Vertex* primary = nullptr;
38 for (const xAOD::Vertex* vtx : *vertices) {
39 if (vtx->vertexType() == xAOD::VxType::PriVtx) {
40 primary = vtx;
41 break;
42 }
43 }
44 if (!primary) {
45 ATH_MSG_WARNING("Could not find a Primary vertex");
46 }
47
48 for (const auto& sys : m_systematicsList.systematicsVector()) {
49
50 xAOD::PhotonContainer* photons = nullptr;
51
52 ANA_CHECK(m_PhotonHandle.getCopy(photons, sys, ctx));
53
54 // Actually here we rely on the egamma preselection
55 // to have run. Otherwise there is high danger
56 // or garbage for the LarEM "gap" region.
57 // It seems to be the case for PHYSLITE
58 for (xAOD::Photon* ph : *photons) {
59 if (m_preselection.getBool(*ph, sys) && primary) {
60 // We have a primary vertex so we should be able
61 // to correct the Photon Origin from (0,0,0)
62 // to (0,0,z)
63 photonWrtPoint::correctForZ(*ph, primary->z());
64 }
65 }
66 }
67 return StatusCode::SUCCESS;
68}
69} // namespace CP
#define ATH_MSG_WARNING(x,...)
Handle class for reading from StoreGate.
#define ANA_CHECK(EXP)
check whether the given expression was successful
SysCopyHandle< xAOD::PhotonContainer > m_PhotonHandle
the egamma collection we run on
SysReadSelectionHandle m_preselection
the preselection we apply to our input
SysListHandle m_systematicsList
the systematics list we run
SG::ReadHandleKey< xAOD::VertexContainer > m_primVertices
the vertices to loop over to select the Primary
Select isolated Photons, Electrons and Muons.
void correctForZ(xAOD::Egamma &ph, double z)
Function to modify in place the kinematics of a photon wrt (0,0,z0).
@ PriVtx
Primary vertex.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
Photon_v1 Photon
Definition of the current "egamma version".