#include <Utility.h>
Classes | |
class | Params |
Public Member Functions | |
void | add (const float &value_x, const float &value_y) |
void | add (const float &value_x, const float &value_y, const float &error_y) |
void | fit (Params &fit_params) |
LinearFit () | |
~LinearFit () | |
Private Attributes | |
std::vector< float > | e_ |
float | ss_ |
float | sx_ |
float | sy_ |
std::vector< float > | x_ |
std::vector< float > | y_ |
LinearFit::LinearFit | ( | ) |
void LinearFit::add | ( | const float & | value_x, |
const float & | value_y | ||
) |
Definition at line 17 of file Utility.cc.
References alignCSCRings::e, and mathSSE::sqrt().
Referenced by OptoScanAlgorithm::analyse().
void LinearFit::add | ( | const float & | value_x, |
const float & | value_y, | ||
const float & | error_y | ||
) |
void LinearFit::fit | ( | Params & | fit_params | ) |
Definition at line 47 of file Utility.cc.
References sistrip::LinearFit::Params::a_, b, sistrip::LinearFit::Params::b_, sistrip::LinearFit::Params::erra_, sistrip::LinearFit::Params::errb_, i, sistrip::LinearFit::Params::n_, indexGen::s2, mathSSE::sqrt(), and lumiQTWidget::t.
Referenced by OptoScanAlgorithm::analyse().
{ float s2 = 0.; float b = 0; for ( uint16_t i = 0; i < x_.size(); i++ ) { float t = ( x_[i] - sx_/ss_ ) / e_[i]; s2 += t*t; b += t * y_[i] / e_[i]; } // Set parameters params.n_ = x_.size(); params.b_ = b / s2; params.a_ = ( sy_ - sx_ * params.b_ ) / ss_; params.erra_ = sqrt( ( 1. + (sx_*sx_) / (ss_*s2) ) / ss_ ); params.errb_ = sqrt( 1. / s2 ); /* params.chi2_ = 0.; *q=1.0; if (mwt == 0) { for (i=1;i<=ndata;i++) *chi2 += SQR(y[i]-(*a)-(*b)*x[i]); sigdat=sqrt((*chi2)/(ndata-2)); *sigb *= sigdat; */ }
std::vector<float> sistrip::LinearFit::e_ [private] |
float sistrip::LinearFit::ss_ [private] |
float sistrip::LinearFit::sx_ [private] |
float sistrip::LinearFit::sy_ [private] |
std::vector<float> sistrip::LinearFit::x_ [private] |
std::vector<float> sistrip::LinearFit::y_ [private] |