]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFPID.cxx
Classes for reading raw data moved to the RAW module. New on-line MONITORING module...
[u/mrichter/AliRoot.git] / TOF / AliTOFPID.cxx
index 73e4156d9325a2232f0cf3ee54205c3dff5a4494..15ca3904f9524e0f2e47b202d915487a1c38626f 100644 (file)
@@ -50,8 +50,6 @@
 //-- Authors: B. Zagreev , F. Pierella
 //////////////////////////////////////////////////////////////////////////////
 
-
-#include "TROOT.h"
 #include "TStyle.h"
 #include "TTask.h"
 #include "TTree.h"
 #include "TLine.h"
 #include "TPaveLabel.h"
 #include "TPaveText.h"
-#include "AliConst.h"
-#include "AliTOFConstants.h"
-#include "AliTOFPID.h"
-#include <TClonesArray.h>
 #include "TFile.h"
 #include <TF1.h>
 #include <TF2.h>
 #include "TFolder.h"
 #include "TNtuple.h"
 #include "TLeaf.h"
+
+#include "AliConst.h"
+#include "AliTOFConstants.h"
+#include "AliTOFPID.h"
+
 #include <stdlib.h>
-#include <iostream.h>
-#include <fstream.h>
+#include <Riostream.h>
+#include <Riostream.h>
 
 ClassImp(AliTOFPID)
 
