ATLAS Offline Software
DiTauTruthMatchingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 
15 //
16 // method implementations
17 //
18 
19 namespace CP
20 {
21 
23  initialize ()
24  {
25  ANA_CHECK (m_matchingTool.retrieve());
29  return StatusCode::SUCCESS;
30  }
31 
32 
33 
35  execute ()
36  {
37  for (const auto& sys : m_systematicsList.systematicsVector())
38  {
39  const xAOD::DiTauJetContainer *taus = nullptr;
41  // all decorations done within the DiTauTruthMatchingTool and to be saved in output
42  static const SG::Decorator<float> accTruthVisLeadPt("TruthVisLeadPt");
43  static const SG::Decorator<float> accTruthVisLeadEta("TruthVisLeadEta");
44  static const SG::Decorator<float> accTruthVisLeadPhi("TruthVisLeadPhi");
45  static const SG::Decorator<float> accTruthVisLeadM("TruthVisLeadM");
46  static const SG::Decorator<int> accTruthLeadPdgID("TruthLeadPdgID");
47  static const SG::Decorator<float> accTruthVisSubleadPt("TruthVisSubleadPt");
48  static const SG::Decorator<float> accTruthVisSubleadEta("TruthVisSubleadEta");
49  static const SG::Decorator<float> accTruthVisSubleadPhi("TruthVisSubleadPhi");
50  static const SG::Decorator<float> accTruthVisSubleadM("TruthVisSubleadM");
51  static const SG::Decorator<int> accTruthSubleadPdgID("TruthSubleadPdgID");
52  static const SG::Decorator<float> accTruthVisDeltaR("TruthVisDeltaR");
53  static const SG::Decorator<float> accTruthVisMass("TruthVisMass");
54  static const SG::Decorator<char> accIsTruthMatched("IsTruthMatched");
55  static const SG::Decorator<char> accIsTruthHadronic("IsTruthHadronic");
56 
57  for (const xAOD::DiTauJet *tau : *taus)
58  {
59  if (m_preselection.getBool (*tau, sys))
60  {
61  m_matchingTool->getTruth (*tau);
62  } else {
63  // for failed selection, use the same default value as for failed match
64  accTruthVisLeadPt(*tau) = -1234;
65  accTruthVisLeadEta(*tau) = -1234;
66  accTruthVisLeadPhi(*tau) = -1234;
67  accTruthVisLeadM(*tau) = -1234;
68  accTruthLeadPdgID(*tau) = -1234;
69  accTruthVisSubleadPt(*tau) = -1234;
70  accTruthVisSubleadEta(*tau) = -1234;
71  accTruthVisSubleadPhi(*tau) = -1234;
72  accTruthVisSubleadM(*tau) = -1234;
73  accTruthSubleadPdgID(*tau) = -1234;
74  accTruthVisDeltaR(*tau) = -1234;
75  accTruthVisMass(*tau) = -1234;
76  accIsTruthMatched(*tau) = char(false);
77  accIsTruthHadronic(*tau) = char(false);
78  }
79  }
80  }
81  return StatusCode::SUCCESS;
82  }
83 }
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
CP::DiTauTruthMatchingAlg::execute
StatusCode execute() override
Definition: DiTauTruthMatchingAlg.cxx:35
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
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:25
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::DiTauTruthMatchingAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: DiTauTruthMatchingAlg.h:48
CP::SysReadHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
CP::SysReadSelectionHandle::getBool
bool getBool(const SG::AuxElement &element, const CP::SystematicSet &sys) const
get the selection as a bool
SG::Decorator< float >
CP::DiTauTruthMatchingAlg::m_matchingTool
ToolHandle< TauAnalysisTools::IDiTauTruthMatchingTool > m_matchingTool
the matching tool
Definition: DiTauTruthMatchingAlg.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
CP::DiTauTruthMatchingAlg::initialize
StatusCode initialize() override
Definition: DiTauTruthMatchingAlg.cxx:23
CP::DiTauTruthMatchingAlg::m_tauHandle
SysReadHandle< xAOD::DiTauJetContainer > m_tauHandle
the tau collection we run on
Definition: DiTauTruthMatchingAlg.h:43
DiTauTruthMatchingAlg.h
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:27
CP::DiTauTruthMatchingAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: DiTauTruthMatchingAlg.h:39