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

#include <TruthCaloShowerDecorator.h>

Inheritance diagram for DerivationFramework::TruthCaloShowerDecorator:
Collaboration diagram for DerivationFramework::TruthCaloShowerDecorator:

Public Member Functions

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

Private Attributes

SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthParticleContainerName
 SG key of the truth particle container. More...
 
SG::ReadHandleKey< xAOD::CaloClusterContainerm_truthClusterContainerEtot
 
SG::ReadHandleKey< xAOD::CaloClusterContainerm_truthClusterContainerEvis
 
SG::ReadHandleKey< xAOD::CaloClusterContainerm_truthClusterContainerEem
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_linkDecoratorClusterEtot { this, "truthLArClusterEtotLink", "", "" }
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_linkDecoratorClusterEvis { this, "truthLArClusterEvisLink", "", "" }
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_linkDecoratorClusterEem { this, "truthLArClusterEemLink", "", "" }
 
ToolHandle< CalibHitToCaloCellToolm_calibhitToCaloCellTool
 

Detailed Description

Definition at line 23 of file TruthCaloShowerDecorator.h.

Constructor & Destructor Documentation

◆ TruthCaloShowerDecorator()

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

Definition at line 15 of file TruthCaloShowerDecorator.cxx.

18  : base_class(t, n, p)
19 {
20 }

Member Function Documentation

◆ addBranches()

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

Definition at line 57 of file TruthCaloShowerDecorator.cxx.

58 {
59  const EventContext& ctx = Gaudi::Hive::currentContext();
60 
61  SG::ReadHandle<xAOD::TruthParticleContainer> truthPartContainerReadHandle{
63  };
64  const xAOD::TruthParticleContainer* truthPartContainer =
65  truthPartContainerReadHandle.ptr();
66 
67  // create truth clusters
68  ATH_MSG_DEBUG("Creating truth clusters");
70  ->processCalibHitsFromParticle()
71  .isSuccess()) {
72  ATH_MSG_FATAL("Tool " << m_calibhitToCaloCellTool << " failed.");
73  return StatusCode::FAILURE;
74  }
75 
76  ATH_MSG_DEBUG("Retrieving truth clusters");
78  truthClusterContainerEtotReadHandle{ m_truthClusterContainerEtot, ctx };
80  truthClusterContainerEvisReadHandle{ m_truthClusterContainerEvis, ctx };
81  SG::ReadHandle<xAOD::CaloClusterContainer> truthClusterContainerEemReadHandle{
83  };
84  const xAOD::CaloClusterContainer* truthClusterContainerEtot =
85  truthClusterContainerEtotReadHandle.ptr();
86  const xAOD::CaloClusterContainer* truthClusterContainerEvis =
87  truthClusterContainerEvisReadHandle.ptr();
88  const xAOD::CaloClusterContainer* truthClusterContainerEem =
89  truthClusterContainerEemReadHandle.ptr();
90 
91  if (!truthClusterContainerEtot || !truthClusterContainerEvis ||
92  !truthClusterContainerEem) {
93  ATH_MSG_ERROR("Failed to retrieve truth cluster container");
94  return StatusCode::FAILURE;
95  }
96 
99  linkDecoratorClusterEtot(m_linkDecoratorClusterEtot, ctx);
102  linkDecoratorClusterEvis(m_linkDecoratorClusterEvis, ctx);
105  linkDecoratorClusterEem(m_linkDecoratorClusterEem, ctx);
106 
108  *truthClusterContainerEtot, 0);
110  *truthClusterContainerEvis, 0);
112  *truthClusterContainerEem, 0);
113 
114  ATH_MSG_DEBUG("Decorating truth parts with truth cluster energy");
115  for (const auto* const truthPart : *truthPartContainer) {
116  if (!truthPart) continue;
117  if (!MC::isSingleParticle(truthPart)) continue;
118  linkDecoratorClusterEtot(*truthPart) = truthClusterEtot;
119  linkDecoratorClusterEvis(*truthPart) = truthClusterEvis;
120  linkDecoratorClusterEem(*truthPart) = truthClusterEem;
121  }
122  return StatusCode::SUCCESS;
123 }

◆ finalize()

StatusCode DerivationFramework::TruthCaloShowerDecorator::finalize ( )

Definition at line 51 of file TruthCaloShowerDecorator.cxx.

52 {
53  return StatusCode::SUCCESS;
54 }

◆ initialize()

StatusCode DerivationFramework::TruthCaloShowerDecorator::initialize ( )

