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

#include <ClassifyAndCalculateHFAugmentation.h>

Inheritance diagram for DerivationFramework::ClassifyAndCalculateHFAugmentation:
Collaboration diagram for DerivationFramework::ClassifyAndCalculateHFAugmentation:

Public Member Functions

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

Private Attributes

SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthParticlesKey {this, "TruthParticleContainerName", "TruthParticles", "Name of the truth particles collection that is used to compute the HF Classification"}
 
SG::ReadHandleKey< xAOD::JetContainerm_jetCollectionKey {this, "jetCollectionName", "AntiKt4TruthDressedWZJets", "Name of the jet collection that is used to compute the HF Classification"}
 
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfo", "EventInfo", ""}
 
SG::WriteDecorHandleKey< xAOD::EventInfom_hfDecorKey {this, "EventInfoHFDecorName", "", "Name that is used to store the HF Classification."}
 
SG::WriteDecorHandleKey< xAOD::EventInfom_SimplehfDecorKey {this, "EventInfoSimpleHFDecorName", "", "Name that is used to store the simple HF Classification."}
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_jetIDDecorationKey {this, "JetOriginIDDecorationKey", "", "jet origin ID decoration key"}
 
Gaudi::Property< std::string > m_hfDecorationName {this, "hfDecorationName", "HF_Classification", "Name that is used to store the HF Classification."}
 
Gaudi::Property< std::string > m_SimplehfDecorationName {this, "SimplehfDecorationName", "SimpleHFClassification", "Name that is used to store the simple HF Classification."}
 
Gaudi::Property< std::string > m_jetIDDecorationName {this, "HadronOriginIDDecorationName", "HFHadronOriginID", "Name that is used to store the jet origin ID."}
 
ToolHandle< DerivationFramework::JetMatchingToolm_JetMatchingTool_Tool
 
ToolHandle< DerivationFramework::ClassifyAndCalculateHFToolm_HFClassification_tool
 
ToolHandle< DerivationFramework::HadronOriginClassifierm_HadronOriginClassifier_Tool
 

Detailed Description

Definition at line 60 of file ClassifyAndCalculateHFAugmentation.h.

Constructor & Destructor Documentation

◆ ClassifyAndCalculateHFAugmentation()

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

Definition at line 27 of file ClassifyAndCalculateHFAugmentation.cxx.

27  :
28  base_class(t,n,p), // Athena tool.
29  m_JetMatchingTool_Tool(""), // Hadron-jet matching tool.
30  m_HFClassification_tool(""), // HF classifier tool.
31  m_HadronOriginClassifier_Tool("") // HF hadron origin tool.
32  {
33 
34  // Declare a set of tool properties to set them exertanally:
35  // -m_HFClassification_tool: The tool to compute the HF classifier.
36  // -m_HadronOriginClassifier_Tool: The tool to determine the origin of the HF hadrons.
37  // -m_JetMatchingTool_Tool: The tool to match the hadrons with the jets.
38 
39  declareProperty("ClassifyAndComputeHFtool", m_HFClassification_tool);
40  declareProperty("HadronOriginClassifierTool", m_HadronOriginClassifier_Tool);
41  declareProperty("JetMatchingTool", m_JetMatchingTool_Tool);
42  }

◆ ~ClassifyAndCalculateHFAugmentation()

DerivationFramework::ClassifyAndCalculateHFAugmentation::~ClassifyAndCalculateHFAugmentation ( )

Definition at line 44 of file ClassifyAndCalculateHFAugmentation.cxx.

44 {}

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::ClassifyAndCalculateHFAugmentation::addBranches ( ) const
overridevirtual

Definition at line 101 of file ClassifyAndCalculateHFAugmentation.cxx.

