]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FEMTOSCOPY/AliFemto/AliFemtoMCTrackCut.cxx
Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoMCTrackCut.cxx
CommitLineData
859f1d8d 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),
b84aaa8b 25 fPDGcode(211),
859f1d8d 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
127 tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
128 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
129 float tEta = track->P().PseudoRapidity();
130
131 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
132 {
133 fNTracksFailed++;
134 return false;
135 }
136 if ((tEta<fEta[0])||(tEta>fEta[1]))
137 {
138 fNTracksFailed++;
139 return false;
140 }
141 if ((tPt<fPt[0])||(tPt>fPt[1]))
142 {
143 fNTracksFailed++;
144 return false;
145 }
146
147 fNTracksPassed++ ;
148 return true;
149
150
151}
152//------------------------------
153AliFemtoString AliFemtoMCTrackCut::Report()
154{
155 // Prepare report from the execution
156 string tStemp;
157 char tCtemp[100];
b84aaa8b 158 snprintf(tCtemp,100,"Particle mass:\t%E\n",this->Mass());
859f1d8d 159 tStemp=tCtemp;
b84aaa8b 160 snprintf(tCtemp,100,"Particle charge:\t%d\n",fCharge);
859f1d8d 161 tStemp+=tCtemp;
b84aaa8b 162 snprintf(tCtemp,100,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
859f1d8d 163 tStemp+=tCtemp;
b84aaa8b 164 snprintf(tCtemp,100,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
859f1d8d 165 tStemp+=tCtemp;
b84aaa8b 166 snprintf(tCtemp,100,"Particle eta:\t%E - %E\n",fEta[0],fEta[1]);
859f1d8d 167 tStemp+=tCtemp;
b84aaa8b 168 snprintf(tCtemp,100,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
859f1d8d 169 tStemp += tCtemp;
170 AliFemtoString returnThis = tStemp;
171 return returnThis;
172}
173TList *AliFemtoMCTrackCut::ListSettings()
174{
175 // return a list of settings in a writable form
176 TList *tListSetttings = new TList();
177 char buf[200];
178 snprintf(buf, 200, "AliFemtoMCTrackCut.mass=%f", this->Mass());
179 tListSetttings->AddLast(new TObjString(buf));
180
181 snprintf(buf, 200, "AliFemtoMCTrackCut.charge=%i", fCharge);
182 tListSetttings->AddLast(new TObjString(buf));
183 return tListSetttings;
184}
185
186