93 std::string algoname(
type);
94 std::transform(algoname.begin(), algoname.end(), algoname.begin(), (
int(*)(
int)) tolower );
96 if (algoname.find(
"robust") != std::string::npos)
fRobust =
true;
112 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
116 const Chi2Func * chi2func =
dynamic_cast<const Chi2Func *
>(&objfunc);
117 if (chi2func ==
nullptr) {
118 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
125 const ModelFunc * modfunc =
dynamic_cast<const ModelFunc*
>( &(chi2func->ModelFunction()) );
126 assert(modfunc !=
nullptr);
128 fDim = chi2func->NDim();
133 for (
unsigned int i = 0; i <
fDim; ++i) {
140 std::string fname =
"_LinearMinimimizer_BasisFunction_" +
157 std::vector<double> xc(
data.NDim());
158 for (
unsigned int i = 0; i <
data.Size(); ++i) {
160 const double *
x1 =
data.GetPoint(i,
y);
162 if (!
data.Opt().fErrors1) {
166 double binVolume = 1.;
167 double *
x =
nullptr;
168 if (
data.Opt().fBinVolume) {
170 const double *
x2 =
data.BinUpEdge(i);
171 for (
unsigned int j = 0; j <
data.NDim(); ++j) {
172 binVolume *= (
x2[j]-
x1[j]);
174 xc[j] = 0.5 * (
x2[j]+
x1[j]);
176 if (
data.Opt().fNormBinVolume) binVolume /=
data.RefVolume();
182 x =
const_cast<double*
>(
x1);
212 std::cout <<
"TLinearMinimizer: Robust fitting with h = " <<
h << std::endl;
218 Warning(
"Minimize",
"TLinearFitter failed in finding the solution");
227 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.
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() 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)