- new plots for PID-oriented QA have been added
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Mar 2011 13:41:06 +0000 (13:41 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Mar 2011 13:41:06 +0000 (13:41 +0000)
- new plots for timeZero checks have been added
- some ranges of other plots have been optimized
- cuts for primary tracks selection have been updated

Francesca Bellini <fbellini@cern.ch>

PWG1/TOF/AddTaskTOFQA.C
PWG1/TOF/AliAnalysisTaskTOFqa.cxx
PWG1/TOF/AliAnalysisTaskTOFqa.h

index d38a859..e43d169 100644 (file)
@@ -1,5 +1,5 @@
 /*  created by fbellini@cern.ch on 14/09/2010 */
-/*  last modified by fbellini   on 14/09/2010 */
+/*  last modified by fbellini   on 08/03/2010 */
 
 #include "AliAnalysisTaskTOFqa.h"
 AliAnalysisTaskSE * AddTaskTOFQA() 
@@ -15,7 +15,7 @@ AliAnalysisTaskSE * AddTaskTOFQA()
   // Check the analysis type using the event handlers connected to the analysis manager.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTas", "This task requires an input event handler");
+    ::Error("AddTask", "This task requires an input event handler");
     return NULL;
   }
   TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -29,29 +29,50 @@ AliAnalysisTaskSE * AddTaskTOFQA()
 
   //--------------- set the filtering ------------
   // Barrel Tracks
-  AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
-  esdTrackCutsL->SetMinNClustersTPC(50); // ok 50
-  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5); // ok 3.5
-  esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);//ok
-  esdTrackCutsL->SetRequireTPCRefit(kTRUE);//ok (?)
-  esdTrackCutsL->SetMaxDCAToVertexXY(3.0); // ok
-  esdTrackCutsL->SetMaxDCAToVertexZ(3.0); // ok
-  esdTrackCutsL->SetRequireSigmaToVertex(kTRUE); //ok ?
-  esdTrackCutsL->SetAcceptKinkDaughters(kFALSE); // ok
+
+  /* cuts used for QA in 2010 p-p */
+  AliESDtrackCuts* esdTrackCutsLoose2010 = new AliESDtrackCuts("AliESDtrackCuts", "esdTrackCutsLoose2010");
+  esdTrackCutsL->SetMinNClustersTPC(70); 
+  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5); 
+  esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
+  esdTrackCutsL->SetRequireTPCRefit(kTRUE);
+  esdTrackCutsL->SetMaxDCAToVertexXY(3.0); 
+  esdTrackCutsL->SetMaxDCAToVertexZ(3.0); 
+  esdTrackCutsL->SetRequireSigmaToVertex(kTRUE); 
+  esdTrackCutsL->SetAcceptKinkDaughters(kFALSE); 
   esdTrackCutsL->SetMaxNsigmaToVertex(4.0);
+
+  /* standard cuts ITS-TPC 2010 */
+  AliESDtrackCuts* esdTrackCutsStd2010 = new AliESDtrackCuts("AliESDtrackCuts", "Standard2010");
+  // TPC  
+  esdTrackCutsStd2010->SetMinNClustersTPC(70); 
+  esdTrackCutsStd2010->SetMaxChi2PerClusterTPC(4);
+  esdTrackCutsStd2010->SetAcceptKinkDaughters(kFALSE); 
+  esdTrackCutsStd2010->SetRequireTPCRefit(kTRUE);
+  // ITS
+  esdTrackCuts->SetRequireITSRefit(kTRUE);
+  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                        AliESDtrackCuts::kAny);
+  esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");//selects primaries
+  esdTrackCutsStd2010->SetMaxDCAToVertexZ(2);
+  esdTrackCutsStd2010->SetDCAToVertex2D(kFALSE);
+  esdTrackCutsStd2010->SetRequireSigmaToVertex(kFALSE);
+
   AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
-  trackFilter->AddCuts(esdTrackCutsL);
+  trackFilter->AddCuts(esdTrackCutsStd2010);
   task->SetTrackFilter(trackFilter);
    
   
   // Create containers for input/output
   AliAnalysisDataContainer *cInputTOFqa = mgr->CreateContainer("cInputTOFqa",TChain::Class(),AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *cOutGeneralTOFqa = mgr->CreateContainer("cOutGeneralTOFqa",TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:TOF_Performance",mgr->GetCommonFileName()));
-   AliAnalysisDataContainer *cOutExpertsTOFqa = mgr->CreateContainer("cOutExpertsTOFqa",TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:TOF_Performance",mgr->GetCommonFileName()));
+  AliAnalysisDataContainer *cGeneralTOFqa = mgr->CreateContainer("cGeneralTOFqa",TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:TOF_Performance",mgr->GetCommonFileName()));
+  AliAnalysisDataContainer *cTimeZeroTOFqa = mgr->CreateContainer("cTimeZeroTOFqa",TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:TOF_Performance",mgr->GetCommonFileName()));
+   AliAnalysisDataContainer *cPIDTOFqa = mgr->CreateContainer("cPIDTOFqa",TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:TOF_Performance",mgr->GetCommonFileName()));
   // Attach i/o
   mgr->ConnectInput(task, 0,mgr->GetCommonInputContainer());
-  mgr->ConnectOutput(task, 1, cOutGeneralTOFqa);
-  mgr->ConnectOutput(task, 2, cOutExpertsTOFqa);
+  mgr->ConnectOutput(task, 1, cGeneralTOFqa);
+  mgr->ConnectOutput(task, 2, cTimeZeroTOFqa);
+  mgr->ConnectOutput(task, 3, cPIDTOFqa);
   
   return task;
 }
index 2557f33..af85937 100644 (file)
@@ -1,5 +1,5 @@
 /*  created by fbellini@cern.ch on 14/09/2010 */
-/*  last modified by fbellini   on 21/10/2010 */
+/*  last modified by fbellini   on 08/03/2010 */
 
 
 #ifndef ALIANALYSISTASKTOFQA_CXX
@@ -14,6 +14,7 @@
 #include "AliAnalysisManager.h"
 #include "AliESDEvent.h"
 #include "AliESDInputHandler.h"
+#include "AliESDpid.h"
 #include "AliAnalysisTaskTOFqa.h"
 #include "AliAnalysisFilter.h"
 #include "AliESDtrackCuts.h"
@@ -30,13 +31,20 @@ AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa() :
   fTrackFilter(0x0), 
   fVertex(0x0),
   fNTOFtracks(0), 
-  fNPrimaryTracks(0), 
-  fT0(0), 
+//  fNPrimaryTracks(0), 
   fHlist(0x0),
-  fHlistExperts(0x0)
+  fHlistTimeZero(0x0),
+  fHlistPID(0x0)
  {
   // Default constructor
-}
+   fESDpid=new AliESDpid();
+   for (Int_t j=0;j<3;j++ ) {
+     if (j<3) fT0[j]=0.0;
+     fSigmaSpecie[j]=0.0;
+     fTrkExpTimes[j]=0.0;
+     fThExpTimes[j]=0.0;
+   }
+ }
 //________________________________________________________________________
 AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const char *name) : 
   AliAnalysisTaskSE(name), 
@@ -45,15 +53,22 @@ AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const char *name) :
   fTrackFilter(0x0),
   fVertex(0x0),
   fNTOFtracks(0), 
-  fNPrimaryTracks(0), 
-  fT0(0), 
+  // fNPrimaryTracks(0),  
   fHlist(0x0),
-  fHlistExperts(0)
+  fHlistTimeZero(0),
+  fHlistPID(0x0)
  {
   // Constructor
   // Define input and output slots here
    Info("AliAnalysisTaskTOFqa","Calling Constructor");
    
+   fESDpid=new AliESDpid();
+   for (Int_t j=0;j<5;j++ ) {
+     if (j<3) fT0[j]=0.0;
+     fSigmaSpecie[j]=0.0;
+     fTrkExpTimes[j]=0.0;
+     fThExpTimes[j]=0.0;
+   }
    // Input slot #0 works with a TChain
    DefineInput(0, TChain::Class());
    
@@ -61,6 +76,7 @@ AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const char *name) :
    // Output slot #1 writes into a user defined  container
    DefineOutput(1, TList::Class());
    DefineOutput(2, TList::Class());
+   DefineOutput(3, TList::Class());
  }
 
 //________________________________________________________________________
@@ -71,12 +87,20 @@ AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const AliAnalysisTaskTOFqa& copy)
   fTrackFilter(copy.fTrackFilter), 
   fVertex(copy.fVertex),
   fNTOFtracks(copy.fNTOFtracks), 
