ATLAS Offline Software
JetTruthTagAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 namespace CP {
13  ANA_CHECK(m_truthJets.initialize());
14  if (!m_isHS.empty())
15  m_decIsHS.emplace(m_isHS);
16  if (!m_isPU.empty())
17  m_decIsPU.emplace(m_isPU);
18 
19  return StatusCode::SUCCESS;
20  }
21 
23  auto truthJets = SG::makeHandle(m_truthJets);
24  if (!truthJets.isValid()) {
25  ATH_MSG_ERROR("Failed to retrieve " << m_truthJets.key());
26  return StatusCode::FAILURE;
27  }
28  for (const auto& sys : m_systematicsList.systematicsVector()) {
29  const xAOD::JetContainer *jets{nullptr};
31 
32  for (const xAOD::Jet *jet : *jets) {
33  bool isHS = false;
34  bool isPU = true;
35  for (const xAOD::Jet *truthJet : *truthJets) {
36  float dr = jet->p4().DeltaR(truthJet->p4());
37  if (dr < m_hsMaxDR && jet->pt() > m_hsMinPt)
38  isHS = true;
39  if (dr < m_puMinDR && jet->pt() > m_puMinPt)
40  isPU = false;
41  if (isHS && !isPU)
42  break;
43  }
44  if (m_decIsHS)
45  (*m_decIsHS)(*jet) = isHS;
46  if (m_decIsPU)
47  (*m_decIsPU)(*jet) = isPU;
48  }
49  }
50  return StatusCode::SUCCESS;
51  }
52 }
CP::JetTruthTagAlg::m_hsMinPt
Gaudi::Property< float > m_hsMinPt
Definition: JetTruthTagAlg.h:35
CP::JetTruthTagAlg::m_puMinPt
Gaudi::Property< float > m_puMinPt
Definition: JetTruthTagAlg.h:37
CP::JetTruthTagAlg::m_isPU
Gaudi::Property< std::string > m_isPU
Definition: JetTruthTagAlg.h:33
test_pyathena.pt
pt
Definition: test_pyathena.py:11
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysReadHandle::retrieve
::StatusCode retrieve(const T *&object, const CP::SystematicSet &sys) const
retrieve the object for the given name
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::JetTruthTagAlg::m_decIsPU
std::optional< SG::AuxElement::Decorator< char > > m_decIsPU
Definition: JetTruthTagAlg.h:40
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::JetTruthTagAlg::execute
virtual StatusCode execute() override
Definition: JetTruthTagAlg.cxx:22
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
CP::SysReadHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
CP::JetTruthTagAlg::m_systematicsList
SysListHandle m_systematicsList
Definition: JetTruthTagAlg.h:29
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::JetTruthTagAlg::m_isHS
Gaudi::Property< std::string > m_isHS
Definition: JetTruthTagAlg.h:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
WriteDecorHandle.h
Handle class for adding a decoration to an object.
CP::JetTruthTagAlg::m_jets
SysReadHandle< xAOD::JetContainer > m_jets
Definition: JetTruthTagAlg.h:30
ReadHandle.h
Handle class for reading from StoreGate.
CP::JetTruthTagAlg::m_decIsHS
std::optional< SG::AuxElement::Decorator< char > > m_decIsHS
Definition: JetTruthTagAlg.h:39
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::JetTruthTagAlg::initialize
virtual StatusCode initialize() override
Definition: JetTruthTagAlg.cxx:10
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
CP::JetTruthTagAlg::m_truthJets
SG::ReadHandleKey< xAOD::JetContainer > m_truthJets
Definition: JetTruthTagAlg.h:31
JetTruthTagAlg.h