ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::TruthQGDecorationTool Class Reference

#include <TruthQGDecorationTool.h>

Inheritance diagram for DerivationFramework::TruthQGDecorationTool:
Collaboration diagram for DerivationFramework::TruthQGDecorationTool:

Public Member Functions

StatusCode initialize ()
virtual StatusCode addBranches (const EventContext &ctx) const

Private Attributes

SG::ReadHandleKey< xAOD::JetContainerm_jetsKey {this, "JetCollection", "AntiKt4TruthWZJets", "Name of jet collection for decoration"}
 input collection key
SG::WriteDecorHandleKey< xAOD::JetContainerm_decOutput {this, "TrueFlavor", m_jetsKey, "TrueFlavor", "Name of the output decoration on the jet"}
 output decoration

Detailed Description

Definition at line 24 of file TruthQGDecorationTool.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::TruthQGDecorationTool::addBranches ( const EventContext & ctx) const
virtual

Definition at line 26 of file TruthQGDecorationTool.cxx.

27{
28 // Event context
29
30 // Retrieve the jet container
31 SG::ReadHandle<xAOD::JetContainer> inputJets(m_jetsKey, ctx);
32 if (!inputJets.isValid()) {
33 ATH_MSG_ERROR("Couldn't retrieve container with name " << m_jetsKey);
34 return StatusCode::FAILURE;
35 }
36
37 SG::WriteDecorHandle<xAOD::JetContainer,int> output_decorator(m_decOutput, ctx);
38 static const SG::ConstAccessor<int> PartonTruthLabelIDAcc("PartonTruthLabelID");
39 static const SG::ConstAccessor<int> HadronConeExclTruthLabelIDAcc("HadronConeExclTruthLabelID");
40
41 for (const auto *ajet : *inputJets){
42 if (!PartonTruthLabelIDAcc.isAvailable(*ajet) ){
43 ATH_MSG_ERROR("Did not have input PartonTruthLabelID decorations available");
44 return StatusCode::FAILURE;
45 }
46 else if (!HadronConeExclTruthLabelIDAcc.isAvailable(*ajet) ){
47 ATH_MSG_ERROR("Did not have input HadronConeExclTruthLabelID decorations available");
48 return StatusCode::FAILURE;
49 } // Now we have the input decorations
50 /* Agreement from the HF-tagging and Jet/MET group:
51 - If it is non-zero, use the label from the HF-tagging group (b, c, tau)
52 - If it is zero, use the label from the Jet/MET group (q/g)
53 - In the case that the two disagree (e.g. Jet/MET says b and HF says light),
54 multiply the Jet/MET label by 100 to ensure this case is kept separate
55 */
56 if (HadronConeExclTruthLabelIDAcc(*ajet)!=0){
57 output_decorator(*ajet) = HadronConeExclTruthLabelIDAcc(*ajet);
58 } else {
59 int labelid = PartonTruthLabelIDAcc(*ajet);
60 if (std::abs(labelid)!=5 &&
61 std::abs(labelid)!=4 &&
62 std::abs(labelid)!=15){
63 output_decorator(*ajet) = labelid;
64 } else {
65 output_decorator(*ajet) = labelid*100;
66 }
67 }
68 } // Loop over jets
69
70 return StatusCode::SUCCESS;
71}
#define ATH_MSG_ERROR(x)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decOutput
output decoration
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
input collection key

◆ initialize()

StatusCode DerivationFramework::TruthQGDecorationTool::initialize ( )

Definition at line 17 of file TruthQGDecorationTool.cxx.

17 {
18
19 ATH_CHECK(m_jetsKey.initialize());
20 ATH_CHECK(m_decOutput.initialize());
21 return StatusCode::SUCCESS;
22
23}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_decOutput

SG::WriteDecorHandleKey<xAOD::JetContainer> DerivationFramework::TruthQGDecorationTool::m_decOutput {this, "TrueFlavor", m_jetsKey, "TrueFlavor", "Name of the output decoration on the jet"}
private

output decoration

Definition at line 37 of file TruthQGDecorationTool.h.

38{this, "TrueFlavor", m_jetsKey, "TrueFlavor", "Name of the output decoration on the jet"};

◆ m_jetsKey

SG::ReadHandleKey<xAOD::JetContainer> DerivationFramework::TruthQGDecorationTool::m_jetsKey {this, "JetCollection", "AntiKt4TruthWZJets", "Name of jet collection for decoration"}
private

input collection key

Definition at line 34 of file TruthQGDecorationTool.h.

35{this, "JetCollection", "AntiKt4TruthWZJets", "Name of jet collection for decoration"};

The documentation for this class was generated from the following files: