Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

HelixTraj Class Reference

#include <HelixTraj.h>

Inheritance diagram for HelixTraj:

TrkSimpTraj TrkSimpTraj TrkKalDeriv TrkDifTraj TrkKalDeriv TrkDifTraj TrkKalDeriv TrkDifTraj TrkKalDeriv TrkDifTraj List of all members.

Public Types

enum  { NHLXPRM = 5 }
enum  { NHLXPRM = 5 }
enum  ParIndex {
  d0Index = 0, phi0Index, omegaIndex, z0Index,
  tanDipIndex
}
enum  ParIndex {
  d0Index = 0, phi0Index, omegaIndex, z0Index,
  tanDipIndex
}

Public Member Functions

void changePoint (const HepPoint3D &newpoint, double &fltlen)
void changePoint (const HepPoint3D &newpoint, double &fltlen)
HelixTrajclone () const
HelixTrajclone () const
double curvature (double fltLen) const
double curvature (double fltLen) const
double d0 () const
double d0 () const
virtual Hep3Vector delDirect (double) const
virtual Hep3Vector delDirect (double) const
HepMatrix derivDeflect (double fltlen, deflectDirection) const
HepMatrix derivDeflect (double fltlen, deflectDirection) const
HepMatrix derivDisplace (double fltlen, deflectDirection idir) const
HepMatrix derivDisplace (double fltlen, deflectDirection idir) const
HepMatrix derivPFract (double fltlen) const
HepMatrix derivPFract (double fltlen) const
virtual Hep3Vector direction (double fltLen) const
virtual Hep3Vector direction (double fltLen) const
double distTo0thError (double s, double tol, int pathDir) const
double distTo0thError (double s, double tol, int pathDir) const
virtual double distTo1stError (double s, double tol, int pathDir) const
virtual double distTo1stError (double s, double tol, int pathDir) const
virtual double distTo2ndError (double s, double tol, int pathDir) const
virtual double distTo2ndError (double s, double tol, int pathDir) const
virtual void getDFInfo (double fltLen, DifPoint &, DifVector &dir, DifVector &delDir) const
virtual void getDFInfo (double fltLen, DifPoint &, DifVector &dir, DifVector &delDir) const
virtual void getDFInfo2 (double fltLen, DifPoint &pos, DifVector &dir) const
virtual void getDFInfo2 (double fltLen, DifPoint &pos, DifVector &dir) const
virtual void getInfo (double fltLen, HepPoint3D &, Hep3Vector &dir, Hep3Vector &delDir) const
virtual void getInfo (double fltLen, HepPoint3D &pos, Hep3Vector &dir) const
virtual void getInfo (double fltLen, HepPoint3D &, Hep3Vector &dir, Hep3Vector &delDir) const
virtual void getInfo (double fltLen, HepPoint3D &pos, Hep3Vector &dir) const
 HelixTraj (const HelixTraj &)
 HelixTraj (const TrkParams &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 HelixTraj (const TrkExchangePar &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 HelixTraj (const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 HelixTraj (const HelixTraj &)
 HelixTraj (const TrkParams &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 HelixTraj (const TrkExchangePar &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 HelixTraj (const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
double hiRange () const
double hiRange () const
TrkSimpTrajinvert ()
TrkSimpTrajinvert ()
void invertParams (TrkParams *params, std::vector< bool > &flags) const
void invertParams (TrkParams *params, std::vector< bool > &flags) const
virtual const TrkSimpTrajlocalTrajectory (double fltLen, double &localFlt) const
virtual const TrkSimpTrajlocalTrajectory (double fltLen, double &localFlt) const
double lowRange () const
double lowRange () const
int nPar () const
int nPar () const
double omega () const
double omega () const
HelixTrajoperator= (const HelixTraj &)
HelixTrajoperator= (const HelixTraj &)
bool operator== (const TrkSimpTraj &) const
bool operator== (const TrkSimpTraj &) const
const TrkParamsparameters () const
TrkParamsparameters ()
const TrkParamsparameters () const
TrkParamsparameters ()
TranslateParams paramFunction () const
TranslateParams paramFunction () const
double phi0 () const
double phi0 () const
virtual HepPoint3D position (double fltLen) const
virtual HepPoint3D position (double fltLen) const
virtual void print (std::ostream &os) const
virtual void print (std::ostream &os) const
virtual void printAll (std::ostream &os) const
virtual void printAll (std::ostream &os) const
double range () const
double range () const
const HepPoint3DreferencePoint () const
const HepPoint3DreferencePoint () const
virtual void setFlightRange (double newrange[2])
virtual void setFlightRange (double newrange[2])
void setPoint (const HepPoint3D &newpoint)
void setPoint (const HepPoint3D &newpoint)
double tanDip () const
double tanDip () const
bool validFlightDistance (double f, double tolerance=0.0) const
bool validFlightDistance (double f, double tolerance=0.0) const
virtual void visitAccept (TrkVisitor *vis) const
virtual void visitAccept (TrkVisitor *vis) const
double z0 () const
double z0 () const
virtual ~HelixTraj ()
virtual ~HelixTraj ()

Static Public Attributes

HepPoint3D _theOrigin

Protected Attributes

TrkParams _dtparams
HepPoint3D _refpoint
double flightrange [2]

Private Member Functions

double angle (const double &f) const
double angle (const double &f) const
double arc (const double &f) const
double arc (const double &f) const
double cosDip () const
double cosDip () const
double dip () const
double dip () const
double sinDip () const
double sinDip () const
double translen (const double &f) const
double translen (const double &f) const
double z (const double &) const
double z (const double &) const

Static Private Member Functions

void paramFunc (const HepPoint3D &oldpoint, const HepPoint3D &newpoint, const HepVector &oldpar, const HepSymMatrix &oldcov, HepVector &newpar, HepSymMatrix &newcov, double fltlen)
void paramFunc (const HepPoint3D &oldpoint, const HepPoint3D &newpoint, const HepVector &oldpar, const HepSymMatrix &oldcov, HepVector &newpar, HepSymMatrix &newcov, double fltlen)

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
NHLXPRM 
00031 {NHLXPRM = 5};

anonymous enum
 

Enumeration values:
NHLXPRM 
00031 {NHLXPRM = 5};

enum HelixTraj::ParIndex
 

Enumeration values:
d0Index 
phi0Index 
omegaIndex 
z0Index 
tanDipIndex 
00030 {d0Index=0, phi0Index, omegaIndex, z0Index, tanDipIndex}; 

enum HelixTraj::ParIndex
 

Enumeration values:
d0Index 
phi0Index 
omegaIndex 
z0Index 
tanDipIndex 
00030 {d0Index=0, phi0Index, omegaIndex, z0Index, tanDipIndex}; 


Constructor & Destructor Documentation

HelixTraj::HelixTraj const HepVector &  ,
const HepSymMatrix &  ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

00029                                                                               :
00030   TrkSimpTraj(pvec, pcov, lowlim,hilim,refpoint)
00031 {
00032   //  Make sure the dimensions of the input matrix and vector are correct
00033 
00034   if( pvec.num_row() != NHLXPRM || pcov.num_row() != NHLXPRM ){
00035     std::cout<<"ErrMsg(fatal) " 
00036       << "HelixTraj: incorrect constructor vector/matrix dimension" << std::endl;
00037       ::abort();
00038   }
00039 
00040   if (omega() == 0.0) parameters()->parameter()[omegaIndex] = 1.e-9;
00041 }

HelixTraj::HelixTraj const TrkExchangePar ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

00045                                                                               :
00046   TrkSimpTraj(inpar.params(), inpar.covariance(), lowlim,hilim,refpoint)
00047 {
00048   if (omega() == 0.0) parameters()->parameter()[omegaIndex] = 1.e-9;
00049 }

HelixTraj::HelixTraj const TrkParams ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

00052                                                                               :
00053   TrkSimpTraj(inpar, lowlim,hilim,refpoint)
00054 {
00055   assert(inpar.parameter().num_row()==NHLXPRM);
00056   if (omega() == 0.0) parameters()->parameter()[omegaIndex] = 1.e-9;
00057 }

HelixTraj::HelixTraj const HelixTraj  ) 
 

00060   : TrkSimpTraj(h.parameters()->parameter(), h.parameters()->covariance(), 
00061                 h.lowRange(),h.hiRange(),h.referencePoint())
00062 {
00063 }

HelixTraj::~HelixTraj  )  [virtual]
 

00083 {
00084 }

HelixTraj::HelixTraj const HepVector &  ,
const HepSymMatrix &  ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

HelixTraj::HelixTraj const TrkExchangePar ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

HelixTraj::HelixTraj const TrkParams ,
double  lowlim = -99999.,
double  hilim = 99999.,
const HepPoint3D refpoint = _theOrigin
 

HelixTraj::HelixTraj const HelixTraj  ) 
 

virtual HelixTraj::~HelixTraj  )  [virtual]
 


Member Function Documentation

double HelixTraj::angle const double &  f  )  const [private]
 

double HelixTraj::angle const double &  f  )  const [private]
 

