BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
T3DLine Class Reference

A class to represent a track in tracking. More...

#include <T3DLine.h>

+ Inheritance diagram for T3DLine:

Public Member Functions

 T3DLine ()
 Constructors.
 
 T3DLine (const TTrack &)
 
 T3DLine (const T3DLine &)
 
virtual ~T3DLine ()
 Destructor.
 
double dr (void) const
 Track parameters.
 
double phi0 (void) const
 
double dz (void) const
 
double tanl (void) const
 
double cosPhi0 (void) const
 
double sinPhi0 (void) const
 
Vector a (void) const
 
const SymMatrixEa (void) const
 returns error matrix
 
const HepPoint3Dpivot (void) const
 pivot position
 
Helix helix (void) const
 approximated helix class
 
unsigned ndf (void) const
 returns NDF
 
double chi2 (void) const
 returns chi2.
 
double reducedchi2 (void) const
 returns reduced-chi2
 
unsigned objectType (void) const
 returns object type
 
HepPoint3D x (double) const
 returns position on 3D line
 
HepPoint3D x0 (void) const
 returns 3D line component x(t)=x0 + t * k
 
HepVector3D k (void) const
 
int approach (TMLink &, bool sagCorrection=true) const
 calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
 
int approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack) const
 caluculate closest points between a line and this track
 
int approach_point (const HepPoint3D &, HepPoint3D &onTrack) const
 caluculate closest point between a point and this track
 
const HepPoint3Dpivot (const HepPoint3D &)
 set new pivot
 
void set (const HepPoint3D &, double t_dr, double t_phi0, double t_dz, double t_tanl)
 set track parameters,pivot
 
Vector a (const Vector &)
 set track parameters
 
const SymMatrixEa (const SymMatrix &)
 set error matrix
 
- Public Member Functions inherited from TTrackBase
 TTrackBase ()
 Constructor.
 
 TTrackBase (const AList< TMLink > &links)
 Constructor.
 
virtual ~TTrackBase ()
 Destructor.
 
virtual unsigned objectType (void) const
 returns object type.
 
virtual unsigned type (void) const
 returns type. Definition is depending on an object class.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
const AList< TMLink > & links (unsigned mask=0) const
 returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
 
unsigned nLinks (unsigned mask=0) const
 returns # of masked TMLinks assigned to this track object.
 
const AList< TMLink > & cores (unsigned mask=0) const
 returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
 
unsigned nCores (unsigned mask=0) const
 returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
 
void update (void) const
 update cache.
 
void append (TMLink &)
 appends a TMLink.
 
void append (const AList< TMLink > &)
 appends TMLinks.
 
void appendByApproach (AList< TMLink > &list, double maxSigma)
 appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
 
void appendByDistance (AList< TMLink > &list, double maxDistance)
 appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
 
void remove (TMLink &a)
 removes a TMLink.
 
void remove (const AList< TMLink > &)
 removes TMLinks.
 
virtual void refine (AList< TMLink > &list, double maxSigma)
 removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
 
virtual void refine (double maxSigma)
 removes bad points by pull. The bad points are masked not to be used in fit.
 
virtual int DropWorst ()
 
virtual void removeLinks (void)
 
virtual double distance (const TMLink &) const
 returns distance to a position of TMLink in TMLink space.
 
virtual int approach (TMLink &) const
 calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
 
unsigned testByApproach (const TMLink &list, double sigma) const
 returns # of good hits to be appended.
 
unsigned testByApproach (const AList< TMLink > &list, double sigma) const
 
virtual int fit (void)
 fits itself by a default fitter. Error was happened if return value is not zero.
 
const TMFitter *const fitter (void) const
 returns a pointer to a default fitter.
 
const TMFitter *const fitter (const TMFitter *)
 sets a default fitter.
 
void falseFit ()
 false Fit
 
TMLinkoperator[] (unsigned i) const
 
const TTrackHEP *const hep (void) const
 returns TTrackHEP.
 
unsigned nHeps (void) const
 returns # of contributed TTrackHEP tracks.
 
const TTrackMC *const mc (void) const
 returns a pointer to TTrackMC.
 
bool fitted (void) const
 returns true if fitted.
 
bool fittedWithCathode (void) const
 returns true if fitted with cathode hits(TEMPORARY).
 

Friends

class T3DLineFitter
 

Additional Inherited Members

- Protected Attributes inherited from TTrackBase
AList< TMLink_links
 
bool _fitted
 
