Ext_Helix Class Reference

Helix parameter class. More...

#include <Helix.h>

List of all members.

Public Member Functions

 Ext_Helix (const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
 Constructor with pivot, helix parameter a, and its error matrix.
 Ext_Helix (const HepPoint3D &pivot, const HepVector &a)
 Constructor without error matrix.
 Ext_Helix (const HepPoint3D &position, const Hep3Vector &momentum, double charge)
 Constructor with position, momentum, and charge.
virtual ~Ext_Helix ()
 Destructor.
const HepPoint3Dcenter (void) const
 returns position of helix center(z = 0.);
const HepPoint3Dpivot (void) const
 returns pivot position.
double radius (void) const
 returns radious of helix.
HepPoint3D x (double dPhi=0.) const
 returns position after rotating angle dPhi in phi direction.
double * x (double dPhi, double p[3]) const
HepPoint3D x (double dPhi, HepSymMatrix &Ex) const
 returns position and convariance matrix(Ex) after rotation.
Hep3Vector direction (double dPhi=0.) const
 returns direction vector after rotating angle dPhi in phi direction.
Hep3Vector momentum (double dPhi=0.) const
 returns momentum vector after rotating angle dPhi in phi direction.
Hep3Vector momentum (double dPhi, HepSymMatrix &Em) const
 returns momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass, HepSymMatrix &Em) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass, HepPoint3D &x, HepSymMatrix &Emx) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
double dr (void) const
 returns an element of parameters.
double phi0 (void) const
double kappa (void) const
double dz (void) const
double tanl (void) const
double curv (void) const
double sinPhi0 (void) const
double cosPhi0 (void) const
const HepVector & a (void) const
 returns helix parameters.
const HepSymMatrix & Ea (void) const
 returns error matrix.
const HepVector & a (const HepVector &newA)
 sets helix parameters.
const HepSymMatrix & Ea (const HepSymMatrix &newdA)
 sets helix paramters and error matrix.
const HepPoint3Dpivot (const HepPoint3D &newPivot)
 sets pivot position.
