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

TrkCircleTraj Class Reference

#include <TrkCircleTraj.h>

Inheritance diagram for TrkCircleTraj:

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

Public Member Functions

void changePoint (const HepPoint3D &newpoint, double &fltlen)
void changePoint (const HepPoint3D &newpoint, double &fltlen)
TrkCircleTrajclone () const
TrkCircleTrajclone () const
virtual double curvature (double fltLen) const
virtual 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) const
HepMatrix derivDisplace (double fltlen, deflectDirection) 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 flt, double tol, int pathDir) const
virtual double distTo1stError (double flt, double tol, int pathDir) const
virtual double distTo2ndError (double flt, double tol, int pathDir) const
virtual double distTo2ndError (double flt, 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
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
TrkCircleTrajoperator= (const TrkCircleTraj &)
TrkCircleTrajoperator= (const TrkCircleTraj &)
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)
 TrkCircleTraj (const TrkCircleTraj &)
 TrkCircleTraj (const TrkExchangePar &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 TrkCircleTraj (const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 TrkCircleTraj (const TrkCircleTraj &)
 TrkCircleTraj (const TrkExchangePar &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
 TrkCircleTraj (const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)
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
 ~TrkCircleTraj ()
 ~TrkCircleTraj ()

Static Public Member Functions

int d0Index ()
int d0Index ()
int nCirPrm ()
int nCirPrm ()
int omegaIndex ()
int omegaIndex ()
int phi0Index ()
int phi0Index ()

Static Public Attributes

HepPoint3D _theOrigin

Protected Attributes

TrkParams _dtparams
HepPoint3D _refpoint
double flightrange [2]

Private Types

enum  { d0Ind = 0, phi0Ind, omegaInd }
enum  { NCIRPAR = 3 }
enum  { d0Ind = 0, phi0Ind, omegaInd }
enum  { NCIRPAR = 3 }

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 x (const double &) const
double x (const double &) const
double y (const double &) const
double y (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 [private]
 

Enumeration values:
d0Ind 
phi0Ind 
omegaInd 
00079 {d0Ind=0, phi0Ind, omegaInd}; 

anonymous enum [private]
 

Enumeration values:
NCIRPAR 
00080 {NCIRPAR = 3};

anonymous enum [private]
 

Enumeration values:
d0Ind 
phi0Ind 
omegaInd 
00079 {d0Ind=0, phi0Ind, omegaInd}; 

anonymous enum [private]
 

Enumeration values:
NCIRPAR 
00080 {NCIRPAR = 3};


Constructor & Destructor Documentation

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

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

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

00050                                                                               :
00051   TrkSimpTraj(inpar.params(), inpar.covariance(), lowlim,hilim,refpoint) {
00052 //-----------------------------------------------------------------
00053  
00054   if (omega() == 0.0) parameters()->parameter()[omegaIndex()] = 1.e-9;   
00055 }

TrkCircleTraj::TrkCircleTraj const TrkCircleTraj  ) 
 

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

TrkCircleTraj::~TrkCircleTraj  ) 
 

00082 {
00083 }

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

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

TrkCircleTraj::TrkCircleTraj const TrkCircleTraj  ) 
 

TrkCircleTraj::~TrkCircleTraj  ) 
 


Member Function Documentation

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

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

00530 {
00531   return BesAngle(phi0() + arc(f));
00532 }

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

00098 {return f*omega();}

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

00098 {return 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 }

TrkCircleTraj* TrkCircleTraj::clone  )  const [virtual]
 

Implements TrkSimpTraj.

TrkCircleTraj * TrkCircleTraj::clone  )  const [virtual]
 

Implements TrkSimpTraj.

00066 {
00067   return new TrkCircleTraj(*this);
00068 }

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

Implements Trajectory.

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

Implements Trajectory.

00422 {
00423 //  Compute the curvature as the magnitude of the 2nd derrivative
00424 //  of the position function with respect to the 3-d flight distance
00425 
00426   return fabs(omega());
00427 }