00632 {
00633   return BesAngle(phi0() + arc(f));
00634 }

double HelixTraj::arc const double &  f  )  const [inline, private]
 

00108 {return translen(f)*omega();}

double HelixTraj::arc const double &  f  )  const [inline, private]
 

00108 {return translen(f)*omega();}

void TrkSimpTraj::changePoint const HepPoint3D newpoint,
double &  fltlen
[inherited]
 

void TrkSimpTraj::changePoint const HepPoint3D newpoint,
double &  fltlen
[inherited]
 

00070                                                                   {
00071 //----------------------------------------------------------------------------
00072   if(newpoint != _refpoint){
00073 //  find POCA to the new point
00074     TrkPocaXY endpoca(*this,fltlen,newpoint);
00075     if(endpoca.status().failure()){
00076       std::cout<<"ErrMsg(error)" << "poca failure changing reference point" << std::endl;
00077       return;
00078     } else {
00079 // update flight length
00080       fltlen = endpoca.flt1();
00081 // make a symmatrix from the covariance: temporary kludge
00082       int nrow = parameters()->covariance().num_row();
00083       HepSymMatrix cov(nrow);
00084       for(int irow=0;irow<nrow;irow++)
00085         for(int icol=0;icol<=irow;icol++)
00086           cov.fast(irow+1,icol+1) = parameters()->covariance().fast(irow+1,icol+1);
00087 //  Get the translation function
00088       TranslateParams pfunc = paramFunction();
00089 //  Use it on the SimpTraj parameters
00090       pfunc(_refpoint,newpoint,
00091             parameters()->parameter(),cov,
00092             _dtparams.parameter(),cov,
00093             fltlen);
00094 // put back the covariance
00095       _dtparams.covariance() = cov;
00096       _refpoint = newpoint;
00097 // update the flight range to correspond to the same range in space as before
00098       double newrange[2];
00099       newrange[0] = lowRange() - fltlen;
00100       newrange[1] = hiRange() - fltlen;
00101       setFlightRange(newrange);
00102     }
00103   }
00104   return;
00105 }

HelixTraj* HelixTraj::clone  )  const [virtual]
 

Implements TrkSimpTraj.

HelixTraj * HelixTraj::clone  )  const [virtual]
 

Implements TrkSimpTraj.

00067 {
00068   return new HelixTraj(*this);
00069 }

double HelixTraj::cosDip  )  const [inline, private]
 

