BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
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 : [email protected]
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/TTrackBase.h"
27#include "TrkReco/TMLink.h"
28#include "TrkReco/TLineFitter.h"
29
30#ifndef CLHEP_POINT3D_H
31#include "CLHEP/Geometry/Point3D.h"
32#endif
33#ifndef ENABLE_BACKWARDS_COMPATIBILITY
35#endif
36
37//class HepPoint3D;
38
39/// A class to represent a track in tracking.
40class TMLine : public TTrackBase {
41
42 public:
43 /// Constructor.
44 TMLine();
45
46 /// Constructor.
47 TMLine(const AList<TMLink> &);
48
49 /// Destructor
50 virtual ~TMLine();
51
52 public:// 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
72 public:// 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
77 public:// 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 zero.
85 int fit2s();
86
87 /// fits itself using isolated hits. Error was happened if return value is not zero.
88 int fit2p();
89
90 /// fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
91 int fit2sp();
92
93 /// remove extremly bad points.
94 void removeChits();
95
96 /// remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.
97 void refine(AList<TMLink> & list, float maxSigma);
98
99 ///
100 void removeSLY(AList<TMLink> & list);
101
102 ///
103 void appendSLY(AList<TMLink> & list);
104
105 ///
106 void appendByszdistance(AList<TMLink> & list, unsigned isl, float maxSigma);
107
108 /// sets circle properties.
109 void property(double a, double b, double det);
110
111 private:// Always updated
112 mutable bool _fittedUpdated;
113
114 private:// Updated when fitted
115 double _a;
116 double _b;
117 double _det;
118 static const TLineFitter _fitter;
119
120 private:// Updated when fitted and accessed
121 mutable double _chi2;
122 mutable double _reducedChi2;
123};
124
125/// Sorter
126#if defined(__GNUG__)
127int
128SortByB(const TMLine ** a, const TMLine ** b);
129#else
130extern "C" int
131SortByB(const void* a, const void* b);
132#endif
133
134//-----------------------------------------------------------------------------
135
136#ifdef TMLine_NO_INLINE
137#define inline
138#else
139#undef inline
140#define TMLine_INLINE_DEFINE_HERE
141#endif
142
143#ifdef TMLine_INLINE_DEFINE_HERE
144
145inline
146double
147TMLine::a(void) const {
148#ifdef TRKRECO_DEBUG
149 if (! _fitted) std::cout << "TMLine::a !!! fit not performed" << std::endl;
150#endif
151 return _a;
152}
153
154inline
155double
156TMLine::b(void) const {
157#ifdef TRKRECO_DEBUG
158 if (! _fitted) std::cout << "TMLine::b !!! fit not performed" << std::endl;
159#endif
160 return _b;
161}
162
163inline
164double
165TMLine::distance(const TMLink & l) const {
166#ifdef TRKRECO_DEBUG
167 if (! _fitted) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
168#endif
169 double dy = fabs(_a * l.position().x() + _b - l.position().y());
170 double invCos = sqrt(1. + _a * _a);
171 return dy / invCos;
172}
173
174inline
175double
176TMLine::distance(const HepPoint3D & p) const {
177#ifdef TRKRECO_DEBUG
178 if (! _fitted) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
179#endif
180 double dy = fabs(_a * p.x() + _b - p.y());
181 double invCos = sqrt(1. + _a * _a);
182 return dy / invCos;
183}
184
185inline
186void
187TMLine::property(double a, double b, double det) {
188 _a = a;
189 _b = b;
190 _det = det;
191}
192
193inline
194unsigned
196 return Line;
197}
198
199#endif
200
201#undef inline
202
203#endif /* TMLine_FLAG_ */
int SortByB(const void *a, const void *b)
Sorter.
Definition: TMLine.cxx:648
HepGeom::Point3D< double > HepPoint3D
Definition: TMLine.h:34
#define Line
Definition: TTrackBase.h:29
A class to fit a TTrackBase object to a line.
Definition: TLineFitter.h:28
A class to represent a track in tracking.
Definition: TMLine.h:40
double chi2(void) const
returns chi2.
Definition: TMLine.cxx:113
void removeChits()
remove extremly bad points.
Definition: TMLine.cxx:511
void removeSLY(AList< TMLink > &list)
Definition: TMLine.cxx:554
int fit2()
fits itself. Error was happened if return value is not zero.
Definition: TMLine.cxx:174
void refine(AList< TMLink > &list, float maxSigma)
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling...
Definition: TMLine.cxx:135
int fit2s()
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
Definition: TMLine.cxx:265
virtual ~TMLine()
Destructor.
Definition: TMLine.cxx:49
void property(double a, double b, double det)
sets circle properties.
Definition: TMLine.h:187
double distance(const TMLink &) const
returns distance to a position of TMLink itself. (not to a wire)
Definition: TMLine.h:165
void appendByszdistance(AList< TMLink > &list, unsigned isl, float maxSigma)
Definition: TMLine.cxx:568
int fit2p()
fits itself using isolated hits. Error was happened if return value is not zero.
Definition: TMLine.cxx:403
int fit2sp()
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
Definition: TMLine.cxx:325
double a(void) const
returns coefficient a.
Definition: TMLine.h:147
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TMLine.cxx:53
double b(void) const
returns coefficient b.
Definition: TMLine.h:156
TMLine()
Constructor.
Definition: TMLine.cxx:23
virtual unsigned objectType(void) const
returns type.
Definition: TMLine.h:195
void appendSLY(AList< TMLink > &list)
Definition: TMLine.cxx:561
double reducedChi2(void) const
returns reduced-chi2.
Definition: TMLine.cxx:607
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46
bool _fitted
Definition: TTrackBase.h:162