EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichRingFitterBase.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichRingFitterBase.h
1 
10 #ifndef CBM_RICH_RING_FITTER_BASE
11 #define CBM_RICH_RING_FITTER_BASE
12 
13 #include "CbmRichRingLight.h"
24 {
25 public:
26 
31 
35  virtual ~CbmRichRingFitterBase() { }
36 
43  virtual void DoFit(
44  CbmRichRingLight* ring) = 0;
45 
46 protected:
47 
52  virtual void CalcChi2(
53  CbmRichRingLight* ring)
54  {
55  int nofHits = ring->GetNofHits();
56  if ( nofHits < 4 ) {
57  ring->SetChi2(-1.);
58  return;
59  }
60 
61  float chi2 = 0.;
62  float r = ring->GetRadius();
63  float xc = ring->GetCenterX();
64  float yc = ring->GetCenterY();
65 
66  for (int i = 0; i < nofHits; i++) {
67  float xh = ring->GetHit(i).fX;
68  float yh = ring->GetHit(i).fY;
69  float d = r - sqrt((xc - xh)*(xc - xh) + (yc - yh)*(yc - yh));
70 
71  chi2 += d*d;
72  }
73  ring->SetChi2(chi2);
74  }
75 
76  static const int MAX_NOF_HITS_IN_RING = 400; // maximum possible number of hits
77 };
78 
79 #endif