#include <MdcxSeg.h>
Inheritance diagram for MdcxSeg:
Public Member Functions | |
float | Chisq () const |
float | Chisq () const |
int | Code () const |
int | Code () const |
double | CosPhi0 () const |
double | CosPhi0 () const |
double | D0 () const |
double | D0 () const |
double | D0_sl_approx () |
double | D0_sl_approx () |
std::vector< float > | derivatives (const MdcxHit &h) |
std::vector< float > | derivatives (const MdcxHit &h) |
double | Doca (const MdcxHit &h) |
double | Doca (double WX, double WY, double WZ, double X, double Y, double Z=0.0) |
double | Doca (const MdcxHit &h) |
double | Doca (double WX, double WY, double WZ, double X, double Y, double Z=0.0) |
double | Doca_Eang () const |
double | Doca_Eang () const |
double | Doca_FLen () const |
double | Doca_FLen () const |
double | Doca_Len () const |
double | Doca_Len () const |
int | Doca_Samb () const |
int | Doca_Samb () const |
double | Doca_Tof () const |
double | Doca_Tof () const |
int | Doca_Wamb () const |
int | Doca_Wamb () const |
double | Doca_Zh () const |
double | Doca_Zh () const |
int | Fail (float Probmin=0.0) const |
int | Fail (float Probmin=0.0) const |
int | FitPrint (MdcxHel &hel, std::ostream &o) |
int | FitPrint () |
int | FitPrint (MdcxHel &hel, std::ostream &o) |
int | FitPrint () |
float | Fittime () const |
float | Fittime () const |
void | flip () |
void | flip () |
int | GetTurnFlag () const |
int | GetTurnFlag () const |
int | GetUsedOnHel () const |
int | GetUsedOnHel () const |
MdcxFittedHel & | Grow (const MdcxFittedHel &, const HepAList< MdcxHit > &) |
MdcxFittedHel & | Grow (const MdcxFittedHel &, const HepAList< MdcxHit > &) |
int | Itofit () const |
int | Itofit () const |
int | Layer (int hitno=0) const |
int | Layer (int hitno=0) const |
double | Lmax () const |
double | Lmax () const |
MdcxSeg (MdcxFittedHel &hel, int p, int a) | |
MdcxSeg (MdcxFittedHel &hel, int p, int a) | |
int | Mode () const |
int | Mode () const |
int | Nfree () const |
int | Nfree () const |
int | Nhits () const |
int | Nhits () const |
double | Omega () const |
double | Omega () const |
double | Omin () const |
double | Omin () const |
int | Ominfl () const |
int | Ominfl () const |
int | Origin () const |
int | Origin () const |
int | Pat () |
int | Pat () |
double | Phi0 () const |
double | Phi0 () const |
double | Phi0_sl_approx () |
double | Phi0_sl_approx () |
void | print () const |
void | print () const |
void | printSeg () |
void | printSeg () |
void | printSegAll () |
void | printSegAll () |
float | Prob () const |
float | Prob () const |
double | Ptot (double l=0.0) const |
double | Ptot (double l=0.0) const |
float | Pull (int i) |
float | Pull (int i) |
double | Px (double l=0.0) const |
double | Px (double l=0.0) const |
double | Py (double l=0.0) const |
double | Py (double l=0.0) const |
double | Pz (double l=0.0) const |
double | Pz (double l=0.0) const |
int | Qd0 () const |
int | Qd0 () const |
int | Qomega () const |
int | Qomega () const |
int | Qphi0 () const |
int | Qphi0 () const |
int | Qt0 () const |
int | Qt0 () const |
int | Qtanl () const |
int | Qtanl () const |
int | Quality () const |
int | Quality () const |
int | Qz0 () const |
int | Qz0 () const |
float | Rcs () const |
float | Rcs () const |
int | ReFit () |
int | ReFit () |
float | Residual (int i) |
float | Residual (int i) |
void | SetBailOut (int i) |
void | SetBailOut (int i) |
void | SetChiDofBail (float r) |
void | SetChiDofBail (float r) |
void | SetD0 (int n) |
void | SetD0 (int n) |
void | SetMode (int n) |
void | SetMode (int n) |
void | SetNiter (int i) |
void | SetNiter (int i) |
void | SetOmega (int n) |
void | SetOmega (int n) |
void | SetPhi0 (int n) |
void | SetPhi0 (int n) |
void | SetQuality (const int &q) |
void | SetQuality (const int &q) |
void | SetRef (double x, double y) |
void | SetRef (double x, double y) |
void | SetT0 (int n) |
void | SetT0 (int n) |
void | SetTanl (int n) |
void | SetTanl (int n) |
void | SetTurnFlag (const int &i) |
void | SetTurnFlag (const int &i) |
void | SetUsedOnHel (const int &i) |
void | SetUsedOnHel (const int &i) |
void | SetZ0 (int n) |
void | SetZ0 (int n) |
double | Sfac () const |
double | Sfac () const |
double | SinPhi0 () const |
double | SinPhi0 () const |
int | SuperLayer (int hitno=0) const |
int | SuperLayer (int hitno=0) const |
double | T0 () const |
double | T0 () const |
double | Tanl () const |
double | Tanl () const |
void | VaryRes () |
void | VaryRes () |
double | X () const |
double | X () const |
double | X0 () const |
double | X0 () const |
double | Xc () const |
double | Xc () const |
double | Xh (double l) const |
double | Xh (double l) const |
const HepAList< MdcxHit > & | XHitList () const |
const HepAList< MdcxHit > & | XHitList () const |
double | Xline_bbrrf () |
double | Xline_bbrrf () |
double | Xline_slope () |
double | Xline_slope () |
double | Xref () const |
double | Xref () const |
double | Y () const |
double | Y () const |
double | Y0 () const |
double | Y0 () const |
double | Yc () const |
double | Yc () const |
double | Yh (double l) const |
double | Yh (double l) const |
double | Yline_bbrrf () |
double | Yline_bbrrf () |
double | Yline_slope () |
double | Yline_slope () |
double | Yref () const |
double | Yref () const |
double | Z0 () const |
double | Z0 () const |
double | Zh (double l) const |
double | Zh (double l) const |
virtual | ~MdcxSeg () |
virtual | ~MdcxSeg () |
Static Public Attributes | |
int | debug = 0 |
Protected Member Functions | |
double | CalcPhi (double xf, double yf, double xl, double yl) const |
double | CalcPhi (double xf, double yf, double xl, double yl) const |
void | copy (const MdcxHel &hel) |
void | copy (const MdcxHel &hel) |
void | decode (const int i, int &i1, int &i2, int &i3, int &i4, int &i5, int &i6, int &n) |
void | decode (const int i, int &i1, int &i2, int &i3, int &i4, int &i5, int &i6, int &n) |
int | deltaq (int i, int j) const |
int | deltaq (int i, int j) const |
int | DoFit () |
int | DoFit () |
int | IterateFit () |
int | IterateFit () |
Protected Attributes | |
float | chisq |
int | code |
double | cosl |
double | cphi0 |
double | d0 |
Hep3Vector | dvec |
double | eang |
double | f0 |
int | fail |
float | fittime |
int | itofit |
double | len |
int | mode |
int | nfree |
int | nhits |
double | omega |
double | omin |
int | ominfl |
int | origin |
double | phi |
double | phi0 |
float | prob |
int | qd0 |
int | qomega |
int | qphi0 |
int | qt0 |
int | qtanl |
int | quality |
int | qz0 |
float | rcs |
int | samb |
double | sfac |
double | sinl |
double | sphi0 |
double | t0 |
double | tanl |
int | turnflag |
Hep3Vector | tvec |
double | tx |
double | ty |
double | tz |
int | usedonhel |
Hep3Vector | vhat |
double | vx |
double | vy |
double | vz |
int | wamb |
Hep3Vector | wvec |
double | x0 |
double | xc |
double | xh |
HepAList< MdcxHit > | xHitList |
HepAList< MdcxHit > | xHitList |
double | xref |
double | y0 |
double | yc |
double | yh |
double | yref |
double | z0 |
double | zh |
Private Attributes | |
int | amb |
double | c1 |
double | c2 |
int | pat |
|
00003 :MdcxFittedHel(hel){ 00004 pat=p; amb=a; 00005 // c1=-0.686; c2=1.74; 00006 c1=-0.77; c2=1.83; 00007 if ((pat == 0x2244) || (pat == 0x4221)) { 00008 c1 = -1.13; 00009 c2 = 2.26; 00010 } 00011 if ((pat == 0x1244) || (pat == 0x8421) || (pat == 0x8221)) { 00012 c1 = -1.54; 00013 c2 = 2.84; 00014 } 00015 if ((pat == 0x2248) || (pat == 0x8441)) { 00016 c1 = -2.06; 00017 c2 = 2.99; 00018 } 00019 }//endof MdcxSeg
|
|
00021 { }
|
|
|
|
|
|
00166 { 00167 double phit=atan2(yl-yf,xl-xf); return phit<0?phit+2*M_PI:phit; 00168 }//endof CalcPhi
|
|
00166 { 00167 double phit=atan2(yl-yf,xl-xf); return phit<0?phit+2*M_PI:phit; 00168 }//endof CalcPhi
|
|
00045 {return chisq;}
|
|
00045 {return chisq;}
|
|
00074 {return code;}
|
|
00074 {return code;}
|
|
|
|
00220 { 00221 //FIXME 00222 omega=rhs.Omega(); phi0=rhs.Phi0(); d0=rhs.D0(); t0=rhs.T0(); 00223 tanl=rhs.Tanl(); z0=rhs.Z0(); 00224 cphi0=rhs.CosPhi0(); sphi0=rhs.SinPhi0(); 00225 x0=rhs.X0(); y0=rhs.Y0(); xc=rhs.Xc(); yc=rhs.Yc(); 00226 xref=rhs.Xref(); yref=rhs.Yref(); 00227 qomega=rhs.Qomega(); qphi0=rhs.Qphi0(); qd0=rhs.Qd0(); qt0=rhs.Qt0(); 00228 qtanl=rhs.Qtanl(); qz0=rhs.Qz0(); 00229 mode=rhs.Mode(); nfree=rhs.Nfree(); 00230 code=rhs.Code(); ominfl=rhs.Ominfl(); omin=rhs.Omin(); 00231 turnflag=rhs.GetTurnFlag(); 00232 }//endof copy
|
|
00063 {return cphi0;}
|
|
00063 {return cphi0;}
|
|
00053 {return d0;}
|
|
00053 {return d0;}
|
|
|
|
|
|
|
|
FIXME use bit code ? 00201 { 00202 int temp = code; 00203 temp=temp/1000000; temp=code-1000000*temp; 00204 i6=temp/100000; temp=temp-100000*i6; 00205 i5=temp/10000; temp=temp-10000*i5; 00206 i4=temp/1000; temp=temp-1000*i4; 00207 i3=temp/100; temp=temp-100*i3; 00208 i2=temp/10; i1=temp-10*i2; 00209 n = 0; 00210 if(i6 == 1) n++; else i6 = 0; 00211 if(i5 == 1) n++; else i5 = 0; 00212 if(i4 == 1) n++; else i4 = 0; 00213 if(i3 == 1) n++; else i3 = 0; 00214 if(i2 == 1) n++; else i2 = 0; 00215 if(i1 == 1) n++; else i1 = 0; 00216 }//endof decode
|
|
00169 { return i==j?0:i==0?1:-1; } //integer comparisons
|
|
00169 { return i==j?0:i==0?1:-1; } //integer comparisons
|
|
|
|
00316 { 00317 double doca = Doca(hit); 00318 std::vector<float> temp(nfree+1); 00319 temp[0] = doca; 00320 double fac = 1.0; 00321 if((mode==0) && (doca<0.0)) fac = -fac; 00322 if(mode == 0) temp[0] = fabs(temp[0]); 00323 00324 int bump = 0; 00325 if (qd0) temp[++bump] = (-vx*sphi0 + vy*cphi0) * fac; 00326 if (qphi0) { 00327 //double dddp0=-(yh-y0)*vx+(xh-x0)*vy; 00328 double dddp0 = -(yh-y0+f0*ty)*vx + (xh-x0+f0*tx)*vy; 00329 dddp0 *= (1.0 + d0*omega); 00330 temp[++bump] = dddp0*fac; 00331 } 00332 if (qomega) { 00333 double dddom; 00334 if (ominfl) { 00335 dddom = ((len*cos(phi)-xh+x0)*vx + (len*sin(phi)-yh+y0)*vy)/omega; 00336 dddom += f0*len*cosl*(-sin(phi)*vx+cos(phi)*vy); 00337 } else { 00338 dddom = 0.5*len*len*(-vx*sphi0+vy*cphi0); 00339 } 00340 temp[++bump] = dddom * fac; 00341 } 00342 if (qz0) temp[++bump] = vz * fac; 00343 if (qtanl) temp[++bump] = (vz *len) * fac; 00344 if (qt0) temp[++bump] = -hit.v(); 00345 return temp; 00346 }//endof derivatives
|
|
|
|
|
|
|
|
calc the phi of point(i) FIXME 00236 { 00237 double m_2pi = 2.0*M_PI; 00238 // describe wire 00239 //cout << " In Doca, xi = " << xi << " yi = " << yi << " zi = " << zi <<endl; 00240 Hep3Vector ivec(xi, yi, zi); 00241 wvec = Hep3Vector(wx, wy, wz); 00242 //cout << " In Doca, wx = " << wx << " wy = " << wy << " wz = " << wz <<endl; 00243 // calculate len to doca 00244 double zd, xd = xi, yd = yi; 00245 // cout << " In Doca, start xd = " << xd << " yd = " << yd << endl; 00246 double lnew,t1,t2,dphi,dlen=1000.0; 00247 len = 0.0; 00248 int itry = 2; 00249 // int segflg=0; if ((code==111)&&(z0==0.0)&&(tanl==0.0))segflg=1; 00250 // int superseg=0; if ((code==11111)&&(xref!=0.0)&&(yref!=0.0))superseg=1; 00251 double circut, circum = 10000.; 00252 if (ominfl) circum = m_2pi/fabs(omega); 00253 circut = 0.50 * circum; 00254 while (itry) { 00255 if (ominfl) { 00257 t1 = -xc + xd; t2 = yc - yd; phi = atan2(t1, t2); 00258 if (omega < 0.0) phi += M_PI; 00259 if (phi > M_PI) phi -= m_2pi; 00260 dphi = phi - phi0; 00261 if (omega < 0.0){ 00262 if (dphi > 0.0) dphi -= m_2pi; 00263 if (dphi < -m_2pi) dphi += m_2pi; 00264 }else{ 00265 if (dphi < 0.0) dphi += m_2pi; 00266 if (dphi > m_2pi) dphi -= m_2pi; 00267 } 00268 lnew = dphi/omega; 00269 // if ((lnew>circut)&&(segflg))lnew-=circum; 00270 // if ((lnew>circut)&&(superseg))lnew-=circum; 00271 if ((lnew>circut)&&(turnflag)) lnew -= circum; //FIXME attention 00272 00273 zh = Zh(lnew); 00274 xd=xi+(zh-zi)*wx/wz; yd=yi+(zh-zi)*wy/wz; zd=zh; 00275 // cout << " In Doca, xd = " << xd << " yd = " << yd << " zh = " << zh; 00276 // cout << " lnew = " << lnew << endl; 00277 dlen=fabs(lnew-len); len=lnew; 00278 // if (segflg)break; 00279 if (fabs(zh) > MdcxParameters::maxMdcZLen) break; //FIXME attention 00280 if ( (0.0==wx) && (0.0==wy) )break; if (dlen < 0.000001)break; itry--; 00281 } else { 00282 len = (xi-xref)*cphi0 + (yi-yref)*sphi0; 00283 zh = z0 + tanl*len; 00284 phi = phi0; 00285 break; 00286 } 00287 } 00288 // Hep3Vector Dvec(xd,yd,zd); 00289 xh = Xh(len); yh = Yh(len); 00290 Hep3Vector hvec(xh, yh, zh); 00291 // cout << " In Doca, xh = " << xh << " yh = " << yh << " zh = " << zh << " len=" << len << " om " << omega << endl; 00292 double lamb = atan(tanl); 00293 cosl = cos(lamb); sinl = sin(lamb); 00294 tx = cosl*cos(phi); ty = cosl*sin(phi); tz = sinl; 00295 tvec = Hep3Vector(tx, ty, tz); 00296 Hep3Vector vvec = wvec.cross(tvec); 00297 vhat = vvec.unit(); vx = vhat.x(); vy = vhat.y(); vz = vhat.z(); 00298 // cout << " In Doca, vx = " << vx << " vy = " << vy << " vz = " << vz << endl; 00299 dvec = ivec - hvec; 00300 double doca = dvec*vhat; 00301 // cout << " doca = " << doca << endl; 00302 double f1 = dvec*tvec; double f2 = wvec*tvec; double f3 = dvec*wvec; 00303 f0 = (f1 - f2*f3) / (1.0 - f2*f2); 00304 samb = (doca > 0.0) ? -1 : +1; 00305 double wirephi = atan2(yd, xd); 00306 eang = BesAngle(phi-wirephi); 00307 wamb = (fabs(eang) < Constants::pi/2) ? samb : -samb; 00308 if (fabs(zh) > MdcxParameters::maxMdcZLen) doca = 1000.0; 00309 //if(doca == 1000.0) cout << " In Doca, zh = " << zh << " len=" << len << " om " << omega <<" "<< ominfl<< 00310 //" z0 " << z0 << "tanl " << tanl <<endl; 00311 //cout << " doca = " << doca << endl; 00312 return doca; 00313 }//endof Doca
|
|
00071 {return eang;}
|
|
00071 {return eang;}
|
|
00066 {return len*sqrt(1.0+tanl*tanl);}
|
|
00066 {return len*sqrt(1.0+tanl*tanl);}
|
|
00065 {return len;}
|
|
00065 {return len;}
|
|
00069 {return samb;}
|
|
00069 {return samb;}
|
|
00067 {return len*sqrt(1.0+tanl*tanl)/MdcxParameters::c;}
|
|
00067 {return len*sqrt(1.0+tanl*tanl)/MdcxParameters::c;}
|
|
00070 {return wamb;}
|
|
00070 {return wamb;}
|
|
00068 {return zh;}
|
|
00068 {return zh;}
|
|
|
|
00199 { 00200 int ftemp = 1301; 00201 // if(nfree>nhits) {return Fail;} 00202 if (nfree > nhits) return ftemp; 00203 double m_2pi = 2.0 * M_PI; 00204 ftemp = 0; 00205 //pointloop 00206 if (6 == debug) { 00207 std::cout << "in MdcxFittedHel::DoFit() nfree = " << nfree 00208 << " nhits = " << nhits << std::endl; 00209 } 00210 00211 int norder = nfree; 00212 double A[10][10] = {{0.}}, B[10] = {0.}, D[10] = {0.}, det; 00213 chisq = 0.0; 00214 00215 if (6 == debug) { 00216 std::cout << "xHitList.length " << xHitList.length() << " "; 00217 for (int ii = 0; ii < xHitList.length(); ii++) { 00218 xHitList[ii]->print(std::cout, ii); 00219 } 00220 std::cout << std::endl << "sfac = " << sfac << std::endl; 00221 } 00222 00223 for (int i = 0; i < nhits; i++) { 00224 std::vector<float> derivs = xHitList[i]->derivatives(*this); 00225 if (6 == debug) { 00226 cout << "derivs " << i<<" "; 00227 for (unsigned int ii = 0; ii < derivs.size(); ii++) { 00228 cout << setw(15)<< derivs[ii]; 00229 } 00230 std::cout << std::endl; 00231 } 00232 if (sfac != 1.0) { 00233 for(unsigned int ipar = 0; ipar < derivs.size(); ipar++) { 00234 derivs[ipar] /= sfac; 00235 if(6 == debug) cout << " derivs[" << ipar << "] = " << derivs[ipar]; 00236 } 00237 if(6 == debug) std::cout << std::endl; 00238 } 00239 chisq += derivs[0] * derivs[0]; 00240 //outer parameter loop 00241 for (int ipar = 0; ipar < norder; ipar++) { 00242 D[ipar] += derivs[0] * derivs[ipar+1]; 00243 //inner parameter loop 00244 for(int jpar = 0; jpar < norder; jpar++) { 00245 A[ipar][jpar] += derivs[ipar+1] * derivs[jpar+1]; 00246 }//endof inner parameter loop 00247 }//endof outer parameter loop 00248 }//pointloop 00249 if (6 == debug) cout << "chisq = " << chisq << endl; 00250 if (chisq == 0 && nhits != 3) { //zoujh: chisq is invalid??? FIXME 00251 ftemp = 1310; 00252 return ftemp; 00253 } 00254 if (6 == debug) { 00255 for (int ii = 0; ii < norder; ii++) { 00256 cout << "D["<< ii << "]: " << D[ii] << " A:"; 00257 for (int jj = 0; jj < norder; jj++) cout << " " << A[ii][jj]; 00258 cout << endl; 00259 } 00260 } 00261 //invert A 00262 int ierr; 00263 if (bailout) { 00264 ftemp = 1308; // bailout 00265 int ndof = nhits - nfree; 00266 if (ndof > 0) { 00267 if (6 == debug){ 00268 cout << "chisq " << chisq << " ndof " << ndof 00269 << " chiperdof " << chisq/ndof 00270 << " >?chidofbail " << chidofbail << endl; 00271 } 00272 float chiperdof = chisq/ndof; 00273 if(chiperdof > chidofbail) return ftemp; 00274 } else { 00275 if (6 == debug){ 00276 cout << " ndof <=0 : chisq " << chisq 00277 << " >? chidofbail/2.5 " << chidofbail/2.5 << endl; 00278 } 00279 if (chisq > chidofbail/2.5) return ftemp; //FIXME 00280 } 00281 } // (bailout) 00282 ftemp = 0; 00283 ierr = Mdcxmatinv(&A[0][0], &norder, &det); 00284 if (6 == debug) cout << "ierr = " << ierr << endl; 00285 if (ierr == 0) { 00286 for(int ii = 0; ii < norder; ii++) 00287 for(int jj = 0; jj < norder; jj++) 00288 B[ii] += A[ii][jj] * D[jj]; 00289 if (6 == debug) { 00290 for (int ii = 0; ii < norder; ii++) { 00291 cout << "B[" << ii << "]: " << B[ii] << " A:"; 00292 for (int jj = 0; jj < norder; jj++) cout << " " << A[ii][jj]; 00293 cout << endl; 00294 } 00295 } 00296 int bump = -1; 00297 if (qd0) d0 -= B[++bump]; 00298 if (qphi0) { 00299 phi0 -= B[++bump]; 00300 if (phi0 > M_PI) phi0 -= m_2pi; 00301 if (phi0 < -M_PI) phi0 += m_2pi; 00302 cphi0 = cos(phi0); sphi0 = sin(phi0); 00303 } 00304 if (qomega) { 00305 omega -= B[++bump]; 00306 ominfl = (fabs(omega) < omin) ? 0 : 1; 00307 } 00308 if (qz0) z0 -= B[++bump]; 00309 if (qtanl) tanl -= B[++bump]; 00310 if (qt0) t0 -= B[++bump]; 00311 00312 x0 = X0(); y0 = Y0(); xc = Xc(); yc = Yc(); 00313 if ( fabs(d0) > MdcxParameters::maxMdcRadius ) ftemp = 1305; 00314 //if(g_fitOmega)g_fitOmega->fill(omega); 00315 if ( fabs(omega) > 10.0 ) ftemp = 1306; // Too tight (r < 1 cm)//yzhang FIXME 2009-11-03 00316 } else { 00317 ftemp = ierr; 00318 } 00319 return ftemp; 00320 }//endof DoFit
|
|
|
|
00141 { 00142 if(fail) return fail; 00143 if(prob < Probmin) return 1303; 00144 // now done in DoFit if(fabs(omega)>omegmax) {return 1306;} 00145 return 0; 00146 } // endof Fail
|
|
|
|
|
|
00357 { 00358 double m_2pi=2.0*M_PI; 00359 double difphi0=phi0-hel.Phi0(); 00360 if (difphi0>M_PI)difphi0-=m_2pi; if (difphi0<-M_PI)difphi0+=m_2pi; 00361 cout << " difphi0= " << difphi0 << endl; 00362 cout << " difomega= " << omega-hel.Omega() << endl; 00363 cout << " difz0= " << z0-hel.Z0() << endl; 00364 cout << " diftanl= " << tanl-hel.Tanl() << endl; 00365 o << "FitPrint "; 00366 o << "nhits "<< nhits << " fail " << fail << " chi2 " << chisq ; 00367 o << "rcs " << rcs << " prob " << prob <<endl; 00368 return 0; 00369 }//endof FitPrint
|
|
00335 { 00336 cout << " d0 " << d0; 00337 cout << " phi0 " << phi0; 00338 cout << " omega " << omega; 00339 cout << " z0 " << z0; 00340 cout << " tanl " << tanl << endl; 00341 cout << " fail " << fail; 00342 cout << " chisq " << chisq; 00343 cout << " iter to fit " << itofit; 00344 cout << " sfac " << sfac; 00345 cout << " rcs " << rcs; 00346 cout << " prob " << prob; 00347 cout << " fittime " << fittime << endl; 00348 cout << " nhits= " << nhits << " xHitList.length " << xHitList.length() << endl; 00349 for (int ii = 0; ii < xHitList.length(); ii++) { 00350 xHitList[ii]->print(cout, ii); 00351 } 00352 cout<<endl; 00353 00354 return 0; 00355 }//endof FitPrint
|
|
00048 {return fittime;}
|
|
00048 {return fittime;}
|
|
|
|
00366 { 00367 double m_2pi = 2.0*M_PI; 00368 if (ominfl) { 00369 if ( (fabs(d0) + 2.0/fabs(omega)) > 80.0 ) return; 00370 double lturn = m_2pi/fabs(omega); 00371 double zturn = Zh(lturn); 00372 // cout << "z0 " << z0 << " zturn " << zturn << endl; 00373 if (fabs(zturn) < fabs(z0)) { 00374 z0 = zturn; 00375 tanl = -tanl; 00376 omega = -omega; 00377 d0 = -d0; 00378 phi0 = phi0 - M_PI; 00379 if (phi0 < -M_PI) phi0 += m_2pi; 00380 cphi0 = cos(phi0); 00381 sphi0 = sin(phi0); 00382 x0 = X0(); 00383 y0 = Y0(); 00384 } 00385 } 00386 }//endof flip
|
|
00115 {return turnflag;}
|
|
00115 {return turnflag;}
|
|
00056 {return usedonhel;}
|
|
00056 {return usedonhel;}
|
|
|
|
00094 { 00095 copy(rhs); 00096 fail=rhs.Fail(); 00097 chisq=rhs.Chisq(); 00098 //rcs=rhs.Rcs(); 00099 //prob=rhs.Prob(); 00100 fittime=0.0; 00101 nhits=rhs.Nhits(); 00102 itofit=0; 00103 quality=rhs.Quality(); 00104 origin=rhs.Origin(); 00105 xHitList=rhs.XHitList(); 00106 sfac=rhs.Sfac(); 00107 usedonhel=rhs.GetUsedOnHel(); 00108 bailout=1; chidofbail=1200.0; niter=10; 00109 int kkk=0; while (ListOAdds[kkk]){ListOAdds[kkk]->SetUsedOnHel(0); kkk++;} 00110 kkk=0; while (xHitList[kkk]){xHitList[kkk]->SetUsedOnHel(1); kkk++;} 00111 double spull; 00112 MdcxHel* temp = (MdcxHel*)(&rhs); 00113 kkk=0; while (ListOAdds[kkk]){ 00114 if (ListOAdds[kkk]->GetUsedOnHel() == 0) { 00115 spull = ListOAdds[kkk]->pull(*temp)/sfac; 00116 chisq += spull*spull; 00117 xHitList.append(ListOAdds[kkk]); 00118 nhits++; 00119 } 00120 kkk++; 00121 } 00122 00123 int ndof = nhits - nfree; 00124 prob = Mdcxprobab(ndof, chisq); 00125 rcs = chisq/ndof; 00126 return *this; 00127 }//endof MdcxFittedHel::Grow
|
|
|
|
FIXME 00160 { 00161 int ftemp = 1301; // not enough hits 00162 if (nfree > nhits) return ftemp; 00163 ftemp = 0; 00164 00165 if(6 == debug) std::cout<<"IterateFit niter="<<niter<< std::endl; 00166 if (niter >= 1) { 00167 float prevchisq = 0.0; 00168 for (int i = 0; i < niter; i++) { 00169 itofit = i + 1; 00170 ftemp = DoFit(); 00171 if (6 == debug) { 00172 if (nfree == 5) { 00173 cout << " iteration number= " << i << " chisq= " << chisq; 00174 cout << " nhits= " << nhits << " " << " fail= " << ftemp << endl; 00175 } 00176 print(); 00177 } 00178 if (ftemp != 0) break; 00179 if(6 == debug)std::cout<<"in MdcxFittedHel::IterateFit() chisq="<<chisq<<" prechi2="<<prevchisq<<std::endl;//yzhang debug 00180 if ((fabs(chisq-prevchisq) < 0.01*chisq) || (chisq < 0.001)) break; 00181 prevchisq = chisq; 00182 }//endof iter loop 00183 } else { 00184 float prevchisq = 0.0; 00185 chisq = 1000000.0; 00186 int iter = 0; 00187 while ((fabs(chisq-prevchisq) > 0.01) && (iter++ < 1000)) { 00188 prevchisq = chisq; 00189 ftemp = DoFit(); 00190 if (ftemp != 0) break; 00191 }//endof (fabs(chisq-oldchisq).gt.0.01) 00192 }//endof (niter>=1) 00193 int ndof = nhits - nfree; 00194 prob = Mdcxprobab(ndof, chisq); 00195 rcs = chisq/ndof; 00196 return ftemp; 00197 }//endof IterateFit
|
|
00050 {return itofit;}
|
|
00050 {return itofit;}
|
|
|
|
00372 { 00373 if(hitno >= nhits) return 0; 00374 return xHitList[hitno]->Layer(); 00375 } // endof Layer
|
|
|
|
FIXME 00142 { 00143 double lmax = MdcxParameters::maxTrkLength; 00144 if (ominfl) { 00145 double rmax = 1.0/fabs(omega); 00146 double dmax = fabs(d0) + 2.0*rmax; 00147 if (dmax > MdcxParameters::maxMdcRadius) lmax = M_PI*rmax; 00148 } 00149 return lmax; 00150 }//endof Lmax
|
|
00073 {return mode;}
|
|
00073 {return mode;}
|
|
00075 {return nfree;}
|
|
00075 {return nfree;}
|
|
00049 {return nhits;}
|
|
00049 {return nhits;}
|
|
00055 {return omega;}
|
|
00055 {return omega;}
|
|
00072 {return omin;}
|
|
00072 {return omin;}
|
|
00076 {return ominfl;}
|
|
00076 {return ominfl;}
|
|
00052 {return origin;}
|
|
00052 {return origin;}
|
|
00019 {return pat;}
|
|
00019 {return pat;}
|
|
00054 {return phi0;}
|
|
00054 {return phi0;}
|
|
|
|
|
|
|
|
00348 { 00349 cout << "MdcxHel("; 00350 cout << d0<<","; 00351 cout << phi0<<","; 00352 cout << omega<<","; 00353 cout << z0<<","; 00354 cout << tanl<<")"<<endl; 00355 cout << " t0 = " << t0 ; 00356 cout << " nfree = " << nfree ; 00357 cout << " (x0,y0) " << x0<<","<<y0; 00358 cout << " (xc,yc) " << xc<<","<<yc; 00359 cout << " (xref,yref) " << xref<<","<<yref; 00360 cout << " code = " << code; 00361 cout << " mode = " << mode; 00362 cout << " ominfl = " << ominfl; 00363 cout << " " << endl; 00364 }//endof print
|
|
|
|
00023 { 00024 std::cout<<"slay "<< SuperLayer()<<", amb "<<amb<<" : "; 00025 for (int i =0; i<Nhits(); i++){ 00026 XHitList()[i]->print(std::cout,i); 00027 } 00028 std::cout<< std::endl; 00029 }
|
|
|
|
00031 { 00032 std::cout<<"MdcxSeg "<< SuperLayer()<<" : "; 00033 for (int i =0; i<Nhits(); i++){ 00034 XHitList()[i]->print(std::cout,i); 00035 } 00036 std::cout <<" pat "<<Pat()<<" amb "<<amb<< " d0 "<<d0<<" phi0 "<<phi0<<" omega "<<omega 00037 <<" d0Sl "<<D0_sl_approx()<<" phi0Sl "<< Phi0_sl_approx() 00038 <<" xB "<<Xline_bbrrf()<<" yB "<< Yline_bbrrf() 00039 <<" xSl "<<Xline_slope()<<" ySl "<< Yline_slope() 00040 <<" x(y)ref " << Xref() << " " << Yref() 00041 <<" origin "<<Origin() 00042 << std::endl; 00043 std::cout<< std::endl; 00044 }
|
|
00047 {return prob;}
|
|
00047 {return prob;}
|
|
|
|
00134 { 00135 if(ominfl) { 00136 return 0.003*sqrt(1.0+tanl*tanl)/fabs(omega); 00137 } else { 00138 return 1000.0*sqrt(1.0+tanl*tanl); 00139 }//ominfl 00140 }//endof Ptot
|
|
|
|
00137 { 00138 return xHitList[i]->pull(*this); 00139 }//endof Pulls
|
|
|
|
pt=0.003*r (0.003 -> q*B) 00107 { 00108 if(ominfl) { 00109 double phit = phi0 + omega*l; 00110 return 0.003*cos(phit)/fabs(omega); 00111 } else { 00112 return 1000.0*cphi0; 00113 }//ominfl 00114 }//endof Px
|
|
|
|
00116 { 00117 if(ominfl) { 00118 double phit = phi0+omega*l; 00119 return 0.003*sin(phit)/fabs(omega); 00120 } else { 00121 return 1000.0*sphi0; 00122 }//ominfl 00123 }//endof Py
|
|
|
|
00125 { 00126 if(ominfl) { 00127 return 0.003*tanl/fabs(omega); 00128 } 00129 else{ 00130 return 1000.0*tanl; 00131 }//ominfl 00132 }//endof Pz
|
|
00077 {return qd0;}
|
|
00077 {return qd0;}
|
|
00079 {return qomega;}
|
|
00079 {return qomega;}
|
|
00078 {return qphi0;}
|
|
00078 {return qphi0;}
|
|
00082 {return qt0;}
|
|
00082 {return qt0;}
|
|
00081 {return qtanl;}
|
|
00081 {return qtanl;}
|
|
00051 {return quality;}
|
|
00051 {return quality;}
|
|
00080 {return qz0;}
|
|
00080 {return qz0;}
|
|
00046 {return rcs;}
|
|
00046 {return rcs;}
|
|
|
|
00155 { 00156 fail = IterateFit(); 00157 return fail; 00158 }//endof ReFit
|
|
|
|
00130 { 00131 //float pull=xHitList[i]->pull(*this); 00132 //float E=xHitList[i]->e(); 00133 //return pull*E; 00134 return xHitList[i]->residual(*this); 00135 }//endof Residual
|
|
00117 {bailout=i;}
|
|
00117 {bailout=i;}
|
|
00118 {chidofbail=r;}
|
|
00118 {chidofbail=r;}
|
|
|
|
00171 { 00172 nfree = nfree + deltaq(qd0, Qd0); 00173 code = code + deltaq(qd0, Qd0); 00174 qd0 = Qd0; 00175 }
|
|
|
|
00154 { mode = n; }
|
|
00119 {niter=i;}
|
|
00119 {niter=i;}
|
|
|
|
00161 { 00162 nfree = nfree + deltaq(qomega, Qomega); 00163 code = code + deltaq(qomega, Qomega)*100; 00164 qomega = Qomega; 00165 }
|
|
|
|
00166 { 00167 nfree = nfree + deltaq(qphi0, Qphi0); 00168 code = code + deltaq(qphi0, Qphi0)*10; 00169 qphi0 = Qphi0; 00170 }
|
|
00054 {quality=q;}
|
|
00054 {quality=q;}
|
|
|
|
|
|
|
|
00186 { 00187 nfree = nfree + deltaq(qt0, Qt0); 00188 code = code + deltaq(qt0, Qt0)*100000; 00189 qt0 = Qt0; 00190 }
|
|
|
|
00176 { 00177 nfree = nfree + deltaq(qtanl, Qtanl); 00178 code = code + deltaq(qtanl, Qtanl)*10000; 00179 qtanl = Qtanl; 00180 }
|
|
00114 {turnflag=i;}
|
|
00114 {turnflag=i;}
|
|
00055 {usedonhel=i;}
|
|
00055 {usedonhel=i;}
|
|
|
|
00181 { 00182 nfree = nfree + deltaq(qz0, Qz0); 00183 code = code + deltaq(qz0, Qz0)*1000; 00184 qz0 = Qz0; 00185 }
|
|
00053 {return sfac;}
|
|
00053 {return sfac;}
|
|
00064 {return sphi0;}
|
|
00064 {return sphi0;}
|
|
|
|
00378 { 00379 if(hitno >= nhits) { return 0; } 00380 if(hitno < 0) { return 0; } 00381 return xHitList[hitno]->SuperLayer(); 00382 } // endof SuperLayer
|
|
00062 {return t0;}
|
|
00062 {return t0;}
|
|
00057 {return tanl;}
|
|
00057 {return tanl;}
|
|
|
|
|
|
00058 {return xref;}
|
|
00058 {return xref;}
|
|
|
|
|
|
|
|
00059 { 00060 if(ominfl) { 00061 //return (X0() - sphi0/omega); 00062 return (x0 - sphi0/omega); 00063 } else { 00064 return 999999999.9; 00065 }//(ominfl) 00066 }//endof Xc
|
|
|
|
00085 { 00086 if(ominfl){ 00087 double phit=phi0+omega*l; 00088 return (xc+sin(phit)/omega); 00089 }else{ 00090 return (x0+cphi0*l-0.5*l*l*omega*sphi0); 00091 }//ominfl 00092 }//endof Xh
|
|
00059 { return xHitList; }
|
|
00059 { return xHitList; }
|
|
|
|
|
|
|
|
|
|
00059 {return xref;}
|
|
00059 {return xref;}
|
|
00060 {return yref;}
|
|
00060 {return yref;}
|
|
|
|
|
|
|
|
00068 { 00069 if(ominfl) { 00070 //return (Y0()+cphi0/omega); 00071 return (y0 + cphi0/omega); 00072 } else { 00073 return 999999999.9; 00074 }//(ominfl) 00075 }//endof Yc
|
|
|
|
00094 { 00095 if(ominfl){ 00096 double phit=phi0+omega*l; 00097 return (yc-cos(phit)/omega); 00098 }else{ 00099 return (y0+sphi0*l+0.5*l*l*omega*cphi0); 00100 }//ominfl 00101 }//endof Yh
|
|
|
|
|
|
|
|
|
|
00061 {return yref;}
|
|
00061 {return yref;}
|
|
00056 {return z0;}
|
|
00056 {return z0;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|