ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 
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
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 
70  m_decoratorPass, ctx
71  };
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 }

◆ 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());
21  ATH_CHECK(m_decoratorPassDelayed.initialize());
22 
23  return StatusCode::SUCCESS;
24 }

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.

◆ m_decoratorPass

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

Definition at line 46 of file EGPhotonCleaningWrapper.h.

◆ m_decoratorPassDelayed

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

Definition at line 48 of file EGPhotonCleaningWrapper.h.

◆ 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.


The documentation for this class was generated from the following files:
DerivationFramework::EGPhotonCleaningWrapper::m_fudgeMCTool
ToolHandle< IElectronPhotonShowerShapeFudgeTool > m_fudgeMCTool
Definition: EGPhotonCleaningWrapper.h:33
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
SG::NEVER_TRACK_INDICES
@ NEVER_TRACK_INDICES
Never track indices, regardless of the setting of the ownership policy.
Definition: IndexTrackingPolicy.h:46
DerivationFramework::EGPhotonCleaningWrapper::m_decoratorPass
SG::WriteDecorHandleKey< xAOD::PhotonContainer > m_decoratorPass
Definition: EGPhotonCleaningWrapper.h:46
PhotonHelpers::passOQquality
bool passOQquality(const xAOD::Photon &ph)
Helper to ease the implemmantation of the pass Quality requirements.
Definition: PhotonHelpers.cxx:12
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
DerivationFramework::EGPhotonCleaningWrapper::m_decoratorPassDelayed
SG::WriteDecorHandleKey< xAOD::PhotonContainer > m_decoratorPassDelayed
Definition: EGPhotonCleaningWrapper.h:48
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:200
xAOD::Photon_v1
Definition: Photon_v1.h:37
DerivationFramework::EGPhotonCleaningWrapper::m_containerName
SG::ReadHandleKey< xAOD::PhotonContainer > m_containerName
Definition: EGPhotonCleaningWrapper.h:39
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
PhotonHelpers::passOQqualityDelayed
bool passOQqualityDelayed(const xAOD::Photon &ph)
Helpers to ease the implementation of the pass Quality requirements.
Definition: PhotonHelpers.cxx:29