void set (const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
 sets helix pivot position, parameters, and error matrix.
void ignoreErrorMatrix (void)
 unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.
double bFieldZ (double)
 sets/returns z componet of the magnetic field.
double bFieldZ (void) const
Ext_Helixoperator= (const Ext_Helix &)
 Copy operator.
HepMatrix delApDelA (const HepVector &ap) const
HepMatrix delXDelA (double phi) const
HepMatrix delMDelA (double phi) const
HepMatrix del4MDelA (double phi, double mass) const
HepMatrix del4MXDelA (double phi, double mass) const

Static Public Attributes

static const double ConstantAlpha
 Constant alpha for uniform field.

Private Member Functions

void updateCache (void)

Private Attributes

IMagneticFieldSvcm_pmgnIMF
double m_bField
double m_alpha
HepPoint3D m_pivot
HepVector m_a
HepSymMatrix m_Ea
bool m_matrixValid
HepPoint3D m_center
double m_cp
double m_sp
double m_pt
double m_r
double m_ac [5]


Detailed Description

Helix parameter class.

Definition at line 38 of file Helix.h.


Constructor & Destructor Documentation

Ext_Helix::Ext_Helix ( const HepPoint3D pivot,
const HepVector &  a,
const HepSymMatrix &  Ea 
)

Constructor with pivot, helix parameter a, and its error matrix.

Definition at line 52 of file Helix.cxx.

References IMagneticFieldSvc::getReferField(), m_alpha, m_bField, m_pmgnIMF, and updateCache().

00055   : //m_bField(-10.0),
00056   //m_alpha(-333.564095),
00057   m_pivot(pivot),
00058   m_a(a),
00059   m_matrixValid(true),
00060   m_Ea(Ea) {
00061   StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 
00062   if(scmgn!=StatusCode::SUCCESS) { 
00063     std::cout<< "Unable to open Magnetic field service"<<std::endl;
00064   }
00065   m_bField = 10000*(m_pmgnIMF->getReferField());
00066   m_alpha = 10000. / 2.99792458 / m_bField;
00067   // m_alpha = 10000. / 2.99792458 / m_bField;
00068   // m_alpha = 333.564095;
00069   updateCache();
00070 }

Ext_Helix::Ext_Helix ( const HepPoint3D pivot,
const HepVector &  a 
)

Constructor without error matrix.

Definition at line 72 of file Helix.cxx.

References IMagneticFieldSvc::getReferField(), m_alpha, m_bField, m_pmgnIMF, and updateCache().

00074   : //m_bField(-10.0),
00075   //m_alpha(-333.564095),
00076   m_pivot(pivot),
00077   m_a(a),
00078   m_matrixValid(false),
00079   m_Ea(HepSymMatrix(5,0)) {
00080   StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 
00081   if(scmgn!=StatusCode::SUCCESS) { 
00082     // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq; 
00083     std::cout<< "Unable to open Magnetic field service"<<std::endl;
00084   }
00085   m_bField = 10000*(m_pmgnIMF->getReferField());
00086   m_alpha = 10000. / 2.99792458 / m_bField;
00087     // m_alpha = 333.564095;
00088  //cout<<"MdcFastTrakAlg:: bField,alpha: "<<m_bField<<" , "<<m_alpha<<endl;
00089     updateCache();
00090 }

Ext_Helix::Ext_Helix ( const HepPoint3D position,
const Hep3Vector &  momentum,
double  charge 
)

Constructor with position, momentum, and charge.

Definition at line 92 of file Helix.cxx.

References DBL_MAX, IMagneticFieldSvc::getReferField(), m_a, m_alpha, m_bField, M_PI2, M_PI4, m_pmgnIMF, and updateCache().

00095   : //m_bField(-10.0),
00096   //m_alpha(-333.564095),
00097   m_pivot(position),
00098   m_a(HepVector(5,0)),
00099   m_matrixValid(false),
00100   m_Ea(HepSymMatrix(5,0)) {
00101   StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 
00102   if(scmgn!=StatusCode::SUCCESS) { 
00103     // log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq; 
00104     std::cout<< "Unable to open Magnetic field service"<<std::endl;
00105   }
00106   m_bField = 10000*(m_pmgnIMF->getReferField());
00107   m_alpha = 10000. / 2.99792458 / m_bField;
00108   
00109   m_a[0] = 0.;
00110     m_a[1] = fmod(atan2(- momentum.x(), momentum.y())
00111                   + M_PI4, M_PI2);
00112     m_a[3] = 0.;
00113     double perp(momentum.perp());
00114     if (perp != 0.0) {
00115         m_a[2] = charge / perp;
00116         m_a[4] = momentum.z() / perp; 
00117     }
00118     else {
00119         m_a[2] = charge * (DBL_MAX);
00120         if (momentum.z() >= 0) {
00121             m_a[4] = (DBL_MAX);
00122         } else {
00123             m_a[4] = -(DBL_MAX);
00124         }
00125     }
00126     // m_alpha = 333.564095;
00127     updateCache();
00128 }

Ext_Helix::~Ext_Helix (  )  [virtual]

Destructor.

Definition at line 130 of file Helix.cxx.

00130                       {
00131 }


Member Function Documentation

const HepVector & Ext_Helix::a ( const HepVector &  newA  )  [inline]

sets helix parameters.

Definition at line 255 of file Helix.h.

References m_a, and updateCache().

00255                                 {
00256     m_a = i;
00257     updateCache();
00258     return m_a;
00259 }

const HepVector & Ext_Helix::a ( void   )  const [inline]

returns helix parameters.

Definition at line 243 of file Helix.h.

References m_a.

00243                        {
00244     return m_a;
00245 }

double Ext_Helix::bFieldZ ( void   )  const [inline]

Definition at line 278 of file Helix.h.

References m_bField.

00278                              {
00279     return m_bField;
00280 }

double Ext_Helix::bFieldZ ( double   )  [inline]

sets/returns z componet of the magnetic field.

Definition at line 269 of file Helix.h.

References m_alpha, m_bField, and updateCache().

00269                            {
00270     m_bField = a;
00271     m_alpha = 10000. / 2.99792458 / m_bField;
00272     updateCache();
00273     return m_bField;
00274 }

const HepPoint3D & Ext_Helix::center ( void   )  const [inline]

returns position of helix center(z = 0.);

Definition at line 183 of file Helix.h.

References m_center.

00183                             {
00184     return m_center;
00185 }

double Ext_Helix::cosPhi0 ( void   )  const [inline]

Definition at line 290 of file Helix.h.

References m_cp.

00290                              {
00291     return m_cp;
00292 }

double Ext_Helix::curv ( void   )  const [inline]

Definition at line 237 of file Helix.h.

References m_r.

00237                           {
00238     return m_r;
00239 }

HepMatrix Ext_Helix::del4MDelA ( double  phi,
double  mass 
) const

Definition at line 602 of file Helix.cxx.

References cos(), DBL_MAX, m_ac, phi0(), and sin().

Referenced by momentum().

00602                                                   {
00603     //
00604     //   Calculate Jacobian (@4m/@a)
00605     //   Vector a  is helix parameters and phi is internal parameter.
00606     //   Vector 4m is 4 momentum.
00607     //
00608 
00609     HepMatrix d4MDA(4,5,0);
00610 
00611     double phi0 = m_ac[1];
00612     double cpa  = m_ac[2];
00613     double tnl  = m_ac[4];
00614 
00615     double cosf0phi = cos(phi0+phi);
00616     double sinf0phi = sin(phi0+phi);
00617 
00618     double rho;
00619     if(cpa != 0.)rho = 1./cpa;
00620     else rho = (DBL_MAX);
00621 
00622     double charge = 1.;
00623     if(cpa < 0.)charge = -1.;
00624 
00625     double E = sqrt(rho*rho*(1.+tnl*tnl)+mass*mass);
00626 
00627     d4MDA[0][1] = -fabs(rho)*cosf0phi;
00628     d4MDA[0][2] = charge*rho*rho*sinf0phi;
00629  
00630     d4MDA[1][1] = -fabs(rho)*sinf0phi;
00631     d4MDA[1][2] = -charge*rho*rho*cosf0phi;
00632 
00633     d4MDA[2][2] = -charge*rho*rho*tnl;
00634     d4MDA[2][4] = fabs(rho);
00635 
00636     if (cpa != 0.0 && E != 0.0) {
00637       d4MDA[3][2] = (-1.-tnl*tnl)/(cpa*cpa*cpa*E);
00638       d4MDA[3][4] = tnl/(cpa*cpa*E);
00639     } else {
00640       d4MDA[3][2] = (DBL_MAX);
00641       d4MDA[3][4] = (DBL_MAX);
00642     }
00643     return d4MDA;
00644 }

HepMatrix Ext_Helix::del4MXDelA ( double  phi,
double  mass 
) const

Definition at line 648 of file Helix.cxx.

References cos(), DBL_MAX, dr(), dz(), m_ac, m_cp, m_r, m_sp, phi0(), and sin().

Referenced by momentum().

00648                                                    {
00649     //
00650     //   Calculate Jacobian (@4mx/@a)
00651     //   Vector a  is helix parameters and phi is internal parameter.
00652     //   Vector 4xm is 4 momentum and position.
00653     //
00654 
00655     HepMatrix d4MXDA(7,5,0);
00656 
00657     const double & dr      = m_ac[0];
00658     const double & phi0    = m_ac[1];
00659     const double & cpa     = m_ac[2];
00660     const double & dz      = m_ac[3];
00661     const double & tnl     = m_ac[4];
00662 
00663     double cosf0phi = cos(phi0+phi);
00664     double sinf0phi = sin(phi0+phi);
00665 
00666     double rho;
00667     if(cpa != 0.)rho = 1./cpa;
00668     else rho = (DBL_MAX);
00669 
00670     double charge = 1.;
00671     if(cpa < 0.)charge = -1.;
00672 
00673     double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
00674 
00675     d4MXDA[0][1] = - fabs(rho) * cosf0phi;
00676     d4MXDA[0][2] = charge * rho * rho * sinf0phi;
00677  
00678     d4MXDA[1][1] = - fabs(rho) * sinf0phi;
00679     d4MXDA[1][2] = - charge * rho * rho * cosf0phi;
00680 
00681     d4MXDA[2][2] = - charge * rho * rho * tnl;
00682     d4MXDA[2][4] = fabs(rho);
00683 
00684     if (cpa != 0.0 && E != 0.0) {
00685       d4MXDA[3][2] = (- 1. - tnl * tnl) / (cpa * cpa * cpa * E);
00686       d4MXDA[3][4] = tnl / (cpa * cpa * E);
00687     } else {
00688       d4MXDA[3][2] = (DBL_MAX);
00689       d4MXDA[3][4] = (DBL_MAX);
00690     }
00691     
00692     d4MXDA[4][0] = m_cp;
00693     d4MXDA[4][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
00694     if (cpa != 0.0) {
00695       d4MXDA[4][2] = - (m_r / cpa) * (m_cp - cosf0phi);
00696     } else {
00697       d4MXDA[4][2] = (DBL_MAX);
00698     }
00699      
00700     d4MXDA[5][0] = m_sp;
00701     d4MXDA[5][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
00702     if (cpa != 0.0) {
00703       d4MXDA[5][2] = - (m_r / cpa) * (m_sp - sinf0phi);
00704 
00705       d4MXDA[6][2] = (m_r / cpa) * tnl * phi;
00706     } else {
00707       d4MXDA[5][2] = (DBL_MAX);
00708 
00709       d4MXDA[6][2] = (DBL_MAX);
00710     }
00711 
00712     d4MXDA[6][3] = 1.;
00713     d4MXDA[6][4] = - m_r * phi;
00714 
00715     return d4MXDA;
00716 }

HepMatrix Ext_Helix::delApDelA ( const HepVector &  ap  )  const

Definition at line 443 of file Helix.cxx.

References cos(), DBL_MAX, dr(), dz(), m_ac, M_PI, M_PI2, M_PI8, m_r, phi0(), and sin().

Referenced by pivot().

00443                                                {
00444     //
00445     //   Calculate Jacobian (@ap/@a)
00446     //   Vector ap is new helix parameters and a is old helix parameters. 
00447     //
00448 
00449     HepMatrix dApDA(5,5,0);
00450 
00451     const double & dr    = m_ac[0];
00452     const double & phi0  = m_ac[1];
00453     const double & cpa   = m_ac[2];
00454     const double & dz    = m_ac[3];
00455     const double & tnl   = m_ac[4];
00456 
00457     double drp   = ap[0];
00458     double phi0p = ap[1];
00459     double cpap  = ap[2];
00460     double dzp   = ap[3];
00461     double tnlp  = ap[4];
00462 
00463     double rdr   = m_r + dr;
00464     double rdrpr;
00465     if ((m_r + drp) != 0.0) {
00466       rdrpr = 1. / (m_r + drp);
00467     } else {
00468       rdrpr = (DBL_MAX);
00469     }
00470     // double csfd  = cos(phi0)*cos(phi0p) + sin(phi0)*sin(phi0p); 
00471     // double snfd  = cos(phi0)*sin(phi0p) - sin(phi0)*cos(phi0p); 
00472     double csfd  = cos(phi0p - phi0);
00473     double snfd  = sin(phi0p - phi0);
00474     double phid  = fmod(phi0p - phi0 + M_PI8, M_PI2);
00475     if (phid > M_PI) phid = phid - M_PI2;
00476 
00477     dApDA[0][0]  =  csfd;
00478     dApDA[0][1]  =  rdr*snfd;
00479     if(cpa!=0.0) {
00480       dApDA[0][2]  =  (m_r/cpa)*( 1.0 - csfd );
00481     } else {
00482       dApDA[0][2]  = (DBL_MAX);
00483     }
00484 
00485     dApDA[1][0]  = - rdrpr*snfd;
00486     dApDA[1][1]  = rdr*rdrpr*csfd;
00487     if(cpa!=0.0) {
00488       dApDA[1][2]  = (m_r/cpa)*rdrpr*snfd;
00489     } else {
00490       dApDA[1][2]  = (DBL_MAX);
00491     }
00492     
00493     dApDA[2][2]  = 1.0;
00494 
00495     dApDA[3][0]  = m_r*rdrpr*tnl*snfd;
00496     dApDA[3][1]  = m_r*tnl*(1.0 - rdr*rdrpr*csfd);
00497     if(cpa!=0.0) {
00498       dApDA[3][2]  = (m_r/cpa)*tnl*(phid - m_r*rdrpr*snfd);
00499     } else {
00500       dApDA[3][2]  = (DBL_MAX);
00501     }
00502     dApDA[3][3]  = 1.0;
00503     dApDA[3][4]  = - m_r*phid;
00504 
00505     dApDA[4][4] = 1.0;
00506  
00507     return dApDA;
00508 }

HepMatrix Ext_Helix::delMDelA ( double  phi  )  const

Definition at line 565 of file Helix.cxx.

References cos(), DBL_MAX, m_ac, phi0(), and sin().

Referenced by momentum().

00565                                     {
00566     //
00567     //   Calculate Jacobian (@m/@a)
00568     //   Vector a is helix parameters and phi is internal parameter.
00569     //   Vector m is momentum.
00570     //
00571 
00572     HepMatrix dMDA(3,5,0);
00573 
00574     const double & phi0 = m_ac[1];
00575     const double & cpa  = m_ac[2];
00576     const double & tnl  = m_ac[4];
00577 
00578     double cosf0phi = cos(phi0+phi);
00579     double sinf0phi = sin(phi0+phi);
00580 
00581     double rho;
00582     if(cpa != 0.)rho = 1./cpa;
00583     else rho = (DBL_MAX);
00584 
00585     double charge = 1.;
00586     if(cpa < 0.)charge = -1.;
00587 
00588     dMDA[0][1] = -fabs(rho)*cosf0phi;
00589     dMDA[0][2] = charge*rho*rho*sinf0phi;
00590  
00591     dMDA[1][1] = -fabs(rho)*sinf0phi;
00592     dMDA[1][2] = -charge*rho*rho*cosf0phi;
00593 
00594     dMDA[2][2] = -charge*rho*rho*tnl;
00595     dMDA[2][4] = fabs(rho);
00596 
00597     return dMDA;
00598 }

HepMatrix Ext_Helix::delXDelA ( double  phi  )  const

Definition at line 511 of file Helix.cxx.

References cos(), DBL_MAX, dr(), dz(), m_ac, m_cp, m_r, m_sp, phi0(), and sin().

Referenced by x().

00511                                     {
00512     //
00513     //   Calculate Jacobian (@x/@a)
00514     //   Vector a is helix parameters and phi is internal parameter
00515     //   which specifys the point to be calculated for Ex(phi).
00516     //
00517 
00518     HepMatrix dXDA(3,5,0);
00519 
00520     const double & dr      = m_ac[0];
00521     const double & phi0    = m_ac[1];
00522     const double & cpa     = m_ac[2];
00523     const double & dz      = m_ac[3];
00524     const double & tnl     = m_ac[4];
00525 
00526     double cosf0phi = cos(phi0 + phi);
00527     double sinf0phi = sin(phi0 + phi);
00528 
00529     dXDA[0][0]     = m_cp;
00530     dXDA[0][1]     = - dr * m_sp + m_r * (- m_sp + sinf0phi); 
00531     if(cpa!=0.0) {
00532       dXDA[0][2]     = - (m_r / cpa) * (m_cp - cosf0phi);
00533     } else {
00534       dXDA[0][2] = (DBL_MAX);
00535     }
00536     // dXDA[0][3]     = 0.0;
00537     // dXDA[0][4]     = 0.0;
00538  
00539     dXDA[1][0]     = m_sp;
00540     dXDA[1][1]     = dr * m_cp + m_r * (m_cp - cosf0phi);
00541     if(cpa!=0.0) {
00542       dXDA[1][2]     = - (m_r / cpa) * (m_sp - sinf0phi);
00543     } else {
00544       dXDA[1][2] = (DBL_MAX);
00545     }
00546     // dXDA[1][3]     = 0.0;
00547     // dXDA[1][4]     = 0.0;
00548 
00549     // dXDA[2][0]     = 0.0;
00550     // dXDA[2][1]     = 0.0;
00551     if(cpa!=0.0) {
00552       dXDA[2][2]     = (m_r / cpa) * tnl * phi;
00553     } else {
00554       dXDA[2][2] = (DBL_MAX);
00555     }
00556     dXDA[2][3]     = 1.0;
00557     dXDA[2][4]     = - m_r * phi;
00558 
00559     return dXDA;
00560 }

Hep3Vector Ext_Helix::direction ( double  dPhi = 0.  )  const [inline]

returns direction vector after rotating angle dPhi in phi direction.

Definition at line 201 of file Helix.h.

References momentum().

00201                                      {
00202     return momentum(phi).unit();
00203 }

double Ext_Helix::dr ( void   )  const [inline]

returns an element of parameters.

Definition at line 207 of file Helix.h.

References m_ac.

Referenced by del4MXDelA(), delApDelA(), delXDelA(), and pivot().

00207                         {
00208     return m_ac[0];
00209 }

double Ext_Helix::dz ( void   )  const [inline]

Definition at line 225 of file Helix.h.

References m_ac.

Referenced by del4MXDelA(), delApDelA(), delXDelA(), and pivot().

00225                         {
00226     return m_ac[3];
00227 }

const HepSymMatrix & Ext_Helix::Ea ( const HepSymMatrix &  newdA  )  [inline]

sets helix paramters and error matrix.

Definition at line 263 of file Helix.h.

References m_Ea.

00263                                     {
00264     return m_Ea = i;
00265 }

const HepSymMatrix & Ext_Helix::Ea ( void   )  const [inline]

returns error matrix.

Definition at line 249 of file Helix.h.

References m_Ea.

Referenced by ExtMdcTrack::GetErrorMatrix().

00249                         {
00250     return m_Ea;
00251 }

void Ext_Helix::ignoreErrorMatrix ( void   ) 

unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.

Definition at line 719 of file Helix.cxx.

References m_Ea, and m_matrixValid.

00719                                  {
00720     m_matrixValid = false;
00721     m_Ea *= 0.;
00722 }

double Ext_Helix::kappa ( void   )  const [inline]

Definition at line 219 of file Helix.h.

References m_ac.

Referenced by ExtMdcTrack::GetErrorMatrix(), and pivot().

00219                            {
00220     return m_ac[2];
00221 }

HepLorentzVector Ext_Helix::momentum ( double  dPhi,
double  mass,
HepPoint3D x,
HepSymMatrix &  Emx 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 280 of file Helix.cxx.

References cos(), del4MXDelA(), m_ac, m_cp, m_Ea, m_matrixValid, m_pivot, m_pt, m_r, m_sp, and sin().

00283                                           {
00284   // 
00285   // Calculate momentum.
00286   //
00287   // Pt = | 1/kappa | (GeV/c)
00288   //
00289   // Px = -Pt * sin(phi0 + phi) 
00290   // Py =  Pt * cos(phi0 + phi)
00291   // Pz =  Pt * tan(lambda)
00292   //
00293   // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00294   
00295   double pt = fabs(m_pt);
00296   double px = - pt * sin(m_ac[1] + phi);
00297   double py =   pt * cos(m_ac[1] + phi);
00298   double pz =   pt * m_ac[4];
00299   double E  = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
00300 
00301   x.setX(m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi)));
00302   x.setY(m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi)));
00303   x.setZ(m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi);
00304 
00305   if (m_matrixValid) Emx = m_Ea.similarity(del4MXDelA(phi,mass));
00306   else               Emx = m_Ea;
00307   
00308   return HepLorentzVector(px, py, pz, E);
00309 }

