#include <BackgroundHandler.h>
Public Member Functions | |
std::pair< double, double > | backgroundFunction (const bool doBackgroundFit, const double *parval, const int resTotNum, const int ires, const bool *resConsidered, const double *ResMass, const double ResHalfWidth[], const int MuonType, const double &mass, const double &eta1, const double &eta2) |
BackgroundHandler (const std::vector< int > &identifiers, const std::vector< double > &leftWindowBorders, const std::vector< double > &rightWindowBorders, const double *ResMass, const double *massWindowHalfWidth) | |
bool | checkBackgroundWindow (const double &mass, const int iRegion) |
Check if the mass value is inside the given background region. More... | |
void | countEventsInAllWindows (const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > &muonPairs, const double &weight) |
void | initializeParNums () |
Initialize the parNums to be used in the shifts of parval. More... | |
int | regionsParNum () |
Returns the total number of parameters used for the regions. More... | |
void | rescale (std::vector< double > &parBgr, const double *ResMass, const double *massWindowHalfWidth, const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > &muonPairs, const double &weight=1.) |
double | resMass (const bool doBackgroundFit, const int ires) |
void | setParameters (double *Start, double *Step, double *Mini, double *Maxi, int *ind, TString *parname, const std::vector< double > &parBgr, const std::vector< int > &parBgrOrder, const int muonType) |
Sets initial parameters for all the functions. More... | |
bool | unlockParameter (const std::vector< int > &resfind, const unsigned int ipar) |
returns true if the parameter is to be unlocked More... | |
std::pair< double, double > | windowBorders (const bool doBackgroundFit, const int ires) |
Returns the appropriate window borders depending on whether the background is being fitted and on the resonance. More... | |
~BackgroundHandler () | |
Private Member Functions | |
void | consistencyCheck (const std::vector< int > &identifiers, const std::vector< double > &leftWindowBorders, const std::vector< double > &rightWindowBorders) const noexcept(false) |
Used to check the consistency of passed parameters. More... | |
Private Attributes | |
std::vector< MassWindow > | backgroundWindow_ |
int | parNumsRegions_ [3] |
int | parNumsResonances_ [6] |
int | regToResHW_ [3] |
std::vector< MassWindow > | resonanceWindow_ |
int | resToReg_ [6] |
Friends | |
class | TestBackgroundHandler |
This class is used to handle the different background functions for the different regions.
It uses the backgroundFunctions defined in Functions.h and the backgroundFunctionService defined in Functions.cc.
More details are in the description of backgroundFunctionBase in Functions.h.
A bool selects if to use the regions functions or the resonances functions.
Definition at line 32 of file BackgroundHandler.h.
BackgroundHandler::BackgroundHandler | ( | const std::vector< int > & | identifiers, |
const std::vector< double > & | leftWindowBorders, | ||
const std::vector< double > & | rightWindowBorders, | ||
const double * | ResMass, | ||
const double * | massWindowHalfWidth | ||
) |
Definition at line 11 of file BackgroundHandler.cc.
References backgroundFunctionService(), backgroundWindow_, consistencyCheck(), mps_fire::i, initializeParNums(), EgHLTOffHistBins_cfi::mass, regToResHW_, resonanceWindow_, and resToReg_.
BackgroundHandler::~BackgroundHandler | ( | ) |
Definition at line 88 of file BackgroundHandler.cc.
std::pair< double, double > BackgroundHandler::backgroundFunction | ( | const bool | doBackgroundFit, |
const double * | parval, | ||
const int | resTotNum, | ||
const int | ires, | ||
const bool * | resConsidered, | ||
const double * | ResMass, | ||
const double | ResHalfWidth[], | ||
const int | MuonType, | ||
const double & | mass, | ||
const double & | eta1, | ||
const double & | eta2 | ||
) |
Returns the background fraction parameter (parBgr[0], but shifted to the correct function) and the value returned by the background function.
Depending on the value of doBackgroundFit it returns the values for the regions or the resonances.
Definition at line 249 of file BackgroundHandler.cc.
References backgroundWindow_, HLT_FULL_cff::eta1, HLT_FULL_cff::eta2, ires, EgHLTOffHistBins_cfi::mass, parNumsRegions_, parNumsResonances_, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::massProb().
|
inline |
Check if the mass value is inside the given background region.
Definition at line 51 of file BackgroundHandler.h.
References backgroundWindow_, and EgHLTOffHistBins_cfi::mass.
|
privatenoexcept |
Used to check the consistency of passed parameters.
Definition at line 306 of file BackgroundHandler.cc.
References Exception.
Referenced by BackgroundHandler().
void BackgroundHandler::countEventsInAllWindows | ( | const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > & | muonPairs, |
const double & | weight | ||
) |
Definition at line 280 of file BackgroundHandler.cc.
References backgroundWindow_, resonanceWindow_, and mps_merge::weight.
Referenced by rescale().
void BackgroundHandler::initializeParNums | ( | ) |
Initialize the parNums to be used in the shifts of parval.
Definition at line 90 of file BackgroundHandler.cc.
References backgroundWindow_, mps_fire::i, parNumsRegions_, parNumsResonances_, and resonanceWindow_.
Referenced by BackgroundHandler().
|
inline |
Returns the total number of parameters used for the regions.
Definition at line 48 of file BackgroundHandler.h.
References parNumsResonances_.
Referenced by MuScleFitUtils::minimizeLikelihood().
void BackgroundHandler::rescale | ( | std::vector< double > & | parBgr, |
const double * | ResMass, | ||
const double * | massWindowHalfWidth, | ||
const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > & | muonPairs, | ||
const double & | weight = 1. |
||
) |
Computes the rescaled parameters from the regions functions to the resonances functions. It takes into account the difference in intervals and rescales the parameters so that the fraction of events is correctly accounted for.
It uses the list of all muon pairs to compute the number of events in each resonance window.
Definition at line 192 of file BackgroundHandler.cc.
References backgroundWindow_, countEventsInAllWindows(), gather_cfg::cout, parNumsRegions_, parNumsResonances_, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::minimizeLikelihood().
double BackgroundHandler::resMass | ( | const bool | doBackgroundFit, |
const int | ires | ||
) |
Returns the appropriate resMass value depending on whether the background is being fitted and on the resonance.
The resMass used for the region is the mean of the mass of the corresponding resonances, so for the Z is the same Z mass, for the Upsilons is the arithmetic mean of the Upsilon masses and the same for the J/Psi and Psi2S region.
Definition at line 182 of file BackgroundHandler.cc.
References backgroundWindow_, ires, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::massProb().
void BackgroundHandler::setParameters | ( | double * | Start, |
double * | Step, | ||
double * | Mini, | ||
double * | Maxi, | ||
int * | ind, | ||
TString * | parname, | ||
const std::vector< double > & | parBgr, | ||
const std::vector< int > & | parBgrOrder, | ||
const int | muonType | ||
) |
Sets initial parameters for all the functions.
Definition at line 102 of file BackgroundHandler.cc.
References backgroundWindow_, parNumsRegions_, parNumsResonances_, resonanceWindow_, and edm::shift.
Referenced by MuScleFitUtils::minimizeLikelihood().
bool BackgroundHandler::unlockParameter | ( | const std::vector< int > & | resfind, |
const unsigned int | ipar | ||
) |
returns true if the parameter is to be unlocked
Definition at line 141 of file BackgroundHandler.cc.
References parNumsRegions_, parNumsResonances_, and MuScleFitGenFilter_cfi::resfind.
Referenced by MuScleFitUtils::minimizeLikelihood().
std::pair< double, double > BackgroundHandler::windowBorders | ( | const bool | doBackgroundFit, |
const int | ires | ||
) |
Returns the appropriate window borders depending on whether the background is being fitted and on the resonance.
Definition at line 170 of file BackgroundHandler.cc.
References backgroundWindow_, ires, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::computeWeight(), MuScleFitUtils::massProb(), and MuScleFitUtils::minimizeLikelihood().
|
friend |
Definition at line 34 of file BackgroundHandler.h.
|
private |
Definition at line 142 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), checkBackgroundWindow(), countEventsInAllWindows(), initializeParNums(), rescale(), resMass(), setParameters(), and windowBorders().
|
private |
Definition at line 133 of file BackgroundHandler.h.
Referenced by backgroundFunction(), initializeParNums(), rescale(), setParameters(), and unlockParameter().
|
private |
Definition at line 136 of file BackgroundHandler.h.
Referenced by backgroundFunction(), initializeParNums(), regionsParNum(), rescale(), setParameters(), and unlockParameter().
|
private |
Definition at line 120 of file BackgroundHandler.h.
Referenced by BackgroundHandler().
|
private |
Definition at line 141 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), countEventsInAllWindows(), initializeParNums(), rescale(), resMass(), setParameters(), and windowBorders().
|
private |
Definition at line 126 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), rescale(), resMass(), and windowBorders().