-/**************************************************************************\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 Cleanup Bins for Less Memory\r
-// V1.1 2013/04/15 Bins Added \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 ), \r
- fThnList(NULL), \r
- fAnalysisType("AOD"), \r
- fAnalysisData("PbPb"), \r
- fCentralityEstimator("V0M"), \r
- fVxMax(3.), \r
- fVyMax(3.), \r
- fVzMax(10.), \r
- fDCAxy(2.4), \r
- fDCAz(3.2), \r
- fPtLowerLimit(0.2), \r
- fPtHigherLimit(5.), \r
- fEtaLowerLimit(-1.), \r
- fEtaHigherLimit(1.), \r
- fTPCNClus(80),\r
- fAODtrackCutBit(128), \r
- isQA(kFALSE), \r
- fDebug(kFALSE), \r
- fHelperPID(0x0),\r
- fEventCounter(NULL), \r
- fHistoCorrelation(NULL) { \r
- for(Int_t i = 0; i < 14; i++ ) fHistQA[i] = NULL;\r
- DefineOutput(1, TList::Class()); //! Connect Outpput....\r
-}\r
-\r
-AliEbyEParticleRatioFluctuationTask::~AliEbyEParticleRatioFluctuationTask() {\r
- //! Cleaning up\r
- if (fThnList) delete fThnList;\r
- if (fHelperPID) delete fHelperPID;\r
-}\r
-\r
-//---------------------------------------------------------------------------------\r
-void AliEbyEParticleRatioFluctuationTask::UserCreateOutputObjects() {\r
- fThnList = new TList();\r
- fThnList->SetOwner(kTRUE);\r
-\r
- fEventCounter = new TH1D("fEventCounter","EventCounter", 300, 0.5,300.5);\r
- if (isQA) fThnList->Add(fEventCounter);\r
- \r
- fHistQA[0] = new TH2F("fHistQAvx", "Histo Vx Selected;Centrality;Vx", 100,0,100, 5000, -5., 5.);\r
- fHistQA[1] = new TH2F("fHistQAvy", "Histo Vy Selected;Centrality;Vy", 100,0,100, 5000, -5., 5.);\r
- fHistQA[2] = new TH2F("fHistQAvz", "Histo Vz Selected;Centrality;Vz", 100,0,100, 5000, -25., 25.); \r
- fHistQA[3] = new TH2F("fHistQAvxA", "Histo Vx;Centrality;Vx", 100,0,100, 5000, -5., 5.);\r
- fHistQA[4] = new TH2F("fHistQAvyA", "Histo Vy;Centrality;Vy", 100,0,100, 5000, -5., 5.);\r
- fHistQA[5] = new TH2F("fHistQAvzA", "Histo Vz;Centrality;Vz", 100,0,100, 5000, -25., 25.);\r
-\r
- fHistQA[6] = new TH2F("fHistQADcaXyA", "Histo DCAxy;Centrality;DCAxy",100,0,100, 600, -15., 15.);\r
- fHistQA[7] = new TH2F("fHistQADcaZA", "Histo DCAz;Centrality;DCAz ",100,0,100, 600, -15., 15.); \r
- fHistQA[8] = new TH2F("fHistQAPtA","p_{T} distribution;Centrality;p_{T}",100,0,100,1000,0,10);\r
- fHistQA[9] = new TH2F("fHistQAEtaA","#eta distribution;Centrality;#eta",100,0,100,240,-1.2,1.2);\r
-\r
- fHistQA[10] = new TH2F("fHistQADcaXy", "Histo DCAxy after Selected;Centrality;DCAxy", 100,0,100,600, -15., 15.);\r
- fHistQA[11] = new TH2F("fHistQADcaZ", "Histo DCAz Selected;Centrality;DCAz", 100,0,100,600, -15., 15.); \r
- fHistQA[12] = new TH2F("fHistQAPt","p_{T} distribution Selected;Centrality;p_{T}",100,0,100,1000,0,10);\r
- fHistQA[13] = new TH2F("fHistQAEta","#eta distribution Selected;Centrality;#eta",100,0,100, 240,-1.2,1.2);\r
- \r
- if (isQA) for(Int_t i = 0; i < 14; i++) fThnList->Add(fHistQA[i]);\r
- \r
- Int_t fgSparseDataBins[kNSparseData] = {100, 5000, 5000, 2500, 2500, 3000, 1500, 1500, 1000, 500, 500, 500, 250, 250};\r
- Double_t fgSparseDataMin[kNSparseData] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};\r
- Double_t fgSparseDataMax[kNSparseData] = {100.,5000.,5000.,2500.,2500.,3000.,1500.,1500.,1000.,500.,500.,500.,250.,250.};\r
- \r
- 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}}"};\r
- \r
- fHistoCorrelation = new THnSparseI("fThnCorr", "", kNSparseData, 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
-void AliEbyEParticleRatioFluctuationTask::UserExec( Option_t * ){\r
-\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
- Int_t gCent = -1;\r
- Float_t gRefMul = -1;\r
- \r
- AliAODHeader *aodHeader = event->GetHeader();\r
- gCent = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
- gRefMul = aodHeader->GetRefMultiplicity();\r
- if (gCent < 0 || gCent > 100) return;\r
- if (isQA) fEventCounter->Fill(2); \r
-\r
- if (!AcceptEvent(event,gCent)) return;\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
-\r
- if(fAnalysisType == "AOD") {\r
- if (isQA) {\r
- fEventCounter->Fill(5);\r
- fEventCounter->Fill(50+gCent);\r
- }\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, gCent)) continue;\r
- \r
- Int_t a = fHelperPID->GetParticleSpecies((AliVTrack*) track,kTRUE);\r
-\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= 0; \r
- arrayMC = dynamic_cast<TClonesArray*> (event->GetList()->FindObject(AliAODMCParticle::StdBranchName()));\r
- if (!arrayMC) {\r
- Printf("Error: MC particles branch not found!\n");\r
- return;\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
- if (isQA) {\r
- fEventCounter->Fill(5);\r
- fEventCounter->Fill(50+gCent);\r
- }\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, gCent)) 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 {\r
- printf(" No Event Type is Defined ");\r
- return;\r
- }\r
- \r
- if( (gCharge[0] + gCharge[1]) != 0 ) {\r
- if (isQA) {\r
- fEventCounter->Fill(6); \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] + gCharge[1];\r
- vsparse[3] = gCharge[0];\r
- vsparse[4] = gCharge[1];\r
- vsparse[5] = gPid[0][0] + gPid[0][1];\r
- vsparse[6] = gPid[0][0];\r
- vsparse[7] = gPid[0][1];\r
- vsparse[8] = gPid[1][0] + gPid[1][0];\r
- vsparse[9] = gPid[1][0];\r
- vsparse[10] = gPid[1][1];\r
- vsparse[11] = gPid[2][0] + gPid[2][1];\r
- vsparse[12] = gPid[2][0];\r
- vsparse[13] = 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
- PostData(1, fThnList);\r
-}\r
-\r
-void AliEbyEParticleRatioFluctuationTask::Terminate( Option_t * ){\r
- Info("AliEbyEParticleRatioFluctuationTask"," Task Successfully finished");\r
-}\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptEvent(AliAODEvent *event, Int_t cent) 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(3);\r
- fHistQA[3]->Fill(cent,vertex->GetX());\r
- fHistQA[4]->Fill(cent,vertex->GetY());\r
- fHistQA[5]->Fill(cent,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(4);\r
- fHistQA[0]->Fill(cent,vertex->GetX());\r
- fHistQA[1]->Fill(cent,vertex->GetY());\r
- fHistQA[2]->Fill(cent,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, Int_t cent) const {\r
- if(!track) return kFALSE;\r
- if (track->Charge() == 0 ) return kFALSE;\r
- \r
- if(isQA) {\r
- fHistQA[6]->Fill(cent,track->DCA());\r
- fHistQA[7]->Fill(cent,track->ZAtDCA());\r
- fHistQA[8]->Fill(cent,track->Pt());\r
- fHistQA[9]->Fill(cent,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(cent,track->DCA());\r
- fHistQA[11]->Fill(cent,track->ZAtDCA());\r
- fHistQA[12]->Fill(cent,track->Pt());\r
- fHistQA[13]->Fill(cent,track->Eta());\r
- }\r
- \r
- return kTRUE;\r
-}\r
-\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptMCTrack(AliAODMCParticle *track, Int_t cent) 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(cent,track->Pt());\r
- fHistQA[9]->Fill(cent,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(cent,track->Pt());\r
- fHistQA[13]->Fill(cent,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;
+}