-  fNPrimaryTracks(copy.fNPrimaryTracks), 
-  fT0(copy.fT0),
+  //fNPrimaryTracks(copy.fNPrimaryTracks), 
   fHlist(copy.fHlist),
-  fHlistExperts(copy.fHlistExperts)
+  fHlistTimeZero(copy.fHlistTimeZero),
+  fHlistPID(copy.fHlistPID)
 {
   // Copy constructor
+   for (Int_t j=0;j<5;j++ ) {
+     if (j<3) fT0[j]=copy.fT0[j];
+     fSigmaSpecie[j]=copy.fSigmaSpecie[j];
+     fTrkExpTimes[j]=copy.fTrkExpTimes[j];
+     fThExpTimes[j]=copy.fThExpTimes[j];
+   }
+  fESDpid=copy.fESDpid;
+
 }
 
 //___________________________________________________________________________
@@ -91,11 +115,18 @@ AliAnalysisTaskTOFqa& AliAnalysisTaskTOFqa::operator=(const AliAnalysisTaskTOFqa
     fESD=copy.fESD;
     fTrackFilter=copy.fTrackFilter;
     fVertex=copy.fVertex;
+    fESDpid=copy.fESDpid;
     fNTOFtracks=copy.fNTOFtracks; 
-    fNPrimaryTracks=copy.fNPrimaryTracks; 
-    fT0=copy.fT0;
+    //fNPrimaryTracks=copy.fNPrimaryTracks; 
+    for (Int_t j=0;j<5;j++ ) {
+      if (j<3) fT0[j]=copy.fT0[j];
+      fSigmaSpecie[j]=copy.fSigmaSpecie[j];
+      fTrkExpTimes[j]=copy.fTrkExpTimes[j];
+      fThExpTimes[j]=copy.fThExpTimes[j];
+    }
     fHlist=copy.fHlist;
-    fHlistExperts=copy.fHlistExperts;
+    fHlistTimeZero=copy.fHlistTimeZero;
+    fHlistPID=copy.fHlistPID;
   }
   return *this;
 }
