CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
StraightLine Class Reference

#include <StraightLine.h>

Public Member Functions

 StraightLine (const HepPoint3D &pivot, const HepVector &a)
 
 StraightLine (double dr, double phi0, double dz, double tanl)
 
 StraightLine (HepPoint3D pos1, HepPoint3D pos2)
 
virtual ~StraightLine ()
 Destructor.
 
const HepPoint3Dpivot (void) const
 returns pivot position.
 
const HepVector & a (void) const
 returns helix parameters.
 
double dr (void) const
 returns an element of parameters.
 
double phi0 (void) const
 
double dz (void) const
 
double tanl (void) const
 
double sinPhi0 (void) const
 
double cosPhi0 (void) const
 
double lambda () const
 
double theta () const
 
double cosTheta () const
 
HepPoint3D x (double s=0.) const
 returns position after moving s in downwoards
 
double sAtR (double R, int direction=1) const
 
HepPoint3D xAtR (double R, int direction=1) const
 
double sAtPhi (double phi) const
 
HepPoint3D xAtPhi (double phi) const
 
void set (const HepVector &a)
 returns position and convariance matrix(Ex) after moving s.
 
void set (const HepPoint3D &pivot)
 
void set (const HepPoint3D &pivot, const HepVector &a)
 sets pivot position, parameters.
 
void print ()
 
 StraightLine (const HepPoint3D &pivot, const HepVector &a)
 
 StraightLine (double dr, double phi0, double dz, double tanl)
 
 StraightLine (HepPoint3D pos1, HepPoint3D pos2)
 
virtual ~StraightLine ()
 Destructor.
 
const HepPoint3Dpivot (void) const
 returns pivot position.
 
const HepVector & a (void) const
 returns helix parameters.
 
double dr (void) const
 returns an element of parameters.
 
double phi0 (void) const
 
double dz (void) const
 
double tanl (void) const
 
double sinPhi0 (void) const
 
double cosPhi0 (void) const
 
double lambda () const
 
double theta () const
 
double cosTheta () const
 
HepPoint3D x (double s=0.) const
 returns position after moving s in downwoards
 
double sAtR (double R, int direction=1) const
 
HepPoint3D xAtR (double R, int direction=1) const
 
double sAtPhi (double phi) const
 
HepPoint3D xAtPhi (double phi) const
 
void set (const HepVector &a)
 returns position and convariance matrix(Ex) after moving s.
 
void set (const HepPoint3D &pivot)
 
void set (const HepPoint3D &pivot, const HepVector &a)
 sets pivot position, parameters.
 
void print ()
 

Detailed Description

Constructor & Destructor Documentation

◆ StraightLine() [1/6]

StraightLine::StraightLine ( const HepPoint3D pivot,
const HepVector &  a 
)

Definition at line 8 of file StraightLine.cxx.

9 :m_pivot(pivot),m_a(a)
10{
11}
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.

◆ StraightLine() [2/6]

StraightLine::StraightLine ( double  dr,
double  phi0,
double  dz,
double  tanl 
)

Definition at line 13 of file StraightLine.cxx.

14 :m_a(HepVector(4,0))
15{
16 m_a[0]=dr;
17 m_a[1]=phi0;
18 m_a[2]=dz;
19 m_a[3]=tanl;
20
21 HepPoint3D pivot(0,0,0);
22 m_pivot=pivot;
23}
double dr(void) const
returns an element of parameters.

◆ StraightLine() [3/6]

StraightLine::StraightLine ( HepPoint3D  pos1,
HepPoint3D  pos2 
)

Definition at line 25 of file StraightLine.cxx.

