81 cout<<
"BAD part id from MucRecLineFit"<<endl;
89 for(
int i = 0; i <
n; i++){
101 for(
int i = 0; i <
n; i++){
114 *siga = 1/c/c * sigc;
119 if(seg == 0||seg == 4){
121 for(
int i = 0; i <
n; i++){
126 else if(seg == 2||seg == 6){
128 for(
int i = 0; i <
n; i++){
135 *siga = 1/c/c * sigc;
140 for(
int i = 0; i <
n; i++){
141 float temp = (
y[i] +
x[i])/sqrt(2.0);
142 y[i] = (
y[i] -
x[i])/sqrt(2.0);
146 if(seg == 1 || seg == 5){
147 for(
int i = 0; i <
n; i++){
153 else if(seg == 3 || seg == 7){
154 for(
int i = 0; i <
n; i++){
187 double sum, sx, sy, sxx, sxy, syy, det;
200 cout <<
"utiLineFit-W: Too few points for line fit \n" << endl;
213 for (i = 0; i <
n; i++)
217 sx = sx +
w[i] *
x[i];
218 sy = sy +
w[i] *
y[i];
219 sxx = sxx +
w[i] *
x[i] *
x[i];
220 sxy = sxy +
w[i] *
x[i] *
y[i];
221 syy = syy +
w[i] *
y[i] *
y[i];
225 if (fabs(det) < 1.0e-20)
237 *a = (sum*sxy-sx*sy)/det;
238 *
b = (sy*sxx-sxy*sx)/det;
245 chi = chi+(
w[i])*((
y[i])-*a*(
x[i])-*
b)*
246 ((
y[i])-*a*(
x[i])-*
b);
249 *siga = sqrt(fabs(sum/det));
250 *sigb = sqrt(fabs(sxx/det));
HepPoint3D GetCenter() const
Get gap center position in global coordinate.
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
MucRecLineFit()
Constructor.
~MucRecLineFit()
Destructor.
int LineFit(float x[], float y[], float w[], int n, float *a, float *b, float *chisq, float *siga, float *sigb)