Definition at line 23 of file TruthCaloShowerDecorator.cxx.

24 {
25  ATH_MSG_DEBUG("Initializing " << name() << "...");
26 
27  if (m_calibhitToCaloCellTool.retrieve().isFailure()) {
28  ATH_MSG_FATAL("Failed to retrieve tool " << m_calibhitToCaloCellTool);
29  return StatusCode::FAILURE;
30  }
31  ATH_MSG_INFO("Retrieved tool " << m_calibhitToCaloCellTool);
32 
37 
38  const std::string baseName = m_truthParticleContainerName.key();
39  m_linkDecoratorClusterEtot = baseName + ".truthLArClusterEtotLink";
40  m_linkDecoratorClusterEvis = baseName + ".truthLArClusterEvisLink";
41  m_linkDecoratorClusterEem = baseName + ".truthLArClusterEemLink";
42 
46 
47  return StatusCode::SUCCESS;
48 }

Member Data Documentation

◆ m_calibhitToCaloCellTool

ToolHandle<CalibHitToCaloCellTool> DerivationFramework::TruthCaloShowerDecorator::m_calibhitToCaloCellTool
private
Initial value:
{
this,
"CalibHitToCaloCellTool",
"",
"Handle to the Calib Hit to Calo cell Tool"
}

Definition at line 62 of file TruthCaloShowerDecorator.h.

◆ m_linkDecoratorClusterEem

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEem { this, "truthLArClusterEemLink", "", "" }
private

Definition at line 60 of file TruthCaloShowerDecorator.h.

◆ m_linkDecoratorClusterEtot

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEtot { this, "truthLArClusterEtotLink", "", "" }
private

Definition at line 56 of file TruthCaloShowerDecorator.h.

◆ m_linkDecoratorClusterEvis

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEvis { this, "truthLArClusterEvisLink", "", "" }
private

Definition at line 58 of file TruthCaloShowerDecorator.h.

◆ m_truthClusterContainerEem

SG::ReadHandleKey<xAOD::CaloClusterContainer> DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEem
private
Initial value:
{
"TruthLArClustersEem"
}

Definition at line 50 of file TruthCaloShowerDecorator.h.

◆ m_truthClusterContainerEtot

SG::ReadHandleKey<xAOD::CaloClusterContainer> DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEtot
private
Initial value:
{
"TruthLArClustersEtot",
}

Definition at line 44 of file TruthCaloShowerDecorator.h.

◆ m_truthClusterContainerEvis

SG::ReadHandleKey<xAOD::CaloClusterContainer> DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEvis
private
Initial value:
{
"TruthLArClustersEvis"
}

Definition at line 47 of file TruthCaloShowerDecorator.h.

◆ m_truthParticleContainerName

SG::ReadHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthCaloShowerDecorator::m_truthParticleContainerName
private
Initial value:
{
this,
"TruthParticleContainerName",
"egammaTruthParticles",
"SG key of the truth particle container"
}

SG key of the truth particle container.

Definition at line 36 of file TruthCaloShowerDecorator.h.


The documentation for this class was generated from the following files:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEem
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_linkDecoratorClusterEem
Definition: TruthCaloShowerDecorator.h:60
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEvis
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_linkDecoratorClusterEvis
Definition: TruthCaloShowerDecorator.h:58
SG::ReadHandle< xAOD::TruthParticleContainer >
DerivationFramework::TruthCaloShowerDecorator::m_linkDecoratorClusterEtot
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_linkDecoratorClusterEtot
Definition: TruthCaloShowerDecorator.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEvis
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_truthClusterContainerEvis
Definition: TruthCaloShowerDecorator.h:47
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEtot
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_truthClusterContainerEtot
Definition: TruthCaloShowerDecorator.h:44
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
DerivationFramework::TruthCaloShowerDecorator::m_truthClusterContainerEem
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_truthClusterContainerEem
Definition: TruthCaloShowerDecorator.h:50
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
MC::isSingleParticle
bool isSingleParticle(const T &p)
Identify a particlegun particle.
Definition: HepMCHelpers.h:74
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::TruthCaloShowerDecorator::m_calibhitToCaloCellTool
ToolHandle< CalibHitToCaloCellTool > m_calibhitToCaloCellTool
Definition: TruthCaloShowerDecorator.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
DerivationFramework::TruthCaloShowerDecorator::m_truthParticleContainerName
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerName
SG key of the truth particle container.
Definition: TruthCaloShowerDecorator.h:36