ATLAS Offline Software
TruthCategoriesDecorator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Tool to decorate the EventInfo object with truth categories informations
6 // Authors: T. Guillemin, J. Lacey, D. Gillberg
7 
8 #ifndef DerivationFrameworkHiggs_TruthCategoriesDecorator_H
9 #define DerivationFrameworkHiggs_TruthCategoriesDecorator_H
10 
12 #include "GaudiKernel/ToolHandle.h"
15 
16 // EDM: typedefs, so must be included and not forward-referenced
19 
20 // Note: must include TLorentzVector before the next one
21 
25 
26 namespace DerivationFramework {
27 
29  public:
30  TruthCategoriesDecorator(const std::string& n, ISvcLocator* p);
31  virtual ~TruthCategoriesDecorator() = default;
33  StatusCode execute(const EventContext& ctx) const;
34 
35  private:
36  ToolHandle<IxAODtoHepMCTool> m_xAODtoHepMCTool{this, "HepMCTool", "xAODtoHepMCTool"};
37  ToolHandle<IHiggsTruthCategoryTool> m_higgsTruthCatTool{this, "CategoryTool", "HiggsTruthCategoryTool"};
38 
39  // Path to TEnv file containing MC-channel-number <-> HiggsProdMode map
40  Gaudi::Property<std::string> m_configPath{this, "ConfigPath", "DerivationFrameworkHiggs/HiggsMCsamples.cfg"};
41  struct HTXSSample {
46  // DSIDs satisfying this production mode
47  std::set<int> dsids{};
48  };
49 
50  std::vector<HTXSSample> m_htxs_samples{};
51 
52  // Detail level. Steers amount of decoration.
53  // 0: basic information. Categoization ints, Higgs prod mode, Njets, Higgs pT
54  // 1: the above + Higgs boson 4-vec + associated V 4-vec
55  // 2: the above + truth jets built excluding the Higgs boson decay
56  // 3: the above + 4-vector sum of all decay products from Higgs boson and V-boson
57  Gaudi::Property<int> m_detailLevel{this, "DetailLevel", 3};
58 
59  SG::ReadHandleKey<xAOD::TruthEventContainer> m_truthEvtKey{this, "TruthEvtKey", "TruthEvents"};
60  SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey{this, "EvtKey", "EventInfo"};
61 
63 
65  { this, "ProdModeDecorKey", m_evtInfoKey, "HTXS_prodMode", "" };
67  { this, "ErrorCodeDecorKey", m_evtInfoKey, "HTXS_errorCore", "" };
69  { this, "Stage0CatDecorKey", m_evtInfoKey, "HTXS_Stage0_Category", "" };
70  // Stage 1 binning
72  { this, "Stage1CatPt25Key", m_evtInfoKey, "HTXS_Stage1_Category_pTjet25", "" };
74  { this, "Stage1CatPt30Key", m_evtInfoKey, "HTXS_Stage1_Category_pTjet30", "" };
76  { this, "Stage1IdxPt25Key", m_evtInfoKey, "HTXS_Stage1_FineIndex_pTjet25", "" };
78  { this, "Stage1IdxPt30Key", m_evtInfoKey, "HTXS_Stage1_FineIndex_pTjet30", "" };
79 
80  // Stage-1.2 binning
82  { this, "Stage1p2_CatPt25Key", m_evtInfoKey, "HTXS_Stage1_2_Category_pTjet25", "" };
84  { this, "Stage1p2_CatPt30Key", m_evtInfoKey, "HTXS_Stage1_2_Category_pTjet30", "" };
86  { this, "Stage1p2_IdxPt25Key", m_evtInfoKey, "HTXS_Stage1_2_FineIndex_pTjet25", "" };
88  { this, "Stage1p2_IdxPt30Key", m_evtInfoKey, "HTXS_Stage1_2_FineIndex_pTjet30", "" };
89 
90  // Stage-1.2 finer binning
92  { this, "Stage1p2_Fine_CatPt25Key", m_evtInfoKey, "HTXS_Stage1_2_Fine_Category_pTjet25", "" };
94  { this, "Stage1p2_Fine_CatPt30Key", m_evtInfoKey, "HTXS_Stage1_2_Fine_Category_pTjet30", "" };
96  { this, "Stage1p2_Fine_IdxPt25Key", m_evtInfoKey, "HTXS_Stage1_2_Fine_FineIndex_pTjet25", "" };
98  { this, "Stage1p2_Fine_IdxPt30Key", m_evtInfoKey, "HTXS_Stage1_2_Fine_FineIndex_pTjet30", "" };
99 
101  { this, "NJets25Key", m_evtInfoKey, "HTXS_Njets_pTjet25", "" };
103  { this, "NJets30Key", m_evtInfoKey, "HTXS_Njets_pTjet30", "" };
105  { this, "IsZnunuKey", m_evtInfoKey, "HTXS_isZ2vvDecay", "" };
106 
111  const std::string& the_prefix) :
112  prefix{the_prefix},
113  pt{parent, prefix + "_ptKey", ei_key, prefix + "_pt"},
114  eta{parent, prefix + "_etaKey", ei_key, prefix + "_eta"},
115  phi{parent, prefix + "_phiKey", ei_key, prefix + "_phi"},
116  m{parent, prefix + "_mKey", ei_key, prefix + "_m"} {}
117  std::string prefix;
123  if (!pt.initialize(used).isSuccess() || !eta.initialize(used).isSuccess() || !phi.initialize(used).isSuccess() || !m.initialize(used).isSuccess()){
124  return StatusCode::FAILURE;
125  }
126  return StatusCode::SUCCESS;
127  }
128  };
129 
131  { this, "Higgs_ptKey", m_evtInfoKey, "HTXS_Higgs_pt", "" };
133  { this, m_evtInfoKey, "HTXS_Higgs" };
135  { this, m_evtInfoKey, "HTXS_V" };
137  { this, m_evtInfoKey, "HTXS_V_jets25" };
139  { this, m_evtInfoKey, "HTXS_V_jets30" };
141  { this, m_evtInfoKey, "HTXS_Higgs_decay" };
143  { this, m_evtInfoKey, "HTXS_V_decay" };
144 
145  // Methods for decoration of four vectors
146  StatusCode decorateFourVec(const EventContext& ctx,
147  const FourMomDecorationKeys& keys,
148  const xAOD::EventInfo& eventInfo,
149  const TLorentzVector& p4) const;
150  StatusCode decorateFourVecs(const EventContext& ctx,
151  const FourMomDecorationKeys& keys,
152  const xAOD::EventInfo& eventInfo,
153  const std::vector<TLorentzVector>& p4s) const;
154  };
155 
156 } // namespace DerivationFramework
157 
158 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
DerivationFramework::TruthCategoriesDecorator::m_detailLevel
Gaudi::Property< int > m_detailLevel
Definition: TruthCategoriesDecorator.h:57
python.StoreID.UNKNOWN
int UNKNOWN
Definition: StoreID.py:16
SG::WriteDecorHandleKey< xAOD::EventInfo >
used
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1CatPt30Key
EvtInfoDecorKey m_dec_stage1CatPt30Key
Definition: TruthCategoriesDecorator.h:74
DerivationFramework::TruthCategoriesDecorator::m_decp4_Higgs_decayKeys
FourMomDecorationKeys m_decp4_Higgs_decayKeys
Definition: TruthCategoriesDecorator.h:141
DerivationFramework::TruthCategoriesDecorator::m_truthEvtKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEvtKey
Definition: TruthCategoriesDecorator.h:59
DerivationFramework::TruthCategoriesDecorator::m_dec_Higgs_ptKey
EvtInfoDecorKey m_dec_Higgs_ptKey
Definition: TruthCategoriesDecorator.h:131
IxAODtoHepMCTool.h
HiggsTemplateCrossSectionsDefs.h
DerivationFramework::TruthCategoriesDecorator::m_dec_errorCodeKey
EvtInfoDecorKey m_dec_errorCodeKey
Definition: TruthCategoriesDecorator.h:67
DerivationFramework::TruthCategoriesDecorator::HTXSSample::dsids
std::set< int > dsids
Definition: TruthCategoriesDecorator.h:47
DerivationFramework::TruthCategoriesDecorator::m_dec_NJets25Key
EvtInfoDecorKey m_dec_NJets25Key
Definition: TruthCategoriesDecorator.h:101
DerivationFramework::TruthCategoriesDecorator::m_dec_prodModeKey
EvtInfoDecorKey m_dec_prodModeKey
Definition: TruthCategoriesDecorator.h:65
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_CatPt30Key
EvtInfoDecorKey m_dec_stage1p2_CatPt30Key
Definition: TruthCategoriesDecorator.h:84
DerivationFramework::TruthCategoriesDecorator::m_configPath
Gaudi::Property< std::string > m_configPath
Definition: TruthCategoriesDecorator.h:40
DerivationFramework::TruthCategoriesDecorator::m_dec_stage0CatKey
EvtInfoDecorKey m_dec_stage0CatKey
Definition: TruthCategoriesDecorator.h:69
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
DerivationFramework::TruthCategoriesDecorator::execute
StatusCode execute(const EventContext &ctx) const
Definition: TruthCategoriesDecorator.cxx:147
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
DerivationFramework::TruthCategoriesDecorator
Definition: TruthCategoriesDecorator.h:28
DerivationFramework::TruthCategoriesDecorator::m_decp4_V_jets25Keys
FourMomDecorationKeys m_decp4_V_jets25Keys
Definition: TruthCategoriesDecorator.h:137
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_CatPt25Key
EvtInfoDecorKey m_dec_stage1p2_CatPt25Key
Definition: TruthCategoriesDecorator.h:82
DerivationFramework::TruthCategoriesDecorator::TruthCategoriesDecorator
TruthCategoriesDecorator(const std::string &n, ISvcLocator *p)
Definition: TruthCategoriesDecorator.cxx:22
DerivationFramework::TruthCategoriesDecorator::~TruthCategoriesDecorator
virtual ~TruthCategoriesDecorator()=default
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::prefix
std::string prefix
Definition: TruthCategoriesDecorator.h:117
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::TruthCategoriesDecorator::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: TruthCategoriesDecorator.h:60
DerivationFramework::TruthCategoriesDecorator::HTXSSample::prod
HTXS::HiggsProdMode prod
Higgs production modes, corresponding to input sample.
Definition: TruthCategoriesDecorator.h:43
DerivationFramework::TruthCategoriesDecorator::m_htxs_samples
std::vector< HTXSSample > m_htxs_samples
Definition: TruthCategoriesDecorator.h:50
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::m
EvtInfoDecorKey m
Definition: TruthCategoriesDecorator.h:121
DerivationFramework::TruthCategoriesDecorator::m_decp4_VKeys
FourMomDecorationKeys m_decp4_VKeys
Definition: TruthCategoriesDecorator.h:135
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::TruthCategoriesDecorator::decorateFourVecs
StatusCode decorateFourVecs(const EventContext &ctx, const FourMomDecorationKeys &keys, const xAOD::EventInfo &eventInfo, const std::vector< TLorentzVector > &p4s) const
Definition: TruthCategoriesDecorator.cxx:121
DerivationFramework::TruthCategoriesDecorator::initialize
StatusCode initialize()
Definition: TruthCategoriesDecorator.cxx:24
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DerivationFramework::TruthCategoriesDecorator::HTXSSample
Definition: TruthCategoriesDecorator.h:41
HTXS::noTH
@ noTH
Definition: HiggsTemplateCrossSectionsDefs.h:34
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_IdxPt25Key
EvtInfoDecorKey m_dec_stage1p2_IdxPt25Key
Definition: TruthCategoriesDecorator.h:86
AthReentrantAlgorithm.h
DerivationFramework::TruthCategoriesDecorator::decorateFourVec
StatusCode decorateFourVec(const EventContext &ctx, const FourMomDecorationKeys &keys, const xAOD::EventInfo &eventInfo, const TLorentzVector &p4) const
Definition: TruthCategoriesDecorator.cxx:105
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_Fine_IdxPt30Key
EvtInfoDecorKey m_dec_stage1p2_Fine_IdxPt30Key
Definition: TruthCategoriesDecorator.h:98
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::initialize
StatusCode initialize(bool used=true)
Definition: TruthCategoriesDecorator.h:122
HTXS::HiggsProdMode
HiggsProdMode
Higgs production modes, corresponding to input sample.
Definition: HiggsTemplateCrossSectionsDefs.h:27
DerivationFramework::TruthCategoriesDecorator::m_higgsTruthCatTool
ToolHandle< IHiggsTruthCategoryTool > m_higgsTruthCatTool
Definition: TruthCategoriesDecorator.h:37
DerivationFramework::TruthCategoriesDecorator::m_xAODtoHepMCTool
ToolHandle< IxAODtoHepMCTool > m_xAODtoHepMCTool
Definition: TruthCategoriesDecorator.h:36
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_Fine_IdxPt25Key
EvtInfoDecorKey m_dec_stage1p2_Fine_IdxPt25Key
Definition: TruthCategoriesDecorator.h:96
DerivationFramework::TruthCategoriesDecorator::m_decp4_V_jets30Keys
FourMomDecorationKeys m_decp4_V_jets30Keys
Definition: TruthCategoriesDecorator.h:139
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::pt
EvtInfoDecorKey pt
Definition: TruthCategoriesDecorator.h:118
DerivationFramework::TruthCategoriesDecorator::m_decp4_HiggsKeys
FourMomDecorationKeys m_decp4_HiggsKeys
Definition: TruthCategoriesDecorator.h:133
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
DerivationFramework::TruthCategoriesDecorator::HTXSSample::th_type
HTXS::tH_type th_type
Additional identifier flag for TH production modes.
Definition: TruthCategoriesDecorator.h:45
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1CatPt25Key
EvtInfoDecorKey m_dec_stage1CatPt25Key
Definition: TruthCategoriesDecorator.h:72
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.
HTXS::tH_type
tH_type
Additional identifier flag for TH production modes.
Definition: HiggsTemplateCrossSectionsDefs.h:34
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_Fine_CatPt25Key
EvtInfoDecorKey m_dec_stage1p2_Fine_CatPt25Key
Definition: TruthCategoriesDecorator.h:92
WriteDecorHandleKeyArray.h
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys
Set of DecorHandleKeys to write the four momenta needed for the HTXS categorization.
Definition: TruthCategoriesDecorator.h:108
IHiggsTruthCategoryTool.h
DerivationFramework::TruthCategoriesDecorator::m_decp4_V_decayKeys
FourMomDecorationKeys m_decp4_V_decayKeys
Definition: TruthCategoriesDecorator.h:143
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::FourMomDecorationKeys
FourMomDecorationKeys(TruthCategoriesDecorator *parent, const SG::ReadHandleKey< xAOD::EventInfo > &ei_key, const std::string &the_prefix)
Definition: TruthCategoriesDecorator.h:109
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_IdxPt30Key
EvtInfoDecorKey m_dec_stage1p2_IdxPt30Key
Definition: TruthCategoriesDecorator.h:88
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1IdxPt30Key
EvtInfoDecorKey m_dec_stage1IdxPt30Key
Definition: TruthCategoriesDecorator.h:78
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::eta
EvtInfoDecorKey eta
Definition: TruthCategoriesDecorator.h:119
DerivationFramework::TruthCategoriesDecorator::FourMomDecorationKeys::phi
EvtInfoDecorKey phi
Definition: TruthCategoriesDecorator.h:120
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1p2_Fine_CatPt30Key
EvtInfoDecorKey m_dec_stage1p2_Fine_CatPt30Key
Definition: TruthCategoriesDecorator.h:94
TruthEventContainer.h
DerivationFramework::TruthCategoriesDecorator::m_dec_isZnunuKey
EvtInfoDecorKey m_dec_isZnunuKey
Definition: TruthCategoriesDecorator.h:105
DerivationFramework::TruthCategoriesDecorator::m_dec_stage1IdxPt25Key
EvtInfoDecorKey m_dec_stage1IdxPt25Key
Definition: TruthCategoriesDecorator.h:76
DerivationFramework::TruthCategoriesDecorator::m_dec_NJets30Key
EvtInfoDecorKey m_dec_NJets30Key
Definition: TruthCategoriesDecorator.h:103