ATLAS Offline Software
JetPileupLabelingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
11 
13 
14  ATH_MSG_INFO("Initializing " << name());
15  print();
16 
19 
20  ATH_CHECK(m_truthJetsKey.initialize());
21 #ifndef XAOD_STANDALONE
23  // For analysis applications, may not enforce scheduling via data deps
26  }
27 #endif
28  ATH_CHECK(m_decIsHSKey.initialize());
29  ATH_CHECK(m_decIsPUKey.initialize());
30 
31  return StatusCode::SUCCESS;
32 }
33 
35 
36  ATH_MSG_INFO("Parameters for " << name() << " :");
37  ATH_MSG_INFO("HS Truth Jet Container: " << m_truthJetsKey.key());
38  ATH_MSG_INFO("Name of isHS Label Decoration: " << m_decIsHSKey.key());
39  ATH_MSG_INFO("Name of isPU Label Decoration: " << m_decIsPUKey.key());
40 }
41 
42 
44 
45  // Get collection of HS Truth Jets
47  if (!truthHSJetsHandle.isValid()){
48  ATH_MSG_ERROR("Invalid JetContainer datahandle: " << m_truthJetsKey.key());
49  return StatusCode::FAILURE;
50  }
51  const xAOD::JetContainer* truthHSJets = truthHSJetsHandle.cptr();
52 
55 
56  for (const xAOD::Jet* jet : jets){
57  bool isHS = false;
58  bool isPU = true;
59  for (const xAOD::Jet *truthJet : *truthHSJets) {
60  float dr = jet->p4().DeltaR(truthJet->p4());
61  if (dr < m_hsMaxDR && jet->pt() > m_hsMinPt)
62  isHS = true;
63  if (dr < m_puMinDR && jet->pt() > m_puMinPt)
64  isPU = false;
65  if (isHS && !isPU)
66  break;
67  }
68  isHSJetHandle(*jet) = isHS;
69  isPUJetHandle(*jet) = isPU;
70  }
71 
72  return StatusCode::SUCCESS;
73 }
74 
JetPileupLabelingTool::decorate
StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate hard-scatter and pileup labels to a jet collection.
Definition: JetPileupLabelingTool.cxx:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
JetPileupLabelingTool::m_suppressOutputDeps
Gaudi::Property< bool > m_suppressOutputDeps
Definition: JetPileupLabelingTool.h:43
JetPileupLabelingTool.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
JetPileupLabelingTool::m_decIsHSKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decIsHSKey
Definition: JetPileupLabelingTool.h:52
AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
test_pyathena.pt
pt
Definition: test_pyathena.py:11
JetPileupLabelingTool::print
void print() const override
Print configured parameters.
Definition: JetPileupLabelingTool.cxx:34
JetPileupLabelingTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetPileupLabelingTool.cxx:12
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
JetPileupLabelingTool::m_puMinPt
Gaudi::Property< float > m_puMinPt
Definition: JetPileupLabelingTool.h:48
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
WriteDecorHandle.h
Handle class for adding a decoration to an object.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
JetPileupLabelingTool::m_truthJetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetsKey
Definition: JetPileupLabelingTool.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ReadHandle.h
Handle class for reading from StoreGate.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ReadDecorHandle.h
Handle class for reading a decoration on an object.
JetPileupLabelingTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetPileupLabelingTool.h:41
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetPileupLabelingTool::m_hsMinPt
Gaudi::Property< float > m_hsMinPt
Definition: JetPileupLabelingTool.h:46
JetPileupLabelingTool::m_decIsPUKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decIsPUKey
Definition: JetPileupLabelingTool.h:53