ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::EGPhotonCleaningWrapper Class Reference

#include <EGPhotonCleaningWrapper.h>

Inheritance diagram for DerivationFramework::EGPhotonCleaningWrapper:
Collaboration diagram for DerivationFramework::EGPhotonCleaningWrapper:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

ToolHandle< IElectronPhotonShowerShapeFudgeToolm_fudgeMCTool
SG::ReadHandleKey< xAOD::PhotonContainerm_containerName
SG::WriteDecorHandleKey< xAOD::PhotonContainerm_decoratorPass { this, "decoratorPass", m_containerName, "", "" }
SG::WriteDecorHandleKey< xAOD::PhotonContainerm_decoratorPassDelayed { this, "decoratorPassDelayed", m_containerName, "", "" }

Detailed Description

Definition at line 23 of file EGPhotonCleaningWrapper.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::EGPhotonCleaningWrapper::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 27 of file EGPhotonCleaningWrapper.cxx.

28{
29
30 SG::ReadHandle<xAOD::PhotonContainer> photons{ m_containerName, ctx };
31
32 // If we're applying corrections, the correction tools will give us
33 // copies that we need to keep track of. (We want to do all the copies
34 // before we start writing decorations, to avoid warnings about having
35 // unlocked decorations in a copy).
36 // The copies we get back from the tool will have standalone aux stores.
37 // We'll put them in a DataVector to get them deleted, but we don't
38 // need to copy the aux data to the container, so construct it with
39 // @c NEVER_TRACK_INDICES.
41 if (!m_fudgeMCTool.empty()) {
42 pCopies.reserve (photons->size());
43 for (const xAOD::Photon* photon : *photons) {
44 // apply the shower shape corrections
45 CP::CorrectionCode correctionCode = CP::CorrectionCode::Ok;
46 xAOD::Photon* ph = nullptr;
47 correctionCode = m_fudgeMCTool->correctedCopy(*photon, ph);
48 if (correctionCode == CP::CorrectionCode::Ok) {
49 } else if (correctionCode == CP::CorrectionCode::Error) {
50 Error("addBranches()",
51 "Error applying fudge factors to current photon");
52 } else if (correctionCode == CP::CorrectionCode::OutOfValidityRange) {
53 Warning(
54 "addBranches()",
55 "Current photon has no valid fudge factors due to out-of-range");
56 } else {
57 Warning("addBranches()",
58 "Unknown correction code %d from "
59 "ElectronPhotonShowerShapeFudgeTool",
60 (int)correctionCode);
61 }
62 pCopies.push_back (ph);
63 }
64 }
65 else {
66 pCopies.resize (photons->size());
67 }
68
69 SG::WriteDecorHandle<xAOD::PhotonContainer, char> decoratorPass{
71 };
72 SG::WriteDecorHandle<xAOD::PhotonContainer, char> decoratorPassDelayed{
74 };
75
76 // Write mask for each element and record to SG for subsequent selection
77 for (size_t ipar = 0; const xAOD::Photon* photon : *photons) {
78
79 const xAOD::Photon* pCopy = pCopies[ipar++];
80 if (!pCopy) pCopy = photon;
81
82 // decorate the original object
83 decoratorPass(*photon) = static_cast<int> (PhotonHelpers::passOQquality(*pCopy));
84 decoratorPassDelayed(*photon) = static_cast<int> (PhotonHelpers::passOQqualityDelayed(*pCopy));
85 }
86 return StatusCode::SUCCESS;
87}
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
SG::WriteDecorHandleKey< xAOD::PhotonContainer > m_decoratorPassDelayed
SG::WriteDecorHandleKey< xAOD::PhotonContainer > m_decoratorPass
SG::ReadHandleKey< xAOD::PhotonContainer > m_containerName
ToolHandle< IElectronPhotonShowerShapeFudgeTool > m_fudgeMCTool
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition Error.h:16
bool passOQqualityDelayed(const xAOD::Photon &ph)
Helpers to ease the implementation of the pass Quality requirements.
bool passOQquality(const xAOD::Photon &ph)
Helper to ease the implemmantation of the pass Quality requirements.
@ NEVER_TRACK_INDICES
Never track indices, regardless of the setting of the ownership policy.
@ OWN_ELEMENTS
this data object owns its elements
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Photon_v1 Photon
Definition of the current "egamma version".

◆ initialize()

StatusCode DerivationFramework::EGPhotonCleaningWrapper::initialize ( )
finaloverridevirtual

Definition at line 14 of file EGPhotonCleaningWrapper.cxx.

15{
16 if (!m_fudgeMCTool.name().empty()) {
17 CHECK(m_fudgeMCTool.retrieve());
18 }
19 ATH_CHECK(m_containerName.initialize());
20 ATH_CHECK(m_decoratorPass.initialize());
22
23 return StatusCode::SUCCESS;
24}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_containerName

SG::ReadHandleKey<xAOD::PhotonContainer> DerivationFramework::EGPhotonCleaningWrapper::m_containerName
private
Initial value:
{ this,
"ContainerName",
"",
"Input" }

Definition at line 39 of file EGPhotonCleaningWrapper.h.

39 { this,
40 "ContainerName",
41 "",
42 "Input" };

◆ m_decoratorPass

SG::WriteDecorHandleKey<xAOD::PhotonContainer> DerivationFramework::EGPhotonCleaningWrapper::m_decoratorPass { this, "decoratorPass", m_containerName, "", "" }
private

Definition at line 46 of file EGPhotonCleaningWrapper.h.

46{ this, "decoratorPass", m_containerName, "", "" };

◆ m_decoratorPassDelayed

SG::WriteDecorHandleKey<xAOD::PhotonContainer> DerivationFramework::EGPhotonCleaningWrapper::m_decoratorPassDelayed { this, "decoratorPassDelayed", m_containerName, "", "" }
private

Definition at line 48 of file EGPhotonCleaningWrapper.h.

48{ this, "decoratorPassDelayed", m_containerName, "", "" };

◆ m_fudgeMCTool

ToolHandle<IElectronPhotonShowerShapeFudgeTool> DerivationFramework::EGPhotonCleaningWrapper::m_fudgeMCTool
private
Initial value:
{
this,
"EGammaFudgeMCTool",
"",
"Handle to the Fudging Tool"
}

Definition at line 33 of file EGPhotonCleaningWrapper.h.

33 {
34 this,
35 "EGammaFudgeMCTool",
36 "",
37 "Handle to the Fudging Tool"
38 };

The documentation for this class was generated from the following files: