CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkCircleTraj Class Reference

#include <TrkCircleTraj.h>

+ Inheritance diagram for TrkCircleTraj:

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
 
- Public Member Functions inherited from TrkSimpTraj
 TrkSimpTraj (const HepVector &params, const HepSymMatrix &cov, const double startRange=-99999., const double endRange=99999., const HepPoint3D &refpoint=_theOrigin)
 
 TrkSimpTraj (const TrkParams &params, const double startRange=-99999., const double endRange=99999., const HepPoint3D &refpoint=_theOrigin)
 
virtual ~TrkSimpTraj ()
 
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
 
- Public Member Functions inherited from TrkDifTraj
 TrkDifTraj (const double lowlim=-99999., const double hilim=99999.)
 
virtual ~TrkDifTraj ()
 
- Public Member Functions inherited from Trajectory
 Trajectory (double lowlim, double hilim)
 
virtual ~Trajectory ()
 
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
 
- Public Member Functions inherited from TrkKalDeriv

Static Public Member Functions

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

Additional Inherited Members

- Static Public Attributes inherited from TrkSimpTraj
static HepPoint3D _theOrigin
 
- Protected Member Functions inherited from Trajectory
Trajectoryoperator= (const Trajectory &)
 
- Protected Attributes inherited from TrkSimpTraj
TrkParams _dtparams
 
HepPoint3D _refpoint
 
- Protected Attributes inherited from Trajectory
double flightrange [2]
 

Detailed Description

Definition at line 27 of file TrkCircleTraj.h.

Constructor & Destructor Documentation

◆ TrkCircleTraj() [1/3]

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

Definition at line 32 of file TrkCircleTraj.cxx.

33 :
34 TrkSimpTraj(pvec, pcov, lowlim,hilim,refpoint)
35//-----------------------------------------------------------------
36{
37 // Make sure the dimensions of the input matrix and vector are correct
38 if( pvec.num_row() != nCirPrm() ||
39 pcov.num_row() != nCirPrm() ){
40 std::cout<<"ErrMsg(fatal)" <<
41 "CircleTraj: incorrect constructor vector/matrix dimension" << std::endl;
42 }
43
44 if (omega() == 0.0) parameters()->parameter()[omegaIndex()] = 1.e-9;
45}
HepVector & parameter()
Definition DifIndepPar.h:51
static int nCirPrm()
static int omegaIndex()
double omega() const
TrkSimpTraj(const HepVector &params, const HepSymMatrix &cov, const double startRange=-99999., const double endRange=99999., const HepPoint3D &refpoint=_theOrigin)
TrkParams * parameters()
Definition TrkSimpTraj.h:80

Referenced by clone().

◆ TrkCircleTraj() [2/3]

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

Definition at line 49 of file TrkCircleTraj.cxx.

50 :
51 TrkSimpTraj(inpar.params(), inpar.covariance(), lowlim,hilim,refpoint) {
52//-----------------------------------------------------------------
53
54 if (omega() == 0.0) parameters()->parameter()[omegaIndex()] = 1.e-9;
55}
const HepVector & params() const
const HepSymMatrix & covariance() const

◆ TrkCircleTraj() [3/3]

TrkCircleTraj::TrkCircleTraj ( const TrkCircleTraj & h)

Definition at line 57 of file TrkCircleTraj.cxx.

60{
61
62}
double lowRange() const
Definition Trajectory.h:91
double hiRange() const
Definition Trajectory.h:92
HepSymMatrix & covariance()
Definition TrkParams.h:54
const HepPoint3D & referencePoint() const
Definition TrkSimpTraj.h:84

◆ ~TrkCircleTraj()

TrkCircleTraj::~TrkCircleTraj ( )

Definition at line 81 of file TrkCircleTraj.cxx.

82{
83}

Member Function Documentation

◆ clone()

TrkCircleTraj * TrkCircleTraj::clone ( ) const
virtual

Implements TrkSimpTraj.

Definition at line 65 of file TrkCircleTraj.cxx.

