8#ifndef KLFITTERANALYSISALGORITHMS_RUNKLFITTERALG_H_
9#define KLFITTERANALYSISALGORITHMS_RUNKLFITTERALG_H_
37#include "KLFitter/BoostedLikelihoodTopLeptonJets.h"
38#include "KLFitter/DetectorAtlas_8TeV.h"
39#include "KLFitter/Fitter.h"
40#include "KLFitter/LikelihoodTTHLeptonJets.h"
41#include "KLFitter/LikelihoodTTZTrilepton.h"
42#include "KLFitter/LikelihoodTopAllHadronic.h"
43#include "KLFitter/LikelihoodTopLeptonJets.h"
44#include "KLFitter/LikelihoodTopLeptonJets_Angular.h"
45#include "KLFitter/LikelihoodTopLeptonJets_JetAngles.h"
46#include "KLFitter/Permutations.h"
55 virtual StatusCode
execute(
const EventContext& ctx)
final;
59 const EventContext &ctx);
61 const std::vector<const xAOD::Electron *> &selected_electrons,
62 const std::vector<const xAOD::Muon *> &selected_muons,
63 KLFitter::Particles *myParticles);
65 StatusCode
add_jets(
const std::vector<const xAOD::Jet *> &selected_jets,
66 KLFitter::Particles *myParticles);
69 KLFitter::Particles *inputParticles,
75 const bool isTagged, KLFitter::Particles *inputParticles);
81 KLFitter::Particles *inputParticles,
82 const size_t maxJets);
85 const EventContext &ctx,
86 const std::vector<size_t> &electron_indices,
87 const std::vector<size_t> &muon_indices,
88 const std::vector<size_t> &jet_indices);
91 std::vector<const T *>
sortPt(
const std::vector<const T *> &particles,
93 indices.resize(particles.size());
96 [&particles](
const size_t i,
const size_t j) {
97 return particles[i]->pt() > particles[j]->pt();
99 std::vector<const T *> sorted_particles;
100 sorted_particles.reserve(particles.size());
101 for (
const size_t i :
indices) {
102 sorted_particles.push_back(particles[i]);
104 return sorted_particles;
112 this,
"electrons",
"",
"the electron container to use"};
114 this,
"electronSelection",
"",
"the selection on the input electrons"};
117 this,
"muons",
"",
"the muon container to use"};
119 this,
"muonSelection",
"",
"the selection on the input muons"};
122 this,
"jets",
"",
"the jet container to use"};
124 "the selection on the input jets"};
127 this,
"met",
"",
"the MET container to use"};
130 this,
"eventInfo",
"EventInfo",
131 "the EventInfo container to read selection decisions from"};
137 "the output KLFitterResultContainer"};
140 "Name of the selection on which this "
141 "KLFitter instance is allowed to run"};
144 Gaudi::Property<std::string>
m_leptonType{
this,
"LeptonType",
"kUndefined",
145 "Define the lepton type"};
146 Gaudi::Property<std::string>
m_LHType{
this,
"LHType",
"kUndefined",
147 "Define the Likelihood type"};
149 this,
"TransferFunctionsPath",
150 "dev/AnalysisTop/KLFitterTFs/mc12a/akt4_LCtopo_PP6/",
151 "Path to transfer functions"};
153 this,
"JetSelectionMode",
"kBtagPriorityFourJets",
154 "Define the behavior for selecting jets"};
156 this,
"BTaggingMethod",
"kNotag",
157 "Method for accounting b-tagging information"};
159 this,
"BTaggingDecoration",
"",
160 "Name of the btag decision decoration for jets"};
161 Gaudi::Property<std::string>
m_METterm{
this,
"METterm",
"Final",
162 "Which MET term should be used"};
164 this,
"TopMass", 172.5,
165 "The mass of top quark used in KLFitter likelihood (assuming the fixed "
166 "m_top mode is used)"};
168 this,
"TopMassFixed",
true,
169 "If the top quark mass is fixed in the likelihood to the value of "
170 "TopMass parameter"};
172 this,
"SaveAllPermutations",
false,
173 "Whether to store only the permutation with highest KLFitter event "
174 "probability, or all"};
176 this,
"FailOnLessThanXJets",
false,
177 "Fail if kLeadingX or kBtagPriorityXJets is set and the number of jets "
178 "in the event is less than X"};
194 this,
"btagEffTool",
"",
"the b-tagging efficiency tool"};
std::vector< std::vector< int64_t > > indices
a class managing the property to configure the list of systematics to process
a data handle for reading systematics varied input data
a data handle for reading systematically varied selection properties from objects
a data handle for writing systematics varied input data
Class to wrap a set of SystematicVariations.
the (new) base class for EventLoop algorithms
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual::StatusCode execute()
execute this algorithm
std::optional< SG::ConstAccessor< char > > m_bTagDecoAcc
CP::SysWriteHandle< xAOD::KLFitterResultContainer, xAOD::KLFitterResultAuxContainer > m_outHandle
virtual StatusCode initialize() final
StatusCode retrieveEfficiencies(const xAOD::Jet *jet, float *eff, float *ineff)
size_t m_njetsRequirement
StatusCode addJet(const xAOD::Jet *jet, const size_t index, const bool isTagged, KLFitter::Particles *inputParticles)
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
Gaudi::Property< std::string > m_transferFunctionsPath
StatusCode setJetskLeadingN(const std::vector< const xAOD::Jet * > &jets, KLFitter::Particles *inputParticles, const size_t njets)
CP::SysListHandle m_systematicsList
std::unique_ptr< KLFitter::DetectorAtlas_8TeV > m_myDetector
CP::SysReadSelectionHandle m_muonSelection
StatusCode evaluatePermutations(const CP::SystematicSet &sys, const EventContext &ctx, const std::vector< size_t > &electron_indices, const std::vector< size_t > &muon_indices, const std::vector< size_t > &jet_indices)
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
KLFEnums::JetSelectionMode m_jetSelectionModeEnum
KLFEnums::LeptonType m_leptonTypeEnum
std::vector< const T * > sortPt(const std::vector< const T * > &particles, std::vector< size_t > &indices)
Gaudi::Property< bool > m_fixedTopMass
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
Gaudi::Property< std::string > m_leptonType
xAOD::JetContainer m_effJets
StatusCode getBTagDecision(const xAOD::Jet &jet, bool &isTagged) const
Gaudi::Property< std::string > m_bTaggingMethod
StatusCode add_leptons(const std::vector< const xAOD::Electron * > &selected_electrons, const std::vector< const xAOD::Muon * > &selected_muons, KLFitter::Particles *myParticles)
Gaudi::Property< bool > m_saveAllPermutations
Gaudi::Property< std::string > m_METterm
CP::SysReadHandle< xAOD::MissingETContainer > m_metHandle
KLFEnums::Likelihood m_LHTypeEnum
CP::SysReadSelectionHandle m_selection
KLFitter::LikelihoodBase::BtaggingMethod m_bTaggingMethodEnum
ToolHandle< IBTaggingEfficiencyTool > m_btagging_eff_tool
Gaudi::Property< std::string > m_bTagDecoration
std::unique_ptr< KLFitter::LikelihoodBase > m_likelihood
xAOD::JetAuxContainer m_effJetsAux
StatusCode setJetskBtagPriority(const std::vector< const xAOD::Jet * > &jets, KLFitter::Particles *inputParticles, const size_t maxJets)
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
Gaudi::Property< bool > m_failOnLessThanXJets
CP::SysReadSelectionHandle m_electronSelection
Gaudi::Property< std::string > m_jetSelectionMode
StatusCode add_jets(const std::vector< const xAOD::Jet * > &selected_jets, KLFitter::Particles *myParticles)
CP::SysReadSelectionHandle m_jetSelection
Gaudi::Property< std::string > m_LHType
StatusCode execute_syst(const CP::SystematicSet &sys, const EventContext &ctx)
std::unique_ptr< KLFitter::Fitter > m_myFitter
Gaudi::Property< float > m_massTop
Auxiliary container for xAOD::KLFitterResultContainer.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Jet_v1 Jet
Definition of the current "jet version".
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
DataVector< xAOD::KLFitterResult > KLFitterResultContainer
Definition of the KLFitterResultContainer type.
JetContainer_v1 JetContainer
Definition of the current "jet container version".