46 if ((
a == 0.0) || (
b == 0.0))
return v;
115 if (
g->GetN() < 6)
return 0;
136 m->SetMaxFunctionCalls(1000000);
137 m->SetMaxIterations(100000);
138 m->SetTolerance(0.001);
159 theta = ((std::abs(
b) > 9999.9 * std::abs(
a)) ? 9999.9 : (
b /
a));
169 theta = ((std::abs(dy) > 9999.9 * std::abs(dx)) ? 9999.9 : (dy / dx));
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);
181 m->SetVariable(2,
"a",
a,
a / 100.0);
182 m->SetVariable(3,
"b",
b,
b / 100.0);
183 m->SetVariable(4,
"theta", theta, 1);
196 m->SetVariableLimits(2, 0,
a * 3.0);
197 m->SetVariableLimits(3, 0,
b * 3.0);
199 m->SetVariableLimits(4, theta - 45.0, theta + 45.0);
207 std::cout <<
"Minimum ( "
208 << xm[0] <<
" , " << xm[1] <<
" , "
209 << xm[2] <<
" , " << xm[3] <<
" , "
245 for (i = 0; i <
n; i++) {
261 g->SetNameTitle(
"g",
"test ellipse");
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())) ) {
301 c->Modified();
c->Update();
R__EXTERN TRandom * gRandom
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: ...
Documentation for class Functor class.
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn,...
virtual void SetParameters(const Double_t *params)
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.
A 2-Dim function with parameters.
A Graph is a graphics object made of two arrays X and Y with npoints each.
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 Double_t Rndm()
Machine independent random number generator.
TGraph * TestGraphRMM(Bool_t randomize=kFALSE)
Double_t ellipse_TGraph_chi2(const Double_t *x)
void fitEllipseTGraphRMM(TGraph *g=((TGraph *) 0))
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)
ROOT::Math::Minimizer * ellipse_TGraph_minimize(TGraph *g)
constexpr Double_t PiOver2()
constexpr Double_t TwoPi()