StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcConfMapper.hh
1 // $Id: StFtpcConfMapper.hh,v 1.23 2018/03/15 22:00:35 smirnovd Exp $
2 // $Log: StFtpcConfMapper.hh,v $
3 // Revision 1.23 2018/03/15 22:00:35 smirnovd
4 // Fix linker error by removing declared but undefined functions
5 //
6 // Revision 1.22 2010/06/02 12:12:01 jcs
7 // undo correction for Bug#1939 since it was incorrect
8 //
9 // Revision 1.21 2010/05/19 14:55:29 jcs
10 // Correction for Bug #1939 - variables with the same name were defined twice;
11 // once in StFtpcTrackingParams.hh and again in StFtpcConfMapper.hh
12 // The names of the StFtpcConfMapper variables have been changed to make them unique
13 //
14 // Revision 1.20 2007/01/15 08:23:01 jcs
15 // replace printf, cout and gMesMgr with Logger commands
16 //
17 // Revision 1.19 2004/02/12 19:37:10 oldi
18 // *** empty log message ***
19 //
20 // Revision 1.18 2003/09/16 15:27:01 jcs
21 // removed inline as it would leave a few undefined reference
22 //
23 // Revision 1.17 2003/01/20 13:16:23 oldi
24 // Additional volume segment added as garbage container. Hits which give a
25 // segment index which is out of range (esp. those ones sitting exactly on the
26 // beam line) are put in here.
27 // Handling of function GetSegm() simplified.
28 //
29 // Revision 1.16 2002/11/06 13:44:53 oldi
30 // Vertex handling simplifed.
31 // Flag for clusters not to be used for tracking introduced.
32 // Code clean ups.
33 //
34 // Revision 1.15 2002/10/11 15:45:03 oldi
35 // Get FTPC geometry and dimensions from database.
36 // No field fit activated: Returns momentum = 0 but fits a helix.
37 // Bug in TrackMaker fixed (events with z_vertex > outer_ftpc_radius were cut).
38 // QA histograms corrected (0 was supressed).
39 // Code cleanup (several lines of code changed due to *params -> Instance()).
40 // cout -> gMessMgr.
41 //
42 // Revision 1.14 2002/09/04 13:44:22 oldi
43 // Typos fixed.
44 //
45 // Revision 1.13 2002/04/29 15:49:50 oldi
46 // All tracking parameters moved to StFtpcTrackingParameters.cc/hh.
47 // In a future version the actual values should be moved to an .idl file (the
48 // interface should be kept as is in StFtpcTrackingParameters.cc/hh).
49 //
50 // Revision 1.12 2002/04/05 16:50:11 oldi
51 // Cleanup of MomentumFit (StFtpcMomentumFit is now part of StFtpcTrack).
52 // Each Track inherits from StHelix, now.
53 // Therefore it is possible to calculate, now:
54 // - residuals
55 // - vertex estimations obtained by back extrapolations of FTPC tracks
56 // Chi2 was fixed.
57 // Many additional minor (and major) changes.
58 //
59 // Revision 1.11 2002/03/15 10:04:41 oldi
60 // Adjust eta segments not only to z-position of vertex but to x,y as well.
61 // Avoid tracking if vertex position is outside of the inner radius of the Ftpc.
62 //
63 // Revision 1.10 2001/11/21 12:31:15 jcs
64 // adjust mEtaMax for extended drift maps
65 //
66 // Revision 1.9 2001/07/12 08:29:09 oldi
67 // New constructor introduced to be able to use only cluster which were
68 // found to be good in a previous run.
69 // New function NoFieldTracking() introduced.
70 // Tracking parameters for LaserTracking() changed.
71 //
72 // Revision 1.8 2001/01/25 15:21:45 oldi
73 // Review of the complete code.
74 // Fix of several bugs which caused memory leaks:
75 // - Tracks were not allocated properly.
76 // - Tracks (especially split tracks) were not deleted properly.
77 // - TClonesArray seems to have a problem (it could be that I used it in a
78 // wrong way). I changed all occurences to TObjArray which makes the
79 // program slightly slower but much more save (in terms of memory usage).
80 // Speed up of HandleSplitTracks() which is now 12.5 times faster than before.
81 // Cleanup.
82 //
83 // Revision 1.7 2000/11/10 18:37:02 oldi
84 // New functions introduced to be able to extend tracks after main vertex tracking.
85 // This implied many changes in other parts of the class (loop over clusters can run backwards now).
86 // TBenchmark object ('mBench') moved to StFtpcTracker.
87 // Cleanup.
88 //
89 // Revision 1.6 2000/08/02 10:10:44 oldi
90 // Changes in function GetSegm() to avoid pointing out of the ObjArry.
91 // If GetSegm() tries to use a segment out of bounds a warning will be print
92 // and the last segment will be returned.
93 // New functions added to be able to calculate the coordinates of a given
94 // volume segment (used in the warning message above).
95 //
96 // Revision 1.5 2000/07/18 21:22:15 oldi
97 // Changes due to be able to find laser tracks.
98 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint
99 // to bundle often called functions
100 // - short functions inlined
101 // - formulas of StFormulary made static
102 // - avoid streaming of objects of unknown size
103 // (removes the bunch of CINT warnings during compile time)
104 // - two or three minor bugs cured
105 //
106 // Revision 1.4 2000/06/13 14:33:10 oldi
107 // Added three new funtions (SetEtaMin(), SetEtaMax(), CalcEtaMinMax()) and
108 // two data members (mEtaMin, mEtaMax) to be able to calculate the
109 // min./max. possible value of the pseudorapidity eta with the z-position of
110 // the found main vertex. This solves bug #574 where the min./max. values of eta
111 // were fixed and could be to small if the found main vertex was to far off from
112 // z=0.
113 //
114 // Revision 1.3 2000/06/07 11:03:53 oldi
115 // Added CreateTrack(StFtpcConfMapPoint *hit) to cleanup ClusterLoop().
116 // Added TrackLoop().
117 // Added ExtendTrack(StFtpcTrack *track).
118 // Added CalcChiSquared(StFtpcTrack *track, StFtpcConfMapPoint *point,
119 // Double_t *chi2).
120 // Added MergeSplitTracks(StFtpcTrack *t1, StFtpcTrack *t2).
121 //
122 // Revision 1.2 2000/05/11 15:14:42 oldi
123 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent
124 //
125 // Revision 1.1 2000/05/10 13:39:11 oldi
126 // Initial version of StFtpcTrackMaker
127 //
128 
130 // //
131 // StFtpcConfMapper class - tracking algorithm with conformal mapping //
132 // //
134 
135 #ifndef STAR_StFtpcConfMapper
136 #define STAR_StFtpcConfMapper
137 
138 #include "StFtpcTrackingParams.hh"
139 #include "StFtpcTracker.hh"
140 #include "StFtpcConfMapPoint.hh"
141 #include "StFtpcTrack.hh"
142 #include "StMessMgr.h"
143 
144 #include "TObjArray.h"
145 #include "TBenchmark.h"
146 
148 
149 private:
150 
151  Bool_t mLaser; // indicator to know if this is a laser event
152 
153  // Volume segemnts
154  TObjArray *mVolume; // array of volume (pad, phi, eta) elements
155 
156  // Number of cells (segments)
157  Int_t mNumRowSegment; // this is (and has to be at most) the number of padrows
158  Int_t mNumPhiSegment; // number of phi segments
159  Int_t mNumEtaSegment; // number of eta segments
160  Int_t mBounds; // array size
161  Int_t mMaxFtpcRow; // number of rows in one Ftpc
162  Char_t mFtpc; // current Ftpc number (either 1 ore 2)
163 
164  // max. eta (pseudorapidity) values
165  Double_t mEtaMin;
166  Double_t mEtaMax;
167 
168  // Settings ([0]: non vertex tracks, [1]: main vertex tracks)
169  Bool_t mVertexConstraint; // vertex constraint (true or false)
170  Int_t mTrackletLength[2]; // minimal length of tracks (up to here different search algorithm)
171  Int_t mRowScopeTracklet[2]; // number of row segments to look for the next point of a tracklet
172  Int_t mRowScopeTrack[2]; // number of row segments to look for the next point of a track
173  Int_t mPhiScope[2]; // number of phi segments to look for the next point
174  Int_t mEtaScope[2]; // number of eta segments to look for the next point
175  Int_t mMinPoints[2]; // minimum number of points on one track
176 
177  // Cuts
178  Double_t mMaxAngleTracklet[2]; // limit of angle between to pieces of a tracklet
179  Double_t mMaxAngleTrack[2]; // limit of angle between to pieces of a track
180  Double_t mMaxCircleDist[2]; // limit of distance of a new cluster to the circle fit of a track
181  Double_t mMaxLengthDist[2]; // limit of distance of a new cluster to the length fit of a track
182 
183  // Tracking informtion
184  Int_t mMainVertexTracks; // number of tracks coming from the main vertex
185  Int_t mMergedTracks; // cluster on a track missing, but tracker was able to merge the pieces
186  Int_t mMergedTracklets; // cluster on a tracklet missing, but tracker was able to merge the pieces
187  Int_t mMergedSplits; // number of merged split tracks
188  Int_t mExtendedTracks; // number of extended tracks
189  Int_t mDiffHits; // circle fit and length fit returned differnet hits
190  Int_t mDiffHitsStill; // different hits from fits could not be resolved
191  Int_t mLengthFitNaN; // argument of arcsin was higher than +1 (lower than -1)
192  Int_t mClustersUnused; // number of unused clusters
193  Int_t mBadClusters; // number of clusters noy to be used for tracking ('bad' flag set)
194 
195  // setter
196  void SetEtaMin(Double_t f) { mEtaMin = f; } // sets min. value for eta
197  void SetEtaMax(Double_t f) { mEtaMax = f; } // sets max. value for eta
198  void CalcEtaMinMax(); // calculates the min. and max. value for eta
199 
200  void SetTrackletLength(Int_t f) { mTrackletLength[0] = mTrackletLength[1] = f; } // sets tracklet lengths (both the same)
201  void SetRowScopeTrack(Int_t f) { mRowScopeTrack[0] = mRowScopeTrack[1] = f; } // sets row scopes (both the same)
202  void SetRowScopeTracklet(Int_t f) { mRowScopeTracklet[0] = mRowScopeTracklet[1] = f; } // sets row scopes (both the same)=
203  void SetPhiScope(Int_t f) { mPhiScope[0] = mPhiScope[1] = f; } // sets phi scopes (both the same)
204  void SetEtaScope(Int_t f) { mEtaScope[0] = mEtaScope[1] = f; } // sets eta scopes (both the same)
205  void SetMinPoints(Int_t f) { mMinPoints[0] = mMinPoints[1] = f; } // sets minimum number of points (both the same)
206  void SetMaxAngleTrack(Double_t f) { mMaxAngleTrack[0] = mMaxAngleTrack[1] = f; } // sets angle cuts (both the same)
207  void SetMaxAngleTracklet(Double_t f) { mMaxAngleTracklet[0] = mMaxAngleTracklet[1] = f; } // sets angle cuts (both the same)
208  void SetMaxCircleDistTrack(Double_t f) { mMaxCircleDist[0] = mMaxCircleDist[1] = f; } // sets circle cuts (both the same)
209  void SetMaxLengthDistTrack(Double_t f) { mMaxLengthDist[0] = mMaxLengthDist[1] = f; } // sets length cuts (both the same)
210 
211  void SetTrackletLength(Int_t f, Int_t g) { mTrackletLength[1] = f; mTrackletLength[0] = g; } // sets tracklet lengths (both but different)
212  void SetRowScopeTrack(Int_t f, Int_t g) { mRowScopeTrack[1] = f; mRowScopeTrack[0] = g; } // sets row scopes for tracks(both but different)
213  void SetRowScopeTracklet(Int_t f, Int_t g) { mRowScopeTracklet[1] = f; mRowScopeTracklet[0] = g; } // sets row scopes for tracklets(both but different)
214  void SetPhiScope(Int_t f, Int_t g) { mPhiScope[1] = f; mPhiScope[0] = g; } // sets phi scopes (both but different)
215  void SetEtaScope(Int_t f, Int_t g) { mEtaScope[1] = f; mEtaScope[0] = g; } // sets eta scopes (both but different)
216  void SetMinPoints(Int_t f, Int_t g) { mMinPoints[1] = f; mMinPoints[0] = g; } // sets minimum number of points (both but different)
217  void SetMaxAngleTrack(Double_t f, Double_t g) { mMaxAngleTrack[1] = f; mMaxAngleTrack[0] = g; } // sets angle cuts (both but different)
218  void SetMaxAngleTracklet(Double_t f, Double_t g) { mMaxAngleTracklet[1] = f; mMaxAngleTracklet[0] = g; } // sets angle cuts (both but different)
219  void SetMaxCircleDistTrack(Double_t f, Double_t g) { mMaxCircleDist[1] = f; mMaxCircleDist[0] = g; } // sets circle cuts (both but different)
220  void SetMaxLengthDistTrack(Double_t f, Double_t g) { mMaxLengthDist[1] = f; mMaxLengthDist[0] = g; } // sets length cuts (both but different)
221 
222  void SetTrackletLength(Int_t f, Bool_t vertex_constraint) { mTrackletLength[(Int_t)vertex_constraint] = f; } // sets one tracklet length
223  void SetRowScopeTrack(Int_t f, Bool_t vertex_constraint) { mRowScopeTrack[(Int_t)vertex_constraint] = f; } // sets one row scope for tracks
224  void SetRowScopeTracklet(Int_t f, Bool_t vertex_constraint) { mRowScopeTracklet[(Int_t)vertex_constraint] = f; } // sets one row scope for tracklets
225  void SetPhiScope(Int_t f, Bool_t vertex_constraint) { mPhiScope[(Int_t)vertex_constraint] = f; } // sets one phi scope
226  void SetEtaScope(Int_t f, Bool_t vertex_constraint) { mEtaScope[(Int_t)vertex_constraint] = f; } // sets one eta scope
227  void SetMinPoints(Int_t f, Bool_t vertex_constraint) { mMinPoints[(Int_t)vertex_constraint] = f; } // sets one minimum number of points
228  void SetMaxAngleTrack(Double_t f, Bool_t vertex_constraint) { mMaxAngleTrack[(Int_t)vertex_constraint] = f; } // sets one angle cut
229  void SetMaxAngleTracklet(Double_t f, Bool_t vertex_constraint) { mMaxAngleTracklet[(Int_t)vertex_constraint] = f; } // sets one angle cut
230  void SetMaxCircleDistTrack(Double_t f, Bool_t vertex_constraint) { mMaxCircleDist[(Int_t)vertex_constraint] = f; } // sets one circle cut
231  void SetMaxLengthDistTrack(Double_t f, Bool_t vertex_constraint) { mMaxLengthDist[(Int_t)vertex_constraint] = f; } // sets one length cut
232 
233 
234 public:
235  StFtpcConfMapper(); // default constructor
236  StFtpcConfMapper(TObjArray *inputHits,
237  MIntArray *good_hits,
238  StFtpcVertex *vertex = 0,
239  Bool_t bench = (Bool_t)kFALSE,
240  Int_t phi_segments = 100,
241  Int_t eta_segments = 200); // constructor to fill evaluated hits
242  StFtpcConfMapper(TObjArray *hits,
243  StFtpcVertex *vertex = 0,
244  Bool_t bench = (Bool_t)kFALSE,
245  Int_t phi_segments = 100,
246  Int_t eta_segments = 200); // constructor which takes an CLonesArray of hits
247  virtual ~StFtpcConfMapper(); // destructor
248 
249  // setter
250  void SetLaser(Bool_t f) { mLaser = f; } // set laser flag
251 
252  void Settings(TString method); // set settings by tracking procedure
253  void Settings(Int_t method_id); // set settings by tracking id
254  void Settings(Int_t trackletlength1, Int_t trackletlength2,
255  Int_t tracklength1, Int_t tracklength2,
256  Int_t rowscopetracklet1, Int_t rowscopetracklet2,
257  Int_t rowscopetrack1, Int_t rowscopetrack2,
258  Int_t phiscope1, Int_t phiscope2,
259  Int_t etascope1, Int_t etascope2); // sets all settings of tracker
260 
261  void Cuts(TString method); // set cuts by tracking procedure
262  void Cuts(Int_t method_id); // set cuts by tracking id
263  void Cuts(Double_t maxangletracklet1, Double_t maxangletracklet2, Double_t maxangletrack1, Double_t maxangletrack2,
264  Double_t maxcircletrack1, Double_t maxcircletrack2, Double_t maxlengthtrack1, Double_t maxlengthtrack2); // sets all cuts
265 
266  void SetVertexConstraint(Bool_t f) { mVertexConstraint = f; } // sets vertex constraint (on or off)
267 
268  // getter
269  Bool_t GetLaser() { return mLaser; } // returns laser flag
270 
271  Double_t GetEtaMin() { return mEtaMin; } // returns min. value of eta
272  Double_t GetEtaMax() { return mEtaMax; } // returns max. value of eta
273 
274  Int_t GetNumMainVertexTracks() { return mMainVertexTracks; } // returns number of main vertex tracks
275  Int_t GetNumMergedTracks() { return mMergedTracks; } // returns number of merged tracks
276  Int_t GetNumMergedTracklets() { return mMergedTracklets; } // returns number of merged tracklets
277  Int_t GetNumMergedSplits() { return mMergedSplits; } // returns number of merged split tracks
278  Int_t GetNumExtendedTracks() { return mExtendedTracks; } // returns number of extended tracks
279  Int_t GetNumDiffHits() { return mDiffHits; } // returns number of cases where length and circle fit are different
280  Int_t GetNumLengthFitNaN() { return mLengthFitNaN; } // retruns number of settings of argumnet of arcsin to +/-1
281  Int_t GetNumClustersUnused() { return mClustersUnused; } // returns number of unused clusters
282  Int_t GetNumBadClusters() { return mBadClusters; } // returns number of bad clusters
283 
284  Int_t GetRowSegm(StFtpcConfMapPoint *hit); // returns number of pad segment of a specific hit
285  Int_t GetPhiSegm(StFtpcConfMapPoint *hit); // returns number of phi segment of a specific hit
286  Int_t GetEtaSegm(StFtpcConfMapPoint *hit); // returns number of eta segment of a specific hit
287  Int_t GetSegm(StFtpcConfMapPoint *hit); // returns number of segment of a specific hit
288  Int_t GetRowSegm(Int_t segm); // returns number of pad segment of a specific segment
289  Int_t GetPhiSegm(Int_t segm); // returns number of phi segment of a specific segment
290  Int_t GetEtaSegm(Int_t segm); // returns number of eta segment of a specific segment
291  Int_t GetSegm(Int_t row_segm, Int_t phi_segm, Int_t eta_segm); // returns number of segment
292  Int_t GetRow(Int_t segm); // returns the row of a given row segment
293  Double_t GetPhi(Int_t segm); // returns phi of a given phi segment
294  Double_t GetEta(Int_t segm); // returns eta of a given eta segment
295 
296  Double_t const GetPhiDiff(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); //returns normalized difference of phi
297  Double_t const GetEtaDiff(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); //returns normalized difference of eta
298  Double_t const GetClusterDistance(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); // returns distance between to clusters
299  Double_t const GetDistanceFromFit(const StFtpcConfMapPoint *hit); // returns distance of cluster from fit
300 
301  // Tracking procedures
302  void ClusterLoop(); // loops over clusters
303  void CreateTrack(StFtpcConfMapPoint *hit); // create track with start at hit
304  void RemoveTrack(StFtpcTrack *track); // removes track from track array
305  void CompleteTrack(StFtpcTrack *track); // completes track
306 StFtpcConfMapPoint *GetNextNeighbor(StFtpcConfMapPoint *start_hit, Double_t *coeff, Bool_t backward); // returns next cluster to start cluster
307  void ExtendTracks(); // Loops over found tracks. Trys to extend them.
308  Bool_t TrackExtension(StFtpcTrack *track); // Trys to extend given track.
309  Bool_t const TestExpression(Int_t sub_row_segm, Int_t end_row, Bool_t backward = (Bool_t)kTRUE); // increments or decrements *sub_row_segm
310  void LoopUpdate(Int_t *sub_row_segm, Bool_t backward); // tests if loop should be continued
311  Double_t const TrackAngle(const StFtpcPoint *lasthitoftrack, const StFtpcPoint *hit, Bool_t backward); // returns angle
312  Double_t const TrackletAngle(StFtpcTrack *track, Int_t n = 0); // returns angle
313  Double_t const CalcDistance(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2, Bool_t laser); // returns distance of two hits
314  Double_t const CalcDistance(const StFtpcConfMapPoint *hit, Double_t *coeff); // returns distance between a hit and straight line
315  void StraightLineFit(StFtpcTrack *track, Double_t *a, Int_t n = 0); // calculates a straight line fit for given clusters
316  void CalcChiSquared(StFtpcTrack *track, StFtpcConfMapPoint *point, Double_t *chi2); // calculates chi squared for cirlce and length fit
317  Bool_t const VerifyCuts(const StFtpcConfMapPoint *lasttrackhithit,
318  const StFtpcConfMapPoint *newhit, Bool_t backward = (Bool_t)kTRUE); // returns true if phi and eta cut holds
319  void HandleSplitTracks(Double_t max_dist, Double_t ratio_min, Double_t ratio_max); // loops over tracks and looks for split tracks
320  void HandleSplitTracks(); // HandleSplitTracks() with default values
321  void MergeSplitTracks(StFtpcTrack *t1, StFtpcTrack *t2); // merges two tracks
322  void AdjustTrackNumbers(Int_t first_split = 0); // renews tracknumbers
323 
324  // Start tracking
325  void MainVertexTracking(); // tracking of main vertex tracks (vertex constraint on)
326  void FreeTracking(); // tracking without vertex constraint
327  void NonVertexTracking(); // same as FreeTracking()
328  void TwoCycleTracking(); // tracking: 1st cylce: with vertex constraint, 2nd cycle: without vertex constraint
329  void LaserTracking(); // tracks straight tracks (settings optimized for laser data)
330  void NoFieldTracking(); // tracks straight tracks originating from main vertex
331 
332  // Information
333  void SettingInfo(); // displays settings
334  void CutInfo(); // displays cuts
335  void TrackingInfo(); // displays information about the tracking process (e.g. difficulties during the tracking)
336 
337  ClassDef(StFtpcConfMapper, 1) // Ftpc conformal mapper class
338 };
339 
340 
341 #endif