AliTOFPID.cxx and related testmacro added
authorvicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Apr 2002 14:25:30 +0000 (14:25 +0000)
committervicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Apr 2002 14:25:30 +0000 (14:25 +0000)
TOF/AliTOFPID.cxx
TOF/AliTOFtestPID.C [new file with mode: 0644]

index ff7e41f..c3f76f9 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>
@@ -213,6 +212,7 @@ 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 *elall=0;
@@ -221,6 +221,9 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     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);
@@ -234,8 +237,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);
@@ -259,6 +265,9 @@ 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);
@@ -282,6 +291,9 @@ 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);
@@ -369,19 +381,19 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
        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 ////////////////////
@@ -479,8 +491,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;
@@ -491,14 +505,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(elid);
     }
+    // overall efficiency
     pieff->Divide(piall);
     kaeff->Divide(kaall);
     preff->Divide(prall);
+
+    // last step efficiency
+    pieffls->Divide(piid);
+    kaeffls->Divide(kaid);
+    preffls->Divide(prid);
+
     pit->Divide(piall);
     kat->Divide(kaall);
     prt->Divide(prall);
@@ -508,42 +541,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);
@@ -559,9 +664,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);
@@ -577,8 +684,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) {
@@ -588,7 +695,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();
@@ -613,7 +721,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();
     
@@ -636,7 +745,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();
     
@@ -659,7 +769,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();
 
@@ -677,8 +788,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) {
@@ -687,7 +798,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");
+      }
     }
 
 
@@ -700,8 +812,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) { 
@@ -743,7 +855,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);
@@ -754,8 +867,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) {
@@ -764,7 +877,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);
@@ -775,8 +889,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) {
@@ -785,8 +899,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);
@@ -865,10 +1227,11 @@ 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);
       piall->Write(0,TObject::kOverwrite);
@@ -876,6 +1239,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
       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);
       kaall->Write(0,TObject::kOverwrite);
       kagen->Write(0,TObject::kOverwrite);
@@ -883,11 +1247,12 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
       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);
       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);
@@ -911,6 +1276,7 @@ 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 piall; piall=0;
@@ -918,6 +1284,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     delete kat  ; kat=0;
     delete kag  ; kag=0;
     delete kaeff; kaeff=0;
+    delete kaeffls; kaeffls=0;
     delete kaid;  kaid=0;
     delete kaall; kaall=0;
     delete kagen; kagen=0;
@@ -925,6 +1292,7 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
     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 prall; prall=0;
@@ -941,6 +1309,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;
diff --git a/TOF/AliTOFtestPID.C b/TOF/AliTOFtestPID.C
new file mode 100644 (file)
index 0000000..98cae79
--- /dev/null
@@ -0,0 +1,34 @@
+void AliTOFtestPID(TString fileNameMatch, TString fileNameCuts) 
+{
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // Test macro for TOF PID 
+  // Author: F. Pierella
+  // Report problems to pierella@bo.infn.it
+  // input filenames:
+  // fileNameMatch -> file with the result of matching
+  // fileNameCuts  -> file containing the graphical cuts
+  //
+  // Use case:
+  // start root
+  // // load the macro
+  // root[0] .L AliTOFtestPID.C
+  // root[1] AliTOFtestPID("match-6KevPYTHIA-0.2T.root","stdCutspp.root")
+  /////////////////////////////////////////////////////////////////////////
+
+  // Dynamically link some shared libs
+  if (gClassTable->GetID("AliRun") < 0) {
+    gROOT->LoadMacro("loadlibs.C");
+    loadlibs();
+    cout << "Loaded shared libraries" << endl;
+  }
+  
+  AliTOFPID* tofpid=new AliTOFPID(fileNameMatch.Data(),fileNameCuts.Data());
+  // make a choice: uncomment one of these lines and try
+  // tofpid->Exec("pp","visual","asC");
+  // tofpid->Exec("pp","novisual","asC");
+  // tofpid->Exec("Pb-Pb","visual","asC");
+  // e.g. for p-p events
+  tofpid->Exec("pp","visual","asC");
+  //tofpid->Exec("pp","novisual","asEPS");
+}