CbmRoot
Loading...
Searching...
No Matches
CbmRichRingFitterEllipseMinuit.h
Go to the documentation of this file.
1/* Copyright (C) 2011-2015 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer], Florian Uhlig */
4
13#ifndef CBM_RICH_RING_FITTER_ELLIPSE_MINUIT
14#define CBM_RICH_RING_FITTER_ELLIPSE_MINUIT
15
17#include "Math/IFunction.h"
18#include "Rtypes.h"
19
20#include <vector>
21
22using std::vector;
23
24class FCNEllipse2 : public ROOT::Math::IBaseFunctionMultiDim {
25 private:
26 vector<Double_t> fX; // vector of X coordinates
27 vector<Double_t> fY; // vector of Y coordinates
28 public:
29 FCNEllipse2(vector<Double_t> x, vector<Double_t> y) : ROOT::Math::IBaseFunctionMultiDim(), fX(x), fY(y) {}
30
31 double DoEval(const double* x) const
32 {
33 Double_t r = 0.;
34 for (UInt_t i = 0; i < fX.size(); i++) {
35 Double_t ri = calcE(i, x);
36 r += ri * ri;
37 }
38 return r;
39 }
40
41 Double_t calcE(Int_t i, const double* par) const
42 {
43 Double_t d1 = sqrt((fX[i] - par[0]) * (fX[i] - par[0]) + (fY[i] - par[1]) * (fY[i] - par[1]));
44 Double_t d2 = sqrt((fX[i] - par[2]) * (fX[i] - par[2]) + (fY[i] - par[3]) * (fY[i] - par[3]));
45 Double_t ri = d1 + d2 - 2 * par[4];
46 return ri;
47 }
48
49 unsigned int NDim() const { return 5; }
50
51 ROOT::Math::IBaseFunctionMultiDim* Clone() const { return new FCNEllipse2(fX, fY); }
52};
53
54
63 public:
68
73
77 virtual void DoFit(CbmRichRingLight* ring);
78
79 private:
86 vector<double> DoFit(const vector<double>& x, const vector<double>& y);
87
93 void TransformToRichRing(CbmRichRingLight* ring, const vector<double>& par);
94};
95
96#endif
Base class for concrete ellipse fitting algorithms. Each derived class must implement the method DoFi...
friend fvec sqrt(const fvec &a)
Base class for concrete ellipse fitting algorithms. Each derived class must implement the method DoFi...
This is the implementation of ellipse fitting using MINUIT.
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
virtual ~CbmRichRingFitterEllipseMinuit()
Standard destructor.
void TransformToRichRing(CbmRichRingLight *ring, const vector< double > &par)
Transform obtained parameters from MINUIT to CbmRichRingLight.
ROOT::Math::IBaseFunctionMultiDim * Clone() const
FCNEllipse2(vector< Double_t > x, vector< Double_t > y)
Double_t calcE(Int_t i, const double *par) const
unsigned int NDim() const
double DoEval(const double *x) const