38 struct BasisFunction {
39 BasisFunction(
const Func &
f,
int k) :
45 return fFunc->ParameterDerivative(x,fKPar);
92 std::string algoname(type);
93 std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower );
95 if (algoname.find(
"robust") != std::string::npos)
fRobust =
true;
114 if (
this == &rhs)
return *
this;
122 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
131 const Chi2Func * chi2func =
dynamic_cast<const Chi2Func *
>(&objfunc);
133 Error(
"TLinearMinimizer::SetFunction(IMultiGradFunction)",
"Wrong type of function used for Linear fitter");
140 const ModelFunc * modfunc =
dynamic_cast<const ModelFunc*
>( &(chi2func->ModelFunction()) );
143 fDim = chi2func->NDim();
148 for (
unsigned int i = 0; i <
fDim; ++i) {
153 BasisFunction<ModelFunc > bf(*modfunc,i);
155 std::string fname =
"_LinearMinimimizer_BasisFunction_" +
172 for (
unsigned int i = 0; i < data.
Size(); ++i) {
205 std::cout <<
"TLinearMinimizer: Robust fitting with h = " << h << std::endl;
211 Warning(
"Minimize",
"TLinearFitter failed in finding the solution");
220 for (
unsigned int i = 0; i <
fDim; ++i) {
227 if (!
fRobust && cov) std::copy(cov,cov+fDim*fDim,
fCovar.begin() );
virtual void StoreData(Bool_t store)
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
std::vector< double > fErrors
virtual void FixParameter(Int_t ipar)
Fixes paramter #ipar at its current value.
The Linear Fitter - For fitting functions that are LINEAR IN PARAMETERS.
std::vector< double > fParams
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
double Tolerance() const
absolute tolerance
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
TLinearMinimizer class: minimizer implementation based on TMinuit.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
unsigned int Size() const
return number of fit points
TLinearMinimizer & operator=(const TLinearMinimizer &rhs)
Assignment operator.
std::vector< double > fCovar
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the fit model function
void Error(const char *location, const char *msgfmt,...)
Chi2FCN class for binnned fits using the least square methods.
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
RooCmdArg Minimizer(const char *type, const char *alg=0)
const ROOT::Math::IMultiGradFunction * fObjFunc
virtual Int_t EvalRobust(Double_t h=-1)
Finds the parameters of the fitted function in case data contains outliers.
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
int PrintLevel() const
minimizer configuration parameters
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
void Warning(const char *location, const char *msgfmt,...)
virtual Double_t GetParameter(Int_t ipar) const
virtual void SetBasisFunctions(TObjArray *functions)
set the basis functions in case the fitting function is not set directly The TLinearFitter will manag...
virtual Int_t Eval()
Perform the fit and evaluate the parameters Returns 0 if the fit is ok, 1 if there are errors...
TLinearMinimizer(int type=0)
Default constructor.
TRObject operator()(const T1 &t1) const
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
virtual bool Minimize()
method to perform the minimization
double Error(unsigned int ipoint) const
return error on the value for the given fit point Safe (but slower) method returning correctly the er...
bool fRobust
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;...
Param Functor class for Multidimensional functions.
const DataOptions & Opt() const
access to options
virtual Double_t GetParError(Int_t ipar) const
Returns the error of parameter #ipar.
const double * GetPoint(unsigned int ipoint, double &value) const
retrieve at the same time a pointer to the coordinate data and the fit value More efficient than call...
virtual ~TLinearMinimizer()
Destructor (no operations)
Documentation for the abstract class IBaseFunctionMultiDim.
ClassImp(TLinearMinimizer) TLinearMinimizer
virtual bool SetFixedVariable(unsigned int, const std::string &, double)
set fixed variable (override if minimizer supports them )
virtual Double_t * GetCovarianceMatrix() const
Returns covariance matrix.
virtual void AddPoint(Double_t *x, Double_t y, Double_t e=1)
Adds 1 point to the fitter.