CGEM BOSS 6.6.5.g
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 ()
 

Detailed Description

Definition at line 23 of file StraightLine.h.

Constructor & Destructor Documentation

◆ StraightLine() [1/3]

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.
Definition: StraightLine.h:40
const HepVector & a(void) const
returns helix parameters.
Definition: StraightLine.h:43

◆ StraightLine() [2/3]

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 dz(void) const
Definition: StraightLine.h:48
double dr(void) const
returns an element of parameters.
Definition: StraightLine.h:45
double tanl(void) const
Definition: StraightLine.h:49
double phi0(void) const
Definition: StraightLine.h:46

◆ StraightLine() [3/3]

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<<"StraightLine: 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)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
#define M_PI
Definition: TConstant.h:4
dble_vec_t vec[12]
Definition: ranlxd.c:372

◆ ~StraightLine()

StraightLine::~StraightLine ( )
virtual

Destructor.

Definition at line 78 of file StraightLine.cxx.

79{}

Member Function Documentation

◆ a()

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

returns helix parameters.

Definition at line 43 of file StraightLine.h.

43{return m_a;};

Referenced by set().

◆ cosPhi0()

double StraightLine::cosPhi0 ( void  ) const
inline

Definition at line 51 of file StraightLine.h.

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

◆ cosTheta()

double StraightLine::cosTheta ( ) const
inline

Definition at line 54 of file StraightLine.h.

54{return cos(theta());};
double theta() const
Definition: StraightLine.h:53

◆ dr()

double StraightLine::dr ( void  ) const
inline

◆ dz()

double StraightLine::dz ( void  ) const
inline

◆ lambda()

double StraightLine::lambda ( ) const
inline

Definition at line 52 of file StraightLine.h.

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

Referenced by theta().

◆ phi0()

double StraightLine::phi0 ( void  ) const
inline

◆ pivot()

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

returns pivot position.

Definition at line 40 of file StraightLine.h.

40{return m_pivot;};

Referenced by set(), and StraightLine().

◆ print()

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}

◆ sAtPhi()

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)
Definition: BesAngle.h:216

Referenced by xAtPhi().

◆ sAtR()

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().

◆ set() [1/3]

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/3]

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() [3/3]

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}

◆ sinPhi0()

double StraightLine::sinPhi0 ( void  ) const
inline

Definition at line 50 of file StraightLine.h.

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

◆ tanl()

double StraightLine::tanl ( void  ) const
inline

◆ theta()

double StraightLine::theta ( ) const
inline

Definition at line 53 of file StraightLine.h.

53{return M_PI/2.-lambda();};
double lambda() const
Definition: StraightLine.h:52

Referenced by cosTheta().

◆ x()

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
Definition: StraightLine.h:16
HepPoint3D x(double s=0.) const
returns position after moving s in downwoards

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

◆ xAtPhi()

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

◆ xAtR()

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::getPointIdealGeom(), BesCgemSD::ProcessHits(), and CgemGeoAlign::StraightLineConversion().


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