ATLAS Offline Software
Loading...
Searching...
No Matches
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
19namespace CP
20{
21
22 StatusCode DiTauTruthMatchingAlg ::
23 initialize ()
24 {
25 ANA_CHECK (m_matchingTool.retrieve());
28 ANA_CHECK (m_systematicsList.initialize());
29 return StatusCode::SUCCESS;
30 }
31
32
33
34 StatusCode DiTauTruthMatchingAlg ::
35 execute ()
36 {
37 for (const auto& sys : m_systematicsList.systematicsVector())
38 {
39 const xAOD::DiTauJetContainer *taus = nullptr;
40 ANA_CHECK (m_tauHandle.retrieve (taus, sys));
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}
#define ANA_CHECK(EXP)
check whether the given expression was successful
static Double_t taus
SysListHandle m_systematicsList
the systematics list we run
SysReadHandle< xAOD::DiTauJetContainer > m_tauHandle
the tau collection we run on
SysReadSelectionHandle m_preselection
the preselection we apply to our input
ToolHandle< TauAnalysisTools::IDiTauTruthMatchingTool > m_matchingTool
the matching tool
Helper class to provide type-safe access to aux data.
Definition Decorator.h:59
Select isolated Photons, Electrons and Muons.
DiTauJetContainer_v1 DiTauJetContainer
Definition of the current DiTauJet container version.
DiTauJet_v1 DiTauJet
Definition of the current version.
Definition DiTauJet.h:17