Making the directory structure of AliFemtoUser flat. All files go into one common...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoESDTrackCut.cxx
1 /***************************************************************************
2  *
3  * $Id$ 
4  *
5  * 
6  ***************************************************************************
7  *
8  * 
9  *              
10  *
11  ***************************************************************************
12  *
13  * $Log$
14  * Revision 1.4  2007/05/03 09:46:10  akisiel
15  * Fixing Effective C++ warnings
16  *
17  * Revision 1.3  2007/04/27 07:25:59  akisiel
18  * Make revisions needed for compilation from the main AliRoot tree
19  *
20  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
21  * Importing the HBT code dir
22  *
23  * Revision 1.4  2007-04-03 16:00:08  mchojnacki
24  * Changes to iprove memory managing
25  *
26  * Revision 1.3  2007/03/13 15:30:03  mchojnacki
27  * adding reader for simulated data
28  *
29  * Revision 1.2  2007/03/08 14:58:03  mchojnacki
30  * adding some alice stuff
31  *
32  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
33  * First version on CVS
34  *
35  **************************************************************************/
36
37 #include "AliFemtoESDTrackCut.h"
38 #include <cstdio>
39
40 #ifdef __ROOT__ 
41 ClassImp(AliFemtoESDTrackCut)
42 #endif
43
44 AliFemtoESDTrackCut::AliFemtoESDTrackCut() :
45   fCharge(0),
46   fLabel(0),
47   fStatus(0),
48   fminTPCclsF(0),
49   fminITScls(0),
50   fNTracksPassed(0),
51   fNTracksFailed(0)
52 {
53     fNTracksPassed = fNTracksFailed = 0;
54     fCharge = 0;  // takes both charges 0
55     fPt[0]=0.0;              fPt[1] = 100.0;//100
56     fRapidity[0]=-2;       fRapidity[1]=2;//-2 2
57     fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
58     fPidProbPion[0]=-1;    fPidProbPion[1]=2;
59     fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
60     fPidProbProton[0]=-1;fPidProbProton[1]=2;
61     fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
62     fLabel=false;
63     fStatus=0;
64     fminTPCclsF=0;
65     fminITScls=0;
66     
67 }
68 //------------------------------
69 //AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
70 //  /* noop */
71 //}
72 //------------------------------
73 bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
74 {
75     //cout<<"AliFemtoESD  cut"<<endl;
76     //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
77     if (fStatus!=0)
78     {
79         //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
80         if ((track->Flags()&fStatus)!=fStatus)
81         {
82           //  cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
83             return false;
84         }
85         
86     }
87     if (fminTPCclsF>track->TPCnclsF())
88     {
89         //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
90         return false;
91     }
92     if (fminITScls>track->ITSncls())
93     {
94         //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
95         return false;
96     }
97         
98     if (fLabel)
99     {
100         //cout<<"labels"<<endl;
101         if(track->Label()<0)
102         {
103             fNTracksFailed++;
104          //   cout<<"No Go Through the cut"<<endl;
105           //  cout<<fLabel<<" Label="<<track->Label()<<endl;
106             return false;
107         }    
108     }
109     if (fCharge!=0)
110     {              
111          //cout<<"AliFemtoESD  cut ch "<<endl;
112           //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
113         if (track->Charge()!= fCharge)  
114         {
115             fNTracksFailed++;
116           //  cout<<"No Go Through the cut"<<endl;
117            // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
118             return false;
119         }
120     }
121     float TEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
122     float TRapidity = 0.5*::log((TEnergy+track->P().z())/(TEnergy-track->P().z()));
123     float Pt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
124     if ((TRapidity<fRapidity[0])||(TRapidity>fRapidity[1]))
125     {
126         fNTracksFailed++;
127         //cout<<"No Go Through the cut"<<endl;   
128         //cout<<fRapidity[0]<<" < Rapidity ="<<TRapidity<<" <"<<fRapidity[1]<<endl;
129         return false;
130     }
131     if ((Pt<fPt[0])||(Pt>fPt[1]))
132     {
133         fNTracksFailed++;
134         //cout<<"No Go Through the cut"<<endl;
135         //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
136         return false;
137     }
138     if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
139     {
140         fNTracksFailed++;
141         //cout<<"No Go Through the cut"<<endl;
142         //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
143         return false;
144     }
145     if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
146     {
147         fNTracksFailed++;
148         //cout<<"No Go Through the cut"<<endl;
149         //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
150         return false;
151     }
152     if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
153     {
154         fNTracksFailed++;
155         //cout<<"No Go Through the cut"<<endl;
156         //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
157         return false;
158     }
159     if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
160     {
161         fNTracksFailed++;
162         //cout<<"No Go Through the cut"<<endl;
163         //cout<<fPidProbProton[0]<<" < p  ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
164         return false;
165     }
166     if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
167     {
168         fNTracksFailed++;
169         //cout<<"No Go Through the cut"<<endl;
170         //cout<<fPidProbMuon[0]<<" <  mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
171         return false;
172     }
173   
174    // cout<<"Go Through the cut"<<endl;
175    // cout<<fLabel<<" Label="<<track->Label()<<endl;
176    // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
177     // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
178     //cout<<fRapidity[0]<<" < Rapidity ="<<TRapidity<<" <"<<fRapidity[1]<<endl;
179     //cout<<fPidProbElectron[0]<<" <  e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
180     //cout<<fPidProbPion[0]<<" <  pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
181     //cout<<fPidProbKaon[0]<<" <  k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
182     //cout<<fPidProbProton[0]<<" <  p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
183     //cout<<fPidProbMuon[0]<<" <  mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
184     fNTracksPassed++ ;
185     return true;
186     
187     
188 }
189 //------------------------------
190 AliFemtoString AliFemtoESDTrackCut::Report()
191 {
192     string Stemp;
193     char Ctemp[100];
194     sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
195     Stemp=Ctemp;
196     sprintf(Ctemp,"Particle charge:\t%d\n",fCharge);
197     Stemp+=Ctemp;
198     sprintf(Ctemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
199     Stemp+=Ctemp;
200     sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
201     Stemp+=Ctemp;
202     sprintf(Ctemp,"Number of tracks which passed:\t%ld  Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
203     Stemp += Ctemp;
204     AliFemtoString returnThis = Stemp;
205     return returnThis;
206 }