00105 {return 1./sqrt(1.+tanDip()*tanDip()); }

double HelixTraj::cosDip  )  const [inline, private]
 

00105 {return 1./sqrt(1.+tanDip()*tanDip()); }

double HelixTraj::curvature double  fltLen  )  const [virtual]
 

Implements Trajectory.

double HelixTraj::curvature double  fltLen  )  const [virtual]
 

Implements Trajectory.

00500 {
00501 //  Compute the curvature as the magnitude of the 2nd derivative
00502 //  of the position function with respect to the 3-d flight distance
00503 //
00504   double cosd = cosDip();
00505 //  return sqr(cosd)*fabs(omega());
00506   return (cosd*cosd)*fabs(omega());
00507 }

double HelixTraj::d0  )  const [inline]
 

00079 {return parameters()->parameter()[d0Index];}

double HelixTraj::d0  )  const [inline]
 

00079 {return parameters()->parameter()[d0Index];}

virtual Hep3Vector HelixTraj::delDirect double   )  const [virtual]
 

Implements Trajectory.

Hep3Vector HelixTraj::delDirect double   )  const [virtual]
 

Implements Trajectory.

00124 {
00125   double ang = angle(fltLen);
00126   double cDip = cosDip();
00127   double delX = -omega() * cDip * cDip * sin(ang);
00128   double delY =  omega() * cDip * cDip * cos(ang);
00129   return Hep3Vector(delX, delY, 0.0);
00130 }

HepMatrix HelixTraj::derivDeflect double  fltlen,
deflectDirection 
const [virtual]
 

Implements TrkKalDeriv.

HepMatrix HelixTraj::derivDeflect double  fltlen,
deflectDirection 
const [virtual]
 

Implements TrkKalDeriv.

00366 {
00367 //
00368 //  This function computes the column matrix of derrivatives for the change
00369 //  in parameters for a change in the direction of a track at a point along
00370 //  its flight, holding the momentum and position constant.  The effects for
00371 //  changes in 2 perpendicular directions (theta1 = dip and
00372 //  theta2 = phi*cos(dip)) can sometimes be added, as scattering in these
00373 //  are uncorrelated.
00374 //
00375   HepMatrix ddflct(NHLXPRM,1);
00376 //
00377 //  Compute some common things
00378 //
00379   double omeg = omega();
00380   double tand = tanDip();
00381   double arcl = arc(fltlen);
00382   double dx = cos(arcl);
00383   double dy = sin(arcl);
00384   double cosd = cosDip();
00385   double darc = omeg*d0();
00386 //
00387 //  Go through the parameters
00388 //
00389   switch (idirect) {
00390   case theta1:
00391     ddflct(omegaIndex+1,1) = omeg*tand;
00392 //    ddflct(tanDipIndex+1,1) = 1.0/sqr(cosd);
00393     ddflct(tanDipIndex+1,1) = 1.0/(cosd*cosd);
00394     ddflct(d0Index+1,1) = (1-dx)*tand/omeg;
00395     ddflct(phi0Index+1,1) =  -dy*tand/(1+darc);
00396 //    ddflct(z0Index+1,1) = - translen(fltlen) - sqr(tand)*dy/(omeg*(1+darc));
00397     ddflct(z0Index+1,1) = - translen(fltlen) - (tand*tand)*dy/(omeg*(1+darc));
00398     break;
00399   case theta2:
00400     ddflct(omegaIndex+1,1) = 0;
00401     ddflct(tanDipIndex+1,1) = 0;
00402     ddflct(d0Index+1,1) = -dy/(cosd*omeg);
00403     ddflct(phi0Index+1,1) = dx/(cosd*(1+darc));
00404     ddflct(z0Index+1,1) = -tand*(1- dx/(1+darc))/(cosd*omeg);
00405     break;
00406   }
00407 
00408   return ddflct;
00409 }

HepMatrix HelixTraj::derivDisplace double  fltlen,
deflectDirection  idir
const [virtual]
 

Implements TrkKalDeriv.

HepMatrix HelixTraj::derivDisplace double  fltlen,
deflectDirection  idir
const [virtual]
 

Implements TrkKalDeriv.

00414 {
00415 //
00416 //  This function computes the column matrix of derrivatives for the change
00417 //  in parameters for a change in the position of a track at a point along
00418 //  its flight, holding the momentum and direction constant.  The effects for
00419 //  changes in 2 perpendicular directions 'theta1' = (-sin(l)cos(p),-sin(l)sin(p),cos(l)) and
00420 //  'theta2' = (-sin(p),cos(p),0).  These are by definition orthogonal and uncorrelated.
00421 //  these displacements are correlated with the angular change above
00422 //
00423   HepMatrix ddflct(NHLXPRM,1);
00424 //
00425 //  Compute some common things
00426 //
00427   double omeg = omega();
00428   double tand = tanDip();
00429   double arcl = arc(fltlen);
00430   double dx = cos(arcl);
00431   double dy = sin(arcl);
00432   double cosd = cosDip();
00433   double sind = sinDip();
00434   double darc_1 = 1.0+omeg*d0();
00435 //
00436 //  Go through the parameters
00437 //
00438   switch (idirect) {
00439   case theta1:
00440     ddflct(omegaIndex+1,1) = 0.0;
00441     ddflct(tanDipIndex+1,1) = 0.0;
00442     ddflct(d0Index+1,1) = -sind*dy;
00443     ddflct(phi0Index+1,1) = sind*dx*omeg/darc_1;
00444     ddflct(z0Index+1,1) = sind*tand*dx/darc_1 + cosd;
00445     break;
00446   case theta2:
00447     ddflct(omegaIndex+1,1) = 0;
00448     ddflct(tanDipIndex+1,1) = 0;
00449     ddflct(d0Index+1,1) = dx;
00450     ddflct(phi0Index+1,1) = dy*omeg/darc_1;
00451     ddflct(z0Index+1,1) = tand*dy/darc_1;
00452     break;
00453   }
00454 
00455   return ddflct;
00456 }

