StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
adamsTrackCut.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/adamsTrackCut.h"
17 #include <cstdio>
18 
19 #ifdef __ROOT__
20 ClassImp(adamsTrackCut)
21 #endif
22 
23  //#define STHBTDEBUG
24 
25 adamsTrackCut::adamsTrackCut(): franksTrackCut() {
26  mPIDPThreshold = 0;
27 }
28 //------------------------------
29 adamsTrackCut::adamsTrackCut(adamsTrackCut& c) : franksTrackCut(c) {
30  mPIDPThreshold = c.mPIDPThreshold;
31 #ifdef STHBTDEBUG
32  cout << " adamsTrackCut::adamsTrackCut(adamsTrackCut& c) " << endl;
33 #endif
34 }
35 
36 //------------------------------
37 adamsTrackCut::~adamsTrackCut(){
38 }
39 
40 //------------------------------
41 bool adamsTrackCut::Pass(const StHbtTrack* track){
42  // cout << " *** adamsTrackCut::Pass(const StHbtTrack* track) " << endl;
43 
44  float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
45  float TRapidity = 0.5*::log((TEnergy+track->P().z())/
46  (TEnergy-track->P().z()));
47 
48 #ifdef STHBTDEBUG
49  cout <<
50  track->NSigmaElectron() << " " <<
51  track->NSigmaPion() << " " <<
52  track->NSigmaKaon() << " " <<
53  track->NSigmaProton() << " " <<
54  track->DCAxy() << " " <<
55  track->DCAxyGlobal() << " " <<
56  track->NHits() << " " <<
57  track->NHitsDedx() << " " <<
58  track->P().mag() << " " <<
59  track->Pt() << " " <<
60  TRapidity << " " <<
61  track->Charge() << " ";
62 #endif
63 
64  bool goodPID;
65  // Use different PIDs for P below and above threshold
66  if (track->P().mag() < mPIDPThreshold)
67  {
68  // Use NSigma
69  goodPID = (
70  (track->NSigmaElectron() >= mNSigmaElectron[0]) &&
71  (track->NSigmaElectron() <= mNSigmaElectron[1]) &&
72  (track->NSigmaPion() >= mNSigmaPion[0]) &&
73  (track->NSigmaPion() <= mNSigmaPion[1]) &&
74  (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
75  (track->NSigmaKaon() <= mNSigmaKaon[1]) &&
76  (track->NSigmaProton() >= mNSigmaProton[0]) &&
77  (track->NSigmaProton() <= mNSigmaProton[1]) &&
78  !( (track->NSigmaElectron() > mNSigmaAntiElectron[0]) &&
79  (track->NSigmaElectron() < mNSigmaAntiElectron[1]) ) &&
80  !( (track->NSigmaPion() > mNSigmaAntiPion[0]) &&
81  (track->NSigmaPion() < mNSigmaAntiPion[1]) ) &&
82  !( (track->NSigmaKaon() > mNSigmaAntiKaon[0]) &&
83  (track->NSigmaKaon() < mNSigmaAntiKaon[1]) ) &&
84  !( (track->NSigmaProton() > mNSigmaAntiProton[0]) &&
85  (track->NSigmaProton() < mNSigmaAntiProton[1]) ) &&
86  (track->Charge() == mCharge || mCharge==0 )
87  );
88  }
89  else
90  {
91  // Use PID Probability
92  goodPID = (
93  (track->PidProbElectron() >= mPidProbElectron[0]) &&
94  (track->PidProbElectron() <= mPidProbElectron[1]) &&
95  (track->PidProbPion() >= mPidProbPion[0]) &&
96  (track->PidProbPion() <= mPidProbPion[1]) &&
97  (track->PidProbKaon() >= mPidProbKaon[0]) &&
98  (track->PidProbKaon() <= mPidProbKaon[1]) &&
99  (track->PidProbProton() >= mPidProbProton[0]) &&
100  (track->PidProbProton() <= mPidProbProton[1]) &&
101  (track->Charge() == mCharge || mCharge==0 )
102  );
103  }
104 
105 #ifdef STHBTDEBUG
106  cout << mNSigmaElectron[0] << " << " << track->NSigmaElectron() << " << " << mNSigmaElectron[1] << " ";
107  cout << (track->NSigmaElectron() >= mNSigmaElectron[0]) << (track->NSigmaElectron() <= mNSigmaElectron[1]) << endl;
108 #endif
109 
110  bool goodTrack=( true &&
111  (track->DCAxy() >= mDCA[0]) &&
112  (track->DCAxy() <= mDCA[1]) &&
113  (track->DCAxyGlobal() >= mDCAGlobal[0]) &&
114  (track->DCAxyGlobal() <= mDCAGlobal[1]) &&
115  (track->NHits() >= mNHits[0]) &&
116  (track->NHits() <= mNHits[1]) &&
117  (track->NHitsDedx() >= mNdEdxHits[0]) &&
118  (track->NHitsDedx() <= mNdEdxHits[1]) &&
119  (track->P().mag() >= mP[0]) &&
120  (track->P().mag() <= mP[1]) &&
121  (track->Pt() >= mPt[0]) &&
122  (track->Pt() <= mPt[1]) &&
123  (track->P().x() >= mPx[0]) &&
124  (track->P().x() <= mPx[1]) &&
125  (track->P().y() >= mPy[0]) &&
126  (track->P().y() <= mPy[1]) &&
127  (track->P().z() >= mPz[0]) &&
128  (track->P().z() <= mPz[1]) &&
129  (track->P().pseudoRapidity() >= mEta[0]) &&
130  (track->P().pseudoRapidity() <= mEta[1]) &&
131  (TRapidity >= mRapidity[0]) &&
132  (TRapidity <= mRapidity[1])
133 );
134 
135 
136 #ifdef STHBTDEBUG
137  cout << " goodPID=" << goodPID << " ";
138  cout << " goodTrack=" << goodTrack << " ";
139  cout << endl;
140 #endif
141 
142  (goodTrack && goodPID) ? mNTracksPassed++ : mNTracksFailed++;
143 
144  return (goodPID && goodTrack);
145 }
146 //------------------------------
147 StHbtString adamsTrackCut::Report() {
148  return franksTrackCut::Report();
149 }
150 
151 
152 std::ostringstream* adamsTrackCut::finalReport() const{
153  return franksTrackCut::finalReport();
154 }
155