double TrkCircleTraj::d0  )  const [inline]
 

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

double TrkCircleTraj::d0  )  const [inline]
 

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

int TrkCircleTraj::d0Index  )  [inline, static]
 

00082 {return d0Ind;}

int TrkCircleTraj::d0Index  )  [inline, static]
 

00082 {return d0Ind;}

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

Implements Trajectory.

Hep3Vector TrkCircleTraj::delDirect double   )  const [virtual]
 

Implements Trajectory.

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

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

Implements TrkKalDeriv.

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

Implements TrkKalDeriv.

00323 {
00324 //  This function computes the column matrix of derivatives for the change
00325 //  in parameters for a change in the direction of a track at a point along
00326 //  its flight, holding the momentum and position constant.  The effects for
00327 //  changes in 2 perpendicular directions (theta1 = dip and
00328 //  theta2 = phi*cos(dip)) can sometimes be added, as scattering in these
00329 //  are uncorrelated.
00330 
00331   HepMatrix ddflct(nCirPrm(),1,0); // initialize with zeros
00332 
00333 //  Compute some common things
00334 
00335   double omeg = omega();
00336   double arcl = arc(fltlen);
00337   double dx = cos(arcl);
00338   double dy = sin(arcl);
00339   double darc = omeg*d0();
00340 
00341 //  Go through the parameters
00342 
00343   switch (idirect) {
00344   case theta1:
00345     break;
00346   case theta2:
00347     ddflct[d0Index()][0] = -dy/(omeg);
00348     ddflct[phi0Index()][0] = dx/(1+darc);
00349   }
00350 
00351   return ddflct;
00352 }

HepMatrix TrkCircleTraj::derivDisplace double  fltlen,
deflectDirection 
const [virtual]
 

Implements TrkKalDeriv.

HepMatrix TrkCircleTraj::derivDisplace double  fltlen,
deflectDirection 
const [virtual]
 

Implements TrkKalDeriv.

00356 {
00357 //  This function computes the column matrix of derivatives for the change
00358 //  in parameters for a change in the position of a track at a point along
00359 //  its flight, holding the momentum and direction constant.  The effects for
00360 //  changes in 2 perpendicular directions (theta1 = dip and
00361 //  theta2 = phi*cos(dip)) can sometimes be added, as scattering in these
00362 //  are uncorrelated.
00363 
00364   HepMatrix ddflct(nCirPrm(),1,0); // initialize with zeros
00365 
00366 //  Compute some common things
00367 
00368   double omeg = omega();
00369   double arcl = arc(fltlen);
00370   double dx = cos(arcl);
00371   double dy = sin(arcl);
00372   double darc = omeg*d0();
00373 
00374 //  Go through the parameters
00375 
00376   switch (idirect) {
00377   case theta1:
00378     break;
00379   case theta2:
00380     ddflct[d0Index()][0] = dx;
00381     ddflct[phi0Index()][0] = dy*omeg/(1+darc);
00382   }
00383 
00384   return ddflct;
00385 }

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

Implements TrkKalDeriv.

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

Implements TrkKalDeriv.

00389 {
00390 //
00391 //  This function computes the column matrix of derrivatives for the change
00392 //  in parameters from a (fractional) change in the track momentum,
00393 //  holding the direction and position constant.  The momentum change can
00394 //  come from energy loss or bfield inhomogeneities.
00395 //
00396 //  For a helix, dp/P = -domega/omega,
00397 //  dParam/d(domega/omega) = omega*dParam/ddomega
00398 
00399   HepMatrix dmomfrac(nCirPrm(),1);
00400 
00401 //  Compute some common things
00402 
00403   double omeg = omega();
00404   double arcl = arc(fltlen);
00405   double dx = cos(arcl);
00406   double dy = sin(arcl);
00407   double darc = omeg*d0();
00408 
00409 //  Go through the parameters
00410 // omega
00411   dmomfrac[omegaIndex()][0] = -omeg;
00412 // d0
00413   dmomfrac[d0Index()][0] = -(1-dx)/omeg;
00414 // phi0
00415   dmomfrac[phi0Index()][0] = dy/(1+darc);
00416 
00417   return dmomfrac;
00418 }

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

