6#ifndef F_TAG_ANALYSIS_ALGORITHMS__SSV_WEIGHTS_ALG_H
7#define F_TAG_ANALYSIS_ALGORITHMS__SSV_WEIGHTS_ALG_H
27#include <nlohmann/json.hpp>
36 virtual StatusCode
execute(
const EventContext& ctx)
override;
39 Gaudi::Property<std::string>
m_jsonConfigPath_SSVWeightsAlg {
this,
"JsonConfigFile_SSVWeightsAlg",
"",
"Path to the JSON config file that contains the SSV calibration results which are needed to calculate the SSV weights"};
40 Gaudi::Property<std::string>
m_BTaggingWP {
this,
"BTaggingWP",
"",
"b-tagging working point that is used to count the number of b-jets in the event for b-jet based SSV weight calculation"};
41 Gaudi::Property<std::string>
m_EfficiencyMethod {
this,
"EfficiencyMethod",
"",
"efficiency definition that will be used to calculate the SSV weights, string can be 'Bhadron_pT_eta_based' or 'bjet_based'"};
42 Gaudi::Property<std::string>
m_nFMethod {
this,
"nFMethod",
"",
"average number of fake SSV definition that will be used to calculate the SSV weights, string can be 'pileup_bjet_based','pileup_based_linearfit' or 'pileup_based_binned'"};
43 Gaudi::Property<std::string>
m_OutputVariableSize {
this,
"OutputVariableSize",
"",
"number of variables that will be saved to the output, string can be 'standard','extended','additional' or 'all'"};
72 const double muactual,
73 const int N_fake)
const;
85 const double muactual,
87 const double SF_fake_low,
88 const double SF_fake_high)
const;
99 const double muactual,
100 const int b_jet_count,
102 const double SF_fake_low,
103 const double SF_fake_high)
const;
114 const std::vector<const xAOD::TruthParticle*> &accepted_truthBh,
115 const std::vector<bool> &truthBh_to_SSV_matched,
116 double SF_eff)
const;
128 const int b_jet_count,
130 const double SF_eff)
const;
154 const std::vector<const xAOD::Jet*> &jets,
155 const std::vector<const xAOD::Electron*> &electrons,
156 const std::vector<const xAOD::Muon*> &muons,
160 const std::vector<const xAOD::TruthParticle*> &truthBhs,
161 const std::vector<const xAOD::Jet*> &jets)
const;
164 const std::vector<const xAOD::TruthParticle*> &truthBhs,
165 const std::vector<const xAOD::Vertex*> &SSVs)
const;
168 const std::vector<const xAOD::TruthParticle*> &truthBhs,
169 const std::vector<const xAOD::Vertex*> &SSVs)
const;
172 const std::vector<const xAOD::TruthParticle*> &truthBhs,
173 const std::vector<bool> &matched_vector);
181 const double lambda);
185 const int type)
const;
189 this,
"eventInfo",
"EventInfo",
"the EventInfo container"};
192 this,
"TruthParticleContainer",
"TruthParticles",
"input TruthParticles container"};
195 this,
"jets",
"",
"the jet container to use"};
198 this,
"electrons",
"",
"the electron container to use"};
201 this,
"muons",
"",
"the muon container to use"};
204 this,
"NVSI_WP",
"",
"The NewVrtSecInclusiveTool output container to use (NewVrtSecInclusiveTool = algorithm that constructs the soft secondary vertices (SSVs))"};
207 this,
"jetSelection",
"",
"the jet selection to apply on the jets that are used to check if they overlap with a SSV or a b-hadron"};
210 this,
"electronSelection",
"",
"the electron selection to apply on the electrons that are used to check if they overlap with a SSV or a b-hadron"};
213 this,
"muonSelection",
"",
"the muon selection to apply on the muons that are used to check if they overlap with a SSV or a b-hadron"};
EfficiencyMethodBJetBasedClass(const nlohmann::json &jsonConfig)
double getPIneff(const int b_jet_count, const int N_missed, const double SF_eff) const
std::map< std::string, double > m_bjetEfficiencyMap
std::string m_overflowPtBinKey
EfficiencyMethodBhadronPtEtaBasedClass(const nlohmann::json &jsonConfig)
std::map< std::string, std::map< std::string, std::vector< double > > > m_BhadronPtEtaEfficiencyMap
double getPIneff(const std::vector< const xAOD::TruthParticle * > &accepted_truthBh, const std::vector< bool > &truthBh_to_SSV_matched, double SF_eff) const
std::vector< double > m_ptbins
double getPFake(const double muactual, const int b_jet_count, const int N_fake, const double SF_fake_low, const double SF_fake_high) const
double m_lowMuHighMuThreshold
nFMethodPileupBJetBasedClass(const nlohmann::json &jsonConfig)
std::map< std::string, std::map< std::string, double > > m_nFPileupBJetMap
std::vector< double > m_muactualBins
double getPFake(const double muactual, const int N_fake, const double SF_fake_low, const double SF_fake_high) const
nFMethodPileupBasedBinnedClass(const nlohmann::json &jsonConfig)
std::vector< double > m_nFBins
double m_lowMuHighMuThreshold
double getPFake(const double muactual, const int N_fake) const
nFMethodPileupBasedLinearFitClass(const nlohmann::json &jsonConfig)
double m_interceptUnscaled
std::optional< SG::AuxElement::ConstAccessor< char > > m_jetBTagAccessor
CP::SysReadSelectionHandle m_muonSelection
std::vector< bool > truthBh_to_SSV_matching(const std::vector< const xAOD::TruthParticle * > &truthBhs, const std::vector< const xAOD::Vertex * > &SSVs) const
CP::SysWriteDecorHandle< int > m_N_fake_decor
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
OutputVariableSizeType m_OutputVariableSizeType
CP::SysReadHandle< xAOD::VertexContainer > m_ssvHandle
std::unique_ptr< nFMethodPileupBasedLinearFitClass > m_nFPileupBasedLinearFitPtr
CP::SysWriteDecorHandle< float > m_SSV_weight_decor
CP::SysWriteDecorHandle< int > m_number_of_accepted_Bhadrons_decor
std::unique_ptr< EfficiencyMethodBJetBasedClass > m_EfficiencyMethodBJetBasedPtr
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
virtual StatusCode initialize() override
CP::SysWriteDecorHandle< int > m_N_matched_decor
double compute_DeltaR_between_SSV_and_particle(const xAOD::Vertex *vtx, const xAOD::IParticle *part) const
CP::SysWriteDecorHandle< float > m_P_fake_pileup_based_linearfit_decor
std::unique_ptr< EfficiencyMethodBhadronPtEtaBasedClass > m_EfficiencyMethodBhadronPtEtaBasedPtr
nlohmann::json m_jsonConfig_SSVWeightsAlg
CP::SysWriteDecorHandle< int > m_number_of_good_SSVs_decor
bool isHFHadronFinalState(const xAOD::TruthParticle *part, const int type) const
std::vector< const xAOD::TruthParticle * > create_accepted_truthBhs(const std::vector< const xAOD::TruthParticle * > &truthBhs, const std::vector< const xAOD::Jet * > &jets) const
CP::SysReadSelectionHandle m_electronSelection
static double poisson_pmf(const int k, const double lambda)
Gaudi::Property< std::string > m_jsonConfigPath_SSVWeightsAlg
nFMethodType m_nFMethodType
CP::SysWriteDecorHandle< float > m_P_fake_pileup_bjet_based_decor
Gaudi::Property< std::string > m_nFMethod
Gaudi::Property< std::string > m_EfficiencyMethod
CP::SysReadHandle< xAOD::TruthParticleContainer > m_truthParticlesHandle
std::unique_ptr< nFMethodPileupBJetBasedClass > m_nFPileupBJetBasedPtr
CP::SysWriteDecorHandle< float > m_P_ineff_bjet_based_decor
CP::SysWriteDecorHandle< float > m_P_ineff_decor
SSVWeightsAlg(const std::string &name, ISvcLocator *pSvcLocator)
CP::SysReadSelectionHandle m_jetSelection
int count_number_of_fake_SSVs(const std::vector< const xAOD::TruthParticle * > &truthBhs, const std::vector< const xAOD::Vertex * > &SSVs) const
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
CP::SysListHandle m_systematicsList
Gaudi::Property< std::string > m_OutputVariableSize
std::vector< const xAOD::Vertex * > create_good_SSVs(const std::vector< const xAOD::Jet * > &jets, const std::vector< const xAOD::Electron * > &electrons, const std::vector< const xAOD::Muon * > &muons, const xAOD::VertexContainer &SSVs) const
CP::SysWriteDecorHandle< int > m_number_of_bjets_decor
CP::SysWriteDecorHandle< int > m_N_missed_decor
Gaudi::Property< std::string > m_BTaggingWP
CP::SysWriteDecorHandle< float > m_P_ineff_pt_eta_based_decor
CP::SysWriteDecorHandle< float > m_P_fake_pileup_based_binned_decor
static std::vector< const xAOD::TruthParticle * > construct_not_matched_vectors(const std::vector< const xAOD::TruthParticle * > &truthBhs, const std::vector< bool > &matched_vector)
CP::SysWriteDecorHandle< float > m_P_fake_decor
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
CP::SysWriteDecorHandle< float > m_P_eff_decor
EfficiencyMethodType m_EfficiencyMethodType
std::unique_ptr< nFMethodPileupBasedBinnedClass > m_nFPileupBasedBinnedPtr
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 reading systematics varied input data
the (new) base class for EventLoop algorithms
virtual::StatusCode execute()
execute this algorithm
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.