From bb6f433c01788dc77a367b16a6b061c8d0e273d2 Mon Sep 17 00:00:00 2001 From: delia Date: Thu, 17 Oct 2013 20:23:37 +0000 Subject: [PATCH] First preliminary tasks for PWGLF production QA (cont'd) --- PWGLF/CMakelibPWGLFQATasks.pkg | 40 + PWGLF/PWGLFQATasksLinkDef.h | 10 + PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.cxx | 1941 +++++++++++++++++ PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.h | 175 ++ PWGLF/QATasks/AliQAProdMultistrange.cxx | 901 ++++++++ PWGLF/QATasks/AliQAProdMultistrange.h | 102 + 6 files changed, 3169 insertions(+) create mode 100644 PWGLF/CMakelibPWGLFQATasks.pkg create mode 100644 PWGLF/PWGLFQATasksLinkDef.h create mode 100644 PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.cxx create mode 100644 PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.h create mode 100644 PWGLF/QATasks/AliQAProdMultistrange.cxx create mode 100644 PWGLF/QATasks/AliQAProdMultistrange.h diff --git a/PWGLF/CMakelibPWGLFQATasks.pkg b/PWGLF/CMakelibPWGLFQATasks.pkg new file mode 100644 index 00000000000..585466032b3 --- /dev/null +++ b/PWGLF/CMakelibPWGLFQATasks.pkg @@ -0,0 +1,40 @@ +# -*- mode: CMake -*- +#-----------------------------------------------------------------------# +# Package File for PWG2spectra # +# Author : Johny Jose (johny.jose@cern.ch) # +# Variables Defined : # +# # +# SRCS - C++ source files # +# HDRS - C++ header files # +# DHDR - ROOT Dictionary Linkdef header file # +# CSRCS - C source files # +# CHDRS - C header files # +# EINCLUDE - Include directories # +# EDEFINE - Compiler definitions # +# ELIBS - Extra libraries to link # +# ELIBSDIR - Extra library directories # +# PACKFFLAGS - Fortran compiler flags for package # +# PACKCXXFLAGS - C++ compiler flags for package # +# PACKCFLAGS - C compiler flags for package # +# PACKSOFLAGS - Shared library linking flags # +# PACKLDFLAGS - Module linker flags # +# PACKBLIBS - Libraries to link (Executables only) # +# EXPORT - Header files to be exported # +# CINTHDRS - Dictionary header files # +# CINTAUTOLINK - Set automatic dictionary generation # +# ARLIBS - Archive Libraries and objects for linking (Executables only) # +# SHLIBS - Shared Libraries and objects for linking (Executables only) # +#-----------------------------------------------------------------------# + +set ( SRCS + QATasks/AliAnalysisTaskQAHighPtDeDx.cxx + QATasks/AliQAProdMultistrange.cxx +) + +string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" ) + +set ( DHDR PWGLFQATasksLinkDef.h) + +set ( EXPORT ) + +set ( EINCLUDE ANALYSIS PWGLF/QATasks STEER/ESD STEER/STEERBase) diff --git a/PWGLF/PWGLFQATasksLinkDef.h b/PWGLF/PWGLFQATasksLinkDef.h new file mode 100644 index 00000000000..fe4621911c8 --- /dev/null +++ b/PWGLF/PWGLFQATasksLinkDef.h @@ -0,0 +1,10 @@ +#ifdef __CINT__ + +#pragma link off all glols; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliAnalysisTaskQAHighPtDeDx+; +#pragma link C++ class AliQAProdMultistrange+; + +#endif diff --git a/PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.cxx b/PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.cxx new file mode 100644 index 00000000000..d10501be79f --- /dev/null +++ b/PWGLF/QATasks/AliAnalysisTaskQAHighPtDeDx.cxx @@ -0,0 +1,1941 @@ + /************************************************************************* +* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* 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. * **************************************************************************/ + + +#include "AliAnalysisTaskQAHighPtDeDx.h" + +// ROOT includes +#include +#include +#include +#include +#include +#include +#include +#include + +// AliRoot includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include "AliCentrality.h" +#include +#include +#include + +#include +#include +#include + + +// STL includes +#include +using namespace std; + + +// +// Responsible: +// Antonio Ortiz (Lund) +// Peter Christiansen (Lund) +// + + + + + + + + +const Double_t AliAnalysisTaskQAHighPtDeDx::fgkClight = 2.99792458e-2; +Float_t magf = -1; +TF1* cutLow = new TF1("StandardPhiCutLow", "0.1/x/x+pi/18.0-0.025", 0, 50); +TF1* cutHigh = new TF1("StandardPhiCutHigh", "0.12/x+pi/18.0+0.035", 0, 50); +Double_t DeDxMIPMin = 30; +Double_t DeDxMIPMax = 65; +const Int_t nHists = 9; + +Int_t etaLow[nHists] = {-8, -8, -6, -4, -2, 0, 2, 4, 6}; +Int_t etaHigh[nHists] = { 8, -6, -4, -2, 0, 2, 4, 6, 8}; + +Int_t nDeltaPiBins = 60; +Double_t deltaPiLow = 40; +Double_t deltaPiHigh = 100; +const Char_t *Pid[7]={"Ch","Pion","Kaon","Proton","Electron","Muon","Oher"}; +ClassImp(AliAnalysisTaskQAHighPtDeDx) +//_____________________________________________________________________________ +AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx(const char *name): + AliAnalysisTaskSE(name), + fESD(0x0), + fAOD(0x0), + fMC(0x0), + fMCStack(0x0), + fMCArray(0x0), + fTrackFilterGolden(0x0), + fTrackFilterTPC(0x0), + fCentEst("V0M"), + fAnalysisType("ESD"), + fAnalysisMC(kFALSE), + fAnalysisPbPb(kFALSE), + ftrigBit(0x0), + fRandom(0x0), + fPileUpRej(kFALSE), + fVtxCut(10.0), + fEtaCut(0.9), + fMinCent(0.0), + fMaxCent(100.0), + fStoreMcIn(kFALSE),// + fMcProcessType(-999), + fTriggeredEventMB(-999), + fVtxStatus(-999), + fZvtx(-999), + fZvtxMC(-999), + fRun(-999), + fEventId(-999), + fListOfObjects(0), + fEvents(0x0), fVtx(0x0), fVtxMC(0x0), fVtxBeforeCuts(0x0), fVtxAfterCuts(0x0), + fn1(0x0), + fcent(0x0), + hMIPVsEta(0x0), + pMIPVsEta(0x0), + hMIPVsEtaV0s(0x0), + pMIPVsEtaV0s(0x0), + hPlateauVsEta(0x0), + pPlateauVsEta(0x0), + hPhi(0x0) + + +{ + // Default constructor (should not be used) + for(Int_t i=0;i<9;++i){ + + hMIPVsNch[i]=0;//TH2D, MIP vs Nch for different eta intervals + pMIPVsNch[i]=0;//TProfile, MIP vs Nch for different eta intervals + hMIPVsPhi[i]=0;//TH2D, MIP vs phi for different eta intervals + pMIPVsPhi[i]=0;//TProfile, MIP vs phi for different eta intervals + hPlateauVsPhi[i]=0;//TH2D, dE/dx vs Phi, electrons 0.41 + histEV0[i]=0; + + for(Int_t pid=0;pid<7;++pid){ + hMcIn[pid][i]=0; + hMcOut[pid][i]=0; + } + + } + DefineOutput(1, TList::Class());//esto es nuevo +} + +//______________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::UserCreateOutputObjects() +{ + // This method is called once per worker node + // Here we define the output: histograms and debug tree if requested + // We also create the random generator here so it might get different seeds... + fRandom = new TRandom(0); // 0 means random seed + + + + //OpenFile(1); + fListOfObjects = new TList(); + fListOfObjects->SetOwner(); + + + + + // + // Histograms + // + fEvents = new TH1I("fEvents","Number of analyzed events; Events; Counts", 3, 0, 3); + fListOfObjects->Add(fEvents); + + fn1=new TH1F("fn1","fn1",11,-1,10); + fListOfObjects->Add(fn1); + + fcent=new TH1F("fcent","fcent",104,-2,102); + fListOfObjects->Add(fcent); + + fVtx = new TH1I("fVtx","Vtx info (0=no, 1=yes); Vtx; Counts", 2, -0.5, 1.5); + fListOfObjects->Add(fVtx); + + fVtxBeforeCuts = new TH1F("fVtxBeforeCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30); + fListOfObjects->Add(fVtxBeforeCuts); + + fVtxAfterCuts = new TH1F("fVtxAfterCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30); + fListOfObjects->Add(fVtxAfterCuts); + + + const Int_t nPtBinsV0s = 25; + Double_t ptBinsV0s[nPtBinsV0s+1] = { 0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 , + 1.2 , 1.4 , 1.6 , 1.8 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 , 5.0 , 7.0 , + 9.0 , 12.0, 15.0, 20.0 }; + + + + + const Char_t* ending[nHists] = {"", "86", "64", "42", "20", "02", "24", "46", "68"}; + + const Char_t* LatexEta[nHists] = { + "|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", + "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8" + }; + hPhi = new TH2D("histPhi", "pt; #phi'", nPtBinsV0s, ptBinsV0s, 90, -0.05, 0.4); + //dE/dx vs phi, pions at the MIP + fListOfObjects->Add(hPhi); + + + + + Int_t nPhiBins = 36; + + for(Int_t i = 0; i < nHists; i++) { + + + hMIPVsPhi[i] = new TH2D(Form("hMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(), + DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax); + hMIPVsPhi[i]->Sumw2(); + + pMIPVsPhi[i] = new TProfile(Form("pMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(), + DeDxMIPMin, DeDxMIPMax); + pMIPVsPhi[i]->SetMarkerStyle(20); + pMIPVsPhi[i]->SetMarkerColor(1); + pMIPVsPhi[i]->SetLineColor(1); + pMIPVsPhi[i]->Sumw2(); + + fListOfObjects->Add(hMIPVsPhi[i]); + fListOfObjects->Add(pMIPVsPhi[i]); + + hPlateauVsPhi[i] = new TH2D(Form("hPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(), + 95-DeDxMIPMax, DeDxMIPMax, 95); + hPlateauVsPhi[i]->Sumw2(); + + pPlateauVsPhi[i] = new TProfile(Form("pPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(), + DeDxMIPMax, 95); + pPlateauVsPhi[i]->SetMarkerStyle(20); + pPlateauVsPhi[i]->SetMarkerColor(1); + pPlateauVsPhi[i]->SetLineColor(1); + pPlateauVsPhi[i]->Sumw2(); + + fListOfObjects->Add(hPlateauVsPhi[i]); + fListOfObjects->Add(pPlateauVsPhi[i]); + + + hMIPVsNch[i] = new TH2D(Form("hMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001, + DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax); + hMIPVsNch[i]->Sumw2(); + + pMIPVsNch[i] = new TProfile(Form("pMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001, DeDxMIPMin, DeDxMIPMax); + pMIPVsNch[i]->SetMarkerStyle(20); + pMIPVsNch[i]->SetMarkerColor(1); + pMIPVsNch[i]->SetLineColor(1); + pMIPVsNch[i]->Sumw2(); + + fListOfObjects->Add(hMIPVsNch[i]); + fListOfObjects->Add(pMIPVsNch[i]); + + + histPiV0[i] = new TH2D(Form("histPiV0%s", ending[i]), "Pions id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh); + histPiV0[i]->Sumw2(); + histPV0[i] = new TH2D(Form("histPV0%s", ending[i]), "Protons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh); + + fListOfObjects->Add(histPiV0[i]); + fListOfObjects->Add(histPV0[i]); + + histPiTof[i] = new TH2D(Form("histPiTof%s", ending[i]), "all charged", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh); + histPiTof[i]->Sumw2(); + + histAllCh[i] = new TH2D(Form("histAllCh%s", ending[i]), "Pions id by TOF", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh); + histAllCh[i]->Sumw2(); + + fListOfObjects->Add(histPiTof[i]); + fListOfObjects->Add(histAllCh[i]); + + histEV0[i] = new TH2D(Form("histEV0%s", ending[i]), "Electrons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh); + histEV0[i]->Sumw2(); + fListOfObjects->Add(histEV0[i]); + + + + } + + + hMIPVsEta = new TH2D("hMIPVsEta","; #eta; dE/dx_{MIP, primary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax); + pMIPVsEta = new TProfile("pMIPVsEta","; #eta; #LT dE/dx #GT_{MIP, primary tracks}",16,-0.8,0.8, DeDxMIPMin, DeDxMIPMax); + hMIPVsEtaV0s = new TH2D("hMIPVsEtaV0s","; #eta; dE/dx_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax); + pMIPVsEtaV0s = new TProfile("pMIPVsEtaV0s","; #eta; #LT dE/dx #GT_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMin, DeDxMIPMax); + + hPlateauVsEta = new TH2D("hPlateauVsEta","; #eta; dE/dx_{Plateau, primary tracks}",16,-0.8,0.8,95-DeDxMIPMax, DeDxMIPMax, 95); + pPlateauVsEta = new TProfile("pPlateauVsEta","; #eta; #LT dE/dx #GT_{Plateau, primary tracks}",16,-0.8,0.8, DeDxMIPMax, 95); + + fListOfObjects->Add(hMIPVsEta); + fListOfObjects->Add(pMIPVsEta); + fListOfObjects->Add(hMIPVsEtaV0s); + fListOfObjects->Add(pMIPVsEtaV0s); + fListOfObjects->Add(hPlateauVsEta); + fListOfObjects->Add(pPlateauVsEta); + + + + + + + if (fAnalysisMC) { + for(Int_t i = 0; i < nHists; i++) { + for(Int_t pid = 0; pid < 7; pid++) { + + hMcIn[pid][i] = new TH1D(Form("hIn%s%s", Pid[pid],ending[i]), Form("MC in (pid %s)", Pid[pid]), + nPtBinsV0s, ptBinsV0s); + fListOfObjects->Add(hMcIn[pid][i]); + + hMcOut[pid][i] = new TH1D(Form("hMcOut%s%s", Pid[pid],ending[i]), Form("MC out (pid %s)", Pid[pid]), + nPtBinsV0s, ptBinsV0s); + fListOfObjects->Add(hMcOut[pid][i]); + + + } + } + + fVtxMC = new TH1F("fVtxMC","mc vtx", 120, -30, 30); + fListOfObjects->Add(fVtxMC); + + } + + // Post output data. + PostData(1, fListOfObjects); +} + +//______________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::UserExec(Option_t *) +{ + // Main loop + + // + // First we make sure that we have valid input(s)! + // + + + + AliVEvent *event = InputEvent(); + if (!event) { + Error("UserExec", "Could not retrieve event"); + return; + } + + + + if (fAnalysisType == "ESD"){ + fESD = dynamic_cast(event); + if(!fESD){ + Printf("%s:%d ESDEvent not found in Input Manager",(char*)__FILE__,__LINE__); + this->Dump(); + return; + } + } else { + fAOD = dynamic_cast(event); + if(!fAOD){ + Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__); + this->Dump(); + return; + } + } + + + + if (fAnalysisMC) { + + if (fAnalysisType == "ESD"){ + fMC = dynamic_cast(MCEvent()); + if(!fMC){ + Printf("%s:%d MCEvent not found in Input Manager",(char*)__FILE__,__LINE__); + this->Dump(); + return; + } + + fMCStack = fMC->Stack(); + + if(!fMCStack){ + Printf("%s:%d MCStack not found in Input Manager",(char*)__FILE__,__LINE__); + this->Dump(); + return; + } + } else { // AOD + + fMC = dynamic_cast(MCEvent()); + if(fMC) + fMC->Dump(); + + fMCArray = (TClonesArray*)fAOD->FindListObject("mcparticles"); + if(!fMCArray){ + Printf("%s:%d AOD MC array not found in Input Manager",(char*)__FILE__,__LINE__); + this->Dump(); + return; + } + } + } + + + // Get trigger decision + fTriggeredEventMB = 0; //init + + fn1->Fill(0); + + if(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler())) + ->IsEventSelected() & ftrigBit ){ + fTriggeredEventMB = 1; //event triggered as minimum bias + } + + // Get process type for MC + fMcProcessType = 0; // -1=invalid, 0=data, 1=ND, 2=SD, 3=DD + + // real data that are not triggered we skip + if(!fAnalysisMC && !fTriggeredEventMB) + return; + + fn1->Fill(1); + + + if (fAnalysisMC) { + + + + if (fAnalysisType == "ESD"){ + + + + AliHeader* headerMC = fMC->Header(); + if (headerMC) { + + AliGenEventHeader* genHeader = headerMC->GenEventHeader(); + TArrayF vtxMC(3); // primary vertex MC + vtxMC[0]=9999; vtxMC[1]=9999; vtxMC[2]=9999; //initialize with dummy + if (genHeader) { + genHeader->PrimaryVertex(vtxMC); + } + fZvtxMC = vtxMC[2]; + + // PYTHIA: + AliGenPythiaEventHeader* pythiaGenHeader = + dynamic_cast(headerMC->GenEventHeader()); + if (pythiaGenHeader) { //works only for pythia + fMcProcessType = GetPythiaEventProcessType(pythiaGenHeader->ProcessType()); + } + // PHOJET: + AliGenDPMjetEventHeader* dpmJetGenHeader = + dynamic_cast(headerMC->GenEventHeader()); + if (dpmJetGenHeader) { + fMcProcessType = GetDPMjetEventProcessType(dpmJetGenHeader->ProcessType()); + } + } + } else { // AOD + + + + AliAODMCHeader* mcHeader = dynamic_cast(fAOD->FindListObject("mcHeader")); + + + if(mcHeader) { + fZvtxMC = mcHeader->GetVtxZ(); + + + + if(strstr(mcHeader->GetGeneratorName(), "Pythia")) { + fMcProcessType = GetPythiaEventProcessType(mcHeader->GetEventType()); + } else { + fMcProcessType = GetDPMjetEventProcessType(mcHeader->GetEventType()); + } + } + } + + + } + + + + if (fAnalysisType == "ESD"){ + + const AliESDVertex *vtxESD = fESD->GetPrimaryVertexTracks(); + if(vtxESD->GetNContributors()<1) { + // SPD vertex + vtxESD = fESD->GetPrimaryVertexSPD(); + /* quality checks on SPD-vertex */ + TString vertexType = vtxESD->GetTitle(); + if (vertexType.Contains("vertexer: Z") && (vtxESD->GetDispersion() > 0.04 || vtxESD->GetZRes() > 0.25)) + fZvtx = -1599; //vertex = 0x0; // + else if (vtxESD->GetNContributors()<1) + fZvtx = -999; //vertex = 0x0; // + else + fZvtx = vtxESD->GetZ(); + } + else + fZvtx = vtxESD->GetZ(); + + } + else // AOD + fZvtx = GetVertex(fAOD); + + fVtxBeforeCuts->Fill(fZvtx); + + //cut on the z position of vertex + if (TMath::Abs(fZvtx) > fVtxCut) { + return; + } + fn1->Fill(2); + + + + + + + Float_t centrality = -10; + + // only analyze triggered events + if(fTriggeredEventMB) { + + if (fAnalysisType == "ESD"){ + if(fAnalysisPbPb){ + AliCentrality *centObject = fESD->GetCentrality(); + centrality = centObject->GetCentralityPercentile(fCentEst); + + if((centrality>fMaxCent)||(centralityFill(centrality); + fn1->Fill(3); + if(fAnalysisMC){ + if(TMath::Abs(fZvtxMC)Fill(fZvtxMC); + } + } + AnalyzeESD(fESD); + } else { // AOD + if(fAnalysisPbPb){ + AliCentrality *centObject = fAOD->GetCentrality(); + if(centObject){ + centrality = centObject->GetCentralityPercentile(fCentEst); + } + //cout<<"centrality="<fMaxCent)||(centralityFill(centrality); + fn1->Fill(3); + if(fAnalysisMC){ + if(TMath::Abs(fZvtxMC)Fill(fZvtxMC); + } + } + AnalyzeAOD(fAOD); + } + } + + fVtxAfterCuts->Fill(fZvtx); + + + + + // Post output data. + PostData(1, fListOfObjects); +} + +//________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::AnalyzeESD(AliESDEvent* esdEvent) +{ + fRun = esdEvent->GetRunNumber(); + fEventId = 0; + if(esdEvent->GetHeader()) + fEventId = GetEventIdAsLong(esdEvent->GetHeader()); + + Bool_t isPileup = esdEvent->IsPileupFromSPD(); + if(fPileUpRej) + if(isPileup) + return; + fn1->Fill(4); + + + // Int_t event = esdEvent->GetEventNumberInFile(); + //UInt_t time = esdEvent->GetTimeStamp(); + // ULong64_t trigger = esdEvent->GetTriggerMask(); + magf = esdEvent->GetMagneticField(); + + + + + + if(fTriggeredEventMB) {// Only MC case can we have not triggered events + + // accepted event + fEvents->Fill(0); + + + //Change, 10/04/13. Now accept all events to do a correct normalization + //if(fVtxStatus!=1) return; // accepted vertex + //Int_t nESDTracks = esdEvent->GetNumberOfTracks(); + + ProduceArrayTrksESD( esdEvent );//produce array with global track parameters + ProduceArrayV0ESD( esdEvent );//v0's + + + fEvents->Fill(1); + + + + + } // end if triggered + + +} + +//________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::AnalyzeAOD(AliAODEvent* aodEvent) +{ + fRun = aodEvent->GetRunNumber(); + fEventId = 0; + if(aodEvent->GetHeader()) + fEventId = GetEventIdAsLong(aodEvent->GetHeader()); + + //UInt_t time = 0; // Missing AOD info? aodEvent->GetTimeStamp(); + magf = aodEvent->GetMagneticField(); + + //Int_t trackmult = 0; // no pt cuts + //Int_t nadded = 0; + + Bool_t isPileup = aodEvent->IsPileupFromSPD(); + if(fPileUpRej) + if(isPileup) + return; + fn1->Fill(4); + + + + if(fTriggeredEventMB) {// Only MC case can we have not triggered events + + // accepted event + fEvents->Fill(0); + + //if(fVtxStatus!=1) return; // accepted vertex + //Int_t nAODTracks = aodEvent->GetNumberOfTracks(); + + ProduceArrayTrksAOD( aodEvent ); + ProduceArrayV0AOD( aodEvent ); + + fEvents->Fill(1); + + + + + } // end if triggered + +} + +//_____________________________________________________________________________ +Float_t AliAnalysisTaskQAHighPtDeDx::GetVertex(const AliVEvent* event) const +{ + Float_t zvtx = -999; + + const AliVVertex* primaryVertex = event->GetPrimaryVertex(); + + if(primaryVertex->GetNContributors()>0) + zvtx = primaryVertex->GetZ(); + + return zvtx; +} + +//_____________________________________________________________________________ +Short_t AliAnalysisTaskQAHighPtDeDx::GetPidCode(Int_t pdgCode) const +{ + // return our internal code for pions, kaons, and protons + + Short_t pidCode = 6; + + switch (TMath::Abs(pdgCode)) { + case 211: + pidCode = 1; // pion + break; + case 321: + pidCode = 2; // kaon + break; + case 2212: + pidCode = 3; // proton + break; + case 11: + pidCode = 4; // electron + break; + case 13: + pidCode = 5; // muon + break; + default: + pidCode = 6; // something else? + }; + + return pidCode; +} + +//_____________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthESD() +{ + // Fill the special MC histogram with the MC truth info + + const Int_t nTracksMC = fMCStack->GetNtrack(); + + for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) { + + //Cuts + if(!(fMCStack->IsPhysicalPrimary(iTracks))) + continue; + + TParticle* trackMC = fMCStack->Particle(iTracks); + + TParticlePDG* pdgPart = trackMC ->GetPDG(); + Double_t chargeMC = pdgPart->Charge(); + + if(chargeMC==0) + continue; + + if (TMath::Abs(trackMC->Eta()) > fEtaCut ) + continue; + + Double_t etaMC = trackMC->Eta(); + Int_t pdgCode = trackMC->GetPdgCode(); + Short_t pidCodeMC = 0; + pidCodeMC = GetPidCode(pdgCode); + + + for(Int_t nh = 0; nh < 9; nh++) { + + if( etaMC > etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 ) + continue; + + hMcIn[0][nh]->Fill(trackMC->Pt()); + hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt()); + + + } + + }//MC track loop + + + +} + +//_____________________________________________________________________________ +void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthAOD() +{ + // Fill the special MC histogram with the MC truth info + + + const Int_t nTracksMC = fMCArray->GetEntriesFast(); + + for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) { + + AliAODMCParticle* trackMC = dynamic_cast(fMCArray->At(iTracks)); + + //Cuts + if(!(trackMC->IsPhysicalPrimary())) + continue; + + + Double_t chargeMC = trackMC->Charge(); + if(chargeMC==0) + continue; + + + if (TMath::Abs(trackMC->Eta()) > fEtaCut ) + continue; + + Double_t etaMC = trackMC->Eta(); + Int_t pdgCode = trackMC->GetPdgCode(); + Short_t pidCodeMC = 0; + pidCodeMC = GetPidCode(pdgCode); + + //cout<<"pidcode="< etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 ) + continue; + + hMcIn[0][nh]->Fill(trackMC->Pt()); + hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt()); + + + } + + }//MC track loop + + +} + + +//_____________________________________________________________________________ +Short_t AliAnalysisTaskQAHighPtDeDx::GetPythiaEventProcessType(Int_t pythiaType) { + // + // Get the process type of the event. PYTHIA + // + // source PWG0 dNdpt + + Short_t globalType = -1; //init + + if(pythiaType==92||pythiaType==93){ + globalType = 2; //single diffractive + } + else if(pythiaType==94){ + globalType = 3; //double diffractive + } + //else if(pythiaType != 91){ // also exclude elastic to be sure... CKB?? + else { + globalType = 1; //non diffractive + } + return globalType; +} + +//_____________________________________________________________________________ +Short_t AliAnalysisTaskQAHighPtDeDx::GetDPMjetEventProcessType(Int_t dpmJetType) { + // + // get the process type of the event. PHOJET + // + //source PWG0 dNdpt + // can only read pythia headers, either directly or from cocktalil header + Short_t globalType = -1; + + if (dpmJetType == 1 || dpmJetType == 4) { // explicitly inelastic plus central diffraction + globalType = 1; + } + else if (dpmJetType==5 || dpmJetType==6) { + globalType = 2; + } + else if (dpmJetType==7) { + globalType = 3; + } + return globalType; +} + +//_____________________________________________________________________________ +ULong64_t AliAnalysisTaskQAHighPtDeDx::GetEventIdAsLong(AliVHeader* header) const +{ + // To have a unique id for each event in a run! + // Modified from AliRawReader.h + return ((ULong64_t)header->GetBunchCrossNumber()+ + (ULong64_t)header->GetOrbitNumber()*3564+ + (ULong64_t)header->GetPeriodNumber()*16777215*3564); +} + + +//____________________________________________________________________ +TParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMother(AliStack* stack, Int_t label) +{ + // + // Finds the first mother among the primary particles of the particle identified by