~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/common_cpp/Recon/SciFi/LeastSquaresFitter.hh

  • Committer: Durga Rajaram
  • Date: 2014-07-16 15:13:05 UTC
  • mfrom: (659.1.92 cand)
  • Revision ID: durga@fnal.gov-20140716151305-q27rv1y9p03v9lks
Tags: MAUS-v0.9, MAUS-v0.9.0
MAUS-v0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
/** @class LeastSquaresFitter
19
19
 *
20
20
 * Least Squares Fitting algorithms encapsulated in a class
 
21
 * NOTE: It advisable to always call LoadGlobals() before performing circle fit
21
22
 *
22
23
 */
23
24
 
32
33
#include "src/common_cpp/Recon/SciFi/SimpleCircle.hh"
33
34
#include "src/common_cpp/DataStructure/SciFiStraightPRTrack.hh"
34
35
 
35
 
namespace MAUS {
36
 
 
37
 
class LeastSquaresFitter {
38
 
  public:
39
 
 
40
 
    /** @brief Default constructor
41
 
     */
42
 
    LeastSquaresFitter(double sd_1to4, double sd_5, double R_res_cut);
43
 
 
44
 
    /** @brief Default destructor, does nothing
45
 
     */
46
 
    ~LeastSquaresFitter();
47
 
 
48
 
    /** @brief Set the member variables using the Global singleton class */
49
 
    bool LoadGlobals();
50
 
 
51
 
    /** @brief Least-squares straight line fit
52
 
     *
53
 
     *  Fit straight lines, using linear least squares fitting,
54
 
     *  for input spacepoints. Output is a line.
55
 
     *
56
 
     *  @param spnts - A vector of all the input spacepoints
57
 
     *  @param line_x - Output line in x - z plane
58
 
     *  @param line_y - Output line in y - z plane
59
 
     *
60
 
     */
61
 
    void linear_fit(const std::vector<double> &_x, const std::vector<double> &_y,
62
 
                    const std::vector<double> &_y_err, SimpleLine &line);
63
 
 
64
 
    /** @brief Fit a circle to spacepoints in x-y projection
65
 
     *
66
 
     *  Fit a circle of the form A*(x^2 + y^2) + b*x + c*y = 1 with least squares fit
67
 
     *  for input spacepoints. Output is a circle in the x-y projection.
68
 
     *
69
 
     *  @param spnts - A vector containing the input spacepoints
70
 
     *  @param circle - The output circle fit
71
 
     *
72
 
     */
73
 
    bool circle_fit(const std::vector<SciFiSpacePoint*> &spnts, SimpleCircle &circle);
74
 
 
75
 
    /** Set the resolution of stations 1 - 4 */
76
 
    void set_sd_1to4(double sd_1to4) { _sd_1to4 = sd_1to4; }
77
 
 
78
 
    /** Get the resolution of stations 1 - 4  */
79
 
    double get_sd_1to4() const { return _sd_1to4; }
80
 
 
81
 
    /** Set the resolution of station 5 */
82
 
    void set_sd_5(double sd_5) { _sd_5 = sd_5; }
83
 
 
84
 
    /** Get the resolution of station 5 */
85
 
    double get_sd_5() const { return _sd_5; }
86
 
 
87
 
    /** Set the helix radius cut */
88
 
    void set_R_res_cut(double R_res_cut) { _R_res_cut = R_res_cut; }
89
 
 
90
 
    /** Get the helix radius cut */
91
 
    double get_R_res_cut() const { return _R_res_cut; }
92
 
 
93
 
 
94
 
  private:
95
 
    double _sd_1to4;     /** Position error associated with stations 1 t0 4 */
96
 
    double _sd_5;        /** Position error associated with station 5 */
97
 
    double _R_res_cut;   /** Road cut for circle radius in mm */
98
 
};
99
 
 
100
 
} // ~namespace MAUS
 
36
namespace LeastSquaresFitter {
 
37
 
 
38
  /** @brief Least-squares straight line fit
 
39
    *
 
40
    *  Fit straight lines, using linear least squares fitting,
 
41
    *  for input spacepoints. Output is a line.
 
42
    *
 
43
    *  @param spnts - A vector of all the input spacepoints
 
44
    *  @param line_x - Output line in x - z plane
 
45
    *  @param line_y - Output line in y - z plane
 
46
    *
 
47
    */
 
48
  void linear_fit(const std::vector<double> &_x, const std::vector<double> &_y,
 
49
                  const std::vector<double> &_y_err, MAUS::SimpleLine &line);
 
50
 
 
51
  /** @brief Fit a circle to spacepoints in x-y projection
 
52
    *
 
53
    *  Fit a circle of the form A*(x^2 + y^2) + b*x + c*y = 1 with least squares fit
 
54
    *  for input spacepoints. Output is a circle in the x-y projection.
 
55
    *
 
56
    *  @param spnts - A vector containing the input spacepoints
 
57
    *  @param circle - The output circle fit
 
58
    *  @param sd_1to4 - Position error associated with stations 1 to 4
 
59
    *  @param sd_5 - Position error associated with stations 5
 
60
    *  @param R_res_cut - Road cut for circle radius in mm
 
61
    *
 
62
    */
 
63
  bool circle_fit(const double sd_1to4, const double sd_5, const double R_res_cut,
 
64
                  const std::vector<MAUS::SciFiSpacePoint*> &spnts, MAUS::SimpleCircle &circle);
 
65
 
 
66
} // ~namespace LeastSquaresFitter
101
67
 
102
68
#endif