1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //_________________________________________________________________________
17 // TTask class for TOF PID.
18 // Use case: start root and execute the following macro
21 // Dynamically link some shared libs
22 if (gClassTable->GetID("AliRun") < 0) {
23 gROOT->LoadMacro("loadlibs.C");
26 // create an instance of the AliTOFPID class
27 // You have to pass the ntuple and cuts filenames
28 AliTOFPID* tofpid=new AliTOFPID("ntuple.root","cuts.root");
30 // option "pp" for pp events (it includes also electron in the analysis)
31 // option "visual" to shows interactively histos
32 // option "asC" or "asEPS" to save canvas in the current dir in .C or .eps format
34 // make a choice: uncomment one of these lines
35 // tofpid->Exec("pp","visual","asC");
36 // tofpid->Exec("pp","novisual","asC");
37 // tofpid->Exec("Pb-Pb","visual","asC");
38 // tofpid->Exec("pp","visual","asC");
39 // tofpid->Exec("pp","novisual","asEPS");
50 //-- Authors: B. Zagreev , F. Pierella
51 //////////////////////////////////////////////////////////////////////////////
64 #include "TPaveLabel.h"
65 #include "TPaveText.h"
67 #include "AliTOFConstants.h"
68 #include "AliTOFPID.h"
69 #include <TClonesArray.h>
86 //____________________________________________________________________________
87 AliTOFPID::AliTOFPID():TTask("AliTOFPID","")
89 // default ctor - set the pointer member vars to zero
101 //____________________________________________________________________________
102 AliTOFPID::AliTOFPID(char* headerFile, char *cutsFile, const Option_t* opt):TTask("AliTOFPID","")
108 fhfile = TFile::Open(headerFile); // connect file with ntuple
109 fcut = TFile::Open(cutsFile); // connect file for cuts
110 foutfileName=headerFile;
115 // add Task to //root/Tasks folder
116 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
117 roottasks->Add(this) ;
119 //____________________________________________________________________________
120 void AliTOFPID::Init(const Option_t* opt)
122 if(strstr(opt,"pp")){
123 if(fcut->GetKey("electron")) felectron = (TCutG*)fcut->Get("electron");
125 if(fcut->GetKey("pion")) fpion = (TCutG*)fcut->Get("pion");
128 if(fcut->GetKey("kaon")) fkaon = (TCutG*)fcut->Get("kaon");
130 if(fcut->GetKey("proton")) fproton = (TCutG*)fcut->Get("proton");
133 fNtuple= (TNtuple*)fhfile->Get("Ntuple"); // get ntuple from file
134 Int_t nvar = fNtuple->GetNvar(); cout <<"N of var.="<< nvar << endl;
135 fNtuple->GetEvent(0);
139 //____________________________________________________________________________
140 AliTOFPID::~AliTOFPID()
143 // dtor (free used memory)
204 //____________________________________________________________________________
205 void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, const Option_t *outputsavemode)
208 // Performs PID for TOF detector
213 ////////// Create histograms /////////////////
214 // for electron only in pp case
220 if(strstr(eventType,"pp")){
221 eleff = new TH1F("eleff","",10,0,0.6);
222 xaxis=eleff->GetYaxis();
223 xaxis->SetLabelSize(.08);
224 elcon = new TH1F("elcon","",10,0,0.6);
225 xaxis=elcon->GetXaxis();
226 xaxis->SetLabelSize(.09);
227 xaxis=elcon->GetYaxis();
228 xaxis->SetLabelSize(.08);
229 elid = new TH1F("elid","Identified electrons",10,0,0.6);
230 elall = new TH1F("elall","Electrons",10,0,0.6);
234 TH1F *pit = new TH1F("pit","",15,0,2.5); //part. with tracks
235 TH1F *pig = new TH1F("pig","",15,0,2.5); //part. in geometry acceptance
236 TH1F *pieff = new TH1F("pieff","",15,0,2.5); //efficiency
237 xaxis=pieff->GetYaxis();
238 xaxis->SetLabelSize(.08);
239 TH1F *picon = new TH1F("picon","",15,0,2.5); //contamination
240 xaxis=picon->GetXaxis();
241 xaxis->SetLabelSize(.09);
242 xaxis=picon->GetYaxis();
243 xaxis->SetLabelSize(.08);
244 TH1F *piid = new TH1F("piid","Identified pions",15,0,2.5);
245 TH1F *piall = new TH1F("piall","Pions",15,0,2.5);
246 TH1F *pigen = new TH1F("pigen","Pions",15,0,2.5);
247 xaxis=pigen->GetXaxis();
248 xaxis->SetLabelSize(.09);
249 pigen->SetXTitle("P?t! (GeV/c)");
250 xaxis->SetTitleSize(.09);
251 xaxis=pigen->GetYaxis();
252 xaxis->SetLabelSize(.08);
253 //pigen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
254 xaxis->SetTitleSize(.09);
257 TH1F *kat = new TH1F("kat","",15,0,2.5);
258 TH1F *kag = new TH1F("kag","",15,0,2.5);
259 TH1F *kaeff = new TH1F("kaeff","",15,0,2.5);
260 xaxis=kaeff->GetYaxis();
261 xaxis->SetLabelSize(.08);
262 TH1F *kacon = new TH1F("kacon","",15,0,2.5);
263 xaxis=kacon->GetXaxis();
264 xaxis->SetLabelSize(.09);
265 xaxis=kacon->GetYaxis();
266 xaxis->SetLabelSize(.08);
267 TH1F *kaid = new TH1F("kaid","Identified kaons",15,0,2.5);
268 TH1F *kaall = new TH1F("kaall","Kaons",15,0,2.5);
269 TH1F *kagen = new TH1F("kagen","Kaons",15,0,2.5);
270 xaxis=kagen->GetXaxis();
271 xaxis->SetLabelSize(.09);
272 kagen->SetXTitle("P?t! (GeV/c)");
273 xaxis->SetTitleSize(.09);
274 xaxis=kagen->GetYaxis();
275 xaxis->SetLabelSize(.08);
276 //kagen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
277 xaxis->SetTitleSize(.09);
280 TH1F *prt = new TH1F("prt","",15,0,4.4);
281 TH1F *prg = new TH1F("prg","",15,0,4.4);
282 TH1F *preff = new TH1F("preff","",15,0,4.4);
283 xaxis=preff->GetYaxis();
284 xaxis->SetLabelSize(.08);
285 TH1F *prcon = new TH1F("prcon","",15,0,4.4);
286 xaxis=prcon->GetXaxis();
287 xaxis->SetLabelSize(.09);
288 xaxis=prcon->GetYaxis();
289 xaxis->SetLabelSize(.08);
290 TH1F *prid = new TH1F("prid","Identified protons",15,0,4.4);
291 TH1F *prall = new TH1F("prall","Protons",15,0,4.4);
292 TH1F *prgen = new TH1F("prgen","Protons",15,0,4.4);
293 xaxis=prgen->GetXaxis();
294 xaxis->SetLabelSize(.09);
295 prgen->SetXTitle("P?t! (GeV/c)");
296 xaxis->SetTitleSize(.09);
297 xaxis=prgen->GetYaxis();
298 xaxis->SetLabelSize(.08);
299 //prgen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
300 xaxis->SetTitleSize(.09);
302 // 2-D histos (extrapolated mass vs momentum)
304 if(strstr(eventType,"pp")){
305 hel = new TH2F("hel","",1000,-.2,1.2,1000,-4.2,0.);
306 hel->SetXTitle("Mass (GeV/c^{2})");
307 hel->SetYTitle("Momentum (GeV/c)");
309 TH2F *hpi = new TH2F("hpi","",1000,-.2,1.2,1000,-4.2,0.);
310 hpi->SetXTitle("Mass (GeV/c^{2})");
311 hpi->SetYTitle("Momentum (GeV/c)");
312 TH2F *hka = new TH2F("hka","",1000,-.2,1.2,1000,-4.2,0.);
313 hka->SetXTitle("Mass (GeV/c^{2})");
314 hka->SetYTitle("Momentum (GeV/c)");
315 TH2F *hpr = new TH2F("hpr","",1000,-.2,1.2,1000,-4.2,0.);
316 hpr->SetXTitle("Mass (GeV/c^{2})");
317 hpr->SetYTitle("Momentum (GeV/c)");
321 Int_t nparticles = (Int_t)fNtuple->GetEntries();
322 cout << " Number of nparticles =" << nparticles << endl;
323 if (nparticles <= 0) return;
325 Float_t ka=0, pi=0, pr=0, kaal=0, pial=0, pral=0;
326 Float_t pitrack=0, pimag=0, pigeom=0;
327 Float_t katrack=0, kamag=0, kageom=0;
328 Float_t prtrack=0, prmag=0, prgeom=0;
329 Float_t pif=0, kaf=0, prf=0, pin=0, kan=0, prn=0;
330 Float_t px, py, pz, x, y, z, pdgcode, mass;
331 Int_t event, matc, imam;
332 Int_t indexOfFile=0, numfile=0;
333 //////// Loop over tracks (particles)///////////////////////
335 for (Int_t i=0; i < nparticles; i++) {
336 fNtuple->GetEvent(i);
337 event=fNtuple->GetLeaf("event")->GetValue();
338 pdgcode=fNtuple->GetLeaf("ipart")->GetValue();
339 mass=fNtuple->GetLeaf("mext")->GetValue(0);
340 matc=fNtuple->GetLeaf("matc")->GetValue(0);
341 imam=fNtuple->GetLeaf("imam")->GetValue(0);
342 px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
343 py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
344 pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
345 x=fNtuple->GetLeaf("xvtx")->GetValue(0);
346 y=fNtuple->GetLeaf("yvtx")->GetValue(0);
347 z=fNtuple->GetLeaf("zvtx")->GetValue(0);
348 Float_t pvtx=TMath::Sqrt(px*px+py*py+pz*pz);
349 Float_t ptvtx=TMath::Sqrt(px*px+py*py);
351 Int_t abspdgcode=TMath::Abs(pdgcode);
354 mt=TMath::Sqrt(AliTOFConstants::fgkKaonMass*AliTOFConstants::fgkKaonMass+px*px+py*py);
357 mt=TMath::Sqrt(AliTOFConstants::fgkProtonMass*AliTOFConstants::fgkProtonMass+px*px+py*py);
360 mt=TMath::Sqrt(AliTOFConstants::fgkElectronMass*AliTOFConstants::fgkElectronMass+px*px+py*py);
363 mt=TMath::Sqrt(AliTOFConstants::fgkPionMass*AliTOFConstants::fgkPionMass+px*px+py*py);
367 if (imam == 0 && pz !=0 && TMath::ATan(TMath::Abs(ptvtx/pz))>TMath::Pi()*45./180.)
368 {//only primary +/-45
369 if (fkaon->IsInside(mass,-pvtx) && matc>2) {
371 if (fTask!=2) kaid->Fill(pvtx); else {kaid->Fill(ptvtx);}
372 if (TMath::Abs(pdgcode)==321) {kaf++; kaeff->Fill(pvtx);} else {kan++; kacon->Fill(pvtx);}
373 } else if (fproton->IsInside(mass,-pvtx) && matc>1) {
375 if (fTask!=2) prid->Fill(pvtx); else
377 if (TMath::Abs(pdgcode)==2212) {prf++; preff->Fill(pvtx);} else {prn++; prcon->Fill(pvtx);}
378 } else if (strstr(eventType,"pp") && felectron->IsInside(mass,-pvtx) && matc>2) {elid->Fill(pvtx);
379 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) eleff->Fill(pvtx); else elcon->Fill(pvtx);
381 //||matc==-4&&fpion->IsInside(mass,-pvtx)
383 if (fTask!=2) piid->Fill(pvtx); else {piid->Fill(ptvtx);}
384 if (TMath::Abs(pdgcode)==211) {pif++; pieff->Fill(pvtx);} else {pin++; picon->Fill(pvtx);}
387 //////////////// Normalization histograms ////////////////////
388 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) {
389 if (fTask!=2) elall->Fill(pvtx); else elall->Fill(ptvtx);
390 if (fTask==1) hel->Fill(mass,-pvtx);
392 } else if (TMath::Abs(pdgcode)==211) {
399 if (matc>-2 || matc==-4) {
405 if (fTask!=2) piall->Fill(pvtx);
407 piall->Fill(ptvtx,1/ptvtx);
409 if (fTask==1) hpi->Fill(mass,-pvtx);
411 } else if (TMath::Abs(pdgcode)==321) {
418 if (matc>-2 || matc==-4) {
424 if (fTask!=2) kaall->Fill(pvtx);
426 kaall->Fill(ptvtx,1/ptvtx);
428 if (fTask==1) hka->Fill(mass,-pvtx);
430 } else if (TMath::Abs(pdgcode)==2212) {
437 if (matc>-2 || matc==-4) {
443 if (fTask!=2) prall->Fill(pvtx);
445 prall->Fill(ptvtx,1/ptvtx);
447 if (fTask==1) hpr->Fill(mass,-pvtx);}
449 }// End of cuts appling
450 }// End of loop over particles
453 cout<< "Pions in 45-135 deg. "<< pial <<" (100%)"<< endl;
454 cout<< "Pions that have track "<< pitrack/pial*100 <<" %"<<endl;
455 cout<< "Magnetic field "<< pimag/pial*100 <<" %"<<endl;
456 cout<< "Geometry efficiency "<< pigeom/pial*100 <<" %"<<endl;
457 cout<< "PID procedure "<< pif/pial*100 <<" %"<<endl;
458 cout<< "Contamination "<< pin/pi*100 <<" %"<<endl;
460 cout<< "Kaons in 45-135 deg. "<< kaal <<" (100%)"<< endl;
461 cout<< "Kaons that have track "<< katrack/kaal*100 <<" %"<<endl;
462 cout<< "Magnetic field "<< kamag/kaal*100 <<" %"<<endl;
463 cout<< "Geometry efficiency "<< kageom/kaal*100 <<" %"<<endl;
464 cout<< "PID procedure(+decays) "<< kaf/kaal*100 <<" %"<<endl;
465 cout<< "Contamination "<< kan/ka*100 <<" %"<<endl;
467 cout<< "Protons in 45-135 deg. "<< pral <<" (100%)"<< endl;
468 cout<< "Protons that have track "<< prtrack/pral*100 <<" %"<<endl;
469 cout<< "Magnetic field "<< prmag/pral*100 <<" %"<<endl;
470 cout<< "Geometry efficiency "<< prgeom/pral*100 <<" %"<<endl;
471 cout<< "PID procedure "<< prf/pral*100 <<" %"<<endl;
472 cout<< "Contamination "<< prn/pr*100 <<" %"<<endl;
474 cout<< "All part. in 45-135 deg. "<< pial+kaal+pral <<" (100%)"<< endl;
475 cout<< "All part. that have track "<< (pitrack+katrack+prtrack)/(pial+kaal+pral)*100 <<" %"<<endl;
476 cout<< "Magnetic field "<< (pimag+kamag+prmag)/(pial+kaal+pral)*100 <<" %"<<endl;
477 cout<< "Geometry efficiency "<< (pigeom+kageom+prgeom)/(pial+kaal+pral)*100 <<" %"<<endl;
478 cout<< "PID procedure "<< (pif+kaf+prf)/(pial+kaal+pral)*100 <<" %"<<endl;
479 cout<< "Contamination "<< (pin+kan+prn)/(pi+ka+pr)*100 <<" %"<<endl;
482 TCanvas *pidCanvas=0;
483 TCanvas *momvsmassCanvas=0;
494 //////////////////////// For fTask 1 ///////////////////////////
496 if (strstr(eventType,"pp")){
497 eleff->Divide(elall);
499 pieff->Divide(piall);
500 kaeff->Divide(kaall);
501 preff->Divide(prall);
508 if (strstr(eventType,"pp")){
514 //Create a canvas, set the view range, show histograms
515 if (indexOfFile==0) {
516 pidCanvas = new TCanvas("pidCanvas","PID ",10,100,800,500);
517 pidCanvas->SetBorderMode(0);
518 pidCanvas->SetBorderSize(0);
519 pidCanvas->SetFillColor(0);
520 pidCanvas->SetFillStyle(0);
521 if (strstr(outputmode,"visual")) pidCanvas->Draw();
522 Float_t pxs=0.25+0.125; //X size of pad
523 Float_t pys=0.5+0.055; //y size of pad
524 tp = new TPad("histo","Histograms",.1,.1,.9,.9);
525 if (strstr(eventType,"Pb-Pb")){
526 //pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
527 pad2 = new TPad("pad2","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
528 pad3 = new TPad("pad3","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
529 pad4 = new TPad("pad4","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
530 //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
531 pad6 = new TPad("pad6","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
532 pad7 = new TPad("pad7","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
533 pad8 = new TPad("pad8","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
536 if (strstr(eventType,"pp")){
537 pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
538 pad2 = new TPad("pad2","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
539 pad3 = new TPad("pad3","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
540 pad4 = new TPad("pad4","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
541 pad5 = new TPad("pad5","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
542 pad6 = new TPad("pad6","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
543 pad7 = new TPad("pad7","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
544 pad8 = new TPad("pad8","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
547 gStyle->SetOptStat(0);
550 tp->SetBorderSize(0);
552 TText *text1= new TText(.1,.2,"Contamination Efficiency");
553 text1->SetTextAngle(90);
554 if (strstr(outputmode,"visual")) text1->Draw();
555 //tp->DrawText(.3,.0,"p (GeV/c");
557 TText *text2= new TText(.8,.0,"p (GeV/c)");
558 if (strstr(outputmode,"visual")) {
565 if (strstr(eventType,"pp")){
566 pad1->SetFillStyle(0);
567 pad1->SetFillColor(10);
569 if (strstr(outputmode,"visual")) pad1->Draw();
571 //eleff->SetLineWidth(15);
572 eleff->SetLineWidth(3);
573 eleff->SetMaximum(1.);
574 if (indexOfFile==0) {
575 //eleff->SetFillColor(33);
576 //eleff->SetFillColor(30);
577 //eleff->SetFillColor(0);
578 //eleff->SetLineColor(4);
579 eleff->SetLineColor(1);
580 if (strstr(outputmode,"visual")) eleff->Draw();}
582 eleff->SetFillStyle(0);
583 eleff->SetFillColor(30);
584 if (indexOfFile==2) {
585 eleff->SetLineColor(3);
586 eleff->SetLineWidth(3);
588 //eleff->SetLineColor(2);
589 eleff->SetLineColor(1);
590 eleff->SetLineStyle(2);}
591 if (strstr(outputmode,"visual")) eleff->Draw("same");}
592 // eleff->Fit("pol1");
593 TPaveLabel *ellab = new TPaveLabel(.42,.85,.52,1.05,"e");
594 if (strstr(outputmode,"visual")) ellab->Draw();
597 pad2->SetFillStyle(0);
598 pad2->SetFillColor(10);
600 if (strstr(outputmode,"visual")) pad2->Draw();
602 pieff->SetLineWidth(3);
603 pieff->SetMaximum(1.);
604 if (indexOfFile==0) {
605 pieff->SetLineColor(1);
606 if (strstr(outputmode,"visual")) pieff->Draw();
608 pieff->SetFillStyle(0);
609 pieff->SetFillColor(30);
610 if (indexOfFile==1) {
611 pieff->SetLineStyle(2);
612 } else if (indexOfFile==2) {
613 pieff->SetLineStyle(3);
615 pieff->SetLineStyle(4);}
616 if (strstr(outputmode,"visual")) pieff->Draw("same");}
617 TPaveLabel *pilab = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
618 if (strstr(outputmode,"visual")) pilab->Draw();
620 pad3->SetFillStyle(0);
621 pad3->SetFillColor(10);
623 if (strstr(outputmode,"visual")) pad3->Draw();
625 kaeff->SetLineWidth(3);
626 kaeff->SetMaximum(1.);
627 if (indexOfFile==0) {
628 kaeff->SetLineColor(1);
629 if (strstr(outputmode,"visual")) kaeff->Draw();
631 kaeff->SetFillStyle(0);
632 kaeff->SetFillColor(30);
633 if (indexOfFile==1) {
634 kaeff->SetLineStyle(2);
635 } else if (indexOfFile==2) {
636 kaeff->SetLineStyle(3);
638 kaeff->SetLineStyle(4);}
639 if (strstr(outputmode,"visual")) kaeff->Draw("same");}
640 TPaveLabel *kalab = new TPaveLabel(1.7,.85,2.2,1.05,"K");
641 if (strstr(outputmode,"visual")) kalab->Draw();
643 pad4->SetFillStyle(0);
644 pad4->SetFillColor(10);
646 if (strstr(outputmode,"visual")) pad4->Draw();
648 preff->SetLineWidth(3);
649 preff->SetMaximum(1.);
650 if (indexOfFile==0) {
651 preff->SetLineColor(1);
652 if (strstr(outputmode,"visual")) preff->Draw();
654 preff->SetFillStyle(0);
655 preff->SetFillColor(30);
656 if (indexOfFile==1) {
657 preff->SetLineStyle(2);
658 } else if (indexOfFile==2) {
659 preff->SetLineStyle(3);
661 preff->SetLineStyle(4);}
662 if (strstr(outputmode,"visual")) preff->Draw("same");}
663 TPaveLabel *prlab = new TPaveLabel(3.2,.85,4.1,1.05,"p");
664 if (strstr(outputmode,"visual")) prlab->Draw();
666 if (strstr(eventType,"pp")){
667 pad5->SetFillStyle(0);
668 pad5->SetFillColor(10);
670 if (strstr(outputmode,"visual")) pad5->Draw();
672 //elcon->SetLineWidth(5);
673 elcon->SetLineWidth(3);
674 elcon->SetMaximum(1.);
675 if (indexOfFile==0) {
676 //elcon->SetFillColor(33);
677 //elcon->SetFillColor(30);
678 //elcon->SetLineColor(4);
679 elcon->SetLineColor(1);
680 if (strstr(outputmode,"visual")) elcon->Draw();}
682 elcon->SetFillStyle(4000);
683 elcon->SetFillColor(30);
684 if (indexOfFile==2) {
685 elcon->SetLineColor(3);
686 elcon->SetLineWidth(3);
688 elcon->SetLineColor(2);
689 elcon->SetLineStyle(2);}
690 if (strstr(outputmode,"visual")) elcon->Draw("same");}
694 pad6->SetFillStyle(0);
695 pad6->SetFillColor(10);
697 if (strstr(outputmode,"visual")) pad6->Draw();
699 picon->SetLineWidth(3);
700 picon->SetMaximum(1.);
701 if (indexOfFile==0) {
702 picon->SetLineColor(1);
703 if (strstr(outputmode,"visual")) picon->Draw();}
705 picon->SetFillStyle(0);
706 picon->SetFillColor(30);
707 if (indexOfFile==1) {
708 picon->SetLineStyle(2);
709 } else if (indexOfFile==2) {
710 picon->SetLineStyle(3);
712 picon->SetLineStyle(4);
714 line = new TLine(0.2,0.85,0.9,0.85);
715 line->SetLineStyle(2);
716 line->SetLineWidth(1);
717 if (strstr(outputmode,"visual")) line->Draw();
718 line = new TLine(0.2,0.65,0.9,0.65);
719 line->SetLineWidth(2);
720 if (strstr(outputmode,"visual")) line->Draw();
721 line = new TLine(0.2,0.45,0.9,0.45);
722 line->SetLineStyle(3);
723 line->SetLineWidth(1);
724 if (strstr(outputmode,"visual")) line->Draw();
725 line = new TLine(0.2,0.25,0.9,0.25);
726 line->SetLineStyle(4);
727 line->SetLineWidth(1);
728 if (strstr(outputmode,"visual")) line->Draw();
729 TPaveLabel *pl = new TPaveLabel(1.1,0.8,1.9,0.9,"100 ps","br");
730 pl->SetFillColor(18);
731 pl->SetTextSize(0.99);
732 if (strstr(outputmode,"visual")) pl->Draw();
733 pl = new TPaveLabel(1.1,0.6,1.9,0.7,"150 ps","br");
734 pl->SetFillColor(18);
735 pl->SetTextSize(0.99);
736 if (strstr(outputmode,"visual")) pl->Draw();
737 pl = new TPaveLabel(1.1,0.4,1.9,0.5,"200 ps","br");
738 pl->SetFillColor(18);
739 pl->SetTextSize(0.99);
740 if (strstr(outputmode,"visual")) pl->Draw();
741 pl = new TPaveLabel(1.1,0.2,1.9,0.3,"300 ps","br");
742 pl->SetFillColor(18);
743 pl->SetTextSize(0.99);
744 if (strstr(outputmode,"visual")) pl->Draw();
746 if (strstr(outputmode,"visual")) picon->Draw("same");}
748 pad7->SetFillStyle(0);
749 pad7->SetFillColor(10);
751 if (strstr(outputmode,"visual")) pad7->Draw();
753 kacon->SetLineWidth(3);
754 kacon->SetMaximum(1.);
755 if (indexOfFile==0) {
756 kacon->SetLineColor(1);
757 if (strstr(outputmode,"visual")) kacon->Draw();}
759 kacon->SetFillStyle(0);
760 kacon->SetFillColor(30);
761 if (indexOfFile==1) {
762 kacon->SetLineStyle(2);
763 } else if (indexOfFile==2) {
764 kacon->SetLineStyle(3);
766 kacon->SetLineStyle(4);}
767 if (strstr(outputmode,"visual")) kacon->Draw("same");}
769 pad8->SetFillStyle(0);
770 pad8->SetFillColor(10);
772 if (strstr(outputmode,"visual")) pad8->Draw();
774 prcon->SetLineWidth(3);
775 prcon->SetMaximum(1.);
776 if (indexOfFile==0) {
777 prcon->SetLineColor(1);
778 if (strstr(outputmode,"visual")) prcon->Draw();}
780 prcon->SetFillStyle(0);
781 prcon->SetFillColor(30);
782 if (indexOfFile==1) {
783 prcon->SetLineStyle(2);
784 } else if (indexOfFile==2) {
785 prcon->SetLineStyle(3);
787 prcon->SetLineStyle(4);}
788 if (strstr(outputmode,"visual")) prcon->Draw("same");}
790 if (indexOfFile==0) {
791 momvsmassCanvas = new TCanvas("momvsmassCanvas","Momentum vs mass disribution",500,10,700,700);
792 momvsmassCanvas->SetFillColor(0);
793 momvsmassCanvas->SetBorderMode(0);
794 gPad->SetFillStyle(0);
795 gPad->SetBorderMode(0);
796 gPad->SetFillColor(0);
797 // gStyle->SetOptStat(11);
798 if (numfile==4) momvsmassCanvas->Divide(1,2,0,0);
799 } else if (indexOfFile==1 && numfile == 4) {
800 momvsmassCanvas->cd(1);
801 TPaveLabel *pl = new TPaveLabel(-0.0376218,-3.03586,0.0979277,-2.70158,"100 ps","br");
802 pl->SetFillColor(18);
803 pl->SetTextSize(0.99);
804 if (strstr(outputmode,"visual")) pl->Draw();
805 } else if (indexOfFile==3 && numfile == 4) {
806 momvsmassCanvas->cd(2);
807 TPaveLabel *pl = new TPaveLabel(-0.0591866,-3.17077,0.076363,-2.86857,"300 ps","br");
808 pl->SetFillColor(18);
809 pl->SetTextSize(0.99);
810 if (strstr(outputmode,"visual")) pl->Draw();
812 if (numfile !=4) momvsmassCanvas->cd();
813 if (numfile !=4 || indexOfFile==1 || indexOfFile==3) {
814 // hpi->PaintStat2(01);
815 hpi->SetMarkerColor(5);
816 if (strstr(outputmode,"visual")) hpi->Draw();
817 if(strstr(eventType,"pp")){
818 hel->SetMarkerColor(2);
819 if (strstr(outputmode,"visual")) hel->Draw("same");
821 hka->SetMarkerColor(4);
822 if (strstr(outputmode,"visual")) hka->Draw("same");
823 hpr->SetMarkerColor(3);
824 if (strstr(outputmode,"visual")) hpr->Draw("same");
825 if (strstr(outputmode,"visual")) {
828 if(strstr(eventType,"pp")){
833 if(strstr(eventType,"pp")){
834 //TPaveText *ep = new TPaveText(-0.05,-0.5,0.05,-0.3);
836 TPaveLabel *ep = new TPaveLabel(.42,.85,.52,1.05,"e");
837 if (strstr(outputmode,"visual")) ep->Draw();
840 TPaveText *pip = new TPaveText(0.15,-1.0,0.25,-0.8);
842 if (strstr(outputmode,"visual")) pip->Draw();
843 TPaveText *kp = new TPaveText(0.5,-2.0,0.6,-1.8);
845 if (strstr(outputmode,"visual")) kp->Draw();
846 TPaveText *prp = new TPaveText(0.9,-2.7,1.0,-2.5);
848 if (strstr(outputmode,"visual")) prp->Draw();
849 // TText *text2= new TText(.59,.06,"Momentum");
850 // text1->SetTextAngle(90);
852 //pidCanvas->DrawText(.1,.2,"Contamination Efficiency");
853 momvsmassCanvas->Update();
854 if(strstr(outputsavemode,"asC")) momvsmassCanvas->Print("momvsmassCanvas.C");
855 if(strstr(outputsavemode,"asEPS")) momvsmassCanvas->Print("momvsmassCanvas.eps");
858 if(strstr(outputsavemode,"asC")) pidCanvas->Print("pidCanvas.C");
859 if(strstr(outputsavemode,"asEPS")) pidCanvas->Print("pidCanvas.eps");
860 char outFileName[100];
861 strcpy(outFileName,"histos");
862 strcat(outFileName,foutfileName);
863 TFile *houtfile = new TFile(outFileName,"recreate");
866 pidCanvas->Write(0,TObject::kOverwrite);
867 momvsmassCanvas->Write(0,TObject::kOverwrite);
869 pit->Write(0,TObject::kOverwrite);
870 pig->Write(0,TObject::kOverwrite);
871 pieff->Write(0,TObject::kOverwrite);
872 picon->Write(0,TObject::kOverwrite);
873 piid->Write(0,TObject::kOverwrite);
874 piall->Write(0,TObject::kOverwrite);
875 pigen->Write(0,TObject::kOverwrite);
876 kat->Write(0,TObject::kOverwrite);
877 kag->Write(0,TObject::kOverwrite);
878 kaeff->Write(0,TObject::kOverwrite);
879 kaid->Write(0,TObject::kOverwrite);
880 kaall->Write(0,TObject::kOverwrite);
881 kagen->Write(0,TObject::kOverwrite);
882 kacon->Write(0,TObject::kOverwrite);
883 prt->Write(0,TObject::kOverwrite);
884 prg->Write(0,TObject::kOverwrite);
885 preff->Write(0,TObject::kOverwrite);
886 prcon->Write(0,TObject::kOverwrite);
887 prid->Write(0,TObject::kOverwrite);
888 prall->Write(0,TObject::kOverwrite);
889 prgen->Write(0,TObject::kOverwrite);
891 hpi->Write(0,TObject::kOverwrite);
892 hka->Write(0,TObject::kOverwrite);
893 hpr->Write(0,TObject::kOverwrite);
895 if (hel && eleff && elcon && elid && elall){
896 hel->Write(0,TObject::kOverwrite);
897 eleff->Write(0,TObject::kOverwrite);
898 elcon->Write(0,TObject::kOverwrite);
899 elid->Write(0,TObject::kOverwrite);
900 elall->Write(0,TObject::kOverwrite);
902 cout << "file " << houtfile << " has been created" << endl;
903 cout << "it contains PID histos and canvas" << endl;
905 houtfile->Write(0,TObject::kOverwrite);
909 if (strstr(outputmode,"novisual")){
913 delete pieff; pieff=0;
914 delete picon; picon=0;
915 delete piid ; piid=0;
916 delete piall; piall=0;
917 delete pigen; pigen=0;
920 delete kaeff; kaeff=0;
922 delete kaall; kaall=0;
923 delete kagen; kagen=0;
924 delete kacon; kacon=0;
927 delete preff; preff=0;
928 delete prcon; prcon=0;
930 delete prall; prall=0;
931 delete prgen; prgen=0;
960 //__________________________________________________________________
961 Bool_t AliTOFPID::operator==( AliTOFPID const & tofrec)const
963 // dummy version of Equal operator.
964 // requested by coding conventions