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;
115 if (
this == &rhs)
return *
this;
126 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
130 const Chi2Func * chi2func =
dynamic_cast<const Chi2Func *
>(&objfunc);
131 if (chi2func ==
nullptr) {
132 Error(
"TLinearMinimizer::SetFunction(IMultiGenFunction)",
"Wrong type of function used for Linear fitter");
139 const ModelFunc * modfunc =
dynamic_cast<const ModelFunc*
>( &(chi2func->ModelFunction()) );
140 assert(modfunc !=
nullptr);
142 fDim = chi2func->NDim();
147 for (
unsigned int i = 0; i <
fDim; ++i) {
154 std::string fname =
"_LinearMinimimizer_BasisFunction_" +
171 std::vector<double> xc(
data.NDim());
172 for (
unsigned int i = 0; i <
data.Size(); ++i) {
174 const double *
x1 =
data.GetPoint(i,
y);
176 if (!
data.Opt().fErrors1) {
180 double binVolume = 1.;
181 double *
x =
nullptr;
182 if (
data.Opt().fBinVolume) {
184 const double *
x2 =
data.BinUpEdge(i);
185 for (
unsigned int j = 0; j <
data.NDim(); ++j) {
186 binVolume *= (
x2[j]-
x1[j]);
188 xc[j] = 0.5 * (
x2[j]+
x1[j]);
190 if (
data.Opt().fNormBinVolume) binVolume /=
data.RefVolume();
196 x =
const_cast<double*
>(
x1);
226 std::cout <<
"TLinearMinimizer: Robust fitting with h = " <<
h << std::endl;
232 Warning(
"Minimize",
"TLinearFitter failed in finding the solution");
241 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 & 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)