ATLAS Offline Software
PhotonOriginCorrectionAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 //
8 // includes
9 //
10 
13 
15 //
16 // method implementations
17 //
18 
19 namespace CP {
21  ISvcLocator* pSvcLocator)
22  : AnaAlgorithm(name, pSvcLocator) {}
23 
28 
29  // We do not have systematics in principle from this operation
31  ANA_CHECK(m_primVertices.initialize());
32  return StatusCode::SUCCESS;
33 }
34 
36 
37  // If we can not rely on Event Cleaning or something
38  // else having run before for the PHYSLITE.
39  // We have to see if we have a PriVtx.
41  const xAOD::Vertex* primary = nullptr;
42  for (const xAOD::Vertex* vtx : *vertices) {
43  if (vtx->vertexType() == xAOD::VxType::PriVtx) {
44  primary = vtx;
45  break;
46  }
47  }
48  if (!primary) {
49  ATH_MSG_WARNING("Could not find a Primary vertex");
50  }
51 
52  for (const auto& sys : m_systematicsList.systematicsVector()) {
53 
54  xAOD::PhotonContainer* photons = nullptr;
55 
56  ANA_CHECK(m_PhotonHandle.getCopy(photons, sys));
57 
58  // Actually here we rely on the egamma preselection
59  // to have run. Otherwise there is high danger
60  // or garbage for the LarEM "gap" region.
61  // It seems to be the case for PHYSLITE
62  for (xAOD::Photon* ph : *photons) {
63  if (m_preselection.getBool(*ph, sys) && primary) {
64  // We have a primary vertex so we should be able
65  // to correct the Photon Origin from (0,0,0)
66  // to (0,0,z)
68  }
69  }
70  }
71  return StatusCode::SUCCESS;
72 }
73 } // namespace CP
egPhotonWrtPoint.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CP::PhotonOriginCorrectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: PhotonOriginCorrectionAlg.h:42
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
PhotonOriginCorrectionAlg.h
StateLessPT_NewConfig.primary
primary
Definition: StateLessPT_NewConfig.py:228
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
CP::SysReadSelectionHandle::getBool
bool getBool(const SG::AuxElement &element, const CP::SystematicSet &sys) const
get the selection as a bool
CP::PhotonOriginCorrectionAlg::m_PhotonHandle
SysCopyHandle< xAOD::PhotonContainer > m_PhotonHandle
the egamma collection we run on
Definition: PhotonOriginCorrectionAlg.h:37
CP::PhotonOriginCorrectionAlg::execute
StatusCode execute() override
Definition: PhotonOriginCorrectionAlg.cxx:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::PhotonOriginCorrectionAlg::PhotonOriginCorrectionAlg
PhotonOriginCorrectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: PhotonOriginCorrectionAlg.cxx:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ReadHandle.h
Handle class for reading from StoreGate.
CP::PhotonOriginCorrectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: PhotonOriginCorrectionAlg.h:46
photonWrtPoint::correctForZ
void correctForZ(xAOD::Egamma &ph, double z)
Function to modify in place the kinematics of a photon wrt (0,0,z0)
Definition: egPhotonWrtPoint.cxx:23
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::Photon_v1
Definition: Photon_v1.h:37
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::PhotonOriginCorrectionAlg::m_primVertices
SG::ReadHandleKey< xAOD::VertexContainer > m_primVertices
the vertices to loop over to select the Primary
Definition: PhotonOriginCorrectionAlg.h:50
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::PhotonOriginCorrectionAlg::initialize
StatusCode initialize() override
Definition: PhotonOriginCorrectionAlg.cxx:24