TrkCircleTraj Class Reference

#include <TrkCircleTraj.h>

Inheritance diagram for TrkCircleTraj:

TrkSimpTraj TrkDifTraj TrkKalDeriv Trajectory List of all members.

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static HepPoint3D _theOrigin

Protected Attributes

TrkParams _dtparams
HepPoint3D _refpoint
double flightrange [2]

Private Types

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

Private Member Functions

double x (const double &) const
double y (const double &) const
double arc (const double &f) const
double angle (const double &f) const

Static Private Member Functions

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

Detailed Description

Definition at line 27 of file TrkCircleTraj.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
d0Ind 
phi0Ind 
omegaInd 

Definition at line 79 of file TrkCircleTraj.h.

00079 {d0Ind=0, phi0Ind, omegaInd}; 

anonymous enum [private]

Enumerator:
NCIRPAR 

Definition at line 80 of file TrkCircleTraj.h.

00080 {NCIRPAR = 3};


Constructor & Destructor Documentation

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

Definition at line 32 of file TrkCircleTraj.cxx.

References nCirPrm(), omega(), omegaIndex(), DifIndepPar::parameter(), and TrkSimpTraj::parameters().

Referenced by clone().

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 
)

Definition at line 49 of file TrkCircleTraj.cxx.

References omega(), omegaIndex(), DifIndepPar::parameter(), and TrkSimpTraj::parameters().

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  ) 

Definition at line 57 of file TrkCircleTraj.cxx.

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

TrkCircleTraj::~TrkCircleTraj (  ) 

Definition at line 81 of file TrkCircleTraj.cxx.

00082 {
00083 }


Member Function Documentation

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

Definition at line 529 of file TrkCircleTraj.cxx.

References arc(), and phi0().

Referenced by delDirect(), direction(), getInfo(), position(), x(), and y().

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

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

Definition at line 98 of file TrkCircleTraj.h.

References omega().

Referenced by angle(), derivDeflect(), derivDisplace(), and derivPFract().

00098 {return f*omega();}

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

Definition at line 70 of file TrkSimpTraj.cxx.

References TrkSimpTraj::_dtparams, TrkSimpTraj::_refpoint, TrkParams::covariance(), TrkErrCode::failure(), TrkPocaBase::flt1(), Trajectory::hiRange(), icol, Trajectory::lowRange(), DifIndepPar::parameter(), TrkSimpTraj::parameters(), TrkSimpTraj::paramFunction(), Trajectory::setFlightRange(), and TrkPocaBase::status().

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.

Definition at line 65 of file TrkCircleTraj.cxx.

References TrkCircleTraj().

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

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

Implements Trajectory.

Definition at line 421 of file TrkCircleTraj.cxx.

References omega().

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]

Definition at line 88 of file TrkCircleTraj.h.

References d0Index(), DifIndepPar::parameter(), and TrkSimpTraj::parameters().

Referenced by derivDeflect(), derivDisplace(), derivPFract(), getDFInfo(), getDFInfo2(), getInfo(), TrkCircleRep::helix(), position(), x(), and y().

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

static int TrkCircleTraj::d0Index (  )  [inline, static]

Definition at line 82 of file TrkCircleTraj.h.

References d0Ind.

Referenced by d0(), derivDeflect(), derivDisplace(), derivPFract(), getDFInfo(), getDFInfo2(), and paramFunc().

00082 {return d0Ind;}

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

Implements Trajectory.

Definition at line 123 of file TrkCircleTraj.cxx.

References angle(), cos(), omega(), and sin().

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.

Definition at line 322 of file TrkCircleTraj.cxx.

References arc(), cos(), d0(), d0Index(), nCirPrm(), omega(), phi0Index(), sin(), theta1, and theta2.

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.

Definition at line 355 of file TrkCircleTraj.cxx.

References arc(), cos(), d0(), d0Index(), nCirPrm(), omega(), phi0Index(), sin(), theta1, and theta2.

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.

Definition at line 388 of file TrkCircleTraj.cxx.

References arc(), cos(), d0(), d0Index(), nCirPrm(), omega(), omegaIndex(), phi0Index(), and sin().

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 }

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

Implements Trajectory.

Definition at line 111 of file TrkCircleTraj.cxx.

References alpha, angle(), cos(), and sin().

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]

