32
33
#include "src/common_cpp/Recon/SciFi/SimpleCircle.hh"
33
34
#include "src/common_cpp/DataStructure/SciFiStraightPRTrack.hh"
37
class LeastSquaresFitter {
40
/** @brief Default constructor
42
LeastSquaresFitter(double sd_1to4, double sd_5, double R_res_cut);
44
/** @brief Default destructor, does nothing
46
~LeastSquaresFitter();
48
/** @brief Set the member variables using the Global singleton class */
51
/** @brief Least-squares straight line fit
53
* Fit straight lines, using linear least squares fitting,
54
* for input spacepoints. Output is a line.
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
61
void linear_fit(const std::vector<double> &_x, const std::vector<double> &_y,
62
const std::vector<double> &_y_err, SimpleLine &line);
64
/** @brief Fit a circle to spacepoints in x-y projection
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.
69
* @param spnts - A vector containing the input spacepoints
70
* @param circle - The output circle fit
73
bool circle_fit(const std::vector<SciFiSpacePoint*> &spnts, SimpleCircle &circle);
75
/** Set the resolution of stations 1 - 4 */
76
void set_sd_1to4(double sd_1to4) { _sd_1to4 = sd_1to4; }
78
/** Get the resolution of stations 1 - 4 */
79
double get_sd_1to4() const { return _sd_1to4; }
81
/** Set the resolution of station 5 */
82
void set_sd_5(double sd_5) { _sd_5 = sd_5; }
84
/** Get the resolution of station 5 */
85
double get_sd_5() const { return _sd_5; }
87
/** Set the helix radius cut */
88
void set_R_res_cut(double R_res_cut) { _R_res_cut = R_res_cut; }
90
/** Get the helix radius cut */
91
double get_R_res_cut() const { return _R_res_cut; }
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 */
36
namespace LeastSquaresFitter {
38
/** @brief Least-squares straight line fit
40
* Fit straight lines, using linear least squares fitting,
41
* for input spacepoints. Output is a line.
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
48
void linear_fit(const std::vector<double> &_x, const std::vector<double> &_y,
49
const std::vector<double> &_y_err, MAUS::SimpleLine &line);
51
/** @brief Fit a circle to spacepoints in x-y projection
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.
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
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);
66
} // ~namespace LeastSquaresFitter