1 /**************************************************************************
2 * Author: Panos Christakoglou. *
3 * Contributors are mentioned in the code where appropriate. *
5 * Permission to use, copy, modify and distribute this software and its *
6 * documentation strictly for non-commercial purposes is hereby granted *
7 * without fee, provided that the above copyright notice appears in all *
8 * copies and that both the copyright notice and this permission notice *
9 * appear in the supporting documentation. The authors make no claims *
10 * about the suitability of this software for any purpose. It is *
11 * provided "as is" without express or implied warranty. *
12 **************************************************************************/
16 //-----------------------------------------------------------------
17 // AliAnalysisTrackCuts class
18 // This is the class to deal with the event and track level cuts
19 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
20 //-----------------------------------------------------------------
25 #include <TPaveText.h>
32 #include "AliESDtrack.h"
35 #include "AliAnalysisTrackCuts.h"
37 ClassImp(AliAnalysisTrackCuts)
39 //----------------------------------------//
40 AliAnalysisTrackCuts::AliAnalysisTrackCuts()
42 //Default constructor.
43 //Calls the Reset method.
47 //----------------------------------------//
48 AliAnalysisTrackCuts::~AliAnalysisTrackCuts()
53 //----------------------------------------//
54 void AliAnalysisTrackCuts::Reset()
56 //Assigns dummy values to every private member.
99 //----------------------------------------//
100 void AliAnalysisTrackCuts::SetPxRange(Float_t r1, Float_t r2)
102 //Sets the range for the momentum x component.
108 //----------------------------------------//
109 void AliAnalysisTrackCuts::SetPyRange(Float_t r1, Float_t r2)
111 //Sets the range for the momentum y component.
117 //----------------------------------------//
118 void AliAnalysisTrackCuts::SetPzRange(Float_t r1, Float_t r2)
120 //Sets the range for the momentum z component.
126 //----------------------------------------//
127 void AliAnalysisTrackCuts::SetPRange(Float_t r1, Float_t r2)
129 //Sets the range for the momentum.
135 //----------------------------------------//
136 void AliAnalysisTrackCuts::SetPtRange(Float_t r1, Float_t r2)
138 //Sets the range for the teransverse momentum.
144 //----------------------------------------//
145 void AliAnalysisTrackCuts::SetBrRange(Float_t r1, Float_t r2)
147 //Sets the range of the closest approach of the track
148 //to the primary vertex in the r-phi plane.
154 //----------------------------------------//
155 void AliAnalysisTrackCuts::SetBzRange(Float_t r1, Float_t r2)
157 //Sets the range of the closest approach of the track
158 //to the primary vertex in the beam axis.
164 //----------------------------------------//
165 void AliAnalysisTrackCuts::SetEtaRange(Float_t r1, Float_t r2)
167 //Sets the range of the pseudo-rapidity.
173 //----------------------------------------//
174 void AliAnalysisTrackCuts::SetRapRange(Float_t r1, Float_t r2)
176 //Sets the range of the rapidity.
182 //----------------------------------------//
183 void AliAnalysisTrackCuts::GetTrackStats()
185 //Gets the statistics.
186 //fTotalTracks is the total number of tracks.
187 //fAcceptedTracks is the number of accepted tracks after the cuts.
188 AliInfo(Form("Total number of tracks: %d",fTotalTracks));
189 AliInfo(Form("Total number of accepted tracks: %d",fAcceptedTracks));
192 //----------------------------------------//
193 void AliAnalysisTrackCuts::GetPStats()
195 //Gets the momentum statistics.
196 //Prints the percentage of tracks rejected due to this cut.
197 AliInfo(Form("P range: [%f,%f]",fPMin,fPMax));
198 if(fTotalTracks != 0)
199 AliInfo(Form("Tracks rejected: %f",100.0*fP/fTotalTracks));
202 //----------------------------------------//
203 void AliAnalysisTrackCuts::GetPtStats()
205 //Gets the transverse momentum statistics.
206 //Prints the percentage of tracks rejected due to this cut.
207 AliInfo(Form("Pt range: [%f,%f]",fPtMin,fPtMax));
208 if(fTotalTracks != 0)
209 AliInfo(Form("Tracks rejected: %f",100.0*fPt/fTotalTracks));
212 //----------------------------------------//
213 void AliAnalysisTrackCuts::GetPxStats()
215 //Gets the x momentum statistics.
216 //Prints the percentage of tracks rejected due to this cut.
217 AliInfo(Form("Px range: [%f,%f]",fPxMin,fPxMax));
218 if(fTotalTracks != 0)
219 AliInfo(Form("Tracks rejected: %f",100.0*fPx/fTotalTracks));
222 //----------------------------------------//
223 void AliAnalysisTrackCuts::GetPyStats()
225 //Gets the y momentum statistics.
226 //Prints the percentage of tracks rejected due to this cut.
227 AliInfo(Form("Py range: [%f,%f]",fPyMin,fPyMax));
228 if(fTotalTracks != 0)
229 AliInfo(Form("Tracks rejected: %f",100.0*fPy/fTotalTracks));
232 //----------------------------------------//
233 void AliAnalysisTrackCuts::GetPzStats()
235 //Gets the z momentum statistics.
236 //Prints the percentage of tracks rejected due to this cut.
237 AliInfo(Form("Pz range: [%f,%f]",fPzMin,fPzMax));
238 if(fTotalTracks != 0)
239 AliInfo(Form("Tracks rejected: %f",100.0*fPz/fTotalTracks));
242 //----------------------------------------//
243 void AliAnalysisTrackCuts::GetEtaStats()
245 //Gets the pseudo-rapidity statistics.
246 //Prints the percentage of tracks rejected due to this cut.
247 AliInfo(Form("eta range: [%f,%f]",fEtaMin,fEtaMax));
248 if(fTotalTracks != 0)
249 AliInfo(Form("Tracks rejected: %f",100.0*fEta/fTotalTracks));
252 //----------------------------------------//
253 void AliAnalysisTrackCuts::GetRapStats()
255 //Gets the rapidity statistics.
256 //Prints the percentage of tracks rejected due to this cut.
257 AliInfo(Form("y range: [%f,%f]",fRapMin,fRapMax));
258 if(fTotalTracks != 0)
259 AliInfo(Form("Tracks rejected: %f",100.0*fRap/fTotalTracks));
262 //----------------------------------------//
263 void AliAnalysisTrackCuts::GetBrStats()
265 //Gets the statistics fro the closest distance of
266 //the track to the primary vertex in the r-phi plane.
267 //Prints the percentage of tracks rejected due to this cut.
268 AliInfo(Form("br range: [%f,%f]",fBrMin,fBrMax));
269 if(fTotalTracks != 0)
270 AliInfo(Form("Tracks rejected: %f",100.0*fbr/fTotalTracks));
273 //----------------------------------------//
274 void AliAnalysisTrackCuts::GetBzStats()
276 //Gets the statistics fro the closest distance of
277 //the track to the primary vertex in the beam axis.
278 //Prints the percentage of tracks rejected due to this cut.
279 AliInfo(Form("bz range: [%f,%f]",fBzMin,fBzMax));
280 if(fTotalTracks != 0)
281 AliInfo(Form("Tracks rejected: %f",100.0*fbz/fTotalTracks));
285 //----------------------------------------//
286 Bool_t AliAnalysisTrackCuts::IsAccepted(AliESD *esd ,AliESDtrack *esdtrack)
288 //Returns true if the tracks is accepted otherwise false.
291 //momentum related calculations
293 esdtrack->GetPxPyPz(p);
294 Float_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
295 Float_t pt = sqrt(pow(p[0],2) + pow(p[1],2));
296 Float_t energy = sqrt(pow(esdtrack->GetMass(),2) + pow(momentum,2));
298 //y-eta related calculations
299 Float_t eta = 0.5*log((momentum - p[2])/(momentum + p[2]));
300 Float_t y = 0.5*log((energy - p[2])/(energy + p[2]));
302 //impact parameter related calculations
303 Double_t trackPosition[3];
304 esdtrack->GetXYZ(trackPosition);
305 const AliESDVertex * vertexIn = esd->GetVertex();
306 Double_t vertexPosition[3];
307 vertexIn->GetXYZ(vertexPosition);
308 for (Int_t ii=0; ii<3; ii++) trackPosition[ii] -= vertexPosition[ii];
310 Float_t br = Float_t(TMath::Sqrt(pow(trackPosition[0],2) + pow(trackPosition[1],2)));
311 Float_t bz = Float_t(TMath::Abs(trackPosition[2]));
313 if((momentum < fPMin) || (momentum > fPMax))
318 if((pt < fPtMin) || (pt > fPtMax))
323 if((p[0] < fPxMin) || (p[0] > fPxMax))
328 if((p[1] < fPyMin) || (p[1] > fPyMax))
333 if((p[2] < fPzMin) || (p[2] > fPzMax))
338 if((br < fBrMin) || (br > fBrMax))
343 if((bz < fBzMin) || (bz > fBzMax))
348 if((eta < fEtaMin) || (eta > fEtaMax))
353 if((y < fRapMin) || (y > fRapMax))
365 //----------------------------------------//
366 TPaveText *AliAnalysisTrackCuts::GetTrackCuts()
368 //Shows a TPaveText with all the track cuts stats.
369 TCanvas *ccuts2 = new TCanvas("ccuts2","Track cuts",410,10,400,400);
370 ccuts2->SetFillColor(10);
371 ccuts2->SetHighLightColor(10);
373 TPaveText *pave = new TPaveText(0.01,0.01,0.98,0.98);
374 pave->SetFillColor(3);
377 TLine *l1 = pave->AddLine(0,0.89,1,0.89);
379 TLine *l2 = pave->AddLine(0,0.79,1,0.79);
381 TLine *l3 = pave->AddLine(0,0.69,1,0.69);
383 TLine *l4 = pave->AddLine(0,0.59,1,0.59);
385 TLine *l5 = pave->AddLine(0,0.49,1,0.49);
387 TLine *l6 = pave->AddLine(0,0.39,1,0.39);
389 TLine *l7 = pave->AddLine(0,0.29,1,0.29);
391 TLine *l8 = pave->AddLine(0,0.19,1,0.19);
393 TLine *l9 = pave->AddLine(0,0.09,1,0.09);
396 sprintf(cutName,"Total number of tracks: %d",fTotalTracks);
397 TText *t1 = pave->AddText(cutName);
399 t1->SetTextSize(0.04);
400 t1->SetTextAlign(11);
402 sprintf(cutName,"Total number of accepted tracks: %d",fAcceptedTracks);
403 t1 = pave->AddText(cutName);
405 t1->SetTextSize(0.04);
406 t1->SetTextAlign(11);
408 sprintf(cutName,"P range: [%f,%f]",fPMin,fPMax);
409 t1 = pave->AddText(cutName);
411 t1->SetTextSize(0.04);
412 t1->SetTextAlign(11);
413 sprintf(cutName,"Tracks rejected: %f",100.0*fP/fTotalTracks);
414 t1 = pave->AddText(cutName);
416 t1->SetTextSize(0.04);
417 t1->SetTextAlign(11);
419 sprintf(cutName,"Pt range: [%f,%f]",fPtMin,fPtMax);
420 t1 = pave->AddText(cutName);
422 t1->SetTextSize(0.04);
423 t1->SetTextAlign(11);
424 sprintf(cutName,"Tracks rejected: %f",100.0*fPt/fTotalTracks);
425 t1 = pave->AddText(cutName);
427 t1->SetTextSize(0.04);
428 t1->SetTextAlign(11);
430 sprintf(cutName,"Px range: [%f,%f]",fPxMin,fPxMax);
431 t1 = pave->AddText(cutName);
433 t1->SetTextSize(0.04);
434 t1->SetTextAlign(11);
435 sprintf(cutName,"Tracks rejected: %f",100.0*fPx/fTotalTracks);
436 t1 = pave->AddText(cutName);
438 t1->SetTextSize(0.04);
439 t1->SetTextAlign(11);
441 sprintf(cutName,"Py range: [%f,%f]",fPyMin,fPyMax);
442 t1 = pave->AddText(cutName);
444 t1->SetTextSize(0.04);
445 t1->SetTextAlign(11);
446 sprintf(cutName,"Tracks rejected: %f",100.0*fPy/fTotalTracks);
447 t1 = pave->AddText(cutName);
449 t1->SetTextSize(0.04);
450 t1->SetTextAlign(11);
452 sprintf(cutName,"Pz range: [%f,%f]",fPzMin,fPzMax);
453 t1 = pave->AddText(cutName);
455 t1->SetTextSize(0.04);
456 t1->SetTextAlign(11);
457 sprintf(cutName,"Tracks rejected: %f",100.0*fPz/fTotalTracks);
458 t1 = pave->AddText(cutName);
460 t1->SetTextSize(0.04);
461 t1->SetTextAlign(11);
463 sprintf(cutName,"br range: [%f,%f]",fBrMin,fBrMax);
464 t1 = pave->AddText(cutName);
466 t1->SetTextSize(0.04);
467 t1->SetTextAlign(11);
468 sprintf(cutName,"Tracks rejected: %f",100.0*fbr/fTotalTracks);
469 t1 = pave->AddText(cutName);
471 t1->SetTextSize(0.04);
472 t1->SetTextAlign(11);
474 sprintf(cutName,"bz range: [%f,%f]",fBzMin,fBzMax);
475 t1 = pave->AddText(cutName);
477 t1->SetTextSize(0.04);
478 t1->SetTextAlign(11);
479 sprintf(cutName,"Tracks rejected: %f",100.0*fbz/fTotalTracks);
480 t1 = pave->AddText(cutName);
482 t1->SetTextSize(0.04);
483 t1->SetTextAlign(11);
485 sprintf(cutName,"eta range: [%f,%f]",fEtaMin,fEtaMax);
486 t1 = pave->AddText(cutName);
488 t1->SetTextSize(0.04);
489 t1->SetTextAlign(11);
490 sprintf(cutName,"Tracks rejected: %f",100.0*fEta/fTotalTracks);
491 t1 = pave->AddText(cutName);
493 t1->SetTextSize(0.04);
494 t1->SetTextAlign(11);
496 sprintf(cutName,"y range: [%f,%f]",fRapMin,fRapMax);
497 t1 = pave->AddText(cutName);
499 t1->SetTextSize(0.04);
500 t1->SetTextAlign(11);
501 sprintf(cutName,"Tracks rejected: %f",100.0*fRap/fTotalTracks);
502 t1 = pave->AddText(cutName);
504 t1->SetTextSize(0.04);
505 t1->SetTextAlign(11);
510 //----------------------------------------//
511 void AliAnalysisTrackCuts::PrintTrackCuts()
513 //Prints the track cut stats.
514 //GetTrackCuts()->Draw();
516 AliInfo(Form("**************TRACK CUTS**************"));
536 AliInfo(Form("**************************************"));