26 :m_a(HepVector(4,0))
27{
28 // cout << "debug int StraightLine" << endl;
29 // cout << "2points: " << setw(15) << pos1.x() << setw(15) << pos1.y() << setw(15) << pos1.z()
30 // << setw(15) << pos2.x() << setw(15) << pos2.y() << setw(15) << pos2.z() << endl;
31 HepPoint3D pivot(0,0,0);
32 m_pivot=pivot;
33
34 if(pos1.y()<pos2.y()) {
35 HepPoint3D pos_tmp=pos1;
36 pos1=pos2;
37 pos2=pos_tmp;
38 }
39 else if(pos1.y()==pos2.y()&&pos1.x()>pos2.x()) {
40 HepPoint3D pos_tmp = pos1;
41 pos1=pos2;
42 pos2=pos_tmp;
43 }
44 //cout<<__FILE__<<": pos1, pos2 = "<<pos1<<", "<<pos2<<endl;
45 HepPoint3D vec = pos2-pos1;
46 double phi_vec = vec.phi();// (pi,2pi]
47 //cout<<__FILE__<<": phi_vec="<<phi_vec<<endl;
48 double phi0=phi_vec+M_PI/2.;// automatically in (-pi/2,pi/2)
49 //cout<<__FILE__<<": phi0 ="<<phi0 <<endl;
50 double dphi1=pos1.phi()-phi0;
51 double dr = pos1.perp()*cos(dphi1);
52
53 double s1(0.),s2(0.);
54 if(pos1.y()!=pos2.y()) {
55 s1=(pos1.y()-dr*sin(phi0))/sin(phi_vec);
56 s2=(pos2.y()-dr*sin(phi0))/sin(phi_vec);
57 }
58 else {
59 s1=(pos1.x()-dr*cos(phi0))/cos(phi_vec);
60 s2=(pos2.x()-dr*cos(phi0))/cos(phi_vec);
61 }
62
63 double dz(0.),tanl(0.);
64 if(s1>=s2) {
65 cout<<"s1>=s2!!!"<<endl;
66 }
67 else {
68 tanl=(pos2.z()-pos1.z())/(s2-s1);
69 dz=-s1*tanl+pos1.z();
70 }
71 m_a[0]=dr;
72 m_a[1]=phi0;
73 m_a[2]=dz;
74 m_a[3]=tanl;
75 // cout << "line: " << setw(15) << dr << setw(15) << phi0 << setw(15) << dz << setw(15) << tanl << endl;
76}
double sin(const BesAngle a)
double cos(const BesAngle a)
#define M_PI
Definition: TConstant.h:4
dble_vec_t vec[12]
Definition: ranlxd.c:372

◆ ~StraightLine() [1/2]

StraightLine::~StraightLine ( )
virtual

Destructor.

Definition at line 78 of file StraightLine.cxx.

79{}

◆ StraightLine() [4/6]

StraightLine::StraightLine ( const HepPoint3D pivot,
const HepVector &  a 
)

◆ StraightLine() [5/6]

StraightLine::StraightLine ( double  dr,
double  phi0,
double  dz,
double  tanl 
)

◆ StraightLine() [6/6]

StraightLine::StraightLine ( HepPoint3D  pos1,
HepPoint3D  pos2 
)

◆ ~StraightLine() [2/2]

virtual StraightLine::~StraightLine ( )
virtual

Destructor.

Member Function Documentation

◆ a() [1/2]

const HepVector & StraightLine::a ( void  ) const
inline

returns helix parameters.

Definition at line 43 of file Cgem/CgemGeomSvc/CgemGeomSvc-00-00-31-p01/CgemGeomSvc/StraightLine.h.

43{return m_a;};

Referenced by set().

◆ a() [2/2]

const HepVector & StraightLine::a ( void  ) const
inline

returns helix parameters.

Definition at line 43 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

43{return m_a;};

◆ cosPhi0() [1/2]

double StraightLine::cosPhi0 ( void  ) const
inline

◆ cosPhi0() [2/2]

double StraightLine::cosPhi0 ( void  ) const
inline

Definition at line 51 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

51{return cos(phi0());};

◆ cosTheta() [1/2]

double StraightLine::cosTheta ( ) const
inline

◆ cosTheta() [2/2]

double StraightLine::cosTheta ( ) const
inline

