StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mikesTrackCut.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * a simple particle cut that selects on phasespace, #hits, DCA, and PID
10  *
11  ***************************************************************************
12  *
13  *
14  **************************************************************************/
15 
16 #include "StHbtMaker/Cut/mikesTrackCut.h"
17 #include <cstdio>
18 
19 #ifdef __ROOT__
20 ClassImp(mikesTrackCut)
21 #endif
22 
23 mikesTrackCut::mikesTrackCut(){
24  mNTracksPassed = mNTracksFailed = 0;
25 }
26 //------------------------------
27 //mikesTrackCut::~mikesTrackCut(){
28 // /* noop */
29 //}
30 //------------------------------
31 bool mikesTrackCut::Pass(const StHbtTrack* track){
32 
33  /*
34  cout << endl;
35  cout << "#track " << trackCount++;
36  cout << " * pion " << (track->NSigmaPion() > mNSigmaPion[0]) && (track->NSigmaPion() < mNSigmaPion[1]);
37  cout << " * kaon " << (track->NSigmaKaon() > mNSigmaKaon[0]) && (track->NSigmaKaon() < mNSigmaKaon[1]);
38  cout << " * proton " << (track->NSigmaProton() > mNSigmaProton[0]) && (track->NSigmaProton() < mNSigmaProton[1]);
39  cout << " * charge " << (track->Charge() == mCharge);
40  */
41  bool goodPID = ((track->NSigmaPion() > mNSigmaPion[0]) &&
42  (track->NSigmaPion() < mNSigmaPion[1]) &&
43  (track->NSigmaKaon() > mNSigmaKaon[0]) &&
44  (track->NSigmaKaon() < mNSigmaKaon[1]) &&
45  (track->NSigmaProton() > mNSigmaProton[0]) &&
46  (track->NSigmaProton() < mNSigmaProton[1]));
47  if (mCharge !=0){ // if user requests "charge=0" then that means ignore charge
48  goodPID = (goodPID&&(track->Charge() == mCharge));
49  }
50 
51  if (goodPID){
52  float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
53  float TRapidity = 0.5*::log((TEnergy+track->P().z())/
54  (TEnergy-track->P().z()));
55 
56  float Pt = ::sqrt((track->P().x())*(track->P().x())+
57  (track->P().y())*(track->P().y()));
58 
59 
60 
61  /*
62  cout << " * DCAxy " << (track->DCAxy() > mDCA[0]) && (track->DCAxy() < mDCA[1]);
63  cout << " * mDCA[0] " << mDCA[0];
64  cout << " * mDCA[1] " << mDCA[1];
65  cout << " * track->DCAxy " << track->DCAxy();
66  cout << " * NHits " << (track->NHits() > mNHits[0]) && (track->NHits() < mNHits[1]);
67  cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
68  cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
69  cout << endl;
70  */
71 
72  bool goodTrack=
73  ((track->DCAxy() > mDCA[0]) &&
74  (track->DCAxy() < mDCA[1]) &&
75  (track->NHits() > mNHits[0]) &&
76  (track->NHits() < mNHits[1]) &&
77  (Pt > mPt[0]) &&
78  (Pt < mPt[1]) &&
79  (TRapidity > mRapidity[0]) &&
80  (TRapidity < mRapidity[1]));
81 
82  goodTrack ? mNTracksPassed++ : mNTracksFailed++;
83  return (goodTrack);
84  }
85  else{
86  mNTracksFailed++;
87  return (goodPID);
88  }
89 }
90 //------------------------------
91 StHbtString mikesTrackCut::Report(){
92  string Stemp;
93  char Ctemp[100];
94  sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
95  Stemp=Ctemp;
96  sprintf(Ctemp,"Particle charge:\t%d\n",mCharge);
97  Stemp=Ctemp;
98  sprintf(Ctemp,"Particle Nsigma from pion:\t%E - %E\n",mNSigmaPion[0],mNSigmaPion[1]);
99  Stemp+=Ctemp;
100  sprintf(Ctemp,"Particle Nsigma from kaon:\t%E - %E\n",mNSigmaKaon[0],mNSigmaKaon[1]);
101  Stemp+=Ctemp;
102  sprintf(Ctemp,"Particle Nsigma from proton:\t%E - %E\n",mNSigmaProton[0],mNSigmaProton[1]);
103  Stemp+=Ctemp;
104  sprintf(Ctemp,"Particle #hits:\t%d - %d\n",mNHits[0],mNHits[1]);
105  Stemp+=Ctemp;
106  sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
107  Stemp+=Ctemp;
108  sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
109  Stemp+=Ctemp;
110  sprintf(Ctemp,"Particle DCA:\t%E - %E\n",mDCA[0],mDCA[1]);
111  Stemp+=Ctemp;
112  sprintf(Ctemp,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",mNTracksPassed,mNTracksFailed);
113  Stemp += Ctemp;
114  StHbtString returnThis = Stemp;
115  return returnThis;
116 }