203 double m_2pi = 2.0 *
M_PI;
207 std::cout <<
"in MdcxFittedHel::DoFit() nfree = " <<
nfree
208 <<
" nhits = " <<
nhits << std::endl;
212 double A[10][10] = {{0.}}, B[10] = {0.}, D[10] = {0.}, det;
216 std::cout <<
"xHitList.length " <<
xHitList.length() <<
" ";
217 for (
int ii = 0; ii <
xHitList.length(); ii++) {
220 std::cout << std::endl <<
"sfac = " <<
sfac << std::endl;
223 for (
int i = 0; i <
nhits; i++) {
224 std::vector<float> derivs =
xHitList[i]->derivatives(*
this);
226 cout <<
"derivs " << i<<
" ";
227 for (
unsigned int ii = 0; ii < derivs.size(); ii++) {
228 cout << setw(15)<< derivs[ii];
230 std::cout << std::endl;
233 for(
unsigned int ipar = 0; ipar < derivs.size(); ipar++) {
234 derivs[ipar] /=
sfac;
235 if(6 ==
debug) cout <<
" derivs[" << ipar <<
"] = " << derivs[ipar];
237 if(6 ==
debug) std::cout << std::endl;
239 chisq += derivs[0] * derivs[0];
241 for (
int ipar = 0; ipar < norder; ipar++) {
242 D[ipar] += derivs[0] * derivs[ipar+1];
244 for(
int jpar = 0; jpar < norder; jpar++) {
245 A[ipar][jpar] += derivs[ipar+1] * derivs[jpar+1];
249 if (6 ==
debug) cout <<
"chisq = " <<
chisq << endl;
255 for (
int ii = 0; ii < norder; ii++) {
256 cout <<
"D["<< ii <<
"]: " << D[ii] <<
" A:";
257 for (
int jj = 0; jj < norder; jj++) cout <<
" " << A[ii][jj];
268 cout <<
"chisq " <<
chisq <<
" ndof " << ndof
269 <<
" chiperdof " <<
chisq/ndof
270 <<
" >?chidofbail " << chidofbail << endl;
272 float chiperdof =
chisq/ndof;
273 if(chiperdof > chidofbail)
return ftemp;
276 cout <<
" ndof <=0 : chisq " <<
chisq
277 <<
" >? chidofbail/2.5 " << chidofbail/2.5 << endl;
279 if (
chisq > chidofbail/2.5)
return ftemp;
284 if (6 ==
debug) cout <<
"ierr = " << ierr << endl;
286 for(
int ii = 0; ii < norder; ii++)
287 for(
int jj = 0; jj < norder; jj++)
288 B[ii] += A[ii][jj] * D[jj];
290 for (
int ii = 0; ii < norder; ii++) {
291 cout <<
"B[" << ii <<
"]: " << B[ii] <<
" A:";
292 for (
int jj = 0; jj < norder; jj++) cout <<
" " << A[ii][jj];
297 if (
qd0)
d0 -= B[++bump];
308 if (
qz0)
z0 -= B[++bump];
310 if (
qt0)
t0 -= B[++bump];
315 if ( fabs(
omega) > 10.0 ) ftemp = 1306;