Definition at line 51 of file Trajectory.cxx.

00052 {
00053   return fabs(tolerance);
00054 }

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

Implements Trajectory.

Definition at line 131 of file TrkCircleTraj.cxx.

References arg(), and omega().

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

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

Implements Trajectory.

Definition at line 139 of file TrkCircleTraj.cxx.

References omega().

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

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

Implements TrkDifTraj.

Definition at line 253 of file TrkCircleTraj.cxx.

References DifNumber::cosAndSin(), d0(), d0Index(), DifNumber::mod(), nCirPrm(), omega(), omegaIndex(), TrkSimpTraj::parameters(), phi0(), phi0Index(), Constants::pi, boss::pos, TrkSimpTraj::referencePoint(), DifNumber::setIndepPar(), DifVector::x, x(), DifVector::y, y(), and DifVector::z.

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 }

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

Reimplemented from TrkDifTraj.

Definition at line 191 of file TrkCircleTraj.cxx.

References DifNumber::cosAndSin(), d0(), d0Index(), DifNumber::mod(), nCirPrm(), omega(), omegaIndex(), TrkSimpTraj::parameters(), phi0(), phi0Index(), Constants::pi, boss::pos, TrkSimpTraj::referencePoint(), DifNumber::setIndepPar(), DifVector::x, x(), DifVector::y, y(), and DifVector::z.

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 }

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

Implements Trajectory.

Definition at line 146 of file TrkCircleTraj.cxx.

References angle(), cos(), d0(), omega(), phi0(), TrkSimpTraj::referencePoint(), and sin().

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.

Definition at line 171 of file TrkCircleTraj.cxx.

References angle(), cos(), d0(), omega(), phi0(), TrkSimpTraj::referencePoint(), and sin().

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 [inline, inherited]

Definition at line 92 of file Trajectory.h.

References Trajectory::flightrange.

Referenced by TrkDifPieceTraj::append(), TrkSimpTraj::changePoint(), MdcUtilitySvc::docaPatPar(), TrkRep::endValidRange(), TrkCompTrk::endValidRange(), TrkSimpTraj::invert(), TrkDifPieceTraj::invert(), TrkDifPieceTraj::locallyValid(), MdcHitOnTrack::MdcHitOnTrack(), TrkSimpTraj::operator==(), TrkDifPieceTraj::prepend(), and Trajectory::range().

00092 {return flightrange[1];}

TrkSimpTraj & TrkSimpTraj::invert (  )  [inherited]

Reimplemented in NeutTraj.

Definition at line 128 of file TrkSimpTraj.cxx.

References TrkParams::covariance(), Trajectory::hiRange(), TrkSimpTraj::invertParams(), Trajectory::lowRange(), DifIndepPar::nPar(), TrkSimpTraj::nPar(), TrkSimpTraj::parameters(), Trajectory::range(), and Trajectory::setFlightRange().

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.

Definition at line 495 of file TrkCircleTraj.cxx.

References d0Ind, NCIRPAR, omegaInd, DifIndepPar::parameter(), phi0Ind, and Constants::pi.

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 }

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

Implements TrkDifTraj.

Definition at line 59 of file TrkSimpTraj.cxx.

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

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

Definition at line 91 of file Trajectory.h.

References Trajectory::flightrange.

Referenced by TrkDifPieceTraj::append(), TrkSimpTraj::changePoint(), MdcUtilitySvc::docaPatPar(), TrkSimpTraj::invert(), TrkDifPieceTraj::invert(), TrkDifPieceTraj::locallyValid(), MdcHitOnTrack::MdcHitOnTrack(), TrkSimpTraj::operator==(), TrkDifPieceTraj::prepend(), Trajectory::range(), TrkRep::startValidRange(), TrkCompTrk::startValidRange(), TrkDifPieceTraj::trajIndex(), and TrkDifPieceTraj::TrkDifPieceTraj().

00091 {return flightrange[0];}

static int TrkCircleTraj::nCirPrm (  )  [inline, static]

Definition at line 85 of file TrkCircleTraj.h.

References NCIRPAR.

Referenced by derivDeflect(), derivDisplace(), derivPFract(), getDFInfo(), getDFInfo2(), paramFunc(), and TrkCircleTraj().

00085 {return NCIRPAR;}

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

