46  if ((
a == 0.0) || (
b == 0.0)) 
return v; 
 
   53  x = 
x * std::cos(theta) + 
y * std::sin(theta);
 
   54  y = 
y * std::cos(theta) - 
v * std::sin(theta);
 
 
  113  if (!
g) 
return nullptr; 
 
  114  if (
g->GetN() < 6) 
return nullptr; 
 
  135  m->SetMaxFunctionCalls(1000000); 
 
  136  m->SetMaxIterations(100000); 
 
  137  m->SetTolerance(0.001); 
 
  152  double x0, 
y0, 
a, 
b, theta;
 
  158  theta = ((std::abs(
b) > 9999.9 * std::abs(
a)) ? 9999.9 : (
b / 
a));
 
  168      theta = ((std::abs(
dy) > 9999.9 * std::abs(
dx)) ? 9999.9 : (
dy / 
dx));
 
  172  a = std::sqrt(
a); 
if (!(
a > 0)) 
a = 0.001;
 
  173  b = std::sqrt(
b); 
if (!(
b > 0)) 
b = 0.001;
 
  174  theta = std::atan(theta) * 180.0 / 
TMath::Pi();
 
  175  if (theta < -45.0) theta += 180.0; 
 
  178  m->SetVariable(0, 
"x0", x0, (
xmax - 
xmin) / 100.0);
 
  179  m->SetVariable(1, 
"y0", 
y0, (
ymax - 
ymin) / 100.0);
 
  180  m->SetVariable(2, 
"a", 
a, 
a / 100.0);
 
  181  m->SetVariable(3, 
"b", 
b, 
b / 100.0);
 
  182  m->SetVariable(4, 
"theta", theta, 1);
 
  195  m->SetVariableLimits(2, 0, 
a * 3.0);
 
  196  m->SetVariableLimits(3, 0, 
b * 3.0);
 
  198  m->SetVariableLimits(4, theta - 45.0, theta + 45.0); 
 
  205  const double *
xm = 
m->X();
 
  206  std::cout << 
"Minimum ( " 
  207            << 
xm[0] << 
" , " << 
xm[1] << 
" , "  
  208            << 
xm[2] << 
" , " << 
xm[3] << 
" , "  
 
  243  for (
int i = 0; i < 
n; i++) {
 
  248    x[i] = 
x[i] * std::cos(theta) - 
y[i] * std::sin(theta);
 
  249    y[i] = 
y[i] * std::cos(theta) + tmp * std::sin(theta);
 
  259  g->SetNameTitle(
"g", 
"test ellipse");
 
 
  275  auto c1 = 
new TCanvas(
"c1",
"c1", 1000, 800);
 
  278  if ( 
m && (!(
m->Status())) ) {
 
  279     const double *
xm = 
m->X();
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 r
R__EXTERN TRandom * gRandom
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corresponding 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,...
A TGraph is an 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 void Clear(Option_t *="")
Double_t Rndm() override
Machine independent random number generator.
void fitEllipseTGraphRMM(TGraph *g=nullptr)
TGraph * TestGraphRMM(bool randomize=false)
double ellipse_fcn(double x, double y, double x0, double y0, double a, double b, double theta)
ROOT::Math::Minimizer * ellipse_TGraph_minimize(TGraph *g)
https://root.cern.ch/doc/master/NumericalMinimization_8C.html
double ellipse_TGraph_chi2(const double *x)
constexpr Double_t PiOver2()
constexpr Double_t TwoPi()