BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/TSegment0.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TSegment0.h,v 1.7 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TSegment0.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to manage a group of TMLink's.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TSegment0_FLAG_
14#define TSegment0_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17# ifndef TRKRECO_DEBUG
18# define TRKRECO_DEBUG
19# endif
20#endif
21#ifndef CLHEP_POINT3D_H
22# include "CLHEP/Geometry/Point3D.h"
23#endif
24#ifndef ENABLE_BACKWARDS_COMPATIBILITY
25typedef HepGeom::Point3D<double> HepPoint3D;
26#endif
27#include "CLHEP/Geometry/Vector3D.h"
28#ifndef ENABLE_BACKWARDS_COMPATIBILITY
29typedef HepGeom::Vector3D<double> HepVector3D;
30#endif
31
32#include "TrkReco/TMDCUtil.h"
33#include "TrkReco/TMLink.h"
34#include "TrkReco/TTrackBase.h"
35
36class TTrack;
37class Range;
38template <class T> class CAList;
39
40/// A class to relate TMDCWireHit and TTrack objects.
41class TSegment0 : public TTrackBase {
42
43public:
44 /// Constructor.
47
48 /// Destructor
49 virtual ~TSegment0();
50
51public: // Selectors
52 /// returns type.
53 virtual unsigned objectType( void ) const;
54
55 /// dumps debug information.
56 void dump( const std::string& message = std::string( "" ),
57 const std::string& prefix = std::string( "" ) ) const;
58
59 /// returns super layer id.
60 unsigned superLayerId() const;
61
62 /// returns position.
63 const HepPoint3D& position( void ) const;
64
65 /// returns direction.
66 const HepVector3D& direction( void ) const;
67
68 /// calculates distance between two clusters. Smaller value indicates closer.
69 double distance( const TSegment0& ) const;
70 double distance( const HepPoint3D&, const HepVector3D& ) const;
71
72 /// returns Range of x-coordinate of TMLinks.
73 Range rangeX( double min, double max ) const;
74
75 /// returns inner width.
76 unsigned innerWidth( void ) const;
77
78 /// returns outer width.
79 unsigned outerWidth( void ) const;
80
81 /// returns inner most layer.
82 unsigned innerMostLayer( void ) const;
83
84 /// returns outer most layer.
85 unsigned outerMostLayer( void ) const;
86
87 /// returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A
88 /// shape, 5:X shape, 6:parallel, 7:complicated.
89 unsigned clusterType( void ) const;
90
91 /// returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no
92 /// cluster is returned.
93 AList<TSegment0> split( void ) const;
94
95 int solveDualHits( void );
96 double duality( void ) const;
97
98public: // TTrack relations
100
101public: // Segment links
103
104private:
105 AList<TSegment0> splitAV( void ) const;
106 AList<TSegment0> splitParallel( void ) const;
107 AList<TSegment0> splitComplicated( void ) const;
108 AList<TSegment0> splitDual( void ) const;
109
110private:
111 /// updates cache.
112 void update( void ) const;
113
114 /// updates type.
115 void updateType( void ) const;
116
117 /// updates duality.
118 void updateDuality( void ) const;
119
120private:
121 // always updated.
122 AList<TTrack> _tracks;
123 AList<TSegment0> _innerLinks;
124
125private:
126 mutable HepPoint3D _position;
127 mutable HepVector3D _direction;
128 mutable unsigned _innerWidth;
129 mutable unsigned _outerWidth;
130 mutable unsigned _innerMostLayer;
131 mutable unsigned _outerMostLayer;
132 mutable AList<TMLink> _inners;
133 mutable AList<TMLink> _outers;
134 mutable unsigned _nLayer;
135 mutable unsigned _clusterType;
136 mutable double _duality;
137 mutable unsigned _nDual;
138 mutable double _angle;
139};
140
141// Utility functions
142/// returns \# of core links in segments.
143unsigned NCoreLinks( const CAList<TSegment0>& list );
144
145/// returns AList of TMLink used for a track.
146AList<TMLink> Links( const TSegment0&, const TTrack& );
147
148/*
149/// checks property of segments.
150void
151CheckSegments(const CAList<TSegment0> & segmentList);
152
153/// checks to link segments.
154void
155CheckSegmentLink(const TSegment0 & base,
156 const TSegment0 & next,
157 float distance,
158 float dirAngle);
159*/
160
161//-----------------------------------------------------------------------------
162
163#ifdef TSegment0_NO_INLINE
164# define inline
165#else
166# undef inline
167# define TSegment0_INLINE_DEFINE_HERE
168#endif
169
170#ifdef TSegment0_INLINE_DEFINE_HERE
171
172inline const HepPoint3D& TSegment0::position( void ) const {
173 if ( !_fitted ) update();
174 return _position;
175}
176
177inline const HepVector3D& TSegment0::direction( void ) const {
178 if ( !_fitted ) update();
179 return _direction;
180}
181
182inline unsigned TSegment0::innerWidth( void ) const {
183 if ( !_fitted ) update();
184 return _innerWidth;
185}
186
187inline unsigned TSegment0::outerWidth( void ) const {
188 if ( !_fitted ) update();
189 return _outerWidth;
190}
191
192inline unsigned TSegment0::innerMostLayer( void ) const {
193 if ( !_fitted ) update();
194 return _innerMostLayer;
195}
196
197inline unsigned TSegment0::outerMostLayer( void ) const {
198 if ( !_fitted ) update();
199 return _outerMostLayer;
200}
201
202inline unsigned TSegment0::clusterType( void ) const {
203 if ( !nLinks() ) return 0;
204 if ( _clusterType == 0 ) updateType();
205 return _clusterType;
206}
207
208inline double TSegment0::duality( void ) const { return _duality; }
209
210inline unsigned TSegment0::objectType( void ) const { return Segment; }
211
212inline unsigned TSegment0::superLayerId( void ) const {
213 unsigned id = ( links() )[0]->wire()->superLayerId();
214# ifdef TRKRECO_DEBUG
215 {
216 const AList<TMLink>& list = links();
217 unsigned n = list.length();
218 for ( unsigned i = 1; i < n; i++ )
219 {
220 if ( list[i]->hit()->wire()->superLayerId() != id )
221 {
222 std::cout << "TSegment0::superLayerId !!! strange segment found";
223 std::cout << std::endl;
224 dump();
225 break;
226 }
227 }
228 }
229# endif
230 return id;
231}
232
233inline AList<TTrack>& TSegment0::tracks( void ) { return _tracks; }
234
235inline AList<TSegment0>& TSegment0::innerLinks( void ) { return _innerLinks; }
236
237#endif
238
239#undef inline
240
241#endif /* TSegment0_FLAG_ */
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
const Int_t n
#define min(a, b)
#define max(a, b)
HepGeom::Point3D< double > HepPoint3D
unsigned NCoreLinks(const CAList< TSegment0 > &list)
returns # of core links in segments.
HepGeom::Vector3D< double > HepVector3D
AList< TMLink > Links(const TSegment0 &, const TTrack &)
returns AList of TMLink used for a track.
to specify 1-dim region or range by two floats
A class to relate TMDCWireHit and TTrack objects.
unsigned outerMostLayer(void) const
returns outer most layer.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
virtual unsigned objectType(void) const
returns type.
AList< TTrack > & tracks(void)
virtual ~TSegment0()
Destructor.
double distance(const HepPoint3D &, const HepVector3D &) const
AList< TSegment0 > & innerLinks(void)
double duality(void) const
int solveDualHits(void)
unsigned superLayerId() const
returns super layer id.
double distance(const TSegment0 &) const
calculates distance between two clusters. Smaller value indicates closer.
unsigned innerMostLayer(void) const
returns inner most layer.
Range rangeX(double min, double max) const
returns Range of x-coordinate of TMLinks.
AList< TSegment0 > split(void) const
TSegment0()
Constructor.
TSegment0(const AList< TMLink > &)
const HepVector3D & direction(void) const
returns direction.
unsigned innerWidth(void) const
returns inner width.
unsigned outerWidth(void) const
returns outer width.
virtual unsigned objectType(void) const
returns type.
const HepPoint3D & position(void) const
returns position.
unsigned clusterType(void) const
A virtual class for a track class in tracking.
const AList< TMLink > & links(unsigned mask=0) const
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 track in tracking.