66{
67 return new TrkCircleTraj(*this);
68}
TrkCircleTraj(const HepVector &, const HepSymMatrix &, double lowlim=-99999., double hilim=99999., const HepPoint3D &refpoint=_theOrigin)

◆ curvature()

double TrkCircleTraj::curvature ( double fltLen) const
virtual

Implements Trajectory.

Definition at line 421 of file TrkCircleTraj.cxx.

422{
423// Compute the curvature as the magnitude of the 2nd derrivative
424// of the position function with respect to the 3-d flight distance
425
426 return fabs(omega());
427}

◆ d0()

double TrkCircleTraj::d0 ( ) const
inline

◆ d0Index()

static int TrkCircleTraj::d0Index ( )
inlinestatic

Definition at line 82 of file TrkCircleTraj.h.

82{return d0Ind;}

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

◆ delDirect()

Hep3Vector TrkCircleTraj::delDirect ( double fltLen) const
virtual

Implements Trajectory.

Definition at line 123 of file TrkCircleTraj.cxx.

124{
125 double delX = -omega() * sin(angle(fltLen));
126 double delY = omega() * cos(angle(fltLen));
127 return Hep3Vector(delX, delY, 0.0);
128}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213

◆ derivDeflect()

HepMatrix TrkCircleTraj::derivDeflect ( double fltlen,
deflectDirection idirect ) const
virtual

Implements TrkKalDeriv.

Definition at line 322 of file TrkCircleTraj.cxx.

323{
324// This function computes the column matrix of derivatives for the change
325// in parameters for a change in the direction of a track at a point along
326// its flight, holding the momentum and position constant. The effects for
327// changes in 2 perpendicular directions (theta1 = dip and
328// theta2 = phi*cos(dip)) can sometimes be added, as scattering in these
329// are uncorrelated.
330
331 HepMatrix ddflct(nCirPrm(),1,0); // initialize with zeros
332
333// Compute some common things
334
335 double omeg = omega();
336 double arcl = arc(fltlen);
337 double dx = cos(arcl);
338 double dy = sin(arcl);
339 double darc = omeg*d0();
340
341// Go through the parameters
342
343 switch (idirect) {
344 case theta1:
345 break;
346 case theta2:
347 ddflct[d0Index()][0] = -dy/(omeg);
348 ddflct[phi0Index()][0] = dx/(1+darc);
349 }
350
351 return ddflct;
352}
@ theta2
Definition TrkKalDeriv.h:24
@ theta1
Definition TrkKalDeriv.h:24
static int phi0Index()
double d0() const

◆ derivDisplace()

HepMatrix TrkCircleTraj::derivDisplace ( double fltlen,
deflectDirection idirect ) const
virtual

Implements TrkKalDeriv.

Definition at line 355 of file TrkCircleTraj.cxx.

356{
357// This function computes the column matrix of derivatives for the change
358// in parameters for a change in the position of a track at a point along
359// its flight, holding the momentum and direction constant. The effects for
360// changes in 2 perpendicular directions (theta1 = dip and
361// theta2 = phi*cos(dip)) can sometimes be added, as scattering in these
362// are uncorrelated.
363
364 HepMatrix ddflct(nCirPrm(),1,0); // initialize with zeros
365
366// Compute some common things
367
368 double omeg = omega();
369 double arcl = arc(fltlen);
370 double dx = cos(arcl);
371 double dy = sin(arcl);
372 double darc = omeg*d0();
373
374// Go through the parameters
375
376 switch (idirect) {
377 case theta1:
378 break;
379 case theta2:
380 ddflct[d0Index()][0] = dx;
381 ddflct[phi0Index()][0] = dy*omeg/(1+darc);
382 }
383
384 return ddflct;
385}

◆ derivPFract()

HepMatrix TrkCircleTraj::derivPFract ( double fltlen) const
virtual

Implements TrkKalDeriv.

Definition at line 388 of file TrkCircleTraj.cxx.

