ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DerivationFramework::ClusterEnergyPerLayerDecorator Class Reference

Decorate egamma objects with the energy per layer for a rectangular cluster of size neta X nphi built on the fly. More...

#include <ClusterEnergyPerLayerDecorator.h>

Inheritance diagram for DerivationFramework::ClusterEnergyPerLayerDecorator:
Collaboration diagram for DerivationFramework::ClusterEnergyPerLayerDecorator:

Public Member Functions

 ClusterEnergyPerLayerDecorator (const std::string &t, const std::string &n, const IInterface *p)
 
 ~ClusterEnergyPerLayerDecorator ()
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 

Private Member Functions

std::vector< float > decorateObject (const EventContext &ctx, const xAOD::Egamma *egamma, const CaloCellContainer *cellCont) const
 

Private Attributes

int m_eta_size = 0
 
int m_phi_size = 0
 
std::vector< unsigned int > m_layers
 
SG::ReadHandleKey< xAOD::EgammaContainerm_SGKey_photons { this, "SGKey_photons", "", "SG key of photon container" }
 
SG::ReadHandleKey< xAOD::EgammaContainerm_SGKey_electrons
 
SG::ReadHandleKey< CaloCellContainerm_SGKey_caloCells
 
ToolHandle< CaloClusterProcessorm_caloFillRectangularTool
 
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainerm_SGKey_photons_decorations
 
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainerm_SGKey_electrons_decorations
 
const CaloFillRectangularClusterm_tool = nullptr
 

Detailed Description

Decorate egamma objects with the energy per layer for a rectangular cluster of size neta X nphi built on the fly.

Definition at line 30 of file ClusterEnergyPerLayerDecorator.h.

Constructor & Destructor Documentation

◆ ClusterEnergyPerLayerDecorator()

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

Definition at line 19 of file ClusterEnergyPerLayerDecorator.cxx.

23  : base_class(t, n, p)
24 {
25  declareProperty("neta", m_eta_size);
26  declareProperty("nphi", m_phi_size);
27  declareProperty("layers", m_layers = { 0, 1, 2, 3 });
28 }

◆ ~ClusterEnergyPerLayerDecorator()

DerivationFramework::ClusterEnergyPerLayerDecorator::~ClusterEnergyPerLayerDecorator ( )
default

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::addBranches ( ) const
virtual

Definition at line 97 of file ClusterEnergyPerLayerDecorator.cxx.

98 {
99  const EventContext& ctx = Gaudi::Hive::currentContext();
100 
101  // Retrieve cell container
102 
104  const CaloCellContainer* cellCont = cellContainer.ptr();
105 
106  // Photon decorations
107 
108  if (!m_SGKey_photons.key().empty()) {
109 
110  // Retrieve photon container
112  const xAOD::EgammaContainer* importedPhotons = photonContainer.ptr();
113 
114  // Setup vectors of photon decorations
115  std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
116  for (unsigned int i = 0; i < m_layers.size(); i++) {
117  decorations.emplace_back(
118 
120  }
121 
122  // Decorate photons
123  for (const auto* photon : *importedPhotons) {
124  std::vector<float> result = decorateObject(ctx, photon, cellCont);
125  for (unsigned int i = 0; i < m_layers.size(); i++) {
126  decorations[i](*photon) = result[i];
127  }
128  }
129  }
130 
131  // Electron decorations
132 
133  if (!m_SGKey_electrons.key().empty()) {
134 
135  // Retrieve electron container
137  ctx);
138  const xAOD::EgammaContainer* importedElectrons = electronContainer.ptr();
139 
140  // Setup vectors of electron decorations
141  std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decorations;
142  for (unsigned int i = 0; i < m_layers.size(); i++) {
143  decorations.emplace_back(
144 
146  }
147 
148  // Decorate electrons
149  for (const auto* electron : *importedElectrons) {
150  std::vector<float> result = decorateObject(ctx, electron, cellCont);
151  for (unsigned int i = 0; i < m_layers.size(); i++) {
152  decorations[i](*electron) = result[i];
153  }
154  }
155  }
156 
157  return StatusCode::SUCCESS;
158 }

◆ decorateObject()

std::vector< float > DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject ( const EventContext &  ctx,
const xAOD::Egamma egamma,
const CaloCellContainer cellCont 
) const
private

Definition at line 161 of file ClusterEnergyPerLayerDecorator.cxx.

165 {
166  std::vector<float> result;
167  result.clear();
168  if (not egamma or not egamma->caloCluster())
169  return result;
170 
171  std::unique_ptr<xAOD::CaloCluster> egcClone;
173  egcClone =
175  egamma->caloCluster()->eta0(),
176  egamma->caloCluster()->phi0(),
177  egamma->caloCluster()->clusterSize());
178  m_tool->makeCorrection(ctx, egcClone.get());
179  }
180 
181  for (unsigned int layer : m_layers) {
182  result.emplace_back(egcClone ? egcClone->energyBE(layer) : 0.);
183  }
184 
185  return result;
186 }

