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

Public Member Functions

 nFMethodPileupBasedLinearFitClass (const nlohmann::json &jsonConfig)
double getPFake (const double muactual, const int N_fake) const

Private Attributes

double m_slopeUnscaled = -999.
double m_interceptUnscaled = -999.
double m_slopeScaled = -999.
double m_interceptScaled = -999.

Detailed Description

Definition at line 68 of file SSVWeightsAlg.h.

Constructor & Destructor Documentation

◆ nFMethodPileupBasedLinearFitClass()

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

Definition at line 689 of file SSVWeightsAlg.cxx.

689 {
690 // Extract information from JSON file for nFMethodPileupBasedLinearFit
691 m_slopeUnscaled = jsonConfig["nF_pileup_based_linearfit"]["unscaled"]["slope"];
692 m_interceptUnscaled = jsonConfig["nF_pileup_based_linearfit"]["unscaled"]["intercept"];
693 m_slopeScaled = jsonConfig["nF_pileup_based_linearfit"]["scaled"]["slope"];
694 m_interceptScaled = jsonConfig["nF_pileup_based_linearfit"]["scaled"]["intercept"];
695 }

Member Function Documentation

◆ getPFake()

double CP::SSVWeightsAlg::nFMethodPileupBasedLinearFitClass::getPFake ( const double muactual,
const int N_fake ) const

Definition at line 698 of file SSVWeightsAlg.cxx.

700 {
701 // Calculate expected counts
702 double n_F = m_slopeUnscaled * muactual + m_interceptUnscaled;
703 double n_F_scaled = m_slopeScaled * muactual + m_interceptScaled;
704 auto denom = poisson_pmf(N_fake, n_F);
705 if (denom == 0.)[[unlikely]]{
706 throw std::runtime_error("nFMethodPileupBasedLinearFitClass::getPFake: divide-by-zero.");
707 }
708 // Calculate P_fake
709 double P_fake = poisson_pmf(N_fake, n_F_scaled) / poisson_pmf(N_fake, n_F);
710
711 return P_fake;
712 }
static double poisson_pmf(const int k, const double lambda)
#define unlikely(x)

Member Data Documentation

◆ m_interceptScaled

double CP::SSVWeightsAlg::nFMethodPileupBasedLinearFitClass::m_interceptScaled = -999.
private

Definition at line 78 of file SSVWeightsAlg.h.

◆ m_interceptUnscaled

double CP::SSVWeightsAlg::nFMethodPileupBasedLinearFitClass::m_interceptUnscaled = -999.
private

Definition at line 76 of file SSVWeightsAlg.h.

◆ m_slopeScaled

double CP::SSVWeightsAlg::nFMethodPileupBasedLinearFitClass::m_slopeScaled = -999.
private

Definition at line 77 of file SSVWeightsAlg.h.

◆ m_slopeUnscaled

double CP::SSVWeightsAlg::nFMethodPileupBasedLinearFitClass::m_slopeUnscaled = -999.
private

Definition at line 75 of file SSVWeightsAlg.h.


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