StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StuCutTrack.cxx
1 //
3 // $Id: StuCutTrack.cxx,v 1.3 2003/09/02 17:58:09 perev Exp $
4 //
5 // Author: Art Poskanzer, LBNL, Dec 1999
6 //
7 // Description: Class for applying track cuts
8 //
10 //
11 // $Log: StuCutTrack.cxx,v $
12 // Revision 1.3 2003/09/02 17:58:09 perev
13 // gcc 3.2 updates + WarnOff
14 //
15 // Revision 1.2 1999/12/21 16:12:26 posk
16 // Updates.
17 //
18 // Revision 1.1 1999/12/17 00:07:08 posk
19 // Classes for StEvent cuts.
20 //
21 // Revision 1.0 posk
22 // First versions of StEvent cut classes.
23 //
25 
26 #include <Stiostream.h>
27 #include <stdlib.h>
28 #include "StEvent.h"
29 #include "StEventTypes.h"
30 #include "StuCutTrack.hh"
31 #include "PhysicalConstants.h"
32 #include "SystemOfUnits.h"
33 #include "StThreeVectorD.hh"
34 #define PR(x) cout << "##### CutTrack: " << (#x) << " = " << (x) << endl;
35 
36 ClassImp(StuCutTrack)
37 
38 //-----------------------------------------------------------------------
39 
40 Int_t StuCutTrack::mFitPtsCuts[2] = {10, 200};
41 Float_t StuCutTrack::mFitOverMaxCuts[2] = {0.6, 1.};
42 
43 UInt_t StuCutTrack::mTrackN = 0;
44 UInt_t StuCutTrack::mGoodTrackN = 0;
45 UInt_t StuCutTrack::mEtaSymPosN = 0;
46 UInt_t StuCutTrack::mEtaSymNegN = 0;
47 UInt_t StuCutTrack::mFitPtsCutN = 0;
48 UInt_t StuCutTrack::mFitOverMaxCutN = 0;
49 
50 //-----------------------------------------------------------------------
51 
52 StuCutTrack::StuCutTrack() {
53  // To apply track cuts
54 }
55 
56 //-----------------------------------------------------------------------
57 
58 StuCutTrack::~StuCutTrack() {
59 }
60 
61 //-----------------------------------------------------------------------
62 
63 Int_t StuCutTrack::CheckTrack(StPrimaryTrack* pTrack) {
64  // Returns kTRUE if the track survives all the cuts
65 
66  mTrackN++;
67 
68  // Fit Points
69  Int_t nFitPoints = pTrack->fitTraits().numberOfFitPoints();
70  if (mFitPtsCuts[1] > mFitPtsCuts[0] &&
71  (nFitPoints < mFitPtsCuts[0] || nFitPoints >= mFitPtsCuts[1])) {
72  mFitPtsCutN++;
73  return kFALSE;
74  }
75 
76  // Fit points / max points
77  Int_t nMaxPoints = pTrack->numberOfPossiblePoints();
78  float fitOverMax = (nMaxPoints) ? (float)nFitPoints/(float)nMaxPoints : 0.8;
79  // When nMaxPoints is done correctly the 0.8 should be changed to 0.
80  if (mFitOverMaxCuts[1] > mFitOverMaxCuts[0] &&
81  (fitOverMax < mFitOverMaxCuts[0] || fitOverMax >= mFitOverMaxCuts[1])) {
82  mFitOverMaxCutN++;
83  return kFALSE;
84  }
85 
86 
87  // Increment counters for Eta symmetry cut
88  double bField = 0.5*tesla;
89  // When I learn how to get this from StRun, bField will be done correctly.
90  StThreeVectorD p = pTrack->geometry()->helix().momentum(bField);
91  if (p.pseudoRapidity() > 0.) {
92  mEtaSymPosN++;
93  } else {
94  mEtaSymNegN++;
95  }
96  mGoodTrackN++;
97  return kTRUE;
98 }
99 
100 //-----------------------------------------------------------------------
101 
102 void StuCutTrack::PrintCutList() {
103  // Prints the list of cuts
104  // Call in Finish
105 
106  cout << "#######################################################" << endl;
107  cout << "# Track Cut List:" << endl;
108  cout << "# FitPts cuts= " << mFitPtsCuts[0] << ", " << mFitPtsCuts[1]
109  << " :\t " << setprecision(4) << (float)mFitPtsCutN/(float)mTrackN/perCent
110  << "% cut" << endl;
111  cout << "# FitOverMax cuts= " << mFitOverMaxCuts[0] << ", "
112  << mFitOverMaxCuts[1] << " :\t " << setprecision(4)
113  << (float)mFitOverMaxCutN/(float)mTrackN/perCent << "% cut" << endl;
114  cout << "# Good Tracks = " << (float)mGoodTrackN/(float)mTrackN/perCent
115  << "%" << endl;
116  cout << "#######################################################" << endl;
117 
118 }