]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/EBYE/PIDFluctuation/task/AliEbyEParticleRatioFluctuationTask.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / task / AliEbyEParticleRatioFluctuationTask.cxx
index ad421bc10ec0c2d4630d5f6981a92329d0a9d7bd..1c622bffb87641e83de5d6936e7577a8049b5601 100644 (file)
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- *                                                                        *\r
- * Author: Satyajit Jena.                                                 *\r
- * Contributors are mentioned in the code where appropriate.              *\r
- *                                                                        *\r
- * Permission to use, copy, modify and distribute this software and its   *\r
- * documentation strictly for non-commercial purposes is hereby granted   *\r
- * without fee, provided that the above copyright notice appears in all   *\r
- * copies and that both the copyright notice and this permission notice   *\r
- * appear in the supporting documentation. The authors make no claims     *\r
- * about the suitability of this software for any purpose. It is          *\r
- * provided "as is" without express or implied warranty.                  *\r
- **************************************************************************/\r
-\r
-\r
-//=========================================================================//\r
-//             AliEbyE Analysis for Particle Ratio Fluctuation             //\r
-//                   Deepika Rathee  | Satyajit Jena                       //\r
-//                   drathee@cern.ch | sjena@cern.ch                       //\r
-//\r
-//             V0.1 2013/03/25 Using THnSparse\r
-//             V0.2 2013/04/03 Cleanup\r
-//             V1.0 2013/04/10 Reduce Bins for Less Memory\r
-//   Todo: pp and pA, Mix Events\r
-//=========================================================================//\r
-\r
-#include "TChain.h"\r
-#include "TList.h"\r
-#include "TFile.h"\r
-#include "TTree.h"\r
-#include "TH1D.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TCanvas.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliVEvent.h"\r
-#include "AliESD.h"\r
-#include "AliESDEvent.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAODMCHeader.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliAODHeader.h"\r
-#include "AliAODpidUtil.h"\r
-#include "AliHelperPID.h"\r
-\r
-#include "AliEbyEParticleRatioFluctuationTask.h"\r
-\r
-ClassImp(AliEbyEParticleRatioFluctuationTask)\r
-\r
-//-----------------------------------------------------------------------\r
-AliEbyEParticleRatioFluctuationTask::AliEbyEParticleRatioFluctuationTask( const char *name ) : AliAnalysisTaskSE( name ), fThnList(NULL), fAnalysisType("AOD"), fAnalysisData("PbPb"), fCentralityEstimator("V0M"), fVxMax(3.), fVyMax(3.), fVzMax(10.), fDCAxy(2.4),  fDCAz(3.2), fPtLowerLimit(0.2), fPtHigherLimit(5.), fEtaLowerLimit(-1.), fEtaHigherLimit(1.), fAODtrackCutBit(128), isQA(kFALSE), fDebug(kFALSE), fHelperPID(0x0),fEventCounter(NULL), fHistoCorrelation(NULL) { \r
-  for(Int_t i = 0; i < 14; i++ ) fHistQA[i] = NULL;\r
-  DefineOutput(1, TList::Class()); // Outpput....\r
-}\r
-\r
-AliEbyEParticleRatioFluctuationTask::~AliEbyEParticleRatioFluctuationTask() {\r
-  //clean up\r
-  if (fThnList) delete fThnList;\r
-  if (fHelperPID) delete fThnList;\r
-}\r
-\r
-\r
-//---------------------------------------------------------------------------------\r
-void AliEbyEParticleRatioFluctuationTask::UserCreateOutputObjects() {\r
-  fThnList = new TList();\r
-  fThnList->SetOwner(kTRUE);\r
-\r
-  fEventCounter = new TH1D("fEventCounter","EventCounter", 250, 0.5,250.5);\r
-  if (isQA) fThnList->Add(fEventCounter);\r
-  \r
-  fHistQA[0] = new TH1D("fHistQAvx", "Histo Vx Selected", 5000, -5., 5.);\r
-  fHistQA[1] = new TH1D("fHistQAvy", "Histo Vy Selected", 5000, -5., 5.);\r
-  fHistQA[2] = new TH1D("fHistQAvz", "Histo Vz Selected", 5000, -25., 25.);  \r
-  fHistQA[3] = new TH1D("fHistQAvxA", "Histo Vx", 5000, -5., 5.);\r
-  fHistQA[4] = new TH1D("fHistQAvyA", "Histo Vy", 5000, -5., 5.);\r
-  fHistQA[5] = new TH1D("fHistQAvzA", "Histo Vz", 5000, -25., 25.);\r
-\r
-  fHistQA[6] = new TH1D("fHistQADcaXyA", "Histo DCAxy", 600, -15., 15.);\r
-  fHistQA[7] = new TH1D("fHistQADcaZA", "Histo DCAz ", 600, -15., 15.);   \r
-  fHistQA[8] = new TH1D("fHistQAPtA","p_{T} distribution",1000,0,10);\r
-  fHistQA[9] = new TH1D("fHistQAEtaA","#eta distribution",240,-1.2,1.2);\r
-\r
-  fHistQA[10] = new TH1D("fHistQADcaXy", "Histo DCAxy after Selected", 600, -15., 15.);\r
-  fHistQA[11] = new TH1D("fHistQADcaZ", "Histo DCAz Selected", 600, -15., 15.);   \r
-  fHistQA[12] = new TH1D("fHistQAPt","p_{T} distribution Selected",1000,0,10);\r
-  fHistQA[13] = new TH1D("fHistQAEta","#eta distribution Selected",240,-1.2,1.2);\r
-  \r
-  if (isQA) {  \r
-    for(Int_t i = 0; i < 14; i++) fThnList->Add(fHistQA[i]);\r
-  }\r
\r
-  Int_t fgSparseDataBins[kNSparseData]   = {100, 5000, 2500, 2500, 1500, 1500, 500, 500, 250, 250};\r
-  Double_t fgSparseDataMin[kNSparseData] = {0.,  0.,   0.,   0.,   0.,   0.,   0.,  0.,  0.,  0.};\r
-  Double_t fgSparseDataMax[kNSparseData] = {100.,5000.,2500.,2500.,1500.,1500.,500.,500.,250.,250.};\r
-  \r
-  const Char_t *fgkSparseDataTitle[] = {\r
-    "centrality",\r
-    "RefMult",\r
-    "N_{+}",\r
-    "N_{-}",\r
-    "N_{#pi^{+}}",\r
-    "N_{#pi^{-}}",\r
-    "N_{K^{+}}",\r
-    "N_{K^{-}}",\r
-    "N_{p}",\r
-    "N_{#bar{p}}"\r
-  };\r
-  \r
-  \r
-  fHistoCorrelation = new THnSparseI("fThnCorr", "", 10, fgSparseDataBins, fgSparseDataMin, fgSparseDataMax);\r
-  for (Int_t iaxis = 0; iaxis < kNSparseData; iaxis++)\r
-    fHistoCorrelation->GetAxis(iaxis)->SetTitle(fgkSparseDataTitle[iaxis]);\r
-  \r
-  if(!isQA) fThnList->Add(fHistoCorrelation);\r
-  if(isQA)  \r
-    if (fHelperPID)\r
-      fThnList->Add(fHelperPID);\r
-  \r
-  PostData(1, fThnList);\r
-}\r
-\r
-\r
-//----------------------------------------------------------------------------------\r
-void AliEbyEParticleRatioFluctuationTask::UserExec( Option_t * ){\r
-  if (isQA) fEventCounter->Fill(1);\r
-\r
-  AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());\r
-  if (!event) {\r
-    cout<< "ERROR 01: AOD not found " <<endl;\r
-    return;\r
-  }\r
-\r
-  if (!AcceptEvent(event)) return;\r
-  if (isQA) fEventCounter->Fill(2);  \r
-  \r
-  Int_t icharge = -1;\r
-  Int_t gCharge[2];\r
-  Int_t gPid[3][2];\r
-  \r
-  for (Int_t i = 0; i < 2; i++) {\r
-    gCharge[i] = 0;\r
-    for (Int_t ii = 0; ii < 3; ii++) {\r
-      gPid[ii][i] = 0;\r
-    }\r
-  }\r
-\r
-  Float_t gCent   = -1;\r
-  Float_t gRefMul = -1;\r
-\r
-  if(fAnalysisType == "AOD") {\r
-    AliAODHeader *aodHeader = event->GetHeader();\r
-    gCent = aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
-    gRefMul = aodHeader->GetRefMultiplicity();\r
-    \r
-    if (gCent < 0 || gCent > 100) return;\r
-    if (isQA) fEventCounter->Fill(50+gCent);\r
-    \r
-    for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {\r
-      AliAODTrack* track = dynamic_cast<AliAODTrack *>(event->GetTrack(itrk));\r
-      if (!track) continue;\r
-      \r
-      if (!AcceptTrack(track)) continue;\r
-            \r
-      Int_t a = fHelperPID->GetParticleSpecies((AliVTrack*) track,kTRUE);\r
-      if(a < 0 || a > 2) continue;\r
-      icharge = track->Charge() > 0 ? 0 : 1;\r
-      gCharge[icharge]++;\r
-      gPid[a][icharge]++;\r
-    }\r
-  }\r
-  else if(fAnalysisType == "MCAOD") {\r
-    TClonesArray *arrayMC = (TClonesArray*) event->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
-    if (!arrayMC) {\r
-      AliFatal("Error: MC particles branch not found!\n");\r
-    }\r
-    AliAODMCHeader *mcHdr=0;\r
-    mcHdr=(AliAODMCHeader*)event->GetList()->FindObject(AliAODMCHeader::StdBranchName());  \r
-    if(!mcHdr) {\r
-      printf("MC header branch not found!\n");\r
-      return;\r
-    }\r
-    \r
-    AliAODHeader *aodHeader = event->GetHeader();\r
-    AliCentrality* fcentrality = aodHeader->GetCentralityP();\r
-    gCent = fcentrality ->GetCentralityPercentile(fCentralityEstimator.Data());\r
-    if (gCent < 0 || gCent > 100) return;\r
-    if (isQA) fEventCounter->Fill(50+gCent);      \r
-\r
-    Int_t nMC = arrayMC->GetEntries();\r
-    for (Int_t iMC = 0; iMC < nMC; iMC++) {\r
-      AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);\r
-      if(!AcceptMCTrack(partMC)) continue;\r
-      Int_t a = fHelperPID->GetMCParticleSpecie((AliVEvent*) event,(AliVTrack*)partMC,1);\r
-      if(a < 0 || a > 2) continue;\r
-      icharge = partMC->Charge() > 0 ? 0 : 1;\r
-      gCharge[icharge]++;\r
-      gPid[a][icharge]++;\r
-    }\r
-  }\r
-  else return;\r
-  \r
-    \r
-  if( (gCharge[0] + gCharge[1]) != 0 ) {\r
-    if (isQA) {\r
-      fEventCounter->Fill(3); \r
-      fEventCounter->Fill(160 + gCent);\r
-    }\r
-    else { \r
-      Double_t vsparse[kNSparseData];\r
-      vsparse[0]  = gCent;\r
-      vsparse[1]  = gRefMul;\r
-      vsparse[2]  = gCharge[0];\r
-      vsparse[3]  = gCharge[1];\r
-      vsparse[4]  = gPid[0][0];\r
-      vsparse[5]  = gPid[0][1];\r
-      vsparse[6]  = gPid[1][0];\r
-      vsparse[7]  = gPid[1][1];\r
-      vsparse[8]  = gPid[2][0];\r
-      vsparse[9]  = gPid[2][1];\r
-      fHistoCorrelation->Fill(vsparse);\r
-    }\r
-  }\r
-  \r
-  if(fDebug && isQA)  Printf(" %6d  %6d %6d  %6d %6d  %6d %6d %6d %6d %6d %6d %6d %6d", \r
-                            (Int_t)fEventCounter->GetBinContent(1), \r
-                            (Int_t)fEventCounter->GetBinContent(2), \r
-                            (Int_t)fEventCounter->GetBinContent(3), \r
-                            (Int_t)gCent, (Int_t)gRefMul, \r
-                            gCharge[0], gCharge[1], \r
-                            gPid[0][0], gPid[0][1],  gPid[1][0], \r
-                            gPid[1][1],  gPid[2][0], gPid[2][1]);\r
-  \r
-\r
-  PostData(1, fThnList);\r
-  \r
-}\r
-\r
-void AliEbyEParticleRatioFluctuationTask::Terminate( Option_t * ){\r
-\r
-  Info("AliEbyEParticleRatioFluctuationTask"," Task Successfully finished");\r
-  \r
-}\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptEvent(AliAODEvent *event) const {\r
-  Bool_t ver = kFALSE;\r
-  const AliAODVertex *vertex = event->GetPrimaryVertex();\r
-  if(vertex) {\r
-    Double32_t fCov[6];\r
-    vertex->GetCovarianceMatrix(fCov);\r
-    if(vertex->GetNContributors() > 0) {\r
-      if(fCov[5] != 0) {\r
-       \r
-       if(isQA) {      \r
-         fEventCounter->Fill(5);\r
-         fHistQA[3]->Fill(vertex->GetX());\r
-         fHistQA[4]->Fill(vertex->GetY());\r
-         fHistQA[5]->Fill(vertex->GetZ());\r
-       }\r
-       \r
-       if(TMath::Abs(vertex->GetX()) < fVxMax) {\r
-         if(TMath::Abs(vertex->GetY()) < fVyMax) {\r
-           if(TMath::Abs(vertex->GetZ()) < fVzMax) {\r
-             ver = kTRUE;\r
-             if(isQA) {        \r
-               fEventCounter->Fill(6);\r
-               fHistQA[0]->Fill(vertex->GetX());\r
-               fHistQA[1]->Fill(vertex->GetY());\r
-               fHistQA[2]->Fill(vertex->GetZ());\r
-             }\r
-           }\r
-         }\r
-       }\r
-      }\r
-    }\r
-  }\r
-  \r
-  AliCentrality *centrality = event->GetCentrality();\r
-  if (centrality->GetQuality() != 0) ver = kFALSE;\r
-  return ver;\r
-}\r
-\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptTrack(AliAODTrack *track) const {\r
-  if(!track) return kFALSE;\r
-  if (track->Charge() == 0 ) return kFALSE;\r
-  \r
-  if(isQA) {\r
-    fHistQA[6]->Fill(track->DCA());\r
-    fHistQA[7]->Fill(track->ZAtDCA());\r
-    fHistQA[8]->Fill(track->Pt());\r
-    fHistQA[9]->Fill(track->Eta());\r
-  }\r
-  \r
-  if (!track->TestFilterBit(fAODtrackCutBit)) return kFALSE;\r
-\r
-  if (track->Eta() < fEtaLowerLimit ||\r
-      track->Eta() > fEtaHigherLimit) return kFALSE;\r
-  if (track->Pt() < fPtLowerLimit ||\r
-      track->Pt() > fPtHigherLimit) return kFALSE;  \r
-  if ( track->DCA() > fDCAxy ) return kFALSE; \r
-  if ( track->ZAtDCA() > fDCAz ) return kFALSE;\r
-   \r
-  if(isQA) {\r
-    fHistQA[10]->Fill(track->DCA());\r
-    fHistQA[11]->Fill(track->ZAtDCA());\r
-    fHistQA[12]->Fill(track->Pt());\r
-    fHistQA[13]->Fill(track->Eta());\r
-  }\r
\r
-  return kTRUE;\r
-}\r
-\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptMCTrack(AliAODMCParticle *track) const {\r
-  if(!track) return kFALSE;\r
-  if(!track->IsPhysicalPrimary()) return kFALSE;\r
-  if (track->Charge() == 0 ) return kFALSE;\r
-  if(isQA) {\r
-    fHistQA[8]->Fill(track->Pt());\r
-    fHistQA[9]->Fill(track->Eta());\r
-  }\r
-\r
-  if (track->Eta() < fEtaLowerLimit ||\r
-      track->Eta() > fEtaHigherLimit) return kFALSE;\r
-  if (track->Pt() < fPtLowerLimit ||\r
-      track->Pt() > fPtHigherLimit) return kFALSE;  \r
-    \r
-  if(isQA) {\r
-    fHistQA[12]->Fill(track->Pt());\r
-    fHistQA[13]->Fill(track->Eta());\r
-  }\r
\r
-  return kTRUE;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: Satyajit Jena.                                                 *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+//=========================================================================//
+//             AliEbyE Analysis for Particle Ratio Fluctuation             //
+//                   Deepika Rathee  | Satyajit Jena                       //
+//                   drathee@cern.ch | sjena@cern.ch                       //
+//
+//             V0.1 2013/03/25 Using THnSparse
+//             V0.2 2013/04/03 Cleanup
+//             V1.0 2013/04/10 Cleanup Bins for Less Memory
+//             V1.1 2013/04/15 Bins Added 
+//   Todo: pp and pA, Mix Events
+//=========================================================================//
+
+#include "TChain.h"
+#include "TList.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TH1D.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TCanvas.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliVEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliAODEvent.h"
+#include "AliAODMCParticle.h"
+#include "AliAODMCHeader.h"
+#include "AliPIDResponse.h"
+#include "AliAODHeader.h"
+#include "AliAODpidUtil.h"
+#include "AliHelperPID.h"
+using std::endl;
+using std::cout;
+#include "AliEbyEParticleRatioFluctuationTask.h"
+
+ClassImp(AliEbyEParticleRatioFluctuationTask)
+
+//-----------------------------------------------------------------------
+AliEbyEParticleRatioFluctuationTask::AliEbyEParticleRatioFluctuationTask( const char *name ) : AliAnalysisTaskSE( name ), 
+  fThnList(NULL), 
+  fAnalysisType("AOD"), 
+  fAnalysisData("PbPb"), 
+  fCentralityEstimator("V0M"), 
+  fVxMax(3.), 
+  fVyMax(3.), 
+  fVzMax(10.), 
+  fDCAxy(2.4),  
+  fDCAz(3.2), 
+  fPtLowerLimit(0.2), 
+  fPtHigherLimit(5.), 
+  fEtaLowerLimit(-1.), 
+  fEtaHigherLimit(1.), 
+  fTPCNClus(80),
+  fAODtrackCutBit(128), 
+  isQA(kFALSE), 
+  fDebug(kFALSE), 
+  fHelperPID(0x0),
+  fEventCounter(NULL), 
+  fHistoCorrelation(NULL) { 
+  for(Int_t i = 0; i < 14; i++ ) fHistQA[i] = NULL;
+  DefineOutput(1, TList::Class()); //! Connect Outpput....
+}
+
+AliEbyEParticleRatioFluctuationTask::~AliEbyEParticleRatioFluctuationTask() {
+  //!   Cleaning up
+  if (fThnList)   delete fThnList;
+  if (fHelperPID) delete fHelperPID;
+}
+
+//---------------------------------------------------------------------------------
+void AliEbyEParticleRatioFluctuationTask::UserCreateOutputObjects() {
+  fThnList = new TList();
+  fThnList->SetOwner(kTRUE);
+
+  fEventCounter = new TH1D("fEventCounter","EventCounter", 300, 0.5,300.5);
+  if (isQA) fThnList->Add(fEventCounter);
+  
+  fHistQA[0] = new TH2F("fHistQAvx", "Histo Vx Selected;Centrality;Vx", 100,0,100, 5000, -5., 5.);
+  fHistQA[1] = new TH2F("fHistQAvy", "Histo Vy Selected;Centrality;Vy", 100,0,100, 5000, -5., 5.);
+  fHistQA[2] = new TH2F("fHistQAvz", "Histo Vz Selected;Centrality;Vz", 100,0,100, 5000, -25., 25.);  
+  fHistQA[3] = new TH2F("fHistQAvxA", "Histo Vx;Centrality;Vx", 100,0,100, 5000, -5., 5.);
+  fHistQA[4] = new TH2F("fHistQAvyA", "Histo Vy;Centrality;Vy", 100,0,100, 5000, -5., 5.);
+  fHistQA[5] = new TH2F("fHistQAvzA", "Histo Vz;Centrality;Vz", 100,0,100, 5000, -25., 25.);
+
+  fHistQA[6] = new TH2F("fHistQADcaXyA", "Histo DCAxy;Centrality;DCAxy",100,0,100, 600, -15., 15.);
+  fHistQA[7] = new TH2F("fHistQADcaZA", "Histo DCAz;Centrality;DCAz ",100,0,100, 600, -15., 15.);   
+  fHistQA[8] = new TH2F("fHistQAPtA","p_{T} distribution;Centrality;p_{T}",100,0,100,1000,0,10);
+  fHistQA[9] = new TH2F("fHistQAEtaA","#eta distribution;Centrality;#eta",100,0,100,240,-1.2,1.2);
+
+  fHistQA[10] = new TH2F("fHistQADcaXy", "Histo DCAxy after Selected;Centrality;DCAxy", 100,0,100,600, -15., 15.);
+  fHistQA[11] = new TH2F("fHistQADcaZ", "Histo DCAz Selected;Centrality;DCAz", 100,0,100,600, -15., 15.);   
+  fHistQA[12] = new TH2F("fHistQAPt","p_{T} distribution Selected;Centrality;p_{T}",100,0,100,1000,0,10);
+  fHistQA[13] = new TH2F("fHistQAEta","#eta distribution Selected;Centrality;#eta",100,0,100, 240,-1.2,1.2);
+  
+  if (isQA) for(Int_t i = 0; i < 14; i++) fThnList->Add(fHistQA[i]);
+  
+  Int_t fgSparseDataBins[kNSparseData]   = {100, 5000, 5000, 2500, 2500, 3000, 1500, 1500, 1000, 500, 500, 500, 250, 250};
+  Double_t fgSparseDataMin[kNSparseData] = {0.,  0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,  0.,  0.,  0.,  0.};
+  Double_t fgSparseDataMax[kNSparseData] = {100.,5000.,5000.,2500.,2500.,3000.,1500.,1500.,1000.,500.,500.,500.,250.,250.};
+  
+  const Char_t *fgkSparseDataTitle[] = {"centrality","RefMult","N_{ch}", "N_{+}","N_{-}","N_{#pi}", "N_{#pi^{+}}","N_{#pi^{-}}","N_{K}","N_{K^{+}}", "N_{K^{-}}","N_{p}","N_{p}","N_{#bar{p}}"};
+    
+  fHistoCorrelation = new THnSparseI("fThnCorr", "", kNSparseData, fgSparseDataBins, fgSparseDataMin, fgSparseDataMax);
+  for (Int_t iaxis = 0; iaxis < kNSparseData; iaxis++)
+    fHistoCorrelation->GetAxis(iaxis)->SetTitle(fgkSparseDataTitle[iaxis]);
+  
+  if(!isQA) fThnList->Add(fHistoCorrelation);
+  if(isQA)  
+    if (fHelperPID)
+      fThnList->Add(fHelperPID);
+  
+  PostData(1, fThnList);
+}
+
+//----------------------------------------------------------------------------------
+void AliEbyEParticleRatioFluctuationTask::UserExec( Option_t * ){
+
+  if (isQA) fEventCounter->Fill(1);
+
+  AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());
+  if (!event) {
+    Printf("ERROR 01: AOD not found ");
+    return;
+  }
+
+  Int_t gCent   = -1;
+  Float_t gRefMul = -1;
+  
+  AliAODHeader *aodHeader = dynamic_cast<AliAODHeader*>(event->GetHeader());
+  if(!aodHeader) AliFatal("Not a standard AOD");
+  gCent = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data()); // V0M`
+  gRefMul = aodHeader->GetRefMultiplicity();
+  if (gCent < 0 || gCent > 100) return;
+  if (isQA) fEventCounter->Fill(2);  
+
+  if (!AcceptEvent(event,gCent)) return;
+  
+  Int_t icharge = -1;
+  Int_t gCharge[2];
+  Int_t gPid[3][2];
+  
+  for (Int_t i = 0; i < 2; i++) {
+    gCharge[i] = 0;
+    for (Int_t ii = 0; ii < 3; ii++) {
+      gPid[ii][i] = 0;
+    }
+  }
+
+
+  if(fAnalysisType == "AOD") {
+    if (isQA) {
+       fEventCounter->Fill(5);
+       fEventCounter->Fill(50+gCent);
+    }
+    
+    for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
+      AliAODTrack* track = dynamic_cast<AliAODTrack *>(event->GetTrack(itrk));
+      if (!track) continue;
+      
+      if (!AcceptTrack(track, gCent)) continue;
+            
+      Int_t a = fHelperPID->GetParticleSpecies((AliVTrack*) track,kTRUE);
+
+      if(a < 0 || a > 2) continue;
+      icharge = track->Charge() > 0 ? 0 : 1;
+      gCharge[icharge]++;
+      gPid[a][icharge]++;
+    }
+  }
+  else if(fAnalysisType == "MCAOD") {
+    TClonesArray *arrayMC= 0; 
+    arrayMC = dynamic_cast<TClonesArray*> (event->GetList()->FindObject(AliAODMCParticle::StdBranchName()));
+    if (!arrayMC) {
+      Printf("Error: MC particles branch not found!\n");
+      return;
+    }
+    AliAODMCHeader *mcHdr=0;
+    mcHdr=(AliAODMCHeader*)event->GetList()->FindObject(AliAODMCHeader::StdBranchName());  
+    if(!mcHdr) {
+      Printf("MC header branch not found!\n");
+      return;
+    }
+    
+    if (isQA) {
+      fEventCounter->Fill(5);
+      fEventCounter->Fill(50+gCent);
+    }
+    
+    Int_t nMC = arrayMC->GetEntries();
+    for (Int_t iMC = 0; iMC < nMC; iMC++) {
+      AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
+      if(!AcceptMCTrack(partMC, gCent)) continue;
+      Int_t a = fHelperPID->GetMCParticleSpecie((AliVEvent*) event,(AliVTrack*)partMC,1);
+      if(a < 0 || a > 2) continue;
+      icharge = partMC->Charge() > 0 ? 0 : 1;
+      gCharge[icharge]++;
+      gPid[a][icharge]++;
+    }
+  }
+  else {
+    printf(" No Event Type is Defined ");
+    return;
+  }
+  
+  if( (gCharge[0] + gCharge[1]) != 0 ) {
+    if (isQA) {
+      fEventCounter->Fill(6); 
+      fEventCounter->Fill(160 + gCent);
+    }
+    else { 
+      Double_t vsparse[kNSparseData];
+      vsparse[0]   = gCent;
+      vsparse[1]   = gRefMul;
+      vsparse[2]   = gCharge[0] + gCharge[1];
+      vsparse[3]   = gCharge[0];
+      vsparse[4]   = gCharge[1];
+      vsparse[5]   = gPid[0][0] + gPid[0][1];
+      vsparse[6]   = gPid[0][0];
+      vsparse[7]   = gPid[0][1];
+      vsparse[8]   = gPid[1][0] + gPid[1][0];
+      vsparse[9]   = gPid[1][0];
+      vsparse[10]  = gPid[1][1];
+      vsparse[11]  = gPid[2][0] + gPid[2][1];
+      vsparse[12]  = gPid[2][0];
+      vsparse[13]  = gPid[2][1];
+      fHistoCorrelation->Fill(vsparse);
+    }
+  }
+  
+  if(fDebug && isQA)  Printf(" %6d  %6d %6d  %6d %6d  %6d %6d %6d %6d %6d %6d %6d %6d", 
+                            (Int_t)fEventCounter->GetBinContent(1), 
+                            (Int_t)fEventCounter->GetBinContent(2), 
+                            (Int_t)fEventCounter->GetBinContent(3), 
+                            (Int_t)gCent, (Int_t)gRefMul, 
+                            gCharge[0], gCharge[1], 
+                            gPid[0][0], gPid[0][1],  gPid[1][0], 
+                            gPid[1][1],  gPid[2][0], gPid[2][1]);
+  
+  PostData(1, fThnList);
+}
+
+void AliEbyEParticleRatioFluctuationTask::Terminate( Option_t * ){
+  Info("AliEbyEParticleRatioFluctuationTask"," Task Successfully finished");
+}
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptEvent(AliAODEvent *event, Int_t cent) const {
+  Bool_t ver = kFALSE;
+  const AliAODVertex *vertex = event->GetPrimaryVertex();
+  if(vertex) {
+    Double32_t fCov[6];
+    vertex->GetCovarianceMatrix(fCov);
+    if(vertex->GetNContributors() > 0) {
+      if(fCov[5] != 0) {
+       
+       if(isQA) {      
+         fEventCounter->Fill(3);
+         fHistQA[3]->Fill(cent,vertex->GetX());
+         fHistQA[4]->Fill(cent,vertex->GetY());
+         fHistQA[5]->Fill(cent,vertex->GetZ());
+       }
+       
+       if(TMath::Abs(vertex->GetX()) < fVxMax) {
+         if(TMath::Abs(vertex->GetY()) < fVyMax) {
+           if(TMath::Abs(vertex->GetZ()) < fVzMax) {
+             ver = kTRUE;
+             if(isQA) {        
+               fEventCounter->Fill(4);
+               fHistQA[0]->Fill(cent,vertex->GetX());
+               fHistQA[1]->Fill(cent,vertex->GetY());
+               fHistQA[2]->Fill(cent,vertex->GetZ());
+             }
+           }
+         }
+       }
+      }
+    }
+  }
+  
+  AliCentrality *centrality = event->GetCentrality();
+  if (centrality->GetQuality() != 0) ver = kFALSE;
+  return ver;
+}
+
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptTrack(AliAODTrack *track, Int_t cent) const {
+  if(!track)                                  return kFALSE;
+  if (track->Charge() == 0 )                  return kFALSE;
+  
+  if(isQA) {
+    fHistQA[6]->Fill(cent,track->DCA());
+    fHistQA[7]->Fill(cent,track->ZAtDCA());
+    fHistQA[8]->Fill(cent,track->Pt());
+    fHistQA[9]->Fill(cent,track->Eta());
+  }
+  
+  if (!track->TestFilterBit(fAODtrackCutBit)) return kFALSE;
+
+  if (track->Eta() < fEtaLowerLimit ||
+      track->Eta() > fEtaHigherLimit)         return kFALSE;
+  if (track->Pt() < fPtLowerLimit ||
+      track->Pt() > fPtHigherLimit)           return kFALSE;  
+  if ( track->DCA() > fDCAxy )                return kFALSE; 
+  if ( track->ZAtDCA() > fDCAz )              return kFALSE;
+   
+  if(isQA) {
+    fHistQA[10]->Fill(cent,track->DCA());
+    fHistQA[11]->Fill(cent,track->ZAtDCA());
+    fHistQA[12]->Fill(cent,track->Pt());
+    fHistQA[13]->Fill(cent,track->Eta());
+  }
+  return kTRUE;
+}
+
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptMCTrack(AliAODMCParticle *track, Int_t cent) const {
+  if(!track) return kFALSE;
+  if(!track->IsPhysicalPrimary()) return kFALSE;
+  if (track->Charge() == 0 ) return kFALSE;
+  if(isQA) {
+    fHistQA[8]->Fill(cent,track->Pt());
+    fHistQA[9]->Fill(cent,track->Eta());
+  }
+
+  if (track->Eta() < fEtaLowerLimit ||
+      track->Eta() > fEtaHigherLimit) return kFALSE;
+  if (track->Pt() < fPtLowerLimit ||
+      track->Pt() > fPtHigherLimit) return kFALSE;  
+    
+  if(isQA) {
+    fHistQA[12]->Fill(cent,track->Pt());
+    fHistQA[13]->Fill(cent,track->Eta());
+  }
+  return kTRUE;
+}