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