@@ -101,9 +100,15 @@ ClassImp(AliTOFPID)
 //____________________________________________________________________________ 
   AliTOFPID::AliTOFPID(char* headerFile, char *cutsFile, const Option_t* opt):TTask("AliTOFPID","") 
 {
+  felectron = 0;
+  fpion     = 0;
+  fkaon     = 0;
+  fproton   = 0;
   fhfile = TFile::Open(headerFile); // connect file with ntuple
   fcut = TFile::Open(cutsFile); // connect file for cuts
   foutfileName=headerFile;
+  fNtuple   = 0;
+  fgen      = 0;
 
   Init(opt);
   // add Task to //root/Tasks folder
@@ -207,20 +212,26 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   ////////// Create histograms /////////////////
   // for electron only in pp case
   TH1F* eleff=0;
+  TH1F* eleffls=0;
   TH1F *elcon=0;
   TH1F *elid=0;
+  TH1F *elmatch=0;
   TH1F *elall=0;
 
   if(strstr(eventType,"pp")){
     eleff = new TH1F("eleff","",10,0,0.6);
     xaxis=eleff->GetYaxis();
     xaxis->SetLabelSize(.08);
+    eleffls = new TH1F("eleffls","",10,0,0.6);
+    xaxis=eleffls->GetYaxis();
+    xaxis->SetLabelSize(.08);
     elcon = new TH1F("elcon","",10,0,0.6);
     xaxis=elcon->GetXaxis();
     xaxis->SetLabelSize(.09);
     xaxis=elcon->GetYaxis();
     xaxis->SetLabelSize(.08);
     elid = new TH1F("elid","Identified electrons",10,0,0.6);
+    elmatch = new TH1F("elmatch","N(e)",10,0,0.6);
     elall = new TH1F("elall","Electrons",10,0,0.6);
   }
 
@@ -228,8 +239,11 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   TH1F *pit  = new TH1F("pit","",15,0,2.5); //part. with tracks
   TH1F *pig  = new TH1F("pig","",15,0,2.5); //part. in geometry acceptance
   TH1F *pieff = new TH1F("pieff","",15,0,2.5); //efficiency
+  TH1F *pieffls = new TH1F("pieffls","",15,0,2.5); //efficiency (last step)
   xaxis=pieff->GetYaxis();
   xaxis->SetLabelSize(.08);
+  xaxis=pieffls->GetYaxis();
+  xaxis->SetLabelSize(.08);
   TH1F *picon = new TH1F("picon","",15,0,2.5); //contamination
   xaxis=picon->GetXaxis();
   xaxis->SetLabelSize(.09);
@@ -237,6 +251,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   xaxis->SetLabelSize(.08);
   TH1F *piid  = new TH1F("piid","Identified pions",15,0,2.5);
   TH1F *piall = new TH1F("piall","Pions",15,0,2.5);
+  TH1F *pimatch = new TH1F("pimatch","N(Pions)",15,0,2.5);
   TH1F *pigen = new TH1F("pigen","Pions",15,0,2.5);
   xaxis=pigen->GetXaxis();
   xaxis->SetLabelSize(.09);
@@ -253,12 +268,16 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   TH1F *kaeff = new TH1F("kaeff","",15,0,2.5);
   xaxis=kaeff->GetYaxis();
   xaxis->SetLabelSize(.08);
+  TH1F *kaeffls = new TH1F("kaeffls","",15,0,2.5);
+  xaxis=kaeffls->GetYaxis();
+  xaxis->SetLabelSize(.08);
   TH1F *kacon = new TH1F("kacon","",15,0,2.5);
   xaxis=kacon->GetXaxis();
   xaxis->SetLabelSize(.09);
   xaxis=kacon->GetYaxis();
   xaxis->SetLabelSize(.08);
   TH1F *kaid  = new TH1F("kaid","Identified kaons",15,0,2.5);
+  TH1F *kamatch  = new TH1F("kamatch","N(K)",15,0,2.5);
   TH1F *kaall = new TH1F("kaall","Kaons",15,0,2.5);
   TH1F *kagen = new TH1F("kagen","Kaons",15,0,2.5);
   xaxis=kagen->GetXaxis();
@@ -276,12 +295,16 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   TH1F *preff = new TH1F("preff","",15,0,4.4);
   xaxis=preff->GetYaxis();
   xaxis->SetLabelSize(.08);
+  TH1F *preffls = new TH1F("preffls","",15,0,4.4);
+  xaxis=preffls->GetYaxis();
+  xaxis->SetLabelSize(.08);
   TH1F *prcon = new TH1F("prcon","",15,0,4.4);
   xaxis=prcon->GetXaxis();
   xaxis->SetLabelSize(.09);
   xaxis=prcon->GetYaxis();
   xaxis->SetLabelSize(.08);
   TH1F *prid  = new TH1F("prid","Identified protons",15,0,4.4);
+  TH1F *prmatch  = new TH1F("prmatch","N(p)",15,0,4.4);
   TH1F *prall = new TH1F("prall","Protons",15,0,4.4);
   TH1F *prgen = new TH1F("prgen","Protons",15,0,4.4);
   xaxis=prgen->GetXaxis();
@@ -321,18 +344,18 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   Float_t katrack=0, kamag=0, kageom=0;
   Float_t prtrack=0, prmag=0, prgeom=0;
   Float_t pif=0, kaf=0, prf=0, pin=0, kan=0, prn=0;
-  Float_t px, py, pz, x, y, z, pdgcode, mass;
-  Int_t event, matc, imam;
+  Float_t px, py, pz, x, y, z, mass;
+  Int_t event, matc, imam, pdgcode;
   Int_t indexOfFile=0, numfile=0;
   //////// Loop over tracks (particles)///////////////////////
   
   for (Int_t i=0; i < nparticles; i++) {
     fNtuple->GetEvent(i);
-    event=fNtuple->GetLeaf("event")->GetValue();
-    pdgcode=fNtuple->GetLeaf("ipart")->GetValue();
+    event=(Int_t)(fNtuple->GetLeaf("event")->GetValue());
+    pdgcode=(Int_t)(fNtuple->GetLeaf("ipart")->GetValue());
     mass=fNtuple->GetLeaf("mext")->GetValue(0);
-    matc=fNtuple->GetLeaf("matc")->GetValue(0);
-    imam=fNtuple->GetLeaf("imam")->GetValue(0);
+    matc=(Int_t)(fNtuple->GetLeaf("matc")->GetValue(0));
+    imam=(Int_t)(fNtuple->GetLeaf("imam")->GetValue(0));
     px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
     py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
     pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
@@ -342,40 +365,45 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     Float_t pvtx=TMath::Sqrt(px*px+py*py+pz*pz);
     Float_t ptvtx=TMath::Sqrt(px*px+py*py);
     Float_t mt=0.;
+    Bool_t isSelected=(imam == 0 && pz !=0 && TMath::ATan(TMath::Abs(ptvtx/pz))>TMath::Pi()*45./180.);
     Int_t abspdgcode=TMath::Abs(pdgcode);
     switch(abspdgcode){
     case 321:
+      if(isSelected && (matc==3 || matc==4)) kamatch->Fill(pvtx);
       mt=TMath::Sqrt(AliTOFConstants::fgkKaonMass*AliTOFConstants::fgkKaonMass+px*px+py*py);
       break;
     case 2212:
+      if(isSelected && (matc==2 || matc==3 || matc==4)) prmatch->Fill(pvtx);
       mt=TMath::Sqrt(AliTOFConstants::fgkProtonMass*AliTOFConstants::fgkProtonMass+px*px+py*py);
       break;
     case 11:
+      if(strstr(eventType,"pp") && (matc==3 || matc==4)) elmatch->Fill(pvtx); //  as in kaon case
       mt=TMath::Sqrt(AliTOFConstants::fgkElectronMass*AliTOFConstants::fgkElectronMass+px*px+py*py);
       break;
     default:
+      if(isSelected && matc>0) pimatch->Fill(pvtx);
       mt=TMath::Sqrt(AliTOFConstants::fgkPionMass*AliTOFConstants::fgkPionMass+px*px+py*py);
       break;
     }
 
-    if (imam == 0 && pz !=0 && TMath::ATan(TMath::Abs(ptvtx/pz))>TMath::Pi()*45./180.)
+    if (isSelected)
       {//only primary +/-45  
        if (fkaon->IsInside(mass,-pvtx) && matc>2) {
          ka++;
          if (fTask!=2) kaid->Fill(pvtx); else {kaid->Fill(ptvtx);}
-         if (TMath::Abs(pdgcode)==321) {kaf++; kaeff->Fill(pvtx);} else {kan++; kacon->Fill(pvtx);}
+         if (TMath::Abs(pdgcode)==321) {kaf++; kaeff->Fill(pvtx); kaeffls->Fill(pvtx);} else {kan++; kacon->Fill(pvtx);}
        } else if (fproton->IsInside(mass,-pvtx) && matc>1) {
          pr++;
          if (fTask!=2) prid->Fill(pvtx); else 
            {prid->Fill(ptvtx);}
-         if (TMath::Abs(pdgcode)==2212) {prf++; preff->Fill(pvtx);} else {prn++; prcon->Fill(pvtx);}
+         if (TMath::Abs(pdgcode)==2212) {prf++; preff->Fill(pvtx); preffls->Fill(pvtx);} else {prn++; prcon->Fill(pvtx);}
        } else  if (strstr(eventType,"pp") && felectron->IsInside(mass,-pvtx) && matc>2) {elid->Fill(pvtx);
-       if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) eleff->Fill(pvtx); else elcon->Fill(pvtx);
+       if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) {eleff->Fill(pvtx); eleffls->Fill(pvtx);} else {elcon->Fill(pvtx);}
        } else if (matc>0) {
          //||matc==-4&&fpion->IsInside(mass,-pvtx)
          pi++;
          if (fTask!=2) piid->Fill(pvtx); else {piid->Fill(ptvtx);}
-         if (TMath::Abs(pdgcode)==211) {pif++; pieff->Fill(pvtx);} else {pin++; picon->Fill(pvtx);}
+         if (TMath::Abs(pdgcode)==211) {pif++; pieff->Fill(pvtx); pieffls->Fill(pvtx);} else {pin++; picon->Fill(pvtx);}
        }
 
        //////////////// Normalization histograms ////////////////////
@@ -473,8 +501,10 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   cout<< "Contamination             "<< (pin+kan+prn)/(pi+ka+pr)*100 <<" %"<<endl;
   cout<<endl;
   
-  TCanvas *pidCanvas=0;
+  TCanvas *pidCanvas=0;   // overall
+  TCanvas *pidCanvasls=0; // last step of PID
   TCanvas *momvsmassCanvas=0;
+  // overall Efficiency
   TPad  *tp=0;
   TPad  *pad1=0;
   TPad  *pad2=0;
@@ -485,14 +515,33 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   TPad  *pad7=0;
   TPad  *pad8=0;
 
+  // last step Efficiency
+  TPad  *tpls=0;
+  TPad  *pad1ls=0;
+  TPad  *pad2ls=0;
+  TPad  *pad3ls=0;
+  TPad  *pad4ls=0;
+  TPad  *pad5ls=0;
+  TPad  *pad6ls=0;
+  TPad  *pad7ls=0;
+  TPad  *pad8ls=0;
+
   //////////////////////// For fTask 1 ///////////////////////////
   if (fTask==1) {
     if (strstr(eventType,"pp")){
       eleff->Divide(elall);
+      eleffls->Divide(elmatch);
     }
+    // overall efficiency
     pieff->Divide(piall);
     kaeff->Divide(kaall);
     preff->Divide(prall);
+
+    // last step efficiency
+    pieffls->Divide(pimatch);
+    kaeffls->Divide(kamatch);
+    preffls->Divide(prmatch);
+
     pit->Divide(piall);
     kat->Divide(kaall);
     prt->Divide(prall);
@@ -502,42 +551,114 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     if (strstr(eventType,"pp")){
       elcon->Divide(elid);
     }
+    // contamination
     picon->Divide(piid);
     kacon->Divide(kaid);
     prcon->Divide(prid);
+
     //Create a canvas, set the view range, show histograms
+    // for overall PID
     if (indexOfFile==0) {
-      pidCanvas = new TCanvas("pidCanvas","PID ",10,100,800,500);
+      // overall Efficiency canvas
+      pidCanvas = new TCanvas("pidCanvas","PID (Overall)",10,100,800,500);
       pidCanvas->SetBorderMode(0);
       pidCanvas->SetBorderSize(0);
       pidCanvas->SetFillColor(0);
       pidCanvas->SetFillStyle(0);
-      if (strstr(outputmode,"visual")) pidCanvas->Draw();
+
+      // last step Efficiency canvas
+      pidCanvasls = new TCanvas("pidCanvasls","PID (Last Step)",10,100,800,500);
+      pidCanvasls->SetBorderMode(0);
+      pidCanvasls->SetBorderSize(0);
+      pidCanvasls->SetFillColor(0);
+      pidCanvasls->SetFillStyle(0);
+
+      if (strstr(outputmode,"visual")) {
+       pidCanvas->Draw();
+       pidCanvasls->Draw();
+      }
+
       Float_t pxs=0.25+0.125; //X size of pad
-      Float_t pys=0.5+0.055; //y size of pad
-      tp = new TPad("histo","Histograms",.1,.1,.9,.9);
+      Float_t pys=0.5+0.055;  //y size of pad
+      // overall
+      tp   = new TPad("histo","Histograms",.1,.1,.9,.9);
+      // last step
+      tpls = new TPad("histo","Histograms",.1,.1,.9,.9);
+
       if (strstr(eventType,"Pb-Pb")){
+       // overall efficiency
        //pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
        pad2 = new TPad("pad2","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
        pad3 = new TPad("pad3","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
        pad4 = new TPad("pad4","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
+
+       // contamination
        //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
        pad6 = new TPad("pad6","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
        pad7 = new TPad("pad7","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
        pad8 = new TPad("pad8","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
+
+       // we repeat the same for the last step of PID
+       //pad1ls = new TPad("pad1ls","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
+       pad2ls = new TPad("pad2ls","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
+       pad3ls = new TPad("pad3ls","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
+       pad4ls = new TPad("pad4ls","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
+
+       // contamination
+       //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
+       pad6ls = new TPad("pad6ls","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
+       pad7ls = new TPad("pad7ls","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
+       pad8ls = new TPad("pad8ls","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
+
       }
 
       if (strstr(eventType,"pp")){
+       // overall Efficiency
        pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
        pad2 = new TPad("pad2","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
        pad3 = new TPad("pad3","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
        pad4 = new TPad("pad4","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
+
+       // contamination
        pad5 = new TPad("pad5","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
        pad6 = new TPad("pad6","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
        pad7 = new TPad("pad7","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
        pad8 = new TPad("pad8","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
+
+
+       // we repeat the same for the last step of PID
+       pad1ls = new TPad("pad1ls","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
+       pad2ls = new TPad("pad2ls","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
+       pad3ls = new TPad("pad3ls","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
+       pad4ls = new TPad("pad4ls","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
+
+       // contamination
+       pad5ls = new TPad("pad5ls","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
+       pad6ls = new TPad("pad6ls","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
+       pad7ls = new TPad("pad7ls","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
+       pad8ls = new TPad("pad8ls","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
+
+
+      }
+
+      // last step of PID
+      gStyle->SetOptStat(0);
+      tpls->SetFillStyle(0);
+      tpls->SetFillColor(0);
+      tpls->SetBorderSize(0);
+      pidCanvasls->cd();
+      TText *text1ls= new TText(.1,.2,"Contamination              Efficiency"); 
+      text1ls->SetTextAngle(90);
+      if (strstr(outputmode,"visual")) text1ls->Draw();
+      //tp->DrawText(.3,.0,"p (GeV/c");
+      pidCanvasls->cd();
+      TText *text2ls= new TText(.8,.0,"p (GeV/c)"); 
+      if (strstr(outputmode,"visual")) {
+       text2ls->Draw();
+       tpls->Draw();
       }
 
+      // overall
       gStyle->SetOptStat(0);
       tp->SetFillStyle(0);
       tp->SetFillColor(0);
@@ -553,9 +674,11 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        text2->Draw();
        tp->Draw();
       }
+
     }
 
 
+    // drawing histos for overall case
     if (strstr(eventType,"pp")){
       pad1->SetFillStyle(0);
       pad1->SetFillColor(10);
@@ -571,8 +694,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        //eleff->SetFillColor(0);
        //eleff->SetLineColor(4);
        eleff->SetLineColor(1);
-       if (strstr(outputmode,"visual")) eleff->Draw();}
-      else {
+       if (strstr(outputmode,"visual")) eleff->Draw();
+      else {
        eleff->SetFillStyle(0);
        eleff->SetFillColor(30);
        if (indexOfFile==2) {
@@ -582,7 +705,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
          //eleff->SetLineColor(2);
          eleff->SetLineColor(1);
          eleff->SetLineStyle(2);}
-       if (strstr(outputmode,"visual")) eleff->Draw("same");}
+       if (strstr(outputmode,"visual")) eleff->Draw("same");
+      }
       //   eleff->Fit("pol1");
       TPaveLabel *ellab = new TPaveLabel(.42,.85,.52,1.05,"e");
       if (strstr(outputmode,"visual")) ellab->Draw();
@@ -607,7 +731,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        pieff->SetLineStyle(3);
       } else {
        pieff->SetLineStyle(4);}
-      if (strstr(outputmode,"visual")) pieff->Draw("same");}
+      if (strstr(outputmode,"visual")) pieff->Draw("same");
+    }
     TPaveLabel *pilab = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
     if (strstr(outputmode,"visual")) pilab->Draw();
     
@@ -630,7 +755,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        kaeff->SetLineStyle(3);
       } else {
        kaeff->SetLineStyle(4);}
-      if (strstr(outputmode,"visual")) kaeff->Draw("same");}
+      if (strstr(outputmode,"visual")) kaeff->Draw("same");
+    }
     TPaveLabel *kalab = new TPaveLabel(1.7,.85,2.2,1.05,"K");
     if (strstr(outputmode,"visual")) kalab->Draw();
     
@@ -653,7 +779,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        preff->SetLineStyle(3);
       } else {
        preff->SetLineStyle(4);}
-      if (strstr(outputmode,"visual")) preff->Draw("same");}
+      if (strstr(outputmode,"visual")) preff->Draw("same");
+    }
     TPaveLabel *prlab = new TPaveLabel(3.2,.85,4.1,1.05,"p");
     if (strstr(outputmode,"visual")) prlab->Draw();
 
@@ -671,8 +798,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        //elcon->SetFillColor(30);
        //elcon->SetLineColor(4);
        elcon->SetLineColor(1);
-       if (strstr(outputmode,"visual")) elcon->Draw();}
-      else {
+       if (strstr(outputmode,"visual")) elcon->Draw();
+      else {
        elcon->SetFillStyle(4000);
        elcon->SetFillColor(30);
        if (indexOfFile==2) {
@@ -681,7 +808,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        } else {
          elcon->SetLineColor(2);
          elcon->SetLineStyle(2);}
-       if (strstr(outputmode,"visual")) elcon->Draw("same");}
+       if (strstr(outputmode,"visual")) elcon->Draw("same");
+      }
     }
 
 
@@ -694,8 +822,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     picon->SetMaximum(1.);
     if (indexOfFile==0) {
       picon->SetLineColor(1);
-      if (strstr(outputmode,"visual")) picon->Draw();}
-    else {
+      if (strstr(outputmode,"visual")) picon->Draw();
+    else {
       picon->SetFillStyle(0);
       picon->SetFillColor(30);
       if (indexOfFile==1) { 
@@ -737,7 +865,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        pl->SetTextSize(0.99);
        if (strstr(outputmode,"visual")) pl->Draw();
       }
-      if (strstr(outputmode,"visual")) picon->Draw("same");}
+      if (strstr(outputmode,"visual")) picon->Draw("same");
+    }
     
     pad7->SetFillStyle(0);
     pad7->SetFillColor(10);
@@ -748,8 +877,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     kacon->SetMaximum(1.);
     if (indexOfFile==0) {
       kacon->SetLineColor(1);
-      if (strstr(outputmode,"visual")) kacon->Draw();}
-    else {
+      if (strstr(outputmode,"visual")) kacon->Draw();
+    else {
       kacon->SetFillStyle(0);
       kacon->SetFillColor(30);
       if (indexOfFile==1) {
@@ -758,7 +887,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        kacon->SetLineStyle(3);
       } else {
        kacon->SetLineStyle(4);}
-      if (strstr(outputmode,"visual")) kacon->Draw("same");}
+      if (strstr(outputmode,"visual")) kacon->Draw("same");
+    }
     
     pad8->SetFillStyle(0);
     pad8->SetFillColor(10);
@@ -769,8 +899,8 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     prcon->SetMaximum(1.);
     if (indexOfFile==0) {
       prcon->SetLineColor(1);
-      if (strstr(outputmode,"visual")) prcon->Draw();}
-    else {
+      if (strstr(outputmode,"visual")) prcon->Draw();
+    else {
       prcon->SetFillStyle(0);
       prcon->SetFillColor(30);
       if (indexOfFile==1) {
@@ -779,8 +909,256 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        prcon->SetLineStyle(3);
       } else {
        prcon->SetLineStyle(4);}
-      if (strstr(outputmode,"visual")) prcon->Draw("same");}
+      if (strstr(outputmode,"visual")) prcon->Draw("same");
+    }
+
+
+
+    // last step case (it is just a copy of the previous lines)
+    // moving to pidCanvasls canvas
+    pidCanvasls->cd();
+    // drawing histos for overall case
+    if (strstr(eventType,"pp")){
+      pad1ls->SetFillStyle(0);
+      pad1ls->SetFillColor(10);
+      tpls->cd();
+      if (strstr(outputmode,"visual")) pad1ls->Draw();
+      pad1ls->cd();
+      //eleff->SetLineWidth(15);
+      eleffls->SetLineWidth(3);
+      eleffls->SetMaximum(1.);
+      if (indexOfFile==0) {
+       //eleff->SetFillColor(33);
+       //eleff->SetFillColor(30);
+       //eleff->SetFillColor(0);
+       //eleff->SetLineColor(4);
+       eleffls->SetLineColor(1);
+       if (strstr(outputmode,"visual")) eleffls->Draw();
+      } else {
+       eleffls->SetFillStyle(0);
+       eleffls->SetFillColor(30);
+       if (indexOfFile==2) {
+         eleffls->SetLineColor(3);
+         eleffls->SetLineWidth(3);
+       } else {
+         //eleff->SetLineColor(2);
+         eleffls->SetLineColor(1);
+         eleffls->SetLineStyle(2);}
+       if (strstr(outputmode,"visual")) eleffls->Draw("same");
+      }
+      //   eleff->Fit("pol1");
+      TPaveLabel *ellabls = new TPaveLabel(.42,.85,.52,1.05,"e");
+      if (strstr(outputmode,"visual")) ellabls->Draw();
+    }
+    
+    pad2ls->SetFillStyle(0);
+    pad2ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad2ls->Draw();
+    pad2ls->cd();
+    pieffls->SetLineWidth(3);
+    pieffls->SetMaximum(1.);
+    if (indexOfFile==0) {
+      pieffls->SetLineColor(1);
+      if (strstr(outputmode,"visual")) pieffls->Draw();
+    } else {
+      pieffls->SetFillStyle(0);
+      pieffls->SetFillColor(30);
+      if (indexOfFile==1) {
+       pieffls->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       pieffls->SetLineStyle(3);
+      } else {
+       pieffls->SetLineStyle(4);}
+      if (strstr(outputmode,"visual")) pieffls->Draw("same");
+    }
+    TPaveLabel *pilabls = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
+    if (strstr(outputmode,"visual")) pilabls->Draw();
+    
+    pad3ls->SetFillStyle(0);
+    pad3ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad3ls->Draw();
+    pad3ls->cd();
+    kaeffls->SetLineWidth(3);
+    kaeffls->SetMaximum(1.);
+    if (indexOfFile==0) {
+      kaeffls->SetLineColor(1);
+      if (strstr(outputmode,"visual")) kaeffls->Draw();
+    } else {
+      kaeffls->SetFillStyle(0);
+      kaeffls->SetFillColor(30);
+      if (indexOfFile==1) { 
+       kaeffls->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       kaeffls->SetLineStyle(3);
+      } else {
+       kaeffls->SetLineStyle(4);}
+      if (strstr(outputmode,"visual")) kaeffls->Draw("same");
+    }
+    TPaveLabel *kalabls = new TPaveLabel(1.7,.85,2.2,1.05,"K");
+    if (strstr(outputmode,"visual")) kalabls->Draw();
     
+    pad4ls->SetFillStyle(0);
+    pad4ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad4ls->Draw();
+    pad4ls->cd();
+    preffls->SetLineWidth(3);
+    preffls->SetMaximum(1.);
+    if (indexOfFile==0) {
+      preffls->SetLineColor(1);
+      if (strstr(outputmode,"visual")) preffls->Draw();
+    } else {
+      preffls->SetFillStyle(0);
+      preffls->SetFillColor(30);
+      if (indexOfFile==1) {
+       preffls->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       preffls->SetLineStyle(3);
+      } else {
+       preffls->SetLineStyle(4);}
+      if (strstr(outputmode,"visual")) preffls->Draw("same");
+    }
+    TPaveLabel *prlabls = new TPaveLabel(3.2,.85,4.1,1.05,"p");
+    if (strstr(outputmode,"visual")) prlabls->Draw();
+
+    if (strstr(eventType,"pp")){
+      pad5ls->SetFillStyle(0);
+      pad5ls->SetFillColor(10);
+      tpls->cd();
+      if (strstr(outputmode,"visual")) pad5ls->Draw();
+      pad5ls->cd();
+      //elcon->SetLineWidth(5);
+      elcon->SetLineWidth(3);
+      elcon->SetMaximum(1.);
+      if (indexOfFile==0) {
+       //elcon->SetFillColor(33);
+       //elcon->SetFillColor(30);
+       //elcon->SetLineColor(4);
+       elcon->SetLineColor(1);
+       if (strstr(outputmode,"visual")) elcon->Draw();
+      } else {
+       elcon->SetFillStyle(4000);
+       elcon->SetFillColor(30);
+       if (indexOfFile==2) {
+         elcon->SetLineColor(3);
+         elcon->SetLineWidth(3);
+       } else {
+         elcon->SetLineColor(2);
+         elcon->SetLineStyle(2);}
+       if (strstr(outputmode,"visual")) elcon->Draw("same");
+      }
+    }
+
+
+    pad6ls->SetFillStyle(0);
+    pad6ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad6ls->Draw();
+    pad6ls->cd();
+    picon->SetLineWidth(3);
+    picon->SetMaximum(1.);
+    if (indexOfFile==0) {
+      picon->SetLineColor(1);
+      if (strstr(outputmode,"visual")) picon->Draw();
+    } else {
+      picon->SetFillStyle(0);
+      picon->SetFillColor(30);
+      if (indexOfFile==1) { 
+       picon->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       picon->SetLineStyle(3);
+      } else {
+       picon->SetLineStyle(4);
+       TLine* line;
+       line = new TLine(0.2,0.85,0.9,0.85);
+       line->SetLineStyle(2);
+       line->SetLineWidth(1);
+       if (strstr(outputmode,"visual")) line->Draw();
+       line = new TLine(0.2,0.65,0.9,0.65);
+       line->SetLineWidth(2);
+       if (strstr(outputmode,"visual")) line->Draw();
+       line = new TLine(0.2,0.45,0.9,0.45);
+       line->SetLineStyle(3);
+       line->SetLineWidth(1);
+       if (strstr(outputmode,"visual")) line->Draw();
+       line = new TLine(0.2,0.25,0.9,0.25);
+       line->SetLineStyle(4);
+       line->SetLineWidth(1);
+       if (strstr(outputmode,"visual")) line->Draw();
+       TPaveLabel *pl = new TPaveLabel(1.1,0.8,1.9,0.9,"100 ps","br");
+       pl->SetFillColor(18);
+       pl->SetTextSize(0.99);
+       if (strstr(outputmode,"visual")) pl->Draw();
+       pl = new TPaveLabel(1.1,0.6,1.9,0.7,"150 ps","br");
+       pl->SetFillColor(18);
+       pl->SetTextSize(0.99);
+       if (strstr(outputmode,"visual")) pl->Draw();
+       pl = new TPaveLabel(1.1,0.4,1.9,0.5,"200 ps","br");
+       pl->SetFillColor(18);
+       pl->SetTextSize(0.99);
+       if (strstr(outputmode,"visual")) pl->Draw();
+       pl = new TPaveLabel(1.1,0.2,1.9,0.3,"300 ps","br");
+       pl->SetFillColor(18);
+       pl->SetTextSize(0.99);
+       if (strstr(outputmode,"visual")) pl->Draw();
+      }
+      if (strstr(outputmode,"visual")) picon->Draw("same");
+    }
+    
+    pad7ls->SetFillStyle(0);
+    pad7ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad7ls->Draw();
+    pad7ls->cd();
+    kacon->SetLineWidth(3);
+    kacon->SetMaximum(1.);
+    if (indexOfFile==0) {
+      kacon->SetLineColor(1);
+      if (strstr(outputmode,"visual")) kacon->Draw();
+    } else {
+      kacon->SetFillStyle(0);
+      kacon->SetFillColor(30);
+      if (indexOfFile==1) {
+       kacon->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       kacon->SetLineStyle(3);
+      } else {
+       kacon->SetLineStyle(4);}
+      if (strstr(outputmode,"visual")) kacon->Draw("same");
+    }
+    
+    pad8ls->SetFillStyle(0);
+    pad8ls->SetFillColor(10);
+    tpls->cd();
+    if (strstr(outputmode,"visual")) pad8ls->Draw();
+    pad8ls->cd();
+    prcon->SetLineWidth(3);
+    prcon->SetMaximum(1.);
+    if (indexOfFile==0) {
+      prcon->SetLineColor(1);
+      if (strstr(outputmode,"visual")) prcon->Draw();
+    } else {
+      prcon->SetFillStyle(0);
+      prcon->SetFillColor(30);
+      if (indexOfFile==1) {
+       prcon->SetLineStyle(2);
+      } else if (indexOfFile==2) {
+       prcon->SetLineStyle(3);
+      } else {
+       prcon->SetLineStyle(4);}
+      if (strstr(outputmode,"visual")) prcon->Draw("same");
+    }
+
+
+
+
+
+
+
+    // momentum vs mass 2-D histos
+
     if (indexOfFile==0) {
       momvsmassCanvas = new TCanvas("momvsmassCanvas","Momentum vs mass disribution",500,10,700,700);
       momvsmassCanvas->SetFillColor(0);
@@ -859,29 +1237,35 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
       // saving canvas
       pidCanvas->Write(0,TObject::kOverwrite);
       momvsmassCanvas->Write(0,TObject::kOverwrite);
-      // saving histos
+      // saving 1-D histos
       pit->Write(0,TObject::kOverwrite);
       pig->Write(0,TObject::kOverwrite);
       pieff->Write(0,TObject::kOverwrite);
+      pieffls->Write(0,TObject::kOverwrite);
       picon->Write(0,TObject::kOverwrite);
       piid->Write(0,TObject::kOverwrite);
+      pimatch->Write(0,TObject::kOverwrite);
       piall->Write(0,TObject::kOverwrite);
       pigen->Write(0,TObject::kOverwrite);
       kat->Write(0,TObject::kOverwrite);
       kag->Write(0,TObject::kOverwrite);
       kaeff->Write(0,TObject::kOverwrite);
+      kaeffls->Write(0,TObject::kOverwrite);
       kaid->Write(0,TObject::kOverwrite);
+      kamatch->Write(0,TObject::kOverwrite);
       kaall->Write(0,TObject::kOverwrite);
       kagen->Write(0,TObject::kOverwrite);
       kacon->Write(0,TObject::kOverwrite);
       prt->Write(0,TObject::kOverwrite);
       prg->Write(0,TObject::kOverwrite);
       preff->Write(0,TObject::kOverwrite);
+      preffls->Write(0,TObject::kOverwrite);
       prcon->Write(0,TObject::kOverwrite);
       prid->Write(0,TObject::kOverwrite);
+      prmatch->Write(0,TObject::kOverwrite);
       prall->Write(0,TObject::kOverwrite);
       prgen->Write(0,TObject::kOverwrite);
-      // 2-D
+      // saving 2-D histos
       hpi->Write(0,TObject::kOverwrite);
       hka->Write(0,TObject::kOverwrite);
       hpr->Write(0,TObject::kOverwrite);
@@ -891,6 +1275,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        eleff->Write(0,TObject::kOverwrite);
        elcon->Write(0,TObject::kOverwrite);
        elid->Write(0,TObject::kOverwrite);
+       elmatch->Write(0,TObject::kOverwrite);
        elall->Write(0,TObject::kOverwrite);
       }
       cout << "file " << houtfile << " has been created" << endl;
@@ -905,22 +1290,28 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     delete pit  ; pit=0;
     delete pig  ; pig=0;
     delete pieff; pieff=0;
+    delete pieffls; pieffls=0;
     delete picon; picon=0;
     delete piid ; piid=0;
+    delete pimatch; pimatch=0;
     delete piall; piall=0;
     delete pigen; pigen=0;
     delete kat  ; kat=0;
     delete kag  ; kag=0;
     delete kaeff; kaeff=0;
+    delete kaeffls; kaeffls=0;
     delete kaid;  kaid=0;
+    delete kamatch; kamatch=0;
     delete kaall; kaall=0;
     delete kagen; kagen=0;
     delete kacon; kacon=0;
     delete prt;   prt=0;
     delete prg;   prg=0;
     delete preff; preff=0;
+    delete preffls; preffls=0;
     delete prcon; prcon=0;
     delete prid;  prid=0;
+    delete prmatch; prmatch=0;
     delete prall; prall=0;
     delete prgen; prgen=0;
     // 2-D
@@ -935,6 +1326,10 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
       delete eleff;
       eleff=0;
     }
+    if (eleffls){ 
+      delete eleffls;
+      eleffls=0;
+    }
     if (elcon){ 
       delete elcon;
       elcon=0;
@@ -943,6 +1338,10 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
       delete elid;
       elid=0;
     }
+    if (elmatch){ 
+      delete elmatch;
+      elmatch=0;
+    }
     if (elall){ 
       delete elall;
       elall=0;
@@ -952,7 +1351,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
 
 
 //__________________________________________________________________
-Bool_t AliTOFPID::operator==( AliTOFPID const & tofrec)const
+Bool_t AliTOFPID::operator==( AliTOFPID const & /*tofrec*/)const
 {
   // dummy version of Equal operator.
   // requested by coding conventions