389{
390//
391// This function computes the column matrix of derrivatives for the change
392// in parameters from a (fractional) change in the track momentum,
393// holding the direction and position constant. The momentum change can
394// come from energy loss or bfield inhomogeneities.
395//
396// For a helix, dp/P = -domega/omega,
397// dParam/d(domega/omega) = omega*dParam/ddomega
398
399 HepMatrix dmomfrac(nCirPrm(),1);
400
401// Compute some common things
402
403 double omeg = omega();
404 double arcl = arc(fltlen);
405 double dx = cos(arcl);
406 double dy = sin(arcl);
407 double darc = omeg*d0();
408
409// Go through the parameters
410// omega
411 dmomfrac[omegaIndex()][0] = -omeg;
412// d0
413 dmomfrac[d0Index()][0] = -(1-dx)/omeg;
414// phi0
415 dmomfrac[phi0Index()][0] = dy/(1+darc);
416
417 return dmomfrac;
418}

◆ direction()

Hep3Vector TrkCircleTraj::direction ( double fltLen) const
virtual

Implements Trajectory.

Definition at line 111 of file TrkCircleTraj.cxx.

112{
113 // Angle formed by tangent vector after
114 // being rotated 'arclength' around orbit.
115 double alpha = angle( f );
116 // Construct 3-D tangent vector of unit magnitude.
117 return Hep3Vector ( cos(alpha),
118 sin(alpha),
119 0.0);
120}
const double alpha

◆ distTo1stError()

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

Implements Trajectory.

Definition at line 131 of file TrkCircleTraj.cxx.

132{
133 double arg = 2. * tol / fabs(omega());
134 assert (arg >= 0.);
135 return sqrt(arg);
136}
double arg(const EvtComplex &c)

◆ distTo2ndError()

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

Implements Trajectory.

Definition at line 139 of file TrkCircleTraj.cxx.

140{
141 //return pow(6.*tol / sqr(omega()), 0.33333333);//yzhang changed sqr
142 return pow(6.*tol / (omega()*omega()), 0.33333333);
143}

◆ getDFInfo()

void TrkCircleTraj::getDFInfo ( double fltLen,
DifPoint & pos,
DifVector & dir,
DifVector & delDir ) const
virtual

Implements TrkDifTraj.

Definition at line 253 of file TrkCircleTraj.cxx.

255{
256 //Provides difNum version of information for calculation of derivatives.
257
258 // Create difNumber versions of parameters
259 DifNumber phi0Df(phi0(), phi0Index()+1, nCirPrm());
260 DifNumber d0Df(d0(), d0Index()+1, nCirPrm());
261 DifNumber omegaDf(omega(), omegaIndex()+1, nCirPrm());
262 phi0Df.setIndepPar( parameters() );
263 d0Df.setIndepPar( parameters() );
264 omegaDf.setIndepPar( parameters() );
265
266 DifNumber sinPhi0, cosPhi0;
267 phi0Df.cosAndSin(cosPhi0, sinPhi0);
268
269 DifNumber alphaDf = omegaDf;
270 alphaDf *= flt;
271 alphaDf += phi0Df;
272
273 // This is not the prettiest line imaginable for this operation:
275 DifNumber sinAlpha, cosAlpha;
276 alphaDf.cosAndSin(cosAlpha, sinAlpha);
277
278 // DifNumber x = (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
279 // DifNumber y = -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
280
281 DifNumber x = sinAlpha;
282 x -= sinPhi0;
283 x /= omegaDf;
284 x -= (d0Df * sinPhi0);
285
286 DifNumber y = -cosAlpha;
287 y += cosPhi0;
288 y /= omegaDf;
289 y += (d0Df * cosPhi0);
290
291
292 static DifNumber zNull(0.);
293
294 pos.x = x;
295 pos.y = y;
296 pos.z = zNull;
297
298 bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
299 referencePoint().z() != 0.);
300 if (lref) {
301 DifNumber px(referencePoint().x());
302 DifNumber py(referencePoint().y());
303 DifNumber pz(referencePoint().z());
304 pos.x += px;
305 pos.y += py;
306 pos.z += pz;
307 }
308
309 dir.x = cosAlpha;
310 dir.y = sinAlpha;
311 dir.z = 0.;
312
313 delDir.x = -omegaDf;
314 delDir.x *= sinAlpha;
315
316 delDir.y = omegaDf;
317 delDir.y *= cosAlpha;
318
319 delDir.z = 0.;
320}
Double_t x[10]
static const double pi
Definition Constants.h:38
DifNumber & mod(double lo, double hi)
void cosAndSin(DifNumber &c, DifNumber &s) const
DifNumber y
Definition DifVector.h:149
DifNumber x
Definition DifVector.h:148
DifNumber z
Definition DifVector.h:150
double phi0() const

