StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
helensLaPTrackCut.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Frank Laue, Ohio State, laue@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/helensLaPTrackCut.h"
17 #include "StHbtMaker/Cut/helensEventCut.h"
18 #include "StHbtMaker/Infrastructure/StHbtAnalysis.h"
19 #include <cstdio>
20 
21 #ifdef __ROOT__
22  ClassImp(helensLaPTrackCut)
23 #endif
24 
25 helensLaPTrackCut::helensLaPTrackCut(){
26  mNTracksPassed = mNTracksFailed = 0;
27  mNSigmaElectron[0] = -1e9; mNSigmaElectron[1] = +1e9;
28  mNSigmaPion[0] = -1e9; mNSigmaPion[1] = +1e9;
29  mNSigmaKaon[0] = -1e9; mNSigmaKaon[1] = +1e9;
30  mNSigmaProton[0] = -1e9; mNSigmaProton[1] = +1e9;
31  mNSigmaAntiElectron[0] = 0.; mNSigmaAntiElectron[1] = 0.;
32  mNSigmaAntiPion[0] = 0.; mNSigmaAntiPion[1] = 0.;
33  mNSigmaAntiKaon[0] = 0.; mNSigmaAntiKaon[1] = 0.;
34  mNSigmaAntiProton[0] = 0.; mNSigmaAntiProton[1] = 0.;
35  mPt[0] = -1e9; mPt[1] = +1e9;
36  mPx[0] = -1e9; mPx[1] = +1e9;
37  mPy[0] = -1e9; mPy[1] = +1e9;
38  mPz[0] = -1e9; mPz[1] = +1e9;
39 }
40 //------------------------------
41 helensLaPTrackCut::helensLaPTrackCut(helensLaPTrackCut& c) : StHbtTrackCut(c) {
42  mNTracksPassed = mNTracksFailed = 0;
43  mCharge = c.mCharge;
44  mNSigmaElectron[0] = c.mNSigmaElectron[0];
45  mNSigmaElectron[1] = c.mNSigmaElectron[1];
46  mNSigmaPion[0] = c.mNSigmaPion[0];
47  mNSigmaPion[1] = c.mNSigmaPion[1];
48  mNSigmaKaon[0] = c.mNSigmaKaon[0];
49  mNSigmaKaon[1] = c.mNSigmaKaon[1];
50  mNSigmaProton[0] = c.mNSigmaProton[0];
51  mNSigmaProton[1] = c.mNSigmaProton[1];
52  mNSigmaAntiElectron[0] = c.mNSigmaAntiElectron[0];
53  mNSigmaAntiElectron[1] = c.mNSigmaAntiElectron[1];
54  mNSigmaAntiPion[0] = c.mNSigmaAntiPion[0];
55  mNSigmaAntiPion[1] = c.mNSigmaAntiPion[1];
56  mNSigmaAntiKaon[0] = c.mNSigmaAntiKaon[0];
57  mNSigmaAntiKaon[1] = c.mNSigmaAntiKaon[1];
58  mNSigmaAntiProton[0] = c.mNSigmaAntiProton[0];
59  mNSigmaAntiProton[1] = c.mNSigmaAntiProton[1];
60  mNHits[0] = c.mNHits[0];
61  mNHits[1] = c.mNHits[1];
62  mP[0] = c.mP[0]; mP[1] = c.mP[1];
63  mPt[0] = c.mPt[0]; mPt[1] = c.mPt[1];
64  mPx[0] = c.mPx[0]; mPx[1] = c.mPx[1];
65  mPy[0] = c.mPy[0]; mPy[1] = c.mPy[1];
66  mPz[0] = c.mPz[0]; mPz[1] = c.mPz[1];
67  mRapidity[0] = c.mRapidity[0];
68  mRapidity[1] = c.mRapidity[1];
69  mDCA[0] = c.mDCA[0];
70  mDCA[1] = c.mDCA[1];
71  mNTracksPassed=0;
72  mNTracksFailed=0;
73 #ifdef STHBTDEBUG
74  cout << " helensLaPTrackCut::helensLaPTrackCut(helensLaPTrackCut& c) " << endl;
75 #endif
76 }
77 
78 //------------------------------
79 helensLaPTrackCut::~helensLaPTrackCut(){
80 }
81 
82 //------------------------------
83 bool helensLaPTrackCut::Pass(const StHbtTrack* track){
84  // cout << " *** helensLaPTrackCut::Pass(const StHbtTrack* track) " << endl;
85 
86  float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
87  float TRapidity = 0.5*::log((TEnergy+track->P().z())/
88  (TEnergy-track->P().z()));
89 
90 #ifdef STHBTDEBUG
91  cout <<
92  track->NSigmaElectron() << " " <<
93  track->NSigmaPion() << " " <<
94  track->NSigmaKaon() << " " <<
95  track->NSigmaProton() << " " <<
96  track->DCAxy() << " " <<
97  track->NHits() << " " <<
98  track->P().mag() << " " <<
99  track->Pt() << " " <<
100  TRapidity << " " <<
101  track->Charge() << " ";
102 #endif
103 
104  bool goodPID = (
105  (track->NSigmaElectron() >= mNSigmaElectron[0]) &&
106  (track->NSigmaElectron() <= mNSigmaElectron[1]) &&
107  (track->NSigmaPion() >= mNSigmaPion[0]) &&
108  (track->NSigmaPion() <= mNSigmaPion[1]) &&
109  (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
110  (track->NSigmaKaon() <= mNSigmaKaon[1]) &&
111  (track->NSigmaProton() >= mNSigmaProton[0]) &&
112  (track->NSigmaProton() <= mNSigmaProton[1]) &&
113  !( (track->NSigmaElectron() >= mNSigmaAntiElectron[0]) &&
114  (track->NSigmaElectron() <= mNSigmaAntiElectron[1]) ) &&
115  !( (track->NSigmaPion() >= mNSigmaAntiPion[0]) &&
116  (track->NSigmaPion() <= mNSigmaAntiPion[1]) ) &&
117  !( (track->NSigmaKaon() >= mNSigmaAntiKaon[0]) &&
118  (track->NSigmaKaon() <= mNSigmaAntiKaon[1]) ) &&
119  !( (track->NSigmaProton() >= mNSigmaAntiProton[0]) &&
120  (track->NSigmaProton() <= mNSigmaAntiProton[1]) ) &&
121  (track->Charge() == mCharge || mCharge==0 )
122  );
123 
124 
125 
126 #ifdef STHBTDEBUG
127  cout << mNSigmaElectron[0] << " << " << track->NSigmaElectron() << " << " << mNSigmaElectron[1] << " ";
128  cout << (track->NSigmaElectron() >= mNSigmaElectron[0]) << (track->NSigmaElectron() <= mNSigmaElectron[1]) << endl;
129 #endif
130 
131  bool goodTrack=( true &&
132  (track->DCAxy() >= mDCA[0]) &&
133  (track->DCAxy() <= mDCA[1]) &&
134  (track->NHits() >= mNHits[0]) &&
135  (track->NHits() <= mNHits[1]) &&
136  (track->P().mag() >= mP[0]) &&
137  (track->P().mag() <= mP[1]) &&
138  (track->Pt() >= mPt[0]) &&
139  (track->Pt() <= mPt[1]) &&
140  (track->P().x() >= mPx[0]) &&
141  (track->P().x() <= mPx[1]) &&
142  (track->P().y() >= mPy[0]) &&
143  (track->P().y() <= mPy[1]) &&
144  (track->P().z() >= mPz[0]) &&
145  (track->P().z() <= mPz[1]) &&
146  (TRapidity >= mRapidity[0]) &&
147  (TRapidity <= mRapidity[1])
148 );
149 
150 
151 #ifdef STHBTDEBUG
152  cout << " goodPID=" << goodPID << " ";
153  cout << " goodTrack=" << goodTrack << " ";
154  cout << endl;
155 #endif
156 
157 
158  if( goodTrack){
159 
160  // Go get event cut to get my list
161 
162  StHbtAnalysis* Anal = (StHbtAnalysis*) myAnalysis;
163  helensEventCut* EventCut = (helensEventCut*)Anal->EventCut();
164  StHbtTrkV0Iterator pIter;
165  StHbtTrkV0Match* TheMatch;
166 
167 
168  for( pIter= EventCut->TrkV0MatchCollection()->begin(); pIter!= EventCut->TrkV0MatchCollection()->end(); pIter++){
169 
170  TheMatch = *pIter;
171  if( TheMatch->TrkId() == track->TrackId()){
172  goodTrack = !(TheMatch->Used());
173  break;
174  }
175 
176  }
177 
178  }
179 
180  (goodTrack && goodPID) ? mNTracksPassed++ : mNTracksFailed++;
181 
182  return (goodPID && goodTrack);
183 }
184 //------------------------------
185 StHbtString helensLaPTrackCut::Report(){
186  string Stemp;
187  char Ctemp[100];
188  sprintf(Ctemp,"\nParticle mass:\t%E",mMass);
189  Stemp+=Ctemp;
190  sprintf(Ctemp,"\nParticle charge:\t%d",mCharge);
191  Stemp+=Ctemp;
192  sprintf(Ctemp,"\nParticle Nsigma from pion:\t%E - %E",mNSigmaPion[0],mNSigmaPion[1]);
193  Stemp+=Ctemp;
194  sprintf(Ctemp,"\nParticle Nsigma from kaon:\t%E - %E",mNSigmaKaon[0],mNSigmaKaon[1]);
195  Stemp+=Ctemp;
196  sprintf(Ctemp,"\nParticle Nsigma from proton:\t%E - %E",mNSigmaProton[0],mNSigmaProton[1]);
197  Stemp+=Ctemp;
198  sprintf(Ctemp,"\nParticle Nsigma from electron:\t%E - %E",mNSigmaElectron[0],mNSigmaElectron[1]);
199  Stemp+=Ctemp;
200  sprintf(Ctemp,"\nParticle #hits:\t%d - %d",mNHits[0],mNHits[1]);
201  Stemp+=Ctemp;
202  sprintf(Ctemp,"\nParticle p:\t%E - %E",mP[0],mP[1]);
203  Stemp+=Ctemp;
204  sprintf(Ctemp,"\nParticle pT:\t%E - %E",mPt[0],mPt[1]);
205  Stemp+=Ctemp;
206  sprintf(Ctemp,"\nParticle rapidity:\t%E - %E",mRapidity[0],mRapidity[1]);
207  Stemp+=Ctemp;
208  sprintf(Ctemp,"\nParticle DCA:\t%E - %E",mDCA[0],mDCA[1]);
209  Stemp+=Ctemp;
210  sprintf(Ctemp,"\nNumber of tracks which passed:\t%ld Number which failed:\t%ld",mNTracksPassed,mNTracksFailed);
211  Stemp += Ctemp;
212  StHbtString returnThis = Stemp;
213  return returnThis;
214 }
215