#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 &resEta) |
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 throw (cms::Exception) |
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] |
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 19 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 10 of file BackgroundHandler.cc.
References backgroundFunctionService(), backgroundWindow_, consistencyCheck(), i, getHLTprescales::index, initializeParNums(), regToResHW_, resonanceWindow_, and resToReg_.
BackgroundHandler::~BackgroundHandler | ( | ) |
Definition at line 79 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 & | resEta | ||
) |
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 224 of file BackgroundHandler.cc.
References backgroundWindow_, parNumsRegions_, parNumsResonances_, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::massProb().
|
inline |
Check if the mass value is inside the given background region.
Definition at line 39 of file BackgroundHandler.h.
References backgroundWindow_.
|
private |
Used to check the consistency of passed parameters.
Definition at line 266 of file BackgroundHandler.cc.
References edm::hlt::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 240 of file BackgroundHandler.cc.
References backgroundWindow_, MassWindow::count(), MassWindow::resetCounter(), resonanceWindow_, and CommonMethods::weight().
Referenced by rescale().
void BackgroundHandler::initializeParNums | ( | ) |
Initialize the parNums to be used in the shifts of parval.
Definition at line 83 of file BackgroundHandler.cc.
References backgroundWindow_, i, parNumsRegions_, parNumsResonances_, and resonanceWindow_.
Referenced by BackgroundHandler().
|
inline |
Returns the total number of parameters used for the regions.
Definition at line 33 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 169 of file BackgroundHandler.cc.
References MassWindow::backgroundFunction(), backgroundWindow_, countEventsInAllWindows(), gather_cfg::cout, MassWindow::events(), backgroundFunctionBase::functionForIntegral(), getHLTprescales::index, MassWindow::indexes(), MassWindow::lowerBound(), parNumsRegions_, parNumsResonances_, resonanceWindow_, resToReg_, and MassWindow::upperBound().
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 157 of file BackgroundHandler.cc.
References backgroundWindow_, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::massProb(), and MuScleFitUtils::minimizeLikelihood().
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 96 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 116 of file BackgroundHandler.cc.
References parNumsRegions_, and parNumsResonances_.
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 144 of file BackgroundHandler.cc.
References backgroundWindow_, resonanceWindow_, and resToReg_.
Referenced by MuScleFitUtils::computeWeight(), MuScleFitUtils::massProb(), and MuScleFitUtils::minimizeLikelihood().
|
private |
Definition at line 113 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), checkBackgroundWindow(), countEventsInAllWindows(), initializeParNums(), rescale(), resMass(), setParameters(), and windowBorders().
|
private |
Definition at line 104 of file BackgroundHandler.h.
Referenced by backgroundFunction(), initializeParNums(), rescale(), setParameters(), and unlockParameter().
|
private |
Definition at line 107 of file BackgroundHandler.h.
Referenced by backgroundFunction(), initializeParNums(), regionsParNum(), rescale(), setParameters(), and unlockParameter().
|
private |
Definition at line 91 of file BackgroundHandler.h.
Referenced by BackgroundHandler().
|
private |
Definition at line 112 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), countEventsInAllWindows(), initializeParNums(), rescale(), resMass(), setParameters(), and windowBorders().
|
private |
Definition at line 97 of file BackgroundHandler.h.
Referenced by backgroundFunction(), BackgroundHandler(), rescale(), resMass(), and windowBorders().