40 struct BasisFunction {
41 BasisFunction(
const Func & f,
int k) :
47 return fFunc->ParameterDerivative(x,fKPar);
94 std::string algoname(type);
95 std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower );
97 if (algoname.find(
"robust") != std::string::npos)
fRobust =
true;
116 if (
this == &rhs)
return *
this;
124 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
133 const Chi2Func * chi2func =
dynamic_cast<const Chi2Func *
>(&objfunc);
135 Error(
"TLinearMinimizer::SetFunction(IMultiGradFunction)",
"Wrong type of function used for Linear fitter");
142 const ModelFunc * modfunc =
dynamic_cast<const ModelFunc*
>( &(chi2func->ModelFunction()) );
143 assert(modfunc != 0);
145 fDim = chi2func->NDim();
150 for (
unsigned int i = 0; i <
fDim; ++i) {
155 BasisFunction<ModelFunc > bf(*modfunc,i);
157 std::string fname =
"_LinearMinimimizer_BasisFunction_" +
174 for (
unsigned int i = 0; i < data.
Size(); ++i) {
207 std::cout <<
"TLinearMinimizer: Robust fitting with h = " << h << std::endl;
213 Warning(
"Minimize",
"TLinearFitter failed in finding the solution");
222 for (
unsigned int i = 0; i <
fDim; ++i) {
229 if (!
fRobust && cov) std::copy(cov,cov+fDim*fDim,
fCovar.begin() );
virtual void StoreData(Bool_t store)
std::vector< double > fErrors
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
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.
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
virtual Double_t * GetCovarianceMatrix() const
Returns covariance matrix.
Minimizer()
Default constructor.
int PrintLevel() const
minimizer configuration parameters
TLinearMinimizer class: minimizer implementation based on TMinuit.
TRObject operator()(const T1 &t1) const
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...
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
TLinearMinimizer & operator=(const TLinearMinimizer &rhs)
Assignment operator.
std::vector< double > fCovar
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the fit model function
unsigned int Size() const
return number of fit points
double Error(unsigned int ipoint) const
void Error(const char *location, const char *msgfmt,...)
double Tolerance() const
absolute tolerance
Documentation for the abstract class IBaseFunctionMultiDim.
Chi2FCN class for binnned fits using the least square methods.
virtual Double_t GetParameter(Int_t ipar) const
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 DataOptions & Opt() const
access to options
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 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.
virtual Double_t GetParError(Int_t ipar) const
Returns the error of parameter #ipar.
virtual bool Minimize()
method to perform the minimization
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
bool fRobust
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;...
ParamFunctorTempl< double > ParamFunctor
virtual ~TLinearMinimizer()
Destructor (no operations)
virtual bool SetFixedVariable(unsigned int, const std::string &, double)
set fixed variable (override if minimizer supports them )
virtual void AddPoint(Double_t *x, Double_t y, Double_t e=1)
Adds 1 point to the fitter.