BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/TTrackBase.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TTrackBase.h,v 1.14 2011/10/08 01:56:15 maoh Exp $
3//-----------------------------------------------------------------------------
4// Filename : TTrackBase.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A virtual class for a track class in tracking.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TTrackBase_FLAG_
14#define TTrackBase_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17# ifndef TRKRECO_DEBUG
18# define TRKRECO_DEBUG
19# endif
20#endif
21
22#define TrackAxialLayer 0
23#define TrackStereoLayer 1
24#define TrackBothLayer 2
25
26//...Definition of objectType...
27#define TrackBase 1
28#define Circle 2
29#define Line 4
30#define Track 8
31#define Segment 16
32
33#include <string>
34
35// #define HEP_SHORT_NAMES
36#include "CLHEP/Alist/AList.h"
37
38#include "TrkReco/TMDCUtil.h"
39
40class TMLink;
41class TTrackMC;
42class TMFitter;
43class TTrackHEP;
44
45/// A virtual class for a track class in tracking.
46class TTrackBase {
47
48public:
49 /// Constructor.
51
52 /// Constructor.
54
55 /// Destructor
56 virtual ~TTrackBase();
57
58public: // General information
59 /// returns object type.
60 virtual unsigned objectType( void ) const;
61
62 /// returns type. Definition is depending on an object class.
63 virtual unsigned type( void ) const;
64
65 /// dumps debug information.
66 virtual void dump( const std::string& message = std::string( "" ),
67 const std::string& prefix = std::string( "" ) ) const;
68
69public: // Hit information
70 /// returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask
71 /// is not 0.
72 const AList<TMLink>& links( unsigned mask = 0 ) const;
73
74 /// returns \# of masked TMLinks assigned to this track object.
75 unsigned nLinks( unsigned mask = 0 ) const;
76
77 /// returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
78 const AList<TMLink>& cores( unsigned mask = 0 ) const;
79
80 /// returns \# of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
81 unsigned nCores( unsigned mask = 0 ) const;
82
83public: // Hit manipulation
84 /// update cache.
85 void update( void ) const;
86
87 /// appends a TMLink.
88 void append( TMLink& );
89
90 /// appends TMLinks.
91 void append( const AList<TMLink>& );
92
93 /// appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from
94 /// 'list' when returned.
95 void appendByApproach( AList<TMLink>& list, double maxSigma );
96
97 /// appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from
98 /// 'list' when returned.
99 void appendByDistance( AList<TMLink>& list, double maxDistance );
100
101 /// removes a TMLink.
102 void remove( TMLink& a );
103
104 /// removes TMLinks.
105 void remove( const AList<TMLink>& );
106
107 /// removes bad points by pull. The bad points are removed from the track, and are returned
108 /// in 'list'.
109 virtual void refine( AList<TMLink>& list, double maxSigma );
110
111 /// removes bad points by pull. The bad points are masked not to be used in fit.
112 virtual void refine( double maxSigma );
113
114 virtual int DropWorst();
115
116 virtual void removeLinks( void );
117
118 /// returns distance to a position of TMLink in TMLink space.
119 virtual double distance( const TMLink& ) const;
120
121 /// calculates the closest approach to a wire in real space. Results are stored in TMLink.
122 /// Return value is negative if error happened.
123 virtual int approach( TMLink& ) const;
124
125 /// returns \# of good hits to be appended.
126 unsigned testByApproach( const TMLink& list, double sigma ) const;
127 unsigned testByApproach( const AList<TMLink>& list, double sigma ) const;
128
129 /// fits itself by a default fitter. Error was happened if return value is not zero.
130 virtual int fit( void );
131
132 /// returns a pointer to a default fitter.
133 const TMFitter* const fitter( void ) const;
134
135 /// sets a default fitter.
136 const TMFitter* const fitter( const TMFitter* );
137
138 /// false Fit
139 void falseFit(); // added by matsu ( 1999/05/24 )
140
141public: // Operators
142 TMLink* operator[]( unsigned i ) const;
143
144public: // MC information
145 /// returns TTrackHEP.
146 const TTrackHEP* const hep( void ) const;
147
148 /// returns \# of contributed TTrackHEP tracks.
149 unsigned nHeps( void ) const;
150
151 /// returns a pointer to TTrackMC.
152 const TTrackMC* const mc( void ) const;
153
154public: // Obsolete functions. Followings should be removed in TrkReco 2.
155 /// returns true if fitted.
156 bool fitted( void ) const;
157
158 /// returns true if fitted with cathode hits(TEMPORARY).
159 bool fittedWithCathode( void ) const;
160
161private:
162 /// refine core part.
163 AList<TMLink> refineMain( double maxSigma );
164
165protected: // Always updated
167 mutable bool _fitted;
168 mutable bool _fittedWithCathode;
169 // unsigned _state;
170 TTrackMC* _mc;
171
172private: // Always updated
173 mutable bool _updated;
174
175private: // Updated when accessed
176 mutable AList<TMLink> _cores;
177
178private: // Always updated when accessed
179 mutable const TTrackHEP* _hep;
180 mutable unsigned _nHeps;
181
182private:
183 const TMFitter* _fitter;
184 float _time;
185
186 friend class TMFitter;
187 friend class THelixFitter;
188 friend class TCosmicFitter;
189
190#ifdef TRKRECO_DEBUG
191public:
192 bool fitted( bool ) const;
193#endif
194};
195
196//-----------------------------------------------------------------------------
197
198#ifdef TTrackBase_NO_INLINE
199# define inline
200#else
201# undef inline
202# define TTrackBase_INLINE_DEFINE_HERE
203#endif
204
205#ifdef TTrackBase_INLINE_DEFINE_HERE
206
207inline void TTrackBase::remove( TMLink& a ) {
208 _links.remove( a );
209 _updated = false;
210 _fitted = false;
211 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 )
212}
213
214inline void TTrackBase::remove( const AList<TMLink>& a ) {
215 _links.remove( a );
216 _updated = false;
217 _fitted = false;
218 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 )
219}
220
221inline bool TTrackBase::fitted( void ) const { return _fitted; }
222
223// added by matsu ( 1999/05/24 )
224inline void TTrackBase::falseFit() {
225 _fitted = false;
226 _fittedWithCathode = false;
227}
228// end of addition
229
230inline TMLink* TTrackBase::operator[]( unsigned i ) const { return _links[i]; }
231
232inline bool TTrackBase::fittedWithCathode( void ) const { return _fittedWithCathode; }
233
234inline const TTrackMC* const TTrackBase::mc( void ) const { return _mc; }
235
236inline const TMFitter* const TTrackBase::fitter( void ) const { return _fitter; }
237
238inline const TMFitter* const TTrackBase::fitter( const TMFitter* a ) {
239 _fitted = false;
240 return _fitter = a;
241}
242
243inline unsigned TTrackBase::objectType( void ) const { return TrackBase; }
244
245inline unsigned TTrackBase::type( void ) const { return 0; }
246
247# ifdef TRKRECO_DEBUG
248inline bool TTrackBase::fitted( bool a ) const { return _fitted = a; }
249# endif
250
251#endif
252
253#undef inline
254
255#endif /* TTrackBase_FLAG_ */
A virtual class for a track class in tracking.
void falseFit()
false Fit
unsigned testByApproach(const AList< TMLink > &list, double sigma) const
bool fitted(void) const
returns true if fitted.
bool fittedWithCathode(void) const
returns true if fitted with cathode hits(TEMPORARY).
virtual void refine(AList< TMLink > &list, double maxSigma)
void append(const AList< TMLink > &)
appends TMLinks.
void appendByDistance(AList< TMLink > &list, double maxDistance)
virtual unsigned type(void) const
returns type. Definition is depending on an object class.
unsigned testByApproach(const TMLink &list, double sigma) const
returns # of good hits to be appended.
const TTrackMC *const mc(void) const
returns a pointer to TTrackMC.
virtual unsigned objectType(void) const
returns object type.
virtual void refine(double maxSigma)
removes bad points by pull. The bad points are masked not to be used in fit.
unsigned nHeps(void) const
returns # of contributed TTrackHEP tracks.
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
const TMFitter *const fitter(const TMFitter *)
sets a default fitter.
const TMFitter *const fitter(void) const
returns a pointer to a default fitter.
virtual unsigned type(void) const
returns type. Definition is depending on an object class.
void remove(TMLink &a)
removes a TMLink.
const TTrackHEP *const hep(void) const
returns TTrackHEP.
TTrackBase(const AList< TMLink > &links)
Constructor.
virtual int DropWorst()
virtual double distance(const TMLink &) const
returns distance to a position of TMLink in TMLink space.
unsigned nCores(unsigned mask=0) const
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
void appendByApproach(AList< TMLink > &list, double maxSigma)
TMLink * operator[](unsigned i) const
void remove(const AList< TMLink > &)
removes TMLinks.
virtual ~TTrackBase()
Destructor.
virtual int approach(TMLink &) const
virtual int fit(void)
fits itself by a default fitter. Error was happened if return value is not zero.
TTrackBase()
Constructor.
virtual unsigned objectType(void) const
returns object type.
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.
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
virtual void removeLinks(void)
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
void update(void) const
update cache.
A class to represent a GEN_HEPEVT particle in tracking.
A class to have MC information of TTrack.