Implements Trajectory.

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

Implements Trajectory.

00112 {
00113   // Angle formed by tangent vector after
00114   // being rotated 'arclength' around orbit.
00115   double alpha = angle( f );
00116   // Construct 3-D tangent vector of unit magnitude.
00117   return Hep3Vector ( cos(alpha),
00118                       sin(alpha),
00119                              0.0);
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 TrkCircleTraj::distTo1stError double  flt,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

double TrkCircleTraj::distTo1stError double  flt,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

00132 {
00133   double arg = 2. * tol / fabs(omega());
00134   assert (arg >= 0.);
00135   return sqrt(arg);
00136 }

virtual double TrkCircleTraj::distTo2ndError double  flt,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

double TrkCircleTraj::distTo2ndError double  flt,
double  tol,
int  pathDir
const [virtual]
 

Implements Trajectory.

00140 {
00141   //return pow(6.*tol / sqr(omega()), 0.33333333);//yzhang changed sqr
00142   return pow(6.*tol / (omega()*omega()), 0.33333333);
00143 }

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

Implements TrkDifTraj.

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

Implements TrkDifTraj.

00255 {
00256   //Provides difNum version of information for calculation of derivatives.
00257 
00258   // Create difNumber versions of parameters
00259   DifNumber phi0Df(phi0(), phi0Index()+1, nCirPrm());
00260   DifNumber d0Df(d0(), d0Index()+1, nCirPrm());
00261   DifNumber omegaDf(omega(), omegaIndex()+1, nCirPrm());
00262   phi0Df.setIndepPar( parameters() );
00263   d0Df.setIndepPar( parameters() );
00264   omegaDf.setIndepPar( parameters() );
00265 
00266   DifNumber sinPhi0, cosPhi0;
00267   phi0Df.cosAndSin(cosPhi0, sinPhi0);
00268 
00269   DifNumber alphaDf = omegaDf;
00270   alphaDf *= flt;
00271   alphaDf += phi0Df;
00272 
00273   // This is not the prettiest line imaginable for this operation:
00274   alphaDf.mod(-Constants::pi, Constants::pi);
00275   DifNumber sinAlpha, cosAlpha;
00276   alphaDf.cosAndSin(cosAlpha, sinAlpha);
00277 
00278   //  DifNumber x =  (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
00279   //  DifNumber y = -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
00280 
00281   DifNumber x = sinAlpha;
00282   x -= sinPhi0;
00283   x /= omegaDf;
00284   x -= (d0Df * sinPhi0);
00285 
00286   DifNumber y = -cosAlpha;
00287   y += cosPhi0;
00288   y /= omegaDf;
00289   y += (d0Df * cosPhi0);
00290 
00291 
00292   static DifNumber zNull(0.);
00293 
00294   pos.x = x;
00295   pos.y = y;
00296   pos.z = zNull;
00297 
00298   bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
00299                referencePoint().z() != 0.);
00300   if (lref) {
00301     DifNumber px(referencePoint().x());
00302     DifNumber py(referencePoint().y());
00303     DifNumber pz(referencePoint().z());
00304     pos.x += px;
00305     pos.y += py;
00306     pos.z += pz;
00307   }
00308 
00309   dir.x = cosAlpha;
00310   dir.y = sinAlpha;
00311   dir.z = 0.;
00312 
00313   delDir.x = -omegaDf;
00314   delDir.x *= sinAlpha;
00315 
00316   delDir.y = omegaDf;
00317   delDir.y *= cosAlpha;
00318 
00319   delDir.z = 0.;
00320 }

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

