ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
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
10
#include "
Minuit2/MnParabolaFactory.h
"
11
#include "
Minuit2/MnParabola.h
"
12
#include "
Minuit2/MnPoint.h
"
13
14
namespace
ROOT
{
15
16
namespace
Minuit2
{
17
18
MnParabola
MnParabolaFactory::operator()
(
const
MnPoint
&p1,
const
MnPoint
&p2,
const
MnPoint
&p3)
const
19
{
20
// construct the parabola from 3 points p1,p2,p3
21
double
x1 = p1.
X
();
22
double
x2 = p2.
X
();
23
double
x3 = p3.
X
();
24
double
dx12 = x1 - x2;
25
double
dx13 = x1 - x3;
26
double
dx23 = x2 - x3;
27
28
// std::cout<<"MnParabolaFactory x1, x2, x3: "<<x1<<" "<<x2<<" "<<x3<<std::endl;
29
30
double
xm = (x1 + x2 + x3) / 3.;
31
x1 -= xm;
32
x2 -= xm;
33
x3 -= xm;
34
35
double
y1 = p1.
Y
();
36
double
y2 = p2.
Y
();
37
double
y3 = p3.
Y
();
38
// std::cout<<"MnParabolaFactory y1, y2, y3: "<<y1<<" "<<y2<<" "<<y3<<std::endl;
39
40
double
a
= y1 / (dx12 * dx13) - y2 / (dx12 * dx23) + y3 / (dx13 * dx23);
41
double
b
= -y1 * (x2 + x3) / (dx12 * dx13) + y2 * (x1 + x3) / (dx12 * dx23) - y3 * (x1 + x2) / (dx13 * dx23);
42
double
c
= y1 -
a
* x1 * x1 -
b
* x1;
43
44
c
+= xm * (xm *
a
-
b
);
45
b
-= 2. * xm *
a
;
46
47
// std::cout<<"a,b,c= "<<a<<" "<<b<<" "<<c<<std::endl;
48
return
MnParabola
(
a
,
b
,
c
);
49
}
50
51
MnParabola
MnParabolaFactory::operator()
(
const
MnPoint
&p1,
double
dxdy1,
const
MnPoint
&p2)
const
52
{
53
// construct the parabola from 2 points + derivative at first point dxdy1
54
double
x1 = p1.
X
();
55
double
xx1 = x1 * x1;
56
double
x2 = p2.
X
();
57
double
xx2 = x2 * x2;
58
double
y1 = p1.
Y
();
59
double
y12 = p1.
Y
() - p2.
Y
();
60
61
double
det = xx1 - xx2 - 2. * x1 * (x1 - x2);
62
double
a
= -(y12 + (x2 - x1) * dxdy1) / det;
63
double
b
= -(-2. * x1 * y12 + (xx1 - xx2) * dxdy1) / det;
64
double
c
= y1 -
a
* xx1 -
b
* x1;
65
66
return
MnParabola
(
a
,
b
,
c
);
67
}
68
69
}
// namespace Minuit2
70
71
}
// namespace ROOT
MnParabolaFactory.h
MnParabola.h
MnPoint.h
b
#define b(i)
Definition
RSha256.hxx:100
c
#define c(i)
Definition
RSha256.hxx:101
a
#define a(i)
Definition
RSha256.hxx:99
ROOT::Minuit2::MnParabolaFactory::operator()
MnParabola operator()(const MnPoint &, const MnPoint &, const MnPoint &) const
Definition
MnParabolaFactory.cxx:18
ROOT::Minuit2::MnParabola
This class defines a parabola of the form a*x*x + b*x + c.
Definition
MnParabola.h:30
ROOT::Minuit2::MnPoint
A point in x-y.
Definition
MnPoint.h:28
ROOT::Minuit2::MnPoint::X
double X() const
Get the x (first) coordinate.
Definition
MnPoint.h:38
ROOT::Minuit2::MnPoint::Y
double Y() const
Get the y (second) coordinate.
Definition
MnPoint.h:41
ROOT::Minuit2
Definition
AnalyticalGradientCalculator.h:18
ROOT
Definition
EExecutionPolicy.hxx:4
math
minuit2
src
MnParabolaFactory.cxx
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1