bool _fittedWithCathode
 
TTrackMC_mc
 

Detailed Description

A class to represent a track in tracking.

Definition at line 50 of file T3DLine.h.

Constructor & Destructor Documentation

◆ T3DLine() [1/3]

T3DLine::T3DLine ( )

Constructors.

Definition at line 21 of file T3DLine.cxx.

22 : TTrackBase(),
23 _dr(0),_phi0(0),_dz(0),_tanl(0),
24 _chi2(0),_ndf(0),_Ea(SymMatrix(4,0)),
25 _pivot(ORIGIN){
26
27 _cos_phi0 = 1;
28 _sin_phi0 = 0;
29
30 //...Set a default fitter...
31 fitter(& T3DLine::_fitter);
32
33 _fitted = false;
34 _fittedWithCathode = false;
35}
const HepPoint3D ORIGIN
Constants.
Definition: TMDCUtil.cxx:47
bool _fittedWithCathode
Definition: TTrackBase.h:163
bool _fitted
Definition: TTrackBase.h:162
const TMFitter *const fitter(void) const
returns a pointer to a default fitter.
Definition: TTrackBase.h:255
TTrackBase()
Constructor.
Definition: TTrackBase.cxx:40

◆ T3DLine() [2/3]

T3DLine::T3DLine ( const TTrack a)

Definition at line 37 of file T3DLine.cxx.

38 : TTrackBase((TTrackBase &) a),
39 _dr(a.helix().dr()),
40 _phi0(a.helix().phi0()),
41 _dz(a.helix().dz()),
42 _tanl(a.helix().tanl()),
43 _chi2(0),_ndf(0),_Ea(SymMatrix(4,0)),
44 _pivot(a.helix().pivot()){
45
46 _cos_phi0 = cos(_phi0);
47 _sin_phi0 = sin(_phi0);
48
49 //...Set a default fitter...
50 fitter(& T3DLine::_fitter);
51
52 _fitted = false;
53 _fittedWithCathode = false;
54}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
Vector a(void) const
Definition: T3DLine.cxx:107
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46

◆ T3DLine() [3/3]

T3DLine::T3DLine ( const T3DLine a)

Definition at line 59 of file T3DLine.cxx.

60 : TTrackBase((TTrackBase &) a),
61 _dr(a.dr()),
62 _phi0(a.phi0()),
63 _dz(a.dz()),
64 _tanl(a.tanl()),
65 _chi2(a.chi2()),_ndf(a.ndf()),
66 _Ea(a.Ea()),
67 _pivot(a.pivot()){
68
69 _cos_phi0 = cos(_phi0);
70 _sin_phi0 = sin(_phi0);
71
72 //...Set a default fitter...
73 fitter(& T3DLine::_fitter);
74
75 _fitted = false;
76 _fittedWithCathode = false;
77}

◆ ~T3DLine()

T3DLine::~T3DLine ( )
virtual

Destructor.

Definition at line 56 of file T3DLine.cxx.

56 {
57}

Member Function Documentation

◆ a() [1/2]

Vector T3DLine::a ( const Vector ta)

set track parameters

Definition at line 187 of file T3DLine.cxx.

187 {
188 _dr = ta[0];
189 _phi0 = ta[1];
190 _dz = ta[2];
191 _tanl = ta[3];
192 _cos_phi0 = cos(_phi0);
193 _sin_phi0 = sin(_phi0);
194 return(ta);
195}

◆ a() [2/2]

Vector T3DLine::a ( void  ) const

Definition at line 107 of file T3DLine.cxx.

107 {
108 Vector ta(4);
109 ta[0] = _dr;
110 ta[1] = _phi0;
111 ta[2] = _dz;
112 ta[3] = _tanl;
113 return(ta);
114}

Referenced by helix().

◆ approach()

int T3DLine::approach ( TMLink l,
bool  sagCorrection = true 
) const

calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.

Definition at line 202 of file T3DLine.cxx.