Definition at line 54 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

54{return cos(theta());};

◆ dr() [1/2]

double StraightLine::dr ( void  ) const
inline

returns an element of parameters.

Definition at line 45 of file Cgem/CgemGeomSvc/CgemGeomSvc-00-00-31-p01/CgemGeomSvc/StraightLine.h.

45{return m_a[0];};

Referenced by CgemMidDriftPlane::getPointAligned(), and StraightLine().

◆ dr() [2/2]

double StraightLine::dr ( void  ) const
inline

returns an element of parameters.

Definition at line 45 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

45{return m_a[0];};

◆ dz() [1/2]

double StraightLine::dz ( void  ) const
inline

◆ dz() [2/2]

double StraightLine::dz ( void  ) const
inline

Definition at line 48 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

48{return m_a[2];};

◆ lambda() [1/2]

double StraightLine::lambda ( ) const
inline

Definition at line 52 of file Cgem/CgemGeomSvc/CgemGeomSvc-00-00-31-p01/CgemGeomSvc/StraightLine.h.

52{return atan(m_a[3]);};

Referenced by theta().

◆ lambda() [2/2]

double StraightLine::lambda ( ) const
inline

Definition at line 52 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

52{return atan(m_a[3]);};

◆ phi0() [1/2]

double StraightLine::phi0 ( void  ) const
inline

◆ phi0() [2/2]

double StraightLine::phi0 ( void  ) const
inline

Definition at line 46 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

46{return m_a[1];};

◆ pivot() [1/2]

const HepPoint3D & StraightLine::pivot ( void  ) const
inline

returns pivot position.

Definition at line 40 of file Cgem/CgemGeomSvc/CgemGeomSvc-00-00-31-p01/CgemGeomSvc/StraightLine.h.

40{return m_pivot;};

Referenced by set(), and StraightLine().

◆ pivot() [2/2]

const HepPoint3D & StraightLine::pivot ( void  ) const
inline

returns pivot position.

Definition at line 40 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

40{return m_pivot;};

◆ print() [1/2]

void StraightLine::print ( )

Definition at line 152 of file StraightLine.cxx.

153{
154 cout<<"line pivot: "<<m_pivot<<endl;
155 cout<<" par: "<<m_a<<endl;
156}

◆ print() [2/2]

void StraightLine::print ( )

◆ sAtPhi() [1/2]

double StraightLine::sAtPhi ( double  phi) const

Definition at line 108 of file StraightLine.cxx.

109{
110 // if pivot at (0,0,0)
111 double ss=999999.;
112 //double phi0_global = m_a[1];//(-pi/2,pi/2]
113 if(m_a[0]<0) {
114 //phi0_global+ = M_PI; //(pi/2,3/2*pi]
115 phi+=M_PI;
116 }
117 double dphi=phi0()-phi;
118 while(dphi> M_PI) dphi-=2*M_PI;
119 while(dphi<-M_PI) dphi+=2*M_PI;
120 if(fabs(dphi)<M_PI/2)
121 {
122 ss=m_a[0]*tan(dphi);
123 }
124 return ss;
125}
double tan(const BesAngle a)

Referenced by xAtPhi().

◆ sAtPhi() [2/2]

double StraightLine::sAtPhi ( double  phi) const

◆ sAtR() [1/2]

double StraightLine::sAtR ( double  R,
int  direction = 1 
) const

Definition at line 89 of file StraightLine.cxx.

90{
91 // if pivot at (0,0,0)
92 double ss=999999.;
93 if(fabs(m_a[0])<=R) {
94 ss=sqrt(R*R-m_a[0]*m_a[0]);
95 ss*=direction;
96 }
97 return ss;
98}

Referenced by CgemGeoAlign::StraightLineConversion(), and xAtR().

◆ sAtR() [2/2]

double StraightLine::sAtR ( double  R,
int  direction = 1 
) const

◆ set() [1/6]

void StraightLine::set ( const HepPoint3D pivot)