Reimplemented from TrkSimpTraj.

Definition at line 69 of file TrkCircleTraj.h.

References NCIRPAR.

00069 {return NCIRPAR;}

double TrkCircleTraj::omega (  )  const [inline]

Definition at line 90 of file TrkCircleTraj.h.

References omegaIndex(), DifIndepPar::parameter(), and TrkSimpTraj::parameters().

Referenced by arc(), curvature(), delDirect(), derivDeflect(), derivDisplace(), derivPFract(), distTo1stError(), distTo2ndError(), getDFInfo(), getDFInfo2(), getInfo(), TrkCircleRep::helix(), position(), TrkCircleTraj(), x(), and y().

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

static int TrkCircleTraj::omegaIndex (  )  [inline, static]

Definition at line 84 of file TrkCircleTraj.h.

References omegaInd.

Referenced by derivPFract(), getDFInfo(), getDFInfo2(), omega(), paramFunc(), and TrkCircleTraj().

00084 {return omegaInd;}

TrkCircleTraj & TrkCircleTraj::operator= ( const TrkCircleTraj  ) 

Definition at line 71 of file TrkCircleTraj.cxx.

References TrkSimpTraj::_dtparams, TrkSimpTraj::_refpoint, and Trajectory::operator=().

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]

Definition at line 156 of file TrkSimpTraj.cxx.

References TrkSimpTraj::_dtparams, TrkSimpTraj::_refpoint, Trajectory::hiRange(), genRecEmupikp::i, Trajectory::lowRange(), mp, DifIndepPar::parameter(), and x.

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]

Definition at line 81 of file TrkSimpTraj.h.

References TrkSimpTraj::_dtparams.

00081 {return &_dtparams;}

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

Definition at line 80 of file TrkSimpTraj.h.

References TrkSimpTraj::_dtparams.

Referenced by TrkMomCalculator::calcCurvAllCovs(), TrkMomCalculator::calcCurvAllWeights(), TrkMomCalculator::calcNeutAllCovs(), TrkMomCalculator::calcNeutAllWeights(), TrkMomCalculator::calcNeutErrMom(), TrkMomCalculator::calcNeutPosmomCov(), TrkSimpTraj::changePoint(), TrkMomCalculator::charge(), TrkDifLineTraj::d0(), d0(), HelixTraj::d0(), TrkHelixFitter::fit(), TrkDifLineTraj::getDFInfo(), getDFInfo(), NeutTraj::getDFInfo(), HelixTraj::getDFInfo(), getDFInfo2(), HelixTraj::getDFInfo2(), HelixTraj::getInfo(), TrkLineRep::helix(), TrkHelixRep::helix(), TrkCircleRep::helix(), HelixTraj::HelixTraj(), TrkSimpTraj::invert(), TrkSimpleRep::nDof(), TrkSimpTraj::nPar(), omega(), HelixTraj::omega(), TrkDifLineTraj::phi0(), phi0(), HelixTraj::phi0(), HelixTraj::position(), TrkMomCalculator::ptMom(), TrkHelixRep::resid(), TrkDifLineTraj::tanDip(), HelixTraj::tanDip(), TrkCircleTraj(), TrkDifLineTraj::TrkDifLineTraj(), TrkHitOnTrk::TrkHitOnTrk(), TrkMomCalculator::vecMom(), TrkDifLineTraj::z0(), and HelixTraj::z0().

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]

Definition at line 436 of file TrkCircleTraj.cxx.

References cos(), d0Index(), M_2PI, M_PI, nCirPrm(), omegaIndex(), phi0Index(), rad, and sin().

Referenced by paramFunction().

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.

Definition at line 64 of file TrkCircleTraj.h.

References paramFunc().

00064 { return TrkCircleTraj::paramFunc; }

double TrkCircleTraj::phi0 (  )  const

Definition at line 430 of file TrkCircleTraj.cxx.

References TrkSimpTraj::parameters(), and phi0Index().

Referenced by angle(), getDFInfo(), getDFInfo2(), getInfo(), TrkCircleRep::helix(), position(), x(), and y().

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

static int TrkCircleTraj::phi0Index (  )  [inline, static]

Definition at line 83 of file TrkCircleTraj.h.

References phi0Ind.

