ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
EgammaAnalysisAlgorithms
Root
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
11
#include <
AsgDataHandles/ReadHandle.h
>
12
#include <
EgammaAnalysisAlgorithms/PhotonOriginCorrectionAlg.h
>
13
14
#include "
egammaUtils/egPhotonWrtPoint.h
"
15
//
16
// method implementations
17
//
18
19
namespace
CP
{
20
PhotonOriginCorrectionAlg ::PhotonOriginCorrectionAlg(
const
std::string&
name
,
21
ISvcLocator* pSvcLocator)
22
:
AnaReentrantAlgorithm
(
name
, pSvcLocator) {}
23
24
StatusCode PhotonOriginCorrectionAlg ::initialize() {
25
ANA_CHECK
(
m_PhotonHandle
.initialize(
m_systematicsList
));
26
ANA_CHECK
(
m_preselection
.initialize(
m_systematicsList
,
m_PhotonHandle
,
27
SG::AllowEmpty
));
28
29
// We do not have systematics in principle from this operation
30
ANA_CHECK
(
m_systematicsList
.initialize());
31
ANA_CHECK
(
m_primVertices
.initialize());
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode PhotonOriginCorrectionAlg ::execute(
const
EventContext &ctx)
const
{
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.
40
SG::ReadHandle<xAOD::VertexContainer>
vertices(
m_primVertices
, ctx);
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, ctx));
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)
67
photonWrtPoint::correctForZ
(*ph, primary->z());
68
}
69
}
70
}
71
return
StatusCode::SUCCESS;
72
}
73
}
// namespace CP
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ReadHandle.h
Handle class for reading from StoreGate.
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
PhotonOriginCorrectionAlg.h
CP::PhotonOriginCorrectionAlg::m_PhotonHandle
SysCopyHandle< xAOD::PhotonContainer > m_PhotonHandle
the egamma collection we run on
Definition
PhotonOriginCorrectionAlg.h:38
CP::PhotonOriginCorrectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
PhotonOriginCorrectionAlg.h:47
CP::PhotonOriginCorrectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
PhotonOriginCorrectionAlg.h:43
CP::PhotonOriginCorrectionAlg::m_primVertices
SG::ReadHandleKey< xAOD::VertexContainer > m_primVertices
the vertices to loop over to select the Primary
Definition
PhotonOriginCorrectionAlg.h:51
EL::AnaReentrantAlgorithm::AnaReentrantAlgorithm
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaReentrantAlgorithm.cxx:29
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
egPhotonWrtPoint.h
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
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::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::PhotonContainer
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h:17
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Generated on
for ATLAS Offline Software by
1.17.0