Definition at line 140 of file StraightLine.cxx.

141{
142 m_pivot = pivot;
143 // m_a to be updated // FIXME
144}

◆ set() [2/6]

void StraightLine::set ( const HepPoint3D pivot)

◆ set() [3/6]

void StraightLine::set ( const HepPoint3D pivot,
const HepVector &  a 
)

sets pivot position, parameters.

Definition at line 146 of file StraightLine.cxx.

147{
148 m_pivot = pivot;
149 m_a=a;
150}

◆ set() [4/6]

void StraightLine::set ( const HepPoint3D pivot,
const HepVector &  a 
)

sets pivot position, parameters.

◆ set() [5/6]

void StraightLine::set ( const HepVector &  a)

returns position and convariance matrix(Ex) after moving s.

Definition at line 135 of file StraightLine.cxx.

136{
137 m_a=a;
138}

◆ set() [6/6]

void StraightLine::set ( const HepVector &  a)

returns position and convariance matrix(Ex) after moving s.

◆ sinPhi0() [1/2]

double StraightLine::sinPhi0 ( void  ) const
inline

◆ sinPhi0() [2/2]

double StraightLine::sinPhi0 ( void  ) const
inline

Definition at line 50 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

50{return sin(phi0());};

◆ tanl() [1/2]

double StraightLine::tanl ( void  ) const
inline

◆ tanl() [2/2]

double StraightLine::tanl ( void  ) const
inline

Definition at line 49 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

49{return m_a[3];};

◆ theta() [1/2]

double StraightLine::theta ( ) const
inline

◆ theta() [2/2]

double StraightLine::theta ( ) const
inline

Definition at line 53 of file InstallArea/include/CgemGeomSvc/CgemGeomSvc/StraightLine.h.

53{return M_PI/2.-lambda();};

◆ x() [1/2]

HepPoint3D StraightLine::x ( double  s = 0.) const

returns position after moving s in downwoards

Definition at line 81 of file StraightLine.cxx.

82{
83 double x=m_a[0]*cos(m_a[1])+s*cos(m_a[1]-M_PI/2.);
84 double y=m_a[0]*sin(m_a[1])+s*sin(m_a[1]-M_PI/2.);
85 double z=m_a[2]+s*m_a[3];
86 return HepPoint3D(x,y,z);
87}
XmlRpcServer s
Definition: HelloServer.cpp:11
HepGeom::Point3D< double > HepPoint3D
HepPoint3D x(double s=0.) const
returns position after moving s in downwoards

Referenced by CgemGeoAlign::StraightLineConversion(), x(), xAtPhi(), and xAtR().

◆ x() [2/2]

HepPoint3D StraightLine::x ( double  s = 0.) const

returns position after moving s in downwoards

◆ xAtPhi() [1/2]

HepPoint3D StraightLine::xAtPhi ( double  phi) const

Definition at line 127 of file StraightLine.cxx.

128{
129 HepPoint3D pos(999999,999999,999999);
130 double ss=sAtPhi(phi);
131 if(ss!=999999.) pos=x(ss);
132 return pos;
133}
double sAtPhi(double phi) const

◆ xAtPhi() [2/2]

HepPoint3D StraightLine::xAtPhi ( double  phi) const

◆ xAtR() [1/2]

HepPoint3D StraightLine::xAtR ( double  R,
int  direction = 1 
) const

Definition at line 100 of file StraightLine.cxx.

101{
102 HepPoint3D pos(999999,999999,999999);
103 double ss=sAtR(R, direction);
104 if(ss!=999999.) pos=x(ss);
105 return pos;
106}
double sAtR(double R, int direction=1) const

Referenced by CgemMidDriftPlane::getPointAligned(), CgemMidDriftPlane::getPointIdealGeom(), and CgemGeoAlign::StraightLineConversion().

◆ xAtR() [2/2]

HepPoint3D StraightLine::xAtR ( double  R,
int  direction = 1 
) const

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