CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TConformalFinder.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TConformalFinder.h,v 1.24 2012/05/28 05:16:29 maoh Exp $
3//-----------------------------------------------------------------------------
4// Filename : TConformalFinder.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to find tracks with the conformal method.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TConformalFinder_FLAG_
14#define TConformalFinder_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17#ifndef TRKRECO_DEBUG
18#define TRKRECO_DEBUG
19#endif
20#endif
21#define HEP_SHORT_NAMES
22#include "CLHEP/Alist/ConstAList.h"
23#include "TrkReco/TFinderBase.h"
24#include "TrkReco/TMLink.h"
25#include "TrkReco/TSegment.h"
26#include "TrkReco/TBuilder.h"
27
28#ifdef TRKRECO_DEBUG
29#define ConformalInitialization 0
30#define ConformalFast2DLevel0 10
31#define ConformalFast2DLevel1 11
32#define ConformalFast3DLevel0 20
33#define ConformalFast3DLevel1 21
34#define ConformalSlow2D 40
35#define ConformalSlow3D 41
36#define ConformalOutside 99
37#endif
38#ifdef TRKRECO_WINDOW
39#include "TrkReco/TWindow.h"
40#endif
41
42class TMDC;
43class TPoint2D;
44
45/// A class to find tracks with the conformal method.
47
48 public:
49 /// Constructor.
50 TConformalFinder(unsigned fastFinder,
51 unsigned slowFinder,
52 unsigned perfectSegmentFinding,
53 float maxSigma,
54 float maxSigmaStereo,
55 float salvageLevel,
56 unsigned minNLinksForSegment,
57 unsigned minNCoreLinks,
58 unsigned minNSegments,
59 unsigned salvageLoadWidth,
60 unsigned stereoMode,
61 unsigned stereoLoadWidth,
62 float szSegmentDistance,
63 float szLinkDistance,
64 unsigned fittingFlag);
65
66 /// Destructor
67 virtual ~TConformalFinder();
68
69 public:// Selectors
70 /// returns name.
71 std::string name(void) const;
72
73 /// returns version.
74 std::string version(void) const;
75
76 /// dumps debug information.
77 void dump(const std::string & message = std::string(""),
78 const std::string & prefix = std::string("")) const;
79
80 /// returns T0 reset is done.
81 bool T0ResetDone(void) const;
82
83 public:// Modifiers
84 /// clear internal information.
85 void clear(void);
86
87 /// finds tracks.
88 int doit(const AList<TMDCWireHit> & axialHits,
89 const AList<TMDCWireHit> & stereoHits,
90 AList<TTrack> & tracks,
91 AList<TTrack> & tracks2D);
92
93 /// sets a flag to do T0 reset in the fast 2D finding.
94 bool doT0Reset(bool);
95
96 private:
97 /// selects good hits.
98 void selectGoodHits(void);
99
100 /// finds segments from _goodHits.
101 void findSegments(void);
102 void findSegmentsPerfect(void);
103 /// finds segments from all hits.
104 void findSegmentsTsf(void);
105
106 /// links segments.
107 void linkSegments(unsigned level);
108 void linkSegmentsTsf(void);
109
110 /// fast findings. level:0/1:selection of segments to be used
111 void fastFinding2D(unsigned level);
112 void fastFinding3D(unsigned level);
113
114 /// slow findings. level:0/1:selection of segments to be used
115 void slowFinding2D(unsigned level);
116 TTrack * expand(AList<TSegment> &) const;
117 TTrack * expand(TTrack &) const;
118 void targetSuperLayer(unsigned ptn, unsigned & in, unsigned & out) const;
119 AList<TSegment> targetSegments(const TTrack &, unsigned sl) const;
120 AList<TMLink> targetLinks(const TTrack &, unsigned sl) const;
121 bool trackQuality(const TTrack &) const;
122
123 /// finds setereo segments.
124 AList<TSegment> stereoSegments(const TTrack & t) const;
125 AList<TSegment> stereoSegmentsFromBadHits(const TTrack & t) const;
126
127 /// salvages segments.
128 void salvage(TTrack & track,
129 unsigned axialStereoSwitch,
130 const AList<TSegment> & bads) const;
131
132 /// removes bad segments.
133 AList<TSegment> removeBadSegments(TTrack &) const;
134 AList<TSegment> refineSegments(const TTrack &) const;
135 void refineLinks(TTrack &, unsigned minNHits) const;
136
137 /// resolves multi-assignment of segments/hits.
138 void resolveSegments(AList<TTrack> & tracks) const;
139 void resolveHits(AList<TTrack> & tracks) const;
140
141 /// remove used segments.
142 void removeUsedSegments(const AList<TTrack> & tracks);
143
144 /// deletes a track.
145 void deleteTrack(TTrack &) const;
146
147 /// re-calculate TMLinks.
148 void updateTLinks(AList<TTrack> & tracks);
149
150 /// Utility functions
151 int crossPoints(const TTrack &, TPoint2D points[12]) const;
152 int crossPointsInConformal(const AList<TSegment> &,
153 HepPoint3D points[12]) const;
154 AList<TSegment> pickUpSegments(const TPoint2D p[12],
155 float loadWidth,
156 unsigned axialStereo) const;
157 AList<TSegment> pickUpSegmentsInConformal(float phi[12],
158 float loadWidth,
159 unsigned axialStereo) const;
160 AList<TMLink> pickUpLinks(const TPoint2D p[12],
161 float loadWidth,
162 unsigned axialStereo) const;
163 AList<TMLink> pickUpLinksInConformal(float phi[12],
164 float loadWidth,
165 unsigned axialStereo) const;
166 AList<TMLink> trackSide(const TTrack &, const AList<TMLink> &) const;
167 AList<TSegment> trackSide(const TTrack &, const AList<TSegment> &) const;
168 bool quality2D(TTrack & t, unsigned level) const;
169 TSegment * link(const TSegment & seed,
170 const HepPoint3D & p,
171 const HepVector3D & v,
172 const AList<TSegment> & candidates,
173 AList<TSegment> & alternatives,
174 unsigned level) const;
175 HepVector3D direction(const TSegment &) const;
176
177 public:// Utility functions
178 static const TMDCWire * conformal2Wire(const HepPoint3D & conformalPoint);
179
180 private:// Parameters
181 bool _doT0Reset;
182 const unsigned _perfectSegmentFinding;
183 const unsigned _segmentSeparation;
184 const unsigned _minNLinksForSegment;
185 const unsigned _minNLinksForSegmentInRefine;
186 const unsigned _maxNLinksForSegment;
187 const unsigned _maxWidthForSegment;
188 const unsigned _minNCoreLinks;
189 const unsigned _minNSegments;
190 const float _minUsedFractionSlow2D;
191 const unsigned _appendLoad;
192 const unsigned _salvageLoadWidth;
193 const unsigned _stereoMode;
194 const unsigned _stereoLoadWidth;
195 float _linkMaxDistance[3];
196 float _linkMinDirAngle[3];
197
198 private:
199 IMagneticFieldSvc* m_pmgnIMF;
200 const bool _fastFinder;
201 const bool _slowFinder;
202 const TBuilder _builder;
203 const float _maxSigma2;
204
205 AList<TMLink> _allHits[3]; // 0:axial, 1:stereo, 2:both
206 AList<TMLink> _hits[3]; // 0:axial, 1:stereo, 2:both
207 AList<TMLink> _unused[3]; // 0:axial, 1:stereo, 2:both
208
209 AList<TSegment> _allSegments[2][6]; // 0:axial, 1:stereo
210 AList<TSegment> _allUnused[2][6]; // 0:axial, 1:stereo
211 AList<TSegment> _stereoBadSegments;
212
213 AList<TTrack> _2DTracks;
214 AList<TTrack> _3DTracks;
215
216 bool _T0ResetDone;
217
218 struct summary {
219 unsigned _nEvents;
220 unsigned _nTracksFast3D;
221 unsigned _nTracksSlow3D;
222 unsigned _nTracksFast2D;
223 unsigned _nTracksSlow2D;
224 unsigned _nTracksFast2DBadQuality;
225 unsigned _nTracksSlow2DBadQuality;
226 unsigned _dummy;
227 };
228 struct summary * _s;
229
230#ifdef TRKRECO_DEBUG
231 public:
232 static unsigned _stage;
233#endif
234
235#ifdef TRKRECO_WINDOW
236 private:
237 mutable TWindow _rphiWindow;
238
239 public:
240 void displayStatus(const std::string & message) const;
241 void displayAppendSegments(const AList<TSegment> a[2][6],
242 leda_color =leda_black) const;
243 void displayTracks(const AList<TTrack> &,
244 const AList<TSegment> seg[2][6],
245 const std::string & text) const;
246#endif
247};
248
249//-----------------------------------------------------------------------------
250
251#ifdef TConformalFinder_NO_INLINE
252#define inline
253#else
254#undef inline
255#define TConformalFinder_INLINE_DEFINE_HERE
256#endif
257
258#ifdef TConformalFinder_INLINE_DEFINE_HERE
259
260inline
261std::string
263 return "Conformal Finder";
264}
265
266inline
267bool
269 return _doT0Reset = a;
270}
271
272inline
273bool
275 return _T0ResetDone;
276}
277
278#endif
279
280#undef inline
281
282#endif /* TConformalFinder_FLAG_ */
**********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
A class to build a track.
Definition: TBuilder.h:34
A class to find tracks with the conformal method.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void clear(void)
clear internal information.
int doit(const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
finds tracks.
bool T0ResetDone(void) const
returns T0 reset is done.
std::string version(void) const
returns version.
static const TMDCWire * conformal2Wire(const HepPoint3D &conformalPoint)
bool doT0Reset(bool)
sets a flag to do T0 reset in the fast 2D finding.
std::string name(void) const
returns name.
virtual ~TConformalFinder()
Destructor.
A virtual class for a track finder in tracking.
Definition: TFinderBase.h:31
A class to represent a wire in MDC.
Definition: TMDCWire.h:55
Definition: TMDC.h:61
A class to represent a point in 2D.
Definition: TPoint2D.h:37
A class to relate TMDCWireHit and TTrack objects.
Definition: TSegment.h:43
A class to represent a track in tracking.
Definition: TTrack.h:129
int t()
Definition: t.c:1