CbmRoot
CbmRichRingFitterBase.h
Go to the documentation of this file.
1 
10 #ifndef CBM_RICH_RING_FITTER_BASE
11 #define CBM_RICH_RING_FITTER_BASE
12 
13 #include "CbmRichRingLight.h"
24 public:
29 
34 
41  virtual void DoFit(CbmRichRingLight* ring) = 0;
42 
43 protected:
48  virtual void CalcChi2(CbmRichRingLight* ring) {
49  int nofHits = ring->GetNofHits();
50  if (nofHits < 4) {
51  ring->SetChi2(-1.);
52  return;
53  }
54 
55  float chi2 = 0.;
56  float r = ring->GetRadius();
57  float xc = ring->GetCenterX();
58  float yc = ring->GetCenterY();
59 
60  for (int i = 0; i < nofHits; i++) {
61  float xh = ring->GetHit(i).fX;
62  float yh = ring->GetHit(i).fY;
63  float d = r - sqrt((xc - xh) * (xc - xh) + (yc - yh) * (yc - yh));
64 
65  chi2 += d * d;
66  }
67  ring->SetChi2(chi2);
68  }
69 
70  static const int MAX_NOF_HITS_IN_RING =
71  400; // maximum possible number of hits
72 };
73 
74 #endif
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmRichHitLight::fX
float fX
Definition: CbmRichRingLight.h:34
CbmRichRingFitterBase::DoFit
virtual void DoFit(CbmRichRingLight *ring)=0
Abstract method DoFit. To be implemented in the concrete class. Perform a fit to the hits attached to...
CbmRichRingFitterBase::~CbmRichRingFitterBase
virtual ~CbmRichRingFitterBase()
Destructor.
Definition: CbmRichRingFitterBase.h:33
CbmRichRingFitterBase::CalcChi2
virtual void CalcChi2(CbmRichRingLight *ring)
Calculate chi2 for circle fitting algorithms.
Definition: CbmRichRingFitterBase.h:48
CbmRichRingLight::GetNofHits
int GetNofHits() const
Return number of hits in ring.
Definition: CbmRichRingLight.h:108
d
double d
Definition: P4_F64vec2.h:24
CbmRichRingLight::GetCenterY
float GetCenterY() const
Definition: CbmRichRingLight.h:160
CbmRichRingLight.h
CbmRichRingLight::GetRadius
float GetRadius() const
Definition: CbmRichRingLight.h:161
CbmRichRingFitterBase
Abstract base class for concrete Rich Ring fitting algorithms. Each derived class must implement the ...
Definition: CbmRichRingFitterBase.h:23
CbmRichRingFitterBase::MAX_NOF_HITS_IN_RING
static const int MAX_NOF_HITS_IN_RING
Definition: CbmRichRingFitterBase.h:70
CbmRichRingFitterBase::CbmRichRingFitterBase
CbmRichRingFitterBase()
Default constructor.
Definition: CbmRichRingFitterBase.h:28
CbmRichHitLight::fY
float fY
Definition: CbmRichRingLight.h:35
CbmRichRingLight::GetHit
CbmRichHitLight GetHit(int ind)
Return hit by the index.
Definition: CbmRichRingLight.h:114
CbmRichRingLight::GetCenterX
float GetCenterX() const
Definition: CbmRichRingLight.h:159
CbmRichRingLight::SetChi2
void SetChi2(float chi2)
Definition: CbmRichRingLight.h:154
CbmRichRingLight
Definition: CbmRichRingLight.h:39