Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

 EGPhotonCleaningWrapper (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize () override final
 
virtual StatusCode addBranches () const override final
 

Private Attributes

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

Detailed Description

Definition at line 27 of file EGPhotonCleaningWrapper.h.

Constructor & Destructor Documentation

◆ EGPhotonCleaningWrapper()

DerivationFramework::EGPhotonCleaningWrapper::EGPhotonCleaningWrapper ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 17 of file EGPhotonCleaningWrapper.cxx.

20  : base_class(t, n, p)
21  , m_sgName("DFCommonPhotonsCleaning")
22 {
23  declareProperty("StoreGateEntryName", m_sgName);
24 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::EGPhotonCleaningWrapper::addBranches ( ) const
finaloverridevirtual

Definition at line 47 of file EGPhotonCleaningWrapper.cxx.

48 {
49 
50  const EventContext& ctx = Gaudi::Hive::currentContext();
52 
53  // If we're applying corrections, the correction tools will give us
54  // copies that we need to keep track of. (We want to do all the copies
55  // before we start writing decorations, to avoid warnings about having
56  // unlocked decorations in a copy).
57  // The copies we get back from the tool will have standalone aux stores.
58  // We'll put them in a DataVector to get them deleted, but we don't
59  // need to copy the aux data to the container, so construct it with
60  // @c NEVER_TRACK_INDICES.
62  if (!m_fudgeMCTool.empty()) {
63  pCopies.reserve (photons->size());
64  for (const xAOD::Photon* photon : *photons) {
65  // apply the shower shape corrections
67  xAOD::Photon* ph = nullptr;
68  correctionCode = m_fudgeMCTool->correctedCopy(*photon, ph);
69  if (correctionCode == CP::CorrectionCode::Ok) {
70  } else if (correctionCode == CP::CorrectionCode::Error) {
71  Error("addBranches()",
72  "Error applying fudge factors to current photon");
73  } else if (correctionCode == CP::CorrectionCode::OutOfValidityRange) {
74  Warning(
75  "addBranches()",
76  "Current photon has no valid fudge factors due to out-of-range");
77  } else {
78  Warning("addBranches()",
79  "Unknown correction code %d from "
80  "ElectronPhotonShowerShapeFudgeTool",
81  (int)correctionCode);
82  }
83  pCopies.push_back (ph);
84  }
85  }
86  else {
87  pCopies.resize (photons->size());
88  }
89 
91  m_decoratorPass, ctx
92  };
95  };
96 
97  // Write mask for each element and record to SG for subsequent selection
98  for (size_t ipar = 0; const xAOD::Photon* photon : *photons) {
99 
100  const xAOD::Photon* pCopy = pCopies[ipar++];
101  if (!pCopy) pCopy = photon;
102 
103  // decorate the original object
104  decoratorPass(*photon) = static_cast<int> (PhotonHelpers::passOQquality(*pCopy));
105  decoratorPassDelayed(*photon) = static_cast<int> (PhotonHelpers::passOQqualityDelayed(*pCopy));
106  }
107  return StatusCode::SUCCESS;
108 }

◆ initialize()

StatusCode DerivationFramework::EGPhotonCleaningWrapper::initialize ( )
finaloverridevirtual

Definition at line 27 of file EGPhotonCleaningWrapper.cxx.

28 {
29  if (m_sgName.empty()) {
31  "No SG name provided for the output of EGPhotonCleaningWrapper");
32  return StatusCode::FAILURE;
33  }
34  if (!m_fudgeMCTool.name().empty()) {
35  CHECK(m_fudgeMCTool.retrieve());
36  }
37  ATH_CHECK(m_containerName.initialize());
39  m_decoratorPassDelayed = m_containerName.key() + "." + m_sgName + "NoTime";
40  ATH_CHECK(m_decoratorPass.initialize());
41  ATH_CHECK(m_decoratorPassDelayed.initialize());
42 
43  return StatusCode::SUCCESS;
44 }

Member Data Documentation

◆ m_containerName

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

Definition at line 44 of file EGPhotonCleaningWrapper.h.

◆ m_decoratorPass

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

Definition at line 51 of file EGPhotonCleaningWrapper.h.

◆ m_decoratorPassDelayed

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

Definition at line 53 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 38 of file EGPhotonCleaningWrapper.h.

◆ m_sgName

std::string DerivationFramework::EGPhotonCleaningWrapper::m_sgName
private

Definition at line 54 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:38
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:51
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
beamspotman.n
n
Definition: beamspotman.py:731
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:794
DerivationFramework::EGPhotonCleaningWrapper::m_decoratorPassDelayed
SG::WriteDecorHandleKey< xAOD::PhotonContainer > m_decoratorPassDelayed
Definition: EGPhotonCleaningWrapper.h:53
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:44
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
DerivationFramework::EGPhotonCleaningWrapper::m_sgName
std::string m_sgName
Definition: EGPhotonCleaningWrapper.h:54