◆ getDFInfo2()

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

Reimplemented from TrkDifTraj.

Definition at line 191 of file TrkCircleTraj.cxx.

193{
194 //Provides difNum version of information for calculation of derivatives.
195
196 // Create difNumber versions of parameters
197 DifNumber phi0Df(phi0(), phi0Index()+1, nCirPrm());
198 DifNumber d0Df(d0(), d0Index()+1, nCirPrm());
199 DifNumber omegaDf(omega(), omegaIndex()+1, nCirPrm());
200 phi0Df.setIndepPar( parameters() );
201 d0Df.setIndepPar( parameters() );
202 omegaDf.setIndepPar( parameters() );
203
204 DifNumber sinPhi0, cosPhi0;
205 phi0Df.cosAndSin(cosPhi0, sinPhi0);
206
207 DifNumber alphaDf = omegaDf;
208 alphaDf *= fltLen;
209 alphaDf += phi0Df;
210
211 // This is not the prettiest line imaginable for this operation:
213 DifNumber sinAlpha, cosAlpha;
214 alphaDf.cosAndSin(cosAlpha, sinAlpha);
215
216 // DifNumber x = (sinAlpha - sinPhi0) / omegaDf - d0Df * sinPhi0 + px;
217 // DifNumber y = -(cosAlpha - cosPhi0) / omegaDf + d0Df * cosPhi0 + py;
218
219 DifNumber x = sinAlpha;
220 x -= sinPhi0;
221 x /= omegaDf;
222 x -= (d0Df * sinPhi0);
223
224 DifNumber y = -cosAlpha;
225 y += cosPhi0;
226 y /= omegaDf;
227 y += (d0Df * cosPhi0);
228
229
230 static DifNumber zNull(0.);
231
232 pos.x = x;
233 pos.y = y;
234 pos.z = zNull;
235
236 bool lref = (referencePoint().x() != 0. || referencePoint().y() != 0. ||
237 referencePoint().z() != 0.);
238 if (lref) {
239 DifNumber px(referencePoint().x());
240 DifNumber py(referencePoint().y());
241 DifNumber pz(referencePoint().z());
242 pos.x += px;
243 pos.y += py;
244 pos.z += pz;
245 }
246
247 dir.x = cosAlpha;
248 dir.y = sinAlpha;
249 dir.z = 0.;
250}

◆ getInfo() [1/2]

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

Implements Trajectory.

Definition at line 146 of file TrkCircleTraj.cxx.