HepMatrix HelixTraj::derivPFract double  fltlen  )  const [virtual]
 

Implements TrkKalDeriv.

HepMatrix HelixTraj::derivPFract double  fltlen  )  const [virtual]
 

Implements TrkKalDeriv.

00461 {
00462 //
00463 //  This function computes the column matrix of derrivatives for the change
00464 //  in parameters from a (fractional) change in the track momentum,
00465 //  holding the direction and position constant.  The momentum change can
00466 //  come from energy loss or bfield inhomogeneities.
00467 //
00468 //  For a helix, dp/P = -domega/omega,
00469 //  dParam/d(domega/omega) = -omega*dParam/ddomega
00470 //
00471   HepMatrix dmomfrac(NHLXPRM,1);
00472 //
00473 //  Compute some common things
00474 
00475   double omeg = omega();
00476   double tand = tanDip();
00477   double tranl = translen(fltlen);
00478   double arcl = tranl*omeg;
00479   double dx = cos(arcl);
00480   double dy = sin(arcl);
00481   double darc = omeg*d0();
00482 
00483 //  Go through the parameters
00484 // omega
00485   dmomfrac(omegaIndex+1,1) = -omeg;
00486 // tanDip
00487   dmomfrac(tanDipIndex+1,1) = 0.0;
00488 // d0
00489   dmomfrac(d0Index+1,1) = -(1-dx)/omeg;
00490 // phi0
00491   dmomfrac(phi0Index+1,1) = dy/(1+darc);
00492 // z0
00493   dmomfrac(z0Index+1,1) = -tand*(tranl-dy/((1+darc)*omeg));
00494 //
00495   return dmomfrac;
00496 }

double HelixTraj::dip  )  const [inline, private]
 

00103 {return atan(tanDip());}

double HelixTraj::dip  )  const [inline, private]
 

00103 {return atan(tanDip());}

virtual Hep3Vector HelixTraj::direction double  fltLen  )  const [virtual]
 

Implements Trajectory.

Hep3Vector HelixTraj::direction double  fltLen  )  const [virtual]
 

Implements Trajectory.

00111 {
00112   // Angle formed by tangent vector after
00113   // being rotated 'arclength' around orbit.
00114   double alpha = angle( f );
00115   // Construct 3-D tangent vector of unit magnitude.
00116   double cDip = cosDip();
00117   return Hep3Vector ( cos(alpha)*cDip,
00118                       sin(alpha)*cDip,
00119                       cDip*tanDip() );
00120 }

double Trajectory::distTo0thError double  s,
double  tol,
int  pathDir
const [inherited]
 

double Trajectory::distTo0thError double  s,
double  tol,
int  pathDir
const [inherited]
 

00052 {
00053   return fabs(tolerance);
00054 }

virtual double HelixTraj::distTo1stError double  s,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

double HelixTraj::distTo1stError double  s,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

00134 {
00135 //  return sqrt(2.*tol/fabs(omega())*(1.+sqr(tanDip())));
00136   return sqrt(2.*tol/fabs(omega())*(1.+tanDip()*tanDip()));
00137 }

virtual double HelixTraj::distTo2ndError double  s,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

double HelixTraj::distTo2ndError double  s,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

00141 {
00142 //  return sqrt(1.+sqr(tanDip()))*cbrt(6.*tol/sqr(omega()));
00143   return sqrt(1.+tanDip()*tanDip())*cbrt(6.*tol/omega()*omega());
00144 }

virtual void HelixTraj::getDFInfo double  fltLen,
DifPoint ,
DifVector dir,
DifVector delDir
const [virtual]
 

Implements TrkDifTraj.

void HelixTraj::getDFInfo double  fltLen,
DifPoint ,
DifVector dir,
DifVector delDir
const [virtual]
 

Implements TrkDifTraj.

00282 {
00283   //Provides difNum version of information for calculation of derivatives.
00284   //  All arithmetic operations have been replaced by +=, etc. versions 
00285   //  for speed.
00286 
00287   // Create difNumber versions of parameters
00288   DifNumber phi0Df(phi0(), phi0Index+1, NHLXPRM);
00289   DifNumber d0Df(d0(), d0Index+1, NHLXPRM);
00290   DifNumber z0Df(z0(), z0Index+1, NHLXPRM);
00291   DifNumber tanDipDf(tanDip(), tanDipIndex+1, NHLXPRM);
00292   DifNumber omegaDf(omega(), omegaIndex+1, NHLXPRM);
00293   phi0Df.setIndepPar( parameters() );
00294   d0Df.setIndepPar( parameters() );
00295   z0Df.setIndepPar( parameters() );
00296   tanDipDf.setIndepPar( parameters() );
00297   omegaDf.setIndepPar( parameters() );
00298   DifNumber dipDf = atan(tanDipDf);
00299 
00300   static DifNumber cDip;
00301   dipDf.cosAndSin(cDip, dir.z);
00302   static DifNumber sinPhi0, cosPhi0;
00303   phi0Df.cosAndSin(cosPhi0, sinPhi0);
00304 
00305   bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
00306                referencePoint().z() != 0.);
00307 
00308   DifNumber alphaDf = cDip;
00309   alphaDf *= omegaDf;
00310   alphaDf *= flt;
00311   alphaDf += phi0Df;
00312 
00313   // This is not the prettiest line imaginable for this operation:
00314   alphaDf.mod(-Constants::pi, Constants::pi);
00315   //  DifNumber sinAlpha, cosAlpha;
00316   alphaDf.cosAndSin(dir.x, dir.y);
00317 
00318   //  DifNumber x =   (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
00319   //  DifNumber y =  -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
00320 
00321   pos.x = dir.y;
00322   pos.x -= sinPhi0;
00323   pos.x /= omegaDf;
00324   DifNumber temp = d0Df;
00325   temp *= sinPhi0;
00326   pos.x -= temp;
00327 
00328   pos.y = cosPhi0;
00329   pos.y -= dir.x;
00330   pos.y /= omegaDf;
00331   temp = d0Df;
00332   temp *= cosPhi0;
00333   pos.y += temp;
00334 
00335   pos.z = flt;
00336   pos.z *= dir.z;
00337   pos.z += z0Df;
00338 
00339   if (lref) {
00340     DifNumber px(referencePoint().x());
00341     DifNumber py(referencePoint().y());
00342     DifNumber pz(referencePoint().z());
00343     pos.x += px;
00344     pos.y += py;
00345     pos.z += pz;
00346   }
00347 
00348   delDir.x = -omegaDf;
00349   delDir.x *= cDip;
00350   delDir.x *= cDip;
00351   delDir.x *= dir.y;
00352 
00353   delDir.y =  omegaDf;
00354   delDir.y *= cDip;
00355   delDir.y *= cDip;
00356   delDir.y *= dir.x;
00357 
00358   delDir.z = 0.;
00359 
00360   dir.x *= cDip;
00361   dir.y *= cDip;
00362 }