Reimplemented from TrkDifTraj.

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

Reimplemented from TrkDifTraj.

00193 {
00194   //Provides difNum version of information for calculation of derivatives.
00195 
00196   // Create difNumber versions of parameters
00197   DifNumber phi0Df(phi0(), phi0Index()+1, nCirPrm());
00198   DifNumber d0Df(d0(), d0Index()+1, nCirPrm());
00199   DifNumber omegaDf(omega(), omegaIndex()+1, nCirPrm());
00200   phi0Df.setIndepPar( parameters() );
00201   d0Df.setIndepPar( parameters() );
00202   omegaDf.setIndepPar( parameters() );
00203 
00204   DifNumber sinPhi0, cosPhi0;
00205   phi0Df.cosAndSin(cosPhi0, sinPhi0);
00206 
00207   DifNumber alphaDf = omegaDf;
00208   alphaDf *= fltLen;
00209   alphaDf += phi0Df;
00210 
00211   // This is not the prettiest line imaginable for this operation:
00212   alphaDf.mod(-Constants::pi, Constants::pi);
00213   DifNumber sinAlpha, cosAlpha;
00214   alphaDf.cosAndSin(cosAlpha, sinAlpha);
00215 
00216   //  DifNumber x =  (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
00217   //  DifNumber y = -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
00218 
00219   DifNumber x = sinAlpha;
00220   x -= sinPhi0;
00221   x /= omegaDf;
00222   x -= (d0Df * sinPhi0);
00223 
00224   DifNumber y = -cosAlpha;
00225   y += cosPhi0;
00226   y /= omegaDf;
00227   y += (d0Df * cosPhi0);
00228 
00229 
00230   static DifNumber zNull(0.);
00231 
00232   pos.x = x;
00233   pos.y = y;
00234   pos.z = zNull;
00235 
00236   bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
00237                referencePoint().z() != 0.);
00238   if (lref) {
00239     DifNumber px(referencePoint().x());
00240     DifNumber py(referencePoint().y());
00241     DifNumber pz(referencePoint().z());
00242     pos.x += px;
00243     pos.y += py;
00244     pos.z += pz;
00245   }
00246 
00247   dir.x = cosAlpha;
00248   dir.y = sinAlpha;
00249   dir.z = 0.;
00250 }

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

Implements Trajectory.

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

Implements Trajectory.

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

Implements Trajectory.

00148 {
00149   double sphi0 = sin(phi0());
00150   double cphi0 = cos(phi0());
00151   double ang = angle(flt);
00152   double cang = cos(ang);
00153   double sang = sin(ang);
00154   double xt =   (sang-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
00155   double yt =  -(cang-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
00156 
00157   pos.setX(xt);
00158   pos.setY(yt);
00159   pos.setZ(referencePoint().z());
00160 
00161   dir.setX(cang);
00162   dir.setY(sang);
00163   dir.setZ(0.0);
00164 
00165   delDir.setX(-omega()*sang);
00166   delDir.setY( omega()*cang);
00167   delDir.setZ(0.);
00168 }

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

Implements Trajectory.

00172 {
00173   double sphi0 = sin(phi0());
00174   double cphi0 = cos(phi0());
00175   double ang = angle(fltLen);
00176   double cang = cos(ang);
00177   double sang = sin(ang);
00178   double xt =   (sang-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
00179   double yt =  -(cang-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
00180 
00181   pos.setX(xt);
00182   pos.setY(yt);
00183   pos.setZ(referencePoint().z());
00184 
00185   dir.setX(cang);
00186   dir.setY(sang);
00187   dir.setZ(0.0);
00188 }

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 TrkCircleTraj::invertParams TrkParams params,
std::vector< bool > &  flags
const [virtual]
 

Implements TrkSimpTraj.

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

Implements TrkSimpTraj.

00496 {
00497   // Inverts parameters and returns true if the parameter inversion
00498   // requires a change in sign of elements in the covariance matrix
00499 
00500   for (unsigned iparam = 0; iparam < NCIRPAR; iparam++) {
00501     switch ( iparam ) {
00502     case d0Ind:  // changes sign
00503     case omegaInd:  // changes sign
00504       params->parameter()[iparam] *= -1.0;
00505       flags[iparam] = true;
00506       break;
00507     case phi0Ind:  // changes by pi, but covariance matrix shouldn't change
00508       params->parameter()[iparam] =
00509         BesAngle(params->parameter()[iparam] + Constants::pi);
00510       flags[iparam] = false;
00511     }
00512   }
00513 }

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 TrkCircleTraj::nCirPrm  )  [inline, static]
 

00085 {return NCIRPAR;}

int TrkCircleTraj::nCirPrm  )  [inline, static]
 

00085 {return NCIRPAR;}

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

Reimplemented from TrkSimpTraj.

00069 {return NCIRPAR;}

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

Reimplemented from TrkSimpTraj.

00069 {return NCIRPAR;}

double TrkCircleTraj::omega  )  const [inline]
 

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

double TrkCircleTraj::omega  )  const [inline]
 

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