148{
149 double sphi0 = sin(phi0());
150 double cphi0 = cos(phi0());
151 double ang = angle(flt);
152 double cang = cos(ang);
153 double sang = sin(ang);
154 double xt = (sang-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
155 double yt = -(cang-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
156
157 pos.setX(xt);
158 pos.setY(yt);
159 pos.setZ(referencePoint().z());
160
161 dir.setX(cang);
162 dir.setY(sang);
163 dir.setZ(0.0);
164
165 delDir.setX(-omega()*sang);
166 delDir.setY( omega()*cang);
167 delDir.setZ(0.);
168}

◆ getInfo() [2/2]

void TrkCircleTraj::getInfo ( double fltLen,
HepPoint3D & pos,
Hep3Vector & dir ) const
virtual

Implements Trajectory.

Definition at line 171 of file TrkCircleTraj.cxx.

172{
173 double sphi0 = sin(phi0());
174 double cphi0 = cos(phi0());
175 double ang = angle(fltLen);
176 double cang = cos(ang);
177 double sang = sin(ang);
178 double xt = (sang-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
179 double yt = -(cang-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
180
181 pos.setX(xt);
182 pos.setY(yt);
183 pos.setZ(referencePoint().z());
184
185 dir.setX(cang);
186 dir.setY(sang);
187 dir.setZ(0.0);
188}

◆ invertParams()

void TrkCircleTraj::invertParams ( TrkParams * params,
std::vector< bool > & flags ) const
virtual

Implements TrkSimpTraj.

Definition at line 495 of file TrkCircleTraj.cxx.

496{
497 // Inverts parameters and returns true if the parameter inversion
498 // requires a change in sign of elements in the covariance matrix
499
500 for (unsigned iparam = 0; iparam < NCIRPAR; iparam++) {
501 switch ( iparam ) {
502 case d0Ind: // changes sign
503 case omegaInd: // changes sign
504 params->parameter()[iparam] *= -1.0;
505 flags[iparam] = true;
506 break;
507 case phi0Ind: // changes by pi, but covariance matrix shouldn't change
508 params->parameter()[iparam] =
509 BesAngle(params->parameter()[iparam] + Constants::pi);
510 flags[iparam] = false;
511 }
512 }
513}

◆ nCirPrm()

static int TrkCircleTraj::nCirPrm ( )
inlinestatic

Definition at line 85 of file TrkCircleTraj.h.

85{return NCIRPAR;}

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

◆ nPar()

int TrkCircleTraj::nPar ( ) const
inlinevirtual

Reimplemented from TrkSimpTraj.

Definition at line 69 of file TrkCircleTraj.h.

69{return NCIRPAR;}

◆ omega()

◆ omegaIndex()

static int TrkCircleTraj::omegaIndex ( )
inlinestatic

Definition at line 84 of file TrkCircleTraj.h.

84{return omegaInd;}

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

◆ operator=()

TrkCircleTraj & TrkCircleTraj::operator= ( const TrkCircleTraj & h)

Definition at line 71 of file TrkCircleTraj.cxx.

72{
73 if( &h != this ){
75 _dtparams = *(h.parameters());
77 }
78 return *this;
79}
Trajectory & operator=(const Trajectory &)
TrkParams _dtparams
HepPoint3D _refpoint

◆ paramFunction()

TranslateParams TrkCircleTraj::paramFunction ( ) const
inlinevirtual

Implements TrkSimpTraj.

Definition at line 64 of file TrkCircleTraj.h.

64{ return TrkCircleTraj::paramFunc; }

◆ phi0()

double TrkCircleTraj::phi0 ( ) const

Definition at line 430 of file TrkCircleTraj.cxx.

431{
432 return BesAngle(parameters()->parameter()[phi0Index()]).rad();
433}
double rad() const
Definition BesAngle.h:118

Referenced by getDFInfo(), getDFInfo2(), getInfo(), getInfo(), TrkCircleRep::helix(), position(), and TrkCircleRep::print().

◆ phi0Index()

static int TrkCircleTraj::phi0Index ( )
inlinestatic

Definition at line 83 of file TrkCircleTraj.h.

83{return phi0Ind;}

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

◆ position()

HepPoint3D TrkCircleTraj::position ( double fltLen) const
virtual

Implements Trajectory.

Definition at line 100 of file TrkCircleTraj.cxx.

101{
102 double sphi0 = sin(phi0());
103 double cphi0 = cos(phi0());
104 double ang = angle(f);
105 double xt = ( sin(ang)-sphi0)/omega() - d0()*sphi0 + referencePoint().x();
106 double yt = -(cos(ang)-cphi0)/omega() + d0()*cphi0 + referencePoint().y();
107 return HepPoint3D(xt, yt, referencePoint().z());
108}
HepGeom::Point3D< double > HepPoint3D

◆ visitAccept()

void TrkCircleTraj::visitAccept ( TrkVisitor * vis) const
virtual

Implements TrkSimpTraj.

Definition at line 522 of file TrkCircleTraj.cxx.

523{
524// Visitor access--just use the TrkVisitor class member function
525 vis->trkVisitCircleTraj(this);
526}
virtual void trkVisitCircleTraj(const TrkCircleTraj *)=0

The documentation for this class was generated from the following files: