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