int TrkCircleTraj::omegaIndex  )  [inline, static]
 

00084 {return omegaInd;}

int TrkCircleTraj::omegaIndex  )  [inline, static]
 

00084 {return omegaInd;}

TrkCircleTraj& TrkCircleTraj::operator= const TrkCircleTraj  ) 
 

TrkCircleTraj & TrkCircleTraj::operator= const TrkCircleTraj  ) 
 

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

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 TrkCircleTraj::paramFunc const HepPoint3D oldpoint,
const HepPoint3D newpoint,
const HepVector &  oldpar,
const HepSymMatrix &  oldcov,
HepVector &  newpar,
HepSymMatrix &  newcov,
double  fltlen
[static, private]
 

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

00440 {
00441 // copy the input parameter vector, in case the input and output are the same
00442   HepVector parvec(oldvec);
00443 // start with the input: omega doesn't change
00444   newvec = parvec;
00445 //
00446   double delx = newpoint.x()-oldpoint.x();
00447   double dely = newpoint.y()-oldpoint.y();
00448 //
00449   double rad = 1./parvec[omegaIndex()];
00450   double rad2 = rad*rad;
00451   double delta = rad + parvec[d0Index()];
00452   double cos0 = cos(parvec[phi0Index()]);
00453   double sin0 = sin(parvec[phi0Index()]);
00454   double perp = delx*sin0-dely*cos0;
00455   double para = delx*cos0+dely*sin0;
00456   double oldphi  = parvec[phi0Index()] + fltlen*parvec[omegaIndex()] ;
00457 // delta
00458   double newdelta2 = delta*delta + delx*delx + dely*dely +
00459     2.0*delta*perp;
00460 // assume delta, newdelta have the same sign
00461   double newdelta = delta>0 ? sqrt(newdelta2) : -sqrt(newdelta2);
00462   double invdelta = 1.0/newdelta;
00463   double invdelta2 = 1.0/newdelta2;
00464 // d0
00465   newvec[d0Index()] = newdelta - rad;
00466 // phi0; check that we don't get the wrong wrapping
00467   double newphi = atan2(sin0+delx/delta,cos0-dely/delta);
00468   while(fabs(newphi - oldphi)>M_PI)
00469     if(newphi > oldphi)
00470       newphi -= M_2PI;
00471     else
00472       newphi += M_2PI;
00473   newvec[phi0Index()] = newphi;
00474   //double delphi = newphi-parvec[phi0Index()];
00475 // now covariance: first, compute the rotation matrix
00476   HepMatrix covrot(nCirPrm(),nCirPrm(),0); // start with 0: lots of terms are 0
00477 //
00478 // omega is diagonal
00479   covrot[omegaIndex()][omegaIndex()] = 1.0;
00480 // d0
00481   covrot[d0Index()][omegaIndex()] = rad2*(1.0 - invdelta*(delta + perp));
00482   covrot[d0Index()][d0Index()] = invdelta*(delta + perp);
00483   covrot[d0Index()][phi0Index()] = delta*para*invdelta;
00484 // phi0
00485   covrot[phi0Index()][omegaIndex()] = rad2*para*invdelta2;
00486   covrot[phi0Index()][d0Index()] = -para*invdelta2;
00487   covrot[phi0Index()][phi0Index()] = delta*(delta + perp)*invdelta2;
00488 //
00489 //  Apply the rotation
00490   newcov = oldcov.similarity(covrot);
00491 // done
00492 }

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