virtual void HelixTraj::getDFInfo2 double  fltLen,
DifPoint pos,
DifVector dir
const [virtual]
 

Reimplemented from TrkDifTraj.

void HelixTraj::getDFInfo2 double  fltLen,
DifPoint pos,
DifVector dir
const [virtual]
 

Reimplemented from TrkDifTraj.

00208 {
00209   //Provides difNum version of information for calculation of derivatives.
00210   //  All arithmetic operations have been replaced by +=, etc. versions 
00211   //  for speed.
00212 
00213   // Create difNumber versions of parameters
00214   DifNumber phi0Df(phi0(), phi0Index+1, NHLXPRM);
00215   phi0Df.setIndepPar( parameters() );
00216   DifNumber d0Df(d0(), d0Index+1, NHLXPRM);
00217   d0Df.setIndepPar( parameters() );
00218   DifNumber z0Df(z0(), z0Index+1, NHLXPRM);
00219   z0Df.setIndepPar( parameters() );
00220   DifNumber tanDipDf(tanDip(), tanDipIndex+1, NHLXPRM);
00221   tanDipDf.setIndepPar( parameters() );
00222   DifNumber omegaDf(omega(), omegaIndex+1, NHLXPRM);
00223   omegaDf.setIndepPar( parameters() );
00224 
00225   DifNumber dipDf = atan(tanDipDf);
00226 
00227   static DifNumber cDip;
00228   dipDf.cosAndSin(cDip, dir.z);
00229   static DifNumber sinPhi0, cosPhi0;
00230   phi0Df.cosAndSin(cosPhi0, sinPhi0);
00231 
00232   bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
00233                referencePoint().z() != 0.);
00234 
00235   DifNumber alphaDf = cDip;
00236   alphaDf *= omegaDf;
00237   alphaDf *= flt;
00238   alphaDf += phi0Df;
00239 
00240   // This is not the prettiest line imaginable for this operation:
00241   alphaDf.mod(-Constants::pi, Constants::pi);
00242   //  DifNumber sinAlpha, cosAlpha;
00243   alphaDf.cosAndSin(dir.x, dir.y);
00244 
00245   //  DifNumber x =   (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
00246   //  DifNumber y =  -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
00247 
00248   pos.x = dir.y;
00249   pos.x -= sinPhi0;
00250   pos.x /= omegaDf;
00251   DifNumber temp = d0Df;
00252   temp *= sinPhi0;
00253   pos.x -= temp;
00254 
00255   pos.y = cosPhi0;
00256   pos.y -= dir.x;
00257   pos.y /= omegaDf;
00258   temp = d0Df;
00259   temp *= cosPhi0;
00260   pos.y += temp;
00261 
00262   pos.z = flt;
00263   pos.z *= dir.z;
00264   pos.z += z0Df;
00265 
00266   if (lref) {
00267     DifNumber px(referencePoint().x());
00268     DifNumber py(referencePoint().y());
00269     DifNumber pz(referencePoint().z());
00270     pos.x += px;
00271     pos.y += py;
00272     pos.z += pz;
00273   }
00274 
00275   dir.x *= cDip;
00276   dir.y *= cDip;
00277 }

virtual void HelixTraj::getInfo double  fltLen,
HepPoint3D ,
Hep3Vector &  dir,
Hep3Vector &  delDir
const [virtual]
 

Implements Trajectory.

virtual void HelixTraj::getInfo double  fltLen,
HepPoint3D pos,
Hep3Vector &  dir
const [virtual]
 

Implements Trajectory.

void HelixTraj::getInfo double  fltLen,
HepPoint3D ,
Hep3Vector &  dir,
Hep3Vector &  delDir
const [virtual]
 

Implements Trajectory.

00149 {
00150   //  double ang = angle(fltLen);
00151   double cDip = cosDip();
00152   double sDip = tanDip() * cDip;
00153   double phi00 = parameters()->parameter()[phi0Index];  // Don't normalize
00154   double ang = phi00 + cDip*fltLen*omega(); 
00155   double cang = cos(ang);
00156   double sang = sin(ang);
00157   double sphi0 = sin(phi00);
00158   double cphi0 = cos(phi00);
00159 
00160   double xt = (sang - sphi0)/omega() - d0()*sphi0 +
00161     referencePoint().x();
00162   double yt = -(cang - cphi0)/omega() + d0()*cphi0 +
00163     referencePoint().y();
00164   double zt = z0() + fltLen*sDip + referencePoint().z();
00165   pos.setX(xt);
00166   pos.setY(yt);
00167   pos.setZ(zt);
00168 
00169   dir.setX(cang * cDip);
00170   dir.setY(sang * cDip);
00171   dir.setZ(sDip);
00172 
00173   double delX = -omega() * cDip * cDip * sang;
00174   double delY =  omega() * cDip * cDip * cang;
00175   delDir.setX(delX);
00176   delDir.setY(delY);
00177   delDir.setZ(0.0);
00178 }

