Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RunKLFitterAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #ifndef KLFITTERNANALYSISALGORITHMS_RUNKLFITTERALG_H_
9 #define KLFITTERNANALYSISALGORITHMS_RUNKLFITTERALG_H_
10 
11 // Algorithm includes
18 
19 // Framework includes
22 #include <xAODJet/JetContainer.h>
24 #include <xAODMuon/MuonContainer.h>
25 
28 
29 // Externals
33 #include "KLFitter/BoostedLikelihoodTopLeptonJets.h"
34 #include "KLFitter/DetectorAtlas_8TeV.h"
35 #include "KLFitter/Fitter.h"
36 #include "KLFitter/LikelihoodTTHLeptonJets.h"
37 #include "KLFitter/LikelihoodTTZTrilepton.h"
38 #include "KLFitter/LikelihoodTopAllHadronic.h"
39 #include "KLFitter/LikelihoodTopLeptonJets.h"
40 #include "KLFitter/LikelihoodTopLeptonJets_Angular.h"
41 #include "KLFitter/LikelihoodTopLeptonJets_JetAngles.h"
42 #include "KLFitter/Permutations.h"
43 
44 namespace EventReco {
45 
47 
48  public:
50  virtual StatusCode initialize() final;
51  virtual StatusCode execute() final;
52 
53  private:
56  const std::vector<const xAOD::Electron *> &selected_electrons,
57  const std::vector<const xAOD::Muon *> &selected_muons,
58  KLFitter::Particles *myParticles);
59 
60  StatusCode add_jets(const std::vector<const xAOD::Jet *> &selected_jets,
61  KLFitter::Particles *myParticles);
62 
63  StatusCode setJetskLeadingN(const std::vector<const xAOD::Jet *> &jets,
64  KLFitter::Particles *inputParticles,
65  const size_t njets);
66 
68  float *ineff);
69 
70  StatusCode setJetskBtagPriority(const std::vector<const xAOD::Jet *> &jets,
71  KLFitter::Particles *inputParticles,
72  const size_t maxJets);
73 
75  const std::vector<size_t> &electron_indices,
76  const std::vector<size_t> &muon_indices,
77  const std::vector<size_t> &jet_indices);
78 
79  template <typename T>
80  std::vector<const T *> sortPt(const std::vector<const T *> &particles,
81  std::vector<size_t> &indices) {
82  std::vector<std::pair<const T *, size_t>> particle_index(particles.size());
83  size_t indx{0};
84  for (const T *const p : particles) {
85  particle_index[indx] = {p, indx};
86  ++indx;
87  }
88  std::sort(
89  particle_index.begin(), particle_index.end(),
90  [](std::pair<const T *, size_t> &x, std::pair<const T *, size_t> &y) {
91  return x.first->pt() > y.first->pt();
92  });
93  std::vector<const T *> sorted_particles(particles.size());
94  indx = 0;
95  indices.resize(particles.size());
96  for (auto &elem : particle_index) {
97  sorted_particles[indx] = elem.first;
98  indices[indx] = elem.second;
99  ++indx;
100  }
101  return sorted_particles;
102  }
103 
104  // systematics
106 
107  // inputs needed for reconstruction
109  this, "electrons", "", "the electron container to use"};
111  this, "electronSelection", "", "the selection on the input electrons"};
112 
114  this, "muons", "", "the muon container to use"};
116  this, "muonSelection", "", "the selection on the input muons"};
117 
119  this, "jets", "", "the jet container to use"};
120  CP::SysReadSelectionHandle m_jetSelection{this, "jetSelection", "",
121  "the selection on the input jets"};
122 
124  this, "met", "", "the MET container to use"};
125 
127  this, "eventInfo", "EventInfo",
128  "the EventInfo container to read selection deciosions from"};
129 
130  // output container
133  m_outHandle{this, "result", "KLFitterResult_%SYS%",
134  "the output KLFitterResultContainer"};
135 
136  CP::SysReadSelectionHandle m_selection{this, "selectionDecorationName", "",
137  "Name of the selection on which this "
138  "KLFitter instance is allowed to run"};
139 
140  // configurable properties
141  Gaudi::Property<std::string> m_leptonType{this, "LeptonType", "kUndefined",
142  "Define the lepton type"};
143  Gaudi::Property<std::string> m_LHType{this, "LHType", "kUndefined",
144  "Define the Likelihood type"};
145  Gaudi::Property<std::string> m_transferFunctionsPath{
146  this, "TransferFunctionsPath",
147  "dev/AnalysisTop/KLFitterTFs/mc12a/akt4_LCtopo_PP6/",
148  "Path to transfer functions"};
149  Gaudi::Property<std::string> m_jetSelectionMode{
150  this, "JetSelectionMode", "kBtagPriorityFourJets",
151  "Define the behavior for selecting jets"};
152  Gaudi::Property<std::string> m_bTaggingMethod{
153  this, "BTaggingMethod", "kNotag",
154  "Method for accounting b-tagging information"};
155  Gaudi::Property<std::string> m_bTagDecoration{
156  this, "BTaggingDecoration", "",
157  "Name of the btag decision decoration for jets"};
158  Gaudi::Property<std::string> m_METterm{this, "METterm", "Final",
159  "Which MET term should be used"};
160  Gaudi::Property<float> m_massTop{
161  this, "TopMass", 172.5,
162  "The mass of top quark used in KLFitter likelihood (assuming the fixed "
163  "m_top mode is used)"};
164  Gaudi::Property<bool> m_fixedTopMass{
165  this, "TopMassFixed", true,
166  "If the top quark mass is fixed in the likelihood to the value of "
167  "TopMass parameter"};
168  Gaudi::Property<bool> m_saveAllPermutations{
169  this, "SaveAllPermutations", false,
170  "Whether to store only the permutation with highest KLFitter event "
171  "probability, or all"};
172  Gaudi::Property<bool> m_failOnLessThanXJets{
173  this, "FailOnLessThanXJets", false,
174  "Fail if kLeadingX or kBtagPriorityXJets is set and the number of jets "
175  "in the event is less than X"};
176 
180 
181  bool m_useBtagPriority{false};
183 
184  std::unique_ptr<KLFitter::Fitter> m_myFitter;
185  std::unique_ptr<KLFitter::DetectorAtlas_8TeV> m_myDetector;
187  KLFitter::LikelihoodBase::BtaggingMethod m_bTaggingMethodEnum{};
188 
198 
199  std::unique_ptr<KLFitter::LikelihoodTopLeptonJets> m_myLikelihood;
200  std::unique_ptr<KLFitter::LikelihoodTTHLeptonJets> m_myLikelihood_TTH;
201  std::unique_ptr<KLFitter::LikelihoodTopLeptonJets_JetAngles>
203  std::unique_ptr<KLFitter::LikelihoodTopLeptonJets_Angular>
205  std::unique_ptr<KLFitter::LikelihoodTTZTrilepton> m_myLikelihood_TTZ;
206  std::unique_ptr<KLFitter::LikelihoodTopAllHadronic>
208  std::unique_ptr<KLFitter::BoostedLikelihoodTopLeptonJets>
210 
211  ToolHandle<IBTaggingEfficiencyTool> m_btagging_eff_tool{
212  this, "btagEffTool", "", "the b-tagging efficiency tool"};
213 
214  std::unique_ptr<SG::AuxElement::ConstAccessor<char>> m_bTagDecoAcc;
215 };
216 } // namespace EventReco
217 
218 #endif
EventReco::RunKLFitterAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
Definition: RunKLFitterAlg.h:126
EventReco::RunKLFitterAlg::m_muonSelection
CP::SysReadSelectionHandle m_muonSelection
Definition: RunKLFitterAlg.h:115
EventReco::RunKLFitterAlg::setJetskBtagPriority
StatusCode setJetskBtagPriority(const std::vector< const xAOD::Jet * > &jets, KLFitter::Particles *inputParticles, const size_t maxJets)
Definition: RunKLFitterAlg.cxx:563
EventReco::RunKLFitterAlg::setJetskLeadingN
StatusCode setJetskLeadingN(const std::vector< const xAOD::Jet * > &jets, KLFitter::Particles *inputParticles, const size_t njets)
Definition: RunKLFitterAlg.cxx:493
EventReco::RunKLFitterAlg::m_jetSelectionModeEnum
KLFEnums::JetSelectionMode m_jetSelectionModeEnum
Definition: RunKLFitterAlg.h:179
EventReco::RunKLFitterAlg::m_jetSelectionModeKLFitterEnum
KLFEnums::JetSelectionMode m_jetSelectionModeKLFitterEnum
Definition: RunKLFitterAlg.h:186
EventReco::RunKLFitterAlg::m_LHType
Gaudi::Property< std::string > m_LHType
Definition: RunKLFitterAlg.h:143
KLFitterResultAuxContainer.h
PropertyWrapper.h
EventReco::RunKLFitterAlg::m_electronsHandle
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
Definition: RunKLFitterAlg.h:108
CP::SysListHandle
a class managing the property to configure the list of systematics to process
Definition: SysListHandle.h:33
EventReco::RunKLFitterAlg::m_metHandle
CP::SysReadHandle< xAOD::MissingETContainer > m_metHandle
Definition: RunKLFitterAlg.h:123
KLFitterResultContainer.h
EventReco::RunKLFitterAlg::m_LHTypeEnum
KLFEnums::Likelihood m_LHTypeEnum
Definition: RunKLFitterAlg.h:178
EventReco::RunKLFitterAlg::m_electronSelection
CP::SysReadSelectionHandle m_electronSelection
Definition: RunKLFitterAlg.h:110
CP::SysWriteHandle
a data handle for writing systematics varied input data
Definition: SysWriteHandle.h:31
EventReco::RunKLFitterAlg::m_useBtagPriority
bool m_useBtagPriority
Definition: RunKLFitterAlg.h:181
EventReco::RunKLFitterAlg::add_jets
StatusCode add_jets(const std::vector< const xAOD::Jet * > &selected_jets, KLFitter::Particles *myParticles)
Definition: RunKLFitterAlg.cxx:483
EventReco::RunKLFitterAlg::m_massTop
Gaudi::Property< float > m_massTop
Definition: RunKLFitterAlg.h:160
EventReco::RunKLFitterAlg::m_myLikelihood_TTH
std::unique_ptr< KLFitter::LikelihoodTTHLeptonJets > m_myLikelihood_TTH
Definition: RunKLFitterAlg.h:200
EventReco::RunKLFitterAlg::m_systematicsList
CP::SysListHandle m_systematicsList
Definition: RunKLFitterAlg.h:105
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
EventReco::RunKLFitterAlg::m_leptonType
Gaudi::Property< std::string > m_leptonType
Definition: RunKLFitterAlg.h:141
EventReco::RunKLFitterAlg::m_myLikelihood_JetAngles
std::unique_ptr< KLFitter::LikelihoodTopLeptonJets_JetAngles > m_myLikelihood_JetAngles
Definition: RunKLFitterAlg.h:202
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
EventReco::RunKLFitterAlg::m_leptonTypeEnum
KLFEnums::LeptonType m_leptonTypeEnum
Definition: RunKLFitterAlg.h:177
EventReco::RunKLFitterAlg::evaluatePermutations
StatusCode evaluatePermutations(const CP::SystematicSet &sys, const std::vector< size_t > &electron_indices, const std::vector< size_t > &muon_indices, const std::vector< size_t > &jet_indices)
Definition: RunKLFitterAlg.cxx:648
EventReco::RunKLFitterAlg::m_bTaggingMethod
Gaudi::Property< std::string > m_bTaggingMethod
Definition: RunKLFitterAlg.h:152
CP::SysReadHandle< xAOD::ElectronContainer >
x
#define x
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition: AnaAlgorithm.cxx:40
EventReco::RunKLFitterAlg::m_METterm
Gaudi::Property< std::string > m_METterm
Definition: RunKLFitterAlg.h:158
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
SysReadHandle.h
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum_JetAngles
KLFitter::LikelihoodTopLeptonJets_JetAngles::LeptonType m_leptonTypeKLFitterEnum_JetAngles
Definition: RunKLFitterAlg.h:192
KLFitterEnums.h
SysWriteHandle.h
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum_TTH
KLFitter::LikelihoodTTHLeptonJets::LeptonType m_leptonTypeKLFitterEnum_TTH
Definition: RunKLFitterAlg.h:190
AnaAlgorithm.h
EventReco::RunKLFitterAlg
Definition: RunKLFitterAlg.h:46
EventReco::RunKLFitterAlg::m_myLikelihood
std::unique_ptr< KLFitter::LikelihoodTopLeptonJets > m_myLikelihood
Definition: RunKLFitterAlg.h:199
EventReco::KLFEnums::JetSelectionMode
JetSelectionMode
Definition: KLFitterEnums.h:29
IBTaggingEfficiencyTool.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum_Angular
KLFitter::LikelihoodTopLeptonJets_Angular::LeptonType m_leptonTypeKLFitterEnum_Angular
Definition: RunKLFitterAlg.h:194
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
EL::AnaAlgorithm
the (new) base class for EventLoop algorithms
Definition: AnaAlgorithm.h:73
EventReco::RunKLFitterAlg::m_selection
CP::SysReadSelectionHandle m_selection
Definition: RunKLFitterAlg.h:136
ElectronContainer.h
EventReco::RunKLFitterAlg::m_myLikelihood_AllHadronic
std::unique_ptr< KLFitter::LikelihoodTopAllHadronic > m_myLikelihood_AllHadronic
Definition: RunKLFitterAlg.h:207
EventReco::RunKLFitterAlg::execute_syst
StatusCode execute_syst(const CP::SystematicSet &sys)
Definition: RunKLFitterAlg.cxx:306
EventReco::RunKLFitterAlg::m_jetSelection
CP::SysReadSelectionHandle m_jetSelection
Definition: RunKLFitterAlg.h:120
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EventReco::RunKLFitterAlg::m_bTagDecoAcc
std::unique_ptr< SG::AuxElement::ConstAccessor< char > > m_bTagDecoAcc
Definition: RunKLFitterAlg.h:214
EventReco::KLFEnums::Likelihood
Likelihood
Definition: KLFitterEnums.h:18
xAOD::KLFitterResultContainer
DataVector< xAOD::KLFitterResult > KLFitterResultContainer
Definition of the KLFitterResultContainer type.
Definition: KLFitterResultContainer.h:21
EventReco::RunKLFitterAlg::m_muonsHandle
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
Definition: RunKLFitterAlg.h:113
makePlot.Particles
Particles
Definition: makePlot.py:25
EventReco::RunKLFitterAlg::m_jetsHandle
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
Definition: RunKLFitterAlg.h:118
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum_TTZ
KLFitter::LikelihoodTTZTrilepton::LeptonType m_leptonTypeKLFitterEnum_TTZ
Definition: RunKLFitterAlg.h:195
EventReco::RunKLFitterAlg::m_transferFunctionsPath
Gaudi::Property< std::string > m_transferFunctionsPath
Definition: RunKLFitterAlg.h:145
EventReco::RunKLFitterAlg::m_bTagDecoration
Gaudi::Property< std::string > m_bTagDecoration
Definition: RunKLFitterAlg.h:155
EventReco::RunKLFitterAlg::m_fixedTopMass
Gaudi::Property< bool > m_fixedTopMass
Definition: RunKLFitterAlg.h:164
EventReco
Definition: KLFitterEnums.h:16
EventReco::RunKLFitterAlg::m_saveAllPermutations
Gaudi::Property< bool > m_saveAllPermutations
Definition: RunKLFitterAlg.h:168
EventReco::RunKLFitterAlg::m_failOnLessThanXJets
Gaudi::Property< bool > m_failOnLessThanXJets
Definition: RunKLFitterAlg.h:172
EventReco::RunKLFitterAlg::initialize
virtual StatusCode initialize() final
Definition: RunKLFitterAlg.cxx:15
EventReco::RunKLFitterAlg::m_myDetector
std::unique_ptr< KLFitter::DetectorAtlas_8TeV > m_myDetector
Definition: RunKLFitterAlg.h:185
EventReco::RunKLFitterAlg::m_myLikelihood_TTZ
std::unique_ptr< KLFitter::LikelihoodTTZTrilepton > m_myLikelihood_TTZ
Definition: RunKLFitterAlg.h:205
EventReco::RunKLFitterAlg::m_myFitter
std::unique_ptr< KLFitter::Fitter > m_myFitter
Definition: RunKLFitterAlg.h:184
SysReadSelectionHandle.h
columnar::final
CM final
Definition: ColumnAccessor.h:106
EventReco::RunKLFitterAlg::m_btagging_eff_tool
ToolHandle< IBTaggingEfficiencyTool > m_btagging_eff_tool
Definition: RunKLFitterAlg.h:211
EventReco::RunKLFitterAlg::add_leptons
StatusCode add_leptons(const std::vector< const xAOD::Electron * > &selected_electrons, const std::vector< const xAOD::Muon * > &selected_muons, KLFitter::Particles *myParticles)
Definition: RunKLFitterAlg.cxx:414
EventInfo.h
MuonContainer.h
EventReco::RunKLFitterAlg::m_bTaggingMethodEnum
KLFitter::LikelihoodBase::BtaggingMethod m_bTaggingMethodEnum
Definition: RunKLFitterAlg.h:187
EventReco::KLFEnums::LeptonType
LeptonType
Definition: KLFitterEnums.h:27
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
EventReco::RunKLFitterAlg::m_njetsRequirement
size_t m_njetsRequirement
Definition: RunKLFitterAlg.h:182
y
#define y
EventReco::RunKLFitterAlg::m_outHandle
CP::SysWriteHandle< xAOD::KLFitterResultContainer, xAOD::KLFitterResultAuxContainer > m_outHandle
Definition: RunKLFitterAlg.h:133
JetContainer.h
EventReco::RunKLFitterAlg::m_jetSelectionMode
Gaudi::Property< std::string > m_jetSelectionMode
Definition: RunKLFitterAlg.h:149
EventReco::RunKLFitterAlg::sortPt
std::vector< const T * > sortPt(const std::vector< const T * > &particles, std::vector< size_t > &indices)
Definition: RunKLFitterAlg.h:80
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum
KLFitter::LikelihoodTopLeptonJets::LeptonType m_leptonTypeKLFitterEnum
Definition: RunKLFitterAlg.h:189
SysReadDecorHandle.h
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
CP::SysReadSelectionHandle
a data handle for reading systematically varied selection properties from objects
Definition: SysReadSelectionHandle.h:32
EventReco::RunKLFitterAlg::retrieveEfficiencies
StatusCode retrieveEfficiencies(const xAOD::Jet *jet, float *eff, float *ineff)
Definition: RunKLFitterAlg.cxx:543
JetAuxContainer.h
EventReco::RunKLFitterAlg::m_myLikelihood_BoostedLJets
std::unique_ptr< KLFitter::BoostedLikelihoodTopLeptonJets > m_myLikelihood_BoostedLJets
Definition: RunKLFitterAlg.h:209
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
EventReco::RunKLFitterAlg::m_myLikelihood_Angular
std::unique_ptr< KLFitter::LikelihoodTopLeptonJets_Angular > m_myLikelihood_Angular
Definition: RunKLFitterAlg.h:204
MissingETContainer.h
EventReco::RunKLFitterAlg::m_leptonTypeKLFitterEnum_BoostedLJets
KLFitter::BoostedLikelihoodTopLeptonJets::LeptonType m_leptonTypeKLFitterEnum_BoostedLJets
Definition: RunKLFitterAlg.h:197
xAOD::KLFitterResultAuxContainer
Auxiliary container for xAOD::KLFitterResultContainer.
Definition: KLFitterResultAuxContainer.h:21
EventReco::RunKLFitterAlg::execute
virtual StatusCode execute() final
Definition: RunKLFitterAlg.cxx:299