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_" +
166 fFitter->SetBasisFunctions(&flist);
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);
207 fFitter->FixParameter(ivar, val);
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) {
246 double * cov =
fFitter->GetCovarianceMatrix();
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.
virtual bool HasGradient() const
double Tolerance() const
absolute tolerance
int fStatus
status of minimizer
Minimizer()
Default constructor.
int PrintLevel() const
minimizer configuration parameters
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
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.
IMultiGenFunctionTempl< double > IMultiGenFunction
ParamFunctorTempl< double > ParamFunctor
IParametricGradFunctionMultiDim IParamMultiGradFunction
double operator()(double *x, double *)
BasisFunction(const Func &f, int k)