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;
127 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
131 const Chi2Func * chi2func =
dynamic_cast<const Chi2Func *
>(&objfunc);
132 if (chi2func ==
nullptr) {
133 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
140 const ModelFunc * modfunc =
dynamic_cast<const ModelFunc*
>( &(chi2func->ModelFunction()) );
141 assert(modfunc !=
nullptr);
143 fDim = chi2func->NDim();
148 for (
unsigned int i = 0; i <
fDim; ++i) {
155 std::string fname =
"_LinearMinimimizer_BasisFunction_" +
172 std::vector<double> xc(
data.NDim());
173 for (
unsigned int i = 0; i <
data.Size(); ++i) {
175 const double *
x1 =
data.GetPoint(i,
y);
177 if (!
data.Opt().fErrors1) {
181 double binVolume = 1.;
182 double *
x =
nullptr;
183 if (
data.Opt().fBinVolume) {
185 const double *
x2 =
data.BinUpEdge(i);
186 for (
unsigned int j = 0; j <
data.NDim(); ++j) {
187 binVolume *= (
x2[j]-
x1[j]);
189 xc[j] = 0.5 * (
x2[j]+
x1[j]);
191 if (
data.Opt().fNormBinVolume) binVolume /=
data.RefVolume();
197 x =
const_cast<double*
>(
x1);
227 std::cout <<
"TLinearMinimizer: Robust fitting with h = " <<
h << std::endl;
233 Warning(
"Minimize",
"TLinearFitter failed in finding the solution");
242 for (
unsigned int i = 0; i <
fDim; ++i) {
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Chi2FCN class for binned fits using the least square methods.
Documentation for the abstract class IBaseFunctionMultiDim.
virtual bool HasGradient() const
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
double Tolerance() const
absolute tolerance
int fStatus
status of minimizer
int PrintLevel() const
minimizer configuration parameters
Param Functor class for Multidimensional functions.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
The Linear Fitter - For fitting functions that are LINEAR IN PARAMETERS.
Int_t GetNumberFreeParameters() const override
virtual Int_t Eval()
Perform the fit and evaluate the parameters Returns 0 if the fit is ok, 1 if there are errors.
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 EvalRobust(Double_t h=-1)
Finds the parameters of the fitted function in case data contains outliers.
Double_t GetParError(Int_t ipar) const override
Returns the error of parameter #ipar
void FixParameter(Int_t ipar) override
Fixes paramter #ipar at its current value.
virtual void AddPoint(Double_t *x, Double_t y, Double_t e=1)
Adds 1 point to the fitter.
Double_t * GetCovarianceMatrix() const override
Returns covariance matrix.
Double_t GetParameter(Int_t ipar) const override
virtual void StoreData(Bool_t store)
TLinearMinimizer class: minimizer implementation based on TMinuit.
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the fit model function
TLinearMinimizer & operator=(const TLinearMinimizer &rhs)
Assignment operator.
~TLinearMinimizer() override
Destructor (no operations)
bool fRobust
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;
const ROOT::Math::IMultiGradFunction * fObjFunc
bool Minimize() override
method to perform the minimization
std::vector< double > fParams
TLinearMinimizer(int type=0)
Default constructor.
std::vector< double > fCovar
std::vector< double > fErrors
bool SetFixedVariable(unsigned int, const std::string &, double) override
set fixed variable (override if minimizer supports them )
void Add(TObject *obj) override
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
double operator()(double *x, double *)
BasisFunction(const Func &f, int k)