202 {
203
204 const TMDCWire& w=*l.wire();
205 HepPoint3D xw = w.xyPosition();
206 HepPoint3D wireBackwardPosition = w.backwardPosition();
207 HepVector3D v = w.direction();
208
209 HepPoint3D onWire,onTrack;
210
211 if(approach_line(wireBackwardPosition,v,onWire,onTrack)<0)
212 return(-1);
213
214 // onWire,onTrack filled
215
216 if(!doSagCorrection){
217 l.positionOnWire(onWire);
218 l.positionOnTrack(onTrack);
219 return(0); // no sag correction
220 }
221 // Sag correction
222 // loop for sag correction
223 double onWire_y = onWire.y();
224 double onWire_z = onWire.z();
225
226 unsigned nTrial = 1;
227 while(nTrial<100){
228 w.wirePosition(onWire_z,xw,wireBackwardPosition,(HepVector3D&)v);
229 if(approach_line(wireBackwardPosition,v,onWire,onTrack)<0)
230 return(-1);
231 if(fabs(onWire_y - onWire.y())<0.0001) break; // |dy|< 1 micron
232 onWire_y = onWire.y();
233 onWire_z = onWire.z();
234
235 nTrial++;
236 }
237
238 l.positionOnWire(onWire);
239 l.positionOnTrack(onTrack);
240 return(nTrial);
241}
double w
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
int approach_line(const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack) const
caluculate closest points between a line and this track
Definition: T3DLine.cxx:243
A class to represent a wire in MDC.
Definition: TMDCWire.h:55

◆ approach_line()

int T3DLine::approach_line ( const HepPoint3D w0,
const HepVector3D v,
HepPoint3D onLine,
HepPoint3D onTrack 
) const

caluculate closest points between a line and this track

Definition at line 243 of file T3DLine.cxx.

244 {
245 // line = [w0] + s * [v] -> [onLine]
246 // trk = [x0] + t * [k] -> [onTrack]
247 // if [v]//[k] then return(-1) error
248
249 const HepVector3D k = this->k();
250 const double v_k = v.dot(k);
251 const double v_2 = v.mag2();
252 const double k_2 = k.mag2();
253 const double tk = v_k*v_k - v_2*k_2;
254 if(tk==0) return(-1);
255
256 const HepPoint3D x0 = this->x0();
257 const HepPoint3D dx = x0 - w0;
258 const double t = dx.dot( v_2 * k - v_k * v)/tk;
259 const double s = dx.dot( v_k * k - k_2 * v)/tk;
260
261 onLine = w0 + s * v;
262 onTrack = x0 + t * k;
263 return(0);
264}
XmlRpcServer s
Definition: HelloServer.cpp:11
TTree * t
Definition: binning.cxx:23
HepPoint3D x0(void) const
returns 3D line component x(t)=x0 + t * k
Definition: T3DLine.cxx:151
HepVector3D k(void) const
Definition: T3DLine.cxx:158

Referenced by approach().

◆ approach_point()

int T3DLine::approach_point ( const HepPoint3D p0,
HepPoint3D onTrack 
) const

caluculate closest point between a point and this track

Definition at line 266 of file T3DLine.cxx.

266 {
267 // trk = [x0] + t * [k] -> [onTrack]
268 // if [v]//[k] then return(-1) error
269
270 const HepVector3D k = this->k();
271 const HepPoint3D x0 = this->x0();
272 const HepPoint3D dx = p0 - x0;
273 const double t = dx.dot(k)/k.mag2();
274
275 onTrack = x0 + t * k;
276 return(0);
277}

◆ chi2()

double T3DLine::chi2 ( void  ) const

returns chi2.

Definition at line 131 of file T3DLine.cxx.

131 {
132 return _chi2;
133}

◆ cosPhi0()

double T3DLine::cosPhi0 ( void  ) const

Definition at line 95 of file T3DLine.cxx.

95 {
96 return _cos_phi0;
97}

◆ dr()

double T3DLine::dr ( void  ) const

Track parameters.

Definition at line 79 of file T3DLine.cxx.

79 {
80 return _dr;
81}

Referenced by pivot().

◆ dz()

double T3DLine::dz ( void  ) const

Definition at line 87 of file T3DLine.cxx.

87 {
88 return _dz;
89}

Referenced by pivot().

◆ Ea() [1/2]

const SymMatrix & T3DLine::Ea ( const SymMatrix tEa)

set error matrix

Definition at line 197 of file T3DLine.cxx.

197 {
198 _Ea = tEa;
199 return(_Ea);
200}

◆ Ea() [2/2]

const SymMatrix & T3DLine::Ea ( void  ) const

returns error matrix

Definition at line 116 of file T3DLine.cxx.

116 {
117 return(_Ea);
118}

◆ helix()

Helix T3DLine::helix ( void  ) const

approximated helix class

Definition at line 120 of file T3DLine.cxx.

120 {
121 HepVector a(5);
122 a[0]=_dr;a[1]=_phi0;a[2]=1e-10;a[3]=_dz;a[4]=_tanl;
123 Helix _helix(_pivot,a);
124 return _helix;
125}

