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","")
104 fhfile = TFile::Open(headerFile); // connect file with ntuple
105 fcut = TFile::Open(cutsFile); // connect file for cuts
106 foutfileName=headerFile;
109 // add Task to //root/Tasks folder
110 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
111 roottasks->Add(this) ;
113 //____________________________________________________________________________
114 void AliTOFPID::Init(const Option_t* opt)
116 if(strstr(opt,"pp")){
117 if(fcut->GetKey("electron")) felectron = (TCutG*)fcut->Get("electron");
119 if(fcut->GetKey("pion")) fpion = (TCutG*)fcut->Get("pion");
122 if(fcut->GetKey("kaon")) fkaon = (TCutG*)fcut->Get("kaon");
124 if(fcut->GetKey("proton")) fproton = (TCutG*)fcut->Get("proton");
127 fNtuple= (TNtuple*)fhfile->Get("Ntuple"); // get ntuple from file
128 Int_t nvar = fNtuple->GetNvar(); cout <<"N of var.="<< nvar << endl;
129 fNtuple->GetEvent(0);
133 //____________________________________________________________________________
134 AliTOFPID::~AliTOFPID()
137 // dtor (free used memory)
198 //____________________________________________________________________________
199 void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, const Option_t *outputsavemode)
202 // Performs PID for TOF detector
207 ////////// Create histograms /////////////////
208 // for electron only in pp case
214 if(strstr(eventType,"pp")){
215 eleff = new TH1F("eleff","",10,0,0.6);
216 xaxis=eleff->GetYaxis();
217 xaxis->SetLabelSize(.08);
218 elcon = new TH1F("elcon","",10,0,0.6);
219 xaxis=elcon->GetXaxis();
220 xaxis->SetLabelSize(.09);
221 xaxis=elcon->GetYaxis();
222 xaxis->SetLabelSize(.08);
223 elid = new TH1F("elid","Identified electrons",10,0,0.6);
224 elall = new TH1F("elall","Electrons",10,0,0.6);
228 TH1F *pit = new TH1F("pit","",15,0,2.5); //part. with tracks
229 TH1F *pig = new TH1F("pig","",15,0,2.5); //part. in geometry acceptance
230 TH1F *pieff = new TH1F("pieff","",15,0,2.5); //efficiency
231 xaxis=pieff->GetYaxis();
232 xaxis->SetLabelSize(.08);
233 TH1F *picon = new TH1F("picon","",15,0,2.5); //contamination
234 xaxis=picon->GetXaxis();
235 xaxis->SetLabelSize(.09);
236 xaxis=picon->GetYaxis();
237 xaxis->SetLabelSize(.08);
238 TH1F *piid = new TH1F("piid","Identified pions",15,0,2.5);
239 TH1F *piall = new TH1F("piall","Pions",15,0,2.5);
240 TH1F *pigen = new TH1F("pigen","Pions",15,0,2.5);
241 xaxis=pigen->GetXaxis();
242 xaxis->SetLabelSize(.09);
243 pigen->SetXTitle("P?t! (GeV/c)");
244 xaxis->SetTitleSize(.09);
245 xaxis=pigen->GetYaxis();
246 xaxis->SetLabelSize(.08);
247 //pigen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
248 xaxis->SetTitleSize(.09);
251 TH1F *kat = new TH1F("kat","",15,0,2.5);
252 TH1F *kag = new TH1F("kag","",15,0,2.5);
253 TH1F *kaeff = new TH1F("kaeff","",15,0,2.5);
254 xaxis=kaeff->GetYaxis();
255 xaxis->SetLabelSize(.08);
256 TH1F *kacon = new TH1F("kacon","",15,0,2.5);
257 xaxis=kacon->GetXaxis();
258 xaxis->SetLabelSize(.09);
259 xaxis=kacon->GetYaxis();
260 xaxis->SetLabelSize(.08);
261 TH1F *kaid = new TH1F("kaid","Identified kaons",15,0,2.5);
262 TH1F *kaall = new TH1F("kaall","Kaons",15,0,2.5);
263 TH1F *kagen = new TH1F("kagen","Kaons",15,0,2.5);
264 xaxis=kagen->GetXaxis();
265 xaxis->SetLabelSize(.09);
266 kagen->SetXTitle("P?t! (GeV/c)");
267 xaxis->SetTitleSize(.09);
268 xaxis=kagen->GetYaxis();
269 xaxis->SetLabelSize(.08);
270 //kagen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
271 xaxis->SetTitleSize(.09);
274 TH1F *prt = new TH1F("prt","",15,0,4.4);
275 TH1F *prg = new TH1F("prg","",15,0,4.4);
276 TH1F *preff = new TH1F("preff","",15,0,4.4);
277 xaxis=preff->GetYaxis();
278 xaxis->SetLabelSize(.08);
279 TH1F *prcon = new TH1F("prcon","",15,0,4.4);
280 xaxis=prcon->GetXaxis();
281 xaxis->SetLabelSize(.09);
282 xaxis=prcon->GetYaxis();
283 xaxis->SetLabelSize(.08);
284 TH1F *prid = new TH1F("prid","Identified protons",15,0,4.4);
285 TH1F *prall = new TH1F("prall","Protons",15,0,4.4);
286 TH1F *prgen = new TH1F("prgen","Protons",15,0,4.4);
287 xaxis=prgen->GetXaxis();
288 xaxis->SetLabelSize(.09);
289 prgen->SetXTitle("P?t! (GeV/c)");
290 xaxis->SetTitleSize(.09);
291 xaxis=prgen->GetYaxis();
292 xaxis->SetLabelSize(.08);
293 //prgen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
294 xaxis->SetTitleSize(.09);
296 // 2-D histos (extrapolated mass vs momentum)
298 if(strstr(eventType,"pp")){
299 hel = new TH2F("hel","",1000,-.2,1.2,1000,-4.2,0.);
300 hel->SetXTitle("Mass (GeV/c^{2})");
301 hel->SetYTitle("Momentum (GeV/c)");
303 TH2F *hpi = new TH2F("hpi","",1000,-.2,1.2,1000,-4.2,0.);
304 hpi->SetXTitle("Mass (GeV/c^{2})");
305 hpi->SetYTitle("Momentum (GeV/c)");
306 TH2F *hka = new TH2F("hka","",1000,-.2,1.2,1000,-4.2,0.);
307 hka->SetXTitle("Mass (GeV/c^{2})");
308 hka->SetYTitle("Momentum (GeV/c)");
309 TH2F *hpr = new TH2F("hpr","",1000,-.2,1.2,1000,-4.2,0.);
310 hpr->SetXTitle("Mass (GeV/c^{2})");
311 hpr->SetYTitle("Momentum (GeV/c)");
315 Int_t nparticles = (Int_t)fNtuple->GetEntries();
316 cout << " Number of nparticles =" << nparticles << endl;
317 if (nparticles <= 0) return;
319 Float_t ka=0, pi=0, pr=0, kaal=0, pial=0, pral=0;
320 Float_t pitrack=0, pimag=0, pigeom=0;
321 Float_t katrack=0, kamag=0, kageom=0;
322 Float_t prtrack=0, prmag=0, prgeom=0;
323 Float_t pif=0, kaf=0, prf=0, pin=0, kan=0, prn=0;
324 Float_t px, py, pz, x, y, z, pdgcode, mass;
325 Int_t event, matc, imam;
326 Int_t indexOfFile=0, numfile=0;
327 //////// Loop over tracks (particles)///////////////////////
329 for (Int_t i=0; i < nparticles; i++) {
330 fNtuple->GetEvent(i);
331 event=fNtuple->GetLeaf("event")->GetValue();
332 pdgcode=fNtuple->GetLeaf("ipart")->GetValue();
333 mass=fNtuple->GetLeaf("mext")->GetValue(0);
334 matc=fNtuple->GetLeaf("matc")->GetValue(0);
335 imam=fNtuple->GetLeaf("imam")->GetValue(0);
336 px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
337 py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
338 pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
339 x=fNtuple->GetLeaf("xvtx")->GetValue(0);
340 y=fNtuple->GetLeaf("yvtx")->GetValue(0);
341 z=fNtuple->GetLeaf("zvtx")->GetValue(0);
342 Float_t pvtx=TMath::Sqrt(px*px+py*py+pz*pz);
343 Float_t ptvtx=TMath::Sqrt(px*px+py*py);
345 Int_t abspdgcode=TMath::Abs(pdgcode);
348 mt=TMath::Sqrt(AliTOFConstants::fgkKaonMass*AliTOFConstants::fgkKaonMass+px*px+py*py);
351 mt=TMath::Sqrt(AliTOFConstants::fgkProtonMass*AliTOFConstants::fgkProtonMass+px*px+py*py);
354 mt=TMath::Sqrt(AliTOFConstants::fgkElectronMass*AliTOFConstants::fgkElectronMass+px*px+py*py);
357 mt=TMath::Sqrt(AliTOFConstants::fgkPionMass*AliTOFConstants::fgkPionMass+px*px+py*py);
361 if (imam == 0 && pz !=0 && TMath::ATan(TMath::Abs(ptvtx/pz))>TMath::Pi()*45./180.)
362 {//only primary +/-45
363 if (fkaon->IsInside(mass,-pvtx) && matc>2) {
365 if (fTask!=2) kaid->Fill(pvtx); else {kaid->Fill(ptvtx);}
366 if (TMath::Abs(pdgcode)==321) {kaf++; kaeff->Fill(pvtx);} else {kan++; kacon->Fill(pvtx);}
367 } else if (fproton->IsInside(mass,-pvtx) && matc>1) {
369 if (fTask!=2) prid->Fill(pvtx); else
371 if (TMath::Abs(pdgcode)==2212) {prf++; preff->Fill(pvtx);} else {prn++; prcon->Fill(pvtx);}
372 } else if (strstr(eventType,"pp") && felectron->IsInside(mass,-pvtx) && matc>2) {elid->Fill(pvtx);
373 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) eleff->Fill(pvtx); else elcon->Fill(pvtx);
375 //||matc==-4&&fpion->IsInside(mass,-pvtx)
377 if (fTask!=2) piid->Fill(pvtx); else {piid->Fill(ptvtx);}
378 if (TMath::Abs(pdgcode)==211) {pif++; pieff->Fill(pvtx);} else {pin++; picon->Fill(pvtx);}
381 //////////////// Normalization histograms ////////////////////
382 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) {
383 if (fTask!=2) elall->Fill(pvtx); else elall->Fill(ptvtx);
384 if (fTask==1) hel->Fill(mass,-pvtx);
386 } else if (TMath::Abs(pdgcode)==211) {
393 if (matc>-2 || matc==-4) {
399 if (fTask!=2) piall->Fill(pvtx);
401 piall->Fill(ptvtx,1/ptvtx);
403 if (fTask==1) hpi->Fill(mass,-pvtx);
405 } else if (TMath::Abs(pdgcode)==321) {
412 if (matc>-2 || matc==-4) {
418 if (fTask!=2) kaall->Fill(pvtx);
420 kaall->Fill(ptvtx,1/ptvtx);
422 if (fTask==1) hka->Fill(mass,-pvtx);
424 } else if (TMath::Abs(pdgcode)==2212) {
431 if (matc>-2 || matc==-4) {
437 if (fTask!=2) prall->Fill(pvtx);
439 prall->Fill(ptvtx,1/ptvtx);
441 if (fTask==1) hpr->Fill(mass,-pvtx);}
443 }// End of cuts appling
444 }// End of loop over particles
447 cout<< "Pions in 45-135 deg. "<< pial <<" (100%)"<< endl;
448 cout<< "Pions that have track "<< pitrack/pial*100 <<" %"<<endl;
449 cout<< "Magnetic field "<< pimag/pial*100 <<" %"<<endl;
450 cout<< "Geometry efficiency "<< pigeom/pial*100 <<" %"<<endl;
451 cout<< "PID procedure "<< pif/pial*100 <<" %"<<endl;
452 cout<< "Contamination "<< pin/pi*100 <<" %"<<endl;
454 cout<< "Kaons in 45-135 deg. "<< kaal <<" (100%)"<< endl;
455 cout<< "Kaons that have track "<< katrack/kaal*100 <<" %"<<endl;
456 cout<< "Magnetic field "<< kamag/kaal*100 <<" %"<<endl;
457 cout<< "Geometry efficiency "<< kageom/kaal*100 <<" %"<<endl;
458 cout<< "PID procedure(+decays) "<< kaf/kaal*100 <<" %"<<endl;
459 cout<< "Contamination "<< kan/ka*100 <<" %"<<endl;
461 cout<< "Protons in 45-135 deg. "<< pral <<" (100%)"<< endl;
462 cout<< "Protons that have track "<< prtrack/pral*100 <<" %"<<endl;
463 cout<< "Magnetic field "<< prmag/pral*100 <<" %"<<endl;
464 cout<< "Geometry efficiency "<< prgeom/pral*100 <<" %"<<endl;
465 cout<< "PID procedure "<< prf/pral*100 <<" %"<<endl;
466 cout<< "Contamination "<< prn/pr*100 <<" %"<<endl;
468 cout<< "All part. in 45-135 deg. "<< pial+kaal+pral <<" (100%)"<< endl;
469 cout<< "All part. that have track "<< (pitrack+katrack+prtrack)/(pial+kaal+pral)*100 <<" %"<<endl;
470 cout<< "Magnetic field "<< (pimag+kamag+prmag)/(pial+kaal+pral)*100 <<" %"<<endl;
471 cout<< "Geometry efficiency "<< (pigeom+kageom+prgeom)/(pial+kaal+pral)*100 <<" %"<<endl;
472 cout<< "PID procedure "<< (pif+kaf+prf)/(pial+kaal+pral)*100 <<" %"<<endl;
473 cout<< "Contamination "<< (pin+kan+prn)/(pi+ka+pr)*100 <<" %"<<endl;
476 TCanvas *pidCanvas=0;
477 TCanvas *momvsmassCanvas=0;
488 //////////////////////// For fTask 1 ///////////////////////////
490 if (strstr(eventType,"pp")){
491 eleff->Divide(elall);
493 pieff->Divide(piall);
494 kaeff->Divide(kaall);
495 preff->Divide(prall);
502 if (strstr(eventType,"pp")){
508 //Create a canvas, set the view range, show histograms
509 if (indexOfFile==0) {
510 pidCanvas = new TCanvas("pidCanvas","PID ",10,100,800,500);
511 pidCanvas->SetBorderMode(0);
512 pidCanvas->SetBorderSize(0);
513 pidCanvas->SetFillColor(0);
514 pidCanvas->SetFillStyle(0);
515 if (strstr(outputmode,"visual")) pidCanvas->Draw();
516 Float_t pxs=0.25+0.125; //X size of pad
517 Float_t pys=0.5+0.055; //y size of pad
518 tp = new TPad("histo","Histograms",.1,.1,.9,.9);
519 if (strstr(eventType,"Pb-Pb")){
520 //pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
521 pad2 = new TPad("pad2","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
522 pad3 = new TPad("pad3","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
523 pad4 = new TPad("pad4","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
524 //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
525 pad6 = new TPad("pad6","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
526 pad7 = new TPad("pad7","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
527 pad8 = new TPad("pad8","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
530 if (strstr(eventType,"pp")){
531 pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
532 pad2 = new TPad("pad2","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
533 pad3 = new TPad("pad3","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
534 pad4 = new TPad("pad4","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
535 pad5 = new TPad("pad5","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
536 pad6 = new TPad("pad6","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
537 pad7 = new TPad("pad7","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
538 pad8 = new TPad("pad8","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
541 gStyle->SetOptStat(0);
544 tp->SetBorderSize(0);
546 TText *text1= new TText(.1,.2,"Contamination Efficiency");
547 text1->SetTextAngle(90);
548 if (strstr(outputmode,"visual")) text1->Draw();
549 //tp->DrawText(.3,.0,"p (GeV/c");
551 TText *text2= new TText(.8,.0,"p (GeV/c)");
552 if (strstr(outputmode,"visual")) {
559 if (strstr(eventType,"pp")){
560 pad1->SetFillStyle(0);
561 pad1->SetFillColor(10);
563 if (strstr(outputmode,"visual")) pad1->Draw();
565 //eleff->SetLineWidth(15);
566 eleff->SetLineWidth(3);
567 eleff->SetMaximum(1.);
568 if (indexOfFile==0) {
569 //eleff->SetFillColor(33);
570 //eleff->SetFillColor(30);
571 //eleff->SetFillColor(0);
572 //eleff->SetLineColor(4);
573 eleff->SetLineColor(1);
574 if (strstr(outputmode,"visual")) eleff->Draw();}
576 eleff->SetFillStyle(0);
577 eleff->SetFillColor(30);
578 if (indexOfFile==2) {
579 eleff->SetLineColor(3);
580 eleff->SetLineWidth(3);
582 //eleff->SetLineColor(2);
583 eleff->SetLineColor(1);
584 eleff->SetLineStyle(2);}
585 if (strstr(outputmode,"visual")) eleff->Draw("same");}
586 // eleff->Fit("pol1");
587 TPaveLabel *ellab = new TPaveLabel(.42,.85,.52,1.05,"e");
588 if (strstr(outputmode,"visual")) ellab->Draw();
591 pad2->SetFillStyle(0);
592 pad2->SetFillColor(10);
594 if (strstr(outputmode,"visual")) pad2->Draw();
596 pieff->SetLineWidth(3);
597 pieff->SetMaximum(1.);
598 if (indexOfFile==0) {
599 pieff->SetLineColor(1);
600 if (strstr(outputmode,"visual")) pieff->Draw();
602 pieff->SetFillStyle(0);
603 pieff->SetFillColor(30);
604 if (indexOfFile==1) {
605 pieff->SetLineStyle(2);
606 } else if (indexOfFile==2) {
607 pieff->SetLineStyle(3);
609 pieff->SetLineStyle(4);}
610 if (strstr(outputmode,"visual")) pieff->Draw("same");}
611 TPaveLabel *pilab = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
612 if (strstr(outputmode,"visual")) pilab->Draw();
614 pad3->SetFillStyle(0);
615 pad3->SetFillColor(10);
617 if (strstr(outputmode,"visual")) pad3->Draw();
619 kaeff->SetLineWidth(3);
620 kaeff->SetMaximum(1.);
621 if (indexOfFile==0) {
622 kaeff->SetLineColor(1);
623 if (strstr(outputmode,"visual")) kaeff->Draw();
625 kaeff->SetFillStyle(0);
626 kaeff->SetFillColor(30);
627 if (indexOfFile==1) {
628 kaeff->SetLineStyle(2);
629 } else if (indexOfFile==2) {
630 kaeff->SetLineStyle(3);
632 kaeff->SetLineStyle(4);}
633 if (strstr(outputmode,"visual")) kaeff->Draw("same");}
634 TPaveLabel *kalab = new TPaveLabel(1.7,.85,2.2,1.05,"K");
635 if (strstr(outputmode,"visual")) kalab->Draw();
637 pad4->SetFillStyle(0);
638 pad4->SetFillColor(10);
640 if (strstr(outputmode,"visual")) pad4->Draw();
642 preff->SetLineWidth(3);
643 preff->SetMaximum(1.);
644 if (indexOfFile==0) {
645 preff->SetLineColor(1);
646 if (strstr(outputmode,"visual")) preff->Draw();
648 preff->SetFillStyle(0);
649 preff->SetFillColor(30);
650 if (indexOfFile==1) {
651 preff->SetLineStyle(2);
652 } else if (indexOfFile==2) {
653 preff->SetLineStyle(3);
655 preff->SetLineStyle(4);}
656 if (strstr(outputmode,"visual")) preff->Draw("same");}
657 TPaveLabel *prlab = new TPaveLabel(3.2,.85,4.1,1.05,"p");
658 if (strstr(outputmode,"visual")) prlab->Draw();
660 if (strstr(eventType,"pp")){
661 pad5->SetFillStyle(0);
662 pad5->SetFillColor(10);
664 if (strstr(outputmode,"visual")) pad5->Draw();
666 //elcon->SetLineWidth(5);
667 elcon->SetLineWidth(3);
668 elcon->SetMaximum(1.);
669 if (indexOfFile==0) {
670 //elcon->SetFillColor(33);
671 //elcon->SetFillColor(30);
672 //elcon->SetLineColor(4);
673 elcon->SetLineColor(1);
674 if (strstr(outputmode,"visual")) elcon->Draw();}
676 elcon->SetFillStyle(4000);
677 elcon->SetFillColor(30);
678 if (indexOfFile==2) {
679 elcon->SetLineColor(3);
680 elcon->SetLineWidth(3);
682 elcon->SetLineColor(2);
683 elcon->SetLineStyle(2);}
684 if (strstr(outputmode,"visual")) elcon->Draw("same");}
688 pad6->SetFillStyle(0);
689 pad6->SetFillColor(10);
691 if (strstr(outputmode,"visual")) pad6->Draw();
693 picon->SetLineWidth(3);
694 picon->SetMaximum(1.);
695 if (indexOfFile==0) {
696 picon->SetLineColor(1);
697 if (strstr(outputmode,"visual")) picon->Draw();}
699 picon->SetFillStyle(0);
700 picon->SetFillColor(30);
701 if (indexOfFile==1) {
702 picon->SetLineStyle(2);
703 } else if (indexOfFile==2) {
704 picon->SetLineStyle(3);
706 picon->SetLineStyle(4);
708 line = new TLine(0.2,0.85,0.9,0.85);
709 line->SetLineStyle(2);
710 line->SetLineWidth(1);
711 if (strstr(outputmode,"visual")) line->Draw();
712 line = new TLine(0.2,0.65,0.9,0.65);
713 line->SetLineWidth(2);
714 if (strstr(outputmode,"visual")) line->Draw();
715 line = new TLine(0.2,0.45,0.9,0.45);
716 line->SetLineStyle(3);
717 line->SetLineWidth(1);
718 if (strstr(outputmode,"visual")) line->Draw();
719 line = new TLine(0.2,0.25,0.9,0.25);
720 line->SetLineStyle(4);
721 line->SetLineWidth(1);
722 if (strstr(outputmode,"visual")) line->Draw();
723 TPaveLabel *pl = new TPaveLabel(1.1,0.8,1.9,0.9,"100 ps","br");
724 pl->SetFillColor(18);
725 pl->SetTextSize(0.99);
726 if (strstr(outputmode,"visual")) pl->Draw();
727 pl = new TPaveLabel(1.1,0.6,1.9,0.7,"150 ps","br");
728 pl->SetFillColor(18);
729 pl->SetTextSize(0.99);
730 if (strstr(outputmode,"visual")) pl->Draw();
731 pl = new TPaveLabel(1.1,0.4,1.9,0.5,"200 ps","br");
732 pl->SetFillColor(18);
733 pl->SetTextSize(0.99);
734 if (strstr(outputmode,"visual")) pl->Draw();
735 pl = new TPaveLabel(1.1,0.2,1.9,0.3,"300 ps","br");
736 pl->SetFillColor(18);
737 pl->SetTextSize(0.99);
738 if (strstr(outputmode,"visual")) pl->Draw();
740 if (strstr(outputmode,"visual")) picon->Draw("same");}
742 pad7->SetFillStyle(0);
743 pad7->SetFillColor(10);
745 if (strstr(outputmode,"visual")) pad7->Draw();
747 kacon->SetLineWidth(3);
748 kacon->SetMaximum(1.);
749 if (indexOfFile==0) {
750 kacon->SetLineColor(1);
751 if (strstr(outputmode,"visual")) kacon->Draw();}
753 kacon->SetFillStyle(0);
754 kacon->SetFillColor(30);
755 if (indexOfFile==1) {
756 kacon->SetLineStyle(2);
757 } else if (indexOfFile==2) {
758 kacon->SetLineStyle(3);
760 kacon->SetLineStyle(4);}
761 if (strstr(outputmode,"visual")) kacon->Draw("same");}
763 pad8->SetFillStyle(0);
764 pad8->SetFillColor(10);
766 if (strstr(outputmode,"visual")) pad8->Draw();
768 prcon->SetLineWidth(3);
769 prcon->SetMaximum(1.);
770 if (indexOfFile==0) {
771 prcon->SetLineColor(1);
772 if (strstr(outputmode,"visual")) prcon->Draw();}
774 prcon->SetFillStyle(0);
775 prcon->SetFillColor(30);
776 if (indexOfFile==1) {
777 prcon->SetLineStyle(2);
778 } else if (indexOfFile==2) {
779 prcon->SetLineStyle(3);
781 prcon->SetLineStyle(4);}
782 if (strstr(outputmode,"visual")) prcon->Draw("same");}
784 if (indexOfFile==0) {
785 momvsmassCanvas = new TCanvas("momvsmassCanvas","Momentum vs mass disribution",500,10,700,700);
786 momvsmassCanvas->SetFillColor(0);
787 momvsmassCanvas->SetBorderMode(0);
788 gPad->SetFillStyle(0);
789 gPad->SetBorderMode(0);
790 gPad->SetFillColor(0);
791 // gStyle->SetOptStat(11);
792 if (numfile==4) momvsmassCanvas->Divide(1,2,0,0);
793 } else if (indexOfFile==1 && numfile == 4) {
794 momvsmassCanvas->cd(1);
795 TPaveLabel *pl = new TPaveLabel(-0.0376218,-3.03586,0.0979277,-2.70158,"100 ps","br");
796 pl->SetFillColor(18);
797 pl->SetTextSize(0.99);
798 if (strstr(outputmode,"visual")) pl->Draw();
799 } else if (indexOfFile==3 && numfile == 4) {
800 momvsmassCanvas->cd(2);
801 TPaveLabel *pl = new TPaveLabel(-0.0591866,-3.17077,0.076363,-2.86857,"300 ps","br");
802 pl->SetFillColor(18);
803 pl->SetTextSize(0.99);
804 if (strstr(outputmode,"visual")) pl->Draw();
806 if (numfile !=4) momvsmassCanvas->cd();
807 if (numfile !=4 || indexOfFile==1 || indexOfFile==3) {
808 // hpi->PaintStat2(01);
809 hpi->SetMarkerColor(5);
810 if (strstr(outputmode,"visual")) hpi->Draw();
811 if(strstr(eventType,"pp")){
812 hel->SetMarkerColor(2);
813 if (strstr(outputmode,"visual")) hel->Draw("same");
815 hka->SetMarkerColor(4);
816 if (strstr(outputmode,"visual")) hka->Draw("same");
817 hpr->SetMarkerColor(3);
818 if (strstr(outputmode,"visual")) hpr->Draw("same");
819 if (strstr(outputmode,"visual")) {
822 if(strstr(eventType,"pp")){
827 if(strstr(eventType,"pp")){
828 //TPaveText *ep = new TPaveText(-0.05,-0.5,0.05,-0.3);
830 TPaveLabel *ep = new TPaveLabel(.42,.85,.52,1.05,"e");
831 if (strstr(outputmode,"visual")) ep->Draw();
834 TPaveText *pip = new TPaveText(0.15,-1.0,0.25,-0.8);
836 if (strstr(outputmode,"visual")) pip->Draw();
837 TPaveText *kp = new TPaveText(0.5,-2.0,0.6,-1.8);
839 if (strstr(outputmode,"visual")) kp->Draw();
840 TPaveText *prp = new TPaveText(0.9,-2.7,1.0,-2.5);
842 if (strstr(outputmode,"visual")) prp->Draw();
843 // TText *text2= new TText(.59,.06,"Momentum");
844 // text1->SetTextAngle(90);
846 //pidCanvas->DrawText(.1,.2,"Contamination Efficiency");
847 momvsmassCanvas->Update();
848 if(strstr(outputsavemode,"asC")) momvsmassCanvas->Print("momvsmassCanvas.C");
849 if(strstr(outputsavemode,"asEPS")) momvsmassCanvas->Print("momvsmassCanvas.eps");
852 if(strstr(outputsavemode,"asC")) pidCanvas->Print("pidCanvas.C");
853 if(strstr(outputsavemode,"asEPS")) pidCanvas->Print("pidCanvas.eps");
854 char outFileName[100];
855 strcpy(outFileName,"histos");
856 strcat(outFileName,foutfileName);
857 TFile *houtfile = new TFile(outFileName,"recreate");
860 pidCanvas->Write(0,TObject::kOverwrite);
861 momvsmassCanvas->Write(0,TObject::kOverwrite);
863 pit->Write(0,TObject::kOverwrite);
864 pig->Write(0,TObject::kOverwrite);
865 pieff->Write(0,TObject::kOverwrite);
866 picon->Write(0,TObject::kOverwrite);
867 piid->Write(0,TObject::kOverwrite);
868 piall->Write(0,TObject::kOverwrite);
869 pigen->Write(0,TObject::kOverwrite);
870 kat->Write(0,TObject::kOverwrite);
871 kag->Write(0,TObject::kOverwrite);
872 kaeff->Write(0,TObject::kOverwrite);
873 kaid->Write(0,TObject::kOverwrite);
874 kaall->Write(0,TObject::kOverwrite);
875 kagen->Write(0,TObject::kOverwrite);
876 kacon->Write(0,TObject::kOverwrite);
877 prt->Write(0,TObject::kOverwrite);
878 prg->Write(0,TObject::kOverwrite);
879 preff->Write(0,TObject::kOverwrite);
880 prcon->Write(0,TObject::kOverwrite);
881 prid->Write(0,TObject::kOverwrite);
882 prall->Write(0,TObject::kOverwrite);
883 prgen->Write(0,TObject::kOverwrite);
885 hpi->Write(0,TObject::kOverwrite);
886 hka->Write(0,TObject::kOverwrite);
887 hpr->Write(0,TObject::kOverwrite);
889 if (hel && eleff && elcon && elid && elall){
890 hel->Write(0,TObject::kOverwrite);
891 eleff->Write(0,TObject::kOverwrite);
892 elcon->Write(0,TObject::kOverwrite);
893 elid->Write(0,TObject::kOverwrite);
894 elall->Write(0,TObject::kOverwrite);
896 cout << "file " << houtfile << " has been created" << endl;
897 cout << "it contains PID histos and canvas" << endl;
899 houtfile->Write(0,TObject::kOverwrite);
903 if (strstr(outputmode,"novisual")){
907 delete pieff; pieff=0;
908 delete picon; picon=0;
909 delete piid ; piid=0;
910 delete piall; piall=0;
911 delete pigen; pigen=0;
914 delete kaeff; kaeff=0;
916 delete kaall; kaall=0;
917 delete kagen; kagen=0;
918 delete kacon; kacon=0;
921 delete preff; preff=0;
922 delete prcon; prcon=0;
924 delete prall; prall=0;
925 delete prgen; prgen=0;
954 //__________________________________________________________________
955 Bool_t AliTOFPID::operator==( AliTOFPID const & tofrec)const
957 // dummy version of Equal operator.
958 // requested by coding conventions