CMS 3D CMS Logo

ParabolaFit.h
Go to the documentation of this file.
1 #ifndef RecoTracker_PixelTrackFitting_src_ParabolaFit_h
2 #define RecoTracker_PixelTrackFitting_src_ParabolaFit_h
3 
4 #include <vector>
5 
11 class ParabolaFit {
12 public:
13  struct Result {
14  double parA, parB, parC;
16  };
18 
19  void addPoint(double x, double y);
20  void addPoint(double x, double y, double weight);
21 
23  void fixParC(double val) {
24  hasFixedParC = true;
25  theResult.parC = val;
26  }
27 
28  const Result& result(bool doErrors) const;
29 
30  double parA() const {
31  if (!hasValues)
32  result(doErr);
33  return theResult.parA;
34  }
35  double parB() const {
36  if (!hasValues)
37  result(doErr);
38  return theResult.parB;
39  }
40  double parC() const {
41  if (!hasValues)
42  result(doErr);
43  return theResult.parC;
44  }
45  double varAA() const {
46  if (!hasErrors)
47  result(true);
48  return theResult.varAA;
49  }
50  double varBB() const {
51  if (!hasErrors)
52  result(true);
53  return theResult.varBB;
54  }
55  double varCC() const {
56  if (!hasErrors)
57  result(true);
58  return theResult.varCC;
59  }
60  double varAB() const {
61  if (!hasErrors)
62  result(true);
63  return theResult.varAB;
64  }
65  double varAC() const {
66  if (!hasErrors)
67  result(true);
68  return theResult.varAC;
69  }
70  double varBC() const {
71  if (!hasErrors)
72  result(true);
73  return theResult.varBC;
74  }
75 
76  double chi2() const;
77  int dof() const;
78 
79 private:
80  struct Column {
81  double r1;
82  double r2;
83  double r3;
84  };
85  double det(const Column& c1, const Column& c2, const Column& c3) const;
86  double det(const Column& c1, const Column& c2) const;
87 
88  double fun(double x) const;
89 
90 private:
91  struct Point {
92  double x;
93  double y;
94  mutable double w;
95  };
96  std::vector<Point> points;
98  mutable bool hasValues, hasErrors;
99  bool hasWeights;
100  mutable Result theResult;
101 };
102 
103 #endif
double chi2() const
Definition: ParabolaFit.cc:111
bool hasValues
Definition: ParabolaFit.h:98
double parB() const
Definition: ParabolaFit.h:35
bool hasFixedParC
Definition: ParabolaFit.h:97
int dof() const
Definition: ParabolaFit.cc:121
Definition: weight.py:1
double fun(double x) const
Definition: ParabolaFit.cc:119
std::vector< Point > points
Definition: ParabolaFit.h:96
double varAA() const
Definition: ParabolaFit.h:45
double varAC() const
Definition: ParabolaFit.h:65
double varBC() const
Definition: ParabolaFit.h:70
double parA() const
Definition: ParabolaFit.h:30
void skipErrorCalculationByDefault()
Definition: ParabolaFit.h:22
bool hasErrors
Definition: ParabolaFit.h:98
void addPoint(double x, double y)
Definition: ParabolaFit.cc:9
double varBB() const
Definition: ParabolaFit.h:50
void fixParC(double val)
Definition: ParabolaFit.h:23
double det(const Column &c1, const Column &c2, const Column &c3) const
Definition: ParabolaFit.cc:129
double varAB() const
Definition: ParabolaFit.h:60
double parC() const
Definition: ParabolaFit.h:40
bool hasWeights
Definition: ParabolaFit.h:99
double varCC() const
Definition: ParabolaFit.h:55
const Result & result(bool doErrors) const
Definition: ParabolaFit.cc:21
Result theResult
Definition: ParabolaFit.h:100