Referenced by TBuilderCosmic::buildStereo().

◆ k()

HepVector3D T3DLine::k ( void  ) const

Definition at line 158 of file T3DLine.cxx.

158 {
159 HepPoint3D p(-_sin_phi0,_cos_phi0,_tanl);
160 return p;
161}

Referenced by approach_line(), and approach_point().

◆ ndf()

unsigned T3DLine::ndf ( void  ) const

returns NDF

Definition at line 127 of file T3DLine.cxx.

127 {
128 return _ndf;
129}

◆ objectType()

unsigned T3DLine::objectType ( void  ) const
inlinevirtual

returns object type

Reimplemented from TTrackBase.

Definition at line 150 of file T3DLine.h.

150 {
151 return Line3D;
152}
#define Line3D
Definition: T3DLine.h:21

◆ phi0()

double T3DLine::phi0 ( void  ) const

Definition at line 83 of file T3DLine.cxx.

83 {
84 return _phi0;
85}

◆ pivot() [1/2]

const HepPoint3D & T3DLine::pivot ( const HepPoint3D newpivot)

set new pivot

Definition at line 163 of file T3DLine.cxx.

163 {
164 double dr=(_pivot.x()-newpivot.x())*_cos_phi0
165 +(_pivot.y()-newpivot.y())*_sin_phi0 + _dr;
166 double dz=_pivot.z()-newpivot.z()+_dz
167 +_tanl*((_pivot.x()-newpivot.x())*_sin_phi0
168 +(newpivot.y()-_pivot.y())*_cos_phi0);
169 _dr=dr;
170 _dz=dz;
171 _pivot=newpivot;
172 return _pivot;
173}
double dr(void) const
Track parameters.
Definition: T3DLine.cxx:79
double dz(void) const
Definition: T3DLine.cxx:87

◆ pivot() [2/2]

const HepPoint3D & T3DLine::pivot ( void  ) const

pivot position

Definition at line 103 of file T3DLine.cxx.

103 {
104 return _pivot;
105}

◆ reducedchi2()

double T3DLine::reducedchi2 ( void  ) const

returns reduced-chi2

Definition at line 135 of file T3DLine.cxx.

135 {
136 if(_ndf==0){
137 std::cout<<"error at T3DLine::reducedchi2 ndf=0"<<std::endl;
138 return 0;
139 }
140 return (_chi2/_ndf);
141}

◆ set()

void T3DLine::set ( const HepPoint3D t_pivot,
double  t_dr,
double  t_phi0,
double  t_dz,
double  t_tanl 
)

set track parameters,pivot

Definition at line 175 of file T3DLine.cxx.

176 {
177
178 _pivot = t_pivot;
179 _dr = t_dr;
180 _phi0 = t_phi0;
181 _dz = t_dz;
182 _tanl = t_tanl;
183 _cos_phi0 = cos(_phi0);
184 _sin_phi0 = sin(_phi0);
185}

◆ sinPhi0()

double T3DLine::sinPhi0 ( void  ) const

Definition at line 99 of file T3DLine.cxx.

99 {
100 return _sin_phi0;
101}

◆ tanl()

double T3DLine::tanl ( void  ) const

Definition at line 91 of file T3DLine.cxx.

91 {
92 return _tanl;
93}

◆ x()

HepPoint3D T3DLine::x ( double  t) const

returns position on 3D line

Definition at line 143 of file T3DLine.cxx.

143 {
144 double tx= _pivot.x() + _dr * _cos_phi0 - t * _sin_phi0;
145 double ty= _pivot.y() + _dr * _sin_phi0 + t * _cos_phi0;
146 double tz= _pivot.z() + _dz + t * _tanl;
147 HepPoint3D p(tx,ty,tz);
148 return p;
149}

◆ x0()

HepPoint3D T3DLine::x0 ( void  ) const

returns 3D line component x(t)=x0 + t * k

Definition at line 151 of file T3DLine.cxx.

151 {
152 double tx= _pivot.x() + _dr * _cos_phi0;
153 double ty= _pivot.y() + _dr * _sin_phi0;
154 double tz= _pivot.z() + _dz;
155 HepPoint3D p(tx,ty,tz);
156 return p;
157}

Referenced by approach_line(), and approach_point().

Friends And Related Function Documentation

◆ T3DLineFitter

friend class T3DLineFitter
friend

Definition at line 147 of file T3DLine.h.


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