Implements TrkSimpTraj.

00064 { return TrkCircleTraj::paramFunc; }

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

Implements TrkSimpTraj.

00064 { return TrkCircleTraj::paramFunc; }

double TrkCircleTraj::phi0  )  const
 

double TrkCircleTraj::phi0  )  const
 

00431 {
00432  return BesAngle(parameters()->parameter()[phi0Index()]).rad();
00433 }

int TrkCircleTraj::phi0Index  )  [inline, static]
 

00083 {return phi0Ind;}

int TrkCircleTraj::phi0Index  )  [inline, static]
 

00083 {return phi0Ind;}

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

Implements Trajectory.

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

Implements Trajectory.

00101 {
00102   double sphi0 = sin(phi0());
00103   double cphi0 = cos(phi0());
00104   double ang = angle(f);
00105   double xt =  ( sin(ang)-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
00106   double yt =  -(cos(ang)-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
00107   return HepPoint3D(xt, yt, referencePoint().z());
00108 }

virtual void TrkSimpTraj::print std::ostream os  )  const [virtual, inherited]
 

Reimplemented from Trajectory.

Reimplemented in HelixTraj, and HelixTraj.

void TrkSimpTraj::print std::ostream os  )  const [virtual, inherited]
 

Reimplemented from Trajectory.

Reimplemented in HelixTraj, and HelixTraj.

00119                                     {
00120 //----------------------------------------------------------------------------
00121   os << "Simple ";
00122   Trajectory::print(os);
00123 }

virtual void TrkSimpTraj::printAll std::ostream os  )  const [virtual, inherited]
 

Reimplemented from Trajectory.

Reimplemented in HelixTraj, and HelixTraj.

void TrkSimpTraj::printAll std::ostream os  )  const [virtual, inherited]
 

Reimplemented from Trajectory.

Reimplemented in HelixTraj, and HelixTraj.

00108                                        {
00109 //----------------------------------------------------------------------------
00110     os << "Simple ";
00111     Trajectory::printAll(os);
00112     os << "SimpTraj parameter vector = "
00113        << _dtparams.parameter();
00114     os << "  and covariance matrix =  " 
00115        << _dtparams.covariance();
00116   }

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;}

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 TrkCircleTraj::visitAccept TrkVisitor vis  )  const [virtual]
 

Implements TrkSimpTraj.

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

Implements TrkSimpTraj.

00523 {
00524 // Visitor access--just use the TrkVisitor class member function
00525   vis->trkVisitCircleTraj(this);
00526 }

double TrkCircleTraj::x const double &   )  const [private]
 

double TrkCircleTraj::x const double &   )  const [private]
 

00087 {
00088   double sphi0 = sin(phi0());
00089   return ( sin(angle(f))-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
00090 }

double TrkCircleTraj::y const double &   )  const [private]
 

double TrkCircleTraj::y const double &   )  const [private]
 

00094 {
00095   double cphi0 = cos(phi0());
00096   return -(cos(angle(f))-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
00097 }


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 19:06:15 2011 for BOSS6.5.5 by  doxygen 1.3.9.1