◆ finalize()

StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::finalize ( )

Definition at line 89 of file ClusterEnergyPerLayerDecorator.cxx.

90 {
91 
92  return StatusCode::SUCCESS;
93 }

◆ initialize()

StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::initialize ( )

Definition at line 37 of file ClusterEnergyPerLayerDecorator.cxx.

38 {
39  ATH_MSG_VERBOSE("initialize() ...");
40 
41  if (m_SGKey_photons.empty() and m_SGKey_electrons.empty()) {
42  ATH_MSG_FATAL("No e-gamma collection provided for thinning. At least one "
43  "egamma collection (photons/electrons) must be provided!");
44  return StatusCode::FAILURE;
45  }
46 
48  // how to add a statement to theck that the tool indeed has the size matching
49  // the neta and nphi properties? ATH_MSG_DEBUG("CaloFillRectangularCluster
50  // print size ...
51  m_tool =
52  dynamic_cast<const CaloFillRectangularCluster*>(
53  &(*m_caloFillRectangularTool));
54  if (m_tool==nullptr) {
55  ATH_MSG_ERROR("Pointer to CaloFillRectantularCluster tool is invalid");
56  return StatusCode::FAILURE;
57  }
58 
60 
61  if (!m_SGKey_electrons.key().empty()) {
62  ATH_MSG_DEBUG("Using " << m_SGKey_electrons << " for electrons");
63  ATH_CHECK(m_SGKey_electrons.initialize());
64 
65  const char* containerKey = m_SGKey_electrons.key().c_str();
66  for (int layer : m_layers) {
67  m_SGKey_electrons_decorations.emplace_back(
68  Form("%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size, layer));
69  }
71  }
72 
73  if (!m_SGKey_photons.key().empty()) {
74  ATH_MSG_DEBUG("Using " << m_SGKey_photons << " for photons");
75  ATH_CHECK(m_SGKey_photons.initialize());
76 
77  const char* containerKey = m_SGKey_photons.key().c_str();
78  for (int layer : m_layers) {
79  m_SGKey_photons_decorations.emplace_back(
80  Form("%s.E%dx%d_Lr%d", containerKey, m_eta_size, m_phi_size, layer));
81  }
83  }
84 
85  return StatusCode::SUCCESS;
86 }

Member Data Documentation

◆ m_caloFillRectangularTool

ToolHandle<CaloClusterProcessor> DerivationFramework::ClusterEnergyPerLayerDecorator::m_caloFillRectangularTool
private
Initial value:
{
this,
"CaloFillRectangularClusterTool",
"",
"Handle of the CaloFillRectangularClusterTool"
}

Definition at line 63 of file ClusterEnergyPerLayerDecorator.h.

◆ m_eta_size

int DerivationFramework::ClusterEnergyPerLayerDecorator::m_eta_size = 0
private

Definition at line 42 of file ClusterEnergyPerLayerDecorator.h.

◆ m_layers

std::vector<unsigned int> DerivationFramework::ClusterEnergyPerLayerDecorator::m_layers
private

Definition at line 44 of file ClusterEnergyPerLayerDecorator.h.

◆ m_phi_size

int DerivationFramework::ClusterEnergyPerLayerDecorator::m_phi_size = 0
private

Definition at line 43 of file ClusterEnergyPerLayerDecorator.h.

◆ m_SGKey_caloCells

SG::ReadHandleKey<CaloCellContainer> DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_caloCells
private
Initial value:
{
this,
"SGKey_caloCells",
"AllCalo",
"SG key of the cell container"
}

Definition at line 56 of file ClusterEnergyPerLayerDecorator.h.

◆ m_SGKey_electrons

SG::ReadHandleKey<xAOD::EgammaContainer> DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_electrons
private
Initial value:
{
this,
"SGKey_electrons",
"",
"SG key of electron container"
}

Definition at line 49 of file ClusterEnergyPerLayerDecorator.h.

◆ m_SGKey_electrons_decorations

SG::WriteDecorHandleKeyArray<xAOD::EgammaContainer> DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_electrons_decorations
private
Initial value:
{
this,
"SGKey_electrons_decorations_noConf",
{},
"SG keys for electrons decorations not really configurable"
}

Definition at line 79 of file ClusterEnergyPerLayerDecorator.h.

◆ m_SGKey_photons

SG::ReadHandleKey<xAOD::EgammaContainer> DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_photons { this, "SGKey_photons", "", "SG key of photon container" }
private

Definition at line 47 of file ClusterEnergyPerLayerDecorator.h.

◆ m_SGKey_photons_decorations

SG::WriteDecorHandleKeyArray<xAOD::EgammaContainer> DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_photons_decorations
private
Initial value:
{
this,
"SGKey_photons_decorations_noConf",
{},
"SG keys for photon decorations not really configurable"
}

Definition at line 71 of file ClusterEnergyPerLayerDecorator.h.

◆ m_tool

const CaloFillRectangularCluster* DerivationFramework::ClusterEnergyPerLayerDecorator::m_tool = nullptr
private

Definition at line 86 of file ClusterEnergyPerLayerDecorator.h.


The documentation for this class was generated from the following files:
CaloClusterStoreHelper::makeCluster
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
Definition: CaloClusterStoreHelper.cxx:13
electronContainer
xAOD::ElectronContainer * electronContainer
Definition: TrigGlobEffCorrValidation.cxx:187
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_electrons_decorations
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainer > m_SGKey_electrons_decorations
Definition: ClusterEnergyPerLayerDecorator.h:79
DerivationFramework::ClusterEnergyPerLayerDecorator::m_phi_size
int m_phi_size
Definition: ClusterEnergyPerLayerDecorator.h:43
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::ClusterEnergyPerLayerDecorator::m_layers
std::vector< unsigned int > m_layers
Definition: ClusterEnergyPerLayerDecorator.h:44
DerivationFramework::ClusterEnergyPerLayerDecorator::m_caloFillRectangularTool
ToolHandle< CaloClusterProcessor > m_caloFillRectangularTool
Definition: ClusterEnergyPerLayerDecorator.h:63
DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject
std::vector< float > decorateObject(const EventContext &ctx, const xAOD::Egamma *egamma, const CaloCellContainer *cellCont) const
Definition: ClusterEnergyPerLayerDecorator.cxx:161
egamma
Definition: egamma.h:58
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::EgammaParameters::AuthorCaloTopo35
const uint16_t AuthorCaloTopo35
Photon reconstructed by SW CaloTopo35 seeded clusters.
Definition: EgammaDefs.h:38
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_photons_decorations
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainer > m_SGKey_photons_decorations
Definition: ClusterEnergyPerLayerDecorator.h:71
CaloFillRectangularCluster
Definition: CaloFillRectangularCluster.h:63
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
photonContainer
xAOD::PhotonContainer * photonContainer
Definition: TrigGlobEffCorrValidation.cxx:189
DerivationFramework::ClusterEnergyPerLayerDecorator::m_tool
const CaloFillRectangularCluster * m_tool
Definition: ClusterEnergyPerLayerDecorator.h:86
egamma::author
unsigned int author() const
Reconstruction Author
Definition: egamma.h:244
DerivationFramework::ClusterEnergyPerLayerDecorator::m_eta_size
int m_eta_size
Definition: ClusterEnergyPerLayerDecorator.h:42
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_photons
SG::ReadHandleKey< xAOD::EgammaContainer > m_SGKey_photons
Definition: ClusterEnergyPerLayerDecorator.h:47
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:200
xAOD::CaloCluster_v1::energyBE
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:623
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
CaloFillRectangularCluster::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
CaloClusterCorrection virtual method.
DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_caloCells
SG::ReadHandleKey< CaloCellContainer > m_SGKey_caloCells
Definition: ClusterEnergyPerLayerDecorator.h:56
DerivationFramework::ClusterEnergyPerLayerDecorator::m_SGKey_electrons
SG::ReadHandleKey< xAOD::EgammaContainer > m_SGKey_electrons
Definition: ClusterEnergyPerLayerDecorator.h:49