CbmRoot
Loading...
Searching...
No Matches
CbmRichRingFitterBase.h
Go to the documentation of this file.
1/* Copyright (C) 2012 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer] */
4
14#ifndef CBM_RICH_RING_FITTER_BASE
15#define CBM_RICH_RING_FITTER_BASE
16
17#include "CbmRichRingLight.h"
28 public:
33
38
45 virtual void DoFit(CbmRichRingLight* ring) = 0;
46
47 protected:
52 virtual void CalcChi2(CbmRichRingLight* ring)
53 {
54 int nofHits = ring->GetNofHits();
55 if (nofHits < 4) {
56 ring->SetChi2(-1.);
57 return;
58 }
59
60 float chi2 = 0.;
61 float r = ring->GetRadius();
62 float xc = ring->GetCenterX();
63 float yc = ring->GetCenterY();
64
65 for (int i = 0; i < nofHits; i++) {
66 float xh = ring->GetHit(i).fX;
67 float yh = ring->GetHit(i).fY;
68 float d = r - sqrt((xc - xh) * (xc - xh) + (yc - yh) * (yc - yh));
69
70 chi2 += d * d;
71 }
72 ring->SetChi2(chi2);
73 }
74
75 static const int MAX_NOF_HITS_IN_RING = 400; // maximum possible number of hits
76};
77
78#endif
friend fvec sqrt(const fvec &a)
Abstract base class for concrete Rich Ring fitting algorithms. Each derived class must implement the ...
virtual ~CbmRichRingFitterBase()
Destructor.
static const int MAX_NOF_HITS_IN_RING
CbmRichRingFitterBase()
Default constructor.
virtual void DoFit(CbmRichRingLight *ring)=0
Abstract method DoFit. To be implemented in the concrete class. Perform a fit to the hits attached to...
virtual void CalcChi2(CbmRichRingLight *ring)
Calculate chi2 for circle fitting algorithms.
float GetCenterX() const
float GetRadius() const
float GetCenterY() const
int GetNofHits() const
Return number of hits in ring.
CbmRichHitLight GetHit(int ind)
Return hit by the index.
void SetChi2(float chi2)