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