00001 // $Id: StFtpcConfMapper.hh,v 1.22 2010/06/02 12:12:01 jcs Exp $ 00002 // $Log: StFtpcConfMapper.hh,v $ 00003 // Revision 1.22 2010/06/02 12:12:01 jcs 00004 // undo correction for Bug#1939 since it was incorrect 00005 // 00006 // Revision 1.21 2010/05/19 14:55:29 jcs 00007 // Correction for Bug #1939 - variables with the same name were defined twice; 00008 // once in StFtpcTrackingParams.hh and again in StFtpcConfMapper.hh 00009 // The names of the StFtpcConfMapper variables have been changed to make them unique 00010 // 00011 // Revision 1.20 2007/01/15 08:23:01 jcs 00012 // replace printf, cout and gMesMgr with Logger commands 00013 // 00014 // Revision 1.19 2004/02/12 19:37:10 oldi 00015 // *** empty log message *** 00016 // 00017 // Revision 1.18 2003/09/16 15:27:01 jcs 00018 // removed inline as it would leave a few undefined reference 00019 // 00020 // Revision 1.17 2003/01/20 13:16:23 oldi 00021 // Additional volume segment added as garbage container. Hits which give a 00022 // segment index which is out of range (esp. those ones sitting exactly on the 00023 // beam line) are put in here. 00024 // Handling of function GetSegm() simplified. 00025 // 00026 // Revision 1.16 2002/11/06 13:44:53 oldi 00027 // Vertex handling simplifed. 00028 // Flag for clusters not to be used for tracking introduced. 00029 // Code clean ups. 00030 // 00031 // Revision 1.15 2002/10/11 15:45:03 oldi 00032 // Get FTPC geometry and dimensions from database. 00033 // No field fit activated: Returns momentum = 0 but fits a helix. 00034 // Bug in TrackMaker fixed (events with z_vertex > outer_ftpc_radius were cut). 00035 // QA histograms corrected (0 was supressed). 00036 // Code cleanup (several lines of code changed due to *params -> Instance()). 00037 // cout -> gMessMgr. 00038 // 00039 // Revision 1.14 2002/09/04 13:44:22 oldi 00040 // Typos fixed. 00041 // 00042 // Revision 1.13 2002/04/29 15:49:50 oldi 00043 // All tracking parameters moved to StFtpcTrackingParameters.cc/hh. 00044 // In a future version the actual values should be moved to an .idl file (the 00045 // interface should be kept as is in StFtpcTrackingParameters.cc/hh). 00046 // 00047 // Revision 1.12 2002/04/05 16:50:11 oldi 00048 // Cleanup of MomentumFit (StFtpcMomentumFit is now part of StFtpcTrack). 00049 // Each Track inherits from StHelix, now. 00050 // Therefore it is possible to calculate, now: 00051 // - residuals 00052 // - vertex estimations obtained by back extrapolations of FTPC tracks 00053 // Chi2 was fixed. 00054 // Many additional minor (and major) changes. 00055 // 00056 // Revision 1.11 2002/03/15 10:04:41 oldi 00057 // Adjust eta segments not only to z-position of vertex but to x,y as well. 00058 // Avoid tracking if vertex position is outside of the inner radius of the Ftpc. 00059 // 00060 // Revision 1.10 2001/11/21 12:31:15 jcs 00061 // adjust mEtaMax for extended drift maps 00062 // 00063 // Revision 1.9 2001/07/12 08:29:09 oldi 00064 // New constructor introduced to be able to use only cluster which were 00065 // found to be good in a previous run. 00066 // New function NoFieldTracking() introduced. 00067 // Tracking parameters for LaserTracking() changed. 00068 // 00069 // Revision 1.8 2001/01/25 15:21:45 oldi 00070 // Review of the complete code. 00071 // Fix of several bugs which caused memory leaks: 00072 // - Tracks were not allocated properly. 00073 // - Tracks (especially split tracks) were not deleted properly. 00074 // - TClonesArray seems to have a problem (it could be that I used it in a 00075 // wrong way). I changed all occurences to TObjArray which makes the 00076 // program slightly slower but much more save (in terms of memory usage). 00077 // Speed up of HandleSplitTracks() which is now 12.5 times faster than before. 00078 // Cleanup. 00079 // 00080 // Revision 1.7 2000/11/10 18:37:02 oldi 00081 // New functions introduced to be able to extend tracks after main vertex tracking. 00082 // This implied many changes in other parts of the class (loop over clusters can run backwards now). 00083 // TBenchmark object ('mBench') moved to StFtpcTracker. 00084 // Cleanup. 00085 // 00086 // Revision 1.6 2000/08/02 10:10:44 oldi 00087 // Changes in function GetSegm() to avoid pointing out of the ObjArry. 00088 // If GetSegm() tries to use a segment out of bounds a warning will be print 00089 // and the last segment will be returned. 00090 // New functions added to be able to calculate the coordinates of a given 00091 // volume segment (used in the warning message above). 00092 // 00093 // Revision 1.5 2000/07/18 21:22:15 oldi 00094 // Changes due to be able to find laser tracks. 00095 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint 00096 // to bundle often called functions 00097 // - short functions inlined 00098 // - formulas of StFormulary made static 00099 // - avoid streaming of objects of unknown size 00100 // (removes the bunch of CINT warnings during compile time) 00101 // - two or three minor bugs cured 00102 // 00103 // Revision 1.4 2000/06/13 14:33:10 oldi 00104 // Added three new funtions (SetEtaMin(), SetEtaMax(), CalcEtaMinMax()) and 00105 // two data members (mEtaMin, mEtaMax) to be able to calculate the 00106 // min./max. possible value of the pseudorapidity eta with the z-position of 00107 // the found main vertex. This solves bug #574 where the min./max. values of eta 00108 // were fixed and could be to small if the found main vertex was to far off from 00109 // z=0. 00110 // 00111 // Revision 1.3 2000/06/07 11:03:53 oldi 00112 // Added CreateTrack(StFtpcConfMapPoint *hit) to cleanup ClusterLoop(). 00113 // Added TrackLoop(). 00114 // Added ExtendTrack(StFtpcTrack *track). 00115 // Added CalcChiSquared(StFtpcTrack *track, StFtpcConfMapPoint *point, 00116 // Double_t *chi2). 00117 // Added MergeSplitTracks(StFtpcTrack *t1, StFtpcTrack *t2). 00118 // 00119 // Revision 1.2 2000/05/11 15:14:42 oldi 00120 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent 00121 // 00122 // Revision 1.1 2000/05/10 13:39:11 oldi 00123 // Initial version of StFtpcTrackMaker 00124 // 00125 00127 // // 00128 // StFtpcConfMapper class - tracking algorithm with conformal mapping // 00129 // // 00131 00132 #ifndef STAR_StFtpcConfMapper 00133 #define STAR_StFtpcConfMapper 00134 00135 #include "StFtpcTrackingParams.hh" 00136 #include "StFtpcTracker.hh" 00137 #include "StFtpcConfMapPoint.hh" 00138 #include "StFtpcTrack.hh" 00139 #include "StMessMgr.h" 00140 00141 #include "TObjArray.h" 00142 #include "TBenchmark.h" 00143 00144 class StFtpcConfMapper : public StFtpcTracker { 00145 00146 private: 00147 00148 Bool_t mLaser; // indicator to know if this is a laser event 00149 00150 // Volume segemnts 00151 TObjArray *mVolume; // array of volume (pad, phi, eta) elements 00152 00153 // Number of cells (segments) 00154 Int_t mNumRowSegment; // this is (and has to be at most) the number of padrows 00155 Int_t mNumPhiSegment; // number of phi segments 00156 Int_t mNumEtaSegment; // number of eta segments 00157 Int_t mBounds; // array size 00158 Int_t mMaxFtpcRow; // number of rows in one Ftpc 00159 Char_t mFtpc; // current Ftpc number (either 1 ore 2) 00160 00161 // max. eta (pseudorapidity) values 00162 Double_t mEtaMin; 00163 Double_t mEtaMax; 00164 00165 // Settings ([0]: non vertex tracks, [1]: main vertex tracks) 00166 Bool_t mVertexConstraint; // vertex constraint (true or false) 00167 Int_t mTrackletLength[2]; // minimal length of tracks (up to here different search algorithm) 00168 Int_t mRowScopeTracklet[2]; // number of row segments to look for the next point of a tracklet 00169 Int_t mRowScopeTrack[2]; // number of row segments to look for the next point of a track 00170 Int_t mPhiScope[2]; // number of phi segments to look for the next point 00171 Int_t mEtaScope[2]; // number of eta segments to look for the next point 00172 Int_t mMinPoints[2]; // minimum number of points on one track 00173 00174 // Cuts 00175 Double_t mMaxAngleTracklet[2]; // limit of angle between to pieces of a tracklet 00176 Double_t mMaxAngleTrack[2]; // limit of angle between to pieces of a track 00177 Double_t mMaxCircleDist[2]; // limit of distance of a new cluster to the circle fit of a track 00178 Double_t mMaxLengthDist[2]; // limit of distance of a new cluster to the length fit of a track 00179 00180 // Tracking informtion 00181 Int_t mMainVertexTracks; // number of tracks coming from the main vertex 00182 Int_t mMergedTracks; // cluster on a track missing, but tracker was able to merge the pieces 00183 Int_t mMergedTracklets; // cluster on a tracklet missing, but tracker was able to merge the pieces 00184 Int_t mMergedSplits; // number of merged split tracks 00185 Int_t mExtendedTracks; // number of extended tracks 00186 Int_t mDiffHits; // circle fit and length fit returned differnet hits 00187 Int_t mDiffHitsStill; // different hits from fits could not be resolved 00188 Int_t mLengthFitNaN; // argument of arcsin was higher than +1 (lower than -1) 00189 Int_t mClustersUnused; // number of unused clusters 00190 Int_t mBadClusters; // number of clusters noy to be used for tracking ('bad' flag set) 00191 00192 // setter 00193 void SetEtaMin(Double_t f) { mEtaMin = f; } // sets min. value for eta 00194 void SetEtaMax(Double_t f) { mEtaMax = f; } // sets max. value for eta 00195 void CalcEtaMinMax(); // calculates the min. and max. value for eta 00196 00197 void SetTrackletLength(Int_t f) { mTrackletLength[0] = mTrackletLength[1] = f; } // sets tracklet lengths (both the same) 00198 void SetRowScopeTrack(Int_t f) { mRowScopeTrack[0] = mRowScopeTrack[1] = f; } // sets row scopes (both the same) 00199 void SetRowScopeTracklet(Int_t f) { mRowScopeTracklet[0] = mRowScopeTracklet[1] = f; } // sets row scopes (both the same)= 00200 void SetPhiScope(Int_t f) { mPhiScope[0] = mPhiScope[1] = f; } // sets phi scopes (both the same) 00201 void SetEtaScope(Int_t f) { mEtaScope[0] = mEtaScope[1] = f; } // sets eta scopes (both the same) 00202 void SetMinPoints(Int_t f) { mMinPoints[0] = mMinPoints[1] = f; } // sets minimum number of points (both the same) 00203 void SetMaxAngleTrack(Double_t f) { mMaxAngleTrack[0] = mMaxAngleTrack[1] = f; } // sets angle cuts (both the same) 00204 void SetMaxAngleTracklet(Double_t f) { mMaxAngleTracklet[0] = mMaxAngleTracklet[1] = f; } // sets angle cuts (both the same) 00205 void SetMaxCircleDistTrack(Double_t f) { mMaxCircleDist[0] = mMaxCircleDist[1] = f; } // sets circle cuts (both the same) 00206 void SetMaxLengthDistTrack(Double_t f) { mMaxLengthDist[0] = mMaxLengthDist[1] = f; } // sets length cuts (both the same) 00207 00208 void SetTrackletLength(Int_t f, Int_t g) { mTrackletLength[1] = f; mTrackletLength[0] = g; } // sets tracklet lengths (both but different) 00209 void SetRowScopeTrack(Int_t f, Int_t g) { mRowScopeTrack[1] = f; mRowScopeTrack[0] = g; } // sets row scopes for tracks(both but different) 00210 void SetRowScopeTracklet(Int_t f, Int_t g) { mRowScopeTracklet[1] = f; mRowScopeTracklet[0] = g; } // sets row scopes for tracklets(both but different) 00211 void SetPhiScope(Int_t f, Int_t g) { mPhiScope[1] = f; mPhiScope[0] = g; } // sets phi scopes (both but different) 00212 void SetEtaScope(Int_t f, Int_t g) { mEtaScope[1] = f; mEtaScope[0] = g; } // sets eta scopes (both but different) 00213 void SetMinPoints(Int_t f, Int_t g) { mMinPoints[1] = f; mMinPoints[0] = g; } // sets minimum number of points (both but different) 00214 void SetMaxAngleTrack(Double_t f, Double_t g) { mMaxAngleTrack[1] = f; mMaxAngleTrack[0] = g; } // sets angle cuts (both but different) 00215 void SetMaxAngleTracklet(Double_t f, Double_t g) { mMaxAngleTracklet[1] = f; mMaxAngleTracklet[0] = g; } // sets angle cuts (both but different) 00216 void SetMaxCircleDistTrack(Double_t f, Double_t g) { mMaxCircleDist[1] = f; mMaxCircleDist[0] = g; } // sets circle cuts (both but different) 00217 void SetMaxLengthDistTrack(Double_t f, Double_t g) { mMaxLengthDist[1] = f; mMaxLengthDist[0] = g; } // sets length cuts (both but different) 00218 00219 void SetTrackletLength(Int_t f, Bool_t vertex_constraint) { mTrackletLength[(Int_t)vertex_constraint] = f; } // sets one tracklet length 00220 void SetRowScopeTrack(Int_t f, Bool_t vertex_constraint) { mRowScopeTrack[(Int_t)vertex_constraint] = f; } // sets one row scope for tracks 00221 void SetRowScopeTracklet(Int_t f, Bool_t vertex_constraint) { mRowScopeTracklet[(Int_t)vertex_constraint] = f; } // sets one row scope for tracklets 00222 void SetPhiScope(Int_t f, Bool_t vertex_constraint) { mPhiScope[(Int_t)vertex_constraint] = f; } // sets one phi scope 00223 void SetEtaScope(Int_t f, Bool_t vertex_constraint) { mEtaScope[(Int_t)vertex_constraint] = f; } // sets one eta scope 00224 void SetMinPoints(Int_t f, Bool_t vertex_constraint) { mMinPoints[(Int_t)vertex_constraint] = f; } // sets one minimum number of points 00225 void SetMaxAngleTrack(Double_t f, Bool_t vertex_constraint) { mMaxAngleTrack[(Int_t)vertex_constraint] = f; } // sets one angle cut 00226 void SetMaxAngleTracklet(Double_t f, Bool_t vertex_constraint) { mMaxAngleTracklet[(Int_t)vertex_constraint] = f; } // sets one angle cut 00227 void SetMaxCircleDistTrack(Double_t f, Bool_t vertex_constraint) { mMaxCircleDist[(Int_t)vertex_constraint] = f; } // sets one circle cut 00228 void SetMaxLengthDistTrack(Double_t f, Bool_t vertex_constraint) { mMaxLengthDist[(Int_t)vertex_constraint] = f; } // sets one length cut 00229 00230 00231 public: 00232 StFtpcConfMapper(); // default constructor 00233 StFtpcConfMapper(TObjArray *inputHits, 00234 MIntArray *good_hits, 00235 StFtpcVertex *vertex = 0, 00236 Bool_t bench = (Bool_t)kFALSE, 00237 Int_t phi_segments = 100, 00238 Int_t eta_segments = 200); // constructor to fill evaluated hits 00239 StFtpcConfMapper(TObjArray *hits, 00240 StFtpcVertex *vertex = 0, 00241 Bool_t bench = (Bool_t)kFALSE, 00242 Int_t phi_segments = 100, 00243 Int_t eta_segments = 200); // constructor which takes an CLonesArray of hits 00244 virtual ~StFtpcConfMapper(); // destructor 00245 00246 // setter 00247 void SetLaser(Bool_t f) { mLaser = f; } // set laser flag 00248 00249 void Settings(TString method); // set settings by tracking procedure 00250 void Settings(Int_t method_id); // set settings by tracking id 00251 void Settings(Int_t trackletlength1, Int_t trackletlength2, 00252 Int_t tracklength1, Int_t tracklength2, 00253 Int_t rowscopetracklet1, Int_t rowscopetracklet2, 00254 Int_t rowscopetrack1, Int_t rowscopetrack2, 00255 Int_t phiscope1, Int_t phiscope2, 00256 Int_t etascope1, Int_t etascope2); // sets all settings of tracker 00257 00258 void Cuts(TString method); // set cuts by tracking procedure 00259 void Cuts(Int_t method_id); // set cuts by tracking id 00260 void Cuts(Double_t maxangletracklet1, Double_t maxangletracklet2, Double_t maxangletrack1, Double_t maxangletrack2, 00261 Double_t maxcircletrack1, Double_t maxcircletrack2, Double_t maxlengthtrack1, Double_t maxlengthtrack2); // sets all cuts 00262 00263 void SetVertexConstraint(Bool_t f) { mVertexConstraint = f; } // sets vertex constraint (on or off) 00264 00265 // getter 00266 Bool_t GetLaser() { return mLaser; } // returns laser flag 00267 00268 Double_t GetEtaMin() { return mEtaMin; } // returns min. value of eta 00269 Double_t GetEtaMax() { return mEtaMax; } // returns max. value of eta 00270 00271 Int_t GetNumMainVertexTracks() { return mMainVertexTracks; } // returns number of main vertex tracks 00272 Int_t GetNumMergedTracks() { return mMergedTracks; } // returns number of merged tracks 00273 Int_t GetNumMergedTracklets() { return mMergedTracklets; } // returns number of merged tracklets 00274 Int_t GetNumMergedSplits() { return mMergedSplits; } // returns number of merged split tracks 00275 Int_t GetNumExtendedTracks() { return mExtendedTracks; } // returns number of extended tracks 00276 Int_t GetNumDiffHits() { return mDiffHits; } // returns number of cases where length and circle fit are different 00277 Int_t GetNumLengthFitNaN() { return mLengthFitNaN; } // retruns number of settings of argumnet of arcsin to +/-1 00278 Int_t GetNumClustersUnused() { return mClustersUnused; } // returns number of unused clusters 00279 Int_t GetNumBadClusters() { return mBadClusters; } // returns number of bad clusters 00280 00281 Int_t GetRowSegm(StFtpcConfMapPoint *hit); // returns number of pad segment of a specific hit 00282 Int_t GetPhiSegm(StFtpcConfMapPoint *hit); // returns number of phi segment of a specific hit 00283 Int_t GetEtaSegm(StFtpcConfMapPoint *hit); // returns number of eta segment of a specific hit 00284 Int_t GetSegm(StFtpcConfMapPoint *hit); // returns number of segment of a specific hit 00285 Int_t GetRowSegm(Int_t segm); // returns number of pad segment of a specific segment 00286 Int_t GetPhiSegm(Int_t segm); // returns number of phi segment of a specific segment 00287 Int_t GetEtaSegm(Int_t segm); // returns number of eta segment of a specific segment 00288 Int_t GetSegm(Int_t row_segm, Int_t phi_segm, Int_t eta_segm); // returns number of segment 00289 Int_t GetRow(Int_t segm); // returns the row of a given row segment 00290 Double_t GetPhi(Int_t segm); // returns phi of a given phi segment 00291 Double_t GetEta(Int_t segm); // returns eta of a given eta segment 00292 00293 Double_t const GetPhiDiff(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); //returns normalized difference of phi 00294 Double_t const GetEtaDiff(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); //returns normalized difference of eta 00295 Double_t const GetClusterDistance(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2); // returns distance between to clusters 00296 Double_t const GetDistanceFromFit(const StFtpcConfMapPoint *hit); // returns distance of cluster from fit 00297 00298 Double_t const GetSetupTime(); 00299 Double_t const GetMainVertexTrackingTime(); 00300 Double_t const GetFreeTrackingTime(); 00301 Double_t const GetLaserTrackingTime(); 00302 00303 // Tracking procedures 00304 void ClusterLoop(); // loops over clusters 00305 void CreateTrack(StFtpcConfMapPoint *hit); // create track with start at hit 00306 void RemoveTrack(StFtpcTrack *track); // removes track from track array 00307 void CompleteTrack(StFtpcTrack *track); // completes track 00308 StFtpcConfMapPoint *GetNextNeighbor(StFtpcConfMapPoint *start_hit, Double_t *coeff, Bool_t backward); // returns next cluster to start cluster 00309 void ExtendTracks(); // Loops over found tracks. Trys to extend them. 00310 Bool_t TrackExtension(StFtpcTrack *track); // Trys to extend given track. 00311 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 00312 void LoopUpdate(Int_t *sub_row_segm, Bool_t backward); // tests if loop should be continued 00313 Double_t const TrackAngle(const StFtpcPoint *lasthitoftrack, const StFtpcPoint *hit, Bool_t backward); // returns angle 00314 Double_t const TrackletAngle(StFtpcTrack *track, Int_t n = 0); // returns angle 00315 Double_t const CalcDistance(const StFtpcConfMapPoint *hit1, const StFtpcConfMapPoint *hit2, Bool_t laser); // returns distance of two hits 00316 Double_t const CalcDistance(const StFtpcConfMapPoint *hit, Double_t *coeff); // returns distance between a hit and straight line 00317 void StraightLineFit(StFtpcTrack *track, Double_t *a, Int_t n = 0); // calculates a straight line fit for given clusters 00318 void CalcChiSquared(StFtpcTrack *track, StFtpcConfMapPoint *point, Double_t *chi2); // calculates chi squared for cirlce and length fit 00319 Bool_t const VerifyCuts(const StFtpcConfMapPoint *lasttrackhithit, 00320 const StFtpcConfMapPoint *newhit, Bool_t backward = (Bool_t)kTRUE); // returns true if phi and eta cut holds 00321 void HandleSplitTracks(Double_t max_dist, Double_t ratio_min, Double_t ratio_max); // loops over tracks and looks for split tracks 00322 void HandleSplitTracks(); // HandleSplitTracks() with default values 00323 void MergeSplitTracks(StFtpcTrack *t1, StFtpcTrack *t2); // merges two tracks 00324 void AdjustTrackNumbers(Int_t first_split = 0); // renews tracknumbers 00325 00326 // Start tracking 00327 void MainVertexTracking(); // tracking of main vertex tracks (vertex constraint on) 00328 void FreeTracking(); // tracking without vertex constraint 00329 void NonVertexTracking(); // same as FreeTracking() 00330 void TwoCycleTracking(); // tracking: 1st cylce: with vertex constraint, 2nd cycle: without vertex constraint 00331 void LaserTracking(); // tracks straight tracks (settings optimized for laser data) 00332 void NoFieldTracking(); // tracks straight tracks originating from main vertex 00333 00334 // Information 00335 void SettingInfo(); // displays settings 00336 void CutInfo(); // displays cuts 00337 void TrackingInfo(); // displays information about the tracking process (e.g. difficulties during the tracking) 00338 00339 ClassDef(StFtpcConfMapper, 1) // Ftpc conformal mapper class 00340 }; 00341 00342 00343 #endif
1.5.9