@@ -107,15 +138,20 @@ AliAnalysisTaskTOFqa::~AliAnalysisTaskTOFqa() {
   //
 
   Info("~AliAnalysisTaskTOFqa","Calling Destructor");
+  if (fESDpid) delete fESDpid;
   if (fVertex) delete fVertex;
   if (fTrackFilter) delete fTrackFilter;
   if (fHlist) {
     delete fHlist;
     fHlist = 0;
   }
-  if (fHlistExperts) {
-    delete fHlistExperts;
-    fHlistExperts = 0;
+  if (fHlistTimeZero) {
+    delete fHlistTimeZero;
+    fHlistTimeZero = 0;
+  }
+  if (fHlistPID){
+    delete fHlistPID;
+    fHlistPID = 0;
   }
 }
 
@@ -127,150 +163,362 @@ void AliAnalysisTaskTOFqa::UserCreateOutputObjects()
   OpenFile(1);
   if (!fHlist) fHlist = new TList();   
   fHlist->SetOwner(kTRUE);
-  if (!fHlistExperts) fHlistExperts = new TList();     
-  fHlistExperts->SetOwner(kTRUE);
-  //0
-  TH1I* hTOFmatchedESDperEvt = new TH1I("hTOFmatchedPerEvt", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 100, 0, 100) ;  
+  if (!fHlistTimeZero) fHlistTimeZero = new TList();   
+  fHlistTimeZero->SetOwner(kTRUE);
+  if (!fHlistPID) fHlistPID = new TList();     
+  fHlistPID->SetOwner(kTRUE);
+
+//0
+  TH1I* hTOFmatchedESDperEvt = new TH1I("hTOFmatchedPerEvt", "Matched TOF tracks per event (|#eta| #leq 0.9 and pT #geq 0.3 GeV/c);TOF-matched ESD tracks;Events", 100, 0, 100) ;  
+  hTOFmatchedESDperEvt->Sumw2() ;
   hTOFmatchedESDperEvt->SetLineWidth(2);
   hTOFmatchedESDperEvt->SetLineColor(kBlue);
+  hTOFmatchedESDperEvt->SetMarkerStyle(20);
+  hTOFmatchedESDperEvt->SetMarkerSize(0.8);
+  hTOFmatchedESDperEvt->SetMarkerColor(kBlue);
   fHlist->AddLast(hTOFmatchedESDperEvt) ;
   //1
   TH1F* hTOFmatchedESDtime = new TH1F("hTOFmatchedESDtime", "Matched  ESDs tracks: TOF Time spectrum; t [ns];Counts", 250, 0., 610. ) ; 
+  hTOFmatchedESDtime->Sumw2() ;
   hTOFmatchedESDtime->SetLineWidth(2);
   hTOFmatchedESDtime->SetLineColor(kBlue);
   hTOFmatchedESDtime->SetFillColor(kBlue);
+  hTOFmatchedESDtime->SetDrawOption("BAR");
   fHlist->AddLast(hTOFmatchedESDtime) ;
   //2
   TH1F* hTOFmatchedESDrawTime = new TH1F("hTOFmatchedESDrawTime", "Matched ESDs tracks: TOF raw Time spectrum;t_{raw} [ns];Counts", 250, 0., 610.) ; 
+  hTOFmatchedESDrawTime->Sumw2() ;
   hTOFmatchedESDrawTime->SetLineWidth(2);
-  hTOFmatchedESDrawTime->SetLineColor(kGreen+2);
-  hTOFmatchedESDrawTime->SetFillColor(kGreen+2);
+  hTOFmatchedESDrawTime->SetLineColor(kAzure+2);
+  hTOFmatchedESDrawTime->SetFillColor(kAzure+2);
+  hTOFmatchedESDrawTime->SetDrawOption("BAR");
   fHlist->AddLast(hTOFmatchedESDrawTime) ;
   //3
   TH1F* hTOFmatchedESDToT = new TH1F("hTOFmatchedESDToT", "Matched ESDs tracks: TOF ToT spectrum; ToT [ns];Counts",100, 0., 48.8) ; 
-  hTOFmatchedESDToT->SetLineWidth(2);
-  hTOFmatchedESDToT->SetLineColor(kBlue);
-  hTOFmatchedESDToT->SetFillColor(kBlue);
+  hTOFmatchedESDToT->Sumw2() ;
+  hTOFmatchedESDToT->SetLineColor(kOrange+1);
+  hTOFmatchedESDToT->SetMarkerColor(kOrange+1);
+  hTOFmatchedESDToT->SetFillColor(kOrange+1);
+  hTOFmatchedESDToT->SetDrawOption("BAR");
   fHlist->AddLast(hTOFmatchedESDToT) ;
   //4
-  TH1F* hTOFmatchedESDP  = new TH1F("hTOFmatchedESDP", "TPC-TOF matched tracks momentum distribution (GeV/c); P(GeV/c);tracks", 500,0.,5.) ;  
-  hTOFmatchedESDP->SetLineWidth(1);
+  TH1F* hTOFmatchedESDtrkLength  = new TH1F("hTOFmatchedESDtrkLength", "Matched ESDs tracks length; Track length [cm];Counts", 1200, -400., 800) ; 
+  hTOFmatchedESDtrkLength->Sumw2();
+  hTOFmatchedESDtrkLength->SetLineColor(kViolet-3);
+  hTOFmatchedESDtrkLength->SetMarkerColor(kViolet-3);
+  hTOFmatchedESDtrkLength->SetFillColor(kViolet-3);
+  hTOFmatchedESDtrkLength->SetDrawOption("BAR"); 
+  fHlist->AddLast(hTOFmatchedESDtrkLength);
+  //5
+  TH1F* hTOFmatchedESDP  = new TH1F("hTOFmatchedESDP", "TPC-TOF matched tracks momentum distribution (GeV/c); p (GeV/c);tracks", 500,0.,5.) ;  
+  hTOFmatchedESDP->Sumw2() ;
   hTOFmatchedESDP->SetLineColor(kBlue);
-  hTOFmatchedESDP->SetMarkerStyle(21);
-  hTOFmatchedESDP->SetMarkerSize(0.6);
+  hTOFmatchedESDP->SetMarkerStyle(20);
+  hTOFmatchedESDP->SetMarkerSize(0.7);
   hTOFmatchedESDP->SetMarkerColor(kBlue);
   fHlist->AddLast(hTOFmatchedESDP) ; 
-  //5
+  //6
   TH1F* hTOFmatchedESDPt  = new TH1F("hTOFmatchedESDPt", "TPC-TOF matched tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500,0.,5.) ;  
-  hTOFmatchedESDPt->SetLineWidth(1);
+  hTOFmatchedESDPt->Sumw2() ;
   hTOFmatchedESDPt->SetLineColor(kBlue);
-  hTOFmatchedESDPt->SetMarkerStyle(4);
-  hTOFmatchedESDPt->SetMarkerSize(0.6);
+  hTOFmatchedESDPt->SetMarkerStyle(21);
+  hTOFmatchedESDPt->SetMarkerSize(0.7);
   hTOFmatchedESDPt->SetMarkerColor(kBlue);
   fHlist->AddLast(hTOFmatchedESDPt) ; 
-  //6
-  TH1F* hTOFmatchedESDtrkLength  = new TH1F("hTOFmatchedESDtrkLength", "Matched ESDs tracks length; Track length [cm];Counts", 1600, -800., 800) ; 
-  hTOFmatchedESDtrkLength->SetLineWidth(1);
-  hTOFmatchedESDtrkLength->SetLineColor(kBlue);
-  fHlist->AddLast(hTOFmatchedESDtrkLength) ; 
+
   //7
-  TH2F* hTOFmatchedESDpVsBeta  = new TH2F("hTOFmatchedESDpVsBeta", "Matched ESDs tracks p vs. beta; p(GeV/c); beta", 500, 0., 5.,500, 0., 5.) ; 
-  fHlist->AddLast(hTOFmatchedESDpVsBeta);
-  
+  TH1F* hTOFmatchedESDeta = new TH1F("hTOFmatchedESDeta", "Matched ESDtracks #eta (p_{T} #geq 0.5 GeV/c); #eta;Counts", 200, -1., 1.) ; 
+  hTOFmatchedESDeta->Sumw2();
+  hTOFmatchedESDeta->SetLineColor(kBlue);
+  fHlist->AddLast(hTOFmatchedESDeta) ; 
   //8
-  TH1F* hESDprimaryTrackP = new TH1F("hESDprimaryTrackP", "All ESDs tracks Pt distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0., 5.0) ;  
+   TH1F* hTOFmatchedESDphi = new TH1F("hTOFmatchedESDphi", "Matched ESDtracks #phi; #phi (deg);Counts", 72, 0., 365.) ; 
+  hTOFmatchedESDphi->Sumw2();
+  hTOFmatchedESDphi->SetLineColor(kBlue);
+  fHlist->AddLast(hTOFmatchedESDphi) ; 
+
+  //9
+  TH1F* hESDprimaryTrackP = new TH1F("hESDprimaryTrackP", "All ESDs tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0., 5.0) ;  
+  hESDprimaryTrackP->Sumw2();
   hESDprimaryTrackP->SetLineWidth(1);
-  hESDprimaryTrackP->SetMarkerStyle(8);
-  hESDprimaryTrackP->SetMarkerSize(0.6);
-  hESDprimaryTrackP->SetLineColor(kGray+1);
+  hESDprimaryTrackP->SetMarkerStyle(24);
+  hESDprimaryTrackP->SetMarkerSize(0.7);
+  hESDprimaryTrackP->SetMarkerColor(kRed);
+  hESDprimaryTrackP->SetLineColor(kRed);
   fHlist->AddLast(hESDprimaryTrackP);
-  //9
-  TH1F* hESDprimaryTrackPt = new TH1F("hESDprimaryTrackPt", "ESDs primary tracks Pt distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0.0, 5.0) ;  
+  //10
+  TH1F* hESDprimaryTrackPt = new TH1F("hESDprimaryTrackPt", "ESDs primary tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0.0, 5.0) ;  
+  hESDprimaryTrackPt->Sumw2();
   hESDprimaryTrackPt->SetLineWidth(1);
-  hESDprimaryTrackPt->SetMarkerStyle(4);
-  hESDprimaryTrackPt->SetMarkerSize(0.6);
-  hESDprimaryTrackPt->SetLineColor(kBlack);
+  hESDprimaryTrackPt->SetMarkerStyle(25);
+  hESDprimaryTrackPt->SetMarkerSize(0.7);
+  hESDprimaryTrackPt->SetLineColor(kRed);
+  hESDprimaryTrackPt->SetMarkerColor(kRed);
   fHlist->AddLast(hESDprimaryTrackPt);
-  //10
-  TH1F* hTOFmatchedESDeta = new TH1F("hTOFmatchedESDeta", "Matched ESDtracks eta; eta;Counts", 500, -2.5, 2.5) ; 
-  fHlist->AddLast(hTOFmatchedESDeta) ; 
   //11
-  TH1F* hTOFprimaryESDeta = new TH1F("hTOFprimaryESDeta", "Primary ESDtracks eta; eta;Counts", 500, -2.5, 2.5) ; 
+  TH1F* hTOFprimaryESDeta = new TH1F("hTOFprimaryESDeta", "Primary ESDtracks #eta (p_{T} #geq 0.5 GeV/c); #eta;Counts",200, -1., 1.) ; 
+  hTOFprimaryESDeta->Sumw2();
+  hTOFprimaryESDeta->SetLineColor(kRed);
   fHlist->AddLast(hTOFprimaryESDeta) ; 
   //12
-  TH1F* hTOFmatchedESDphi = new TH1F("hTOFmatchedESDphi", "Matched ESDtracks Phi; Phi (rad);Counts", 65, 0., 6.5) ; 
-  fHlist->AddLast(hTOFmatchedESDphi) ; 
-  //13
-  TH1F* hTOFprimaryESDphi = new TH1F("hTOFprimaryESDphi", "Primary ESDtracks Phi;Phi (rad);Counts", 65, 0., 6.5) ; 
+  TH1F* hTOFprimaryESDphi = new TH1F("hTOFprimaryESDphi", "Primary ESDtracks #phi;#phi (deg);Counts", 72, 0., 360.) ; 
+  hTOFprimaryESDphi->Sumw2();
+  hTOFprimaryESDphi->SetLineColor(kRed);
   fHlist->AddLast(hTOFprimaryESDphi) ; 
-  
-  //Experts 0
-  TH1F* hTOFESDsMatchingProb  = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability per event(|eta|<0.9 && pt>0.5GeV/c);TPC-TOF track-matching probability (%)  ;Counts",21, 0., 110.) ;  
-  hTOFESDsMatchingProb->SetLineColor(kRed);
-  fHlistExperts->AddLast(hTOFESDsMatchingProb) ; 
-  
-  //Experts 1
-  TH1F* hTOFmatchedESDdiffTime  = new TH1F("hTOFmatchedESDdiffTime", "ESDs t_{TOF}-t_{pi,exp} spectrum in TOF (ps); t_{TOF}-t_{pi,exp} [ps];Counts", 4000, -50000., 50000.) ; 
-  hTOFmatchedESDdiffTime->SetLineWidth(1);
-  hTOFmatchedESDdiffTime->SetLineColor(kBlack);
-  hTOFmatchedESDdiffTime->SetMarkerStyle(8);
-  hTOFmatchedESDdiffTime->SetMarkerSize(0.8);
-  hTOFmatchedESDdiffTime->SetMarkerColor(kAzure+7);
-  hTOFmatchedESDdiffTime->SetFillColor(kAzure-2);
-  fHlistExperts->AddLast(hTOFmatchedESDdiffTime) ; 
-  
-  //Experts 2
-  TH2F* hTOFmatchedESDdiffTimeVsStrip = new TH2F("hTOFmatchedESDdiffTimeVsStrip", "ESDs t_{TOF}-t_{pi,exp} vs strip number; strip (Eta); t_{TOF}-t_{pi,exp} [ps]", 92,0.,92,400, -5000., 5000.) ; 
-  fHlistExperts->AddLast(hTOFmatchedESDdiffTimeVsStrip) ; 
-  
-  //Experts 3
-  TH2F* hTOFmatchedESDdxVsEta = new TH2F("hTOFmatchedESDdxVsEta", "Matched ESD tracks Dx vs eta; strip(eta); Dx (cm)", 92,0.,92., 200,-10.,10.) ; 
-  fHlistExperts->AddLast(hTOFmatchedESDdxVsEta) ; 
-  
-  //Experts 4
-  TH2F* hTOFmatchedESDdzVsEta  = new TH2F("hTOFmatchedESDdzVsEta", "Matched ESDtracks Dz vs eta; strip(eta); Dz (cm)", 92,0.,92., 200,-10.,10.) ; 
-  fHlistExperts->AddLast(hTOFmatchedESDdzVsEta) ; 
-  
-  //Experts 5
-  TH1F* hTOFmatchedMass= new TH1F("hTOFmatchedMass","Matched ESD tracks mass distribution; M (GeV/c^{2}); entries", 500,0., 5. );
-  hTOFmatchedMass->SetLineWidth(2);
-  hTOFmatchedMass->SetLineColor(kBlue);
-  hTOFmatchedMass->SetLineColor(kBlue);
-  fHlistExperts->AddLast(hTOFmatchedMass);
-   
-  //Experts 6
-  TH1D* hEventT0DetAND = new TH1D("hEventT0DetAND", "Event T0 from T0 detector (A&C); t [ps];Counts", 4000, -50000., 50000. ) ; 
+  //13
+  TH2F* hTOFmatchedDxVsPtPos = new TH2F("hTOFmatchedDxVsPtPos", "Dx vs p_{T} for positive tracks;p_{T} (GeV/c); Dx [cm]; hits", 500,0.,5.,200, -10., 10.) ; 
+  hTOFmatchedDxVsPtPos->Sumw2();
+  fHlist->AddLast(hTOFmatchedDxVsPtPos) ; 
+ //14
+  TH2F* hTOFmatchedDxVsPtNeg = new TH2F("hTOFmatchedDxVsPtNeg", "Dx vs p_{T} for negative tracks;p_{T} (GeV/c); Dx [cm]; hits", 500,0.,5.,200, -10., 10.) ; 
+  hTOFmatchedDxVsPtNeg->Sumw2();
+  fHlist->AddLast(hTOFmatchedDxVsPtNeg) ; 
+
+  //15
+  TH2F* hTOFmatchedDzVsStrip = new TH2F("hTOFmatchedDzVsStrip", "Dz vs strip; strip (#eta); Dz [cm]; hits", 92,0.,92.,200, -10., 10.) ; 
+  hTOFmatchedDzVsStrip->Sumw2();
+  fHlist->AddLast(hTOFmatchedDzVsStrip) ; 
+ //----------------------------------------------timeZero QA plots
+  //TimeZero 0
+  TH1D* hEventT0DetAND = new TH1D("hEventT0DetAND", "Event timeZero from T0AC detector ; t0 [ps]; events", 1000, -25000., 25000. ) ; 
+  hEventT0DetAND->Sumw2() ;
   hEventT0DetAND->SetLineWidth(2);
   hEventT0DetAND->SetLineColor(kRed);
   hEventT0DetAND->SetFillColor(kRed);
-  fHlistExperts->AddLast(hEventT0DetAND) ;
+  fHlistTimeZero->AddLast(hEventT0DetAND) ;
 
-  //Experts 7
-  TH1D* hEventT0DetA = new TH1D("hEventT0DetA", "Event T0 from T0 detector (A side); t [ps];Counts", 4000, -50000., 50000. ) ; 
+  //TImeZero 1
+  TH1D* hEventT0DetA = new TH1D("hEventT0DetA", "Event timeZero from T0A detector; t0 [ps]; events", 1000, -25000., 25000. ) ; 
+  hEventT0DetA->Sumw2() ;
   hEventT0DetA->SetLineWidth(2);
   hEventT0DetA->SetLineColor(kBlue);
   hEventT0DetA->SetFillColor(kBlue);
-  fHlistExperts->AddLast(hEventT0DetA) ;
+  fHlistTimeZero->AddLast(hEventT0DetA) ;
 
-   //Experts 8
-  TH1D* hEventT0DetC = new TH1D("hEventT0DetC", "Event T0 from T0 detector (C side); t [ps];Counts", 4000, -50000., 50000. ) ; 
+   //TImeZero 2
+  TH1D* hEventT0DetC = new TH1D("hEventT0DetC", "Event timeZero from T0C detector; t0 [ps]; events", 1000, -25000., 25000.) ; 
+  hEventT0DetC->Sumw2() ;
   hEventT0DetC->SetLineWidth(2);
   hEventT0DetC->SetLineColor(kGreen);
   hEventT0DetC->SetFillColor(kGreen);
-  fHlistExperts->AddLast(hEventT0DetC);
+  fHlistTimeZero->AddLast(hEventT0DetC);
+
+   //TimeZero 3
+  TH1F* hT0DetRes = new TH1F("hT0DetRes", "T0 detector (T0A-T0C)/2; (T0A-T0C)/2 [ps]; events", 200, -500.,500. ) ; 
+  hT0DetRes->Sumw2() ;
+  hT0DetRes->SetMarkerStyle(24);
+  hT0DetRes->SetMarkerSize(0.7);
+  hT0DetRes->SetMarkerColor(kMagenta+2);
+  hT0DetRes->SetLineColor(kMagenta+2);
+  hT0DetRes->SetFillColor(kMagenta+2);  
+  fHlistTimeZero->AddLast(hT0DetRes) ; 
+
+     //timeZero 4
+  TH1F* hT0fill = new TH1F("hT0fill", "Event timeZero of fill; t0 [ps]; events", 1000, -25000., 25000. ) ; 
+  hT0fill->Sumw2() ;
+  hT0fill->SetMarkerStyle(20);
+  hT0fill->SetMarkerColor(kBlack);
+  hT0fill->SetLineColor(kBlack);
+  fHlistTimeZero->AddLast(hT0fill) ; 
+
+  //TimeZero 5
+  TH1F* hT0TOF = new TH1F("hT0TOF", "Event timeZero estimated by TOF; t0 [ps]; events", 1000, -25000., 25000. ) ; 
+  hT0TOF->Sumw2() ;
+  hT0TOF->SetMarkerStyle(20);
+  hT0TOF->SetMarkerColor(kBlue);
+  hT0TOF->SetLineColor(kBlue);
+  hT0TOF->SetFillColor(kBlue);
+  fHlistTimeZero->AddLast(hT0TOF) ;
+
+
+   //timeZero 6
+  TH1F* hT0T0 = new TH1F("hT0T0", "Event timeZero measured by T0 detector (best between AC, A, C); t0 [ps]; events", 1000, -25000.,25000. ) ; 
+  hT0T0->Sumw2() ;
+  hT0T0->SetMarkerStyle(20);
+  hT0T0->SetMarkerColor(kGreen+1);
+  hT0T0->SetLineColor(kGreen+1);
+  hT0T0->SetFillColor(kGreen+1);
+  fHlistTimeZero->AddLast(hT0T0) ; 
+
+   //timeZero 7
+  TH1F* hT0best = new TH1F("hT0best", "Event timeZero estimated as T0best; t0 [ps]; events", 1000, -25000.,25000. ) ; 
+  hT0best->Sumw2() ;
+  hT0best->SetMarkerStyle(20);
+  hT0best->SetMarkerColor(kRed);
+  hT0best->SetLineColor(kRed);
+  hT0best->SetFillColor(kRed); 
+  fHlistTimeZero->AddLast(hT0best) ; 
+
+   //TimeZero 8
+  TH1F* hT0fillRes = new TH1F("hT0fillRes", "Resolution of fillT0; #sigma_{bestT0} [ps];events", 250, 0.,250. ) ; 
+  hT0fillRes->Sumw2() ;
+  hT0fillRes->SetMarkerStyle(21);
+  hT0fillRes->SetMarkerColor(kBlack);
+  hT0fillRes->SetLineColor(kBlack);
+  hT0fillRes->SetFillColor(kBlack); 
+  fHlistTimeZero->AddLast(hT0fillRes) ; 
  
-  //Experts 9
-  TH1F* hTOFmatchedExpTime = new TH1F("hTOFmatchedExpTime", "Matched  ESDs tracks - pions expected  time; t [ns];Counts", 4000, -50000., 50000. ) ; 
-  hTOFmatchedExpTime->SetLineWidth(1);
-  hTOFmatchedExpTime->SetLineColor(kBlack);
-  hTOFmatchedExpTime->SetMarkerStyle(8);
-  hTOFmatchedExpTime->SetMarkerSize(0.8); 
-  hTOFmatchedExpTime->SetMarkerColor(kRed);
-  fHlistExperts->AddLast(hTOFmatchedExpTime) ;
+  //TimeZero 9
+  TH1F* hT0TOFRes = new TH1F("hT0TOFRes", "Resolution of timeZero from TOF; #sigma_{TOFT0} [ps];events", 250, 0.,250. ) ; 
+  hT0TOFRes->Sumw2() ;
+  hT0TOFRes->SetLineWidth(1);
+  hT0TOFRes->SetMarkerStyle(21);
+  hT0TOFRes->SetMarkerColor(kBlue);
+  hT0TOFRes->SetLineColor(kBlue);
+  hT0TOFRes->SetFillColor(kBlue); 
+  fHlistTimeZero->AddLast(hT0TOFRes) ; 
 
+   //TimeZero 10
+  TH1F* hT0T0res = new TH1F("hT0T0res", "Resolution of timeZero from T0;#sigma_{T0T0}  [ps];events", 250, -0., 250. ) ; 
+  hT0T0res->Sumw2() ;
+  hT0T0res->SetMarkerStyle(21);
+  hT0T0res->SetMarkerColor(kGreen+1);
+  hT0T0res->SetLineColor(kGreen+1);
+  hT0T0res->SetFillColor(kGreen+1); 
+  fHlistTimeZero->AddLast(hT0T0res) ; 
+
+   //TimeZero 11
+  TH1F* hT0bestRes = new TH1F("hT0bestRes", "Resolution of bestT0; #sigma_{bestT0} [ps];events", 250, 0.,250. ) ; 
+  hT0bestRes->Sumw2() ;
+  hT0fillRes->SetMarkerStyle(21);
+  hT0fillRes->SetMarkerColor(kRed);
+  hT0fillRes->SetLineColor(kRed);
+  hT0fillRes->SetFillColor(kRed); 
+  fHlistTimeZero->AddLast(hT0bestRes) ; 
+
+  //timeZero 12
+  TH2F* hT0TOFvsNtrk = new TH2F("hT0TOFvsNtrk", "Event timeZero estimated by TOF vs. number of tracks in event;TOF-matching tracks; t0 [ps]", 100, 0., 100.,1000,-25000.,25000. ) ; 
+  hT0TOFvsNtrk->Sumw2() ;
+  fHlistTimeZero->AddLast(hT0TOFvsNtrk) ;
+
+//--------------------------------------------- TOF PID QA plots
+  //PID 0
+  TH2F* hTOFmatchedESDpVsBeta  = new TH2F("hTOFmatchedESDpVsBeta", "Matched ESDs tracks beta vs. p; p(GeV/c); beta", 500, 0.0, 5.0, 150,0., 1.5) ; 
+  fHlistPID->AddLast(hTOFmatchedESDpVsBeta);
   
+  //PID 1 
+  TH1F* hTOFmatchedMass= new TH1F("hTOFmatchedMass","Matched ESD tracks mass distribution - (L>0); M (GeV/c^{2}); entries", 500,0., 5. );
+  hTOFmatchedMass->Sumw2();
+  hTOFmatchedMass->SetLineWidth(2);
+  hTOFmatchedMass->SetLineColor(kBlue);
+  hTOFmatchedMass->SetLineColor(kBlue);
+  fHlistPID->AddLast(hTOFmatchedMass);
+  
+  //PID 2
+  TH2F* hTOFmatchedExpTimePiVsEta = new TH2F("hTOFmatchedExpTimePiVsEta", "ESDs t_{TOF}-t_{#pi,exp} (from tracking); strip (#eta); t_{TOF}-t_{#pi,exp} [ps]",92,0,92,2000, -5000., 5000. ) ; 
+  hTOFmatchedExpTimePiVsEta->Sumw2() ;
+  fHlistPID->AddLast(hTOFmatchedExpTimePiVsEta) ;
+  
+  //PID 3
+  TH1F* hTOFmatchedExpTimePi = new TH1F("hTOFmatchedExpTimePi", "ESDs t_{TOF}-t_{#pi,exp} (from tracking); t_{TOF}-t_{#pi,exp} [ps];Counts",5000, -25000., 25000. ) ; 
+  hTOFmatchedExpTimePi->Sumw2() ;
+  hTOFmatchedExpTimePi->SetLineWidth(1);
+  hTOFmatchedExpTimePi->SetLineColor(kRed);
+  hTOFmatchedExpTimePi->SetMarkerStyle(20);
+  hTOFmatchedExpTimePi->SetMarkerSize(0.8); 
+  hTOFmatchedExpTimePi->SetMarkerColor(kRed);
+  fHlistPID->AddLast(hTOFmatchedExpTimePi) ;
+  
+  //PID 4
+  TH2F* hTOFmatchedExpTimePiVsP = new TH2F("hTOFmatchedExpTimePiVsP", "ESDs t_{TOF}-t_{#pi,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{#pi,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFmatchedExpTimePiVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFmatchedExpTimePiVsP) ;
+
+  //PID 5
+  TH1F* hTOFtheoreticalExpTimePi = new TH1F("hTOFtheoreticalExpTimePi", "ESDs t_{TOF}-t_{#pi,exp} (theoretical); t_{TOF}-t_{#pi,exp} [ps];Counts", 5000, -25000., 25000. ) ; 
+  hTOFtheoreticalExpTimePi->Sumw2() ;
+  hTOFtheoreticalExpTimePi->SetLineWidth(1);
+  hTOFtheoreticalExpTimePi->SetLineColor(kRed);
+  hTOFtheoreticalExpTimePi->SetMarkerStyle(24);
+  hTOFtheoreticalExpTimePi->SetMarkerSize(0.8); 
+  hTOFtheoreticalExpTimePi->SetMarkerColor(kRed);
+  fHlistPID->AddLast(hTOFtheoreticalExpTimePi) ;
+
+  //PID 6
+  TH2F* hTOFtheoreticalExpTimePiVsP = new TH2F("hTOFtheoreticalExpTimePiVsP", "ESDs t_{TOF}-t_{#pi,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{#pi,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFtheoreticalExpTimePiVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFtheoreticalExpTimePiVsP) ;
+
+  //PID 7
+  TH2F* hTOFExpSigmaPi = new TH2F("hTOFExpSigmaPi", "ESDs TOF n#sigma_{PID,#pi} vs p_{T}; p_{T} (GeV/c); n#sigma_{PID,#pi};Tracks", 500,0.,5.,200, -10., 10. ) ; 
+  hTOFExpSigmaPi->Sumw2() ;
+  fHlistPID->AddLast(hTOFExpSigmaPi) ;
+
+  //PID 8
+  TH1F* hTOFmatchedExpTimeKa = new TH1F("hTOFmatchedExpTimeKa", "ESDs t_{TOF}-t_{K,exp} (from tracking); t_{TOF}-t_{K,exp} [ps];Counts", 500, -5000., 5000. ) ; 
+  hTOFmatchedExpTimeKa->Sumw2() ;
+  hTOFmatchedExpTimeKa->SetLineWidth(1);
+  hTOFmatchedExpTimeKa->SetLineColor(kBlue);
+  hTOFmatchedExpTimeKa->SetMarkerStyle(21);
+  hTOFmatchedExpTimeKa->SetMarkerSize(0.8); 
+  hTOFmatchedExpTimeKa->SetMarkerColor(kBlue);
+  fHlistPID->AddLast(hTOFmatchedExpTimeKa);
+
+  //PID 9
+  TH2F* hTOFmatchedExpTimeKaVsP = new TH2F("hTOFmatchedExpTimeKaVsP", "ESDs t_{TOF}-t_{K,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{K,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFmatchedExpTimeKaVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFmatchedExpTimeKaVsP) ; 
+  
+  //PID 10
+  TH1F* hTOFtheoreticalExpTimeKa = new TH1F("hTOFtheoreticalExpTimeKa", "ESDs t_{TOF}-t_{K,exp} (theoretical); t_{TOF}-t_{K,exp} [ps];Counts", 5000, -25000., 25000. ) ; 
+  hTOFtheoreticalExpTimeKa->Sumw2() ;
+  hTOFtheoreticalExpTimeKa->SetLineWidth(1);
+  hTOFtheoreticalExpTimeKa->SetLineColor(kBlue);
+  hTOFtheoreticalExpTimeKa->SetMarkerStyle(24);
+  hTOFtheoreticalExpTimeKa->SetMarkerSize(0.8); 
+  hTOFtheoreticalExpTimeKa->SetMarkerColor(kBlue);
+  fHlistPID->AddLast(hTOFtheoreticalExpTimeKa) ;  
+  
+  //PID 11
+  TH2F* hTOFtheoreticalExpTimeKaVsP = new TH2F("hTOFtheoreticalExpTimeKaVsP", "ESDs t_{TOF}-t_{K,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{K,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFtheoreticalExpTimeKaVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFtheoreticalExpTimeKaVsP) ; 
+  
+  //PID 12
+  TH2F* hTOFExpSigmaKa = new TH2F("hTOFExpSigmaKa", "ESDs TOF n#sigma_{PID,K} vs p_{T}; p_{T} (GeV/c);n#sigma_{PID,K};Tracks", 500, 0.,5.,200, -10., 10. ) ; 
+  hTOFExpSigmaKa->Sumw2() ;
+  fHlistPID->AddLast(hTOFExpSigmaKa) ;
+  
+  //PID 13
+  TH1F* hTOFmatchedExpTimePro = new TH1F("hTOFmatchedExpTimePro", "ESDs t_{TOF}-t_{p,exp} (from tracking); t_{TOF}-t_{p,exp} [ps];Counts", 500, -5000., 5000. ) ; 
+  hTOFmatchedExpTimePro->Sumw2() ;
+  hTOFmatchedExpTimePro->SetLineWidth(1);
+  hTOFmatchedExpTimePro->SetLineColor(kGreen+1);
+  hTOFmatchedExpTimePro->SetMarkerStyle(22);
+  hTOFmatchedExpTimePro->SetMarkerSize(0.8); 
+  hTOFmatchedExpTimePro->SetMarkerColor(kGreen+1);
+  fHlistPID->AddLast(hTOFmatchedExpTimePro) ;
+
+   //PID 14
+  TH2F* hTOFmatchedExpTimeProVsP = new TH2F("hTOFmatchedExpTimeProVsP", "ESDs t_{TOF}-t_{p,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{p,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFmatchedExpTimeProVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFmatchedExpTimeProVsP) ;
+  
+  //PID 15
+  TH1F* hTOFtheoreticalExpTimePro = new TH1F("hTOFtheoreticalExpTimePro", "ESDs t_{TOF}-t_{p,exp} (theoretical); t_{TOF}-t_{p,exp} [ps];Counts", 500, -5000., 5000. ) ; 
+  hTOFtheoreticalExpTimePro->Sumw2() ;
+  hTOFtheoreticalExpTimePro->SetLineWidth(1);
+  hTOFtheoreticalExpTimePro->SetLineColor(kGreen+1);
+  hTOFtheoreticalExpTimePro->SetMarkerStyle(26);
+  hTOFtheoreticalExpTimePro->SetMarkerSize(0.8); 
+  hTOFtheoreticalExpTimePro->SetMarkerColor(kGreen+1);
+  fHlistPID->AddLast(hTOFtheoreticalExpTimePro) ;
+
+  //PID 16
+  TH2F* hTOFtheoreticalExpTimeProVsP = new TH2F("hTOFtheoreticalExpTimeProVsP", "ESDs t_{TOF}-t_{p,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{p,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ; 
+  hTOFtheoreticalExpTimeProVsP->Sumw2() ;
+  fHlistPID->AddLast(hTOFtheoreticalExpTimeProVsP) ;
+
+  //PID 17
+  TH2F* hTOFExpSigmaPro = new TH2F("hTOFExpSigmaPro", "ESDs TOF n#sigma_{PID,p} vs. p_{T}; p_{T} (GeV/c); n#sigma_{PID,p};Tracks", 500, 0.,5.,200, -10., 10. ) ; 
+  hTOFExpSigmaPro->Sumw2() ;
+  fHlistPID->AddLast(hTOFExpSigmaPro) ;
+
   PostData(1, fHlist);
-  PostData(2, fHlistExperts);
+  PostData(2, fHlistTimeZero);
+  PostData(3, fHlistPID);
+
 }
 //________________________________________________________________________
 void AliAnalysisTaskTOFqa::UserExec(Option_t *) 
@@ -278,7 +526,6 @@ void AliAnalysisTaskTOFqa::UserExec(Option_t *)
   /* Main - executed for each event.
     It extracts event information and track information after selecting 
     primary tracks via standard cuts. */
-  const Double_t speedOfLight =  TMath::C()*1E2*1E-12; // cm/ps
   
   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
   if (!esdH) {
@@ -293,16 +540,44 @@ void AliAnalysisTaskTOFqa::UserExec(Option_t *)
     return;
   }
   
-  // loop over ESD tracks
-  fNTOFtracks=0;
-  fNPrimaryTracks=0;
+  /* info from T0 detector QA */
+  for (Int_t j=0;j<3;j++){
+    fT0[j]= (Float_t) fESD->GetT0TOF(j);//ps
+    if (fT0[j]>90000.) fT0[j]=99999.;//fix old default values to the new one
+  }
+  Float_t t0cut = 90000.; 
+  //Float_t t0cut =3 * t0spread; //use this cut to check t0 used in tof response
+  // if(t0cut < 500) t0cut = 500;
   
-  //info from To detector
-  fT0= fESD->GetT0TOF(0);//ps
-  ((TH1D*)fHlistExperts->At(6))->Fill(fT0);//ps
-  ((TH1D*)fHlistExperts->At(7))->Fill((Double_t)fESD->GetT0TOF(1)); //ps
-  ((TH1D*)fHlistExperts->At(8))->Fill((Double_t)fESD->GetT0TOF(2));//ps
-      
+  if(TMath::Abs(fT0[1]) < t0cut && TMath::Abs(fT0[2]) < t0cut ) {
+    //&& TMath::Abs(fT0[2]-fT0[1]) < 500)  //add this condition to check t0 used in tof response
+    ((TH1F*)fHlistTimeZero->At(3))->Fill((fT0[2]-fT0[1])*0.5);
+    ((TH1F*)fHlistTimeZero->At(0))->Fill(fT0[0]);  
+  } 
+  if(TMath::Abs(fT0[1]) < t0cut){
+    ((TH1F*)fHlistTimeZero->At(1))->Fill(fT0[1]);   
+  }
+  if(TMath::Abs(fT0[2]) < t0cut){
+    ((TH1F*)fHlistTimeZero->At(2))->Fill(fT0[2]);
+  }
+  
+  /*  event timeZero QA via AliESDpid::SetTOFResponse() */
+  Double_t timeZero[4]={99999.,99999.,99999.,99999.};
+  Double_t timeZeroRes[4]={99999.,99999.,99999.,99999.}; 
+  
+  for (Int_t j=0;j<4;j++){
+    fESDpid->SetTOFResponse(fESD, (AliESDpid::EStartTimeType_t) j);//(fill_t0, tof_t0, t0_t0, best_t0)
+    timeZero[j]=fESDpid->GetTOFResponse().GetStartTime(10.); //timeZero for bin pT>10GeV/c
+    timeZeroRes[j]=fESDpid->GetTOFResponse().GetStartTimeRes(10.); //timeZero for bin pT>10GeV/c
+    ((TH1D*)fHlistTimeZero->At(4+j))->Fill(timeZero[j]);
+    ((TH1D*)fHlistTimeZero->At(8+j))->Fill(timeZeroRes[j]);
+  }
+
+
+  /* loop over ESD tracks */
+  fNTOFtracks=0;
+  // fNPrimaryTracks=0;
+
   for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
     AliESDtrack* track = fESD->GetTrack(iTracks);
     if (!track) {
@@ -312,72 +587,100 @@ void AliAnalysisTaskTOFqa::UserExec(Option_t *)
 
     //primary tracks selection: kTPCrefit and std cuts
     if(!fTrackFilter->IsSelected(track)) continue;
-   
-    Double_t tofTime=track->GetTOFsignal();//in ps
-    Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
-    Double_t tofToT=track->GetTOFsignalToT(); //in ps
-    Double_t expTimes[5];
-    track->GetIntegratedTimes(expTimes);
-    Double_t length =track->GetIntegratedLength();
-    Double_t ptot[3];
-    track->GetConstrainedPxPyPz(ptot);    
-    Double_t pT = TMath::Sqrt(ptot[0]*ptot[0] + ptot[1]*ptot[1]);
-    Double_t P2 = pT*pT + ptot[2]*ptot[2];
     Double_t eta=track->Eta();
-    Int_t channel=track->GetTOFCalChannel(); 
-    Int_t volId[5]; //(sector, plate,strip,padZ,padX)
-    AliTOFGeometry::GetVolumeIndices(channel,volId);
-    
-    if (TMath::Abs(eta)<0.9) { //cut for acceptance
-      if (P2>=0)
-       ((TH1F*)fHlist->At(8))->Fill(TMath::Sqrt(P2)); 
-      ((TH1F*)fHlist->At(9))->Fill(track->Pt()); //all esd tracks within acceptance
+    if (TMath::Abs(eta)>0.9) continue; //cut for acceptance
+
+    Double_t mom=track->P();
+    Double_t mom2 = mom*mom;
+    Double_t length=track->GetIntegratedLength();
+    Double_t pT = track->Pt();
+    Double_t phi=track->Phi()*TMath::RadToDeg();
+    track->GetIntegratedTimes(fTrkExpTimes);
+      
+    ((TH1F*)fHlist->At(9))->Fill(mom); 
+    ((TH1F*)fHlist->At(10))->Fill(pT); 
+    if (pT>=0.5)
       ((TH1F*)fHlist->At(11))->Fill(eta);
-      ((TH1F*)fHlist->At(13))->Fill(track->Phi());
-      if ((TMath::Abs(track->Eta())<0.9)&&(track->Pt()>0.5)) fNPrimaryTracks++;
+    ((TH1F*)fHlist->At(12))->Fill(phi);
+    
+    //matched tracks selection: kTOFout and kTIME
+    if ((track->GetStatus() & AliESDtrack::kTOFout) &&
+       (track->GetStatus() & AliESDtrack::kTIME)) {      
       
-      //matched tracks selection: kTOFout and kTIME
-      if ((track->GetStatus() & AliESDtrack::kTOFout) &&
-         (track->GetStatus() & AliESDtrack::kTIME)) {      
-       
-       if ((TMath::Abs(track->Eta())<0.9)&&(track->Pt()>0.5)) fNTOFtracks++; //matched counter
-       
-         ((TH1F*)fHlist->At(1))->Fill(tofTime*1E-3); //ns
-         ((TH1F*)fHlist->At(2))->Fill(tofTimeRaw*1E-3); //ns
-         ((TH1F*)fHlist->At(3))->Fill(tofToT);
-         if (P2>=0)
-           ((TH1F*)fHlist->At(4))->Fill(TMath::Sqrt(P2));
-         ((TH1F*)fHlist->At(5))->Fill(track->Pt());
-         ((TH1F*)fHlist->At(6))->Fill(length);  
-         ((TH1F*)fHlist->At(10))->Fill(eta);
-         ((TH1F*)fHlist->At(12))->Fill(track->Phi());
-         
-         ((TH1F*)fHlistExperts->At(1))->Fill(tofTime-expTimes[2]);//ps
-         ((TH1F*)fHlistExperts->At(2))->Fill((Int_t)GetStripIndex(volId),tofTime-expTimes[2]); //ps
-         ((TH1F*)fHlistExperts->At(3))->Fill((Int_t)GetStripIndex(volId),track->GetTOFsignalDx());
-         ((TH1F*)fHlistExperts->At(4))->Fill((Int_t)GetStripIndex(volId),track->GetTOFsignalDz());
-         ((TH1F*)fHlistExperts->At(9))->Fill(expTimes[2]);//ps
-
-         //basic PID performance check 
-         Double_t tof= tofTime; //average T0 fill subtracted, no info from T0detector 
-         if (length>350){
-           Double_t beta= length/(tof*speedOfLight);
-           //Double_t mass2=P2*((tof/length)*(tof/length)-(1/(speedOfLight*speedOfLight)));
-           ((TH1F*)fHlist->At(7))->Fill(TMath::Sqrt(P2),beta);
-           //if (mass2>=0)((TH1F*)fHlistExperts->At(5))->Fill(TMath::Sqrt(mass2));
-         }
-      }//matched
-    }//acceptance cut
+      Double_t tofTime=track->GetTOFsignal();//in ps
+      Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
+      Double_t tofToT=track->GetTOFsignalToT(); //in ps
+      Int_t channel=track->GetTOFCalChannel(); 
+      Int_t volId[5]; //(sector, plate,strip,padZ,padX)
+      AliTOFGeometry::GetVolumeIndices(channel,volId);
+      
+      if (pT>=0.3) fNTOFtracks++; //matched counter
+      Double_t tof= tofTime*1E-3; // ns, average T0 fill subtracted, no info from T0detector    
+      ((TH1F*)fHlist->At(1))->Fill(tof); //ns
+      ((TH1F*)fHlist->At(2))->Fill(tofTimeRaw*1E-3); //ns
+      ((TH1F*)fHlist->At(3))->Fill(tofToT);
+      ((TH1F*)fHlist->At(4))->Fill(length);  
+      ((TH1F*)fHlist->At(5))->Fill(mom);
+      ((TH1F*)fHlist->At(6))->Fill(pT);
+      if (pT>=0.5)
+       ((TH1F*)fHlist->At(7))->Fill(eta);
+      ((TH1F*)fHlist->At(8))->Fill(phi);
+      if (track->GetSign()>0)
+       ((TH2F*)fHlist->At(13))->Fill(pT,track->GetTOFsignalDx());
+      else ((TH2F*)fHlist->At(14))->Fill(pT,track->GetTOFsignalDx());
+      ((TH2F*)fHlist->At(15))->Fill((Int_t)GetStripIndex(volId),track->GetTOFsignalDz());
+
+      //basic PID performance check
+      Double_t c=TMath::C()*1.E-9;// m/ns
+      Double_t mass=0.; //GeV
+      length =length*0.01; // in meters
+      tof=tof*c;
+      Double_t beta= length/tof;
+      Double_t fact= (tof/length)*(tof/length) -1.;
+      if(fact<=0) {
+       mass = -mom*TMath::Sqrt(-fact);
+      }else{ 
+       mass = mom*TMath::Sqrt(fact); 
+      }
+      ((TH2F*)fHlistPID->At(0))->Fill(mom,beta);
+      ((TH1F*) fHlistPID->At(1))->Fill(mass);
+      
+      //PID sigmas
+      for (Int_t specie = 0; specie < AliPID::kSPECIES; specie++){
+       fSigmaSpecie[specie] = fESDpid->GetTOFResponse().GetExpectedSigma(mom, fTrkExpTimes[specie], AliPID::ParticleMass(specie));
+       beta=1/TMath::Sqrt(1+AliPID::ParticleMass(specie)*AliPID::ParticleMass(specie)/(mom2));
+       fThExpTimes[specie]=length*1.E3/(beta*c);//ps
+      }
+      ((TH2F*)fHlistPID->At(2))->Fill((Int_t)GetStripIndex(volId),tofTime-fTrkExpTimes[AliPID::kPion]);//ps
+
+      ((TH1F*)fHlistPID->At(3))->Fill(tofTime-fTrkExpTimes[AliPID::kPion]);//ps
+      ((TH2F*)fHlistPID->At(4))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kPion]));
+      ((TH1F*)fHlistPID->At(5))->Fill(tofTime-fThExpTimes[AliPID::kPion]);//ps
+      ((TH2F*)fHlistPID->At(6))->Fill(mom,(tofTime-fThExpTimes[AliPID::kPion]));       
+      ((TH2F*)fHlistPID->At(7))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kPion])/fSigmaSpecie[AliPID::kPion]);
+
+      ((TH1F*)fHlistPID->At(8))->Fill(tofTime-fTrkExpTimes[AliPID::kKaon]);//ps
+      ((TH2F*)fHlistPID->At(9))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kKaon]));
+      ((TH1F*)fHlistPID->At(10))->Fill(tofTime-fThExpTimes[AliPID::kKaon]);//ps
+      ((TH2F*)fHlistPID->At(11))->Fill(mom,(tofTime-fThExpTimes[AliPID::kKaon]));
+      ((TH2F*)fHlistPID->At(12))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
+      
+      ((TH1F*)fHlistPID->At(13))->Fill(tofTime-fTrkExpTimes[AliPID::kProton]);//ps
+      ((TH2F*)fHlistPID->At(14))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kProton]));
+      ((TH1F*)fHlistPID->At(15))->Fill(tofTime-fThExpTimes[AliPID::kProton]);//ps
+      ((TH2F*)fHlistPID->At(16))->Fill(mom,(tofTime-fThExpTimes[AliPID::kProton]));
+      ((TH2F*)fHlistPID->At(17))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
+      
+    }//matched
   }//end loop on tracks