void HelixTraj::getInfo double  fltLen,
HepPoint3D pos,
Hep3Vector &  dir
const [virtual]
 

Implements Trajectory.

00182 {
00183   //  double ang = angle(fltLen);
00184   double cDip = cosDip();
00185   double sDip = tanDip() * cDip;
00186   double phi00 = parameters()->parameter()[phi0Index];  // Don't normalize
00187   double ang = phi00 + cDip*fltLen*omega(); 
00188   double cang = cos(ang);
00189   double sang = sin(ang);
00190   double sphi0 = sin(phi00);
00191   double cphi0 = cos(phi00);
00192 
00193   double xt = (sang - sphi0)/omega() - d0()*sphi0 +
00194     referencePoint().x();
00195   double yt = -(cang - cphi0)/omega() + d0()*cphi0 +
00196     referencePoint().y();
00197   double zt = z0() + fltLen*sDip + referencePoint().z();
00198   pos.setX(xt);
00199   pos.setY(yt);
00200   pos.setZ(zt);
00201 
00202   dir.setX(cang * cDip);
00203   dir.setY(sang * cDip);
00204   dir.setZ(sDip);
00205 }

double Trajectory::hiRange  )  const [inherited]
 

double Trajectory::hiRange  )  const [inline, inherited]
 

00092 {return flightrange[1];}

TrkSimpTraj& TrkSimpTraj::invert  )  [inherited]
 

Reimplemented in NeutTraj, and NeutTraj.

TrkSimpTraj & TrkSimpTraj::invert  )  [inherited]
 

Reimplemented in NeutTraj, and NeutTraj.

00129 {
00130   // Invert parameters
00131   std::vector<bool> flags(parameters()->nPar(),false);
00132   invertParams(parameters(), flags);
00133   // loop over parameters and invert covariance matrix
00134   for(int iparam=0;iparam<parameters()->nPar();iparam++){
00135     bool iinvert = flags[iparam];
00136 // do covariance cross-terms too
00137     for(int jparam=iparam+1;jparam<parameters()->nPar();jparam++){
00138       bool jinvert = flags[jparam];
00139       if( (iinvert && !jinvert) || (!iinvert && jinvert) ) {
00140 // cross-terms change sign
00141         parameters()->covariance()[iparam][jparam] *= -1.0;
00142       }
00143     }
00144   }
00145 // invert the flightlength
00146   double range[2];
00147   range[0] = -hiRange();
00148   range[1] = -lowRange();
00149   setFlightRange(range);
00150 // done
00151   return *this;
00152 }

void HelixTraj::invertParams TrkParams params,
std::vector< bool > &  flags
const [virtual]
 

Implements TrkSimpTraj.

void HelixTraj::invertParams TrkParams params,
std::vector< bool > &  flags
const [virtual]
 

Implements TrkSimpTraj.

00599 {
00600   // Inverts parameters and returns true if the parameter inversion
00601   // requires a change in sign of elements in the covariance matrix
00602 
00603   for (unsigned iparam = 0; iparam < NHLXPRM; iparam++) {
00604     switch ( iparam ) {
00605     case d0Index:  // changes sign
00606     case omegaIndex:  // changes sign
00607     case tanDipIndex:  // changes sign
00608       params->parameter()[iparam] *= -1.0;
00609       flags[iparam] = true;
00610       break;
00611     case phi0Index:  // changes by pi, but covariance matrix shouldn't change
00612       params->parameter()[iparam] =
00613         BesAngle(params->parameter()[iparam] + Constants::pi);
00614       flags[iparam] = false;
00615       break;
00616     case z0Index:  // nochange
00617       flags[iparam] = false;
00618     }
00619   }
00620   return;
00621 }

virtual const TrkSimpTraj* TrkSimpTraj::localTrajectory double  fltLen,
double &  localFlt
const [virtual, inherited]
 

Implements TrkDifTraj.

const TrkSimpTraj * TrkSimpTraj::localTrajectory double  fltLen,
double &  localFlt
const [virtual, inherited]
 

Implements TrkDifTraj.

00059                                                                   {
00060 //----------------------------------------------------------------------------
00061   localFlt = fltLen;
00062   return this;
00063 }

double Trajectory::lowRange  )  const [inherited]
 

double Trajectory::lowRange  )  const [inline, inherited]
 

00091 {return flightrange[0];}

int HelixTraj::nPar  )  const [inline, virtual]
 

Reimplemented from TrkSimpTraj.

00075 { return NHLXPRM;}

int HelixTraj::nPar  )  const [inline, virtual]
 

Reimplemented from TrkSimpTraj.

00075 { return NHLXPRM;}

double HelixTraj::omega  )  const [inline]
 

00081 {return parameters()->parameter()[omegaIndex]; }

double HelixTraj::omega  )  const [inline]
 

00081 {return parameters()->parameter()[omegaIndex]; }

HelixTraj& HelixTraj::operator= const HelixTraj  ) 
 

HelixTraj & HelixTraj::operator= const HelixTraj  ) 
 

00073 {
00074   if( &h != this ){
00075     Trajectory::operator=(h);
00076     _dtparams = *(h.parameters());
00077     _refpoint = h._refpoint;
00078   }
00079   return *this;
00080 }

