00001 // $Id: StFtpcTrackEvaluator.hh,v 1.12 2004/02/12 19:37:11 oldi Exp $ 00002 // $Log: StFtpcTrackEvaluator.hh,v $ 00003 // Revision 1.12 2004/02/12 19:37:11 oldi 00004 // *** empty log message *** 00005 // 00006 // Revision 1.11 2003/09/16 15:27:02 jcs 00007 // removed inline as it would leave a few undefined reference 00008 // 00009 // Revision 1.10 2003/01/16 18:04:34 oldi 00010 // Bugs eliminated. Now it compiles on Solaris again. 00011 // Split residuals for global and primary fit. 00012 // 00013 // Revision 1.9 2002/11/06 13:46:29 oldi 00014 // Code clean ups. 00015 // 00016 // Revision 1.8 2002/10/11 15:45:26 oldi 00017 // Get FTPC geometry and dimensions from database. 00018 // No field fit activated: Returns momentum = 0 but fits a helix. 00019 // Bug in TrackMaker fixed (events with z_vertex > outer_ftpc_radius were cut). 00020 // QA histograms corrected (0 was supressed). 00021 // Code cleanup (several lines of code changed due to *params -> Instance()). 00022 // cout -> gMessMgr. 00023 // 00024 // Revision 1.7 2001/07/12 08:34:31 oldi 00025 // Many new things were developed eg. histograms for time consumption and 00026 // momentum resolution. 00027 // File handling was debugged. 00028 // New constructor to evaluate tracks of good evaluated clusters of a 00029 // previous run. 00030 // 00031 // Revision 1.6 2001/01/25 15:22:19 oldi 00032 // Review of the complete code. 00033 // Fix of several bugs which caused memory leaks: 00034 // - Tracks were not allocated properly. 00035 // - Tracks (especially split tracks) were not deleted properly. 00036 // - TClonesArray seems to have a problem (it could be that I used it in a 00037 // wrong way). I changed all occurences to TObjArray which makes the 00038 // program slightly slower but much more save (in terms of memory usage). 00039 // Speed up of HandleSplitTracks() which is now 12.5 times faster than before. 00040 // Cleanup. 00041 // 00042 // Revision 1.5 2000/11/29 08:37:46 jcs 00043 // remove obsolete include statement 00044 // 00045 // Revision 1.4 2000/11/10 18:38:24 oldi 00046 // Short tracks are treated now. 00047 // 00048 // Revision 1.3 2000/07/18 21:22:17 oldi 00049 // Changes due to be able to find laser tracks. 00050 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint 00051 // to bundle often called functions 00052 // - short functions inlined 00053 // - formulas of StFormulary made static 00054 // - avoid streaming of objects of unknown size 00055 // (removes the bunch of CINT warnings during compile time) 00056 // - two or three minor bugs cured 00057 // 00058 // Revision 1.2 2000/06/07 11:58:57 oldi 00059 // Added new histos and Int_t's to count things. :) 00060 // Cleanup. 00061 // 00062 // Revision 1.1 2000/05/10 13:39:27 oldi 00063 // Initial version of StFtpcTrackMaker 00064 // 00065 00067 // // 00068 // StFtpcTrackEvaluator class - evaluates found tracks by comparison to the input // 00069 // GEANT clusters and tracks. // 00070 // // 00072 00073 #ifndef STAR_StFtpcTrackEvaluator 00074 #define STAR_StFtpcTrackEvaluator 00075 00076 #include "TObject.h" 00077 #include "TObjArray.h" 00078 #include "TH1.h" 00079 #include "TH2.h" 00080 #include "TH3.h" 00081 #include "TProfile2D.h" 00082 #include "MIntArray.h" 00083 #include "TFile.h" 00084 00085 #include "StFtpcVertex.hh" 00086 #include "StFtpcTrack.hh" 00087 #include "StFtpcTracker.hh" 00088 #include "StFtpcDisplay.hh" 00089 00090 #include "tables/St_ffs_gepoint_Table.h" 00091 #include "tables/St_g2t_track_Table.h" 00092 #include "tables/St_g2t_ftp_hit_Table.h" 00093 00094 #include "St_DataSet.h" 00095 00096 class StFtpcTrackEvaluator : public TObject { 00097 00098 private: 00099 Bool_t mObjArraysCreated; // flag to know which destructor to be called 00100 00101 TObjArray *mGeantHits; // ObjArray of geant hits 00102 TObjArray *mFastSimHits; // ObjArray of fast simulated hits 00103 TObjArray *mFoundHits; // ObjArray of found hits 00104 TObjArray *mGeantTracks; // ObjArray of geant tracks 00105 TObjArray *mFoundTracks; // ObjArray of found tracks 00106 00107 MIntArray *mFtpcTrackNum; // array of numbers of found Ftpc tracks, [geant track] 00108 00109 Int_t mFoundVertexTracks; // number of found main vertex tracks 00110 Int_t mFoundNonVertexTracks; // number of found non main vertex tracks 00111 00112 Int_t mGoodGeantPoints; // number of points on good geant tracks 00113 Int_t mGoodFoundPoints; // number of points on good found tracks 00114 00115 Int_t mLookLikeGoodTracks; // number of tracks which look like good tracks but aren't 00116 Int_t mElectronTracks; // number of electrons 00117 Int_t mNonVertexTracks; // number of non main vertex tracks 00118 Int_t mGoodGTracks; // number of good geant tracks (all tracks - - short tracks - electrons - non vertex tracks) 00119 Int_t mGoodFTracks; // number of good found tracks (all tracks - - short tracks - electrons - non vertex tracks) 00120 Int_t mSplitTracks; // number of split tracks 00121 Int_t mSplitGoodTracks; // number of split good tracks 00122 Int_t mSplitLoliGoodTracks; // number of split look-like good tracks 00123 Int_t mUncleanTracks; // number of tracks which have picked up wrong clusters 00124 Int_t mUncleanGoodTracks; // number of tracks which have picked up wrong clusters and have a good parent track 00125 Int_t mLongTracks; // number of tracks with more than 10 points 00126 Int_t mLongTrackClusters; // number of clusters on long tracks 00127 Int_t mShortTracks; // number of tracks with less than 5 points 00128 Int_t mShortTrackClusters; // number of clusters on short tracks 00129 Int_t mTooShortTracks; // number of tracks which should be longer 00130 Int_t mMaxClusters; // Max. number of clusters on a track 00131 00132 StFtpcVertex *mVertex; // pointer ro the main vertex 00133 00134 TH1F *mNumGeantHits; // number of geant hits per event 00135 TH1F *mNumFoundHits; // number of found hits per event 00136 TH1F *mNumGeantTracks; // number of geant tracks per event 00137 TH1F *mNumFoundTracks; // number of found tracks per event 00138 00139 TH1F *mNumFoundVertexTracks; // number of found main vertex tracks per event 00140 TH1F *mNumFoundNonVertexTracks; // number of found non main vertex tracks per event 00141 00142 TH1F *mNumElectronTracks; // number of electrons per event 00143 TH1F *mNumNonVertexTracks; // number of non main vertex tracks per event 00144 TH1F *mNumLookLikeGoodTracks; // number of tracks which look good but aren't 00145 TH1F *mNumGoodGTracks; // number of good geant tracks per event 00146 TH1F *mNumGoodFTracks; // number of good found tracks per event 00147 TH1F *mNumSplitTracks; // number of split tracks per event 00148 TH1F *mNumSplitGoodTracks; // number of split good tracks per event 00149 TH1F *mNumSplitLoliGoodTracks; // number of split good tracks per event 00150 00151 TH1F *mNumUncleanTracks; // number of unclean tracks per event 00152 TH1F *mNumUncleanGoodTracks; // number of unclean tracks which have a good parent track per event 00153 TH1F *mNumLongTracks; // number of tracks with more than 10 points per event 00154 TH1F *mNumLongTrackClusters; // number of hits belonging to long tracks per event 00155 TH1F *mNumShortTracks; // number of tracks with less than 5 points per event 00156 TH1F *mNumShortTrackClusters; // number of hits belonging to short tracks per event 00157 TH1F *mNumTooShortTracks; // number of tracks which should be longer 00158 00159 TH1F *mGHitsOnTrack; // number of geant hits per track 00160 TH1F *mFHitsOnTrack; // number of found hits per track 00161 00162 TH1F *mNumParents; // number of parent tracks per track 00163 TH1F *mNumWrongHitsAll; // number of wrong clusters per track 00164 TH2F *mNumWrongHits; // number of wrong clusters per track 00165 00166 TH1F *mGoodRatio; // number of good found tracks divided by the number of good geant tracks 00167 TH1F *mContamination; // number of found tracks looking good divided by the number of found main vertex tracks 00168 TH1F *mContaWoSplit; // number of found tracks looking good minus split tracks divided by the number of found main vertex tracks 00169 00170 TH1F *mNumGoodGeantPoints; // number of points on good geant tracks 00171 TH1F *mNumGoodFoundPoints; // number of points on good found tracks 00172 TH1F *mGoodPointRatio; // ration of points on good geant tracks to points on good found tracks 00173 00174 TH2F *mPtot; // found total momentum vs. geant total momentum 00175 TH2F *mPt; // found transverse momentum vs. geant transverse momentum 00176 TH2F *mPx; // found x momentum vs. geant x momentum 00177 TH2F *mPy; // found y momentum vs. geant y momentum 00178 TH2F *mPz; // found z momentum vs. geant z momentum 00179 00180 TH1F *mPtotDiff; // relative difference of total momentum 00181 TH1F *mPtDiff; // relative difference of transverse momentum 00182 TH1F *mPxDiff; // relative difference of momentum in x direction 00183 TH1F *mPyDiff; // relative difference of momentum in y direction 00184 TH1F *mPzDiff; // relative difference of momentum in z direction 00185 00186 TH1F *mPtotAcc; // relative accuracy of total momentum 00187 TH1F *mPtAcc; // relative accuracy of transverse momentum 00188 TH1F *mPxAcc; // relative accuracy of momentum in x direction 00189 TH1F *mPyAcc; // relative accuracy of momentum in y direction 00190 TH1F *mPzAcc; // relative accuracy of momentum in z direction 00191 00192 TH3F *mPRelErr; // relative error of momentum in pt/eta bins 00193 TH3F *mPRelErrqok; // relative error of momentum in pt/eta bins where the charge sign was measured alright 00194 TH3F *mPRelDiff; // relative difference of momentum in pt/eta bins 00195 00196 TH2F *mEtaNghits; // pseudorapidity vs. number of geant clusters on track 00197 TH2F *mEtaNfhits; // pseudorapidity vs. number of found clusters on track 00198 00199 TH2F *mPtEtaF; // transverse momentum vs. pseudorapidity of found tracks 00200 TH2F *mPtEtaFMes; // measured transverse momentum vs. pseudorapidity of found tracks 00201 TH2F *mPtEtaGood; // transverse momentum vs. pseudorapidity of good found tracks divided by all found tracks 00202 TH2F *mPtEtaBad; // transverse momentum vs. pseudorapidity of bad found tracks divided by all found tracks 00203 TH2F *mPtEtaUnclean; // transverse momentum vs. pseudorapidity of unclean (found) tracks 00204 TH2F *mPtEtaMesUnclean; // measured transverse momentum vs. measured pseudorapidity of unclean (found) tracks 00205 TH2F *mPtEtaUncleanGood; // transverse momentum vs. pseudorapidity of unclean good (found) tracks 00206 TH2F *mPtEtaMesUncleanGood; // measured transverse momentum vs. measured pseudorapidity of unclean good (found) tracks 00207 TH2F *mPtEtaSplit; // ransverse momentum vs. pseudorapidity of split tracks 00208 TH2F *mPtEtaSplitGood; // ransverse momentum vs. pseudorapidity of split good tracks 00209 TH2F *mPtEtaSplitLoliGood; // ransverse momentum vs. pseudorapidity of split look-like good tracks 00210 00211 TH2F *mPtEtaGoodG; // transverse momentum vs. pseudorapidity of good geant tracks 00212 TH2F *mPtEtaGoodF; // transverse momentum vs. pseudorapidity of good found tracks 00213 TH2F *mPtEtaGoodRatio; // transverse momentum vs. pseudorapidity of good found tracks divided by good geant tracks 00214 TH2F *mPtEtaBadG; // transverse momentum vs. pseudorapidity of bad geant tracks 00215 TH2F *mPtEtaBadF; // transverse momentum vs. pseudorapidity of bad found tracks 00216 TH2F *mPtEtaBadRatio; // transverse momentum vs. pseudorapidity of bad found tracks divided by bad geant tracks 00217 00218 TH2F *mPtEtaFVtx; // transverse momentum vs. pseudorapidity of found tracks with main vertex tag 00219 TH2F *mPtEtaLookLikeGood; // transverse momentum vs. pseudorapidity of found tracks which look like good tracks but aren't 00220 TH2F *mPtEtaContamination; // transverse momentum vs. pseudorapidity of found tracks which look like good tracks but aren't divided by found tracks with main vertex tag 00221 TH2F *mPtEtaContaWoSplits; // transverse momentum vs. pseudorapidity of found tracks which look like good tracks but aren't minus double counted splits divided by found tracks with main vertex tag 00222 00223 TH2F *mPtEta10PointTracks; // transverse momentum vs. pseudorapidity of 10 point Geant tracks 00224 TH2F *mPtEtaWrongCharge; // transverse momentum vs. pseudorapidity of tracks with wrong charge assigned 00225 TH2F *mPtEtaWrongPosCharge; // transverse momentum vs. pseudorapidity of tracks with wrong positive charge assigned 00226 00227 TH2F *mGLengthDistTrackAng; // length distance vs. track angle of geant tracks 00228 TH2F *mGCircleDistTrackAng; // circle distance vs. track angle of geant tracks 00229 TH2F *mFLengthDistTrackAng; // length distance vs. track angle of found tracks 00230 TH2F *mFCircleDistTrackAng; // circle distance vs. track angle of found tracks 00231 00232 TH1F *mGTracklAngAll; // tracklet angle of geant tracks 00233 TH1F *mGTrackAngAll; // track angle of geant tracks 00234 TH1F *mGCircleDistAll; // circle distance of geant tracks 00235 TH1F *mGLengthDistAll; // length distance of geant tracks 00236 00237 TH2F *mGTrackAng; // track angle of geant tracks 00238 TH2F *mGCircleDist; // circle distance of geant tracks 00239 TH2F *mGLengthDist; // length distance of geant tracks 00240 00241 TH2F *mGCircleLength; // circle distance vs. length distance of geant tracks 00242 00243 TH1F *mFTracklAngAll; // tracklet angle of found tracks 00244 TH1F *mFTrackAngAll; // track angle of found tracks 00245 TH1F *mFCircleDistAll; // circle distance of found tracks 00246 TH1F *mFLengthDistAll; // length distance of found tracks 00247 00248 TH1F *mDcaFMainVertex; // distance of closest approach for found main vertex tracks 00249 TH1F *mDcaFNonVertex; // distance of closest approach for found non vertex tracks 00250 TH1F *mDcaGMainVertex; // distance of closest approach for geant main vertex tracks 00251 TH1F *mDcaGNonVertex; // distance of closest approach for geant non vertex tracks 00252 00253 TH2F *mFTrackAng; // track angle of found tracks 00254 TH2F *mFCircleDist; // circle distance of found tracks 00255 TH2F *mFLengthDist; // length distance of found tracks 00256 00257 TH2F *mFCircleLength; // circle distance vs. length distance of found tracks 00258 00259 TH2F *mPRatioDist; // point ratio vs. distance of track pairs 00260 TH2F *mPRatioDistSplit; // point ratio vs. distance of split track pairs 00261 00262 TH1F *mSetupTime; // time consumption for initialisation and setup 00263 TH1F *mTrackingTime; // time consumption for main vertex tracking 00264 TH1F *mExtensionTime; // time consumption for track extension 00265 TH1F *mSplitTime; // time consumption for handling split tracks 00266 TH1F *mFitTime; // time consumption for fitting, dE/dx, and writing 00267 TH1F *mTotalTime; // total time consumption 00268 00269 MIntArray *mParentTrack; // array of numbers of parent tracks for each cluster, [found track # * 10 + # of cluster on track] 00270 MIntArray *mParentTracks; // array of numbers of different parent tracks, [found track # * 10 + # of cluster on track] 00271 MIntArray *mNumParentTracks; // array of number of different parent tracks, [found track # * 10 + # of cluster on track] 00272 MIntArray *mParent; // array of number of the actual parent track for each found track 00273 00274 MIntArray *mClusterArr; // array to specify the quality of the found clusters (0 = unused, 1 = used, -1 = used wrong) 00275 MIntArray *mUncleanTracksArr; // array of numbers of unclean tracks 00276 MIntArray *mSplitTracksArr; // array of numbers of split tracks 00277 MIntArray *mSplitGoodTracksArr; // array of numbers of split good tracks 00278 MIntArray *mGoodFastSimHitsArr; // array of goodness of ffs hits (1 = good, 0 = bad) 00279 00280 Bool_t *mUnclean; 00281 00282 void Setup(St_DataSet *geant, St_DataSet *ftpc_data); // Does the setup. 00283 void SetupFile(Char_t *filename, Char_t *write_permission); // Opens the data file. 00284 void SetupHistos(); // Does the setup of the histograms. 00285 void CreateHistos(); // Creates the histograms. 00286 void DeleteHistos(); // Deletes the histograms. 00287 void GeantHitInit(St_g2t_ftp_hit *g2t_ftp_hit); // Initializes Geant hits 00288 void GeantTrackInit(St_g2t_track *g2t_track, St_g2t_ftp_hit *g2t_ftp_hit); // Initializes Geant tracks 00289 void FastSimHitInit(St_ffs_gepoint *ffs_hit); // Initializes fast simulated hits 00290 void ParentTrackInit(); // Initializes parent tracks 00291 void CalcSplitTracks(); // Calculates the number of split tracks 00292 void EvaluateGoodness(Int_t t_Counter); // Evaluates if track "t_counter" origins from a good parent 00293 00294 public: 00295 00296 Char_t *mFilename; 00297 Char_t *mWritePermission; 00298 TFile *mFile; // Pointer to the data file. 00299 00300 StFtpcTrackEvaluator(); // default constructor 00301 StFtpcTrackEvaluator(St_DataSet *geant, St_DataSet *ftpc_data, StFtpcTracker *tracker, 00302 Char_t *filename = 0, Char_t *write_permission = 0); // real constructor 00303 virtual ~StFtpcTrackEvaluator(); // destructor 00304 00305 TObjArray *GetGeantHits() { return mGeantHits; } 00306 TObjArray *GetGeantTracks() { return mGeantTracks; } 00307 TObjArray *GetFastSimHits() { return mFastSimHits; } 00308 TObjArray *GetFoundHits() { return mFoundHits; } 00309 TObjArray *GetFoundTracks() { return mFoundTracks; } 00310 00311 MIntArray *GetClusterArr() { return mClusterArr; } 00312 MIntArray *GetSplitTracksArr() { return mSplitTracksArr; } 00313 MIntArray *GetSplitGoodTracksArr() { return mSplitGoodTracksArr; } 00314 MIntArray *GetUncleanTracksArr() { return mUncleanTracksArr; } 00315 MIntArray *GetGoodFastSimHitsArr() { return mGoodFastSimHitsArr; } 00316 00317 Int_t GetNumFoundVertexTracks() { return mFoundVertexTracks; } // returns the number of found main vertex tracks 00318 Int_t GetNumFoundNonVertexTracks(){ return mFoundNonVertexTracks; } // returns the number of found non main vertex tracks 00319 Int_t GetNumLookLikeGoodTracks() { return mLookLikeGoodTracks; } // returns the number of tracks which look good but aren't 00320 Int_t GetNumElectronTracks() { return mElectronTracks; } // returns the number of electron tracks 00321 Int_t GetNumNonVertexTracks() { return mNonVertexTracks; } // returns the number of non vertex tracks 00322 Int_t GetNumGoodGeantTracks() { return mGoodGTracks; } // returns the number of good geant tracks 00323 Int_t GetNumGoodFoundTracks() { return mGoodFTracks; } // returns the number of good found tracks 00324 Int_t GetNumSplitTracks() { return mSplitTracks; } // returns the number of split tracks 00325 Int_t GetNumSplitGoodTracks() { return mSplitGoodTracks; } // returns the number of split good tracks 00326 Int_t GetNumSplitLookLikeGoodTracks() { return mSplitLoliGoodTracks; } // returns the number of split good tracks 00327 Int_t GetNumUncleanTracks() { return mUncleanTracks; } // returns the number of tracks which have picked up wrong clusters 00328 Int_t GetNumUncleanGoodTracks() { return mUncleanGoodTracks; } // returns the number of tracks which have picked up wrong clusters and have a good parent track 00329 Int_t GetNumLongTracks() { return mLongTracks; } // returns number of tracks with more than 10 points in the Ftpc 00330 Int_t GetNumLongTrackClusters() { return mLongTrackClusters; } // returns number of clusters on long tracks 00331 Int_t GetNumShortTracks() { return mShortTracks; } // returns number of tracks with less than 5 points in the Ftpc 00332 Int_t GetNumShortTrackClusters() { return mShortTrackClusters; } // returns number of clusters on short tracks 00333 Int_t GetNumTooShortTracks() { return mTooShortTracks; } // returns number of tracks which should be longer 00334 Int_t GetMaxClusters() { return mMaxClusters; } // returns max. number of clusters on a track 00335 00336 Int_t GetNumGoodGeantPoints() { return mGoodGeantPoints; } 00337 Int_t GetNumGoodFoundPoints() { return mGoodFoundPoints; } 00338 00339 Int_t GetNumFoundTracks() { return mFoundTracks->GetEntriesFast(); } // returns number of found tracks in the Ftpc 00340 Int_t GetNumGeantTracks() { return mGeantTracks->GetEntriesFast(); } // returns number of geant tracks in the Ftpc 00341 Int_t GetNumFoundHits() { return mFoundHits->GetEntriesFast(); } // returns number of found hits in the Ftpc 00342 Int_t GetNumFastSimHits() { return mFastSimHits->GetEntriesFast(); } // returns number of fast simulated hits in the Ftpc 00343 Int_t GetNumGeantHits() { return mGeantHits->GetEntriesFast(); } // returns number of geant hits in the Ftpc 00344 00345 00346 Bool_t IsGoodTrack(StFtpcTrack* track); // Evaluates if track is a good track. 00347 Bool_t IsGoodMainVertexTrack(StFtpcTrack* track); // Evaluates if track is a good main vertex track. 00348 Bool_t IsGoodNonVertexTrack(StFtpcTrack* track); // Evaluates if track is a good non vertex track. 00349 Bool_t IsUncleanTrack(Int_t track_num) { return mUnclean[track_num]; } // returns true if track is unclean 00350 Bool_t IsCleanTrack(Int_t track_num) { return !mUnclean[track_num]; } // returns true if track is clean 00351 00352 void Loop(); 00353 void FillEventHistos(); // Fills histograms which are filled only once per event. 00354 void FillTimeHistos(StFtpcTracker* tracker); // Fills histogramms of time consumption 00355 void FillParentHistos(); // Fills histogram of number of parents 00356 void FillParentHistos(Int_t t_counter); // Fills histogram of number of parents 00357 void FillMomentumHistos(); // Fills histograms of rel. momentum difference 00358 void FillMomentumHistos(Int_t t_counter); // Fills histograms of rel. momentum difference 00359 void FillHitsOnTrack(TObjArray *trackarray, Char_t c); // Fills histogram of hits on tracks 00360 void FillHitsOnTrack(); // Fills all hits on all tracks 00361 void FillFoundHitsOnTrack(); // Fills found hits on tracks 00362 void FillCutHistos(); // Fills cut histograms (geant and found tracks) 00363 void FillGCutHistos(); // Fills cut histograms (geant tracks) 00364 void FillFCutHistos(); // Fills cut histograms (found tracks) 00365 void DivideHistos(); // Divides histograms 00366 void WriteHistos(); // Writes histograms to file 00367 00368 void GetGoodHits(TObjArray *good_clusters); // Fills all good hits in given array 00369 00370 void ShowTracks(); // Displays geant and/or found tracks 00371 void GeantInfo(); // Shows information about GEANT output. 00372 void ClusterInfo(); // Shows information about geant clusters. 00373 void TrackerInfo(); // Shows information about tracker output. 00374 void ProblemsInfo(); // Shows information about problems. 00375 void InfoAll(); // Shows all information. 00376 00377 ClassDef(StFtpcTrackEvaluator, 1) //Ftpc track evaluation class 00378 }; 00379 00380 00381 00382 00383 00384 #endif
1.5.9