102  {
103 
104  const EventContext& ctx = Gaudi::Hive::currentContext();
105 
106  // Retrieve the truth particle container
108  if (!truthParticlesHandle.isValid()) {
109  ATH_MSG_ERROR ("Could not retrieve TruthParticleContainer " << truthParticlesHandle.key());
110  return StatusCode::FAILURE;
111  }
112  const xAOD::TruthParticleContainer* xTruthParticleContainer = truthParticlesHandle.cptr();
113 
114  // Retrieve the jets container
116  if (!jetInputHandle.isValid()) {
117  ATH_MSG_ERROR ("Could not retrieve JetContainer " << jetInputHandle.key());
118  return StatusCode::FAILURE;
119  }
120  const xAOD::JetContainer* JetCollection = jetInputHandle.cptr();
121 
122  // Compute a map that associates the HF hadrons with their origin using the tool m_HadronOriginClassifier_Tool.
123  std::map<const xAOD::TruthParticle*, DerivationFramework::HadronOriginClassifier::HF_id> hadronMap = m_HadronOriginClassifier_Tool->GetOriginMap();
124 
125  // Create a map with a list of matched hadrons for each jet.
126  std::map<const xAOD::Jet*, std::vector<xAOD::TruthParticleContainer::const_iterator>> particleMatch = m_JetMatchingTool_Tool->matchHadronsToJets(xTruthParticleContainer, JetCollection);
127 
128  // Calculate the necessary information from the jets to compute the HF classifier.
129  m_HFClassification_tool->flagJets(JetCollection, particleMatch, hadronMap, m_hfDecorationName);
130 
131  // Compute the HF classifier and the simple HF classifier.
132  int hfclassif = m_HFClassification_tool->computeHFClassification(JetCollection, m_hfDecorationName);
133  int simpleclassif = m_HFClassification_tool->getSimpleClassification(hfclassif);
134 
135  // Retrieve EventInfo
136  SG::ReadHandle<xAOD::EventInfo> eventInfoHandle(m_eventInfoKey, ctx);
137  if (!eventInfoHandle.isValid()) {
138  ATH_MSG_ERROR ("Could not retrieve EventInfo " << eventInfoHandle.key());
139  return StatusCode::FAILURE;
140  }
141  const xAOD::EventInfo* EventInfo = eventInfoHandle.cptr();
142 
143  // Decorate EventInfo with the HF Classification and the simple version
144  SG::WriteDecorHandle<xAOD::EventInfo, int> decorator_HFClassification(m_hfDecorKey, ctx);
145  decorator_HFClassification(*EventInfo) = hfclassif;
146 
147  SG::WriteDecorHandle<xAOD::EventInfo, int> decorator_SimpleHFClassification(m_SimplehfDecorKey, ctx);
148  decorator_SimpleHFClassification(*EventInfo) = simpleclassif;
149 
150  // Decorate truth jets with origin ID
152  for (const auto jet : *JetCollection) {
153  int id = -999;
155  if(hfidAcc.isAvailable(*jet)){
156  id = hfidAcc(*jet);
157  }
158  jetIdDecorator(*jet) = id;
159  }
160 
161  return StatusCode::SUCCESS;
162  }

◆ finalize()

StatusCode DerivationFramework::ClassifyAndCalculateHFAugmentation::finalize ( )
overridevirtual

Definition at line 91 of file ClassifyAndCalculateHFAugmentation.cxx.

91  {
92  return StatusCode::SUCCESS;
93  }

◆ initialize()

StatusCode DerivationFramework::ClassifyAndCalculateHFAugmentation::initialize ( )
overridevirtual

Definition at line 52 of file ClassifyAndCalculateHFAugmentation.cxx.

52  {
53 
54  ATH_MSG_INFO("Initialize HF computation");
55 
56  ATH_MSG_INFO("Jets Container Name " << m_jetCollectionKey.key());
57  ATH_MSG_INFO("Truth Particles Container Name " << m_truthParticlesKey.key());
58  ATH_MSG_INFO("HF Classifier Name " << m_hfDecorationName);
59  ATH_MSG_INFO("Simple HF Classifier Name " << m_SimplehfDecorationName);
60  ATH_MSG_INFO("Jet Origin ID Decoration Name " << m_jetIDDecorationName);
61 
71 
72  // Retrieve the necessary tools
73  if(m_HFClassification_tool.retrieve().isFailure()){
74  ATH_MSG_ERROR("Unable to retrieve the tool " << m_HFClassification_tool);
75  return StatusCode::FAILURE;
76  }
77 
78  if(m_HadronOriginClassifier_Tool.retrieve().isFailure()){
79  ATH_MSG_ERROR("Unable to retrieve the tool " << m_HadronOriginClassifier_Tool);
80  return StatusCode::FAILURE;
81  }
82 
83  if(m_JetMatchingTool_Tool.retrieve().isFailure()){
84  ATH_MSG_ERROR("Unable to retrieve the tool " << m_JetMatchingTool_Tool);
85  return StatusCode::FAILURE;
86  }
87 
88  return StatusCode::SUCCESS;
89  }

Member Data Documentation

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_eventInfoKey {this, "EventInfo", "EventInfo", ""}
private

Definition at line 94 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_HadronOriginClassifier_Tool

ToolHandle<DerivationFramework::HadronOriginClassifier> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_HadronOriginClassifier_Tool
private

