BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/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 : yoshihito.iwasaki@kek.jp
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 "MdcRecEvent/RecMdcHit.h"
27#include "MdcRecEvent/RecMdcTrack.h"
28#include "TrkReco/TCosmicFitter.h"
29#include "TrkReco/THelixFitter.h"
30#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"
39#include "RawDataProviderSvc/IRawDataProviderSvc.h"
40
41class StatusCode;
42
43/// A manager of TTrack information to make outputs as MdcRec_trk.
44class TTrackManager : public TUpdater {
45
46public:
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
57public: // 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
76public: // 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
90public: // 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.
118 void sortTracksByPt( void );
119
120public: // 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,
128 int runge = 0, int cal = 0 );
129
130 /// stores track info. into Panther table.
131 void saveTables( void );
132
133 /// stores MC track info. into Panther table.
134 void saveMCTables( void ) const;
135
136 /// sorts RECMDC_TRK tables.
137 void sortBanksByPt( void ) const;
138
139private: // table manipulations in private
140 /// copies a track. Non-zero will be returned if error happens.
141 int copyTrack( TTrack& t, MdcRec_trk** r, MdcRec_trk_add** a ) const;
142 /// sorts banks.
143 void swapReccdc( MdcRec_trk& cdc0, MdcRec_trk_add& add0, MdcRec_mctrk& mc0, MdcRec_trk& cdc1,
144 MdcRec_trk_add& add1, MdcRec_mctrk& mc1 ) const;
145 void swapRectrk( MdcTrk& trk0, MdcTrk& tkr1 ) const;
146 void tagReccdc( unsigned* id, unsigned n ) const;
147 void tagRectrk( unsigned* id, unsigned n ) const;
148
149public: // functions for after trak
150 /// final decision for a curler.
151 void treatCurler( MdcTrk& curl, MdcRec_trk_add& cdc, unsigned flag ) const;
152
153 /// determines IP.
154 void determineIP( void );
155
156public: // hit manipulations
157 /// masks hits on found curl tracks.
158 void maskCurlHits( const AList<TMDCWireHit>& axial, const AList<TMDCWireHit>& stereo,
159 const AList<TTrack>& tracks ) const;
160
161 /// masks hits with large chisq as associated hits. Pull in TMLink is used.
162 static void maskBadHits( const AList<TTrack>&, float maxSigma2 );
163
164 /// salvages hits for dE/dx(not for track fitting).
165 void salvageAssociateHits( const AList<TMDCWireHit>&, float maxSigma2 );
166
167 /// associates SVD and then adds track information.
168 // void addSvd(const int) const;
169
170private: // internal functions
171 /// checks track quality.
172 AList<TTrack> selectGoodTracks( const AList<TTrack>&, bool track2D = false ) const;
173 static bool checkNumberOfHits( const TTrack&, bool track2D = false );
174
175 /// names tracks.
176 void nameTracks( void );
177
178 /// returns T0 by old methode(expensive).
179 float T0( unsigned n );
180
181 /// returns T0 by T0 fitting.
182 float T0Fit( unsigned n );
183 float minimum( float y0, float y1, float y2 ) const;
184
185public: // obsolete
186 TMLink& divide( const TTrack& t, AList<TMLink>* l ) const;
187 TMLink& divideByIp( const TTrack& t, AList<TMLink>* l ) const;
189 /// returns a track which is the closest to a hit.
190 TTrack* closest( const AList<TTrack>&, const TMDCWireHit& ) const;
191 /// salvages remaining hits.
192 void salvage( const AList<TMDCWireHit>& ) const;
193 /// masks hits out which are in tail of curly tracks.
194 void mask( void ) const;
195 void maskNormal( TTrack& ) const;
196 void maskCurl( TTrack& ) const;
197 void maskOut( TTrack&, const AList<TMLink>& ) const;
198 void maskMultiHits( TTrack& ) const;
199 void merge( void );
200
201 void sett0bes( double t0 ) { t0bes = t0; }
202
203private:
204 IBesMagFieldSvc* getPmgnIMF() const;
205 IRawDataProviderSvc* getRawDataProviderSvc() const;
206
207 mutable IBesMagFieldSvc* m_pmgnIMF;
208 mutable IRawDataProviderSvc* m_rawDataProviderSvc;
209 double t0bes;
210 int _debugLevel;
211 double _maxMomentum;
212 double _sigmaCurlerMergeTest;
213 unsigned _nCurlerMergeTest;
214
215 THelixFitter _fitter;
216 THelixFitter _cFitter;
217
218 AList<TTrack> _tracksAll; // all tracks found by the finders
219 AList<TTrack> _tracks; // good 3D tracks determined by the mgr
220 AList<TTrack> _tracks2D; // good 2D tracks determined by the mgr
221 AList<TTrack> _tracksFinal; // final tracks output to tables
222
223 AList<TMLink> _associateHits;
224
225 struct summary {
226 unsigned _nEvents;
227 unsigned _nTracks;
228 unsigned _nTracksAll;
229 unsigned _nTracks2D;
230 unsigned _nTracksFinal;
231 unsigned _nSuperMoms;
232 unsigned _nToBeMerged;
233 unsigned _nToBeMergedMoreThanTwo;
234 };
235 struct summary* _s;
236
237 // t0 in 6 para helix fitting... Liuqg
238 float _t0;
239};
240
241//-----------------------------------------------------------------------------
242
243#ifdef TRKRECO_NO_INLINE
244# define inline
245#else
246# undef inline
247# define TTRACKMANAGER_INLINE_DEFINE_HERE
248#endif
249
250#ifdef TTRACKMANAGER_INLINE_DEFINE_HERE
251
252inline std::string TTrackManager::name( void ) const { return std::string( "Track Manager" ); }
253
254inline const AList<TTrack>& TTrackManager::tracks( void ) const { return _tracks; }
255
256inline const AList<TTrack>& TTrackManager::tracks2D( void ) const { return _tracks2D; }
257
258inline const AList<TTrack>& TTrackManager::allTracks( void ) const { return _tracksAll; }
259
260inline double TTrackManager::maxMomentum( double a ) { return _maxMomentum = a; }
261
262inline int TTrackManager::debugLevel( void ) const { return _debugLevel; }
263
264inline int TTrackManager::debugLevel( int a ) { return _debugLevel = a; }
265
266inline void TTrackManager::fittingFlag( unsigned a ) {
267 if ( a & 1 ) _fitter.sag( true );
268 if ( a & 2 ) _fitter.propagation( true );
269 if ( a & 4 ) _fitter.tof( true );
270 if ( a & 8 ) _fitter.freeT0( true );
271}
272
273inline const AList<TTrack>& TTrackManager::tracksFinal( void ) const { return _tracksFinal; }
274
275inline float TTrackManager::paraT0( void ) const { return _t0; }
276
277#endif
278
279#undef inline
280
281#endif /* TTRACKMANAGER_FLAG_ */
std::string cal
const Int_t n
A class to fit a TTrackBase object to a helix.
A manager of TTrack information to make outputs as MdcRec_trk.
void movePivot(void)
moves pivot of tracks.
void append2D(AList< TTrack > &list)
void maskOut(TTrack &, const AList< TMLink > &) const
virtual ~TTrackManager()
Destructor.
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
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.
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.
TMLink & divideByIp(const TTrack &t, AList< TMLink > *l) const
void sortBanksByPt(void) const
sorts RECMDC_TRK tables.
int debugLevel(int)
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)
static bool goodTrack(const TTrack &, bool track2D=false)
checks goodness of a track.
A class to represent a track in tracking.
A class to handle update timing of static objects of tracking.
int t()
Definition t.c:1