bool TrkSimpTraj::operator== const TrkSimpTraj  )  const [inherited]
 

bool TrkSimpTraj::operator== const TrkSimpTraj  )  const [inherited]
 

00157 {
00158      if (lowRange()!=x.lowRange() || hiRange()!=x.hiRange()) return false;
00159      const HepVector &m=_dtparams.parameter(); 
00160      unsigned int mp=m.num_row();
00161      const HepVector &n=x._dtparams.parameter(); 
00162      unsigned int np=n.num_row();
00163      if (np!=mp) return false;
00164      for(unsigned i=0;i<np;++i){
00165         if(m[i] != n[i]) return false;
00166      }
00167      return _refpoint==x._refpoint;
00168 }

const TrkParams* TrkSimpTraj::parameters  )  const [inline, inherited]
 

00081 {return &_dtparams;}

TrkParams* TrkSimpTraj::parameters  )  [inline, inherited]
 

00080 {return &_dtparams;}

const TrkParams* TrkSimpTraj::parameters  )  const [inline, inherited]
 

00081 {return &_dtparams;}

TrkParams* TrkSimpTraj::parameters  )  [inline, inherited]
 

00080 {return &_dtparams;}

void HelixTraj::paramFunc const HepPoint3D oldpoint,
const HepPoint3D newpoint,
const HepVector &  oldpar,
const HepSymMatrix &  oldcov,
HepVector &  newpar,
HepSymMatrix &  newcov,
double  fltlen
[static, private]
 

void HelixTraj::paramFunc const HepPoint3D oldpoint,
const HepPoint3D newpoint,
const HepVector &  oldpar,
const HepSymMatrix &  oldcov,
HepVector &  newpar,
HepSymMatrix &  newcov,
double  fltlen
[static, private]
 

00520 {
00521 // copy the input parameter vector, in case the input and output are the same
00522   HepVector parvec(oldvec);
00523 // start with the input: omega and tandip don't change
00524   newvec = parvec;
00525 //
00526   double delx = newpoint.x()-oldpoint.x();
00527   double dely = newpoint.y()-oldpoint.y();
00528   double delz = newpoint.z()-oldpoint.z();
00529 //
00530   double rad = 1./parvec[omegaIndex];
00531   double rad2 = rad*rad;
00532   double delta = rad + parvec[d0Index];
00533   double cos0 = cos(parvec[phi0Index]);
00534   double sin0 = sin(parvec[phi0Index]);
00535   double perp = delx*sin0-dely*cos0;
00536   double para = delx*cos0+dely*sin0;
00537   double tand = parvec[tanDipIndex];
00538   double oldphi  = parvec[phi0Index] +
00539     fltlen*parvec[omegaIndex]/sqrt(1.+tand*tand);
00540 // delta
00541   double newdelta2 = delta*delta + delx*delx + dely*dely +
00542     2.0*delta*perp;
00543 // assume delta, newdelta have the same sign
00544   double newdelta = delta>0 ? sqrt(newdelta2) : -sqrt(newdelta2);
00545   double invdelta = 1.0/newdelta;
00546   double invdelta2 = 1.0/newdelta2;
00547 // d0
00548   newvec[d0Index] = newdelta - rad;
00549 // phi0; check that we don't get the wrong wrapping. Atan2 has 2Pi ambiguity, not pi
00550   double newphi = atan2(sin0+delx/delta,cos0-dely/delta);
00551   while(fabs(newphi - oldphi)>M_PI)
00552     if(newphi > oldphi)
00553       newphi -= M_2PI;
00554     else
00555       newphi += M_2PI;
00556   newvec[phi0Index] = newphi;
00557   double delphi = newphi-parvec[phi0Index];
00558 //z0
00559   newvec[z0Index] += tand*rad*(delphi) - delz;
00560 // now covariance: first, compute the rotation matrix
00561 // start with 0: lots of terms are zero
00562   static HepMatrix covrot(NHLXPRM,NHLXPRM,0);
00563 //
00564 // omega is diagonal
00565   covrot(omegaIndex+1,omegaIndex+1) = 1.0;
00566 // tandip is diagonal
00567   covrot(tanDipIndex+1,tanDipIndex+1) = 1.0;
00568 // d0
00569   covrot(d0Index+1,omegaIndex+1) = rad2*(1.0 - invdelta*(delta + perp));
00570   covrot(d0Index+1,d0Index+1) = invdelta*(delta + perp);
00571   covrot(d0Index+1,phi0Index+1) = delta*para*invdelta;
00572 // phi0
00573   covrot(phi0Index+1,omegaIndex+1) = rad2*para*invdelta2;
00574   covrot(phi0Index+1,d0Index+1) = -para*invdelta2;
00575   covrot(phi0Index+1,phi0Index+1) = delta*(delta + perp)*invdelta2;
00576 // z0
00577   covrot(z0Index+1,omegaIndex+1) = tand*
00578     (rad*covrot(phi0Index+1,omegaIndex+1) - rad2*delphi);
00579   covrot(z0Index+1,d0Index+1) = tand*rad*covrot(phi0Index+1,d0Index+1);
00580   covrot(z0Index+1,phi0Index+1) = 
00581     tand*rad*(covrot(phi0Index+1,phi0Index+1) - 1.0);
00582   covrot(z0Index+1,tanDipIndex+1) = rad*delphi;
00583   covrot(z0Index+1,z0Index+1) = 1.0;
00584 //
00585 //  Apply the rotation
00586   newcov = oldcov.similarity(covrot);
00587 // done
00588 }

TranslateParams HelixTraj::paramFunction  )  const [inline, virtual]
 

Implements TrkSimpTraj.

00069 { return HelixTraj::paramFunc; }

TranslateParams HelixTraj::paramFunction  )  const [inline, virtual]
 