+  
   ((TH1F*)fHlist->At(0))->Fill(fNTOFtracks) ;
-  //if (fNTOFtracks>fNPrimaryTracks) printf("Something strange!!!\n");
-  if(fNPrimaryTracks>0){
-    ((TH1F*)fHlistExperts->At(0))->Fill((fNTOFtracks/(Float_t)fNPrimaryTracks)*100) ;
-  }
+  ((TH2F*)fHlistTimeZero->At(12))->Fill(fNTOFtracks,timeZero[AliESDpid::kTOF_T0]);
   
   PostData(1, fHlist);
-  PostData(2, fHlistExperts);
+  PostData(2, fHlistTimeZero);
+  PostData(3, fHlistPID);
+  
   
 }      
 
@@ -386,7 +689,7 @@ void AliAnalysisTaskTOFqa::Terminate(Option_t *)
 {
   //check on output validity
   fHlist = dynamic_cast<TList*> (GetOutputData(1));
-  if (!fHlist || !fHlistExperts) {
+  if (!fHlist || !fHlistTimeZero) {
     Printf("ERROR: lists not available");
     return;   
   }   
index 5df3cda..81bcdf0 100644 (file)
@@ -31,16 +31,21 @@ class AliAnalysisTaskTOFqa : public AliAnalysisTaskSE {
   AliESDEvent *fESD;    //ESD object
   AliAnalysisFilter *fTrackFilter; //track filter object
   AliESDVertex *fVertex; //pointer to the vertex object
-  
+  AliESDpid *fESDpid; //pointer to the PID object
+    
   Int_t fNTOFtracks; //number of tracks matching with TOF
-  Int_t fNPrimaryTracks; //number of primary tracks
-  Float_t fT0; //event time
+  //Int_t fNPrimaryTracks; //number of primary tracks
+  Float_t fT0[3]; //event time
+  Float_t fSigmaSpecie[5]; //number of TOF PID sigmas, ie.fSigmaPion, fSigmaKaon, fSigmaProton;
+  Double_t fTrkExpTimes[5]; //expected times from tracking for 5 mass hypothesis
+  Double_t fThExpTimes[5]; //theoretical expected times for 5 mass hypothesis
   
   //output objects
   TList *fHlist;  //list of general histos
-  TList *fHlistExperts; //list of experts histos
+  TList *fHlistTimeZero; //list of timeZero related histos
+  TList *fHlistPID; //list of PID-related histos
 
-  ClassDef(AliAnalysisTaskTOFqa, 1); // example of analysis
+  ClassDef(AliAnalysisTaskTOFqa, 2); // example of analysis
 };
 
 #endif