CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TTrackManager.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TTrackManager.h,v 1.17 2012/05/28 05:16:29 maoh Exp $
3//-----------------------------------------------------------------------------
4// Filename : TTrackManager.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A manager of TTrack information to make outputs as Reccdc_trk.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TTRACKMANAGER_FLAG_
14#define TTRACKMANAGER_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#include "CLHEP/Alist/AList.h"
26#include "TrkReco/TUpdater.h"
31class TMDCWireHit;
32class TTrack;
33//struct reccdc_trk;
34//struct reccdc_trk_add;
35//struct reccdc_mctrk;
36//struct rectrk;
37#include "MdcTables/MdcTables.h"
38#include "MdcTables/TrkTables.h"
40
41class StatusCode;
42
43/// A manager of TTrack information to make outputs as MdcRec_trk.
44class TTrackManager : public TUpdater {
45
46 public:
47 /// Constructor.
49
50 /// Destructor.
51 virtual ~TTrackManager();
52
53 /// dumps debug information.
54 void dump(const std::string & message = std::string(""),
55 const std::string & prefix = std::string("")) const;
56
57 public:// to access information
58 /// returns name.
59 std::string name(void) const;
60
61 /// returns version.
62 std::string version(void) const;
63
64 /// returns a list of all reconstructed tracks including junks.
65 const AList<TTrack> & allTracks(void) const;
66
67 /// returns a list of reconstructed tracks.
68 const AList<TTrack> & tracks(void) const;
69
70 /// returns a list of 2D tracks.
71 const AList<TTrack> & tracks2D(void) const;
72
73 /// returns a list of tracks writen to MdcRec_trk.
74 const AList<TTrack> & tracksFinal(void) const;
75
76 public:// parameters
77 /// sets fitting flag.
78 void fittingFlag(unsigned);
79
80 /// sets the max. momentum.
81 double maxMomentum(double);
82
83 /// returns/sets debug level.
84 int debugLevel(void) const;
85 int debugLevel(int);
86
87 //6para T0... Liuqg
88 float paraT0(void) const;
89
90 public:// track manipulations
91 /// clears all internal information.
92 void clear(void);
93
94 /// checks goodness of a track.
95 static bool goodTrack(const TTrack &, bool track2D = false);
96
97 /// appends (2D) tracks. 'list' will be cleaned up.
98 void append(AList<TTrack> & list);
99 void append2D(AList<TTrack> & list);
100
101 /// refits tracks.
102 void refit(void);
103
104 /// finishes tracks.
105 void finish(void);
106
107 /// moves pivot of tracks.
108 void movePivot(void);
109
110 /// determines T0 and refit all tracks.
111 StatusCode determineT0(unsigned level, unsigned nMaxTracks);
112
113 /// tests for curlers.
114 void setCurlerFlags(void);
115
116 /// sorts tracks.
117 void sortTracksByQuality(void);
118 void sortTracksByPt(void);
119
120 public:// table manipulations
121 /// clears tables.
122 void clearTables(void) const;
123
124 /// stores track info. into TDS. by Zang Shilei
125 //yzhang changed 2010-01-12
126 //StatusCode makeTds(bool doClear = true, int tkStat = 0);
127 StatusCode makeTds(RecMdcTrackCol* trackList, RecMdcHitCol* hitList, int tkStat = 1, int runge=0, int cal=0);
128
129 /// stores track info. into Panther table.
130 void saveTables(void);
131
132 /// stores MC track info. into Panther table.
133 void saveMCTables(void) const;
134
135 /// sorts RECMDC_TRK tables.
136 void sortBanksByPt(void) const;
137
138 private:// table manipulations in private
139 /// copies a track. Non-zero will be returned if error happens.
140 int copyTrack(TTrack & t,
141 MdcRec_trk ** r,
142 MdcRec_trk_add ** a) const;
143 /// sorts banks.
144 void swapReccdc(MdcRec_trk & cdc0,
145 MdcRec_trk_add & add0,
146 MdcRec_mctrk & mc0,
147 MdcRec_trk & cdc1,
148 MdcRec_trk_add & add1,
149 MdcRec_mctrk & mc1) const;
150 void swapRectrk(MdcTrk & trk0, MdcTrk & tkr1) const;
151 void tagReccdc(unsigned * id, unsigned n) const;
152 void tagRectrk(unsigned * id, unsigned n) const;
153
154 public:// functions for after trak
155 /// final decision for a curler.
156 void treatCurler(MdcTrk & curl, MdcRec_trk_add & cdc, unsigned flag) const;
157
158 /// determines IP.
159 void determineIP(void);
160
161 public:// hit manipulations
162 /// masks hits on found curl tracks.
163 void maskCurlHits(const AList<TMDCWireHit> & axial,
164 const AList<TMDCWireHit> & stereo,
165 const AList<TTrack> & tracks) const;
166
167 /// masks hits with large chisq as associated hits. Pull in TMLink is used.
168 static void maskBadHits(const AList<TTrack> &, float maxSigma2);
169
170 /// salvages hits for dE/dx(not for track fitting).
172 float maxSigma2);
173
174 /// associates SVD and then adds track information.
175 // void addSvd(const int) const;
176
177 private:// internal functions
178 /// checks track quality.
179 AList<TTrack> selectGoodTracks(const AList<TTrack> &,
180 bool track2D = false) const;
181 static bool checkNumberOfHits(const TTrack &, bool track2D = false);
182
183 /// names tracks.
184 void nameTracks(void);
185
186 /// returns T0 by old methode(expensive).
187 float T0(unsigned n);
188
189 /// returns T0 by T0 fitting.
190 float T0Fit(unsigned n);
191 float minimum(float y0, float y1, float y2) const;
192
193 public:// obsolete
194 TMLink & divide(const TTrack & t, AList<TMLink> * l) const;
195 TMLink & divideByIp(const TTrack & t, AList<TMLink> * l) const;
197 /// returns a track which is the closest to a hit.
198 TTrack * closest(const AList<TTrack> &, const TMDCWireHit &) const;
199 /// salvages remaining hits.
200 void salvage(const AList<TMDCWireHit> &) const;
201 /// masks hits out which are in tail of curly tracks.
202 void mask(void) const;
203 void maskNormal(TTrack &) const;
204 void maskCurl(TTrack &) const;
205 void maskOut(TTrack &, const AList<TMLink> &) const;
206 void maskMultiHits(TTrack &) const;
207 void merge(void);
208
209
210 void
211 sett0bes(double t0) {
212 t0bes = t0;
213 }
214
215 private:
216 IMagneticFieldSvc* m_pmgnIMF;
217 RawDataProviderSvc * m_rawDataProviderSvc;
218 double t0bes;
219 int _debugLevel;
220 double _maxMomentum;
221 double _sigmaCurlerMergeTest;
222 unsigned _nCurlerMergeTest;
223
224 THelixFitter _fitter;
225 THelixFitter _cFitter;
226
227 AList<TTrack> _tracksAll; // all tracks found by the finders
228 AList<TTrack> _tracks; // good 3D tracks determined by the mgr
229 AList<TTrack> _tracks2D; // good 2D tracks determined by the mgr
230 AList<TTrack> _tracksFinal; // final tracks output to tables
231
232 AList<TMLink> _associateHits;
233
234 struct summary {
235 unsigned _nEvents;
236 unsigned _nTracks;
237 unsigned _nTracksAll;
238 unsigned _nTracks2D;
239 unsigned _nTracksFinal;
240 unsigned _nSuperMoms;
241 unsigned _nToBeMerged;
242 unsigned _nToBeMergedMoreThanTwo;
243 };
244 struct summary * _s;
245
246 //t0 in 6 para helix fitting... Liuqg
247 float _t0;
248};
249
250//-----------------------------------------------------------------------------
251
252#ifdef TRKRECO_NO_INLINE
253#define inline
254#else
255#undef inline
256#define TTRACKMANAGER_INLINE_DEFINE_HERE
257#endif
258
259#ifdef TTRACKMANAGER_INLINE_DEFINE_HERE
260
261inline
262std::string
264 return std::string("Track Manager");
265}
266
267inline
268const AList<TTrack> &
270 return _tracks;
271}
272
273inline
274const AList<TTrack> &
276 return _tracks2D;
277}
278
279inline
280const AList<TTrack> &
282 return _tracksAll;
283}
284
285inline
286double
288 return _maxMomentum = a;
289}
290
291inline
292int
294 return _debugLevel;
295}
296
297inline
298int
300 return _debugLevel = a;
301}
302
303inline
304void
306 if (a & 1) _fitter.sag(true);
307 if (a & 2) _fitter.propagation(true);
308 if (a & 4) _fitter.tof(true);
309 if (a & 8) _fitter.freeT0(true);
310}
311
312inline
313const AList<TTrack> &
315 return _tracksFinal;
316}
317
318inline
319float
321 return _t0;
322}
323
324
325#endif
326
327#undef inline
328
329#endif /* TTRACKMANAGER_FLAG_ */
std::string cal
Definition: CalibModel.cxx:41
const Int_t n
ObjectVector< RecMdcHit > RecMdcHitCol
Definition: RecMdcHit.h:99
ObjectVector< RecMdcTrack > RecMdcTrackCol
Definition: RecMdcTrack.h:102
A class to fit a TTrackBase object to a helix.
Definition: THelixFitter.h:48
bool freeT0(void) const
sets/returns free T0 flag.
Definition: THelixFitter.h:275
bool tof(void) const
sets/returns propagation-delay correction flag.
Definition: THelixFitter.h:207
bool sag(void) const
sets/returns sag correction flag.
Definition: THelixFitter.h:181
bool propagation(void) const
sets/returns propagation-delay correction flag.
Definition: THelixFitter.h:193
A manager of TTrack information to make outputs as MdcRec_trk.
Definition: TTrackManager.h:44
void movePivot(void)
moves pivot of tracks.
void append2D(AList< TTrack > &list)
void maskOut(TTrack &, const AList< TMLink > &) const
void removeHitsAcrossOverIp(AList< TMLink > &) const
static void maskBadHits(const AList< TTrack > &, float maxSigma2)
masks hits with large chisq as associated hits. Pull in TMLink is used.
void clearTables(void) const
clears tables.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void merge(void)
void maskNormal(TTrack &) const
virtual ~TTrackManager()
Destructor.
void finish(void)
finishes tracks.
TTrack * closest(const AList< TTrack > &, const TMDCWireHit &) const
returns a track which is the closest to a hit.
void append(AList< TTrack > &list)
appends (2D) tracks. 'list' will be cleaned up.
void saveTables(void)
stores track info. into Panther table.
std::string version(void) const
returns version.
float paraT0(void) const
void salvageAssociateHits(const AList< TMDCWireHit > &, float maxSigma2)
salvages hits for dE/dx(not for track fitting).
const AList< TTrack > & tracksFinal(void) const
returns a list of tracks writen to MdcRec_trk.
void refit(void)
refits tracks.
TMLink & divide(const TTrack &t, AList< TMLink > *l) const
StatusCode makeTds(RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat=1, int runge=0, int cal=0)
stores track info. into TDS. by Zang Shilei
void setCurlerFlags(void)
tests for curlers.
const AList< TTrack > & tracks2D(void) const
returns a list of 2D tracks.
void maskMultiHits(TTrack &) const
void determineIP(void)
determines IP.
static bool goodTrack(const TTrack &, bool track2D=false)
checks goodness of a track.
const AList< TTrack > & tracks(void) const
returns a list of reconstructed tracks.
std::string name(void) const
returns name.
TTrackManager()
Constructor.
int debugLevel(void) const
returns/sets debug level.
void maskCurl(TTrack &) const
void saveMCTables(void) const
stores MC track info. into Panther table.
const AList< TTrack > & allTracks(void) const
returns a list of all reconstructed tracks including junks.
void mask(void) const
masks hits out which are in tail of curly tracks.
void sett0bes(double t0)
TMLink & divideByIp(const TTrack &t, AList< TMLink > *l) const
void sortBanksByPt(void) const
sorts RECMDC_TRK tables.
void sortTracksByQuality(void)
sorts tracks.
double maxMomentum(double)
sets the max. momentum.
void treatCurler(MdcTrk &curl, MdcRec_trk_add &cdc, unsigned flag) const
final decision for a curler.
void maskCurlHits(const AList< TMDCWireHit > &axial, const AList< TMDCWireHit > &stereo, const AList< TTrack > &tracks) const
masks hits on found curl tracks.
void fittingFlag(unsigned)
sets fitting flag.
StatusCode determineT0(unsigned level, unsigned nMaxTracks)
determines T0 and refit all tracks.
void salvage(const AList< TMDCWireHit > &) const
salvages remaining hits.
void clear(void)
clears all internal information.
void sortTracksByPt(void)
A class to represent a track in tracking.
Definition: TTrack.h:129
A class to handle update timing of static objects of tracking.
Definition: TUpdater.h:25
int t()
Definition: t.c:1