BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/TMLine.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TMLine.h,v 1.3 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TMLine.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to represent a line in tracking.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TMLine_FLAG_
14#define TMLine_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17# ifndef TRKRECO_DEBUG
18# define TRKRECO_DEBUG
19# endif
20#endif
21
22#include <string>
23
24// #define HEP_SHORT_NAMES
25
26#include "TrkReco/TLineFitter.h"
27#include "TrkReco/TMLink.h"
28#include "TrkReco/TTrackBase.h"
29
30#ifndef CLHEP_POINT3D_H
31# include "CLHEP/Geometry/Point3D.h"
32#endif
33#ifndef ENABLE_BACKWARDS_COMPATIBILITY
34typedef HepGeom::Point3D<double> HepPoint3D;
35#endif
36
37// class HepPoint3D;
38
39/// A class to represent a track in tracking.
40class TMLine : public TTrackBase {
41
42public:
43 /// Constructor.
45
46 /// Constructor.
48
49 /// Destructor
50 virtual ~TMLine();
51
52public: // Selectors
53 /// returns type.
54 virtual unsigned objectType( void ) const;
55
56 /// dumps debug information.
57 void dump( const std::string& message = std::string( "" ),
58 const std::string& prefix = std::string( "" ) ) const;
59
60 /// returns coefficient a.
61 double a( void ) const;
62
63 /// returns coefficient b.
64 double b( void ) const;
65
66 /// returns chi2.
67 double chi2( void ) const;
68
69 /// returns reduced-chi2.
70 double reducedChi2( void ) const;
71
72public: // Utilities
73 /// returns distance to a position of TMLink itself. (not to a wire)
74 double distance( const TMLink& ) const;
75 double distance( const HepPoint3D& ) const;
76
77public: // Modifiers
78 /// fits itself. Error was happened if return value is not zero.
79 // int fitx(void);
80
81 /// fits itself using isolated hits. Error was happened if return value is not zero.
82 int fit2();
83
84 /// fits itself using single hits in a wire-layer. Error was happened if return value is not
85 /// zero.
86 int fit2s();
87
88 /// fits itself using isolated hits. Error was happened if return value is not zero.
89 int fit2p();
90
91 /// fits itself using single hits in a wire-layer. Error was happened if return value is not
92 /// zero.
93 int fit2sp();
94
95 /// remove extremly bad points.
97
98 /// remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called
99 /// before calling this function.
100 void refine( AList<TMLink>& list, float maxSigma );
101
102 ///
104
105 ///
107
108 ///
109 void appendByszdistance( AList<TMLink>& list, unsigned isl, float maxSigma );
110
111 /// sets circle properties.
112 void property( double a, double b, double det );
113
114private: // Always updated
115 mutable bool _fittedUpdated;
116
117private: // Updated when fitted
118 double _a;
119 double _b;
120 double _det;
121 static const TLineFitter _fitter;
122
123private: // Updated when fitted and accessed
124 mutable double _chi2;
125 mutable double _reducedChi2;
126};
127
128/// Sorter
129#if defined( __GNUG__ )
130int SortByB( const TMLine** a, const TMLine** b );
131#else
132extern "C" int SortByB( const void* a, const void* b );
133#endif
134
135//-----------------------------------------------------------------------------
136
137#ifdef TMLine_NO_INLINE
138# define inline
139#else
140# undef inline
141# define TMLine_INLINE_DEFINE_HERE
142#endif
143
144#ifdef TMLine_INLINE_DEFINE_HERE
145
146inline double TMLine::a( void ) const {
147# ifdef TRKRECO_DEBUG
148 if ( !_fitted ) std::cout << "TMLine::a !!! fit not performed" << std::endl;
149# endif
150 return _a;
151}
152
153inline double TMLine::b( void ) const {
154# ifdef TRKRECO_DEBUG
155 if ( !_fitted ) std::cout << "TMLine::b !!! fit not performed" << std::endl;
156# endif
157 return _b;
158}
159
160inline double TMLine::distance( const TMLink& l ) const {
161# ifdef TRKRECO_DEBUG
162 if ( !_fitted ) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
163# endif
164 double dy = fabs( _a * l.position().x() + _b - l.position().y() );
165 double invCos = sqrt( 1. + _a * _a );
166 return dy / invCos;
167}
168
169inline double TMLine::distance( const HepPoint3D& p ) const {
170# ifdef TRKRECO_DEBUG
171 if ( !_fitted ) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
172# endif
173 double dy = fabs( _a * p.x() + _b - p.y() );
174 double invCos = sqrt( 1. + _a * _a );
175 return dy / invCos;
176}
177
178inline void TMLine::property( double a, double b, double det ) {
179 _a = a;
180 _b = b;
181 _det = det;
182}
183
184inline unsigned TMLine::objectType( void ) const { return Line; }
185
186#endif
187
188#undef inline
189
190#endif /* TMLine_FLAG_ */
HepGeom::Point3D< double > HepPoint3D
int SortByB(const void *a, const void *b)
Sorter.
Definition TMLine.cxx:656
HepGeom::Point3D< double > HepPoint3D
A class to fit a TTrackBase object to a line.
A class to represent a track in tracking.
double chi2(void) const
returns chi2.
void removeChits()
remove extremly bad points.
void removeSLY(AList< TMLink > &list)
int fit2()
fits itself. Error was happened if return value is not zero.
void refine(AList< TMLink > &list, float maxSigma)
int fit2s()
double distance(const HepPoint3D &) const
void property(double a, double b, double det)
sets circle properties.
virtual ~TMLine()
Destructor.
double distance(const TMLink &) const
returns distance to a position of TMLink itself. (not to a wire)
void appendByszdistance(AList< TMLink > &list, unsigned isl, float maxSigma)
TMLine(const AList< TMLink > &)
Constructor.
int fit2p()
fits itself using isolated hits. Error was happened if return value is not zero.
int fit2sp()
double a(void) const
returns coefficient a.
virtual unsigned objectType(void) const
returns type.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
double b(void) const
returns coefficient b.
TMLine()
Constructor.
virtual unsigned objectType(void) const
returns type.
void appendSLY(AList< TMLink > &list)
double reducedChi2(void) const
returns reduced-chi2.
A virtual class for a track class in tracking.