ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 More...
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_decOutput {this, "TrueFlavor", m_jetsKey, "TrueFlavor", "Name of the output decoration on the jet"}
 output decoration More...
 

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
32  if (!inputJets.isValid()) {
33  ATH_MSG_ERROR("Couldn't retrieve container with name " << m_jetsKey);
34  return StatusCode::FAILURE;
35  }
36 
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 }

◆ initialize()

StatusCode DerivationFramework::TruthQGDecorationTool::initialize ( )

Definition at line 17 of file TruthQGDecorationTool.cxx.

17  {
18 
21  return StatusCode::SUCCESS;
22 
23 }

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.

◆ 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.


The documentation for this class was generated from the following files:
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::TruthQGDecorationTool::m_jetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
input collection key
Definition: TruthQGDecorationTool.h:35
SG::ConstAccessor< int >
DerivationFramework::TruthQGDecorationTool::m_decOutput
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decOutput
output decoration
Definition: TruthQGDecorationTool.h:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
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
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.