CbmRoot
CbmRichRingFitterEllipseMinuit.h
Go to the documentation of this file.
1 
9 #ifndef CBM_RICH_RING_FITTER_ELLIPSE_MINUIT
10 #define CBM_RICH_RING_FITTER_ELLIPSE_MINUIT
11 
13 
14 #include "Math/IFunction.h"
15 #include "Rtypes.h"
16 
17 #include <vector>
18 
19 using std::vector;
20 
21 class FCNEllipse2 : public ROOT::Math::IBaseFunctionMultiDim {
22 private:
23  vector<Double_t> fX; // vector of X coordinates
24  vector<Double_t> fY; // vector of Y coordinates
25 public:
26  FCNEllipse2(vector<Double_t> x, vector<Double_t> y)
27  : ROOT::Math::IBaseFunctionMultiDim(), fX(x), fY(y) {}
28 
29  double DoEval(const double* x) const {
30  Double_t r = 0.;
31  for (UInt_t i = 0; i < fX.size(); i++) {
32  Double_t ri = calcE(i, x);
33  r += ri * ri;
34  }
35  return r;
36  }
37 
38  Double_t calcE(Int_t i, const double* par) const {
39  Double_t d1 = sqrt((fX[i] - par[0]) * (fX[i] - par[0])
40  + (fY[i] - par[1]) * (fY[i] - par[1]));
41  Double_t d2 = sqrt((fX[i] - par[2]) * (fX[i] - par[2])
42  + (fY[i] - par[3]) * (fY[i] - par[3]));
43  Double_t ri = d1 + d2 - 2 * par[4];
44  return ri;
45  }
46 
47  unsigned int NDim() const { return 5; }
48 
49  ROOT::Math::IBaseFunctionMultiDim* Clone() const {
50  return new FCNEllipse2(fX, fY);
51  }
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
CbmRichRingFitterEllipseBase.h
Base class for concrete ellipse fitting algorithms. Each derived class must implement the method DoFi...
CbmRichRingFitterEllipseMinuit::TransformToRichRing
void TransformToRichRing(CbmRichRingLight *ring, const vector< double > &par)
Transform obtained parameters from MINUIT to CbmRichRingLight.
Definition: CbmRichRingFitterEllipseMinuit.cxx:46
CbmRichRingFitterEllipseMinuit::~CbmRichRingFitterEllipseMinuit
virtual ~CbmRichRingFitterEllipseMinuit()
Standard destructor.
Definition: CbmRichRingFitterEllipseMinuit.cxx:19
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmRichRingFitterEllipseBase
Base class for concrete ellipse fitting algorithms. Each derived class must implement the method DoFi...
Definition: CbmRichRingFitterEllipseBase.h:25
FCNEllipse2::NDim
unsigned int NDim() const
Definition: CbmRichRingFitterEllipseMinuit.h:47
CbmRichRingFitterEllipseMinuit::DoFit
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
Definition: CbmRichRingFitterEllipseMinuit.cxx:21
CbmRichRingFitterEllipseMinuit::CbmRichRingFitterEllipseMinuit
CbmRichRingFitterEllipseMinuit()
Default constructor.
Definition: CbmRichRingFitterEllipseMinuit.cxx:17
FCNEllipse2::DoEval
double DoEval(const double *x) const
Definition: CbmRichRingFitterEllipseMinuit.h:29
FCNEllipse2::calcE
Double_t calcE(Int_t i, const double *par) const
Definition: CbmRichRingFitterEllipseMinuit.h:38
FCNEllipse2::FCNEllipse2
FCNEllipse2(vector< Double_t > x, vector< Double_t > y)
Definition: CbmRichRingFitterEllipseMinuit.h:26
FCNEllipse2::fX
vector< Double_t > fX
Definition: CbmRichRingFitterEllipseMinuit.h:23
CbmRichRingFitterEllipseMinuit
This is the implementation of ellipse fitting using MINUIT.
Definition: CbmRichRingFitterEllipseMinuit.h:62
FCNEllipse2::fY
vector< Double_t > fY
Definition: CbmRichRingFitterEllipseMinuit.h:24
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
FCNEllipse2
Definition: CbmRichRingFitterEllipseMinuit.h:21
FCNEllipse2::Clone
ROOT::Math::IBaseFunctionMultiDim * Clone() const
Definition: CbmRichRingFitterEllipseMinuit.h:49
CbmRichRingLight
Definition: CbmRichRingLight.h:39