Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

 TruthQGDecorationTool (const std::string &t, const std::string &n, const IInterface *p)
 
 ~TruthQGDecorationTool ()
 
StatusCode initialize ()
 
virtual StatusCode addBranches () 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.

Constructor & Destructor Documentation

◆ TruthQGDecorationTool()

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

Definition at line 17 of file TruthQGDecorationTool.cxx.

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

◆ ~TruthQGDecorationTool()

DerivationFramework::TruthQGDecorationTool::~TruthQGDecorationTool ( )

Definition at line 25 of file TruthQGDecorationTool.cxx.

25  {
26 }

Member Function Documentation

◆ addBranches()

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

Definition at line 38 of file TruthQGDecorationTool.cxx.

39 {
40  // Event context
41  const EventContext& ctx = Gaudi::Hive::currentContext();
42 
43  // Retrieve the jet container
45  if (!inputJets.isValid()) {
46  ATH_MSG_ERROR("Couldn't retrieve container with name " << m_jetsKey);
47  return StatusCode::FAILURE;
48  }
49 
51  static const SG::ConstAccessor<int> PartonTruthLabelIDAcc("PartonTruthLabelID");
52  static const SG::ConstAccessor<int> HadronConeExclTruthLabelIDAcc("HadronConeExclTruthLabelID");
53 
54  for (const auto *ajet : *inputJets){
55  if (!PartonTruthLabelIDAcc.isAvailable(*ajet) ){
56  ATH_MSG_ERROR("Did not have input PartonTruthLabelID decorations available");
57  return StatusCode::FAILURE;
58  }
59  else if (!HadronConeExclTruthLabelIDAcc.isAvailable(*ajet) ){
60  ATH_MSG_ERROR("Did not have input HadronConeExclTruthLabelID decorations available");
61  return StatusCode::FAILURE;
62  } // Now we have the input decorations
63  /* Agreement from the HF-tagging and Jet/MET group:
64  - If it is non-zero, use the label from the HF-tagging group (b, c, tau)
65  - If it is zero, use the label from the Jet/MET group (q/g)
66  - In the case that the two disagree (e.g. Jet/MET says b and HF says light),
67  multiply the Jet/MET label by 100 to ensure this case is kept separate
68  */
69  if (HadronConeExclTruthLabelIDAcc(*ajet)!=0){
70  output_decorator(*ajet) = HadronConeExclTruthLabelIDAcc(*ajet);
71  } else {
72  int labelid = PartonTruthLabelIDAcc(*ajet);
73  if (std::abs(labelid)!=5 &&
74  std::abs(labelid)!=4 &&
75  std::abs(labelid)!=15){
76  output_decorator(*ajet) = labelid;
77  } else {
78  output_decorator(*ajet) = labelid*100;
79  }
80  }
81  } // Loop over jets
82 
83  return StatusCode::SUCCESS;
84 }

◆ initialize()

StatusCode DerivationFramework::TruthQGDecorationTool::initialize ( )

Definition at line 29 of file TruthQGDecorationTool.cxx.

29  {
30 
33  return StatusCode::SUCCESS;
34 
35 }

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 36 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 33 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:34
SG::ConstAccessor< int >
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TruthQGDecorationTool::m_decOutput
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decOutput
output decoration
Definition: TruthQGDecorationTool.h:37
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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.