#include <UnbinnedLikelihoodFit.h>
Public Member Functions | |
int32_t | fit (int32_t verbosity=-1) |
int32_t | fit (int32_t n, double *x, int32_t verbosity=-1) |
TF1 * | getFunction () const |
double | getParameterError (uint32_t i) |
double * | getParameterErrors () |
double | getParameterValue (uint32_t i) |
double * | getParameterValues () |
void | setData (uint32_t n, double *x) |
void | setFunction (TF1 *f) |
void | setMaxIterations (uint32_t n) |
void | setTolerance (double tol) |
UnbinnedLikelihoodFit () | |
~UnbinnedLikelihoodFit () | |
Private Member Functions | |
double | logL (const double *x) const |
Private Attributes | |
double | arglist_ [10] |
uint32_t | datasize_ |
TF1 * | function_ |
uint32_t | maxIterations_ |
TVirtualFitter * | min |
uint32_t | nparameters_ |
double | tolerance_ |
double * | x_ |
Friends | |
void | UnbinnedLL (Int_t &npar, Double_t *gin, Double_t &val, Double_t *par, Int_t iflag) |
Definition at line 24 of file UnbinnedLikelihoodFit.h.
UnbinnedLikelihoodFit::UnbinnedLikelihoodFit | ( | ) |
Definition at line 30 of file UnbinnedLikelihoodFit.cc.
References datasize_, maxIterations_, min, nparameters_, NULL, tolerance_, and x_.
{ nparameters_ = 0; datasize_ = 0; x_ = NULL; min = NULL; tolerance_ = 0.01; maxIterations_ = 1000; }
UnbinnedLikelihoodFit::~UnbinnedLikelihoodFit | ( | ) |
Definition at line 40 of file UnbinnedLikelihoodFit.cc.
{ }
int32_t UnbinnedLikelihoodFit::fit | ( | int32_t | verbosity = -1 | ) |
Definition at line 57 of file UnbinnedLikelihoodFit.cc.
References arglist_, ExpressReco_HICollisions_FallBack::Fitter, function_, i, maxIterations_, min, nparameters_, ntuplemaker::status, tolerance_, UnbinnedLL, and verbosity.
Referenced by UnbinnedFitDeDxEstimator::dedx().
{ // creates a fitter min = TVirtualFitter::Fitter(this,nparameters_); min->SetFCN(UnbinnedLL); // set print level: no output arglist_[0] = 0; min->ExecuteCommand("SET NOWarnings",arglist_,1); arglist_[0] = verbosity; min->ExecuteCommand("SET PRINT",arglist_,1); // initial values, error, range double parmin,parmax; for(uint32_t i=0;i<nparameters_;++i) { function_->GetParLimits(i, parmin, parmax); min->SetParameter(i, function_->GetParName(i), function_->GetParameter(i), tolerance_, parmin, parmax); } // run MIGRAD arglist_[0] = maxIterations_; // number of function calls arglist_[1] = tolerance_; // tolerance int32_t status = min->ExecuteCommand("MIGRAD",arglist_,2); // get fit parameters and errors for(uint32_t i=0;i<nparameters_;++i) { function_->SetParameter(i, min->GetParameter(i)); function_->SetParError( i, min->GetParError(i) ); } // returns the status return status; }
int32_t UnbinnedLikelihoodFit::fit | ( | int32_t | n, |
double * | x, | ||
int32_t | verbosity = -1 |
||
) | [inline] |
TF1* UnbinnedLikelihoodFit::getFunction | ( | ) | const [inline] |
double UnbinnedLikelihoodFit::getParameterError | ( | uint32_t | i | ) | [inline] |
double* UnbinnedLikelihoodFit::getParameterErrors | ( | ) | [inline] |
double UnbinnedLikelihoodFit::getParameterValue | ( | uint32_t | i | ) | [inline] |
double* UnbinnedLikelihoodFit::getParameterValues | ( | ) | [inline] |
double UnbinnedLikelihoodFit::logL | ( | const double * | x | ) | const [private] |
void UnbinnedLikelihoodFit::setData | ( | uint32_t | n, |
double * | x | ||
) |
void UnbinnedLikelihoodFit::setFunction | ( | TF1 * | f | ) |
Definition at line 51 of file UnbinnedLikelihoodFit.cc.
References f, function_, and nparameters_.
Referenced by UnbinnedFitDeDxEstimator::UnbinnedFitDeDxEstimator().
{ function_ = f; nparameters_ = function_ ? function_->GetNpar() : 0; }
void UnbinnedLikelihoodFit::setMaxIterations | ( | uint32_t | n | ) | [inline] |
Definition at line 39 of file UnbinnedLikelihoodFit.h.
References maxIterations_, and n.
{ maxIterations_ = n; }
void UnbinnedLikelihoodFit::setTolerance | ( | double | tol | ) | [inline] |
void UnbinnedLL | ( | Int_t & | npar, |
Double_t * | gin, | ||
Double_t & | val, | ||
Double_t * | par, | ||
Int_t | iflag | ||
) | [friend] |
Definition at line 22 of file UnbinnedLikelihoodFit.cc.
Referenced by fit().
{ // retrieve the data object (it's also the fitter) // - sign to have a minimum // factor 2 to have the right errors (see for example the pdg) val = -2*((dynamic_cast<const UnbinnedLikelihoodFit*>((TVirtualFitter::GetFitter())->GetObjectFit()))->logL(par)); }
double UnbinnedLikelihoodFit::arglist_[10] [private] |
Definition at line 60 of file UnbinnedLikelihoodFit.h.
Referenced by fit().
uint32_t UnbinnedLikelihoodFit::datasize_ [private] |
Definition at line 54 of file UnbinnedLikelihoodFit.h.
Referenced by logL(), setData(), and UnbinnedLikelihoodFit().
TF1* UnbinnedLikelihoodFit::function_ [private] |
Definition at line 57 of file UnbinnedLikelihoodFit.h.
Referenced by fit(), getFunction(), getParameterError(), getParameterErrors(), getParameterValue(), getParameterValues(), logL(), and setFunction().
uint32_t UnbinnedLikelihoodFit::maxIterations_ [private] |
Definition at line 61 of file UnbinnedLikelihoodFit.h.
Referenced by fit(), setMaxIterations(), and UnbinnedLikelihoodFit().
TVirtualFitter* UnbinnedLikelihoodFit::min [private] |
Definition at line 64 of file UnbinnedLikelihoodFit.h.
Referenced by fit(), and UnbinnedLikelihoodFit().
uint32_t UnbinnedLikelihoodFit::nparameters_ [private] |
Definition at line 58 of file UnbinnedLikelihoodFit.h.
Referenced by fit(), setFunction(), and UnbinnedLikelihoodFit().
double UnbinnedLikelihoodFit::tolerance_ [private] |
Definition at line 62 of file UnbinnedLikelihoodFit.h.
Referenced by fit(), setTolerance(), and UnbinnedLikelihoodFit().
double* UnbinnedLikelihoodFit::x_ [private] |
Definition at line 55 of file UnbinnedLikelihoodFit.h.
Referenced by logL(), setData(), and UnbinnedLikelihoodFit().