46 if ((a == 0.0) || (b == 0.0))
return v;
95 if (!ellipse_TGraph)
return v;
96 for (
Int_t i = 0; i < ellipse_TGraph->
GetN(); i++) {
98 (ellipse_TGraph->
GetY())[i],
115 if (g->
GetN() < 6)
return 0;
155 x0 = (xmax +
xmin) / 2.0;
156 y0 = (ymax +
ymin) / 2.0;
157 a = (ellipse_TGraph->
GetX())[0] - x0;
158 b = (ellipse_TGraph->
GetY())[0] - y0;
159 theta = ((std::abs(b) > 9999.9 * std::abs(a)) ? 9999.9 : (b / a));
162 for (
Int_t i = 1; i < ellipse_TGraph->
GetN(); i++) {
169 theta = ((std::abs(dy) > 9999.9 * std::abs(dx)) ? 9999.9 : (dy / dx));
173 a =
std::sqrt(a);
if (!(a > 0)) a = 0.001;
174 b =
std::sqrt(b);
if (!(b > 0)) b = 0.001;
176 if (theta < -45.0) theta += 180.0;
179 m->
SetVariable(0,
"x0", x0, (xmax - xmin) / 100.0);
180 m->
SetVariable(1,
"y0", y0, (ymax - ymin) / 100.0);
190 if (a < ((xmax - xmin) / 2.0)) a = (xmax -
xmin) / 2.0;
191 if (b < ((ymax - ymin) / 2.0)) b = (ymax - ymin) / 2.0;
193 if (a < ((ymax - ymin) / 2.0)) a = (ymax - ymin) / 2.0;
194 if (b < ((xmax - xmin) / 2.0)) b = (xmax - xmin) / 2.0;
207 std::cout <<
"Minimum ( " 208 << xm[0] <<
" , " << xm[1] <<
" , " 209 << xm[2] <<
" , " << xm[3] <<
" , " 245 for (i = 0; i <
n; i++) {
275 TF2 *ellipse = ((
TF2 *)(
gROOT->GetListOfFunctions()->FindObject(
"ellipse")));
276 if (ellipse)
delete ellipse;
279 ellipse->
SetParNames(
"x0",
"y0",
"a",
"b",
"theta");
289 if (c) { c->
Clear(); }
else { c =
new TCanvas(
"c",
"c"); }
292 if ( m && (!(m->
Status())) ) {
virtual void SetParameters(const Double_t *params)
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
virtual void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
Set up to 10 parameter names.
constexpr Double_t TwoPi()
Documentation for class Functor class.
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corrisponding Minimizer given the string Supported Minimizers types are: ...
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
int Status() const
status code of minimizer
virtual void Clear()
reset for consecutive minimizations - implement if needed
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in's exist in ROOT to be able to instantiate the derived classes like ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the plug-in manager.
virtual double MinValue() const =0
return minimum function value
virtual bool Minimize()=0
method to perform the minimization
void Clear(Option_t *option="")
Remove all primitives from the canvas.
virtual const double * X() const =0
return pointer to X values at the minimum
Double_t ellipse_TGraph_chi2(const Double_t *x)
TGraph * TestGraphRMM(Bool_t randomize=kFALSE)
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
virtual Double_t Rndm()
Machine independent random number generator.
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)=0
set the function to minimize
A 2-Dim function with parameters.
R__EXTERN TRandom * gRandom
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn, set also the maximum in the helper histogram.
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetTolerance(double tol)
set the tolerance
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void fitEllipseTGraphRMM(TGraph *g=((TGraph *) 0))
virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper)
set the limits of an already existing variable
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)=0
set a new free variable
A Graph is a graphics object made of two arrays X and Y with npoints each.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Double_t ellipse_fcn(Double_t x, Double_t y, Double_t x0, Double_t y0, Double_t a, Double_t b, Double_t theta)
void SetPrintLevel(int level)
set print level
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute the x/y range of the points in this graph.
virtual void Update()
Update canvas pad buffers.
constexpr Double_t PiOver2()
void Modified(Bool_t flag=1)
ROOT::Math::Minimizer * ellipse_TGraph_minimize(TGraph *g)