Logo ROOT  
Reference Guide
MnParabolaFactory.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
11 #include "Minuit2/MnParabola.h"
13 
14 namespace ROOT {
15 
16 namespace Minuit2 {
17 
19 operator()(const MnParabolaPoint &p1, const MnParabolaPoint &p2, const MnParabolaPoint &p3) const
20 {
21  // construct the parabola from 3 points p1,p2,p3
22  double x1 = p1.X();
23  double x2 = p2.X();
24  double x3 = p3.X();
25  double dx12 = x1 - x2;
26  double dx13 = x1 - x3;
27  double dx23 = x2 - x3;
28 
29  // std::cout<<"MnParabolaFactory x1, x2, x3: "<<x1<<" "<<x2<<" "<<x3<<std::endl;
30 
31  double xm = (x1 + x2 + x3) / 3.;
32  x1 -= xm;
33  x2 -= xm;
34  x3 -= xm;
35 
36  double y1 = p1.Y();
37  double y2 = p2.Y();
38  double y3 = p3.Y();
39  // std::cout<<"MnParabolaFactory y1, y2, y3: "<<y1<<" "<<y2<<" "<<y3<<std::endl;
40 
41  double a = y1 / (dx12 * dx13) - y2 / (dx12 * dx23) + y3 / (dx13 * dx23);
42  double b = -y1 * (x2 + x3) / (dx12 * dx13) + y2 * (x1 + x3) / (dx12 * dx23) - y3 * (x1 + x2) / (dx13 * dx23);
43  double c = y1 - a * x1 * x1 - b * x1;
44 
45  c += xm * (xm * a - b);
46  b -= 2. * xm * a;
47 
48  // std::cout<<"a,b,c= "<<a<<" "<<b<<" "<<c<<std::endl;
49  return MnParabola(a, b, c);
50 }
51 
53 {
54  // construct the parabola from 2 points + derivative at first point dxdy1
55  double x1 = p1.X();
56  double xx1 = x1 * x1;
57  double x2 = p2.X();
58  double xx2 = x2 * x2;
59  double y1 = p1.Y();
60  double y12 = p1.Y() - p2.Y();
61 
62  double det = xx1 - xx2 - 2. * x1 * (x1 - x2);
63  double a = -(y12 + (x2 - x1) * dxdy1) / det;
64  double b = -(-2. * x1 * y12 + (xx1 - xx2) * dxdy1) / det;
65  double c = y1 - a * xx1 - b * x1;
66 
67  return MnParabola(a, b, c);
68 }
69 
70 } // namespace Minuit2
71 
72 } // namespace ROOT
c
#define c(i)
Definition: RSha256.hxx:101
ROOT::Minuit2::MnParabolaPoint
A point of a parabola.
Definition: MnParabolaPoint.h:36
b
#define b(i)
Definition: RSha256.hxx:100
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
MnParabolaPoint.h
x3
static const double x3[11]
Definition: RooGaussKronrodIntegrator1D.cxx:392
a
auto * a
Definition: textangle.C:12
ROOT::Minuit2::MnParabolaFactory::operator()
MnParabola operator()(const MnParabolaPoint &, const MnParabolaPoint &, const MnParabolaPoint &) const
Definition: MnParabolaFactory.cxx:19
MnParabolaFactory.h
ROOT::Minuit2::MnParabolaPoint::Y
double Y() const
Accessor to the y (second) coordinate.
Definition: MnParabolaPoint.h:70
ROOT::Minuit2::MnParabola
This class defines a parabola of the form a*x*x + b*x + c.
Definition: MnParabola.h:30
MnParabola.h
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
ROOT::Minuit2::MnParabolaPoint::X
double X() const
Accessor to the x (first) coordinate.
Definition: MnParabolaPoint.h:60
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4