Definition at line 115 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_HFClassification_tool

ToolHandle<DerivationFramework::ClassifyAndCalculateHFTool> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_HFClassification_tool
private

Definition at line 114 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_hfDecorationName

Gaudi::Property<std::string> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_hfDecorationName {this, "hfDecorationName", "HF_Classification", "Name that is used to store the HF Classification."}
private

Definition at line 104 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_hfDecorKey

SG::WriteDecorHandleKey<xAOD::EventInfo> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_hfDecorKey {this, "EventInfoHFDecorName", "", "Name that is used to store the HF Classification."}
private

Definition at line 96 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_jetCollectionKey

SG::ReadHandleKey<xAOD::JetContainer> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetCollectionKey {this, "jetCollectionName", "AntiKt4TruthDressedWZJets", "Name of the jet collection that is used to compute the HF Classification"}
private

Definition at line 93 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_jetIDDecorationKey

SG::WriteDecorHandleKey<xAOD::JetContainer> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetIDDecorationKey {this, "JetOriginIDDecorationKey", "", "jet origin ID decoration key"}
private

Definition at line 98 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_jetIDDecorationName

Gaudi::Property<std::string> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetIDDecorationName {this, "HadronOriginIDDecorationName", "HFHadronOriginID", "Name that is used to store the jet origin ID."}
private

Definition at line 106 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_JetMatchingTool_Tool

ToolHandle<DerivationFramework::JetMatchingTool> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_JetMatchingTool_Tool
private

Definition at line 113 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_SimplehfDecorationName

Gaudi::Property<std::string> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_SimplehfDecorationName {this, "SimplehfDecorationName", "SimpleHFClassification", "Name that is used to store the simple HF Classification."}
private

Definition at line 105 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_SimplehfDecorKey

SG::WriteDecorHandleKey<xAOD::EventInfo> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_SimplehfDecorKey {this, "EventInfoSimpleHFDecorName", "", "Name that is used to store the simple HF Classification."}
private

Definition at line 97 of file ClassifyAndCalculateHFAugmentation.h.

◆ m_truthParticlesKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> DerivationFramework::ClassifyAndCalculateHFAugmentation::m_truthParticlesKey {this, "TruthParticleContainerName", "TruthParticles", "Name of the truth particles collection that is used to compute the HF Classification"}
private

Definition at line 92 of file ClassifyAndCalculateHFAugmentation.h.


The documentation for this class was generated from the following files:
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_SimplehfDecorKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_SimplehfDecorKey
Definition: ClassifyAndCalculateHFAugmentation.h:97
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_JetMatchingTool_Tool
ToolHandle< DerivationFramework::JetMatchingTool > m_JetMatchingTool_Tool
Definition: ClassifyAndCalculateHFAugmentation.h:113
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: ClassifyAndCalculateHFAugmentation.h:94
SG::WriteDecorHandleKey::assign
virtual StatusCode assign(const std::string &sgkey) override
Change the key of the object to which we're referring.
SG::ReadHandle< xAOD::TruthParticleContainer >
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_HFClassification_tool
ToolHandle< DerivationFramework::ClassifyAndCalculateHFTool > m_HFClassification_tool
Definition: ClassifyAndCalculateHFAugmentation.h:114
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_HadronOriginClassifier_Tool
ToolHandle< DerivationFramework::HadronOriginClassifier > m_HadronOriginClassifier_Tool
Definition: ClassifyAndCalculateHFAugmentation.h:115
SG::ConstAccessor< int >
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:727
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetCollectionKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetCollectionKey
Definition: ClassifyAndCalculateHFAugmentation.h:93
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_hfDecorationName
Gaudi::Property< std::string > m_hfDecorationName
Definition: ClassifyAndCalculateHFAugmentation.h:104
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetIDDecorationName
Gaudi::Property< std::string > m_jetIDDecorationName
Definition: ClassifyAndCalculateHFAugmentation.h:106
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
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.
JetCollection
Container for Jets
Definition: JetCollection.h:30
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_SimplehfDecorationName
Gaudi::Property< std::string > m_SimplehfDecorationName
Definition: ClassifyAndCalculateHFAugmentation.h:105
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_jetIDDecorationKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetIDDecorationKey
Definition: ClassifyAndCalculateHFAugmentation.h:98
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_truthParticlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
Definition: ClassifyAndCalculateHFAugmentation.h:92
DerivationFramework::ClassifyAndCalculateHFAugmentation::m_hfDecorKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_hfDecorKey
Definition: ClassifyAndCalculateHFAugmentation.h:96