]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoMCTrackCut.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemto / AliFemtoMCTrackCut.cxx
CommitLineData
76ce4b5b 1/////////////////////////////////////////////////////////////////////////////////////
2// //
3// AliFemtoMCTrackCut: A basic track cut that used information from //
4// ALICE MC to accept or reject the track. //
5// Enables the selection on charge, transverse momentum, rapidity, //
6// and PDG of the particle //
7// Authors: Malgorzata Janik, Warsaw University of Technology, majanik@cern.ch //
8// Lukasz Graczykowski, Warsaw University of Technology, lgraczyk@cern.ch //
9// //
10/////////////////////////////////////////////////////////////////////////////////////
11
12
13
14#include "AliFemtoMCTrackCut.h"
15#include <cstdio>
16
17#ifdef __ROOT__
18ClassImp(AliFemtoMCTrackCut)
19#endif
20
21
22AliFemtoMCTrackCut::AliFemtoMCTrackCut() :
23 fCharge(0),
24 fLabel(0),
25 fPDGcode(211),
26 fNTracksPassed(0),
27 fNTracksFailed(0)
28{
29 // Default constructor
30 fNTracksPassed = fNTracksFailed = 0;
31 fCharge = 0; // takes both charges 0
32 fPt[0]=0.0; fPt[1] = 100.0;//100
33 fPDGcode = 0;
34 fRapidity[0]=-2; fRapidity[1]=2;//-2 2
35 fEta[0]=-2; fEta[1]=2;//-2 2
36 fLabel=false;
37}
38//------------------------------
39AliFemtoMCTrackCut::~AliFemtoMCTrackCut(){
40 /* noop */
41}
42//------------------------------
43bool AliFemtoMCTrackCut::Pass(const AliFemtoTrack* track)
44{
45
46 if (fLabel)
47 {
48 if(track->Label()<0)
49 {
50 fNTracksFailed++;
51 return false;
52 }
53 }
54
55 if (fCharge!=0)
56 {
57 if (fCharge==10)
58 {
59 if(track->Charge()==0){
60 fNTracksFailed++;
61 return false;
62 }
63 }
64 else if (track->Charge()!= fCharge)
65 {
66 fNTracksFailed++;
67 return false;
68 }
69 }
70
71 if (fPDGcode!=0)
72 {
73
74 if(fPDGcode==11 || fPDGcode==-11 )
75 { if(!fMass) fMass=0.000511;
76 if (track->PidProbElectron()!=1000)
77 {
78 fNTracksFailed++;
79 return false;
80 }
81 }
82 if(fPDGcode==13 || fPDGcode==-13)
83 {
84 if (track->PidProbMuon()!=1000)
85 {if(!fMass) fMass=0.105658;
86 fNTracksFailed++;
87 return false;
88 }
89 }
90 if(fPDGcode==211 || fPDGcode==-211 )
91 {
92 if (track->PidProbPion()!=1000)
93 {if(!fMass) fMass= 0.1395699;
94 fNTracksFailed++;
95 return false;
96 }
97 }
98 if(fPDGcode==2212 || fPDGcode==-2212 )
99 { if(!fMass) fMass=0.938272013;
100 if (track->PidProbProton()!=1000)
101 {
102 fNTracksFailed++;
103 return false;
104 }
105 }
106 if(fPDGcode==321 || fPDGcode==-321 )
107 { if(!fMass) fMass=0.493677;
108 if (track->PidProbKaon()!=1000)
109 {
110 fNTracksFailed++;
111 return false;
112 }
113 }
114 }
115
116 float tEnergy = ::sqrt(track->P().Mag2()+fMass*fMass);
117 //cout<<"MCTrackCut: tEnergy: "<<tEnergy<<endl;
118 //cout<<"MCTrackCut: track->P().z(): "<<track->P().z()<<endl;
119 //cout<<"MCTrackCut: tEnergy-track->P().z(): "<<tEnergy-track->P().z()<<endl;
120 float tRapidity;
121 if(tEnergy-track->P().z() == 0 || (tEnergy+track->P().z())/(tEnergy-track->P().z()) == 0)
122 {
123 fNTracksFailed++;
124 return false;
125 }
126 else
fa18256d 127 {
128 if((tEnergy+track->P().z())/(tEnergy-track->P().z())>0)
129 tRapidity = 0.5*TMath::Log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
130 else
131 tRapidity = 0;
132 }
76ce4b5b 133 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
134 float tEta = track->P().PseudoRapidity();
135
136 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
137 {
138 fNTracksFailed++;
139 return false;
140 }
141 if ((tEta<fEta[0])||(tEta>fEta[1]))
142 {
143 fNTracksFailed++;
144 return false;
145 }
146 if ((tPt<fPt[0])||(tPt>fPt[1]))
147 {
148 fNTracksFailed++;
149 return false;
150 }
151
152 fNTracksPassed++ ;
153 return true;
154
155
156}
157//------------------------------
158AliFemtoString AliFemtoMCTrackCut::Report()
159{
160 // Prepare report from the execution
161 string tStemp;
162 char tCtemp[100];
163 snprintf(tCtemp,100,"Particle mass:\t%E\n",this->Mass());
164 tStemp=tCtemp;
165 snprintf(tCtemp,100,"Particle charge:\t%d\n",fCharge);
166 tStemp+=tCtemp;
167 snprintf(tCtemp,100,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
168 tStemp+=tCtemp;
169 snprintf(tCtemp,100,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
170 tStemp+=tCtemp;
171 snprintf(tCtemp,100,"Particle eta:\t%E - %E\n",fEta[0],fEta[1]);
172 tStemp+=tCtemp;
173 snprintf(tCtemp,100,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
174 tStemp += tCtemp;
175 AliFemtoString returnThis = tStemp;
176 return returnThis;
177}
178TList *AliFemtoMCTrackCut::ListSettings()
179{
180 // return a list of settings in a writable form
181 TList *tListSetttings = new TList();
182 char buf[200];
183 snprintf(buf, 200, "AliFemtoMCTrackCut.mass=%f", this->Mass());
184 tListSetttings->AddLast(new TObjString(buf));
185
186 snprintf(buf, 200, "AliFemtoMCTrackCut.charge=%i", fCharge);
187 tListSetttings->AddLast(new TObjString(buf));
188 return tListSetttings;
189}
190
191