00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "CLHEP/Matrix/Matrix.h"
00014 #include "TrkBase/TrkLineTraj.h"
00015 #include "MdcGeom/TrkGeomTrajVisitor.h"
00016
00017 TrkLineTraj::TrkLineTraj(const HepPoint3D& point, const Hep3Vector& direction,
00018 double length) :
00019 TrkGeomTraj(0.0,length) , _start(point),
00020 _direction(direction)
00021 {
00022 _direction.setMag(1.0);
00023 }
00024
00025 TrkLineTraj::TrkLineTraj
00026 (const HepPoint3D& point,
00027 const Hep3Vector& direction,
00028 double lorange,
00029 double hirange):
00030 TrkGeomTraj(lorange,hirange),
00031 _start(point),
00032 _direction(direction)
00033 {
00034 _direction.setMag(1.0);
00035 }
00036
00037
00038
00039 TrkLineTraj::TrkLineTraj(const HepPoint3D& point1, const HepPoint3D& point2)
00040 : TrkGeomTraj(0.0,point1.distance2(point2)), _start(point1)
00041 {
00042
00043 _direction = ((CLHEP::Hep3Vector) point2) - ((CLHEP::Hep3Vector) point1);
00044 _direction.setMag(1.0);
00045 }
00046
00047 TrkLineTraj::TrkLineTraj(const TrkLineTraj& other) :
00048 TrkGeomTraj(other.lowRange(),other.hiRange()), _start(other._start),
00049 _direction(other._direction)
00050 {
00051 }
00052
00053 TrkLineTraj::~TrkLineTraj()
00054 {
00055 }
00056
00057 TrkLineTraj& TrkLineTraj::operator = (const TrkLineTraj& other)
00058 {
00059 if(&other != this){
00060 Trajectory::operator=(other);
00061 _start = other._start;
00062 _direction = other._direction;
00063 }
00064 return *this;
00065 }
00066
00067 TrkLineTraj*
00068 TrkLineTraj::clone() const
00069 {
00070 return new TrkLineTraj(*this);
00071 }
00072
00073 HepPoint3D
00074 TrkLineTraj::position(double flightlen) const
00075 {
00076 return _start + _direction*flightlen;
00077 }
00078
00079 Hep3Vector
00080 TrkLineTraj::direction(double ) const
00081 {
00082 return _direction;
00083 }
00084
00085 Hep3Vector
00086 TrkLineTraj::delDirect( double ) const
00087 {
00088 return Hep3Vector(0.,0.,0.);
00089 }
00090
00091 double
00092 TrkLineTraj::distTo1stError(double , double, int ) const
00093 {
00094 return 999.e4;
00095 }
00096
00097 double
00098 TrkLineTraj::distTo2ndError(double, double, int ) const
00099 {
00100 return 999.e4;
00101 }
00102
00103 double
00104 TrkLineTraj::curvature( double ) const
00105 {
00106 return 0.0;
00107 }
00108
00109 void
00110 TrkLineTraj::getInfo(double fltLen, HepPoint3D& pos, Hep3Vector& dir) const
00111 {
00112 pos = position(fltLen);
00113 dir = direction(fltLen);
00114 }
00115
00116 void
00117 TrkLineTraj::getInfo(double fltLen, HepPoint3D& pos, Hep3Vector& dir,
00118 Hep3Vector& delDir) const
00119 {
00120 pos = position(fltLen);
00121 dir = direction(fltLen);
00122 delDir = delDirect(fltLen);
00123 }
00124
00125 void
00126 TrkLineTraj::accept(TrkGeomTrajVisitor& visitor) const
00127 {
00128 visitor.visitLine(this);
00129 }