10 #include "Minuit2/Minuit2Minimizer.h"
12 #include "FairLogger.h"
25 ring->
SetXYABP(-1., -1., -1., -1., -1.);
34 for (
int i = 0;
i < nofHits;
i++) {
39 vector<double> fpar =
DoFit(hitX, hitY);
48 const vector<double>& fpar) {
50 double xc = (fpar[0] + fpar[2]) / 2.;
51 double yc = (fpar[1] + fpar[3]) / 2.;
53 double p1 = (fpar[0] - fpar[2]) * (fpar[0] - fpar[2])
54 + (fpar[1] - fpar[3]) * (fpar[1] - fpar[3]);
56 ring->
SetXYABP(-1., -1., -1., -1., -1.);
61 double c =
sqrt(p1) / 2.;
62 double p2 = fpar[4] * fpar[4] - c * c;
64 ring->
SetXYABP(-1., -1., -1., -1., -1.);
70 double p3 = fpar[2] - fpar[0];
72 ring->
SetXYABP(-1., -1., -1., -1., -1.);
76 double k = (fpar[3] - fpar[1]) / (fpar[2] - fpar[0]);
79 ring->
SetXYABP(xc, yc, fpar[4], b, ang);
84 const vector<double>&
y) {
89 for (
unsigned int i = 0;
i <
x.size();
i++) {
94 xf1 = xf1 /
x.size() - a;
100 ROOT::Minuit2::Minuit2Minimizer
min;
105 min.SetMaxFunctionCalls(1000000);
106 min.SetMaxIterations(100000);
107 min.SetTolerance(0.001);
109 min.SetFunction(*theFCN);
112 min.SetVariable(0,
"xf1", xf1, 0.1);
113 min.SetVariable(1,
"yf1", yf1, 0.1);
114 min.SetVariable(2,
"xf2", xf2, 0.1);
115 min.SetVariable(3,
"yf2", yf2, 0.1);
116 min.SetVariable(4,
"a", a, 0.1);
120 const double* xs =
min.X();
124 for (
int i = 0;
i < 5;
i++) {
125 fpar.push_back(xs[
i]);