HepLorentzVector Ext_Helix::momentum ( double  dPhi,
double  mass,
HepSymMatrix &  Em 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 255 of file Helix.cxx.

References cos(), del4MDelA(), m_ac, m_Ea, m_matrixValid, m_pt, and sin().

00255                                                                     {
00256     // 
00257     // Calculate momentum.
00258     //
00259     // Pt = | 1/kappa | (GeV/c)
00260     //
00261     // Px = -Pt * sin(phi0 + phi) 
00262     // Py =  Pt * cos(phi0 + phi)
00263     // Pz =  Pt * tan(lambda)
00264     //
00265     // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00266 
00267     double pt = fabs(m_pt);
00268     double px = - pt * sin(m_ac[1] + phi);
00269     double py =   pt * cos(m_ac[1] + phi);
00270     double pz =   pt * m_ac[4];
00271     double E  =   sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
00272 
00273     if (m_matrixValid) Em = m_Ea.similarity(del4MDelA(phi,mass));
00274     else               Em = m_Ea;
00275 
00276     return HepLorentzVector(px, py, pz, E);
00277 }

HepLorentzVector Ext_Helix::momentum ( double  dPhi,
double  mass 
) const

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 232 of file Helix.cxx.

References cos(), m_ac, m_pt, and sin().

00232                                                  {
00233     // 
00234     // Calculate momentum.
00235     //
00236     // Pt = | 1/kappa | (GeV/c)
00237     //
00238     // Px = -Pt * sin(phi0 + phi) 
00239     // Py =  Pt * cos(phi0 + phi)
00240     // Pz =  Pt * tan(lambda)
00241     //
00242     // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00243 
00244     double pt = fabs(m_pt);
00245     double px = - pt * sin(m_ac[1] + phi);
00246     double py =   pt * cos(m_ac[1] + phi);
00247     double pz =   pt * m_ac[4];
00248     double E  =   sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
00249 
00250     return HepLorentzVector(px, py, pz, E);
00251 }

Hep3Vector Ext_Helix::momentum ( double  dPhi,
HepSymMatrix &  Em 
) const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 209 of file Helix.cxx.

References cos(), delMDelA(), m_ac, m_Ea, m_matrixValid, m_pt, and sin().

00209                                                        {
00210     // 
00211     // Calculate momentum.
00212     //
00213     // Pt = | 1/kappa | (GeV/c)
00214     //
00215     // Px = -Pt * sin(phi0 + phi) 
00216     // Py =  Pt * cos(phi0 + phi)
00217     // Pz =  Pt * tan(lambda)
00218     //
00219 
00220     double pt = fabs(m_pt);
00221     double px = - pt * sin(m_ac[1] + phi);
00222     double py =   pt * cos(m_ac[1] + phi);
00223     double pz =   pt * m_ac[4];
00224 
00225     if (m_matrixValid) Em = m_Ea.similarity(delMDelA(phi));
00226     else               Em = m_Ea;
00227 
00228     return Hep3Vector(px, py, pz);
00229 }

Hep3Vector Ext_Helix::momentum ( double  dPhi = 0.  )  const

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 189 of file Helix.cxx.

References cos(), m_ac, m_pt, and sin().

Referenced by direction(), ExtMdcTrack::GetErrorMatrix(), and ExtMdcTrack::GetMomentum().

00189                                     {
00190     // 
00191     // Calculate momentum.
00192     //
00193     // Pt = | 1/kappa | (GeV/c)
00194     //
00195     // Px = -Pt * sin(phi0 + phi) 
00196     // Py =  Pt * cos(phi0 + phi)
00197     // Pz =  Pt * tan(lambda)
00198     //
00199 
00200     double pt = fabs(m_pt);
00201     double px = - pt * sin(m_ac[1] + phi);
00202     double py =   pt * cos(m_ac[1] + phi);
00203     double pz =   pt * m_ac[4];
00204 
00205     return Hep3Vector(px, py, pz);
00206 }

Ext_Helix & Ext_Helix::operator= ( const Ext_Helix  ) 

Copy operator.

Definition at line 385 of file Helix.cxx.

References genRecEmupikp::i, m_a, m_ac, m_alpha, m_bField, m_center, m_cp, m_Ea, m_matrixValid, m_pivot, m_pt, m_r, and m_sp.

00385                                           {
00386     if (this == & i) return * this;
00387 
00388     m_bField = i.m_bField;
00389     m_alpha = i.m_alpha;
00390     m_pivot = i.m_pivot;
00391     m_a = i.m_a;
00392     m_Ea = i.m_Ea;
00393     m_matrixValid = i.m_matrixValid;
00394 
00395     m_center = i.m_center;
00396     m_cp = i.m_cp;
00397     m_sp = i.m_sp;
00398     m_pt = i.m_pt;
00399     m_r  = i.m_r;
00400     m_ac[0] = i.m_ac[0];
00401     m_ac[1] = i.m_ac[1];
00402     m_ac[2] = i.m_ac[2];
00403     m_ac[3] = i.m_ac[3];
00404     m_ac[4] = i.m_ac[4];
00405 
00406     return * this;
00407 }

double Ext_Helix::phi0 ( void   )  const [inline]

Definition at line 213 of file Helix.h.

References m_ac.

Referenced by del4MDelA(), del4MXDelA(), delApDelA(), delMDelA(), delXDelA(), ExtMdcTrack::GetErrorMatrix(), and pivot().

00213                           {
00214     return m_ac[1];
00215 }

const HepPoint3D & Ext_Helix::pivot ( const HepPoint3D newPivot  ) 

sets pivot position.

Definition at line 313 of file Helix.cxx.

References cos(), delApDelA(), dr(), dz(), kappa(), m_a, m_ac, m_Ea, m_matrixValid, M_PI, M_PI2, M_PI4, M_PI8, m_pivot, m_r, phi0(), tanl(), and updateCache().

00313                                             {
00314     const double & dr    = m_ac[0];
00315     const double & phi0  = m_ac[1];
00316     const double & kappa = m_ac[2];
00317     const double & dz    = m_ac[3];
00318     const double & tanl  = m_ac[4];
00319 
00320     double rdr = dr + m_r;
00321     double phi = fmod(phi0 + M_PI4, M_PI2);
00322     double csf0 = cos(phi);
00323     double snf0 = (1. - csf0) * (1. + csf0);
00324     snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
00325     if(phi > M_PI) snf0 = - snf0;
00326 
00327     double xc = m_pivot.x() + rdr * csf0;
00328     double yc = m_pivot.y() + rdr * snf0;
00329     double csf, snf;
00330     if(m_r != 0.0) {
00331       csf = (xc - newPivot.x()) / m_r;
00332       snf = (yc - newPivot.y()) / m_r;
00333       double anrm = sqrt(csf * csf + snf * snf);
00334       if(anrm != 0.0) {
00335         csf /= anrm;
00336         snf /= anrm;
00337         phi = atan2(snf, csf);
00338       } else {
00339         csf = 1.0;
00340         snf = 0.0;
00341         phi = 0.0;
00342       }
00343     } else {
00344       csf = 1.0;
00345       snf = 0.0;
00346       phi = 0.0;
00347     }
00348     double phid = fmod(phi - phi0 + M_PI8, M_PI2);
00349     if(phid > M_PI) phid = phid - M_PI2;
00350     double drp = (m_pivot.x() + dr * csf0 + m_r * (csf0 - csf) - newPivot.x())
00351         * csf
00352         + (m_pivot.y() + dr * snf0 + m_r * (snf0 - snf) - newPivot.y()) * snf;
00353     double dzp = m_pivot.z() + dz - m_r * tanl * phid - newPivot.z();
00354 
00355     HepVector ap(5);
00356     ap[0] = drp;
00357     ap[1] = fmod(phi + M_PI4, M_PI2);
00358     ap[2] = kappa;
00359     ap[3] = dzp;
00360     ap[4] = tanl;
00361 
00362     //    if (m_matrixValid) m_Ea.assign(delApDelA(ap) * m_Ea * delApDelA(ap).T());
00363     if (m_matrixValid) m_Ea = m_Ea.similarity(delApDelA(ap));
00364 
00365     m_a = ap;
00366     m_pivot = newPivot;
00367 
00368     //...Are these needed?...iw...
00369     updateCache();
00370     return m_pivot;
00371 }

const HepPoint3D & Ext_Helix::pivot ( void   )  const [inline]

returns pivot position.

Definition at line 189 of file Helix.h.

References m_pivot.

00189                            {
00190     return m_pivot;
00191 }

double Ext_Helix::radius ( void   )  const [inline]

returns radious of helix.

Definition at line 195 of file Helix.h.

References m_r.

Referenced by ExtMdcTrack::GetTrackLength().

00195                             {
00196     return m_r;
00197 }

void Ext_Helix::set ( const HepPoint3D pivot,
const HepVector &  a,
const HepSymMatrix &  Ea 
)

sets helix pivot position, parameters, and error matrix.

Definition at line 374 of file Helix.cxx.

References m_a, m_Ea, m_matrixValid, m_pivot, and updateCache().

00376                                     {
00377     m_pivot = pivot;
00378     m_a = a;
00379     m_Ea = Ea;
00380     m_matrixValid = true;
00381     updateCache();
00382 }

double Ext_Helix::sinPhi0 ( void   )  const [inline]

Definition at line 284 of file Helix.h.

References m_sp.

00284                              {
00285     return m_sp;
00286 }

double Ext_Helix::tanl ( void   )  const [inline]

Definition at line 231 of file Helix.h.

References m_ac.

Referenced by ExtMdcTrack::GetTrackLength(), and pivot().

00231                           {
00232     return m_ac[4];
00233 }

void Ext_Helix::updateCache ( void   )  [private]

Definition at line 410 of file Helix.cxx.

References cos(), DBL_MAX, m_a, m_ac, m_alpha, m_center, m_cp, m_pivot, m_pt, m_r, m_sp, sin(), and x().

Referenced by a(), bFieldZ(), Ext_Helix(), pivot(), and set().

00410                            {
00411     //
00412     //   Calculate Ext_Helix center( xc, yc ).
00413     //   
00414     //   xc = x0 + (dr + (alpha / kappa)) * cos(phi0)  (cm)
00415     //   yc = y0 + (dr + (alpha / kappa)) * sin(phi0)  (cm)
00416     //
00417 
00418     m_ac[0] = m_a[0];
00419     m_ac[1] = m_a[1];
00420     m_ac[2] = m_a[2];
00421     m_ac[3] = m_a[3];
00422     m_ac[4] = m_a[4];
00423 
00424     m_cp = cos(m_ac[1]);
00425     m_sp = sin(m_ac[1]);
00426     if (m_ac[2] != 0.0) {
00427         m_pt = 1. / m_ac[2];
00428         m_r = m_alpha / m_ac[2];
00429     }
00430     else {
00431         m_pt = (DBL_MAX);
00432         m_r = (DBL_MAX);
00433     }
00434 
00435     double x = m_pivot.x() + (m_ac[0] + m_r) * m_cp;
00436     double y = m_pivot.y() + (m_ac[0] + m_r) * m_sp;
00437     m_center.setX(x);
00438     m_center.setY(y);
00439     m_center.setZ(0.);
00440 }

HepPoint3D Ext_Helix::x ( double  dPhi,
HepSymMatrix &  Ex 
) const

returns position and convariance matrix(Ex) after rotation.

Definition at line 168 of file Helix.cxx.

References cos(), delXDelA(), m_ac, m_cp, m_Ea, m_matrixValid, m_pivot, m_r, m_sp, sin(), and x().

00168                                                 {
00169     double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
00170     double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
00171     double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00172 
00173     //
00174     //   Calculate position error matrix.
00175     //   Ex(phi) = (@x/@a)(Ea)(@x/@a)^T, phi is deflection angle to specify the
00176     //   point to be calcualted.
00177     //
00178     // HepMatrix dXDA(3, 5, 0);
00179     // dXDA = delXDelA(phi);
00180     // Ex.assign(dXDA * m_Ea * dXDA.T());
00181 
00182     if (m_matrixValid) Ex = m_Ea.similarity(delXDelA(phi));
00183     else               Ex = m_Ea;
00184 
00185     return HepPoint3D(x, y, z);
00186 }

double * Ext_Helix::x ( double  dPhi,
double  p[3] 
) const

Definition at line 151 of file Helix.cxx.

References cos(), m_ac, m_cp, m_pivot, m_r, m_sp, and sin().

00151                                           {
00152     //
00153     // Calculate position (x,y,z) along helix.
00154     //   
00155     // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
00156     // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
00157     // z = z0 + dz             - (alpha / kappa) * tan(lambda) * phi
00158     //
00159 
00160     p[0] = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
00161     p[1] = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
00162     p[2] = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00163 
00164     return p;
00165 }

HepPoint3D Ext_Helix::x ( double  dPhi = 0.  )  const

returns position after rotating angle dPhi in phi direction.

Definition at line 134 of file Helix.cxx.

References cos(), m_ac, m_cp, m_pivot, m_r, m_sp, and sin().

Referenced by ExtMdcTrack::GetErrorMatrix(), ExtMdcTrack::GetPosition(), updateCache(), and x().

00134                              {
00135     //
00136     // Calculate position (x,y,z) along helix.
00137     //   
00138     // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
00139     // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
00140     // z = z0 + dz             - (alpha / kappa) * tan(lambda) * phi
00141     //
00142 
00143     double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
00144     double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
00145     double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00146 
00147     return HepPoint3D(x, y, z);
00148 }


Member Data Documentation

const double Ext_Helix::ConstantAlpha [static]

Constant alpha for uniform field.

Definition at line 151 of file Helix.h.

HepVector Ext_Helix::m_a [private]

Definition at line 157 of file Helix.h.

Referenced by a(), Ext_Helix(), operator=(), pivot(), set(), and updateCache().

double Ext_Helix::m_ac[5] [private]

Definition at line 167 of file Helix.h.

Referenced by del4MDelA(), del4MXDelA(), delApDelA(), delMDelA(), delXDelA(), dr(), dz(), kappa(), momentum(), operator=(), phi0(), pivot(), tanl(), updateCache(), and x().

double Ext_Helix::m_alpha [private]

Definition at line 155 of file Helix.h.

Referenced by bFieldZ(), Ext_Helix(), operator=(), and updateCache().

double Ext_Helix::m_bField [private]

Definition at line 154 of file Helix.h.

Referenced by bFieldZ(), Ext_Helix(), and operator=().

HepPoint3D Ext_Helix::m_center [private]

Definition at line 162 of file Helix.h.

Referenced by center(), operator=(), and updateCache().

double Ext_Helix::m_cp [private]

Definition at line 163 of file Helix.h.

Referenced by cosPhi0(), del4MXDelA(), delXDelA(), momentum(), operator=(), updateCache(), and x().

HepSymMatrix Ext_Helix::m_Ea [private]

Definition at line 158 of file Helix.h.

Referenced by Ea(), ignoreErrorMatrix(), momentum(), operator=(), pivot(), set(), and x().

bool Ext_Helix::m_matrixValid [private]

Definition at line 159 of file Helix.h.

Referenced by ignoreErrorMatrix(), momentum(), operator=(), pivot(), set(), and x().

HepPoint3D Ext_Helix::m_pivot [private]

Definition at line 156 of file Helix.h.

Referenced by momentum(), operator=(), pivot(), set(), updateCache(), and x().

IMagneticFieldSvc* Ext_Helix::m_pmgnIMF [private]

Definition at line 144 of file Helix.h.

Referenced by Ext_Helix().

double Ext_Helix::m_pt [private]

Definition at line 165 of file Helix.h.

Referenced by momentum(), operator=(), and updateCache().

double Ext_Helix::m_r [private]

Definition at line 166 of file Helix.h.

Referenced by curv(), del4MXDelA(), delApDelA(), delXDelA(), momentum(), operator=(), pivot(), radius(), updateCache(), and x().

double Ext_Helix::m_sp [private]

Definition at line 164 of file Helix.h.

Referenced by del4MXDelA(), delXDelA(), momentum(), operator=(), sinPhi0(), updateCache(), and x().


Generated on Tue Nov 29 23:19:33 2016 for BOSS_7.0.2 by  doxygen 1.4.7