Referenced by derivDeflect(), derivDisplace(), derivPFract(), getDFInfo(), getDFInfo2(), paramFunc(), and phi0().

00083 {return phi0Ind;}

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

Implements Trajectory.

Definition at line 100 of file TrkCircleTraj.cxx.

References angle(), cos(), d0(), omega(), phi0(), TrkSimpTraj::referencePoint(), and sin().

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.

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

Reimplemented from Trajectory.

Reimplemented in HelixTraj.

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

Definition at line 93 of file Trajectory.h.

References Trajectory::hiRange(), and Trajectory::lowRange().

Referenced by TrkDifPieceTraj::append(), TrkSimpTraj::invert(), TrkDifPieceTraj::invert(), and TrkDifPieceTraj::prepend().

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

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

Definition at line 84 of file TrkSimpTraj.h.

References TrkSimpTraj::_refpoint.

Referenced by TrkDifLineTraj::getDFInfo(), getDFInfo(), HelixTraj::getDFInfo(), getDFInfo2(), HelixTraj::getDFInfo2(), getInfo(), HelixTraj::getInfo(), TrkDifLineTraj::position(), position(), HelixTraj::position(), TrkDifLineTraj::x(), x(), TrkDifLineTraj::y(), y(), TrkDifLineTraj::z(), and HelixTraj::z().

00084 {return _refpoint;}

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

Reimplemented in TrkDifPieceTraj.

Definition at line 57 of file Trajectory.cxx.

References Trajectory::flightrange.

Referenced by TrkDifPieceTraj::append(), TrkSimpTraj::changePoint(), TrkSimpTraj::invert(), TrkDifPieceTraj::invert(), TrkDifPieceTraj::prepend(), and TrkDifPieceTraj::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]

Definition at line 96 of file TrkSimpTraj.h.

References TrkSimpTraj::_refpoint.

00096 {_refpoint = newpoint;}

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

Definition at line 88 of file Trajectory.h.

References Trajectory::flightrange.

Referenced by TrkDifPieceTraj::trajIndex().

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

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

Implements TrkSimpTraj.

Definition at line 522 of file TrkCircleTraj.cxx.

References TrkVisitor::trkVisitCircleTraj().

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

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

Definition at line 86 of file TrkCircleTraj.cxx.

References angle(), d0(), omega(), phi0(), TrkSimpTraj::referencePoint(), and sin().

Referenced by getDFInfo(), and getDFInfo2().

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]

Definition at line 93 of file TrkCircleTraj.cxx.

References angle(), cos(), d0(), omega(), phi0(), and TrkSimpTraj::referencePoint().

Referenced by getDFInfo(), and getDFInfo2().

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]

Definition at line 117 of file TrkSimpTraj.h.

Referenced by NeutTraj::_np(), TrkSimpTraj::changePoint(), TrkDifLineTraj::operator=(), operator=(), NeutTraj::operator=(), HelixTraj::operator=(), TrkSimpTraj::operator==(), and TrkSimpTraj::parameters().

HepPoint3D TrkSimpTraj::_refpoint [protected, inherited]

Definition at line 118 of file TrkSimpTraj.h.

Referenced by TrkSimpTraj::changePoint(), TrkDifLineTraj::operator=(), operator=(), HelixTraj::operator=(), TrkSimpTraj::operator==(), TrkSimpTraj::referencePoint(), and TrkSimpTraj::setPoint().

HepPoint3D TrkSimpTraj::_theOrigin [static, inherited]

Definition at line 59 of file TrkSimpTraj.h.

double Trajectory::flightrange[2] [protected, inherited]

Definition at line 83 of file Trajectory.h.

Referenced by TrkDifPieceTraj::append(), Trajectory::hiRange(), Trajectory::lowRange(), TrkDifPieceTraj::operator=(), NeutTraj::operator=(), Trajectory::operator=(), MdcSagTraj::operator=(), TrkDifPieceTraj::prepend(), TrkDifPieceTraj::resize(), TrkDifPieceTraj::setFlightRange(), Trajectory::setFlightRange(), Trajectory::Trajectory(), TrkDifPieceTraj::TrkDifPieceTraj(), and Trajectory::validFlightDistance().


Generated on Tue Nov 29 23:36:13 2016 for BOSS_7.0.2 by  doxygen 1.4.7