Implements TrkSimpTraj.

00069 { return HelixTraj::paramFunc; }

double HelixTraj::phi0  )  const
 

double HelixTraj::phi0  )  const
 

00511 {
00512   return BesAngle(parameters()->parameter()[phi0Index]).rad();
00513 }

virtual HepPoint3D HelixTraj::position double  fltLen  )  const [virtual]
 

Implements Trajectory.

HepPoint3D HelixTraj::position double  fltLen  )  const [virtual]
 

Implements Trajectory.

00094 {
00095   double cDip = cosDip();
00096   double sDip = tanDip() * cDip;
00097   double phi00 = parameters()->parameter()[phi0Index];  // Don't normalize
00098   double ang = phi00 + cDip*f*omega();
00099   double cang = cos(ang);
00100   double sang = sin(ang);
00101   double sphi0 = sin(phi00);
00102   double cphi0 = cos(phi00);
00103 
00104   return HepPoint3D((sang - sphi0)/omega() - d0()*sphi0+referencePoint().x(),
00105                  -(cang - cphi0)/omega() + d0()*cphi0+referencePoint().y(),
00106                  z0() + f*sDip                       +referencePoint().z());
00107 }

virtual void HelixTraj::print std::ostream os  )  const [virtual]
 

Reimplemented from TrkSimpTraj.

void HelixTraj::print std::ostream os  )  const [virtual]
 

Reimplemented from TrkSimpTraj.

00650 {
00651   Trajectory::print(os << "HelixTraj" );
00652 }

virtual void HelixTraj::printAll std::ostream os  )  const [virtual]
 

Reimplemented from TrkSimpTraj.

void HelixTraj::printAll std::ostream os  )  const [virtual]
 

Reimplemented from TrkSimpTraj.

00638 {
00639   os  << "HelixTraj with range "
00640       << lowRange() <<" to " << hiRange() << " and parameters " << endl
00641       << "d0= " << d0() << " phi0= "
00642       << phi0() << " omega= "
00643       << omega() << " z0 = "
00644       << z0() << " tanDip= "
00645       << tanDip() << endl;
00646 }

double Trajectory::range  )  const [inherited]
 

double Trajectory::range  )  const [inline, inherited]
 

00093 { return hiRange()-lowRange(); }

const HepPoint3D& TrkSimpTraj::referencePoint  )  const [inline, inherited]
 

00084 {return _refpoint;}

const HepPoint3D& TrkSimpTraj::referencePoint  )  const [inline, inherited]
 

00084 {return _refpoint;}

virtual void Trajectory::setFlightRange double  newrange[2]  )  [virtual, inherited]
 

Reimplemented in TrkDifPieceTraj, and TrkDifPieceTraj.

void Trajectory::setFlightRange double  newrange[2]  )  [virtual, inherited]
 

Reimplemented in TrkDifPieceTraj, and TrkDifPieceTraj.

00058 {
00059   if (newrange[1] >= newrange[0]) {
00060     flightrange[0] = newrange[0];
00061     flightrange[1] = newrange[1];
00062   } else {
00063     std::cout<<"ErrMsg(error) "<< "Invalid Trajectory range requested." << std::endl;
00064     flightrange[0] = newrange[1];
00065     flightrange[1] = newrange[0];
00066   }
00067 }

void TrkSimpTraj::setPoint const HepPoint3D newpoint  )  [inline, inherited]
 

00096 {_refpoint = newpoint;}

void TrkSimpTraj::setPoint const HepPoint3D newpoint  )  [inline, inherited]
 

00096 {_refpoint = newpoint;}

double HelixTraj::sinDip  )  const [inline, private]
 

00106 {return tanDip()*cosDip(); }

double HelixTraj::sinDip  )  const [inline, private]
 

00106 {return tanDip()*cosDip(); }

double HelixTraj::tanDip  )  const [inline]
 

00083 {  return parameters()->parameter()[tanDipIndex]; }

double HelixTraj::tanDip  )  const [inline]
 

00083 {  return parameters()->parameter()[tanDipIndex]; }

double HelixTraj::translen const double &  f  )  const [inline, private]
 

00107 {return cosDip()*f;}

double HelixTraj::translen const double &  f  )  const [inline, private]
 

00107 {return cosDip()*f;}

bool Trajectory::validFlightDistance double  f,
double  tolerance = 0.0
const [inherited]
 

bool Trajectory::validFlightDistance double  f,
double  tolerance = 0.0
const [inline, inherited]
 

00088                                                                      {
00089   return f >= flightrange[0]-tol && f <= flightrange[1]+tol; 
00090 }

virtual void HelixTraj::visitAccept TrkVisitor vis  )  const [virtual]
 

Implements TrkSimpTraj.

void HelixTraj::visitAccept TrkVisitor vis  )  const [virtual]
 

Implements TrkSimpTraj.

00592 {
00593 // Visitor access--just use the Visitor class member function
00594   vis->trkVisitHelixTraj(this);
00595 }

double HelixTraj::z const double &   )  const [private]
 

double HelixTraj::z const double &   )  const [private]
 

00088 {
00089   return z0() + f*sinDip() + referencePoint().z();
00090 }

double HelixTraj::z0  )  const [inline]
 

00082 {return parameters()->parameter()[z0Index]; }

double HelixTraj::z0  )  const [inline]
 

00082 {return parameters()->parameter()[z0Index]; }


Member Data Documentation

TrkParams TrkSimpTraj::_dtparams [protected, inherited]
 

HepPoint3D TrkSimpTraj::_refpoint [protected, inherited]
 

HepPoint3D TrkSimpTraj::_theOrigin [static, inherited]
 

double Trajectory::flightrange [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:16:52 2011 for BOSS6.5.5 by  doxygen 1.3.9.1