ATLAS Offline Software
Loading...
Searching...
No Matches
CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass Class Reference
Collaboration diagram for CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass:

Public Member Functions

 nFMethodPileupBJetBasedClass (const nlohmann::json &jsonConfig)
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

Private Attributes

std::map< std::string, std::map< std::string, double > > m_nFPileupBJetMap {}
int m_upperboundNbjets = -999
double m_lowMuHighMuThreshold = -999

Detailed Description

Definition at line 95 of file SSVWeightsAlg.h.

Constructor & Destructor Documentation

◆ nFMethodPileupBJetBasedClass()

CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass::nFMethodPileupBJetBasedClass ( const nlohmann::json & jsonConfig)

Definition at line 640 of file SSVWeightsAlg.cxx.

641 : m_nFPileupBJetMap(jsonConfig["nF_pileup_bjet_based"])
642 {
643 // Extract information from JSON file for nFMethodPileupBJetBased
644 std::map<std::string, double>::iterator lastItem = std::prev(m_nFPileupBJetMap.at("high_muactual").end());
645 std::string lastItemKey = lastItem->first;
646 m_upperboundNbjets = std::stoi(lastItemKey);
647 m_lowMuHighMuThreshold = jsonConfig["CalibrationInformation"]["lowMuHighMuThreshold"];
648 }
std::map< std::string, std::map< std::string, double > > m_nFPileupBJetMap

Member Function Documentation

◆ getPFake()

double CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass::getPFake ( const double muactual,
const int b_jet_count,
const int N_fake,
const double SF_fake_low,
const double SF_fake_high ) const

Definition at line 651 of file SSVWeightsAlg.cxx.

656 {
657
658 double P_fake = 1;
659 // 2D map muactual and Nbjets
660 std::string mu_key = (muactual >= m_lowMuHighMuThreshold) ? "high_muactual" : "low_muactual";
661
662 // Get the value
663 double n_F_value = 0;
664
665 if (b_jet_count < m_upperboundNbjets){
666 // Build the bjets key string
667 std::string bjets_key = std::to_string(b_jet_count) + "_bjets";
668 n_F_value = m_nFPileupBJetMap.at(mu_key).at(bjets_key);
669 }
670 else{
671 // Build the bjets key string
672 std::string bjets_key = std::to_string(m_upperboundNbjets) + "p_bjets";
673 n_F_value = m_nFPileupBJetMap.at(mu_key).at(bjets_key);
674 }
675 auto denom = poisson_pmf(N_fake, n_F_value);
676 if (denom == 0. )[[unlikely]]{
677 throw std::runtime_error("nFMethodPileupBJetBasedClass::getPFake: divide-by-zero");
678 }
679 if (muactual >= m_lowMuHighMuThreshold){
680 P_fake = (poisson_pmf(N_fake, SF_fake_high*n_F_value))/denom;
681 }
682 else {
683 P_fake = (poisson_pmf(N_fake, SF_fake_low*n_F_value))/denom;
684 }
685
686 return P_fake;
687 }
static double poisson_pmf(const int k, const double lambda)
#define unlikely(x)

Member Data Documentation

◆ m_lowMuHighMuThreshold

double CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass::m_lowMuHighMuThreshold = -999
private

Definition at line 107 of file SSVWeightsAlg.h.

◆ m_nFPileupBJetMap

std::map<std::string, std::map<std::string, double> > CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass::m_nFPileupBJetMap {}
private

Definition at line 105 of file SSVWeightsAlg.h.

105{};

◆ m_upperboundNbjets

int CP::SSVWeightsAlg::nFMethodPileupBJetBasedClass::m_upperboundNbjets = -999
private

Definition at line 106 of file SSVWeightsAlg.h.


The documentation for this class was generated from the following files: