#include <MdcxHel.h>
Inheritance diagram for MdcxHel:
Public Member Functions | |
int | Code () const |
int | Code () const |
double | CosPhi0 () const |
double | CosPhi0 () const |
double | D0 () const |
double | D0 () const |
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 |
void | flip () |
void | flip () |
int | GetTurnFlag () const |
int | GetTurnFlag () const |
double | Lmax () const |
double | Lmax () const |
MdcxHel (double D0, double Phi0, double Omega, double Z0=0.0, double Tanl=0.0, double T0=0.0, int Code=11111, int Mode=0, double X=0.0, double Y=0.0) | |
MdcxHel () | |
MdcxHel (double D0, double Phi0, double Omega, double Z0=0.0, double Tanl=0.0, double T0=0.0, int Code=11111, int Mode=0, double X=0.0, double Y=0.0) | |
MdcxHel () | |
int | Mode () const |
int | Mode () const |
int | Nfree () const |
int | Nfree () const |
double | Omega () const |
double | Omega () const |
double | Omin () const |
double | Omin () const |
int | Ominfl () const |
int | Ominfl () const |
MdcxHel & | operator= (const MdcxHel &) |
MdcxHel & | operator= (const MdcxHel &) |
double | Phi0 () const |
double | Phi0 () const |
void | print () const |
void | print () const |
double | Ptot (double l=0.0) const |
double | Ptot (double l=0.0) const |
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 | Qz0 () const |
int | Qz0 () const |
void | SetD0 (int n) |
void | SetD0 (int n) |
void | SetMode (int n) |
void | SetMode (int n) |
void | SetOmega (int n) |
void | SetOmega (int n) |
void | SetPhi0 (int n) |
void | SetPhi0 (int n) |
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 | SetZ0 (int n) |
void | SetZ0 (int n) |
double | SinPhi0 () const |
double | SinPhi0 () const |
double | T0 () const |
double | T0 () const |
double | Tanl () const |
double | Tanl () const |
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 |
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 | Yref () const |
double | Yref () const |
double | Z0 () const |
double | Z0 () const |
double | Zh (double l) const |
double | Zh (double l) const |
virtual | ~MdcxHel () |
virtual | ~MdcxHel () |
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 |
Protected Attributes | |
int | code |
double | cosl |
double | cphi0 |
double | d0 |
Hep3Vector | dvec |
double | eang |
double | f0 |
double | len |
int | mode |
int | nfree |
double | omega |
double | omin |
int | ominfl |
double | phi |
double | phi0 |
int | qd0 |
int | qomega |
int | qphi0 |
int | qt0 |
int | qtanl |
int | qz0 |
int | samb |
double | sinl |
double | sphi0 |
double | t0 |
double | tanl |
int | turnflag |
Hep3Vector | tvec |
double | tx |
double | ty |
double | tz |
Hep3Vector | vhat |
double | vx |
double | vy |
double | vz |
int | wamb |
Hep3Vector | wvec |
double | x0 |
double | xc |
double | xh |
double | xref |
double | y0 |
double | yc |
double | yh |
double | yref |
double | z0 |
double | zh |
|
00032 { }
|
|
FIXME 00036 : 00037 d0(D0), phi0(Phi0), omega(Omega), z0(Z0), tanl(Tanl), t0(T0), 00038 xref(X), yref(Y), code(Code), mode(Mode), omin(0.000005) { 00039 00040 ominfl = (fabs(omega) < omin) ? 0 : 1; 00041 double m_2pi = 2.0*M_PI; 00042 if (phi0 > M_PI) phi0 -= m_2pi; 00043 if (phi0 < -M_PI) phi0 += m_2pi; 00044 cphi0 = cos(phi0); 00045 sphi0 = sin(phi0); 00046 x0 = X0(); 00047 y0 = Y0(); 00048 xc = Xc(); 00049 yc = Yc(); 00050 decode(code, qd0, qphi0, qomega, qz0, qtanl, qt0, nfree); 00051 turnflag = 1; 00052 //std::cout << "MdcxHel::MdcxHel() -> (x0, y0) (" << x0 << ", " << y0 << ")" << std::endl; 00053 }//endof MdcxHel
|
|
00055 { }
|
|
|
|
|
|
|
|
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
|
|
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;}
|
|
|
|
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;}
|
|
|
|
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;}
|
|
00055 {return omega;}
|
|
00055 {return omega;}
|
|
00072 {return omin;}
|
|
00072 {return omin;}
|
|
00076 {return ominfl;}
|
|
00076 {return ominfl;}
|
|
Reimplemented in MdcxFittedHel, and MdcxFittedHel. |
|
Reimplemented in MdcxFittedHel, and MdcxFittedHel. 00193 { 00194 copy(rhs); 00195 return *this; 00196 }
|
|
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
|
|
|
|
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
|
|
|
|
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;}
|
|
00080 {return qz0;}
|
|
00080 {return qz0;}
|
|
|
|
00171 { 00172 nfree = nfree + deltaq(qd0, Qd0); 00173 code = code + deltaq(qd0, Qd0); 00174 qd0 = Qd0; 00175 }
|
|
|
|
00154 { mode = n; }
|
|
|
|
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 }
|
|
|
|
|
|
|
|
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;}
|
|
|
|
00181 { 00182 nfree = nfree + deltaq(qz0, Qz0); 00183 code = code + deltaq(qz0, Qz0)*1000; 00184 qz0 = Qz0; 00185 }
|
|
00064 {return sphi0;}
|
|
00064 {return sphi0;}
|
|
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 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;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|