From: gconesab Date: Fri, 24 Oct 2008 15:54:58 +0000 (+0000) Subject: Jet and Particle identification tasks moved to different directories X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=f305082419a8b6786428e14251dbe7762de5b736;hp=b9dbe90758771c1e2e73481381ca36f95b8a620b Jet and Particle identification tasks moved to different directories --- diff --git a/PWG4/CMakeLists.txt b/PWG4/CMakeLists.txt index 630260b9d9f..9467b822106 100644 --- a/PWG4/CMakeLists.txt +++ b/PWG4/CMakeLists.txt @@ -6,6 +6,8 @@ set(INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/PWG4 +${CMAKE_SOURCE_DIR}/PWG4/PartCorr +${CMAKE_SOURCE_DIR}/PWG4/JetTasks ${CMAKE_SOURCE_DIR}/STEER ${CMAKE_SOURCE_DIR}/ANALYSIS ${ROOT_INCLUDE_DIR} @@ -22,4 +24,4 @@ link_directories( ${LINK_DIRECTORIES}) SetModule() include(CMake_libPWG4PartCorr.txt) - +include(CMake_libPWG4JetTasks.txt) diff --git a/PWG4/CMake_libPWG4JetTasks.txt b/PWG4/CMake_libPWG4JetTasks.txt new file mode 100644 index 00000000000..b76e6cc95b1 --- /dev/null +++ b/PWG4/CMake_libPWG4JetTasks.txt @@ -0,0 +1,12 @@ +# -*- mode: cmake -*- + +set(SRCS + JetTasks/AliAnalysisTaskUE.cxx JetTasks/AliAnalysisTaskJetSpectrum.cxx JetTasks/AliAnalysisHelperJetTasks.cxx JetTasks/AliAnaESDSpectraQA.cxx +) + +# fill list of header files from list of source files +# by exchanging the file extension +String(REPLACE ".cxx" ".h" HDRS "${SRCS}") + +AddLibrary(PWG4JetTasks "${SRCS}" "${HDRS}") + diff --git a/PWG4/CMake_libPWG4PartCorr.txt b/PWG4/CMake_libPWG4PartCorr.txt index 3634294cd0c..41cdcab7ad7 100644 --- a/PWG4/CMake_libPWG4PartCorr.txt +++ b/PWG4/CMake_libPWG4PartCorr.txt @@ -1,17 +1,17 @@ # -*- mode: cmake -*- set(SRCS - AliAnaCaloTrigger.cxx AliAnaCaloTriggerMC.cxx - AliAODParticleCorrelation.cxx AliAnalysisTaskPHOSExample.cxx - AliNeutralMesonSelection.cxx AliFidutialCut.cxx AliCaloPID.cxx AliIsolationCut.cxx - AliAnaScale.cxx AliAnaPartCorrMaker.cxx - AliAnaPartCorrBaseClass.cxx AliAnaExample.cxx AliAnaGammaDirect.cxx - AliAnaParticlePartonCorrelation.cxx AliAnaParticleHadronCorrelation.cxx - AliAnaParticleJetFinderCorrelation.cxx - AliAnaParticleJetLeadingConeCorrelation.cxx AliAnalysisTaskParticleCorrelation.cxx - AliCaloTrackReader.cxx AliCaloTrackESDReader.cxx - AliCaloTrackAODReader.cxx AliCaloTrackMCReader.cxx AliAnaPi0.cxx AliCaloPhoton.cxx - AliV0Reader.cxx AliAnalysisTaskGammaConversion.cxx AliGammaConversionHistograms.cxx + PartCorr/AliAnaCaloTrigger.cxx PartCorr/AliAnaCaloTriggerMC.cxx + PartCorr/AliAODParticleCorrelation.cxx PartCorr/AliAnalysisTaskPHOSExample.cxx + PartCorr/AliNeutralMesonSelection.cxx PartCorr/AliFidutialCut.cxx PartCorr/AliCaloPID.cxx PartCorr/AliIsolationCut.cxx + PartCorr/AliAnaScale.cxx PartCorr/AliAnaPartCorrMaker.cxx + PartCorr/AliAnaPartCorrBaseClass.cxx PartCorr/AliAnaExample.cxx PartCorr/AliAnaGammaDirect.cxx + PartCorr/AliAnaParticlePartonCorrelation.cxx PartCorr/AliAnaParticleHadronCorrelation.cxx + PartCorr/AliAnaParticleJetFinderCorrelation.cxx + PartCorr/AliAnaParticleJetLeadingConeCorrelation.cxx PartCorr/AliAnalysisTaskParticleCorrelation.cxx + PartCorr/AliCaloTrackReader.cxx PartCorr/AliCaloTrackESDReader.cxx + PartCorr/AliCaloTrackAODReader.cxx PartCorr/AliCaloTrackMCReader.cxx PartCorr/AliCaloPhoton.cxx + PartCorr/AliV0Reader.cxx PartCorr/AliAnalysisTaskGammaConversion.cxx PartCorr/AliGammaConversionHistograms.cxx ) # fill list of header files from list of source files diff --git a/PWG4/JetTasks/AliAnaESDSpectraQA.cxx b/PWG4/JetTasks/AliAnaESDSpectraQA.cxx new file mode 100644 index 00000000000..11813a2e336 --- /dev/null +++ b/PWG4/JetTasks/AliAnaESDSpectraQA.cxx @@ -0,0 +1,231 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* $Id: $ */ +#include "AliAnaESDSpectraQA.h" + +#include "TH1.h" +#include "TH2.h" +#include "TH3.h" +#include "TList.h" +#include "TChain.h" +#include "TDirectory.h" + +#include "AliAnalysisManager.h" +#include "AliLog.h" +#include "AliESDInputHandler.h" +#include "AliESDEvent.h" +#include "AliESDVertex.h" +#include "AliESDtrack.h" +#include "AliESDtrackCuts.h" + + +const Int_t AliAnaESDSpectraQA::fgkNPtBins=38; +const Float_t AliAnaESDSpectraQA::fgkPtMin=2; +const Float_t AliAnaESDSpectraQA::fgkPtMax=40; +const Int_t AliAnaESDSpectraQA::fgkNPhiBins=18; + +ClassImp(AliAnaESDSpectraQA) + +AliAnaESDSpectraQA::AliAnaESDSpectraQA(): AliAnalysisTask("AliAnaESDSpectraQA", ""), + fESD(0), + fTrackCuts(0), + fNEvent(0), // just to avoid warnings, inititialized in InitPointers too + fPtAll(0), // + fPtSel(0), // + fHistList(0) +{ + InitHistPointers(); +} + +AliAnaESDSpectraQA::AliAnaESDSpectraQA(const char *name): + AliAnalysisTask(name, ""), + fESD(0), + fNEvent(0), // just to avoid warnings, inititialized in InitPointers too + fPtAll(0), // + fPtSel(0), // + fHistList(0) { + // Input slot #0 works with a TChain ESD + DefineInput(0, TChain::Class()); + // Output slot #0 writes into a TList + DefineOutput(0, TList::Class()); + InitHistPointers(); + fTrackCuts = new AliESDtrackCuts; + fTrackCuts->SetAcceptKingDaughters(kFALSE); + fTrackCuts->SetRequireTPCRefit(kTRUE); + fTrackCuts->SetEtaRange(-1,1); + // Add chisq criterium to reject 'bad' tracks that might not make it as prim +} + +//________________________________________________________________________ +void AliAnaESDSpectraQA::ConnectInputData(Option_t *) +{ + // Connect ESD here + // Called once + TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); + + if( handler && handler->InheritsFrom("AliESDInputHandler") ) { + fESD = ((AliESDInputHandler*)handler)->GetEvent(); + } + else { + AliFatal("I can't get any ESD Event Handler"); + } +} + +void AliAnaESDSpectraQA::InitHistPointers() { + fNEvent = 0; + fPtAll = 0; + fPtSel = 0; + for (Int_t i=0; i< 4; i++) { + fHists[i].PhiPtNPointTPC = 0; + fHists[i].PhiPtNPointITS = 0; + fHists[i].PhiPtChisqC = 0; + fHists[i].PhiPtChisqTPC = 0; + fHists[i].PhiPtDCAR = 0; + fHists[i].PhiPtDCAZ = 0; + } +} + +void AliAnaESDSpectraQA::CreateOutputObjects() { + fHistList = new TList(); + //fDirectory = new TDirectory("trig_hists","Trigger histos"); + //fDirectory->cd(); + TString labels[4]; + labels[kNegA]="NegA"; + labels[kPosA]="PosA"; + labels[kNegC]="NegC"; + labels[kPosC]="PosC"; + + static const Float_t kMinPhi = 0; + static const Float_t kMaxPhi = 2*TMath::Pi(); + fNEvent = new TH1F("NEvent","NEvent",1,-0.5,0.5); + fHistList->Add(fNEvent); + fPtAll = new TH1F("PtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax); + fHistList->Add(fPtAll); + fPtSel = new TH1F("PtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax); + fHistList->Add(fPtSel); + for (Int_t iSide = 0; iSide < 4; iSide++) { + TString hname="PhiPtNpointTPC"; + hname += labels[iSide]; + fHists[iSide].PhiPtNPointTPC = new TH3F(hname,hname+";#phi;p_{T} (GeV);N_{point,TPC}",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,160,0.5,160.5); + fHistList->Add(fHists[iSide].PhiPtNPointTPC); + + hname="PhiPtNpointITS"; + hname += labels[iSide]; + fHists[iSide].PhiPtNPointITS = new TH3F(hname,hname+";#phi;p_{T} (GeV);N_{point,ITS}",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,9,-0.5,8.5); + fHistList->Add(fHists[iSide].PhiPtNPointITS); + + hname="PhiPtChisqC"; + hname += labels[iSide]; + fHists[iSide].PhiPtChisqC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,160,0,80); + fHistList->Add(fHists[iSide].PhiPtChisqC); + + hname="PhiPtChisqTPC"; + hname += labels[iSide]; + fHists[iSide].PhiPtChisqTPC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5); + fHistList->Add(fHists[iSide].PhiPtChisqTPC); + + hname="PhiPtDCAR"; + hname += labels[iSide]; + fHists[iSide].PhiPtDCAR = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAR",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-1,1); + fHistList->Add(fHists[iSide].PhiPtDCAR); + + hname="PhiPtDCAZ"; + hname += labels[iSide]; + fHists[iSide].PhiPtDCAZ = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAZ",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-2,2); + fHistList->Add(fHists[iSide].PhiPtDCAZ); + + hname="PhiPtSigmaToVertex"; + hname += labels[iSide]; + fHists[iSide].PhiPtSigmaToVertex = new TH3F(hname,hname+";#phi;p_{T} (GeV);n#sigma to vtx",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5); + fHistList->Add(fHists[iSide].PhiPtSigmaToVertex); + } +} + +void AliAnaESDSpectraQA::Exec(Option_t *) { + // Main loop + // Called for each event + + if (!fESD) { + Printf("ERROR: fESD not available"); + return; + } + + const AliESDVertex *vtx = fESD->GetPrimaryVertex(); + + // Need vertex cut + if (vtx->GetNContributors() < 2) + return; + + printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()); + // Need to keep track of evts without vertex + + Int_t nTracks = fESD->GetNumberOfTracks(); + AliDebug(2,Form("nTracks %d", nTracks)); + printf("nTracks %d\n", nTracks); + static Int_t Mult = 0; + Mult = 0; // Need extra init bc of static + for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) { + AliESDtrack *track = fESD->GetTrack(iTrack); + hists *curTypeHists = 0; + + if (fTrackCuts->AcceptTrack(track)) { + Mult++; + + Float_t dca2D, dcaZ; + track->GetImpactParameters(dca2D,dcaZ); + fPtAll->Fill(track->Pt()); + + if (track->Eta() > 0) { // A side (crude for now) + if (track->Charge() > 0) + curTypeHists = &fHists[kPosA]; + else + curTypeHists = &fHists[kNegA]; + } + else { // C side + if (track->Charge() > 0) + curTypeHists = &fHists[kPosC]; + else + curTypeHists = &fHists[kNegC]; + } + + Float_t phi = track->Phi(); + Float_t pt = track->Pt(); + + UChar_t itsMap = track->GetITSClusterMap(); + Int_t nPointITS = 0; + for (Int_t i=0; i < 6; i++) { + if (itsMap & (1 << i)) + nPointITS ++; + } + + Float_t sigToVertex = fTrackCuts->GetSigmaToVertex(track); + Float_t chisqC = 1000; + if (track->GetConstrainedParam()) + chisqC = track->GetConstrainedChi2(); + + curTypeHists->PhiPtNPointTPC->Fill(phi,pt,track->GetTPCNcls()); + curTypeHists->PhiPtNPointITS->Fill(phi,pt,nPointITS); + curTypeHists->PhiPtChisqC->Fill(phi,pt,chisqC); + curTypeHists->PhiPtChisqTPC->Fill(phi,pt,track->GetTPCchi2()/(track->GetTPCNclsF()-5)); + curTypeHists->PhiPtDCAR->Fill(phi,pt,dca2D); + curTypeHists->PhiPtDCAZ->Fill(phi,pt,dcaZ); + curTypeHists->PhiPtSigmaToVertex->Fill(phi,pt,sigToVertex); + } + } + + // Post output data + PostData(0, fHistList); +} diff --git a/PWG4/JetTasks/AliAnaESDSpectraQA.h b/PWG4/JetTasks/AliAnaESDSpectraQA.h new file mode 100644 index 00000000000..61c0258ff89 --- /dev/null +++ b/PWG4/JetTasks/AliAnaESDSpectraQA.h @@ -0,0 +1,64 @@ +#ifndef __AliAnaESDSpectraQA_hh__ +#define __AliAnaESDSpectraQA_hh__ + +#include "AliAnalysisTask.h" + +class TH1F; +class TH2F; +class TH3F; +class TList; +class TDirectory; +class AliESDEvent; +class AliESDtrackCuts; + +class AliAnaESDSpectraQA: public AliAnalysisTask { + + public: + AliAnaESDSpectraQA(); + AliAnaESDSpectraQA(const char *name); + ~AliAnaESDSpectraQA() {;} + + virtual void ConnectInputData(Option_t *); + virtual void CreateOutputObjects(); + virtual void Exec(Option_t *option); + + + + private: + + void InitHistPointers(); + AliAnaESDSpectraQA(const AliAnaESDSpectraQA&); + AliAnaESDSpectraQA& operator=(const AliAnaESDSpectraQA&); + + + AliESDEvent *fESD; //! ESD object + AliESDtrackCuts *fTrackCuts; + + enum {kNegA,kPosA,kNegC,kPosC}; + struct hists { + TH3F *PhiPtNPointTPC; + TH3F *PhiPtNPointITS; + TH3F *PhiPtChisqC; + TH3F *PhiPtChisqTPC; + TH3F *PhiPtDCAR; + TH3F *PhiPtDCAZ; + TH3F *PhiPtSigmaToVertex; + }; + + hists fHists[4]; //! Internal pointers to hists, do not stream + + TH1F *fNEvent; + TH1F *fPtAll; + TH1F *fPtSel; + + static const Int_t fgkNPtBins; + static const Float_t fgkPtMin; + static const Float_t fgkPtMax; + static const Int_t fgkNPhiBins; + + TList *fHistList; + + ClassDef(AliAnaESDSpectraQA,1) + +}; +#endif diff --git a/PWG4/JetTasks/AliAnalysisHelperJetTasks.cxx b/PWG4/JetTasks/AliAnalysisHelperJetTasks.cxx new file mode 100644 index 00000000000..5a33e3d4a1f --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisHelperJetTasks.cxx @@ -0,0 +1,74 @@ + +#include "TROOT.h" +#include "TList.h" +#include "AliMCEvent.h" +#include "AliStack.h" +#include "AliGenEventHeader.h" +#include "AliGenCocktailEventHeader.h" +#include "AliGenPythiaEventHeader.h" +#include +#include +#include "AliAnalysisHelperJetTasks.h" + + +ClassImp(AliAnalysisHelperJetTasks) + + + + +AliGenPythiaEventHeader* AliAnalysisHelperJetTasks::GetPythiaEventHeader(AliMCEvent *mcEvent){ + + AliGenEventHeader* genHeader = mcEvent->GenEventHeader(); + AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast(genHeader); + if(!pythiaGenHeader){ + // cocktail ?? + AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast(genHeader); + + if (!genCocktailHeader) { + Printf("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__); + return 0; + } + TList* headerList = genCocktailHeader->GetHeaders(); + for (Int_t i=0; iGetEntries(); i++) { + pythiaGenHeader = dynamic_cast(headerList->At(i)); + if (pythiaGenHeader) + break; + } + if(!pythiaGenHeader){ + Printf("%s %d: PythiaHeader not found!",(char*)__FILE__,__LINE__); + return 0; + } + } + return pythiaGenHeader; + +} + + +void AliAnalysisHelperJetTasks::PrintStack(AliMCEvent *mcEvent,Int_t iFirst,Int_t iLast,Int_t iMaxPrint){ + + AliStack *stack = mcEvent->Stack(); + if(!stack){ + Printf("%s%d No Stack available",(char*)__FILE__,__LINE__); + return; + } + + static Int_t iCount = 0; + if(iCount>iMaxPrint)return; + Int_t nStack = stack->GetNtrack(); + if(iLast == 0)iLast = nStack; + else if(iLast > nStack)iLast = nStack; + + + Printf("####################################################################"); + for(Int_t np = iFirst;npParticle(np); + Printf("Nr.%d --- Status %d ---- Mother1 %d Mother2 %d Daughter1 %d Daughter2 %d ", + np,p->GetStatusCode(),p->GetMother(0),p->GetMother(1),p->GetDaughter(0),p->GetDaughter(1)); + Printf("Eta %3.3f Phi %3.3f ",p->Eta(),p->Phi()); + p->Print(); + Printf("---------------------------------------"); + } + iCount++; +} + + diff --git a/PWG4/JetTasks/AliAnalysisHelperJetTasks.h b/PWG4/JetTasks/AliAnalysisHelperJetTasks.h new file mode 100644 index 00000000000..b8a9361b8f1 --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisHelperJetTasks.h @@ -0,0 +1,25 @@ +#ifndef ALIANALYSISHELPERJETTASKS_H +#define ALIANALYSISHELPERJETTASKS_H + + +#include "TObject.h" +class AliMCEvent; +class AliGenPythiaEventHeader; + +// Helper Class that contains a lot of usefull static functions (i.e. for Flavor selection. + +class AliAnalysisHelperJetTasks : public TObject { + public: + AliAnalysisHelperJetTasks() : TObject() {;} + virtual ~AliAnalysisHelperJetTasks(){;} + + static AliGenPythiaEventHeader* GetPythiaEventHeader(AliMCEvent *mcEvent); + static void PrintStack(AliMCEvent *mcEvent,Int_t iFirst = 0,Int_t iLast = 0,Int_t iMaxPrint = 10); + + + private: + + ClassDef(AliAnalysisHelperJetTasks, 1) // +}; + +#endif // ALIANALYSISHELPERJETTASKS_H diff --git a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.cxx b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.cxx new file mode 100644 index 00000000000..75c432c8be1 --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.cxx @@ -0,0 +1,653 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TDatabasePDG.h" + +#include "AliAnalysisTaskJetSpectrum.h" +#include "AliAnalysisManager.h" +#include "AliJetFinder.h" +#include "AliJetHeader.h" +#include "AliJetReader.h" +#include "AliJetReaderHeader.h" +#include "AliUA1JetHeaderV1.h" +#include "AliJet.h" +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliAODHandler.h" +#include "AliAODTrack.h" +#include "AliAODJet.h" +#include "AliMCEventHandler.h" +#include "AliMCEvent.h" +#include "AliStack.h" +#include "AliGenPythiaEventHeader.h" +#include "AliJetKineReaderHeader.h" +#include "AliGenCocktailEventHeader.h" +#include "AliInputEventHandler.h" + +#include "AliAnalysisHelperJetTasks.h" + +ClassImp(AliAnalysisTaskJetSpectrum) + +AliAnalysisTaskJetSpectrum::AliAnalysisTaskJetSpectrum(): AliAnalysisTaskSE(), + fJetHeaderRec(0x0), + fJetHeaderGen(0x0), + fAOD(0x0), + fBranchRec("jets"), + fConfigRec("ConfigJets.C"), + fBranchGen(""), + fConfigGen(""), + fUseAODInput(kFALSE), + fUseExternalWeightOnly(kFALSE), + fLimitGenJetEta(kFALSE), + fAnalysisType(0), + fExternalWeight(1), + fh1PtHard(0x0), + fh1PtHard_NoW(0x0), + fh1PtHard_Trials(0x0), + fh1NGenJets(0x0), + fh1NRecJets(0x0), + fHistList(0x0) +{ + // Default constructor + for(int ij = 0;ij(InputEvent()); + if(!fAOD){ + Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput); + return; + } + // fethc the header + fJetHeaderRec = dynamic_cast(fInputHandler->GetTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data()))); + if(!fJetHeaderRec){ + Printf("%s:%d Jet Header not found in the Input",(char*)__FILE__,__LINE__); + } + } + else{ + // assume that the AOD is in the general output... + fAOD = AODEvent(); + if(!fAOD){ + Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); + return; + } + fJetHeaderRec = dynamic_cast(OutputTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data()))); + if(!fJetHeaderRec){ + Printf("%s:%d Jet Header not found in the Output",(char*)__FILE__,__LINE__); + } + else{ + if(fDebug>10)fJetHeaderRec->Dump(); + } + } + + + + if (fDebug > 1) printf("AnalysisTaskJetSpectrum::UserCreateOutputObjects() \n"); + + OpenFile(1); + if(!fHistList)fHistList = new TList(); + + Bool_t oldStatus = TH1::AddDirectoryStatus(); + TH1::AddDirectory(kFALSE); + + // + // Histogram + + const Int_t nBinPt = 100; + Double_t binLimitsPt[nBinPt+1]; + for(Int_t iPt = 0;iPt <= nBinPt;iPt++){ + if(iPt == 0){ + binLimitsPt[iPt] = 0.0; + } + else {// 1.0 + binLimitsPt[iPt] = binLimitsPt[iPt-1] + 2; + } + } + const Int_t nBinEta = 22; + Double_t binLimitsEta[nBinEta+1]; + for(Int_t iEta = 0;iEta<=nBinEta;iEta++){ + if(iEta==0){ + binLimitsEta[iEta] = -2.2; + } + else{ + binLimitsEta[iEta] = binLimitsEta[iEta-1] + 0.2; + } + } + + const Int_t nBinPhi = 90; + Double_t binLimitsPhi[nBinPhi+1]; + for(Int_t iPhi = 0;iPhi<=nBinPhi;iPhi++){ + if(iPhi==0){ + binLimitsPhi[iPhi] = 0; + } + else{ + binLimitsPhi[iPhi] = binLimitsPhi[iPhi-1] + 1/(Float_t)nBinPhi * TMath::Pi()*2; + } + } + + const Int_t nBinFrag = 25; + + + fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",nBinPt,binLimitsPt); + + fh1PtHard_NoW = new TH1F("fh1PtHard_NoW","PYTHIA Pt hard no weight;p_{T,hard}",nBinPt,binLimitsPt); + + fh1PtHard_Trials = new TH1F("fh1PtHard_Trials","PYTHIA Pt hard weight with trials;p_{T,hard}",nBinPt,binLimitsPt); + + fh1NGenJets = new TH1F("fh1NGenJets","N generated jets",20,-0.5,19.5); + + fh1NRecJets = new TH1F("fh1NRecJets","N reconstructed jets",20,-0.5,19.5); + + + for(int ij = 0;ij0){ + fHistList->Add(fh1PtHard); + fHistList->Add(fh1PtHard_NoW); + fHistList->Add(fh1PtHard_Trials); + fHistList->Add(fh1NGenJets); + fHistList->Add(fh1NRecJets); + for(int ij = 0;ijAdd(fh1E[ij]); + fHistList->Add(fh1PtRecIn[ij]); + fHistList->Add(fh1PtRecOut[ij]); + fHistList->Add(fh1PtGenIn[ij]); + fHistList->Add(fh1PtGenOut[ij]); + fHistList->Add(fh2PtFGen[ij]); + if(saveLevel>2){ + fHistList->Add(fh3RecEtaPhiPt[ij]); + fHistList->Add(fh3RecEtaPhiPt_NoGen[ij]); + fHistList->Add(fh3GenEtaPhiPt_NoFound[ij]); + fHistList->Add(fh3GenEtaPhiPt[ij]); + } + } + } + + // =========== Switch on Sumw2 for all histos =========== + for (Int_t i=0; iGetEntries(); ++i) { + TH1 *h1 = dynamic_cast(fHistList->At(i)); + if (h1){ + // Printf("%s ",h1->GetName()); + h1->Sumw2(); + } + } + + TH1::AddDirectory(oldStatus); + +} + +void AliAnalysisTaskJetSpectrum::Init() +{ + // + // Initialization + // + + Printf(">>> AnalysisTaskJetSpectrum::Init() debug level %d\n",fDebug); + if (fDebug > 1) printf("AnalysisTaskJetSpectrum::Init() \n"); + +} + +void AliAnalysisTaskJetSpectrum::UserExec(Option_t */*option*/) +{ + // + // Execute analysis for current event + // + + + + if (fDebug > 1)printf("Analysing event # %5d\n", (Int_t) fEntry); + + + AliAODHandler *aodH = dynamic_cast(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); + + if(!aodH){ + Printf("%s:%d no output aodHandler found Jet",(char*)__FILE__,__LINE__); + return; + } + + + // aodH->SelectEvent(kTRUE); + + // ========= These pointers need to be valid in any case ======= + + + /* + AliUA1JetHeaderV1 *jhRec = dynamic_cast(fJetFinderRec->GetHeader()); + if(!jhRec){ + Printf("%s:%d No Jet Header found",(char*)__FILE__,__LINE__); + return; + } + */ + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + TClonesArray *aodRecJets = dynamic_cast(fAOD->FindListObject(fBranchRec.Data())); + if(!aodRecJets){ + Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data()); + return; + } + + // ==== General variables needed + + + // We use statice array, not to fragment the memory + AliAODJet genJets[kMaxJets]; + Int_t nGenJets = 0; + AliAODJet recJets[kMaxJets]; + Int_t nRecJets = 0; + + Double_t eventW = 1; + Double_t ptHard = 0; + Double_t nTrials = 1; // Trials for MC trigger weigth for real data + + if(fUseExternalWeightOnly){ + eventW = fExternalWeight; + } + + + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + if((fAnalysisType&kAnaMC)==kAnaMC){ + // this is the part we only use when we have MC information + AliMCEvent* mcEvent = MCEvent(); + // AliStack *pStack = 0; + if(!mcEvent){ + Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__); + return; + } + AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); + if(!pythiaGenHeader){ + return; + } + + nTrials = pythiaGenHeader->Trials(); + ptHard = pythiaGenHeader->GetPtHard(); + + + if(fDebug>20)AliAnalysisHelperJetTasks::PrintStack(mcEvent); + + if(!fUseExternalWeightOnly){ + // case were we combine more than one p_T hard bin... + } + + // fetch the pythia generated jets only to be used here + Int_t nPythiaGenJets = pythiaGenHeader->NTriggerJets(); + AliAODJet pythiaGenJets[kMaxJets]; + Int_t iCount = 0; + for(int ip = 0;ip < nPythiaGenJets;++ip){ + if(iCount>=kMaxJets)continue; + Float_t p[4]; + pythiaGenHeader->TriggerJet(ip,p); + pythiaGenJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); + + if(fLimitGenJetEta){ + if(pythiaGenJets[iCount].Eta()>fJetHeaderRec->GetJetEtaMax()|| + pythiaGenJets[iCount].Eta()GetJetEtaMin())continue; + } + + + if(fBranchGen.Length()==0){ + // if we have MC particles and we do not read from the aod branch + // use the pythia jets + genJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); + } + iCount++; + } + if(fBranchGen.Length()==0)nGenJets = iCount; + + }// (fAnalysisType&kMC)==kMC) + + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + fh1PtHard->Fill(ptHard,eventW); + fh1PtHard_NoW->Fill(ptHard,1); + fh1PtHard_Trials->Fill(ptHard,nTrials); + + // If we set a second branch for the input jets fetch this + if(fBranchGen.Length()>0){ + TClonesArray *aodGenJets = dynamic_cast(fAOD->FindListObject(fBranchGen.Data())); + if(aodGenJets){ + Int_t iCount = 0; + for(int ig = 0;ig < aodGenJets->GetEntries();++ig){ + if(iCount>=kMaxJets)continue; + AliAODJet *tmp = dynamic_cast(aodGenJets->At(ig)); + if(!tmp)continue; + if(fLimitGenJetEta){ + if(tmp->Eta()>fJetHeaderRec->GetJetEtaMax()|| + tmp->Eta()GetJetEtaMin())continue; + } + genJets[iCount] = *tmp; + iCount++; + } + nGenJets = iCount; + } + else{ + Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGen.Data()); + } + } + + fh1NGenJets->Fill(nGenJets); + // We do not want to exceed the maximum jet number + nGenJets = TMath::Min(nGenJets,kMaxJets); + + // Fetch the reconstructed jets... + + + nRecJets = aodRecJets->GetEntries(); + fh1NRecJets->Fill(nRecJets); + nRecJets = TMath::Min(nRecJets,kMaxJets); + + for(int ir = 0;ir < nRecJets;++ir){ + AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); + if(!tmp)continue; + recJets[ir] = *tmp; + } + + + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + // Relate the jets + Int_t iGenIndex[kMaxJets]; // Index of the generated jet for i-th rec -1 if none + Int_t iRecIndex[kMaxJets]; // Index of the rec jet for i-th gen -1 if none + + for(int i = 0;i 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + + if(fDebug){ + for(int i = 0;i=0)Printf("iGenFound: %d -> %d",i,iGenIndex[i]); + if(iRecIndex[i]>=0)Printf("iRecFound: %d -> %d",i,iRecIndex[i]); + } + } + + // loop over reconstructed jets + for(int ir = 0;ir < nRecJets;++ir){ + Double_t ptRec = recJets[ir].Pt(); + Double_t phiRec = recJets[ir].Phi(); + if(phiRec<0)phiRec+=TMath::Pi()*2.; + Double_t etaRec = recJets[ir].Eta(); + + fh1E[ir]->Fill(recJets[ir].E(),eventW); + fh1PtRecIn[ir]->Fill(ptRec,eventW); + fh3RecEtaPhiPt[ir]->Fill(etaRec,phiRec,ptRec,eventW); + // Fill Correlation + Int_t ig = iGenIndex[ir]; + if(ig>=0&&igFill(ptRec,eventW); + Double_t ptGen = genJets[ig].Pt(); + fh2PtFGen[ir]->Fill(ptRec,ptGen,eventW); + fh3PtRecGenHard[ir]->Fill(ptRec,ptGen,ptHard,eventW); + fh3PtRecGenHard_NoW[ir]->Fill(ptRec,ptGen,ptHard,1); + } + else{ + fh3RecEtaPhiPt_NoGen[ir]->Fill(etaRec,phiRec,ptRec,eventW); + } + }// loop over reconstructed jets + + + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + for(int ig = 0;ig < nGenJets;++ig){ + Double_t ptGen = genJets[ig].Pt(); + // Fill Correlation + Double_t phiGen = genJets[ig].Phi(); + if(phiGen<0)phiGen+=TMath::Pi()*2.; + Double_t etaGen = genJets[ig].Eta(); + fh3GenEtaPhiPt[ig]->Fill(etaGen,phiGen,ptGen,eventW); + fh1PtGenIn[ig]->Fill(ptGen,eventW); + Int_t ir = iRecIndex[ig]; + if(ir>=0&&irFill(ptGen,eventW); + } + else{ + fh3GenEtaPhiPt_NoFound[ig]->Fill(etaGen,phiGen,ptGen,eventW); + } + }// loop over reconstructed jets + + if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); + PostData(1, fHistList); +} + +void AliAnalysisTaskJetSpectrum::Terminate(Option_t */*option*/) +{ +// Terminate analysis +// + if (fDebug > 1) printf("AnalysisJetSpectrum: Terminate() \n"); +} + + +void AliAnalysisTaskJetSpectrum::GetClosestJets(AliAODJet *genJets,Int_t &nGenJets, + AliAODJet *recJets,Int_t &nRecJets, + Int_t *iGenIndex,Int_t *iRecIndex,Int_t iDebug){ + + // + // Relate the two input jet Arrays + // + + // + // The association has to be unique + // So check in two directions + // find the closest rec to a gen + // and check if there is no other rec which is closer + // Caveat: Close low energy/split jets may disturb this correlation + + // Idea: search in two directions generated e.g (a--e) and rec (1--3) + // Fill a matrix with Flags (1 for closest rec jet, 2 for closest rec jet + // in the end we have something like this + // 1 2 3 + // ------------ + // a| 3 2 0 + // b| 0 1 0 + // c| 0 0 3 + // d| 0 0 1 + // e| 0 0 1 + // Topology + // 1 2 + // a b + // + // d c + // 3 e + // Only entries with "3" match from both sides + + const int kMode = 3; + + Int_t iFlag[kMaxJets][kMaxJets]; + + + + for(int i = 0;i < kMaxJets;++i){ + iRecIndex[i] = -1; + iGenIndex[i] = -1; + for(int j = 0;j < kMaxJets;++j)iFlag[i][j] = 0; + } + + if(nRecJets==0)return; + if(nGenJets==0)return; + + const Float_t maxDist = 1.0; + // find the closest distance to the generated + for(int ig = 0;ig1)Printf("Gen (%d) p_T %3.3f eta %3.3f ph %3.3f ",ig,genJets[ig].Pt(),genJets[ig].Eta(),genJets[ig].Phi()); + for(int ir = 0;ir1)Printf("Rec (%d) p_T %3.3f eta %3.3f ph %3.3f ",ir,recJets[ir].Pt(),recJets[ir].Eta(),recJets[ir].Phi()); + if(iDebug>1)Printf("Distance (%d)--(%d) %3.3f ",ig,ir,dR); + if(dR=0)iFlag[ig][iRecIndex[ig]]+=1; + // reset... + iRecIndex[ig] = -1; + } + // other way around + for(int ir = 0;ir=0)iFlag[iGenIndex[ir]][ir]+=2; + // reset... + iGenIndex[ir] = -1; + } + + // check for "true" correlations + + if(iDebug>1)Printf(">>>>>> Matrix"); + + for(int ig = 0;ig1)printf("XFL %d ",iFlag[ig][ir]); + + if(kMode==3){ + // we have a uniqie correlation + if(iFlag[ig][ir]==3){ + iGenIndex[ir] = ig; + iRecIndex[ig] = ir; + } + } + else{ + // we just take the correlation from on side + if((iFlag[ig][ir]&2)==2){ + iGenIndex[ir] = ig; + } + if((iFlag[ig][ir]&1)==1){ + iRecIndex[ig] = ir; + } + } + } + if(iDebug>1)printf("\n"); + } +} + + diff --git a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.h b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.h new file mode 100644 index 00000000000..a89345d3f23 --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum.h @@ -0,0 +1,110 @@ +#ifndef ALIANALYSISTASKJETSPECTRUM_H +#define ALIANALYSISTASKJETSPECTRUM_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliAnalysisTaskSE.h" +class AliJetHeader; +class AliESDEvent; +class AliAODEvent; +class AliAODJet; +class AliGenPythiaEventHeader; + +class TList; +class TChain; +class TH2F; +class TH3F; + +class AliAnalysisTaskJetSpectrum : public AliAnalysisTaskSE +{ + public: + AliAnalysisTaskJetSpectrum(); + AliAnalysisTaskJetSpectrum(const char* name); + virtual ~AliAnalysisTaskJetSpectrum() {;} + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() { Init(); } + virtual void UserExec(Option_t *option); + virtual void Terminate(Option_t *option); + + virtual void SetExternalWeight(Float_t f){fExternalWeight = f;} + virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;} + virtual void SetAODInput(Bool_t b){fUseAODInput = b;} + virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;} + virtual void SetAnalysisType(Int_t i){fAnalysisType = i;} + virtual void SetBranchGen(char* c){fBranchGen = c;} + virtual void SetBranchRec(char* c){fBranchRec = c;} + + // Helper + static void GetClosestJets(AliAODJet *genJets,Int_t &nGenJets, + AliAODJet *recJets,Int_t &nRecJets, + Int_t *iGenIndex,Int_t *iRecIndex,Int_t iDebug = 0); + + // + + enum {kAnaMC = 0x1}; + + private: + + AliAnalysisTaskJetSpectrum(const AliAnalysisTaskJetSpectrum&); + AliAnalysisTaskJetSpectrum& operator=(const AliAnalysisTaskJetSpectrum&); + + + enum {kMaxJets = 5}; + + AliJetHeader *fJetHeaderRec; + AliJetHeader *fJetHeaderGen; + AliAODEvent *fAOD; // where we take the jets from can be input or output AOD + + TString fBranchRec; // AOD branch name for reconstructed + TString fConfigRec; // Name of the Config file + TString fBranchGen; // AOD brnach for genereated + TString fConfigGen; // Name of the Config file (if any) + + Bool_t fUseAODInput; + Bool_t fUseExternalWeightOnly; + Bool_t fLimitGenJetEta; + Int_t fAnalysisType; + Float_t fExternalWeight; + + TH1F* fh1PtHard; // Pt har of the event... + TH1F* fh1PtHard_NoW; // Pt har of the event... + TH1F* fh1PtHard_Trials; // Number of trials + TH1F* fh1NGenJets; + TH1F* fh1NRecJets; + TH1F* fh1E[kMaxJets]; // Jet Energy + TH1F* fh1PtRecIn[kMaxJets]; // Jet pt for all + TH1F* fh1PtRecOut[kMaxJets]; // Jet pt with corellated generated jet + TH1F* fh1PtGenIn[kMaxJets]; // Detection efficiency for given p_T.gen + TH1F* fh1PtGenOut[kMaxJets]; // + + + + TH2F* fh2PtFGen[kMaxJets]; // + TH2F* fh2Frag[kMaxJets]; // fragmentation function + TH2F* fh2FragLn[kMaxJets]; // + + TH3F* fh3PtRecGenHard[kMaxJets]; // + TH3F* fh3PtRecGenHard_NoW[kMaxJets]; // + TH3F* fh3RecEtaPhiPt[kMaxJets]; // + TH3F* fh3RecEtaPhiPt_NoGen[kMaxJets]; // + TH3F* fh3GenEtaPhiPt_NoFound[kMaxJets]; // + TH3F* fh3GenEtaPhiPt[kMaxJets]; // + // ========= Multiplicity dependence ====== + + // ==========TODO , flavaor dependence ======== + // ============================================ + + + // ============= TODO , phi dependence ======== + // ============================================ + + TList *fHistList; // Output list + + + ClassDef(AliAnalysisTaskJetSpectrum, 1) // Analysis task for standard jet analysis +}; + +#endif diff --git a/PWG4/JetTasks/AliAnalysisTaskUE.cxx b/PWG4/JetTasks/AliAnalysisTaskUE.cxx new file mode 100644 index 00000000000..7ca9cc504e7 --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisTaskUE.cxx @@ -0,0 +1,725 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* $Id:$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliAnalysisTaskUE.h" +#include "AliAnalysisManager.h" +#include "AliMCEventHandler.h" +#include "AliAODEvent.h" +#include "AliAODInputHandler.h" +#include "AliAODHandler.h" +#include "AliStack.h" +#include "AliAODJet.h" +#include "AliAODTrack.h" + +#include "AliLog.h" + +// +// Analysis class for Underlying Event studies +// +// Look for correlations on the tranverse regions to +// the leading charged jet +// +// This class needs as input AOD with track and Jets +// the output is a list of histograms +// +// AOD can be either connected to the InputEventHandler +// for a chain of AOD files +// or +// to the OutputEventHandler +// for a chain of ESD files, so this case class should be +// in the train after the Jet finder +// +// Arian.Abrahantes.Quintana@cern.ch +// Ernesto.Lopez.Torres@cern.ch +// + + +ClassImp( AliAnalysisTaskUE) + +//////////////////////////////////////////////////////////////////////// + + +//____________________________________________________________________ +AliAnalysisTaskUE:: AliAnalysisTaskUE(const char* name): + AliAnalysisTask(name, ""), + fDebug(kFALSE), + fAOD(0x0), + fListOfHistos(0x0), + fBinsPtInHist(30), + fMinJetPtInHist(0.), + fMaxJetPtInHist(300.), + fAnaType(1), + fRegionType(1), + fConeRadius(0.7), + fOrdering(1), + fJet1EtaCut(0.2), + fJet2DeltaPhiCut(2.616), // 150 degrees + fJet2RatioPtCut(0.8), + fJet3PtCut(15.), + fTrackPtCut(0.), + fTrackEtaCut(0.9), + fhNJets(0x0), + fhEleadingPt(0x0), + fhMinRegPtDist(0x0), + fhRegionMultMin(0x0), + fhMinRegAvePt(0x0), + fhMinRegSumPt(0x0), + fhMinRegMaxPtPart(0x0), + fhMinRegSumPtvsMult(0x0), + fhdNdEta_PhiDist(0x0), + fhFullRegPartPtDistVsEt(0x0), + fhTransRegPartPtDistVsEt(0x0), + fhRegionSumPtMaxVsEt(0x0), + fhRegionMultMax(0x0), + fhRegionMultMaxVsEt(0x0), + fhRegionSumPtMinVsEt(0x0), //fhRegionMultMin(0x0), + fhRegionMultMinVsEt(0x0), + fhRegionAveSumPtVsEt(0x0), + fhRegionDiffSumPtVsEt(0x0), + fhRegionAvePartPtMaxVsEt(0x0), + fhRegionAvePartPtMinVsEt(0x0), + fhRegionMaxPartPtMaxVsEt(0x0)//, fhValidRegion(0x0) +{ + // Default constructor + // Define input and output slots here + // Input slot #0 works with a TChain + DefineInput(0, TChain::Class()); + // Output slot #0 writes into a TList container + DefineOutput(0, TList::Class()); +} + + +//____________________________________________________________________ +void AliAnalysisTaskUE::ConnectInputData(Option_t* /*option*/) +{ +// Connect the input data + +// We need AOD with tracks and jets. +// Since AOD can be either connected to the InputEventHandler or to the OutputEventHandler +// we need to check where it is and get the pointer to AODEvent in the right way + + if (fDebug > 1) AliInfo("ConnectInputData() \n"); + + + TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); + + if( handler && handler->InheritsFrom("AliAODInputHandler") ) { + fAOD = ((AliAODInputHandler*)handler)->GetEvent(); + } else { + handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler(); + if( handler && handler->InheritsFrom("AliAODHandler") ) { + fAOD = ((AliAODHandler*)handler)->GetAOD(); + } else { + AliFatal("I can't get any AOD Event Handler"); + } + } +} + +//____________________________________________________________________ +void AliAnalysisTaskUE::CreateOutputObjects() +{ +// Create the output container +// + if (fDebug > 1) AliInfo("CreateOutPutData()"); + // + // Histograms + CreateHistos(); + fListOfHistos->SetOwner(kTRUE); +// OpenFile(0); +} + + +//____________________________________________________________________ +void AliAnalysisTaskUE::Exec(Option_t */*option*/) +{ +// Execute analysis for current event +// + AnalyseUE(); + // Post the data + PostData(0, fListOfHistos); +} + + +//____________________________________________________________________ +void AliAnalysisTaskUE::Terminate(Option_t */*option*/) +{ +// Terminate analysis +// + + // Normalize histos to region area TODO: + Double_t areafactor = 1.; + if( fRegionType == 1 ) { + areafactor = 1./ (fTrackEtaCut *2. * TMath::Pi()*2.); + } else { + areafactor = 1./ ( fConeRadius * fConeRadius * TMath::Pi() ); + } + + // Draw some Test plot to the screen + if (!gROOT->IsBatch()) { + + // Update pointers reading them from the output slot + fListOfHistos = dynamic_cast (GetOutputData(0)); + if( !fListOfHistos ) { + AliError("Histogram List is not available"); + return; + } + fhEleadingPt = (TH1F*)fListOfHistos->At(1); + fhdNdEta_PhiDist = (TH1F*)fListOfHistos->At(8); + fhRegionSumPtMaxVsEt = (TH1F*)fListOfHistos->At(11); + fhRegionSumPtMinVsEt = (TH1F*)fListOfHistos->At(12); + fhRegionMultMaxVsEt = (TH1F*)fListOfHistos->At(14); + fhRegionMultMinVsEt = (TH1F*)fListOfHistos->At(15); + fhRegionAveSumPtVsEt = (TH1F*)fListOfHistos->At(16); + + fhNJets = (TH1F*)fListOfHistos->At(0); + + // Canvas + TCanvas* c1 = new TCanvas("c1",Form("sumPt dist (%s)", GetTitle()),60,60,1200,800); + c1->Divide(2,2); + c1->cd(1); + TH1F *h1r = new TH1F("hRegionEtvsSumPtMax" , "", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + h1r->Divide(fhRegionSumPtMaxVsEt,fhEleadingPt,1,1); + h1r->Scale( areafactor ); + h1r->SetMarkerStyle(20); + h1r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); + h1r->SetYTitle("P_{T}^{90, max}"); + h1r->DrawCopy("p"); + + c1->cd(2); + + TH1F *h2r = new TH1F("hRegionEtvsSumPtMin" , "", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + h2r->Divide(fhRegionSumPtMinVsEt,fhEleadingPt,1,1); + h2r->Scale( areafactor ); + h2r->SetMarkerStyle(20); + h2r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); + h2r->SetYTitle("P_{T}^{90, min}"); + h2r->DrawCopy("p"); + + c1->cd(3); + TH1F *h4r = new TH1F("hRegionEtvsDiffPt" , "", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + h4r->Divide(fhRegionAveSumPtVsEt,fhEleadingPt,1,1); + h4r->Scale(2.); // make average + h4r->Scale( areafactor ); + h4r->SetYTitle("#DeltaP_{T}^{90}"); + h4r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); + h4r->SetMarkerStyle(20); + h4r->DrawCopy("p"); + + c1->cd(4); + TH1F *h5r = new TH1F("hRegionMultMaxVsEtleading", "", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + TH1F *h6r = new TH1F("hRegionMultMinVsEtleading", "", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + + h5r->Divide(fhRegionMultMaxVsEt,fhEleadingPt,1,1); + h6r->Divide(fhRegionMultMinVsEt,fhEleadingPt,1,1); + h5r->Scale( areafactor ); + h6r->Scale( areafactor ); + h5r->SetYTitle("N_{Tracks}^{90}"); + h5r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); + h5r->SetMarkerStyle(20); + h5r->DrawCopy("p"); + h6r->SetMarkerStyle(21); + h6r->SetMarkerColor(2); + h6r->SetYTitle("N_{Tracks}^{90}"); + h6r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); + h6r->DrawCopy("p same"); + c1->Update(); + + TCanvas* c2 = new TCanvas("c2","Jet Pt dist",160,160,1200,800); + c2->Divide(2,2); + c2->cd(1); + fhEleadingPt->SetMarkerStyle(20); + fhEleadingPt->SetMarkerColor(2); + fhEleadingPt->DrawCopy("p"); + gPad->SetLogy(); + + c2->cd(2); + fhdNdEta_PhiDist->SetMarkerStyle(20); + fhdNdEta_PhiDist->SetMarkerColor(2); + fhdNdEta_PhiDist->DrawCopy("p"); + gPad->SetLogy(); + + c2->cd(3); + fhNJets->DrawCopy(); + + //fhTransRegPartPtDist = (TH1F*)fListOfHistos->At(2); + fhRegionMultMin = (TH1F*)fListOfHistos->At(3); + fhMinRegAvePt = (TH1F*)fListOfHistos->At(4); + fhMinRegSumPt = (TH1F*)fListOfHistos->At(5); + //fhMinRegMaxPtPart = (TH1F*)fListOfHistos->At(6); + fhMinRegSumPtvsMult = (TH1F*)fListOfHistos->At(7); + + // Canvas + TCanvas* c3 = new TCanvas("c3"," p_{T} dist",160,160,1200,800); + c3->Divide(2,2); + c3->cd(1); + /*fhTransRegPartPtDist->SetMarkerStyle(20); + fhTransRegPartPtDist->SetMarkerColor(2); + fhTransRegPartPtDist->Scale(areafactor/fhTransRegPartPtDist->GetEntries()); + fhTransRegPartPtDist->DrawCopy("p"); + gPad->SetLogy(); + */ + c3->cd(2); + fhMinRegSumPt->SetMarkerStyle(20); + fhMinRegSumPt->SetMarkerColor(2); + fhMinRegSumPt->Scale(areafactor); + fhMinRegSumPt->DrawCopy("p"); + gPad->SetLogy(); + + c3->cd(3); + fhMinRegAvePt->SetMarkerStyle(20); + fhMinRegAvePt->SetMarkerColor(2); + fhMinRegAvePt->Scale(areafactor); + fhMinRegAvePt->DrawCopy("p"); + gPad->SetLogy(); + + c3->cd(4); + + TH1F *h7r = new TH1F("hRegionMultMinVsMult", "", 21, -0.5, 20.5); + + h7r->Divide(fhMinRegSumPtvsMult,fhRegionMultMin,1,1); + + h7r->SetMarkerStyle(20); + h7r->SetMarkerColor(2); + h7r->DrawCopy("p"); + + c3->Update(); + + +/* c2->cd(3); + fhValidRegion->SetMarkerStyle(20); + fhValidRegion->SetMarkerColor(2); + fhValidRegion->DrawCopy("p"); +*/ + c2->Update(); + } else { + AliInfo(" Batch mode, not histograms will shown..."); + } + + if( fDebug > 1 ) + AliInfo("End analysis"); + +} + + +//____________________________________________________________________ +void AliAnalysisTaskUE::AnalyseUE() +{ + // + // Look for correlations on the tranverse regions to + // the leading charged jet + // + // ------------------------------------------------ + // Find Leading Jets 1,2,3 + // (could be skipped if Jets are sort by Pt...) + Double_t maxPtJet1 = 0.; + Int_t index1 = -1; + Double_t maxPtJet2 = 0.; // jet 2 need for back to back inclusive + Int_t index2 = -1; + Double_t maxPtJet3 = 0.; // jet 3 need for back to back exclusive + Int_t index3 = -1; + Int_t nJets = fAOD->GetNJets(); + for( Int_t i=0; iGetJet(i); + if( jet->Pt() > maxPtJet1 ) { + maxPtJet3 = maxPtJet2; index3 = index2; + maxPtJet2 = maxPtJet1; index2 = index1; + maxPtJet1 = jet->Pt(); index1 = i; + } else if( jet->Pt() > maxPtJet2 ) { + maxPtJet3 = maxPtJet2; index3 = index2; + maxPtJet2 = jet->Pt(); index2 = i; + } else if( jet->Pt() > maxPtJet3 ) { + maxPtJet3 = jet->Pt(); index3 = i; + } + } + + if( index1 < 0 ) { + AliInfo("\nSkipping Event, not jet found..."); + return; + } else + AliInfo(Form("\nPt Leading Jet = %6.1f eta=%5.1f ", maxPtJet1, fAOD->GetJet(index1)->Eta() )); + + fhNJets->Fill(nJets); + + TVector3 jetVect[2]; + + // ---------------------------------------------- + // Cut events by jets topology + // fAnaType: + // 1 = inclusive, + // - Jet1 |eta| < fJet1EtaCut + // 2 = back to back inclusive + // - fulfill case 1 + // - |Jet1.Phi - Jet2.Phi| > fJet2DeltaPhiCut + // - Jet2.Pt/Jet1Pt > fJet2RatioPtCut + // 3 = back to back exclusive + // - fulfill case 2 + // - Jet3.Pt < fJet3PtCut + + Bool_t isInclusive = kFALSE; + + if( TMath::Abs(fAOD->GetJet(index1)->Eta()) > fJet1EtaCut) { + if( fDebug > 1 ) AliInfo("Skipping Event...Jet1 |eta| > fJet1EtaCut"); + return; + } + isInclusive = kTRUE; + jetVect[0].SetXYZ(fAOD->GetJet(index1)->Px(), + fAOD->GetJet(index1)->Py(), + fAOD->GetJet(index1)->Pz()); + // back to back inclusive + Bool_t isB2Binclusive = kFALSE; + if( fAnaType > 1 && index2 > 0 && isInclusive) { + jetVect[1].SetXYZ(fAOD->GetJet(index2)->Px(), + fAOD->GetJet(index2)->Py(), + fAOD->GetJet(index2)->Pz()); + if( TMath::Abs(jetVect[0].DeltaPhi(jetVect[1])) < fJet2DeltaPhiCut || + maxPtJet2/maxPtJet1 < fJet2RatioPtCut ) { + if( fDebug > 1 ) AliInfo("Skipping Event... |Jet1.Phi - Jet2.Phi| < fJet2DeltaPhiCut"); + return; + } + isB2Binclusive = kTRUE; + } + if (isInclusive && !isB2Binclusive && fAnaType>1) return; + // back to back exclusive + Bool_t isB2Bexclusive = kFALSE; + if( fAnaType > 2 && index3 > 0 && isB2Binclusive) { + if( fAOD->GetJet(index3)->Pt() > fJet3PtCut ) { + if( fDebug > 1 ) AliInfo("Skipping Event... Jet3.Pt > fJet3PtCut "); + return; + } + isB2Bexclusive = kTRUE; + } + if (isB2Binclusive && !isB2Bexclusive && fAnaType>2) return; + + AliInfo(Form("njets = %d",nJets)); + fhEleadingPt->Fill( maxPtJet1 ); + + // ---------------------------------------------- + // Find max and min regions + Double_t sumPtRegionPosit = 0.; + Double_t sumPtRegionNegat = 0.; + Double_t maxPartPtRegion = 0.; + Int_t nTrackRegionPosit = 0; + Int_t nTrackRegionNegat = 0; + static const Double_t k270rad = 270.*TMath::Pi()/180.; + + Int_t nTracks = fAOD->GetNTracks(); + for (Int_t ipart=0; ipartGetTrack( ipart ); + + if ( !part->Charge() ) continue; + if ( part->Pt() < fTrackPtCut ) continue; + + TVector3 partVect(part->Px(), part->Py(), part->Pz()); + + Double_t deltaPhi = jetVect[0].DeltaPhi(partVect)+k270rad; + if( deltaPhi > 2.*TMath::Pi() ) deltaPhi-= 2.*TMath::Pi(); + fhdNdEta_PhiDist->Fill( deltaPhi ); + fhFullRegPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 ); + + Int_t region = IsTrackInsideRegion( jetVect, &partVect ); + + if (region > 0) { + if( maxPartPtRegion < part->Pt() ) maxPartPtRegion = part->Pt(); + sumPtRegionPosit += part->Pt(); + nTrackRegionPosit++; + fhTransRegPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 ); + } + if (region < 0) { + if( maxPartPtRegion < part->Pt() ) maxPartPtRegion = part->Pt(); + sumPtRegionNegat += part->Pt(); + nTrackRegionNegat++; + fhTransRegPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 ); + } + } + + //How quantities will be sorted before Fill Min and Max Histogram + // 1=Plots will be CDF-like + // 2=Plots will be Marchesini-like + if (fOrdering==1){ + if (sumPtRegionPosit > sumPtRegionNegat) { + FillSumPtRegion( maxPtJet1, sumPtRegionPosit, sumPtRegionNegat ); + } else { + FillSumPtRegion( maxPtJet1, sumPtRegionNegat, sumPtRegionPosit ); + } + if (nTrackRegionPosit > nTrackRegionNegat ) { + FillMultRegion( maxPtJet1, nTrackRegionPosit, nTrackRegionNegat, sumPtRegionNegat ); + } else { + FillMultRegion( maxPtJet1, nTrackRegionNegat, nTrackRegionPosit, sumPtRegionPosit ); + } + } else if (fOrdering==2) { + if (sumPtRegionPosit > sumPtRegionNegat) { + FillSumPtRegion( maxPtJet1, sumPtRegionPosit, sumPtRegionNegat ); + FillMultRegion( maxPtJet1, nTrackRegionPosit, nTrackRegionNegat, sumPtRegionNegat ); + } else { + FillSumPtRegion( maxPtJet1, sumPtRegionNegat, sumPtRegionPosit ); + FillMultRegion( maxPtJet1, nTrackRegionNegat, nTrackRegionPosit, sumPtRegionPosit ); + } + } + + Double_t avePosRegion = (nTrackRegionPosit) ? sumPtRegionPosit/nTrackRegionPosit : 0.; + Double_t aveNegRegion = (nTrackRegionNegat) ? sumPtRegionNegat/nTrackRegionNegat : 0.; + if (avePosRegion > aveNegRegion) { + FillAvePartPtRegion( maxPtJet1, avePosRegion, aveNegRegion ); + } else { + FillAvePartPtRegion( maxPtJet1, aveNegRegion, avePosRegion ); + } + + fhRegionMaxPartPtMaxVsEt->Fill(maxPtJet1, maxPartPtRegion ); + + // Compute pedestal like magnitude + fhRegionDiffSumPtVsEt->Fill(maxPtJet1, TMath::Abs(sumPtRegionPosit-sumPtRegionNegat)/2.0); + fhRegionAveSumPtVsEt->Fill(maxPtJet1, (sumPtRegionPosit+sumPtRegionNegat)/2.0); + +} + + +//____________________________________________________________________ +void AliAnalysisTaskUE::FillSumPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ) +{ + // Fill sumPt of control regions + + // Max cone + fhRegionSumPtMaxVsEt->Fill( leadingE, ptMax ); + // Min cone + fhRegionSumPtMinVsEt->Fill( leadingE, ptMin ); + // MAke distributions for UE comparison with MB data + fhMinRegSumPt->Fill(ptMin); +} + +//____________________________________________________________________ +void AliAnalysisTaskUE::FillAvePartPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ) +{ + // Fill average particle Pt of control regions + + // Max cone + fhRegionAvePartPtMaxVsEt->Fill( leadingE, ptMax ); + // Min cone + fhRegionAvePartPtMinVsEt->Fill( leadingE, ptMin ); + // MAke distributions for UE comparison with MB data + fhMinRegAvePt->Fill(ptMin); +} + +//____________________________________________________________________ +void AliAnalysisTaskUE::FillMultRegion( Double_t leadingE, Double_t nTrackPtmax, Double_t nTrackPtmin, Double_t ptMin ) +{ + // Fill Nch multiplicity of control regions + + // Max cone + fhRegionMultMaxVsEt->Fill( leadingE, nTrackPtmax ); + fhRegionMultMax->Fill( nTrackPtmax ); + // Min cone + fhRegionMultMinVsEt->Fill( leadingE, nTrackPtmin ); + fhRegionMultMin->Fill( nTrackPtmin ); + // MAke distributions for UE comparison with MB data + fhMinRegSumPtvsMult->Fill(nTrackPtmin,ptMin); + +} + +//____________________________________________________________________ +Int_t AliAnalysisTaskUE::IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVect) +{ + // return de region in delta phi + // -1 negative delta phi + // 1 positive delta phi + // 0 outside region + static const Double_t k60rad = 60.*TMath::Pi()/180.; + static const Double_t k120rad = 120.*TMath::Pi()/180.; + + Int_t region = 0; + if( fRegionType == 1 ) { + if( TMath::Abs(partVect->Eta()) > fTrackEtaCut ) return 0; + // transverse regions + if (jetVect[0].DeltaPhi(*partVect) < -k60rad && jetVect[0].DeltaPhi(*partVect) > -k120rad ) region = -1; + if (jetVect[0].DeltaPhi(*partVect) > k60rad && jetVect[0].DeltaPhi(*partVect) < k120rad ) region = 1; + + } else if( fRegionType == 2 ) { + // Cone regions + Double_t deltaR = 0.; + + TVector3 positVect,negatVect; + positVect.SetMagThetaPhi(1, 2.*atan(exp(-jetVect[0].Eta())), jetVect[0].Phi()+TMath::PiOver2()); + negatVect.SetMagThetaPhi(1, 2.*atan(exp(-jetVect[0].Eta())), jetVect[0].Phi()-TMath::PiOver2()); + + if (TMath::Abs(positVect.DeltaPhi(*partVect)) < fConeRadius ) { + region = 1; + deltaR = positVect.DrEtaPhi(*partVect); + } else if (TMath::Abs(negatVect.DeltaPhi(*partVect)) < fConeRadius) { + region = -1; + deltaR = negatVect.DrEtaPhi(*partVect); + } + + if (deltaR > fConeRadius) region = 0; + + } else + AliError("Unknow region type"); + + // For debug (to be removed) + //if( region != 0 ) fhValidRegion->Fill( partVect->Eta()-jetVect[0].Eta(), jetVect[0].DeltaPhi(*partVect) ); + + return region; +} + +//____________________________________________________________________ +void AliAnalysisTaskUE::CreateHistos() +{ + fListOfHistos = new TList(); + + + fhNJets = new TH1F("fhNJets", "n Jet", 10, 0, 10); + fhNJets->SetXTitle("# of jets"); + fhNJets->Sumw2(); + fhNJets->Sumw2(); + fListOfHistos->Add( fhNJets ); // At(0) + + fhEleadingPt = new TH1F("hEleadingPt", "Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhEleadingPt->SetXTitle("P_{T} (GeV/c)"); + fhEleadingPt->SetYTitle("dN/dP_{T}"); + fhEleadingPt->Sumw2(); + fListOfHistos->Add( fhEleadingPt ); // At(1) + + fhMinRegPtDist = new TH1F("hMinRegPtDist", "P_{T} distribution in Min zone", 50,0.,20.); + fhMinRegPtDist->SetXTitle("P_{T} (GeV/c)"); + fhMinRegPtDist->SetYTitle("dN/dP_{T}"); + fhMinRegPtDist->Sumw2(); + fListOfHistos->Add( fhMinRegPtDist ); // At(2) + + fhRegionMultMin = new TH1F("hRegionMultMin", "N_{ch}^{90, min}", 21, -0.5, 20.5); + fhRegionMultMin->SetXTitle("N_{ch tracks}"); + fhRegionMultMin->Sumw2(); + fListOfHistos->Add( fhRegionMultMin ); // At(3) + + fhMinRegAvePt = new TH1F("hMinRegAvePt", "#LTp_{T}#GT", 50, 0., 20.); + fhMinRegAvePt->SetXTitle("P_{T} (GeV/c)"); + fhMinRegAvePt->Sumw2(); + fListOfHistos->Add( fhMinRegAvePt ); // At(4) + + fhMinRegSumPt = new TH1F("hMinRegSumPt", "#Sigma p_{T} ", 50, 0., 20.); + fhMinRegSumPt->SetYTitle("Ed^{3}N_{tracks}/dp^{3} (c^{3}/GeV^{2})"); + fhMinRegSumPt->SetXTitle("#Sigma p_{T} (GeV/c)"); + fhMinRegSumPt->Sumw2(); + fListOfHistos->Add( fhMinRegSumPt ); // At(5) + + fhMinRegMaxPtPart = new TH1F("hMinRegMaxPtPart", "max(p_{T})|_{event} ", 50, 0., 20.); + fhMinRegMaxPtPart->SetYTitle("Ed^{3}N_{tracks}/dp^{3} (c^{3}/GeV^{2})"); + fhMinRegMaxPtPart->SetXTitle("p_{T} (GeV/c)"); + fhMinRegMaxPtPart->Sumw2(); + fListOfHistos->Add( fhMinRegMaxPtPart ); // At(6) + + fhMinRegSumPtvsMult = new TH1F("hMinRegSumPtvsMult", "#Sigma p_{T} vs. Multiplicity ", 21, -0.5, 20.5); + fhMinRegSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhMinRegSumPtvsMult->SetXTitle("N_{charge}"); + fhMinRegSumPtvsMult->Sumw2(); + fListOfHistos->Add( fhMinRegSumPtvsMult ); // At(7); + + fhdNdEta_PhiDist = new TH1F("hdNdEta_PhiDist", "Charge particle density |#eta|< 1 vs #Delta#phi", 120, 0., 2.*TMath::Pi()); + fhdNdEta_PhiDist->SetXTitle("#Delta#phi"); + fhdNdEta_PhiDist->SetYTitle("dN_{ch}/d#etad#phi"); + fhdNdEta_PhiDist->Sumw2(); + fListOfHistos->Add( fhdNdEta_PhiDist ); // At(8) + + // Can be use to get part pt distribution for differente Jet Pt bins + fhFullRegPartPtDistVsEt = new TH2F("hFullRegPartPtDistVsEt", "dN/dP_{T} |#eta|<1 vs Leading Jet P_{T}", + 50,0.,50., fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhFullRegPartPtDistVsEt->SetYTitle("Leading Jet P_{T}"); + fhFullRegPartPtDistVsEt->SetXTitle("p_{T}"); + fhFullRegPartPtDistVsEt->Sumw2(); + fListOfHistos->Add( fhFullRegPartPtDistVsEt ); // At(9) + + // Can be use to get part pt distribution for differente Jet Pt bins + fhTransRegPartPtDistVsEt = new TH2F("hTransRegPartPtDistVsEt", "dN/dP_{T} in tranvese regions |#eta|<1 vs Leading Jet P_{T}", + 50,0.,50., fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhTransRegPartPtDistVsEt->SetYTitle("Leading Jet P_{T}"); + fhTransRegPartPtDistVsEt->SetXTitle("p_{T}"); + fhTransRegPartPtDistVsEt->Sumw2(); + fListOfHistos->Add( fhTransRegPartPtDistVsEt ); // At(10) + + + fhRegionSumPtMaxVsEt = new TH1F("hRegionSumPtMaxVsEt", "P_{T}^{90, max} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionSumPtMaxVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionSumPtMaxVsEt->Sumw2(); + fListOfHistos->Add( fhRegionSumPtMaxVsEt ); // At(11) + + fhRegionSumPtMinVsEt = new TH1F("hRegionSumPtMinVsEt", "P_{T}^{90, min} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionSumPtMinVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionSumPtMinVsEt->Sumw2(); + fListOfHistos->Add( fhRegionSumPtMinVsEt ); // At(12) + + fhRegionMultMax = new TH1I("hRegionMultMax", "N_{ch}^{90, max}", 21, -0.5, 20.5); + fhRegionMultMax->SetXTitle("N_{ch tracks}"); + fhRegionMultMax->Sumw2(); + fListOfHistos->Add( fhRegionMultMax ); // At(13) + + fhRegionMultMaxVsEt = new TH1F("hRegionMultMaxVsEt", "N_{ch}^{90, max} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionMultMaxVsEt->SetXTitle("E (GeV hRegionAveSumPtVsEt/c)"); + fhRegionMultMaxVsEt->Sumw2(); + fListOfHistos->Add( fhRegionMultMaxVsEt ); // At(14) + + fhRegionMultMinVsEt = new TH1F("hRegionMultMinVsEt", "N_{ch}^{90, min} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionMultMinVsEt->SetXTitle("E (GeV/c)"); + fhRegionMultMinVsEt->Sumw2(); + fListOfHistos->Add( fhRegionMultMinVsEt ); // At(15) + + fhRegionAveSumPtVsEt = new TH1F("hRegionAveSumPtVsEt", "(P_{T}^{90, max} + P_{T}^{90, min})/2 vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionAveSumPtVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionAveSumPtVsEt->Sumw2(); + fListOfHistos->Add( fhRegionAveSumPtVsEt ); // At(16) + + fhRegionDiffSumPtVsEt= new TH1F("hRegionPtDiffVsEt", "(P_{T}^{90, max} - P_{T}^{90, min}) vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionDiffSumPtVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionDiffSumPtVsEt->Sumw2(); + fListOfHistos->Add( fhRegionDiffSumPtVsEt ); // At(17) + + fhRegionAvePartPtMaxVsEt = new TH1F("hRegionAvePartPtMaxVsEt", "#LTp_{T}#GT^{90, max} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionAvePartPtMaxVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionAvePartPtMaxVsEt->Sumw2(); + fListOfHistos->Add( fhRegionAvePartPtMaxVsEt ); // At(18) + + fhRegionAvePartPtMinVsEt = new TH1F("hRegionAvePartPtMinVsEt", "#LTp_{T}#GT^{90, min} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionAvePartPtMinVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionAvePartPtMinVsEt->Sumw2(); + fListOfHistos->Add( fhRegionAvePartPtMinVsEt ); // At(19) + + fhRegionMaxPartPtMaxVsEt = new TH1F("hRegionMaxPartPtMaxVsEt", "max(p_{T})^{90} vs Leading Jet P_{T}", fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); + fhRegionMaxPartPtMaxVsEt->SetXTitle("P_{T} (GeV/c)"); + fhRegionMaxPartPtMaxVsEt->Sumw2(); + fListOfHistos->Add( fhRegionMaxPartPtMaxVsEt ); // At(20) + +/* + // For debug region selection + fhValidRegion = new TH2F("hValidRegion", "dN/d#eta/d#phi", + 20, -2.,2., 62, -TMath::Pi(), TMath::Pi()); + fhValidRegion->SetYTitle("#Delta#phi"); + fhValidRegion->Sumw2(); + fListOfHistos->Add( fhValidRegion ); // At(15) +*/ +} + + + diff --git a/PWG4/JetTasks/AliAnalysisTaskUE.h b/PWG4/JetTasks/AliAnalysisTaskUE.h new file mode 100644 index 00000000000..0e3ad6274c3 --- /dev/null +++ b/PWG4/JetTasks/AliAnalysisTaskUE.h @@ -0,0 +1,138 @@ +#ifndef ALIANALYSISTASKUE_H +#define ALIANALYSISTASKUE_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliAnalysisTaskSE.h" + +class AliESDEvent; +class AliAODEvent; +class TH1F; +class TH2F; +class TH1I; +class TVector3; + +class AliAnalysisTaskUE : public AliAnalysisTask +{ + public: + AliAnalysisTaskUE(const char* name="AliAnalysisTaskUE"); + virtual ~AliAnalysisTaskUE() {;} + + // Implementation of interface methods + virtual void ConnectInputData(Option_t *); + virtual void CreateOutputObjects(); + virtual void Exec(Option_t *option); + virtual void Terminate(Option_t *); + + // Setters + virtual void SetDebugLevel(Int_t level) { fDebug = level; } + void SetPtRangeInHist(Int_t bin, Double_t min, Double_t max) { + fBinsPtInHist = bin; + fMinJetPtInHist = min; + fMaxJetPtInHist = max; + } + + void SetAnaTopology(Int_t val) { fAnaType = val; } + void SetRegionType(Int_t val) { fRegionType = val; } + void SetConeRadius(Double_t val) { fConeRadius = val; } + void SetPtSumOrdering(Int_t val) { fOrdering = val; } + // Jet cuts + void SetJet1EtaCut(Double_t val) { fJet1EtaCut = val; } + void SetJet2DeltaPhiCut(Double_t val) { fJet2DeltaPhiCut = val; } + void SetJet2RatioPtCut(Double_t val) { fJet2RatioPtCut = val; } + void SetJet3PtCut(Double_t val) { fJet3PtCut = val; } + // track cuts + void SetTrackPtCut(Double_t val) { fTrackPtCut = val; } + void SetTrackEtaCut(Double_t val) { fTrackEtaCut = val; } + +private: + AliAnalysisTaskUE(const AliAnalysisTaskUE &det); +AliAnalysisTaskUE& operator=(const AliAnalysisTaskUE &det); + + void AnalyseUE(); + Int_t IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVect); + void CreateHistos(); + void FillSumPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); + void FillAvePartPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); + void FillMultRegion( Double_t leadingE, Double_t nTrackPtmax, Double_t nTrackPtmin, Double_t ptMin ); + + + Int_t fDebug; // Debug flag + AliAODEvent* fAOD; //! AOD Event + TList* fListOfHistos; // Output list of histograms + + // Config + Int_t fBinsPtInHist; // # bins for Pt histos range + Double_t fMinJetPtInHist; // min Jet Pt value for histo range + Double_t fMaxJetPtInHist; // max Jet Pt value for histo range + + // Cuts + Int_t fAnaType; // Analysis type on jet topology: + // 1=inclusive (default) + // 2=back to back inclusive + // 3=back to back exclusive + // 4=gama jet (back to back) ??? + // Minimum bias + // 31 = Semi jet (charged leading particle jets) + // 32 = Random jetcone ? + // 33 = Swiss chees ? + + Int_t fRegionType; // 1 = transverse regions (default) + // 2 = cone regions + + Double_t fConeRadius; // if selected Cone-like region type set Radius (=0.7 default) + + Int_t fOrdering; // Pt and multiplicity summation ordering: + // 1=CDF-like -independent sorting according quantity to be scored: Double sorting- (default) + // if Pt summation will be scored take Pt minimum between both zones and + // fill Pt Max. and Min. histog. accordingly + // if Multiplicity summation will be scored take Mult. minimum between both zones and + // fill Mult Max and Min histog. accordingly + // 2=Marchesini-like (Only Pt sorting: Single sorting) + // sort only according Pt summation scored, find minimum between both zones and + // fill Pt and Multiplicity Max and Min summation histog. following only this criterium + // 3=User Selection sorting (NOTE: USER must implement it within cxx) + + // Jet cuts + Double_t fJet1EtaCut; // |jet1 eta| < fJet1EtaCut (fAnaType = 1,2,3) + Double_t fJet2DeltaPhiCut; // |Jet1.Phi - Jet2.Phi| < fJet2DeltaPhiCut (fAnaType = 2,3) + Double_t fJet2RatioPtCut; // Jet2.Pt/Jet1Pt > fJet2RatioPtCut (fAnaType = 2,3) + Double_t fJet3PtCut; // Jet3.Pt < fJet3PtCut (fAnaType = 3) + // track cuts + Double_t fTrackPtCut; // Pt cut of tracks in the regions + Double_t fTrackEtaCut; // Eta cut on tracks in the regions (fRegionType=1) + + // Histograms ( are owner by fListOfHistos TList ) + TH1F* fhNJets; //! + TH1F* fhEleadingPt; //! + + TH1F* fhMinRegPtDist; + TH1F* fhRegionMultMin; + TH1F* fhMinRegAvePt; + TH1F* fhMinRegSumPt; + TH1F* fhMinRegMaxPtPart; + TH1F* fhMinRegSumPtvsMult; + + TH1F* fhdNdEta_PhiDist; //! + TH2F* fhFullRegPartPtDistVsEt; //! + TH2F* fhTransRegPartPtDistVsEt; //! + + TH1F* fhRegionSumPtMaxVsEt; //! + TH1I* fhRegionMultMax; //! + TH1F* fhRegionMultMaxVsEt; //! + TH1F* fhRegionSumPtMinVsEt; //! + TH1F* fhRegionMultMinVsEt; //! + TH1F* fhRegionAveSumPtVsEt; //! + TH1F* fhRegionDiffSumPtVsEt; //! + + TH1F* fhRegionAvePartPtMaxVsEt; //! + TH1F* fhRegionAvePartPtMinVsEt; //! + TH1F* fhRegionMaxPartPtMaxVsEt; //! + + // TH2F* fhValidRegion; //! test to be canceled + + ClassDef( AliAnalysisTaskUE, 1) // Analysis task for Underlying Event analysis +}; + +#endif diff --git a/PWG4/PROOF-INF.PWG4JetTasks/SETUP.C b/PWG4/PROOF-INF.PWG4JetTasks/SETUP.C index 2c73d5e06c6..1cd145f1434 100644 --- a/PWG4/PROOF-INF.PWG4JetTasks/SETUP.C +++ b/PWG4/PROOF-INF.PWG4JetTasks/SETUP.C @@ -9,9 +9,9 @@ void SETUP() gROOT->ProcessLine(".include JETAN"); // Set the Include paths - gSystem->AddIncludePath("-IPWG4"); - gROOT->ProcessLine(".include PWG4"); + gSystem->AddIncludePath("-IPWG4JetTasks"); + gROOT->ProcessLine(".include PWG4JetTasks/JetTasks"); // Set our location, so that other packages can find us - gSystem->Setenv("PWG4JetTasks_INCLUDE", "PWG4"); + gSystem->Setenv("PWG4JetTasks_INCLUDE", "PWG4JetTasks"); } diff --git a/PWG4/PROOF-INF.PWG4PartCorr/SETUP.C b/PWG4/PROOF-INF.PWG4PartCorr/SETUP.C index 6cec92558b5..bd7d27e161f 100644 --- a/PWG4/PROOF-INF.PWG4PartCorr/SETUP.C +++ b/PWG4/PROOF-INF.PWG4PartCorr/SETUP.C @@ -5,9 +5,9 @@ void SETUP() gSystem->Load("libPWG4PartCorr"); // Set the Include paths - gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG4"); - gROOT->ProcessLine(".include PWG4"); + gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG4PartCorr"); + gROOT->ProcessLine(".include PWG4PartCorr/PartCorr"); // Set our location, so that other packages can find us - gSystem->Setenv("PWG4PartCorr_INCLUDE", "PWG4"); + gSystem->Setenv("PWG4PartCorr_INCLUDE", "PWG4PartCorr/PartCorr"); } diff --git a/PWG4/PartCorr/AliAODParticleCorrelation.cxx b/PWG4/PartCorr/AliAODParticleCorrelation.cxx new file mode 100644 index 00000000000..d9dcdb138da --- /dev/null +++ b/PWG4/PartCorr/AliAODParticleCorrelation.cxx @@ -0,0 +1,160 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id: AliAODParticleCorrelation.h $ */ + +//------------------------------------------------------------------------- +// AOD class for photon and other particles storage and +// correlation studies +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +//-- ROOT system -- + +//-- Analysis system +#include "AliAODParticleCorrelation.h" + +ClassImp(AliAODParticleCorrelation) + + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation() : + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(), fCorrJet(), fCorrBkg(), fRefJet(0) +{ + // constructor +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e): + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(), fCorrJet(), + fCorrBkg(), fRefJet(0) +{ + // constructor + fMomentum = new TLorentzVector(px, py, pz, e); +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(TLorentzVector & p): + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(), fCorrJet(), fCorrBkg(),fRefJet(0) +{ + // constructor + fMomentum = new TLorentzVector(p); +} + + +//______________________________________________________________________________ +AliAODParticleCorrelation::~AliAODParticleCorrelation() +{ + // destructor + delete fMomentum; + delete fRefTracks; + delete fRefClusters; + delete fRefIsolationConeTracks; + delete fRefIsolationConeClusters; + delete fRefBackgroundTracks; + delete fRefBackgroundClusters; + +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(const AliAODParticleCorrelation& part) : + AliVParticle(part), + fMomentum(0) ,fPdg(part.fPdg), fTag(part.fTag),fLabel(part.fLabel), + fDetector(part.fDetector), + fR(part.fR), + fRefTracks(), fRefClusters(), + fRefIsolationConeTracks(), fRefIsolationConeClusters(), + fRefBackgroundTracks(), fRefBackgroundClusters(), + fLeadingDetector(part.fLeadingDetector), fLeading(part.fLeading), + fCorrJet(part.fCorrJet), fCorrBkg(part.fCorrBkg), fRefJet(part.fRefJet) +{ + // Copy constructor + fMomentum = new TLorentzVector(*part.fMomentum); + fRefTracks = new TRefArray(*part.fRefTracks); + fRefClusters = new TRefArray(*part.fRefClusters); + fRefIsolationConeTracks = new TRefArray(*part.fRefIsolationConeTracks); + fRefIsolationConeClusters = new TRefArray(*part.fRefIsolationConeClusters); + fRefBackgroundTracks = new TRefArray(*part.fRefBackgroundTracks); + fRefBackgroundClusters = new TRefArray(*part.fRefBackgroundClusters); +} + +//______________________________________________________________________________ +AliAODParticleCorrelation& AliAODParticleCorrelation::operator=(const AliAODParticleCorrelation& part) +{ + // Assignment operator + if(this!=&part) { + } + + fPdg = part.fPdg; + fTag = part.fTag; + fLabel = part.fLabel; + fR = part.fR; + fRefJet = part.fRefJet ; + fDetector =part.fDetector; + fLeadingDetector =part.fLeadingDetector; + fLeading = part.fLeading; + fCorrJet = part.fCorrJet ; + fCorrBkg = part.fCorrBkg; + + if (fMomentum ) delete fMomentum; + if( fRefTracks ) delete fRefTracks ; + if( fRefClusters) delete fRefClusters ; + if( fRefIsolationConeTracks ) delete fRefIsolationConeTracks ; + if( fRefIsolationConeClusters) delete fRefIsolationConeClusters ; + if( fRefBackgroundTracks ) delete fRefBackgroundTracks ; + if( fRefBackgroundClusters ) delete fRefBackgroundClusters ; + + fMomentum = new TLorentzVector(*part.fMomentum); + fRefTracks = new TRefArray(*part.fRefTracks); + fRefClusters = new TRefArray(*part.fRefClusters); + fRefIsolationConeTracks = new TRefArray(*part.fRefIsolationConeTracks); + fRefIsolationConeClusters = new TRefArray(*part.fRefIsolationConeClusters); + fRefBackgroundTracks = new TRefArray(*part.fRefBackgroundTracks); + fRefBackgroundClusters = new TRefArray(*part.fRefBackgroundClusters); + + return *this; +} + +void AliAODParticleCorrelation::Print(Option_t* /*option*/) const +{ + // Print information of all data members + printf("Particle 4-vector:\n"); + printf(" E = %13.3f\n", E() ); + printf(" Px = %13.3f\n", Px()); + printf(" Py = %13.3f\n", Py()); + printf(" Pz = %13.3f\n", Pz()); + printf("pdg : %d\n",fPdg); + printf("tag : %d\n",fTag); + printf("R : %2.2f\n",fR); + printf("Trigger Detector : %s\n",fDetector.Data()); + printf("Leading Detector : %s\n",fLeadingDetector.Data()); + // if(fRefJet) fRefJet.Print(); + +} diff --git a/PWG4/PartCorr/AliAODParticleCorrelation.h b/PWG4/PartCorr/AliAODParticleCorrelation.h new file mode 100644 index 00000000000..710441977f7 --- /dev/null +++ b/PWG4/PartCorr/AliAODParticleCorrelation.h @@ -0,0 +1,145 @@ +#ifndef AliAODParticleCorrelation_H +#define AliAODParticleCorrelation_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliAODParticleCorrelation.h $ */ + +//------------------------------------------------------------------------- +// Copy of AOD photon class, adapted for particle identification +// and correlations analysis +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +//-- ROOT system -- +#include +class TString; + +//-- Analysis system +#include "AliAODJet.h" +#include "AliVParticle.h" + +class AliAODParticleCorrelation : public AliVParticle { + + public: + AliAODParticleCorrelation(); + AliAODParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e); + AliAODParticleCorrelation(TLorentzVector & p); + virtual ~AliAODParticleCorrelation(); + AliAODParticleCorrelation(const AliAODParticleCorrelation& photon); + AliAODParticleCorrelation& operator=(const AliAODParticleCorrelation& photon); + + // AliVParticle methods + virtual Double_t Px() const { return fMomentum->Px(); } + virtual Double_t Py() const { return fMomentum->Py(); } + virtual Double_t Pz() const { return fMomentum->Pz(); } + virtual Double_t Pt() const { return fMomentum->Pt(); } + virtual Double_t P() const { return fMomentum->P(); } + virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; } + virtual Double_t OneOverPt() const { return 1. / fMomentum->Pt(); } + virtual Double_t Phi() const; + virtual Double_t Theta() const { return fMomentum->Theta(); } + virtual Double_t E() const { return fMomentum->E(); } + virtual Double_t M() const { return fMomentum->M(); } + virtual Double_t Eta() const { return fMomentum->Eta(); } + virtual Double_t Y() const { return fMomentum->Rapidity();} + virtual Double_t Xv() const {return -999.;} // put reasonable values here + virtual Double_t Yv() const {return -999.;} // + virtual Double_t Zv() const {return -999.;} // + virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; } + virtual void Print(Option_t* /*option*/) const; + + // + //Dummy + virtual Short_t Charge() const { return 0;} + virtual const Double_t* PID() const { return NULL;} + // + + virtual Float_t GetR() const {return fR ; } + virtual Int_t GetPdg() const {return fPdg ; } + virtual Int_t GetTag() const {return fTag ; } + virtual Int_t GetLabel() const {return fLabel ; } + virtual TString GetDetector() const {return fDetector ; } + + virtual void SetR(Float_t r) {fR = r ; } + virtual void SetPdg(Int_t pdg) {fPdg = pdg ; } + virtual void SetTag(Int_t tag) {fTag = tag ; } + virtual void SetLabel(Int_t l) {fLabel = l ; } + virtual void SetDetector(TString d) {fDetector = d ; } + + virtual TRefArray* GetRefTracks() const { return fRefTracks;} + virtual void AddTrack(TObject *tr) {fRefTracks->Add(tr);} + TObject* GetTrack(Int_t i) {return fRefTracks->At(i);} + + virtual TRefArray* GetRefClusters() const { return fRefClusters;} + virtual void AddCluster(TObject *tr) {fRefClusters->Add(tr);} + TObject* GetCluster(Int_t i) {return fRefClusters->At(i);} + + virtual TRefArray* GetRefIsolationConeTracks() const { return fRefIsolationConeTracks;} + virtual void AddIsolationConeTrack(TObject *tr) {fRefIsolationConeTracks->Add(tr);} + TObject* GetIsolationConeTrack(Int_t i) {return fRefIsolationConeTracks->At(i);} + + virtual TRefArray* GetRefIsolationConeClusters() const { return fRefIsolationConeClusters;} + virtual void AddIsolationConeCluster(TObject *tr) {fRefIsolationConeClusters->Add(tr);} + TObject* GetIsolationConeCluster(Int_t i) {return fRefIsolationConeClusters->At(i);} + + virtual TRefArray* GetRefBackgroundTracks() const { return fRefBackgroundTracks;} + virtual void AddBackgroundTrack(TObject *tr) {fRefBackgroundTracks->Add(tr);} + TObject* GetBackgroundTrack(Int_t i) {return fRefBackgroundTracks->At(i);} + + virtual TRefArray* GetRefBackgroundClusters() const { return fRefBackgroundClusters;} + virtual void AddBackgroundCluster(TObject *tr) {fRefBackgroundClusters->Add(tr);} + TObject* GetBackgroundCluster(Int_t i) {return fRefBackgroundClusters->At(i);} + + virtual void SetLeadingDetector(TString d) {fLeadingDetector = d ; } + virtual TString GetLeadingDetector() const {return fLeadingDetector ; } + + virtual TLorentzVector GetLeading() const { return fLeading;} + virtual void SetLeading(TLorentzVector lead) {fLeading = lead;} + + virtual TLorentzVector GetCorrelatedJet() const { return fCorrJet;} + virtual void SetCorrelatedJet(TLorentzVector jet) {fCorrJet = jet;} + + virtual TLorentzVector GetCorrelatedBackground() const { return fCorrBkg;} + virtual void SetCorrelatedBackground(TLorentzVector bkg) {fCorrBkg = bkg;} + + void SetRefJet(AliAODJet* jet) { fRefJet = jet;} + AliAODJet* GetJet() {return ((AliAODJet*) fRefJet.GetObject());} + TRef GetRefJet() {return fRefJet;} + + private: + TLorentzVector* fMomentum; // Photon 4-momentum vector + Int_t fPdg; // id of particle + Int_t fTag; // tag of particle (decay, fragment, prompt photon) + Int_t fLabel; // MC label + TString fDetector; // Detector where particle was measured. + Float_t fR ; // Isolation cone size + TRefArray* fRefTracks; // array of references to the tracks belonging to the jet / all selected hadrons + TRefArray* fRefClusters; // array of references to the clusters belonging to the jet / all selected hadrons + + TRefArray* fRefIsolationConeTracks; // array of references to the tracks belonging to the cone around direct particle candidate + TRefArray* fRefIsolationConeClusters; // array of references to the clusters belonging to the cone around direct particle candidate + + TRefArray* fRefBackgroundTracks; // array of references to the tracks for background stimation + TRefArray* fRefBackgroundClusters; // array of references to the clusters for background stimation + + TString fLeadingDetector; // Detector where leading particle was measured. + TLorentzVector fLeading; // Leading Particle 4-momentum vector + + TLorentzVector fCorrJet; // Jet 4-momentum vector + TLorentzVector fCorrBkg; // Background 4-momentum vector + + TRef fRefJet; // Rerence to jet found with JETAN and correlated with particle + + ClassDef(AliAODParticleCorrelation,1); +}; + +inline Double_t AliAODParticleCorrelation::Phi() const +{ + // Return phi + Double_t phi = fMomentum->Phi(); + if (phi < 0.) phi += 2. * TMath::Pi(); + return phi; +} + +#endif diff --git a/PWG4/PartCorr/AliAnaCaloTrigger.cxx b/PWG4/PartCorr/AliAnaCaloTrigger.cxx new file mode 100644 index 00000000000..fcb747ba6ab --- /dev/null +++ b/PWG4/PartCorr/AliAnaCaloTrigger.cxx @@ -0,0 +1,258 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +//_________________________________________________________________________ +// An analysis task to check the trigger data in ESD +// Creates an ntuple for 2x2 and NxN triggers +// Each ntuple connects the maximum trigger amplitudes +// and its positions with reconstructed clusters +// +//*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF) +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +#include "AliAnaCaloTrigger.h" +#include "AliAnalysisManager.h" +#include "AliESDEvent.h" +#include "AliLog.h" +#include "AliESDCaloCluster.h" + +//______________________________________________________________________________ +AliAnaCaloTrigger::AliAnaCaloTrigger() : + fChain(0), + fESD(0), + fOutputContainer(0), + fCalorimeter("PHOS"), + fNtTrigger22(0), + fNtTriggerNN(0) + +{ + // Default Constructor. + +} + +//______________________________________________________________________________ +AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) : + AliAnalysisTask(name,"AnaCaloTrigger"), + fChain(0), + fESD(0), + fOutputContainer(0), + fCalorimeter("PHOS"), + fNtTrigger22(0), + fNtTriggerNN(0) + +{ + // Constructor. + // Input slot #0 works with an Ntuple + DefineInput(0, TChain::Class()); + // Output slot #0 writes into a TH1 container + DefineOutput(0, TObjArray::Class()) ; +} +//____________________________________________________________________________ +AliAnaCaloTrigger::AliAnaCaloTrigger(const AliAnaCaloTrigger & ct) : + AliAnalysisTask(ct), fChain(ct.fChain), fESD(ct.fESD), + fOutputContainer(ct.fOutputContainer), fCalorimeter(ct. fCalorimeter), + fNtTrigger22(ct.fNtTrigger22), fNtTriggerNN(ct.fNtTriggerNN) +{ + + // cpy ctor + SetName (ct.GetName()) ; + SetTitle(ct.GetTitle()) ; + +} + +//_________________________________________________________________________ +AliAnaCaloTrigger & AliAnaCaloTrigger::operator = (const AliAnaCaloTrigger & source) +{ + // assignment operator + + if(&source == this) return *this; + + fChain = source.fChain ; + fESD = source.fESD ; + fOutputContainer = source.fOutputContainer ; + fCalorimeter = source. fCalorimeter ; + fNtTrigger22 = source.fNtTrigger22 ; + fNtTriggerNN = source.fNtTriggerNN ; + + return *this; + +} + +//______________________________________________________________________________ +AliAnaCaloTrigger::~AliAnaCaloTrigger() +{ + // dtor + //fOutputContainer->Clear() ; + //delete fOutputContainer ; + +} + + +//______________________________________________________________________________ +void AliAnaCaloTrigger::ConnectInputData(const Option_t*) +{ + // Initialisation of branch container and histograms + + AliInfo(Form("*** Initialization of %s", GetName())) ; + + // Get input data + fChain = dynamic_cast(GetInputData(0)) ; + if (!fChain) { + AliError(Form("Input 0 for %s not found\n", GetName())); + return ; + } + + fESD = new AliESDEvent(); + fESD->ReadFromTree(fChain); + +} + +//________________________________________________________________________ + +void AliAnaCaloTrigger::CreateOutputObjects() +{ + + // Create the outputs containers + OpenFile(0) ; + + // create histograms + fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax"); + fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax"); + + // create output container + + fOutputContainer = new TObjArray(2) ; + fOutputContainer->SetName(GetName()) ; + + fOutputContainer->AddAt(fNtTrigger22, 0) ; + fOutputContainer->AddAt(fNtTriggerNN, 1) ; + +} + +//______________________________________________________________________________ +void AliAnaCaloTrigger::Exec(Option_t *) +{ + // Processing of one event + + Long64_t entry = fChain->GetReadEntry() ; + + if (!fESD) { + AliError("fESD is not connected to the input!") ; + return ; + } + + if ( !((entry-1)%100) ) + AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast(fChain))->GetFile()->GetName(), entry)) ; + + // Get trigger information of fCalorimeter + TArrayF * triggerAmplitudes = 0x0 ; + TArrayF * triggerPosition = 0x0 ; + Int_t numberOfCaloClusters = fESD->GetNumberOfCaloClusters() ; + + if(fCalorimeter == "PHOS"){ + triggerAmplitudes = fESD->GetPHOSTriggerAmplitudes(); + triggerPosition = fESD->GetPHOSTriggerPosition(); + } + else if(fCalorimeter == "EMCAL"){ + triggerAmplitudes = fESD->GetEMCALTriggerAmplitudes(); + triggerPosition = fESD->GetEMCALTriggerPosition(); + } + + if( triggerAmplitudes && triggerPosition ){ + // trigger amplitudes + const Float_t ka22 = static_cast(triggerAmplitudes->At(0)) ; + const Float_t ka22O = static_cast(triggerAmplitudes->At(1)) ; + const Float_t kaNN = static_cast(triggerAmplitudes->At(2)) ; + const Float_t kaNNO = static_cast(triggerAmplitudes->At(3)) ; + + // trigger position + const Float_t kx22 = static_cast(triggerPosition->At(0)) ; + const Float_t ky22 = static_cast(triggerPosition->At(1)) ; + const Float_t kz22 = static_cast(triggerPosition->At(2)) ; + const Float_t kxNN = static_cast(triggerPosition->At(3)) ; + const Float_t kyNN = static_cast(triggerPosition->At(4)) ; + const Float_t kzNN = static_cast(triggerPosition->At(5)) ; + + Float_t enMax = 0. ; + Float_t phEnMax = 0. ; + Float_t etaMax = 0.5 ; + Float_t phiMax = 0. ; + Float_t phEtaMax = 0.5 ; + Float_t phPhiMax = 0. ; + + TVector3 vpos22(kx22, ky22, kz22) ; + TVector3 vposNN(kxNN, kyNN, kzNN) ; + Float_t eta22 = vpos22.Eta() ; + Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ; + Float_t etaNN = vposNN.Eta() ; + Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ; + + Int_t icaloCluster ; + + // loop over the Calorimeters Clusters + + for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) { + + AliESDCaloCluster * cluster = fESD->GetCaloCluster(icaloCluster) ; + + if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS()) || + (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) { + + Float_t cluEnergy = cluster->E() ; + Float_t pos[3] ; + TVector3 vpos ; + + cluster->GetPosition( pos ) ; + + if ( cluEnergy > enMax) { + enMax = cluEnergy ; + vpos.SetXYZ(pos[0], pos[1], pos[2]) ; + etaMax = vpos.Eta() ; + phiMax = vpos.Phi() ; + } + + Double_t * pid = cluster->GetPid() ; + + if(pid[AliPID::kPhoton] > 0.9) { + if ( cluEnergy > phEnMax) { + phEnMax = cluEnergy ; + vpos.SetXYZ(pos[0], pos[1], pos[2]) ; + phEtaMax = vpos.Eta() ; + phPhiMax = vpos.Phi() ; + } + } + }//if cluster + + fNtTrigger22->Fill(ka22, ka22O, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); + fNtTriggerNN->Fill(kaNN, kaNNO, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); + }//CaloCluster loop + + }//If trigger arrays filled + + PostData(0, fOutputContainer); + +} + +//______________________________________________________________________________ +void AliAnaCaloTrigger::Terminate(Option_t *) +{ + // Processing when the event loop is ended + +} diff --git a/PWG4/PartCorr/AliAnaCaloTrigger.h b/PWG4/PartCorr/AliAnaCaloTrigger.h new file mode 100644 index 00000000000..8ad9f0dc6e1 --- /dev/null +++ b/PWG4/PartCorr/AliAnaCaloTrigger.h @@ -0,0 +1,56 @@ +#ifndef ALIANACALOTRIGGER_H +#define ALIANACALOTRIGGER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +//______________________________________________________________________________ +// An analysis task to check the trigger data in ESD +// Creates an ntuple for 2x2 and NxN triggers +// Each ntuple connects the maximum trigger amplitudes +// and its positions with reconstructed clusters +// +//*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF) +////////////////////////////////////////////////////////////////////////////// + + +#include "AliAnalysisTask.h" +class TFile ; +class TNtuple ; +class TH1D ; +class TH1I ; +class TChain; + +class AliAnalysisManager ; +class AliESDEvent ; + +class AliAnaCaloTrigger : public AliAnalysisTask { + +public: + AliAnaCaloTrigger() ; + AliAnaCaloTrigger(const char *name) ; + AliAnaCaloTrigger(const AliAnaCaloTrigger & trig) ; + AliAnaCaloTrigger & operator=(const AliAnaCaloTrigger& source); + virtual ~AliAnaCaloTrigger() ; + + virtual void Exec(Option_t * opt = "") ; + virtual void ConnectInputData(Option_t *); + virtual void CreateOutputObjects(); + virtual void Terminate(Option_t * opt = "") ; + + TString GetCalorimeter() const {return fCalorimeter ; } + void SetCalorimeter(TString calo) {fCalorimeter = calo ; } + +private: + TChain * fChain ; //!pointer to the analyzed TTree or TChain + AliESDEvent * fESD ; //! Declaration of leave types + + TObjArray * fOutputContainer ; //! output data container + + TString fCalorimeter ; // "PHOS" or "EMCAL" + + // Histograms + TNtuple * fNtTrigger22 ; //Ntuple with 2x2 max dig amplitude and cluster energy, and positions. + TNtuple * fNtTriggerNN ; //Ntuple with NxN max dig amplitude and cluster energy, and positions. + + ClassDef(AliAnaCaloTrigger, 1); // a photon analysis task +}; +#endif // ALIANACALOTRIGGER_H diff --git a/PWG4/PartCorr/AliAnaCaloTriggerMC.cxx b/PWG4/PartCorr/AliAnaCaloTriggerMC.cxx new file mode 100644 index 00000000000..65540b19134 --- /dev/null +++ b/PWG4/PartCorr/AliAnaCaloTriggerMC.cxx @@ -0,0 +1,283 @@ + +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +//_________________________________________________________________________ +// An analysis task to check the trigger data in ESD with MC data +// Creates an ntuple for 2x2 and NxN triggers +// Each ntuple connects the maximum trigger amplitudes +// and its positions with reconstructed clusters and MC +// +//*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF) +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +#include "AliAnalysisManager.h" +#include "AliMCEventHandler.h" +#include "AliMCEvent.h" +#include "AliAnaCaloTriggerMC.h" +#include "AliESDEvent.h" +#include "AliESDCaloCluster.h" +#include "AliLog.h" +#include "AliStack.h" +#include "TParticle.h" + +//______________________________________________________________________________ +AliAnaCaloTriggerMC::AliAnaCaloTriggerMC() : + fChain(0), + fESD(0), + fOutputContainer(0), + fCalorimeter("PHOS"), + fNtTrigger22(0), + fNtTriggerNN(0) + +{ + // Default constructor. + +} +//______________________________________________________________________________ +AliAnaCaloTriggerMC::AliAnaCaloTriggerMC(const char *name) : + AliAnalysisTask(name, "AnaCaloTriggerMC"), + fChain(0), + fESD(0), + fOutputContainer(0), + fCalorimeter("PHOS"), + fNtTrigger22(0), + fNtTriggerNN(0) + +{ + // Constructor. + // Input slot #0 works with an Ntuple + DefineInput(0, TChain::Class()); + // Output slot #0 writes into a TH1 container + DefineOutput(0, TObjArray::Class()) ; +} +//____________________________________________________________________________ +AliAnaCaloTriggerMC::AliAnaCaloTriggerMC(const AliAnaCaloTriggerMC & ct) : + AliAnalysisTask(ct),fChain(ct.fChain), fESD(ct.fESD), + fOutputContainer(ct.fOutputContainer), fCalorimeter(ct. fCalorimeter), + fNtTrigger22(ct.fNtTrigger22), fNtTriggerNN(ct.fNtTriggerNN) +{ + + // cpy ctor + SetName (ct.GetName()) ; + SetTitle(ct.GetTitle()) ; + +} + +//_________________________________________________________________________ +AliAnaCaloTriggerMC & AliAnaCaloTriggerMC::operator = (const AliAnaCaloTriggerMC & source) +{ + // assignment operator + + if(&source == this) return *this; + + fChain = source.fChain ; + fESD = source.fESD ; + fOutputContainer = source.fOutputContainer ; + fCalorimeter = source. fCalorimeter ; + fNtTrigger22 = source.fNtTrigger22 ; + fNtTriggerNN = source.fNtTriggerNN ; + + return *this; + +} + +//______________________________________________________________________________ +AliAnaCaloTriggerMC::~AliAnaCaloTriggerMC() +{ + // dtor + // fOutputContainer->Clear() ; + // delete fOutputContainer ; + +} + + +//______________________________________________________________________________ +void AliAnaCaloTriggerMC::ConnectInputData(const Option_t*) +{ + // Initialisation of branch container and histograms + + AliInfo(Form("*** Initialization of %s", GetName())) ; + + // Get input data + fChain = dynamic_cast(GetInputData(0)) ; + if (!fChain) { + AliError(Form("Input 0 for %s not found\n", GetName())); + return ; + } + + fESD = new AliESDEvent(); + fESD->ReadFromTree(fChain); + +} + +//________________________________________________________________________ + +void AliAnaCaloTriggerMC::CreateOutputObjects() +{ + + // Create the output container + OpenFile(0); + + // create histograms + fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax"); + fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax"); + + // create output container + + fOutputContainer = new TObjArray(2) ; + fOutputContainer->SetName(GetName()) ; + + fOutputContainer->AddAt(fNtTrigger22, 0) ; + fOutputContainer->AddAt(fNtTriggerNN, 1) ; + +} + +//______________________________________________________________________________ +void AliAnaCaloTriggerMC::Exec(Option_t *) +{ + + // Processing of one event + + Long64_t entry = fChain->GetReadEntry() ; + + if (!fESD) { + AliError("fESD is not connected to the input!") ; + return ; + } + + if ( !((entry-1)%100) ) + AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast(fChain))->GetFile()->GetName(), entry)) ; + + //Get MC data + AliStack* stack = 0x0; + AliMCEventHandler* mctruth = (AliMCEventHandler*) + ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); + + if(mctruth) + stack = mctruth->MCEvent()->Stack(); + + if (!stack) { + AliError("Stack not found") ; + return ; + } + + // Get trigger information of fCalorimeter + TArrayF * triggerAmplitudes = 0x0 ; + TArrayF * triggerPosition = 0x0 ; + Int_t numberOfCaloClusters = 0 ; + + if(fCalorimeter == "PHOS"){ + triggerAmplitudes = fESD->GetPHOSTriggerAmplitudes(); + triggerPosition = fESD->GetPHOSTriggerPosition(); + } + else if(fCalorimeter == "EMCAL"){ + triggerAmplitudes = fESD->GetEMCALTriggerAmplitudes(); + triggerPosition = fESD->GetEMCALTriggerPosition(); + } + + if( triggerAmplitudes && triggerPosition ){ + // trigger amplitudes + const Float_t ka22 = static_cast(triggerAmplitudes->At(0)) ; + const Float_t ka22O = static_cast(triggerAmplitudes->At(1)) ; + const Float_t kaNN = static_cast(triggerAmplitudes->At(2)) ; + const Float_t kaNNO = static_cast(triggerAmplitudes->At(3)) ; + + // trigger position + const Float_t kx22 = static_cast(triggerPosition->At(0)) ; + const Float_t ky22 = static_cast(triggerPosition->At(1)) ; + const Float_t kz22 = static_cast(triggerPosition->At(2)) ; + const Float_t kxNN = static_cast(triggerPosition->At(3)) ; + const Float_t kyNN = static_cast(triggerPosition->At(4)) ; + const Float_t kzNN = static_cast(triggerPosition->At(5)) ; + + Float_t enMax = 0. ; + Float_t phEnMax = 0. ; + Float_t etaMax = 0.5 ; + Float_t phiMax = 0. ; + Float_t phEtaMax = 0.5 ; + Float_t phPhiMax = 0. ; + + TVector3 vpos22(kx22, ky22, kz22) ; + TVector3 vposNN(kxNN, kyNN, kzNN) ; + Float_t eta22 = vpos22.Eta() ; + Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ; + Float_t etaNN = vposNN.Eta() ; + Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ; + + Int_t icaloCluster ; + + // loop over the Calorimeters Clusters + Float_t cluEnergy = 0; + Int_t labelmax = -5; + for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) { + + AliESDCaloCluster * cluster = fESD->GetCaloCluster(icaloCluster) ; + + if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS()) || + (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) { + + cluEnergy = cluster->E() ; + Float_t pos[3] ; + TVector3 vpos ; + + cluster->GetPosition( pos ) ; + + if ( cluEnergy > enMax) { + enMax = cluEnergy ; + vpos.SetXYZ(pos[0], pos[1], pos[2]) ; + etaMax = vpos.Eta() ; + phiMax = vpos.Phi() ; + labelmax = cluster->GetLabel(); + } + + Double_t * pid = cluster->GetPid() ; + + if(pid[AliPID::kPhoton] > 0.9) { + if ( cluEnergy > phEnMax) { + phEnMax = cluEnergy ; + vpos.SetXYZ(pos[0], pos[1], pos[2]) ; + phEtaMax = vpos.Eta() ; + phPhiMax = vpos.Phi() ; + } + } + }//if cluster + }//CaloCluster loop + + if(labelmax < stack->GetNtrack() && labelmax >= 0 ){ + TParticle * particle = stack->Particle(labelmax); + Float_t ptgen = particle->Energy(); + fNtTrigger22->Fill(ka22, ka22O, ptgen, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); + fNtTriggerNN->Fill(kaNN, kaNNO, ptgen, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); + } + else AliDebug(1, Form("Wrong label %d, ntrack %d, Emax %f ",labelmax, stack->GetNtrack(), phEnMax)); + }//If trigger arrays filled + + PostData(0, fOutputContainer); + +} + + +//______________________________________________________________________________ +void AliAnaCaloTriggerMC::Terminate(Option_t *) +{ + // Processing when the event loop is ended + +} diff --git a/PWG4/PartCorr/AliAnaCaloTriggerMC.h b/PWG4/PartCorr/AliAnaCaloTriggerMC.h new file mode 100644 index 00000000000..ce2f7701c75 --- /dev/null +++ b/PWG4/PartCorr/AliAnaCaloTriggerMC.h @@ -0,0 +1,56 @@ +#ifndef ALIANACALOTRIGGERMC_H +#define ALIANACALOTRIGGERMC_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +//______________________________________________________________________________ +// An analysis task to check the trigger data in ESD with MC data +// Creates an ntuple for 2x2 and NxN triggers +// Each ntuple connects the maximum trigger amplitudes +// and its positions with reconstructed clusters and MC +// +//*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF) +////////////////////////////////////////////////////////////////////////////// + +#include "AliAnalysisTask.h" + +class TFile ; +class TNtuple ; +class TH1D ; +class TH1I ; +class TChain; + +class AliMCEvent ; +class AliESDEvent ; + +class AliAnaCaloTriggerMC : public AliAnalysisTask { + +public: + AliAnaCaloTriggerMC(); + AliAnaCaloTriggerMC(const char *name) ; + AliAnaCaloTriggerMC(const AliAnaCaloTriggerMC & trig) ; + AliAnaCaloTriggerMC & operator=(const AliAnaCaloTriggerMC& source); + virtual ~AliAnaCaloTriggerMC() ; + + virtual void Exec(Option_t * opt = "") ; + virtual void ConnectInputData(Option_t *); + virtual void CreateOutputObjects(); + virtual void Terminate(Option_t * opt = "") ; + + TString GetCalorimeter() const {return fCalorimeter ; } + void SetCalorimeter(TString calo) {fCalorimeter = calo ; } + +private: + TChain * fChain ; //!pointer to the analyzed TTree or TChain + AliESDEvent * fESD ; //! Declaration of leave types + + TObjArray * fOutputContainer ; //! output data container + + TString fCalorimeter ; // "PHOS" or "EMCAL" + + // Histograms + TNtuple * fNtTrigger22 ; //Ntuple with 2x2 max dig amplitude and MC particle and cluster energy, and positions. + TNtuple * fNtTriggerNN ; //Ntuple with NxN max dig amplitude and MC particle and cluster energy, and positions. + + ClassDef(AliAnaCaloTriggerMC, 1); // a photon analysis task +}; +#endif // ALIANACALOTRIGGERMC_H diff --git a/PWG4/PartCorr/AliAnaExample.cxx b/PWG4/PartCorr/AliAnaExample.cxx new file mode 100644 index 00000000000..d3792015852 --- /dev/null +++ b/PWG4/PartCorr/AliAnaExample.cxx @@ -0,0 +1,360 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Example class on how to read AODCaloClusters, ESDCaloCells and AODTracks and how +// fill AODs with PWG4PartCorr analysis frame +// Select the type of detector information that you want to analyze, CTS (tracking), PHOS or EMCAL +// Select the PID custer type of the calorimeters +// Set min momentum of the cluster/tracks +// Fill few histograms +// +//-- Author: Gustavo Conesa (INFN-LNF) +//-- Author: Gustavo Conesa (LNF-INFN) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include "Riostream.h" +#include "TClonesArray.h" +#include "TH2F.h" +#include "TParticle.h" + +//---- AliRoot system ---- +#include "AliAnaExample.h" +#include "AliCaloTrackReader.h" +#include "AliLog.h" +#include "AliAODParticleCorrelation.h" +#include "AliESDCaloCells.h" + +ClassImp(AliAnaExample) + +//____________________________________________________________________________ + AliAnaExample::AliAnaExample() : + AliAnaPartCorrBaseClass(),fPdg(0), fDetector(""), fhPt(0),fhPhi(0),fhEta(0), fh2Pt(0),fh2Phi(0),fh2Eta(0), + fhNCells(0), fhAmplitude(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaExample::AliAnaExample(const AliAnaExample & ex) : + AliAnaPartCorrBaseClass(ex), fPdg(ex.fPdg), fDetector(ex.fDetector), fhPt(ex.fhPt), fhPhi(ex.fhPhi),fhEta(ex.fhEta), + fh2Pt(ex.fh2Pt), fh2Phi(ex.fh2Phi),fh2Eta(ex.fh2Eta), fhNCells(ex.fhNCells), fhAmplitude(ex.fhAmplitude) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaExample & AliAnaExample::operator = (const AliAnaExample & ex) +{ + // assignment operator + + if(this == &ex)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(ex); + + fPdg = ex.fPdg; + fDetector = ex.fDetector; + fhPt = ex.fhPt; + fhPhi = ex.fhPhi; + fhEta = ex.fhEta; + fh2Pt = ex.fh2Pt; + fh2Phi = ex.fh2Phi; + fh2Eta = ex.fh2Eta; + fhNCells = ex.fhNCells; + fhAmplitude = ex.fhAmplitude; + + return *this; + +} + +// //____________________________________________________________________________ +// AliAnaExample::~AliAnaExample() +// { +// // Remove all pointers except analysis output pointers. + +// ; +// } + + +//________________________________________________________________________ +TList * AliAnaExample::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + AliDebug(1,"Init parton histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("ExampleHistos") ; + + fhPt = new TH1F ("hPt","p_T distribution", 100,0,100); + fhPt->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPt); + + fhPhi = new TH1F ("hPhi","#phi distribution", 100,0,TMath::TwoPi()); + fhPhi->SetXTitle("#phi (rad)"); + outputContainer->Add(fhPhi); + + fhEta = new TH1F ("hEta","#eta distribution", 100,-2,2); + fhEta->SetXTitle("#eta "); + outputContainer->Add(fhEta); + + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) { + //Calo cells + fhNCells = new TH1F ("hNCells","# cells per event", 100,0,1000); + fhNCells->SetXTitle("n cells"); + outputContainer->Add(fhNCells); + + fhAmplitude = new TH1F ("hAmplitude","#eta distribution", 100,0,1000); + fhAmplitude->SetXTitle("Amplitude "); + outputContainer->Add(fhAmplitude); + } + + if(IsDataMC()){ + fh2Pt = new TH2F ("h2Pt","p_T distribution, reconstructed vs generated", 100,0,100,100,0,100); + fh2Pt->SetXTitle("p_{T,rec} (GeV/c)"); + fh2Pt->SetYTitle("p_{T,gen} (GeV/c)"); + outputContainer->Add(fh2Pt); + + fh2Phi = new TH2F ("h2Phi","#phi distribution, reconstructed vs generated", 100,0,TMath::TwoPi(), 100,0,TMath::TwoPi()); + fh2Phi->SetXTitle("#phi_{rec} (rad)"); + fh2Phi->SetYTitle("#phi_{gen} (rad)"); + outputContainer->Add(fh2Phi); + + fh2Eta = new TH2F ("h2Eta","#eta distribution, reconstructed vs generated", 100,-1,1,100,-1,1); + fh2Eta->SetXTitle("#eta_{rec} "); + fh2Eta->SetYTitle("#eta_{gen} "); + outputContainer->Add(fh2Eta); + + } + return outputContainer; +} + + //__________________________________________________ +void AliAnaExample::InitParameters() +{ + //Initialize the parameters of the analysis. + + fPdg = 22; //Keep photons + fDetector = "PHOS"; + +} + +//__________________________________________________________________ +void AliAnaExample::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("Min Pt = %3.2f\n", GetMinPt()); + printf("Max Pt = %3.2f\n", GetMaxPt()); + printf("Select clusters with pdg %d \n",fPdg); + printf("Select detector %s \n",fDetector.Data()); + +} + +//__________________________________________________________________ +void AliAnaExample::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + + //Some prints + if(GetDebug() > 0){ + if(fDetector == "EMCAL" && GetAODEMCAL())printf("Example : in emcal aod entries %d\n", GetAODEMCAL()->GetEntriesFast()); + if(fDetector == "CTS" && GetAODCTS())printf("Example : in CTS aod entries %d\n", GetAODCTS()->GetEntriesFast()); + if(fDetector == "PHOS" && GetAODPHOS())printf("Example : in PHOS aod entries %d\n", GetAODPHOS()->GetEntriesFast()); + } + + //Get List with tracks or clusters + TClonesArray * partList = new TClonesArray; + if(fDetector == "CTS") partList = GetAODCTS(); + else if(fDetector == "EMCAL") partList = GetAODEMCAL(); + else if(fDetector == "PHOS") partList = GetAODPHOS(); + + if(!partList || partList->GetEntriesFast() == 0) return ; + + //Fill AODCaloClusters and AODParticleCorrelation with PHOS/EMCAL aods + if(fDetector == "EMCAL" || fDetector == "PHOS"){ + + //WORK WITH CALOCLUSTERS + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + ConnectAODCaloClusters(); //Do Only when filling AODCaloClusters + if(GetDebug() > 0) printf("Example: in calo clusters aod entries %d\n", GetAODCaloClusters()->GetEntriesFast()); + + //Get vertex for photon momentum calculation + Double_t v[3] ; //vertex ; + GetReader()->GetVertex(v); + + TLorentzVector mom ; + for(Int_t i = 0; i < partList->GetEntriesFast(); i++){ + + AliAODCaloCluster * calo = dynamic_cast (partList->At(i)); + + //Fill AODCaloClusters + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + AddAODCaloCluster(AliAODCaloCluster(*(calo))); + + //Fill AODParticleCorrelation after some selection + calo->GetMomentum(mom,v); + Int_t pdg = fPdg; + + if(IsCaloPIDOn()){ + Double_t pid[13]; + calo->GetPID(pid); + pdg = GetCaloPID()->GetPdg(fDetector,pid,mom.E()); + cout<<"PDG "<GetPdg(fDetector,mom, + // calo->GetM02(), calo->GetM02(), + // calo->GetDispersion(), 0, 0); + } + + //Acceptance selection + Bool_t in = kTRUE; + if(IsFidutialCutOn()) + in = GetFidutialCut()->IsInFidutialCut(mom,fDetector) ; + + if(GetDebug() > 1) printf("cluster pt %2.2f, phi %2.2f, pdg %d, in fidutial cut %d \n",mom.Pt(), mom.Phi(), pdg, in); + + //Select cluster if momentum, pdg and acceptance are good + if(mom.Pt() > GetMinPt() && pdg ==fPdg && in) { + AliAODParticleCorrelation ph = AliAODParticleCorrelation(mom); + //AddAODParticleCorrelation(AliAODParticleCorrelation(mom)); + ph.SetLabel(calo->GetLabel(0)); + ph.SetPdg(pdg); + ph.SetDetector(fDetector); + AddAODParticleCorrelation(ph); + }//selection + }//loop + + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) { + //WORK WITH ESDCALOCELLS + //Don't connect in the same analysis PHOS and EMCAL cells. + + AliESDCaloCells * esdCell = new AliESDCaloCells ; + if(fDetector == "PHOS") { + ConnectAODPHOSCells(); //Do Only when filling AODCaloCells + esdCell = (AliESDCaloCells *) GetPHOSCells(); + } + else { + ConnectAODEMCALCells(); //Do Only when filling AODCaloCells + esdCell = (AliESDCaloCells *) GetEMCALCells(); + } + //Some prints + if(GetDebug() > 0 && esdCell ) + printf("Example : in ESD %s cell entries %d\n", fDetector.Data(), esdCell->GetNumberOfCells()); + + //Fill AODCells in file + Int_t ncells = esdCell->GetNumberOfCells() ; + GetAODCaloCells()->CreateContainer(ncells); + + GetAODCaloCells()->SetType((AliAODCaloCells::AODCells_t) esdCell->GetType()); + + for (Int_t iCell = 0; iCell < ncells; iCell++) { + if(GetDebug() > 2) printf("cell : amp %f, absId %d, time %f\n", esdCell->GetAmplitude(iCell), esdCell->GetCellNumber(iCell), esdCell->GetTime(iCell)); + + GetAODCaloCells()->SetCell(iCell,esdCell->GetCellNumber(iCell),esdCell->GetAmplitude(iCell)); + } + GetAODCaloCells()->Sort(); + } + }//cluster-cell analysis + else if(fDetector == "CTS"){ //Track analysis + //Fill AODParticleCorrelation with CTS aods + TVector3 p3; + for(Int_t i = 0; i < GetAODCTS()->GetEntriesFast(); i++){ + + AliAODTrack * track = dynamic_cast (GetAODCTS()->At(i)); + + //Fill AODParticleCorrelation after some selection + Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; + p3.SetXYZ(mom[0],mom[1],mom[2]); + + //Acceptance selection + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ; + if(GetDebug() > 1) printf("track pt %2.2f, phi %2.2f, in fidutial cut %d\n",p3.Pt(), p3.Phi(), in); + if(p3.Pt() > GetMinPt() && in) { + AliAODParticleCorrelation tr = AliAODParticleCorrelation(mom[0],mom[1],mom[2],0); + //AddAODParticleCorrelation(AliAODParticleCorrelation(mom)); + tr.SetDetector("CTS"); + AddAODParticleCorrelation(tr); + + }//selection + }//loop + }//CTS analysis + + if(GetDebug() > 0) { + printf("Example: final aod calocluster entries %d\n", GetAODCaloClusters()->GetEntriesFast()); + printf("Example: final aod branch entries %d\n", GetAODBranch()->GetEntriesFast()); + printf("Example: final aod cell entries %d\n", GetAODCaloCells()->GetNumberOfCells()); + } +} + +//__________________________________________________________________ +void AliAnaExample::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + + //Loop on stored AODParticles + Int_t naod = GetAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("histo aod branch entries %d\n", naod); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* ph = dynamic_cast (GetAODBranch()->At(iaod)); + + fhPt->Fill(ph->Pt()); + fhPhi->Fill(ph->Phi()); + fhEta->Fill(ph->Eta()); + + if(IsDataMC()){ + //Play with the MC stack if available + AliStack * stack = GetMCStack() ; + + if(ph->GetLabel() < 0 || !stack) { + printf("*** bad label or no stack ***: label %d \n", ph->GetLabel()); + continue; + } + + if(ph->GetLabel() >= stack->GetNtrack()) { + printf("*** large label ***: label %d, n tracks %d \n", ph->GetLabel(), stack->GetNtrack()); + continue ; + } + + TParticle * mom = GetMCStack()->Particle(ph->GetLabel()); + + fh2Pt->Fill(ph->Pt(), mom->Pt()); + fh2Phi->Fill(ph->Phi(), mom->Phi()); + fh2Eta->Fill(ph->Eta(), mom->Eta()); + }//Work with stack also + }// aod branch loop + + // CaloCells histograms + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) { + if(GetAODCaloCells()){ + + Int_t ncells = GetAODCaloCells()->GetNumberOfCells(); + fhNCells->Fill(ncells) ; + + for (Int_t iCell = 0; iCell < ncells; iCell++) { + if(GetDebug() > 2) printf("cell : amp %f, absId %d \n", GetAODCaloCells()->GetAmplitude(iCell), GetAODCaloCells()->GetCellNumber(iCell)); + fhAmplitude->Fill(GetAODCaloCells()->GetAmplitude(iCell)); + } + }//calo cells container exist + } +} diff --git a/PWG4/PartCorr/AliAnaExample.h b/PWG4/PartCorr/AliAnaExample.h new file mode 100644 index 00000000000..23710ef0a75 --- /dev/null +++ b/PWG4/PartCorr/AliAnaExample.h @@ -0,0 +1,68 @@ +#ifndef ALIANAEXAMPLE_H +#define ALIANAEXAMPLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Example class on how to read AODCaloClusters, ESDCaloCells and AODTracks and how +// fill AODs with PWG4PartCorr analysis frame +// Select the type of detector information that you want to analyze, CTS (tracking), PHOS or EMCAL +// Select the PID custer type of the calorimeters +// Set min momentum of the cluster/tracks +// Fill few histograms +// +//-- Author: Gustavo Conesa (INFN-LNF) + +class TH1F ; + +#include "AliAnaPartCorrBaseClass.h" + +class AliAnaExample : public AliAnaPartCorrBaseClass { + + public: + + AliAnaExample() ; // default ctor + AliAnaExample(const AliAnaExample & g) ; // cpy ctor + AliAnaExample & operator = (const AliAnaExample & g) ;//cpy assignment + virtual ~AliAnaExample() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + Int_t GetPdg() const {return fPdg ;} + void SetPdg( Int_t pdg ) {fPdg = pdg; } + + TString GetDetector() const {return fDetector ;} + void SetDetector( TString calo ) {fDetector = calo; } + + private: + + Int_t fPdg ; //identified particle id + TString fDetector ; //detector selection + //Histograms + //CaloClusters + TH1F * fhPt; //! pT distribution + TH1F * fhPhi; //! phi distribution + TH1F * fhEta; //! eta distribution + TH2F * fh2Pt; //!pT distribution, reconstructed vs generated + TH2F * fh2Phi; //! phi distribution, reconstructed vs generated + TH2F * fh2Eta; //! eta distribution, reconstructed vs generated + //Calo Cells + TH1F * fhNCells; //! Number of towers/crystals with signal + TH1F * fhAmplitude; //! Amplitude measured in towers/crystals + ClassDef(AliAnaExample,1) + } ; + + +#endif //ALIANAEXAMPLE_H + + + diff --git a/PWG4/PartCorr/AliAnaGammaDirect.cxx b/PWG4/PartCorr/AliAnaGammaDirect.cxx new file mode 100644 index 00000000000..da8a4a2a4b0 --- /dev/null +++ b/PWG4/PartCorr/AliAnaGammaDirect.cxx @@ -0,0 +1,1039 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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 iGetEntriesFast(s 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. * + **************************************************************************/ +/* $Id: AliAnaGammaDirect.cxx 28688 2008-09-11 15:04:07Z gconesab $ */ + +//_________________________________________________________________________ +// Class for the prompt gamma analysis, isolation cut +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) +// +// -- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include +#include "Riostream.h" + +// --- Analysis system --- +#include "AliAnaGammaDirect.h" +#include "AliLog.h" +#include "AliCaloTrackReader.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" + +ClassImp(AliAnaGammaDirect) + +//____________________________________________________________________________ + AliAnaGammaDirect::AliAnaGammaDirect() : + AliAnaPartCorrBaseClass(), fDetector(""), fMakeIC(0), fReMakeIC(0), + fMakeSeveralIC(0), fMakeInvMass(0), + fhPtGamma(0),fhPhiGamma(0),fhEtaGamma(0), fhConeSumPt(0), + //Several IC + fNCones(0),fNPtThresFrac(0), fConeSizes(), fPtThresholds(), fPtFractions(), + fhPtThresIsolated(), fhPtFracIsolated(), fhPtSumIsolated(), + //MC + fhPtPrompt(0),fhPhiPrompt(0),fhEtaPrompt(0), + fhPtThresIsolatedPrompt(), fhPtFracIsolatedPrompt(), fhPtSumIsolatedPrompt(), + fhPtFragmentation(0),fhPhiFragmentation(0),fhEtaFragmentation(0), + fhPtThresIsolatedFragmentation(), fhPtFracIsolatedFragmentation(), fhPtSumIsolatedFragmentation(), + fhPtPi0Decay(0),fhPhiPi0Decay(0),fhEtaPi0Decay(0), + fhPtThresIsolatedPi0Decay(), fhPtFracIsolatedPi0Decay(), fhPtSumIsolatedPi0Decay(), + fhPtOtherDecay(0),fhPhiOtherDecay(0),fhEtaOtherDecay(0), + fhPtThresIsolatedOtherDecay(), fhPtFracIsolatedOtherDecay(), fhPtSumIsolatedOtherDecay(), + fhPtConversion(0),fhPhiConversion(0),fhEtaConversion(0), + fhPtThresIsolatedConversion(), fhPtFracIsolatedConversion(), fhPtSumIsolatedConversion(), + fhPtUnknown(0),fhPhiUnknown(0),fhEtaUnknown(0), + fhPtThresIsolatedUnknown(), fhPtFracIsolatedUnknown(), fhPtSumIsolatedUnknown() +{ + //default ctor + + //Initialize parameters + InitParameters(); + + for(Int_t i = 0; i < 5 ; i++){ + fConeSizes[i] = 0 ; + fhPtSumIsolated[i] = 0 ; + + fhPtSumIsolatedPrompt[i] = 0 ; + fhPtSumIsolatedFragmentation[i] = 0 ; + fhPtSumIsolatedPi0Decay[i] = 0 ; + fhPtSumIsolatedOtherDecay[i] = 0 ; + fhPtSumIsolatedConversion[i] = 0 ; + fhPtSumIsolatedUnknown[i] = 0 ; + + for(Int_t j = 0; j < 5 ; j++){ + fhPtThresIsolated[i][j] = 0 ; + fhPtFracIsolated[i][j] = 0 ; + + fhPtThresIsolatedPrompt[i][j] = 0 ; + fhPtThresIsolatedFragmentation[i][j] = 0 ; + fhPtThresIsolatedPi0Decay[i][j] = 0 ; + fhPtThresIsolatedOtherDecay[i][j] = 0 ; + fhPtThresIsolatedConversion[i][j] = 0 ; + fhPtThresIsolatedUnknown[i][j] = 0 ; + + fhPtFracIsolatedPrompt[i][j] = 0 ; + fhPtFracIsolatedFragmentation[i][j] = 0 ; + fhPtFracIsolatedPi0Decay[i][j] = 0 ; + fhPtFracIsolatedOtherDecay[i][j] = 0 ; + fhPtFracIsolatedConversion[i][j] = 0 ; + fhPtFracIsolatedUnknown[i][j] = 0 ; + + } + } + + for(Int_t i = 0; i < 5 ; i++){ + fPtFractions[i]= 0 ; + fPtThresholds[i]= 0 ; + } + + +} + +//____________________________________________________________________________ +AliAnaGammaDirect::AliAnaGammaDirect(const AliAnaGammaDirect & g) : + AliAnaPartCorrBaseClass(g), fDetector(g.fDetector), + fMakeIC(g.fMakeIC), fReMakeIC(g.fReMakeIC), + fMakeSeveralIC(g.fMakeSeveralIC), fMakeInvMass(g.fMakeInvMass), + fhPtGamma(g.fhPtGamma),fhPhiGamma(g.fhPhiGamma), + fhEtaGamma(g.fhEtaGamma), fhConeSumPt(g.fhConeSumPt), + //Several IC + fNCones(g.fNCones),fNPtThresFrac(g.fNPtThresFrac), fConeSizes(), fPtThresholds(), fPtFractions(), + fhPtThresIsolated(), fhPtFracIsolated(), fhPtSumIsolated(), + //MC + fhPtPrompt(g.fhPtPrompt),fhPhiPrompt(g.fhPhiPrompt),fhEtaPrompt(g.fhEtaPrompt), + fhPtThresIsolatedPrompt(), fhPtFracIsolatedPrompt(), fhPtSumIsolatedPrompt(), + fhPtFragmentation(g.fhPtFragmentation),fhPhiFragmentation(g.fhPhiFragmentation),fhEtaFragmentation(g.fhEtaFragmentation), + fhPtThresIsolatedFragmentation(), fhPtFracIsolatedFragmentation(), fhPtSumIsolatedFragmentation(), + fhPtPi0Decay(g.fhPtPi0Decay),fhPhiPi0Decay(g.fhPhiPi0Decay),fhEtaPi0Decay(g.fhEtaPi0Decay), + fhPtThresIsolatedPi0Decay(), fhPtFracIsolatedPi0Decay(), fhPtSumIsolatedPi0Decay(), + fhPtOtherDecay(g.fhPtOtherDecay),fhPhiOtherDecay(g.fhPhiOtherDecay),fhEtaOtherDecay(g.fhEtaOtherDecay), + fhPtThresIsolatedOtherDecay(), fhPtFracIsolatedOtherDecay(), fhPtSumIsolatedOtherDecay(), + fhPtConversion(g. fhPtConversion),fhPhiConversion(g.fhPhiConversion),fhEtaConversion(g.fhEtaConversion), + fhPtThresIsolatedConversion(), fhPtFracIsolatedConversion(), fhPtSumIsolatedConversion(), + fhPtUnknown(g.fhPtUnknown),fhPhiUnknown(g.fhPhiUnknown),fhEtaUnknown(g.fhEtaUnknown), + fhPtThresIsolatedUnknown(), fhPtFracIsolatedUnknown(), fhPtSumIsolatedUnknown() +{ + // cpy ctor + + //Several IC + for(Int_t i = 0; i < fNCones ; i++){ + fConeSizes[i] = g.fConeSizes[i]; + fhPtSumIsolated[i] = g.fhPtSumIsolated[i]; + + fhPtSumIsolatedPrompt[i] = g.fhPtSumIsolatedPrompt[i]; + fhPtSumIsolatedFragmentation[i] = g.fhPtSumIsolatedFragmentation[i]; + fhPtSumIsolatedPi0Decay[i] = g.fhPtSumIsolatedPi0Decay[i]; + fhPtSumIsolatedOtherDecay[i] = g.fhPtSumIsolatedOtherDecay[i]; + fhPtSumIsolatedConversion[i] = g.fhPtSumIsolatedConversion[i]; + fhPtSumIsolatedUnknown[i] = g.fhPtSumIsolatedUnknown[i]; + + for(Int_t j = 0; j < fNPtThresFrac ; j++){ + fhPtThresIsolated[i][j] = g.fhPtThresIsolated[i][j]; + fhPtFracIsolated[i][j] = g.fhPtFracIsolated[i][j]; + + fhPtThresIsolatedPrompt[i][j] = g.fhPtThresIsolatedPrompt[i][j]; + fhPtThresIsolatedFragmentation[i][j] = g.fhPtThresIsolatedFragmentation[i][j]; + fhPtThresIsolatedPi0Decay[i][j] = g.fhPtThresIsolatedPi0Decay[i][j]; + fhPtThresIsolatedOtherDecay[i][j] = g.fhPtThresIsolatedOtherDecay[i][j]; + fhPtThresIsolatedConversion[i][j] = g.fhPtThresIsolatedConversion[i][j]; + fhPtThresIsolatedUnknown[i][j] = g.fhPtThresIsolatedUnknown[i][j]; + + fhPtFracIsolatedPrompt[i][j] = g.fhPtFracIsolatedPrompt[i][j]; + fhPtFracIsolatedFragmentation[i][j] = g.fhPtFracIsolatedFragmentation[i][j]; + fhPtFracIsolatedPi0Decay[i][j] = g.fhPtFracIsolatedPi0Decay[i][j]; + fhPtFracIsolatedOtherDecay[i][j] = g.fhPtFracIsolatedOtherDecay[i][j]; + fhPtFracIsolatedConversion[i][j] = g.fhPtFracIsolatedConversion[i][j]; + fhPtFracIsolatedUnknown[i][j] = g.fhPtFracIsolatedUnknown[i][j]; + + } + } + + for(Int_t i = 0; i < fNPtThresFrac ; i++){ + fPtFractions[i]= g.fPtFractions[i]; + fPtThresholds[i]= g.fPtThresholds[i]; + } + +} + +//_________________________________________________________________________ +AliAnaGammaDirect & AliAnaGammaDirect::operator = (const AliAnaGammaDirect & g) +{ + // assignment operator + + if(&g == this) return *this; + + fMakeIC = g.fMakeIC ; + fReMakeIC = g.fReMakeIC ; + fMakeSeveralIC = g.fMakeSeveralIC ; + fMakeInvMass = g.fMakeInvMass ; + fDetector = g.fDetector ; + + fhPtGamma = g.fhPtGamma ; + fhPhiGamma = g.fhPhiGamma ; + fhEtaGamma = g.fhEtaGamma ; + fhConeSumPt = g.fhConeSumPt ; + + fhPtPrompt = g.fhPtPrompt; + fhPhiPrompt = g.fhPhiPrompt; + fhEtaPrompt = g.fhEtaPrompt; + fhPtFragmentation = g.fhPtFragmentation; + fhPhiFragmentation = g.fhPhiFragmentation; + fhEtaFragmentation = g.fhEtaFragmentation; + fhPtPi0Decay = g.fhPtPi0Decay; + fhPhiPi0Decay = g.fhPhiPi0Decay; + fhEtaPi0Decay = g.fhEtaPi0Decay; + fhPtOtherDecay = g.fhPtOtherDecay; + fhPhiOtherDecay = g.fhPhiOtherDecay; + fhEtaOtherDecay = g.fhEtaOtherDecay; + fhPtConversion = g. fhPtConversion; + fhPhiConversion = g.fhPhiConversion; + fhEtaConversion = g.fhEtaConversion; + fhPtUnknown = g.fhPtUnknown; + fhPhiUnknown = g.fhPhiUnknown; + fhEtaUnknown = g.fhEtaUnknown; + + //Several IC + fNCones = g.fNCones ; + fNPtThresFrac = g.fNPtThresFrac ; + + for(Int_t i = 0; i < fNCones ; i++){ + fConeSizes[i] = g.fConeSizes[i]; + fhPtSumIsolated[i] = g.fhPtSumIsolated[i] ; + + fhPtSumIsolatedPrompt[i] = g.fhPtSumIsolatedPrompt[i]; + fhPtSumIsolatedFragmentation[i] = g.fhPtSumIsolatedFragmentation[i]; + fhPtSumIsolatedPi0Decay[i] = g.fhPtSumIsolatedPi0Decay[i]; + fhPtSumIsolatedOtherDecay[i] = g.fhPtSumIsolatedOtherDecay[i]; + fhPtSumIsolatedConversion[i] = g.fhPtSumIsolatedConversion[i]; + fhPtSumIsolatedUnknown[i] = g.fhPtSumIsolatedUnknown[i]; + + for(Int_t j = 0; j < fNPtThresFrac ; j++){ + fhPtThresIsolated[i][j] = g.fhPtThresIsolated[i][j] ; + fhPtFracIsolated[i][j] = g.fhPtFracIsolated[i][j] ; + + fhPtThresIsolatedPrompt[i][j] = g.fhPtThresIsolatedPrompt[i][j]; + fhPtThresIsolatedFragmentation[i][j] = g.fhPtThresIsolatedFragmentation[i][j]; + fhPtThresIsolatedPi0Decay[i][j] = g.fhPtThresIsolatedPi0Decay[i][j]; + fhPtThresIsolatedOtherDecay[i][j] = g.fhPtThresIsolatedOtherDecay[i][j]; + fhPtThresIsolatedConversion[i][j] = g.fhPtThresIsolatedConversion[i][j]; + fhPtThresIsolatedUnknown[i][j] = g.fhPtThresIsolatedUnknown[i][j]; + + fhPtFracIsolatedPrompt[i][j] = g.fhPtFracIsolatedPrompt[i][j]; + fhPtFracIsolatedFragmentation[i][j] = g.fhPtFracIsolatedFragmentation[i][j]; + fhPtFracIsolatedPi0Decay[i][j] = g.fhPtFracIsolatedPi0Decay[i][j]; + fhPtFracIsolatedOtherDecay[i][j] = g.fhPtFracIsolatedOtherDecay[i][j]; + fhPtFracIsolatedConversion[i][j] = g.fhPtFracIsolatedConversion[i][j]; + fhPtFracIsolatedUnknown[i][j] = g.fhPtFracIsolatedUnknown[i][j]; + + } + } + + for(Int_t i = 0; i < fNPtThresFrac ; i++){ + fPtThresholds[i]= g.fPtThresholds[i]; + fPtFractions[i]= g.fPtFractions[i]; + } + + return *this; + +} + +//____________________________________________________________________________ +AliAnaGammaDirect::~AliAnaGammaDirect() +{ + //dtor + //do not delete histograms + + delete [] fConeSizes ; + delete [] fPtThresholds ; + delete [] fPtFractions ; + +} +//_________________________________________________________________________ +Bool_t AliAnaGammaDirect::CheckInvMass(const Int_t icalo,const TLorentzVector mom, Double_t *vertex, TClonesArray * pl){ + //Search if there is a companion decay photon to the candidate + // and discard it in such case + TLorentzVector mom2 ; + for(Int_t jcalo = 0; jcalo < pl->GetEntriesFast(); jcalo++){ + if(icalo==jcalo) continue ; + AliAODCaloCluster * calo = dynamic_cast (pl->At(jcalo)); + + //Cluster selection, not charged, with photon id and in fidutial cut, fill TLorentz + if(!SelectCluster(calo, vertex, mom2)) continue ; + + //Select good pair (good phit, pt cuts, aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(mom, mom2)){ + if(GetDebug()>1)printf("Selected gamma pair: pt %f, phi %f, eta%f",(mom+mom2).Pt(), (mom+mom2).Phi(), (mom+mom2).Eta()); + return kTRUE ; + } + }//loop + + return kFALSE; + +} +//_________________________________________________________________________ +Int_t AliAnaGammaDirect::CheckOrigin(const Int_t label){ + //Play with the MC stack if available + //Check origin of the candidates, good for PYTHIA + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("Stack is not available, check analysis settings in configuration file, STOP!!"); + + if(label >= 0 && label < stack->GetNtrack()){ + //Mother + TParticle * mom = stack->Particle(label); + Int_t mPdg = TMath::Abs(mom->GetPdgCode()); + Int_t mStatus = mom->GetStatusCode() ; + Int_t iParent = mom->GetFirstMother() ; + if(label < 8 ) printf("Mother is parton %d\n",iParent); + + //GrandParent + TParticle * parent = new TParticle ; + Int_t pPdg = -1; + Int_t pStatus =-1; + if(iParent > 0){ + parent = stack->Particle(iParent); + pPdg = TMath::Abs(parent->GetPdgCode()); + pStatus = parent->GetStatusCode(); + } + else + printf("Parent with label %d\n",iParent); + + //return tag + if(mPdg == 22){ + if(mStatus == 1){ + if(iParent < 8) { + if(pPdg == 22) return kPrompt; + else return kFragmentation; + } + else if(pStatus == 11){ + if(pPdg == 111) return kPi0Decay ; + else if (pPdg == 321) return kEtaDecay ; + else return kOtherDecay ; + } + }//Status 1 : Pythia generated + else if(mStatus == 0){ + if(pPdg ==22 || pPdg ==11) return kConversion ; + if(pPdg == 111) return kPi0Decay ; + else if (pPdg == 221) return kEtaDecay ; + else return kOtherDecay ; + }//status 0 : geant generated + }//Mother gamma + else if(mPdg == 111) return kPi0 ; + else if(mPdg == 221) return kEta ; + else if(mPdg ==11){ + if(mStatus == 0) return kConversion ; + else return kElectron ; + } + else return kUnknown; + }//Good label value + else{ + if(label < 0 ) printf("*** bad label or no stack ***: label %d \n", label); + if(label >= stack->GetNtrack()) printf("*** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack()); + return kUnknown; + }//Bad label + + return kUnknown; + +} + +//________________________________________________________________________ +TList * AliAnaGammaDirect::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in outputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("DirectGammaHistos") ; + + //Histograms of highest gamma identified in Event + fhPtGamma = new TH1F("hPtGamma","Number of #gamma over calorimeter",240,0,120); + fhPtGamma->SetYTitle("N"); + fhPtGamma->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtGamma) ; + + fhPhiGamma = new TH2F + ("hPhiGamma","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiGamma->SetYTitle("#phi"); + fhPhiGamma->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiGamma) ; + + fhEtaGamma = new TH2F + ("hEtaGamma","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaGamma->SetYTitle("#eta"); + fhEtaGamma->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaGamma) ; + + if(!fMakeSeveralIC){ + fhConeSumPt = new TH2F + ("hConePtSum","#Sigma p_{T} in cone ",200,0,120,100,0,100); + fhConeSumPt->SetYTitle("#Sigma p_{T}"); + fhConeSumPt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhConeSumPt) ; + } + + if(IsDataMC()){ + + fhPtPrompt = new TH1F("hPtPrompt","Number of #gamma over calorimeter",240,0,120); + fhPtPrompt->SetYTitle("N"); + fhPtPrompt->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtPrompt) ; + + fhPhiPrompt = new TH2F + ("hPhiPrompt","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiPrompt->SetYTitle("#phi"); + fhPhiPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiPrompt) ; + + fhEtaPrompt = new TH2F + ("hEtaPrompt","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaPrompt->SetYTitle("#eta"); + fhEtaPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaPrompt) ; + + fhPtFragmentation = new TH1F("hPtFragmentation","Number of #gamma over calorimeter",240,0,120); + fhPtFragmentation->SetYTitle("N"); + fhPtFragmentation->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtFragmentation) ; + + fhPhiFragmentation = new TH2F + ("hPhiFragmentation","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiFragmentation->SetYTitle("#phi"); + fhPhiFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiFragmentation) ; + + fhEtaFragmentation = new TH2F + ("hEtaFragmentation","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaFragmentation->SetYTitle("#eta"); + fhEtaFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaFragmentation) ; + + fhPtPi0Decay = new TH1F("hPtPi0Decay","Number of #gamma over calorimeter",240,0,120); + fhPtPi0Decay->SetYTitle("N"); + fhPtPi0Decay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtPi0Decay) ; + + fhPhiPi0Decay = new TH2F + ("hPhiPi0Decay","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiPi0Decay->SetYTitle("#phi"); + fhPhiPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiPi0Decay) ; + + fhEtaPi0Decay = new TH2F + ("hEtaPi0Decay","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaPi0Decay->SetYTitle("#eta"); + fhEtaPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaPi0Decay) ; + + fhPtOtherDecay = new TH1F("hPtOtherDecay","Number of #gamma over calorimeter",240,0,120); + fhPtOtherDecay->SetYTitle("N"); + fhPtOtherDecay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtOtherDecay) ; + + fhPhiOtherDecay = new TH2F + ("hPhiOtherDecay","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiOtherDecay->SetYTitle("#phi"); + fhPhiOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiOtherDecay) ; + + fhEtaOtherDecay = new TH2F + ("hEtaOtherDecay","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaOtherDecay->SetYTitle("#eta"); + fhEtaOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaOtherDecay) ; + + fhPtConversion = new TH1F("hPtConversion","Number of #gamma over calorimeter",240,0,120); + fhPtConversion->SetYTitle("N"); + fhPtConversion->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtConversion) ; + + fhPhiConversion = new TH2F + ("hPhiConversion","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiConversion->SetYTitle("#phi"); + fhPhiConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiConversion) ; + + fhEtaConversion = new TH2F + ("hEtaConversion","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaConversion->SetYTitle("#eta"); + fhEtaConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaConversion) ; + + fhPtUnknown = new TH1F("hPtUnknown","Number of #gamma over calorimeter",240,0,120); + fhPtUnknown->SetYTitle("N"); + fhPtUnknown->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtUnknown) ; + + fhPhiUnknown = new TH2F + ("hPhiUnknown","#phi_{#gamma}",200,0,120,200,0,7); + fhPhiUnknown->SetYTitle("#phi"); + fhPhiUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiUnknown) ; + + fhEtaUnknown = new TH2F + ("hEtaUnknown","#phi_{#gamma}",200,0,120,200,-0.8,0.8); + fhEtaUnknown->SetYTitle("#eta"); + fhEtaUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaUnknown) ; + }//Histos with MC + + if(fMakeSeveralIC){ + char name[128]; + char title[128]; + for(Int_t icone = 0; iconeSetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolated[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolated[icone]) ; + + if(IsDataMC()){ + sprintf(name,"hPtSumIsolatedPrompt_Cone_%d",icone); + sprintf(title,"Candidate Prompt cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedPrompt[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedPrompt[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedPrompt[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedPrompt[icone]) ; + + sprintf(name,"hPtSumIsolatedFragmentation_Cone_%d",icone); + sprintf(title,"Candidate Fragmentation cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedFragmentation[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedFragmentation[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedFragmentation[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedFragmentation[icone]) ; + + sprintf(name,"hPtSumIsolatedPi0Decay_Cone_%d",icone); + sprintf(title,"Candidate Pi0Decay cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedPi0Decay[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedPi0Decay[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedPi0Decay[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedPi0Decay[icone]) ; + + sprintf(name,"hPtSumIsolatedOtherDecay_Cone_%d",icone); + sprintf(title,"Candidate OtherDecay cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedOtherDecay[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedOtherDecay[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedOtherDecay[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedOtherDecay[icone]) ; + + sprintf(name,"hPtSumIsolatedConversion_Cone_%d",icone); + sprintf(title,"Candidate Conversion cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedConversion[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedConversion[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedConversion[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedConversion[icone]) ; + + sprintf(name,"hPtSumIsolatedUnknown_Cone_%d",icone); + sprintf(title,"Candidate Unknown cone sum p_{T} for cone size %d vs candidate p_{T}",icone); + fhPtSumIsolatedUnknown[icone] = new TH2F(name, title,240,0,120,120,0,10); + fhPtSumIsolatedUnknown[icone]->SetYTitle("#Sigma p_{T} (GeV/c)"); + fhPtSumIsolatedUnknown[icone]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtSumIsolatedUnknown[icone]) ; + + }//Histos with MC + + for(Int_t ipt = 0; iptSetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolated[icone][ipt]) ; + + sprintf(name,"hPtFracIsol_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolated[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolated[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolated[icone][ipt]) ; + + if(IsDataMC()){ + sprintf(name,"hPtThresIsolPrompt_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Prompt p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedPrompt[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedPrompt[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedPrompt[icone][ipt]) ; + + sprintf(name,"hPtFracIsolPrompt_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Prompt p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedPrompt[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedPrompt[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedPrompt[icone][ipt]) ; + + sprintf(name,"hPtThresIsolFragmentation_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Fragmentation p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedFragmentation[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedFragmentation[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedFragmentation[icone][ipt]) ; + + sprintf(name,"hPtFracIsolFragmentation_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Fragmentation p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedFragmentation[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedFragmentation[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedFragmentation[icone][ipt]) ; + + sprintf(name,"hPtThresIsolPi0Decay_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Pi0Decay p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedPi0Decay[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedPi0Decay[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedPi0Decay[icone][ipt]) ; + + sprintf(name,"hPtFracIsolPi0Decay_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Pi0Decay p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedPi0Decay[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedPi0Decay[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedPi0Decay[icone][ipt]) ; + + sprintf(name,"hPtThresIsolOtherDecay_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate OtherDecay p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedOtherDecay[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedOtherDecay[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedOtherDecay[icone][ipt]) ; + + sprintf(name,"hPtFracIsolOtherDecay_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate OtherDecay p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedOtherDecay[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedOtherDecay[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedOtherDecay[icone][ipt]) ; + + sprintf(name,"hPtThresIsolConversion_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Conversion p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedConversion[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedConversion[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedConversion[icone][ipt]) ; + + sprintf(name,"hPtFracIsolConversion_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Conversion p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedConversion[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedConversion[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedConversion[icone][ipt]) ; + + sprintf(name,"hPtThresIsolUnknown_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Unknown p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtThresIsolatedUnknown[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtThresIsolatedUnknown[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtThresIsolatedUnknown[icone][ipt]) ; + + sprintf(name,"hPtFracIsolUnknown_Cone_%d_Pt%d",icone,ipt); + sprintf(title,"Isolated candidate Unknown p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt); + fhPtFracIsolatedUnknown[icone][ipt] = new TH1F(name, title,240,0,120); + fhPtFracIsolatedUnknown[icone][ipt]->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPtFracIsolatedUnknown[icone][ipt]) ; + + }//Histos with MC + + }//icone loop + }//ipt loop + } + + //Keep neutral meson selection histograms if requiered + //Setting done in AliNeutralMesonSelection + if(fMakeInvMass && GetNeutralMesonSelection()){ + TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ; + cout<<"NMSHistos "<< nmsHistos<AreNeutralMesonSelectionHistosKept()) + for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ; + } + + return outputContainer ; + +} + +//__________________________________________________________________ +void AliAnaGammaDirect::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + //Search for the isolated photon in fDetector with pt > GetMinPt() + + //Fill CaloClusters if working with ESDs + //if(GetReader()->GetDataType() == AliCaloTrackReader::kESD) ConnectAODCaloClusters(); + + Int_t n = 0, nfrac = 0; + Bool_t isolated = kFALSE ; + Float_t coneptsum = 0 ; + TClonesArray * pl = new TClonesArray; + + //Get vertex for photon momentum calculation + Double_t vertex[]={0,0,0} ; //vertex ; + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Select the detector of the photon + if(fDetector == "PHOS") + pl = GetAODPHOS(); + else if (fDetector == "EMCAL") + pl = GetAODEMCAL(); + //cout<<"Number of entries "<GetEntriesFast()<GetEntriesFast(); icalo++){ + AliAODCaloCluster * calo = dynamic_cast (pl->At(icalo)); + + //Cluster selection, not charged, with photon id and in fidutial cut + if(!SelectCluster(calo,vertex,mom)) continue ; + + //If too small pt, skip + if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ; + + //Play with the MC stack if available + Int_t tag =-1; + if(IsDataMC()){ + //Check origin of the candidates + tag = CheckOrigin(calo->GetLabel(0)); + if(GetDebug() > 0) printf("Origin of candidate %d\n",tag); + }//Work with stack also + + //Check invariant mass + Bool_t decay = kFALSE ; + if(fMakeInvMass) decay = CheckInvMass(icalo,mom,vertex,pl); + if(decay) continue ; + + //Create AOD for analysis + AliAODParticleCorrelation ph = AliAODParticleCorrelation(mom); + ph.SetLabel(calo->GetLabel(0)); + ph.SetPdg(AliCaloPID::kPhoton); + ph.SetDetector(fDetector); + ph.SetTag(tag); + if(fMakeIC){ + n=0; nfrac = 0; isolated = kFALSE; coneptsum = 0; + GetIsolationCut()->MakeIsolationCut((TSeqCollection*)GetAODCTS(), (TSeqCollection*)pl, + vertex, kTRUE, &ph,icalo,-1, + n,nfrac,coneptsum, isolated); + if(isolated){ + //cout<<"Isolated : E "< 1) printf("End fill AODs "); + +} + +//__________________________________________________________________ +void AliAnaGammaDirect::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + Int_t n = 0, nfrac = 0; + Bool_t isolated = kFALSE ; + Float_t coneptsum = 0 ; + //cout<<"MakeAnalysisFillHistograms"<GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(v); + + //Loop on stored AOD photons + Int_t naod = GetAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("histo aod branch entries %d\n", naod); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* ph = dynamic_cast (GetAODBranch()->At(iaod)); + Int_t pdg = ph->GetPdg(); + + //Only isolate photons in detector fDetector + if(pdg != AliCaloPID::kPhoton || ph->GetDetector() != fDetector) continue; + + if(fMakeSeveralIC) { + //Analysis of multiple IC at same time + MakeSeveralICAnalysis(ph,v); + continue; + } + else if(fReMakeIC){ + //In case a more strict IC is needed in the produced AOD + n=0; nfrac = 0; isolated = kFALSE; coneptsum = 0; + GetIsolationCut()->MakeIsolationCut((TSeqCollection*)ph->GetRefIsolationConeTracks(), + (TSeqCollection*)ph->GetRefIsolationConeClusters(), + v, kFALSE, ph,-1,-1, + n,nfrac,coneptsum, isolated); + } + + //Fill histograms (normal case) + if(!fReMakeIC || (fReMakeIC && isolated)){ + + //printf("Isolated Gamma: pt %f, phi %f, eta %f", ph->Pt(),ph->Phi(),ph->Eta()) ; + + //Fill prompt gamma histograms + Float_t ptcluster = ph->Pt(); + Float_t phicluster = ph->Phi(); + Float_t etacluster = ph->Eta(); + + fhPtGamma ->Fill(ptcluster); + fhPhiGamma ->Fill(ptcluster,phicluster); + fhEtaGamma ->Fill(ptcluster,etacluster); + fhConeSumPt->Fill(ptcluster,coneptsum); + + if(IsDataMC()){ + Int_t tag =ph->GetTag(); + + if(tag == kPrompt){ + fhPtPrompt ->Fill(ptcluster); + fhPhiPrompt ->Fill(ptcluster,phicluster); + fhEtaPrompt ->Fill(ptcluster,etacluster); + } + else if(tag==kFragmentation) + { + fhPtFragmentation ->Fill(ptcluster); + fhPhiFragmentation ->Fill(ptcluster,phicluster); + fhEtaFragmentation ->Fill(ptcluster,etacluster); + } + else if(tag==kPi0Decay) + { + fhPtPi0Decay ->Fill(ptcluster); + fhPhiPi0Decay ->Fill(ptcluster,phicluster); + fhEtaPi0Decay ->Fill(ptcluster,etacluster); + } + else if(tag==kEtaDecay || tag==kOtherDecay) + { + fhPtOtherDecay ->Fill(ptcluster); + fhPhiOtherDecay ->Fill(ptcluster,phicluster); + fhEtaOtherDecay ->Fill(ptcluster,etacluster); + } + else if(tag==kConversion) + { + fhPtConversion ->Fill(ptcluster); + fhPhiConversion ->Fill(ptcluster,phicluster); + fhEtaConversion ->Fill(ptcluster,etacluster); + } + else{ + + fhPtUnknown ->Fill(ptcluster); + fhPhiUnknown ->Fill(ptcluster,phicluster); + fhEtaUnknown ->Fill(ptcluster,etacluster); + } + }//Histograms with MC + + } + }// aod loop + +} + +//____________________________________________________________________________ +void AliAnaGammaDirect::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fDetector = "PHOS" ; + fMakeIC = kTRUE; + fReMakeIC = kFALSE ; + fMakeSeveralIC = kFALSE ; + fMakeInvMass = kFALSE ; + + //----------- Several IC----------------- + fNCones = 5 ; + fNPtThresFrac = 6 ; + fConeSizes[0] = 0.1; fConeSizes[1] = 0.2; fConeSizes[2] = 0.3; fConeSizes[3] = 0.4; fConeSizes[4] = 0.5; + fPtThresholds[0]=0.; fPtThresholds[1]=1.; fPtThresholds[2]=2.; fPtThresholds[3]=3.; fPtThresholds[4]=4.;fPtThresholds[5]=5.; + fPtFractions[0]=0.05; fPtFractions[1]=0.075; fPtFractions[2]=0.1; fPtFractions[3]=1.25; fPtFractions[4]=1.5;fPtFractions[5]=2.; + +} + +//__________________________________________________________________ +void AliAnaGammaDirect::MakeSeveralICAnalysis(AliAODParticleCorrelation* ph, Double_t v[3]) +{ + //Isolation Cut Analysis for both methods and different pt cuts and cones + Float_t ptC = ph->Pt(); + Float_t phiC = ph->Phi(); + Float_t etaC = ph->Eta(); + + fhPtGamma->Fill(ptC); + fhPhiGamma->Fill(ptC,ph->Phi()); + fhEtaGamma->Fill(ptC,ph->Eta()); + Int_t tag =ph->GetTag(); + + if(IsDataMC()){ + if(tag == kPrompt){ + fhPtPrompt ->Fill(ptC); + fhPhiPrompt ->Fill(ptC,phiC); + fhEtaPrompt ->Fill(ptC,etaC); + } + else if(tag==kFragmentation) + { + fhPtFragmentation ->Fill(ptC); + fhPhiFragmentation ->Fill(ptC,phiC); + fhEtaFragmentation ->Fill(ptC,etaC); + } + else if(tag==kPi0Decay) + { + fhPtPi0Decay ->Fill(ptC); + fhPhiPi0Decay ->Fill(ptC,phiC); + fhEtaPi0Decay ->Fill(ptC,etaC); + } + else if(tag==kEtaDecay || tag==kOtherDecay) + { + fhPtOtherDecay ->Fill(ptC); + fhPhiOtherDecay ->Fill(ptC,phiC); + fhEtaOtherDecay ->Fill(ptC,etaC); + } + else if(tag==kConversion) + { + fhPtConversion ->Fill(ptC); + fhPhiConversion ->Fill(ptC,phiC); + fhEtaConversion ->Fill(ptC,etaC); + } + else{ + + fhPtUnknown ->Fill(ptC); + fhPhiUnknown ->Fill(ptC,phiC); + fhEtaUnknown ->Fill(ptC,etaC); + } + }//Histograms with MC + //Keep original setting used when filling AODs, reset at end of analysis + Float_t ptthresorg = GetIsolationCut()->GetPtThreshold(); + Float_t ptfracorg = GetIsolationCut()->GetPtFraction(); + Float_t rorg = GetIsolationCut()->GetConeSize(); + + Float_t coneptsum = 0 ; + Int_t n[10][10];//[fNCones][fNPtThresFrac]; + Int_t nfrac[10][10];//[fNCones][fNPtThresFrac]; + Bool_t isolated = kFALSE; + + for(Int_t icone = 0; iconeSetConeSize(fConeSizes[icone]); + coneptsum = 0 ; + for(Int_t ipt = 0; iptSetPtThreshold(fPtThresholds[ipt]); + GetIsolationCut()->MakeIsolationCut((TSeqCollection*)ph->GetRefIsolationConeTracks(), + (TSeqCollection*)ph->GetRefIsolationConeClusters(), + v, kFALSE, ph,-1,-1, + n[icone][ipt],nfrac[icone][ipt],coneptsum, isolated); + if(n[icone][ipt] == 0) { + fhPtThresIsolated[icone][ipt]->Fill(ptC); + if(IsDataMC()){ + if(tag==kPrompt) fhPtThresIsolatedPrompt[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kConversion) fhPtThresIsolatedConversion[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kFragmentation) fhPtThresIsolatedFragmentation[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kPi0Decay) fhPtThresIsolatedPi0Decay[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kOtherDecay || tag==kEtaDecay) fhPtThresIsolatedOtherDecay[icone][ipt]->Fill(ptC,coneptsum) ; + else fhPtThresIsolatedUnknown[icone][ipt]->Fill(ptC,coneptsum) ; + } + } + if(nfrac[icone][ipt] == 0) { + fhPtFracIsolated[icone][ipt]->Fill(ptC); + if(IsDataMC()){ + if(tag==kPrompt) fhPtFracIsolatedPrompt[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kConversion) fhPtFracIsolatedConversion[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kFragmentation) fhPtFracIsolatedFragmentation[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kPi0Decay) fhPtFracIsolatedPi0Decay[icone][ipt]->Fill(ptC,coneptsum) ; + else if(tag==kOtherDecay || tag==kEtaDecay) fhPtFracIsolatedOtherDecay[icone][ipt]->Fill(ptC,coneptsum) ; + else fhPtFracIsolatedUnknown[icone][ipt]->Fill(ptC,coneptsum) ; + } + } + }//pt thresh loop + fhPtSumIsolated[icone]->Fill(ptC,coneptsum) ; + if(IsDataMC()){ + if(tag==kPrompt) fhPtSumIsolatedPrompt[icone]->Fill(ptC,coneptsum) ; + else if(tag==kConversion) fhPtSumIsolatedConversion[icone]->Fill(ptC,coneptsum) ; + else if(tag==kFragmentation) fhPtSumIsolatedFragmentation[icone]->Fill(ptC,coneptsum) ; + else if(tag==kPi0Decay) fhPtSumIsolatedPi0Decay[icone]->Fill(ptC,coneptsum) ; + else if(tag==kOtherDecay || tag==kEtaDecay) fhPtSumIsolatedOtherDecay[icone]->Fill(ptC,coneptsum) ; + else fhPtSumIsolatedUnknown[icone]->Fill(ptC,coneptsum) ; + } + + }//cone size loop + + //Reset original parameters for AOD analysis + GetIsolationCut()->SetPtThreshold(ptthresorg); + GetIsolationCut()->SetPtFraction(ptfracorg); + GetIsolationCut()->SetConeSize(rorg); + +} + +//__________________________________________________________________ +void AliAnaGammaDirect::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; + + printf("Min Gamma pT = %2.2f\n", GetMinPt()) ; + printf("Max Gamma pT = %3.2f\n", GetMaxPt()) ; + +// if(IsCaloPIDOn())printf("Check PID \n") ; +// if(IsCaloPIDRecalculationOn())printf("Recalculate PID \n") ; +// if(IsFidutialCutOn())printf("Check Fidutial cut \n") ; + printf("Make Isolation = %d \n", fMakeIC) ; + printf("ReMake Isolation = %d \n", fReMakeIC) ; + printf("Make Several Isolation = %d \n", fMakeSeveralIC) ; + + if(fMakeSeveralIC){ + printf("N Cone Sizes = %d\n", fNCones) ; + printf("Cone Sizes = \n") ; + for(Int_t i = 0; i < fNCones; i++) + printf(" %1.2f;", fConeSizes[i]) ; + printf(" \n") ; + + printf("N pT thresholds/fractions = %d\n", fNPtThresFrac) ; + printf(" pT thresholds = \n") ; + for(Int_t i = 0; i < fNPtThresFrac; i++) + printf(" %2.2f;", fPtThresholds[i]) ; + + printf(" \n") ; + + printf(" pT fractions = \n") ; + for(Int_t i = 0; i < fNPtThresFrac; i++) + printf(" %2.2f;", fPtFractions[i]) ; + + } + + printf(" \n") ; + +} + +//____________________________________________________________________________ +Bool_t AliAnaGammaDirect::SelectCluster(AliAODCaloCluster * calo, Double_t vertex[3], TLorentzVector & mom){ + //Select cluster depending on its pid and acceptance selections + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) return kFALSE ; + + //Check PID + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + Int_t pdg = AliCaloPID::kPhoton; + if(IsCaloPIDOn()){ + //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) + //or redo PID, recommended option for EMCal. + if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) + pdg = GetCaloPID()->GetPdg(fDetector,calo->PID(),mom.E());//PID with weights + else + pdg = GetCaloPID()->GetPdg(fDetector,mom,calo->GetM02(),0,0,0,0);//PID recalculated + + if(GetDebug() > 1) printf("PDG of identified particle %d\n",pdg); + + //If it does not pass pid, skip + if(pdg != AliCaloPID::kPhoton) return kFALSE ; + } + + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,fDetector) ; + if(! in ) return kFALSE ; + } + + if(GetDebug() > 1) printf("Correlation photon selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg); + + return kTRUE; + + } diff --git a/PWG4/PartCorr/AliAnaGammaDirect.h b/PWG4/PartCorr/AliAnaGammaDirect.h new file mode 100644 index 00000000000..7c3667bf40e --- /dev/null +++ b/PWG4/PartCorr/AliAnaGammaDirect.h @@ -0,0 +1,157 @@ +#ifndef AliAnaGammaDirect_H +#define AliAnaGammaDirect_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliAnaGammaDirect.h 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ + +// Class for the analysis of prompt gamma, isolation cut. +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) + +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include +#include +#include + +// --- ANALYSIS system --- +#include "AliAnaPartCorrBaseClass.h" +class AliAODParticleCorrelations ; + +class TList ; + +class AliAnaGammaDirect : public AliAnaPartCorrBaseClass { + +public: + + AliAnaGammaDirect() ; // default ctor + AliAnaGammaDirect(const AliAnaGammaDirect & g) ; // cpy ctor + AliAnaGammaDirect & operator = (const AliAnaGammaDirect & g) ;//cpy assignment + virtual ~AliAnaGammaDirect() ; //virtual dtor + + enum mcTypes {kPrompt, kFragmentation, kPi0Decay, kEtaDecay, kOtherDecay, kPi0, kEta, kElectron, kConversion, kUnknown}; + + Bool_t CheckInvMass(const Int_t icalo,const TLorentzVector mom, Double_t *v, TClonesArray * pl); + Int_t CheckOrigin(const Int_t label); + + TList * GetCreateOutputObjects(); + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + void MakeSeveralICAnalysis(AliAODParticleCorrelation * ph, Double_t v[3]); + + void Print(const Option_t * opt)const; + + TString GetDetector() const {return fDetector ; } + void SetDetector(TString det) {fDetector = det ; } + + Int_t GetNCones() const {return fNCones ; } + Int_t GetNPtThresFrac() const {return fNPtThresFrac ; } + Float_t GetConeSizes(Int_t i) const {return fConeSizes[i] ; } + Float_t GetPtThresholds(Int_t i) const {return fPtThresholds[i] ; } + Float_t GetPtFractions(Int_t i) const {return fPtFractions[i] ; } + + void InitParameters(); + + void SetNCones(Int_t ncs) {fNCones = ncs ; } + void SetNPtThresFrac(Int_t npt) {fNPtThresFrac = npt; } + void SetConeSizes(Int_t i, Float_t r) {fConeSizes[i] = r ; } + void SetPtThresholds(Int_t i, Float_t pt) {fPtThresholds[i] = pt; } + void SetPtFractions(Int_t i, Float_t pt) {fPtFractions[i] = pt; } + + Bool_t IsIsolationOn() {return fMakeIC ; } + void SwitchOnIsolation() { fMakeIC = kTRUE;} + void SwitchOffIsolation() { fMakeIC = kFALSE;} + + Bool_t IsReIsolationOn() {return fReMakeIC ; } + void SwitchOnReIsolation() { fReMakeIC = kTRUE;} + void SwitchOffReIsolation() { fReMakeIC = kFALSE;} + + Bool_t IsSeveralIsolationOn() {return fMakeSeveralIC ; } + void SwitchOnSeveralIsolation() { fMakeSeveralIC = kTRUE;} + void SwitchOffSeveralIsolation() { fMakeSeveralIC = kFALSE;} + + Bool_t IsInvariantMassOn() {return fMakeInvMass ; } + void SwitchOnInvariantMass() { fMakeInvMass = kTRUE;} + void SwitchOffInvariantMass() { fMakeInvMass = kFALSE;} + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t vertex[3], TLorentzVector & mom); + + private: + + TString fDetector ; // Detector where the gamma is searched; + Bool_t fMakeIC ; //Do isolation analysis + Bool_t fReMakeIC ; //Do isolation analysis + Bool_t fMakeSeveralIC ; //Do analysis for different IC + Bool_t fMakeInvMass; //Select candidate if no pair from decay + + //Histograms + TH1F * fhPtGamma ; //!Number of identified (isolated) gamma + TH2F * fhPhiGamma ; //! Phi of identified (isolated) gamma + TH2F * fhEtaGamma ; //! eta of identified (isolated) gamma + TH2F * fhConeSumPt ; //! Sum Pt in the cone + + //Prompt photon analysis data members for multiple cones and pt thresholds + Int_t fNCones ; //!Number of cone sizes to test + Int_t fNPtThresFrac ; //!Number of ptThres and ptFrac to test + Float_t fConeSizes[5] ; //! Array with cones to test + Float_t fPtThresholds[5] ; //! Array with pt thresholds to test + Float_t fPtFractions[5] ; //! Array with pt thresholds to test + + TH1F* fhPtThresIsolated[5][5]; //! Isolated gamma with pt threshold + TH1F* fhPtFracIsolated[5][5]; //! Isolated gamma with pt threshold + TH2F* fhPtSumIsolated[5] ; //! Isolated gamma with threshold on cone pt sume + + //MC + TH1F * fhPtPrompt; //!Number of identified (isolated) prompt gamma + TH2F * fhPhiPrompt; //! Phi of identified (isolated) prompt gamma + TH2F * fhEtaPrompt; //! eta of identified (isolated) prompt gamma + TH1F * fhPtThresIsolatedPrompt[5][5]; //! Isolated prompt gamma with pt threshold + TH1F * fhPtFracIsolatedPrompt[5][5]; //! Isolated prompt gamma with pt frac + TH2F * fhPtSumIsolatedPrompt[5]; //! Isolated prompt gamma with threshold on cone pt sume + TH1F * fhPtFragmentation; //!Number of identified (isolated) fragmentation gamma + TH2F * fhPhiFragmentation; //! Phi of identified (isolated) fragmentation gamma + TH2F * fhEtaFragmentation; //! eta of identified (isolated) fragmentation gamma + TH1F * fhPtThresIsolatedFragmentation[5][5]; //! Isolated fragmentation gamma with pt threshold + TH1F * fhPtFracIsolatedFragmentation[5][5]; //! Isolated fragmentation gamma with pt frac + TH2F * fhPtSumIsolatedFragmentation[5]; //! Isolated fragmentation gamma with threshold on cone pt sume + TH1F * fhPtPi0Decay; //!Number of identified (isolated) Pi0Decay gamma + TH2F * fhPhiPi0Decay; //! Phi of identified (isolated) Pi0Decay gamma + TH2F * fhEtaPi0Decay; //! eta of identified (isolated) Pi0Decay gamma + TH1F * fhPtThresIsolatedPi0Decay[5][5]; //! Isolated Pi0Decay gamma with pt threshold + TH1F * fhPtFracIsolatedPi0Decay[5][5]; //! Isolated Pi0Decay gamma with pt frac + TH2F * fhPtSumIsolatedPi0Decay[5]; //! Isolated Pi0Decay gamma with threshold on cone pt sume + TH1F * fhPtOtherDecay; //!Number of identified (isolated) OtherDecay gamma + TH2F * fhPhiOtherDecay; //! Phi of identified (isolated) OtherDecay gamma + TH2F * fhEtaOtherDecay; //! eta of identified (isolated) OtherDecay gamma + TH1F * fhPtThresIsolatedOtherDecay[5][5]; //! Isolated OtherDecay gamma with pt threshold + TH1F * fhPtFracIsolatedOtherDecay[5][5]; //! Isolated OtherDecay gamma with pt frac + TH2F * fhPtSumIsolatedOtherDecay[5]; //! Isolated OtherDecay gamma with threshold on cone pt sume + TH1F * fhPtConversion; //!Number of identified (isolated) Conversion gamma + TH2F * fhPhiConversion; //! Phi of identified (isolated) Conversion gamma + TH2F * fhEtaConversion; //! eta of identified (isolated) Conversion gamma + TH1F * fhPtThresIsolatedConversion[5][5]; //! Isolated Conversion gamma with pt threshold + TH1F * fhPtFracIsolatedConversion[5][5]; //! Isolated Conversion gamma with pt frac + TH2F * fhPtSumIsolatedConversion[5]; //! Isolated Conversion gamma with threshold on cone pt sume + TH1F * fhPtUnknown; //!Number of identified (isolated) Unknown gamma + TH2F * fhPhiUnknown; //! Phi of identified (isolated) Unknown gamma + TH2F * fhEtaUnknown; //! eta of identified (isolated) Unknown gamma + TH1F * fhPtThresIsolatedUnknown[5][5]; //! Isolated Unknown gamma with pt threshold + TH1F * fhPtFracIsolatedUnknown[5][5]; //! Isolated Unknown gamma with pt frac + TH2F * fhPtSumIsolatedUnknown[5]; //! Isolated Unknown gamma with threshold on cone pt sume + + ClassDef(AliAnaGammaDirect,1) +} ; + + +#endif //AliAnaGammaDirect_H + + + diff --git a/PWG4/PartCorr/AliAnaPartCorrBaseClass.cxx b/PWG4/PartCorr/AliAnaPartCorrBaseClass.cxx new file mode 100644 index 00000000000..8c5492dc1f3 --- /dev/null +++ b/PWG4/PartCorr/AliAnaPartCorrBaseClass.cxx @@ -0,0 +1,263 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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 *GetEntriesFast( + * 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Base class for analysis algorithms +//-- Author: Gustavo Conesa (LNF-INFN) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include +#include + +//---- AliRoot system ---- +#include "AliAODParticleCorrelation.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCells.h" +#include "AliAODTrack.h" +#include "AliAnaPartCorrBaseClass.h" +#include "AliCaloTrackReader.h" +#include "AliFidutialCut.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" +#include "AliLog.h" +// #include "AliStack.h" +// #include "AliHeader.h" +// #include "AliGenEventHeader.h" + +ClassImp(AliAnaPartCorrBaseClass) + + +//_______________________________________________ + AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass() : + TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0), + fCheckCaloPID(0), fRecalculateCaloPID(0), fMinPt(0), fMaxPt(0), + fReader(0x0), fAODBranch(0x0), fAODCaloClusters(0x0), fAODCaloCells(0x0), + fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fNMS(0x0) +{ + //Default Ctor + + fReader = new AliCaloTrackReader(); + fCaloPID = new AliCaloPID(); + fFidCut = new AliFidutialCut(); + fIC = new AliIsolationCut(); + + //Initialize parameters + InitParameters(); +} + +//___________________________________________________________ +AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass(const AliAnaPartCorrBaseClass & abc) : + TObject(), fDataMC(abc.fDataMC), fDebug(abc.fDebug), + fCheckFidCut(abc.fCheckFidCut), fCheckCaloPID(abc. fCheckCaloPID), + fRecalculateCaloPID(abc.fRecalculateCaloPID), + fMinPt(abc.fMinPt), fMaxPt(abc.fMaxPt), fReader(abc.fReader), + fAODBranch(new TClonesArray(*abc.fAODBranch)), + fAODCaloClusters(new TClonesArray(*abc.fAODCaloClusters)), + fAODCaloCells(new AliAODCaloCells(*abc.fAODCaloCells)), + fCaloPID(abc.fCaloPID), fFidCut(abc.fFidCut), fIC(abc.fIC),fNMS(abc.fNMS) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaPartCorrBaseClass & AliAnaPartCorrBaseClass::operator = (const AliAnaPartCorrBaseClass & abc) +{ + // assignment operator + + if(this == &abc) return *this; + ((TObject *)this)->operator=(abc); + + fDataMC = abc.fDataMC; + fDebug = abc.fDebug ; + fRecalculateCaloPID = abc.fRecalculateCaloPID ; + fCheckCaloPID = abc. fCheckCaloPID ; + fCheckFidCut = abc.fCheckFidCut ; + + fReader = abc.fReader ; + + fAODBranch = new TClonesArray(*abc.fAODBranch) ; + fAODCaloClusters = new TClonesArray(*abc.fAODCaloClusters) ; + fAODCaloCells = new AliAODCaloCells(*abc.fAODCaloCells) ; + + fMinPt = abc.fMinPt; + fMaxPt = abc.fMaxPt; + + fCaloPID = abc.fCaloPID; + fFidCut = abc.fFidCut; + fIC = abc.fIC; + fNMS = abc.fNMS; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass() +{ + // Remove all pointers except analysis output pointers. + + if(fAODBranch){ + fAODBranch->Clear() ; + delete fAODBranch ; + } + + if(fAODCaloClusters){ + fAODCaloClusters->Clear() ; + delete fAODCaloClusters ; + } + + if(fAODCaloCells){ + fAODCaloCells->Clear() ; + delete fAODCaloCells ; + } + + if(fReader) delete fReader ; + if(fCaloPID) delete fCaloPID ; + if(fFidCut) delete fFidCut ; + if(fIC) delete fIC ; + if(fNMS) delete fNMS ; + +} + +//____________________________________________________________________________ +void AliAnaPartCorrBaseClass::AddAODCaloCluster(AliAODCaloCluster calo) { + //Put AOD calo cluster in the CaloClusters array + + Int_t i = fAODCaloClusters->GetEntriesFast(); + new((*fAODCaloClusters)[i]) AliAODCaloCluster(calo); + +} + +//____________________________________________________________________________ +void AliAnaPartCorrBaseClass::AddAODParticleCorrelation(AliAODParticleCorrelation pc) { + //Put AOD calo cluster in the AODParticleCorrelation array + + Int_t i = fAODBranch->GetEntriesFast(); + new((*fAODBranch)[i]) AliAODParticleCorrelation(pc); + +} + +//___________________________________________________ +void AliAnaPartCorrBaseClass::ConnectAODCaloClusters() { + //Recover the list of AODCaloClusters + + fAODCaloClusters = fReader->GetAOD()->GetCaloClusters(); + +} + +//___________________________________________________ +void AliAnaPartCorrBaseClass::ConnectAODPHOSCells() { + //Recover the list of PHOS AODCaloCells + + fAODCaloCells = fReader->GetAOD()->GetPHOSCells(); + +} + +//___________________________________________________ +void AliAnaPartCorrBaseClass::ConnectAODEMCALCells() { + //Recover the list of EMCAL AODCaloCells + + fAODCaloCells = fReader->GetAOD()->GetEMCALCells(); + +} + +//__________________________________________________ +TClonesArray * AliAnaPartCorrBaseClass::GetAODCTS() const { + //Get list of tracks from reader + + return fReader->GetAODCTS(); + +} + +//__________________________________________________ +TClonesArray * AliAnaPartCorrBaseClass::GetAODPHOS() const { + //Get list of PHOS calo clusters from reader + + return fReader->GetAODPHOS(); + +} + + +//__________________________________________________ +TClonesArray * AliAnaPartCorrBaseClass::GetAODEMCAL() const { + //Get list of emcal caloclusters from reader + + return fReader->GetAODEMCAL(); + +} + +//__________________________________________________ +TNamed * AliAnaPartCorrBaseClass::GetPHOSCells() const { + //Get list of PHOS calo cells (ESD or AOD) from reader + + return fReader->GetPHOSCells(); + +} + + +//__________________________________________________ +TNamed * AliAnaPartCorrBaseClass::GetEMCALCells() const { + //Get list of emcal calo cells (ESD or AOD) from reader + + return fReader->GetEMCALCells(); + +} + +//__________________________________________________ +AliStack * AliAnaPartCorrBaseClass::GetMCStack() const { + //Get stack pointer from reader + + return fReader->GetStack(); + +} +//__________________________________________________ +AliHeader * AliAnaPartCorrBaseClass::GetMCHeader() const { + //Get header pointer from reader + + return fReader->GetHeader(); + +} + +//__________________________________________________ +AliGenEventHeader * AliAnaPartCorrBaseClass::GetMCGenEventHeader() const { + //Get GenEventHeader pointer from reader + + return fReader->GetGenEventHeader(); + +} + + +void AliAnaPartCorrBaseClass::InitParameters() +{ + //Initialize the parameters of the analysis. + fDataMC = kFALSE; + fDebug = -1; + fCheckCaloPID = kTRUE ; + fCheckFidCut = kFALSE ; + fRecalculateCaloPID = kFALSE ; + fMinPt = 0.2 ; //Min pt in particle analysis + fMaxPt = 300. ; //Max pt in particle analysis + + fCaloPID = new AliCaloPID ; + fFidCut = new AliFidutialCut; + fIC = new AliIsolationCut; + fNMS = new AliNeutralMesonSelection; + +} + diff --git a/PWG4/PartCorr/AliAnaPartCorrBaseClass.h b/PWG4/PartCorr/AliAnaPartCorrBaseClass.h new file mode 100644 index 00000000000..cdd948f1149 --- /dev/null +++ b/PWG4/PartCorr/AliAnaPartCorrBaseClass.h @@ -0,0 +1,143 @@ +#ifndef AliAnaPartCorrBaseClass_H +#define AliAnaPartCorrBaseClass_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Base class for analysis algorithms +//-- Author: Gustavo Conesa (INFN-LNF) + +//ROOT +class TClonesArray ; +#include +#include + +//Analysis +class AliAODCaloCluster; +class AliAODCaloCells; +#include "AliAODParticleCorrelation.h" +class AliCaloTrackReader ; +#include "AliCaloPID.h" +class AliFidutialCut ; +class AliIsolationCut ; +class AliNeutralMesonSelection ; +/* class AliStack ; */ +/* class AliHeader ; */ +/* class AliGenEventHeader ; */ +#include "AliStack.h" +#include "AliHeader.h" +#include "AliGenEventHeader.h" + +class AliAnaPartCorrBaseClass : public TObject { + + public: + + AliAnaPartCorrBaseClass() ; // default ctor + AliAnaPartCorrBaseClass(const AliAnaPartCorrBaseClass & g) ; // cpy ctor + AliAnaPartCorrBaseClass & operator = (const AliAnaPartCorrBaseClass & g) ;//cpy assignment + virtual ~AliAnaPartCorrBaseClass() ; //virtual dtor + + virtual void AddAODCaloCluster(AliAODCaloCluster calo) ; + virtual void AddAODParticleCorrelation(AliAODParticleCorrelation pc) ; + + virtual void ConnectAODCaloClusters(); + virtual void ConnectAODPHOSCells(); + virtual void ConnectAODEMCALCells(); + + virtual TList * GetCreateOutputObjects(){ return (new TList) ;} + + virtual void Print(const Option_t * ) const {;} + + virtual void MakeAnalysisFillAOD() {;} + + virtual void MakeAnalysisFillHistograms() {;} + + virtual Int_t GetDebug() const { return fDebug ; } + virtual void SetDebug(Int_t d) { fDebug = d ; } + + virtual AliCaloTrackReader * GetReader() const {return fReader ; } + virtual void SetReader(AliCaloTrackReader * reader) { fReader = reader ; } + + virtual TClonesArray* GetAODBranch() const {return fAODBranch ;} + virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;} + virtual AliAODCaloCells* GetAODCaloCells() const {return fAODCaloCells ;} + + virtual TClonesArray* GetAODCTS() const ; + virtual TClonesArray* GetAODEMCAL() const ; + virtual TClonesArray* GetAODPHOS() const ; + + virtual TNamed * GetEMCALCells() const ; + virtual TNamed * GetPHOSCells() const ; + + virtual AliStack * GetMCStack() const ; + virtual AliHeader* GetMCHeader() const ; + virtual AliGenEventHeader* GetMCGenEventHeader() const ; + + virtual void SetAODBranch(TClonesArray * tca) { fAODBranch = tca ; } + + virtual AliCaloPID * GetCaloPID() const {return fCaloPID ;} + virtual void SetCaloPID(AliCaloPID * pid) { fCaloPID = pid ;} + + virtual AliFidutialCut * GetFidutialCut() const {return fFidCut ;} + virtual void SetFidutialCut(AliFidutialCut * fc) { fFidCut = fc ;} + + virtual AliIsolationCut * GetIsolationCut() const {return fIC ;} + virtual void SetIsolationCut(AliIsolationCut * fc) { fIC = fc ;} + + virtual AliNeutralMesonSelection * GetNeutralMesonSelection() const {return fNMS ;} + virtual void SetNeutralMesonSelection(AliNeutralMesonSelection * nms) { fNMS = nms ;} + + virtual Bool_t IsDataMC() const {return fDataMC ; } + virtual void SwitchOnDataMC() {fDataMC = kTRUE ; } + virtual void SwitchOffDataMC() {fDataMC = kFALSE ; } + + virtual Bool_t IsFidutialCutOn() {return fCheckFidCut ; } + virtual void SwitchOnFidutialCut() { fCheckFidCut = kTRUE;} + virtual void SwitchOffFidutialCut() { fCheckFidCut = kFALSE;} + + virtual Bool_t IsCaloPIDOn() {return fCheckCaloPID ; } + virtual void SwitchOnCaloPID() { fCheckCaloPID = kTRUE;} + virtual void SwitchOffCaloPID() { fCheckCaloPID = kFALSE;} + + virtual Bool_t IsCaloPIDRecalculationOn() {return fRecalculateCaloPID ; } + virtual void SwitchOnCaloPIDRecalculation() { fRecalculateCaloPID = kTRUE;} + virtual void SwitchOffCaloPIDRecalculation() { fRecalculateCaloPID = kFALSE;} + + virtual Float_t GetMaxPt() const {return fMaxPt ; } + virtual Float_t GetMinPt() const {return fMinPt ; } + virtual void SetMaxPt(Float_t pt) {fMaxPt = pt ; } + virtual void SetMinPt(Float_t pt) {fMinPt = pt ; } + void SetPtCutRange(Double_t ptmin, Double_t ptmax) + { fMaxPt=ptmax; fMinPt=ptmin;} + + virtual void InitParameters() ; + + private: + + Bool_t fDataMC ; //Flag to access MC data when using ESD or AOD + Int_t fDebug ; // Debug level + Bool_t fCheckFidCut ; // Do analysis for clusters in defined region + Bool_t fCheckCaloPID ; // Do analysis for calorimeters + Bool_t fRecalculateCaloPID ; //Recalculate PID or use PID weights in calorimeters + Float_t fMinPt ; //Maximum pt of (trigger) particles in the analysis + Float_t fMaxPt ; //Minimum pt of (trigger) particles in the analysis + + AliCaloTrackReader * fReader; //Acces to ESD/AOD/MC data + + TClonesArray* fAODBranch ; //! selected particles branch + TClonesArray* fAODCaloClusters ; //! selected PHOS/EMCAL CaloClusters + AliAODCaloCells * fAODCaloCells ; //! selected PHOS/EMCAL CaloCells + AliCaloPID * fCaloPID; // PID calculation + AliFidutialCut * fFidCut; //Acceptance cuts + AliIsolationCut * fIC; // Isolation cut + AliNeutralMesonSelection * fNMS; // Neutral Meson Selection + + ClassDef(AliAnaPartCorrBaseClass,1) + } ; + + +#endif //AliAnaPartCorrBaseClass_H + + + diff --git a/PWG4/PartCorr/AliAnaPartCorrMaker.cxx b/PWG4/PartCorr/AliAnaPartCorrMaker.cxx new file mode 100644 index 00000000000..f237dd924f5 --- /dev/null +++ b/PWG4/PartCorr/AliAnaPartCorrMaker.cxx @@ -0,0 +1,207 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Steering class for particle (gamma, hadron) identification and correlation analysis +// It is called by the task class AliAnalysisTaskParticleCorrelation and it connects the input +// (ESD/AOD/MonteCarlo) got with AliCaloTrackReader (produces TClonesArrays of AODs +// (TParticles in MC case if requested)), with the +// analysis classes that derive from AliAnaPartCorrBaseClass +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include + +//---- AliRoot system ---- +#include "AliAnaPartCorrBaseClass.h" +#include "AliAnaPartCorrMaker.h" +#include "AliCaloTrackReader.h" +#include "AliLog.h" + + +ClassImp(AliAnaPartCorrMaker) + + +//____________________________________________________________________________ + AliAnaPartCorrMaker::AliAnaPartCorrMaker() : + TObject(), + fOutputContainer(new TList ), fAnalysisContainer(new TList ), + fMakeHisto(0), fMakeAOD(0), fAnaDebug(0), + fReader(0x0), fAODBranch(0x0), fAODBranchName("") +{ + //Default Ctor + if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n"); + + //Initialize parameters, pointers and histograms + if(!fReader) + fReader = new AliCaloTrackReader(); + + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaPartCorrMaker::AliAnaPartCorrMaker(const AliAnaPartCorrMaker & g) : + TObject(), + fOutputContainer(g. fOutputContainer), fAnalysisContainer(g.fAnalysisContainer), + fMakeHisto(g.fMakeHisto), fMakeAOD(fMakeAOD), fAnaDebug(g. fAnaDebug), + fReader(g.fReader), fAODBranch(g.fAODBranch), + fAODBranchName(g.fAODBranchName) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaPartCorrMaker & AliAnaPartCorrMaker::operator = (const AliAnaPartCorrMaker & source) +{ + // assignment operator + + if(this == &source)return *this; + ((TObject *)this)->operator=(source); + + fOutputContainer = source.fOutputContainer ; + fAnalysisContainer = source.fAnalysisContainer ; + fAnaDebug = source.fAnaDebug; + fMakeHisto = source.fMakeHisto; + fMakeAOD = source.fMakeAOD; + + fAODBranchName = source.fAODBranchName; + fAODBranch = source.fAODBranch; + + fReader = source.fReader ; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaPartCorrMaker::~AliAnaPartCorrMaker() +{ + // Remove all pointers. + + // Protection added in case of NULL pointers (MG) + if (fOutputContainer) { + fOutputContainer->Clear(); + delete fOutputContainer ; + } + + if (fAnalysisContainer) { + fAnalysisContainer->Clear(); + delete fAnalysisContainer ; + } + + if (fReader) delete fReader ; + + if (fAODBranch) { + fAODBranch->Clear(); + delete fAODBranch ; + } + +} + +//________________________________________________________________________ +void AliAnaPartCorrMaker::Init() +{ + //Init container histograms and other common variables + + if(fMakeHisto){// Analysis with histograms as output on + + //Fill container with appropriate histograms + + if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0) + AliFatal("Analysis job list not initailized"); + + for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){ + TList * templist = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) -> GetCreateOutputObjects(); + + for(Int_t i = 0; i < templist->GetEntries(); i++) + fOutputContainer->Add(templist->At(i)) ; + + } + }// Analysis with histograms as output on +} + +//____________________________________________________________________________ +void AliAnaPartCorrMaker::InitParameters() +{ + + //Init data members + fMakeHisto = kTRUE; + fMakeAOD = kTRUE; + fAnaDebug = 0; // No debugging info displayed by default + fAODBranchName = "Photons" ; + +} + +//__________________________________________________________________ +void AliAnaPartCorrMaker::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + printf("Debug level = %d\n", fAnaDebug) ; + printf("New AOD branch = %s\n", fAODBranchName.Data()) ; + printf("Produce Histo = %d\n", fMakeHisto) ; + printf("Produce AOD = %d\n", fMakeAOD) ; + +} + + +//____________________________________________________________________________ +Bool_t AliAnaPartCorrMaker::ProcessEvent(Int_t iEntry){ + //Process analysis for this event + + if(fMakeHisto && !fOutputContainer) + AliFatal("Histograms not initialized"); + + if(fAnaDebug >= 0 ) printf("*** Event %d *** \n",iEntry); + + //Each event needs an empty branch + fAODBranch->Clear(); + + //Tell the reader to fill the data in the 3 detector lists + fReader->FillInputEvent(); + + //Loop on analysis algorithms + if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n"); + Int_t nana = fAnalysisContainer->GetEntries() ; + for(Int_t iana = 0; iana < nana; iana++){ + + AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ; + + //Set reader and aod branch for each analysis + ana->SetReader(fReader); + ana->SetAODBranch(fAODBranch); + + //Make analysis, create aods in aod branch or AODCaloClusters + if(fMakeAOD) ana->MakeAnalysisFillAOD() ; + //Make further analysis with aod branch and fill histograms + if(fMakeHisto) ana->MakeAnalysisFillHistograms() ; + + } + + if(fAnaDebug > 0 ) printf("*** End analysis *** \n"); + + fReader->ResetLists(); + + return kTRUE ; + +} diff --git a/PWG4/PartCorr/AliAnaPartCorrMaker.h b/PWG4/PartCorr/AliAnaPartCorrMaker.h new file mode 100644 index 00000000000..c93269e268a --- /dev/null +++ b/PWG4/PartCorr/AliAnaPartCorrMaker.h @@ -0,0 +1,89 @@ +#ifndef AliAnaPartCorrMaker_H +#define AliAnaPartCorrMaker_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Steering class for particle (gamma, hadron) identification and correlation analysis +// It is called by the task class AliAnalysisTaskParticleCorrelation and it connects the input +// (ESD/AOD/MonteCarlo) got with AliCaloTrackReader (produces TClonesArrays of AODs +// (TParticles in MC case if requested)), with the +// analysis classes that derive from AliAnaPartCorrBaseClass +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TList; +class TClonesArray; +#include +class TString; + +// --- Analysis system --- +#include "AliLog.h" +class AliCaloTrackReader ; + +class AliAnaPartCorrMaker : public TObject { + +public: + + AliAnaPartCorrMaker() ; // default ctor + AliAnaPartCorrMaker(const AliAnaPartCorrMaker & g) ; // cpy ctor + AliAnaPartCorrMaker & operator = (const AliAnaPartCorrMaker & g) ;//cpy assignment + virtual ~AliAnaPartCorrMaker() ; //virtual dtor + + //Setter and getters + TList * GetOutputContainer() const {return fOutputContainer ; } + + Int_t GetAnaDebug() const { return fAnaDebug ; } + void SetAnaDebug(Int_t d) { fAnaDebug = d ; } + + Bool_t AreHistogramsMade() const { return fMakeHisto ; } + void SwitchOnHistogramsMaker() { fMakeHisto = kTRUE ; } + void SwitchOffHistogramsMaker() { fMakeHisto = kFALSE ; } + + Bool_t AreAODsMade() const { return fMakeAOD ; } + void SwitchOnAODsMaker() { fMakeAOD = kTRUE ; } + void SwitchOffAODsMaker() { fMakeAOD = kFALSE ; } + + void SetAODBranch(TClonesArray* aodbranch) {fAODBranch = aodbranch;} + + void AddAnalysis(TObject* ana, Int_t n) {if ( fAnalysisContainer) fAnalysisContainer->AddAt(ana,n); + else AliFatal("AnalysisContainer not initialized");} + + TString GetAODBranchName() const {return fAODBranchName;} + void SetAODBranchName(TString name) {fAODBranchName = name ;} + + AliCaloTrackReader * GetReader() const {return fReader ; } + void SetReader(AliCaloTrackReader * reader) { fReader = reader ; } + + //Others + void Init(); + void InitParameters(); + + void Print(const Option_t * opt) const; + + Bool_t ProcessEvent(Int_t iEntry) ; + + private: + + //General Data members + + TList * fOutputContainer ; // output histograms container + TList * fAnalysisContainer ; // List with analysis pointers + Bool_t fMakeHisto ; // If true makes final analysis with histograms as output + Bool_t fMakeAOD ; // If true makes analysis generating AODs + Int_t fAnaDebug; // Debugging info. + + AliCaloTrackReader * fReader ; // Pointer to reader + TClonesArray* fAODBranch ; //! selected particles branch + TString fAODBranchName; // New AOD branch name + + ClassDef(AliAnaPartCorrMaker,1) +} ; + + +#endif //AliAnaPartCorrMaker_H + + + diff --git a/PWG4/PartCorr/AliAnaParticleHadronCorrelation.cxx b/PWG4/PartCorr/AliAnaParticleHadronCorrelation.cxx new file mode 100644 index 00000000000..cd8f4b5a786 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleHadronCorrelation.cxx @@ -0,0 +1,524 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for the analysis of particle - hadron correlations +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include "Riostream.h" +#include "TH2F.h" + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliNeutralMesonSelection.h" +#include "AliAnaParticleHadronCorrelation.h" +#include "AliCaloTrackReader.h" + +ClassImp(AliAnaParticleHadronCorrelation) + + +//____________________________________________________________________________ + AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation() : + AliAnaPartCorrBaseClass(), + fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), + fhPhiCharged(0), fhPhiNeutral(0), fhEtaCharged(0), fhEtaNeutral(0), + fhDeltaPhiCharged(0), fhDeltaPhiNeutral(0), + fhDeltaEtaCharged(0), fhDeltaEtaNeutral(0), + fhDeltaPhiChargedPt(0), fhDeltaPhiNeutralPt(0), + fhPtImbalanceNeutral(0), fhPtImbalanceCharged(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation(const AliAnaParticleHadronCorrelation & g) : + AliAnaPartCorrBaseClass(g), + fDeltaPhiMaxCut(g.fDeltaPhiMaxCut), fDeltaPhiMinCut(g.fDeltaPhiMinCut), + fhPhiCharged(g.fhPhiCharged), fhPhiNeutral(g.fhPhiNeutral), + fhEtaCharged(g.fhEtaCharged), fhEtaNeutral(g.fhEtaNeutral), + fhDeltaPhiCharged(g.fhDeltaPhiCharged), + fhDeltaPhiNeutral(g.fhDeltaPhiNeutral), + fhDeltaEtaCharged(g.fhDeltaEtaCharged), + fhDeltaEtaNeutral(g.fhDeltaEtaNeutral), + fhDeltaPhiChargedPt(g.fhDeltaPhiChargedPt), + fhDeltaPhiNeutralPt(g.fhDeltaPhiNeutralPt), + fhPtImbalanceNeutral(g.fhPtImbalanceNeutral), + fhPtImbalanceCharged(g.fhPtImbalanceCharged) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaParticleHadronCorrelation & AliAnaParticleHadronCorrelation::operator = (const AliAnaParticleHadronCorrelation & source) +{ + // assignment operator + + if(this == &source)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(source); + + fDeltaPhiMaxCut = source.fDeltaPhiMaxCut ; + fDeltaPhiMinCut = source.fDeltaPhiMinCut ; + + fhPhiCharged = source.fhPhiCharged ; fhPhiNeutral = source.fhPhiNeutral ; + fhEtaCharged = source.fhEtaCharged ; fhEtaNeutral = source.fhEtaNeutral ; + fhDeltaPhiCharged = source.fhDeltaPhiCharged ; + fhDeltaPhiNeutral = source.fhDeltaPhiNeutral ; + fhDeltaPhiNeutralPt = source.fhDeltaPhiNeutralPt ; + fhDeltaEtaCharged = source.fhDeltaEtaCharged ; + fhDeltaEtaNeutral = source.fhDeltaEtaNeutral ; + fhDeltaPhiChargedPt = source.fhDeltaPhiChargedPt ; + + fhPtImbalanceNeutral = source.fhPtImbalanceNeutral ; + fhPtImbalanceCharged = source.fhPtImbalanceCharged ; + + return *this; + +} + +//________________________________________________________________________ +TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() +{ + + // Create histograms to be saved in output file and + // store them in fOutputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("CorrelationHistos") ; + + //Correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn()) { + fhPhiCharged = new TH2F + ("PhiCharged","#phi_{h^{#pm}} vs p_{T trigger}", + 120,0,120,120,0,7); + fhPhiCharged->SetYTitle("#phi_{h^{#pm}} (rad)"); + fhPhiCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaCharged = new TH2F + ("EtaCharged","#eta_{h^{#pm}} vs p_{T trigger}", + 120,0,120,120,-1,1); + fhEtaCharged->SetYTitle("#eta_{h^{#pm}} (rad)"); + fhEtaCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiCharged = new TH2F + ("DeltaPhiCharged","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}", + 200,0,120,200,0,6.4); + fhDeltaPhiCharged->SetYTitle("#Delta #phi"); + fhDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiChargedPt = new TH2F + ("DeltaPhiChargedPt","#phi_{trigger} - #phi_{#p^{#pm}i} vs p_{T h^{#pm}}", + 200,0,120,200,0,6.4); + fhDeltaPhiChargedPt->SetYTitle("#Delta #phi"); + fhDeltaPhiChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)"); + + fhDeltaEtaCharged = new TH2F + ("DeltaEtaCharged","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}", + 200,0,120,200,-2,2); + fhDeltaEtaCharged->SetYTitle("#Delta #eta"); + fhDeltaEtaCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhPtImbalanceCharged = + new TH2F("CorrelationCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T trigger}", + 240,0.,120.,1000,0.,1.2); + fhPtImbalanceCharged->SetYTitle("z_{trigger h^{#pm}}"); + fhPtImbalanceCharged->SetXTitle("p_{T trigger}"); + + outputContainer->Add(fhPhiCharged) ; + outputContainer->Add(fhEtaCharged) ; + outputContainer->Add(fhDeltaPhiCharged) ; + outputContainer->Add(fhDeltaEtaCharged) ; + outputContainer->Add(fhPtImbalanceCharged) ; + outputContainer->Add(fhDeltaPhiChargedPt) ; + } //Correlation with charged hadrons + + //Correlation with neutral hadrons + if(GetReader()->IsEMCALSwitchedOn() || GetReader()->IsPHOSSwitchedOn()){ + + fhPhiNeutral = new TH2F + ("PhiNeutral","#phi_{#pi^{0}} vs p_{T trigger}", + 120,0,120,120,0,7); + fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaNeutral = new TH2F + ("EtaNeutral","#eta_{#pi^{0}} vs p_{T trigger}", + 120,0,120,120,-1,1); + fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)"); + fhEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiNeutral = new TH2F + ("DeltaPhiNeutral","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T trigger}", + 200,0,120,200,0,6.4); + fhDeltaPhiNeutral->SetYTitle("#Delta #phi"); + fhDeltaPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiNeutralPt = new TH2F + ("DeltaPhiNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}", + 200,0,120,200,0,6.4); + fhDeltaPhiNeutralPt->SetYTitle("#Delta #phi"); + fhDeltaPhiNeutralPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaEtaNeutral = new TH2F + ("DeltaEtaNeutral","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}", + 200,0,120,200,-2,2); + fhDeltaEtaNeutral->SetYTitle("#Delta #eta"); + fhDeltaEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhPtImbalanceNeutral = + new TH2F("CorrelationNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger}", + 240,0.,120.,1000,0.,1.2); + fhPtImbalanceNeutral->SetYTitle("z_{trigger #pi^{0}}"); + fhPtImbalanceNeutral->SetXTitle("p_{T trigger}"); + + outputContainer->Add(fhPhiNeutral) ; + outputContainer->Add(fhEtaNeutral) ; + outputContainer->Add(fhDeltaPhiNeutral) ; + outputContainer->Add(fhDeltaEtaNeutral) ; + outputContainer->Add(fhPtImbalanceNeutral) ; + + + //Keep neutral meson selection histograms if requiered + //Setting done in AliNeutralMesonSelection + if(GetNeutralMesonSelection()){ + TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ; + cout<<"NMSHistos "<< nmsHistos<AreNeutralMesonSelectionHistosKept()) + for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ; + } + + }//Correlation with neutral hadrons + + return outputContainer; +} + + //____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + + SetPtCutRange(2,300); + fDeltaPhiMinCut = 1.5 ; + fDeltaPhiMaxCut = 4.5 ; + +} + +//__________________________________________________________________ +void AliAnaParticleHadronCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("*** Print *** ", "%s %s", GetName(), GetTitle() ) ; + printf("pT Hadron > %2.2f\n", GetMinPt()) ; + printf("pT Hadron < %2.2f\n", GetMaxPt()) ; + printf("Phi trigger particle-Hadron < %3.2f\n", fDeltaPhiMaxCut) ; + printf("Phi trigger particle-Hadron > %3.2f\n", fDeltaPhiMinCut) ; + + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntriesFast()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntriesFast()); + printf("In PHOS aod entries %d\n", GetAODPHOS()->GetEntriesFast()); + } + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + //Make correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn() ) + MakeChargedCorrelation(particle, (TSeqCollection*)GetAODCTS(),kFALSE); + + //Make correlation with neutral pions + //Trigger particle in PHOS, correlation with EMCAL + if(particle->GetDetector()=="PHOS" && GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntriesFast() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODEMCAL(),kFALSE); + //Trigger particle in EMCAL, correlation with PHOS + else if(particle->GetDetector()=="EMCAL" && GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntriesFast() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODPHOS(),kFALSE); + //Trigger particle in CTS, correlation with PHOS, EMCAL and CTS + else if(particle->GetDetector()=="CTS" ){ + if(GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntriesFast() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODPHOS(),kFALSE); + if(GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntriesFast() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODEMCAL(),kFALSE); + } + + }//Aod branch loop + + if(GetDebug() > 1) printf("End hadron correlation analysis, fill AODs \n"); + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() +{ + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + } + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + if(GetDebug() > 1){ + printf("Particle %d, In Track Refs entries %d\n", iaod, (particle->GetRefTracks())->GetEntriesFast()); + printf("Particle %d, In Cluster Refs entries %d\n",iaod, (particle->GetRefClusters())->GetEntriesFast()); + } + + //Make correlation with charged hadrons + if((particle->GetRefTracks())->GetEntriesFast() > 0) + MakeChargedCorrelation(particle, (TSeqCollection*) (particle->GetRefTracks()),kTRUE); + + //Make correlation with neutral pions + if((particle->GetRefClusters())->GetEntriesFast() > 0) + MakeNeutralCorrelation(particle, (TSeqCollection*) (particle->GetRefClusters()), kTRUE); + + }//Aod branch loop + + if(GetDebug() > 1) printf("End hadron correlation analysis, fill histograms \n"); + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODParticleCorrelation *aodParticle, TSeqCollection* pl, const Bool_t bFillHisto) +{ + // Charged Hadron Correlation Analysis + if(GetDebug() > 1)printf("Make trigger particle - charged hadron correlation \n"); + + Double_t ptTrig = aodParticle->Pt(); + Double_t phiTrig = aodParticle->Phi(); + Double_t pt = -100.; + Double_t rat = -100.; + Double_t phi = -100. ; + Double_t eta = -100. ; + Double_t p[3]; + + //Track loop, select tracks with good pt, phi and fill AODs or histograms + for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){ + AliAODTrack * track = dynamic_cast(pl->At(ipr)) ; + track->GetPxPyPz(p) ; + TLorentzVector mom(p[0],p[1],p[2],0); + pt = mom.Pt(); + eta = mom.Eta(); + phi = mom.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + rat = pt/ptTrig ; + + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ; + if(! in ) continue ; + } + + //Select only hadrons in pt range + if(pt < GetMinPt() || pt > GetMaxPt()) continue ; + + if(GetDebug() > 2) + printf("charged hadron: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max%2.2f, pT min %2.2f \n", + pt,phi,phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); + + if(bFillHisto){ + // Fill Histograms + fhEtaCharged->Fill(ptTrig,eta); + fhPhiCharged->Fill(ptTrig,phi); + fhDeltaEtaCharged->Fill(ptTrig,aodParticle->Eta()-eta); + fhDeltaPhiCharged->Fill(ptTrig,phiTrig-phi); + fhDeltaPhiChargedPt->Fill(pt,phiTrig-phi); + //Selection within angular range + if(((phiTrig-phi)> fDeltaPhiMinCut) && ((phiTrig-phi) 2 ) printf("Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f ",pt,phi,eta); + fhPtImbalanceCharged->Fill(ptTrig,rat); + } + } + else{ + //Fill AODs + aodParticle->AddTrack(track); + + }//aod particle loop + }// track loop + +} +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) +{ + // Neutral Pion Correlation Analysis + if(GetDebug() > 1) printf("Make trigger particle - neutral hadron correlation \n"); + + Double_t pt = -100.; + Double_t rat = -100.; + Double_t phi = -100. ; + Double_t eta = -100. ; + Double_t ptTrig = aodParticle->Pt(); + Double_t phiTrig = aodParticle->Phi(); + Double_t etaTrig = aodParticle->Eta(); + + TLorentzVector gammai; + TLorentzVector gammaj; + + Double_t vertex[] = {0,0,0}; + + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Cluster loop, select pairs with good pt, phi and fill AODs or histograms + for(Int_t iclus = 0;iclus < pl->GetEntries() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(pl->At(iclus)) ; + if(!bFillHisto){ + + //Cluster selection, not charged, with photon or pi0 id and in fidutial cut + Int_t pdg=0; + if(!SelectCluster(calo, vertex, gammai, pdg)) continue ; + + if(GetDebug() > 2) + printf("neutral cluster: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max%2.2f, pT min %2.2f \n", + gammai.Pt(),gammai.Phi(),phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); + + //2 gamma overlapped, found with PID + if(pdg == AliCaloPID::kPi0){ + + //Select only hadrons in pt range + if(gammai.Pt() < GetMinPt() || gammai.Pt() > GetMaxPt()) continue ; + + aodParticle->AddCluster(calo); + if(GetDebug() > 2) printf("Correlated with selected pi0 (pid): pt %f, phi %f",gammai.Pt(),gammai.Phi()); + + }// pdg = 111 + + //Make invariant mass analysis + else if(pdg == AliCaloPID::kPhoton){ + //Search the photon companion in case it comes from a Pi0 decay + //Apply several cuts to select the good pair; + for(Int_t jclus = iclus+1; jclus < pl->GetEntries() ; jclus ++ ){ + AliAODCaloCluster * calo2 = dynamic_cast< AliAODCaloCluster *>(pl->At(jclus)) ; + + //Cluster selection, not charged with photon or pi0 id and in fidutial cut + Int_t pdgj=0; + if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; + + if(pdgj == AliCaloPID::kPhoton ){ + + if((gammai+gammaj).Pt() < GetMinPt() || (gammai+gammaj).Pt() > GetMaxPt()) continue ; + + //Select good pair (aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ + + if(GetDebug() > 2 ) printf("Neutral Hadron Correlation: AOD Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f", + (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); + Int_t labels[]={calo->GetLabel(0),calo2->GetLabel(0)}; + Float_t pid[]={0,0,0,0,0,0,1,0,0,0,0,0,0};//Pi0 weight 1 + Float_t pos[]={(gammai+gammaj).X(), (gammai+gammaj).Y(), (gammai+gammaj).Z()}; + + AliAODCaloCluster *caloCluster = new AliAODCaloCluster(0,2,labels,(gammai+gammaj).E(), pos, pid,calo->GetType(),0); + aodParticle->AddCluster(caloCluster); + }//Pair selected + }//if pair of gammas + }//2nd loop + }// if pdg = 22 + }// Fill AODs + else{ //Fill histograms + + calo->GetMomentum(gammai,vertex);//Assume that come from vertex in straight line + pt = gammai.Pt(); + + if(pt < GetMinPt() || pt > GetMaxPt()) continue ; + + rat = pt/ptTrig ; + phi = gammai.Phi() ; + eta = gammai.Eta() ; + + if(GetDebug() > 2 ) printf("Neutral Hadron Correlation: Histograms selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta); + + fhEtaNeutral->Fill(ptTrig,eta); + fhPhiNeutral->Fill(ptTrig,phi); + fhDeltaEtaNeutral->Fill(ptTrig,etaTrig-eta); + fhDeltaPhiNeutral->Fill(ptTrig,phiTrig-phi); + fhDeltaPhiNeutralPt->Fill(pt,phiTrig-phi); + //Selection within angular range + if(((phiTrig-phi)> fDeltaPhiMinCut) && ((phiTrig-phi) 2 ) printf("Selected neutral for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f ",pt,phi,eta); + fhPtImbalanceNeutral->Fill(ptTrig,rat); + } + }//Fill histograms + }//1st loop + +} + +//____________________________________________________________________________ +Bool_t AliAnaParticleHadronCorrelation::SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg){ + //Select cluster depending on its pid and acceptance selections + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) { + return kFALSE;} + + //Check PID + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pdg = AliCaloPID::kPhoton; + if(IsCaloPIDOn()){ + //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) + //or redo PID, recommended option for EMCal. + TString detector = ""; + if(calo->IsPHOSCluster()) detector= "PHOS"; + else if(calo->IsEMCALCluster()) detector= "EMCAL"; + + if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) + pdg = GetCaloPID()->GetPdg(detector,calo->PID(),mom.E());//PID with weights + else + pdg = GetCaloPID()->GetPdg(detector,mom,calo->GetM02(),0,0,0,0);//PID recalculated + + if(GetDebug() > 1) printf("PDG of identified particle %d\n",pdg); + + //If it does not pass pid, skip + if(pdg != AliCaloPID::kPhoton || pdg != AliCaloPID::kPi0) { + return kFALSE ; + } + } + + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = kFALSE; + if(calo->IsPHOSCluster()) + in = GetFidutialCut()->IsInFidutialCut(mom,"PHOS") ; + else if(calo->IsEMCALCluster()) + in = GetFidutialCut()->IsInFidutialCut(mom,"EMCAL") ; + if(! in ) { return kFALSE ;} + } + + if(GetDebug() > 1) printf("Correlation photon selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg); + + return kTRUE; + + } diff --git a/PWG4/PartCorr/AliAnaParticleHadronCorrelation.h b/PWG4/PartCorr/AliAnaParticleHadronCorrelation.h new file mode 100644 index 00000000000..4e72aa5e364 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleHadronCorrelation.h @@ -0,0 +1,74 @@ +#ifndef AliAnaParticleHadronCorrelation_H +#define AliAnaParticleHadronCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the analysis of particle - hadron correlations +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TH2F; + +// --- Analysis system --- +#include "AliAnaPartCorrBaseClass.h" + +class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass { + +public: + + AliAnaParticleHadronCorrelation() ; // default ctor + AliAnaParticleHadronCorrelation(const AliAnaParticleHadronCorrelation & ph) ; // cpy ctor + AliAnaParticleHadronCorrelation & operator = (const AliAnaParticleHadronCorrelation & ph) ;//cpy assignment + virtual ~AliAnaParticleHadronCorrelation() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + Double_t GetDeltaPhiMaxCut() const {return fDeltaPhiMaxCut ; } + Double_t GetDeltaPhiMinCut() const {return fDeltaPhiMinCut ; } + void SetDeltaPhiCutRange(Double_t phimin, Double_t phimax) + {fDeltaPhiMaxCut =phimax; fDeltaPhiMinCut =phimin;} + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeChargedCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + void MakeNeutralCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg); + + private: + + Double_t fDeltaPhiMaxCut ; // Minimum Delta Phi Gamma-Hadron + Double_t fDeltaPhiMinCut ; // Maximum Delta Phi Gamma-Hadron + + //Histograms + TH2F * fhPhiCharged ; //! Phi distribution of selected charged particles + TH2F * fhPhiNeutral ; //! Phi distribution of selected neutral particles + TH2F * fhEtaCharged ; //! Eta distribution of selected charged particles + TH2F * fhEtaNeutral ; //! Eta distribution of selected neutral particles + TH2F * fhDeltaPhiCharged ; //! Difference of charged particle phi and trigger particle phi as function of trigger particle pT + TH2F * fhDeltaPhiNeutral ; //! Difference of neutral particle phi and trigger particle phi as function of trigger particle pT + TH2F * fhDeltaEtaCharged ; //! Difference of charged particle eta and trigger particle eta as function of trigger particle pT + TH2F * fhDeltaEtaNeutral ; //! Difference of neutral particle eta and trigger particle eta as function of trigger particle pT + TH2F * fhDeltaPhiChargedPt ; //! Difference of charged particle phi and trigger particle phi as function of charged particle pT + TH2F * fhDeltaPhiNeutralPt ; //! Difference of neutral particle phi and trigger particle phi as function of neutral particle particle pT + + TH2F * fhPtImbalanceNeutral ; //! Trigger particle - neutral hadron momentum imbalance histogram + TH2F * fhPtImbalanceCharged ; //! Trigger particle -charged hadron momentim imbalance histogram + + ClassDef(AliAnaParticleHadronCorrelation,1) +} ; + + +#endif //AliAnaParticleHadronCorrelation_H + + + diff --git a/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.cxx b/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.cxx new file mode 100644 index 00000000000..2bcd9ca3f91 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.cxx @@ -0,0 +1,342 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: AliAnaParticleJetFinderCorrelation.cxx 22232 2007-11-17 16:39:49Z gustavo $ */ + +//_________________________________________________________________________ +// Class for the analysis of particle (direct gamma) -jet (jet found with finder) correlations +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include "TH2F.h" +#include "Riostream.h" + +//---- AliRoot system ---- +#include "AliCaloTrackReader.h" +#include "AliAODJet.h" +#include "AliAnaParticleJetFinderCorrelation.h" +#include "AliLog.h" + + ClassImp(AliAnaParticleJetFinderCorrelation) + + +//____________________________________________________________________________ + AliAnaParticleJetFinderCorrelation::AliAnaParticleJetFinderCorrelation() : + AliAnaPartCorrBaseClass(), + fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), fRatioMaxCut(0.), fRatioMinCut(0.), + fConeSize(0), fPtThresholdInCone(0),fUseJetRefTracks(0), fMakeCorrelationInHistoMaker(0), + fhDeltaEta(0), fhDeltaPhi(0), fhDeltaPt(0), fhPtRatio(0), fhPt(0), + fhFFz(0),fhFFxi(0),fhFFpt(0),fhNTracksInCone(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaParticleJetFinderCorrelation::AliAnaParticleJetFinderCorrelation(const AliAnaParticleJetFinderCorrelation & pjf) : + AliAnaPartCorrBaseClass(pjf), + fDeltaPhiMaxCut(pjf.fDeltaPhiMaxCut), fDeltaPhiMinCut(pjf.fDeltaPhiMinCut), + fRatioMaxCut(pjf.fRatioMaxCut), fRatioMinCut(pjf.fRatioMinCut), + fConeSize(pjf.fConeSize), fPtThresholdInCone(pjf.fPtThresholdInCone), + fUseJetRefTracks(pjf.fUseJetRefTracks), fMakeCorrelationInHistoMaker(pjf.fMakeCorrelationInHistoMaker), + fhDeltaEta(pjf.fhDeltaEta), fhDeltaPhi(pjf.fhDeltaPhi), + fhDeltaPt(pjf.fhDeltaPt), fhPtRatio(pjf.fhPtRatio), fhPt(pjf.fhPt), + fhFFz(pjf.fhFFz),fhFFxi(pjf.fhFFxi),fhFFpt(pjf.fhFFpt), + fhNTracksInCone(pjf.fhNTracksInCone) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaParticleJetFinderCorrelation & AliAnaParticleJetFinderCorrelation::operator = (const AliAnaParticleJetFinderCorrelation & pjf) +{ + // assignment operator + + if(this == &pjf)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(pjf); + + fDeltaPhiMaxCut = pjf.fDeltaPhiMaxCut ; + fDeltaPhiMinCut = pjf.fDeltaPhiMinCut ; + fRatioMaxCut = pjf.fRatioMaxCut ; + fRatioMinCut = pjf.fRatioMinCut ; + fConeSize = pjf.fConeSize ; + fPtThresholdInCone = pjf.fPtThresholdInCone ; + fUseJetRefTracks = pjf.fUseJetRefTracks ; + fMakeCorrelationInHistoMaker = pjf.fMakeCorrelationInHistoMaker ; + + //Histograms + fhDeltaEta = pjf.fhDeltaEta; + fhDeltaPhi = pjf.fhDeltaPhi; + fhDeltaPt = pjf.fhDeltaPt; + fhPtRatio = pjf.fhPtRatio; + fhPt = pjf.fhPt; + + fhFFz = pjf.fhFFz; + fhFFxi = pjf.fhFFxi; + fhFFpt = pjf.fhFFpt; + fhNTracksInCone = pjf.fhNTracksInCone; + + return *this; + +} + +//____________________________________________________________________________ +//AliAnaParticleJetFinderCorrelation::~AliAnaParticleJetFinderCorrelation() +//{ +// // Remove all pointers except analysis output pointers. +// +//} + + +//________________________________________________________________________ +TList * AliAnaParticleJetFinderCorrelation::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + if(GetDebug()>1) printf("Init histograms \n"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("ParticleJetFinderHistos") ; + + fhDeltaPhi = new TH2F("DeltaPhi","#phi_{jet} - #phi_{trigger} vs p_{T trigger}",120,0,120,200,-4,4); + fhDeltaPhi->SetYTitle("#Delta #phi"); + fhDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + outputContainer->Add(fhDeltaPhi); + + fhDeltaEta = new TH2F("DeltaEta","#eta_{jet} - #eta_{trigger} vs p_{T trigger}",120,0,120,200,-5,5); + fhDeltaEta->SetYTitle("#Delta #eta"); + fhDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + outputContainer->Add(fhDeltaEta); + + fhDeltaPt = new TH2F("DeltaPt","#p_{T trigger} - #p_{T jet} vs p_{T trigger}",120,0,120,200,-100,100); + fhDeltaPt->SetYTitle("#Delta #p_{T}"); + fhDeltaPt->SetXTitle("p_{T trigger} (GeV/c)"); + outputContainer->Add(fhDeltaPt); + + fhPtRatio = new TH2F("PtRatio","#p_{T jet} / #p_{T trigger} vs p_{T trigger}",120,0,120,200,0,2.); + fhPtRatio->SetYTitle("ratio"); + fhPtRatio->SetXTitle("p_{T trigger} (GeV/c)"); + outputContainer->Add(fhPtRatio); + + fhPt = new TH2F("Pt","#p_{T jet} vs p_{T trigger}",120,0,120,120,0,120); + fhPt->SetYTitle("#p_{T jet}(GeV/c)"); + fhPt->SetXTitle("p_{T trigger} (GeV/c)"); + outputContainer->Add(fhPt); + + fhFFz = new TH2F("FFz","z = p_{T i charged}/p_{T trigger} vs p_{T trigger}", 120,0.,120.,200,0.,2); + fhFFz->SetYTitle("z"); + fhFFz->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhFFz) ; + + fhFFxi = new TH2F("FFxi","#xi = ln(p_{T trigger}/p_{T i charged}) vs p_{T trigger}", 120,0.,120.,100,0.,10.); + fhFFxi->SetYTitle("#xi"); + fhFFxi->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhFFxi) ; + + fhFFpt = new TH2F("FFpt","#xi = p_{T i charged}) vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhFFpt->SetYTitle("p_{T charged hadron}"); + fhFFpt->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhFFpt) ; + + fhNTracksInCone = new TH2F("NTracksInCone","#xi = p_{T i charged}) vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhNTracksInCone->SetYTitle("p_{T charged hadron}"); + fhNTracksInCone->SetXTitle("p_{T trigger}"); + outputContainer->Add(fhNTracksInCone) ; + + return outputContainer; +} + + //____________________________________________________________________________ +void AliAnaParticleJetFinderCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fDeltaPhiMinCut = 1.5 ; + fDeltaPhiMaxCut = 4.5 ; + fRatioMaxCut = 1.2 ; + fRatioMinCut = 0.3 ; + fConeSize = 0.3 ; + fPtThresholdInCone = 0.5 ; + fUseJetRefTracks = kFALSE ; + fMakeCorrelationInHistoMaker = kFALSE ; + } + +//__________________________________________________________________ +Int_t AliAnaParticleJetFinderCorrelation::SelectJet(AliAODParticleCorrelation * particle) +{ + //Returns the index of the jet that is opposite to the particle + + Int_t njets = (GetReader()->GetAOD())->GetNJets() ; + cout<<">> Loop on Jets"<GetAOD())->GetJet(ijet) ; + Float_t dphi = TMath::Abs(particle->Phi()-jet->Phi()); + Float_t ratio = jet->Pt()/particle->Pt(); + if(GetDebug() > 3) + printf("Jet %d, Ratio pT %2.3f, Delta phi %2.3f\n",ijet,ratio,dphi); + Float_t dphiprev= 10000; + if((dphi > fDeltaPhiMinCut) && (dphi fRatioMinCut) && (ratio < fRatioMaxCut) && + (TMath::Abs(dphi-3.14159) < TMath::Abs(dphiprev-3.14159))){//In case there is more than one jet select the most opposite. + dphiprev = dphi; + index = ijet ; + }//Selection cuts + }//AOD Jet loop + + return index ; + +} + +//__________________________________________________________________ +void AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Jet Correlation Analysis, fill AODs + + Int_t ntrig = GetAODBranch()->GetEntriesFast() ; + if(GetDebug() > -3){ + printf("Begin jet finder correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", ntrig); + printf("In jet branch aod entries %d\n", (GetReader()->GetAOD())->GetNJets()); + } + + //Loop on stored AOD particles, trigger + for(Int_t iaod = 0; iaod < ntrig ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + //cout<<">> Test reference "<GetRefJet()< -1){ + if(GetDebug() > 2) printf ("Jet with index %d selected \n",ijet); + AliAODJet *jet = (GetReader()->GetAOD())->GetJet(ijet); + particle->SetRefJet(jet); + } + } + + if(GetDebug() >1)printf("End of jet leading cone analysis, fill AODs \n"); +} + +//__________________________________________________________________ +void AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() +{ + //Particle-Jet Correlation Analysis, fill histograms + Int_t ntrig = GetAODBranch()->GetEntriesFast() ; + if(GetDebug() > 1){ + printf("Begin jet finder correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", ntrig); + printf("In jet branch aod entries %d\n", (GetReader()->GetAOD())->GetNJets()); + } + + //Loop on stored AOD particles, trigger + for(Int_t iaod = 0; iaod < ntrig ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + //cout<<">> Test reference "<GetRefJet()<GetJet(); + //If correlation not made before, do it now. + if(fMakeCorrelationInHistoMaker){ + //Correlate with jets + Int_t ijet = SelectJet(particle); + if(ijet > -1){ + if(GetDebug() > 2) printf ("Jet with index %d selected \n",ijet); + jet = (GetReader()->GetAOD())->GetJet(ijet); + particle->SetRefJet(jet); + } + } + + if (!jet) continue ; + + //Fill Histograms + + Double_t ptTrig = particle->Pt(); + Double_t ptJet = jet->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t phiJet = jet->Phi(); + Double_t etaTrig = particle->Eta(); + Double_t etaJet = jet->Eta(); + //printf("pT trigger %2.3f, pT jet %2.3f, Delta phi %2.3f, Delta eta %2.3f, Delta pT %2.3f, ratio %2.3f \n", + // ptTrig,ptJet, phiJet-phiTrig, etaJet-etaTrig, ptTrig-ptJet, ptJet/ptTrig); + fhDeltaPt ->Fill(ptTrig, ptTrig-ptJet); + fhDeltaPhi->Fill(ptTrig, phiJet-phiTrig); + fhDeltaEta->Fill(ptTrig, etaJet-etaTrig); + fhPtRatio ->Fill(ptTrig, ptJet/ptTrig); + fhPt ->Fill(ptTrig, ptJet); + + //Fragmentation function + Float_t rad = 0, pt = 0, eta = 0, phi = 0; + Int_t npartcone = 0; + TVector3 p3; + AliAODTrack* track = new AliAODTrack ; + + Int_t ntracks = 0; + if(!fUseJetRefTracks) + ntracks =GetAODCTS()->GetEntriesFast(); + else //If you want to use jet tracks from JETAN + ntracks = (jet->GetRefTracks())->GetEntriesFast(); + + for(Int_t ipr = 0;ipr < ntracks ; ipr ++ ){ + if(!fUseJetRefTracks) + track = dynamic_cast(GetAODCTS()->At(ipr)) ; + else //If you want to use jet tracks from JETAN + track = dynamic_cast((jet->GetRefTracks())->At(ipr)); + + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + pt = p3.Pt(); + eta = p3.Eta(); + phi = p3.Phi() ; + if(phi < 0) phi+=TMath::TwoPi(); + + //Check if there is any particle inside cone with pt larger than fPtThreshold + rad = TMath::Sqrt((eta-etaJet)*(eta-etaJet)+ (phi-phiJet)*(phi-phiJet)); + if(rad < fConeSize && pt > fPtThresholdInCone){ + //printf("charged in jet cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); + npartcone++; + fhFFz ->Fill(ptTrig, pt/ptTrig); + fhFFxi->Fill(ptTrig, TMath::Log(ptTrig/pt)); + fhFFpt->Fill(ptTrig, pt); + } + }//Tracks + fhNTracksInCone->Fill(ptTrig, npartcone); + }//AOD trigger particle loop + if(GetDebug() >1) printf("End of jet leading cone analysis, fill histograms \n"); +} + + +//__________________________________________________________________ +void AliAnaParticleJetFinderCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("Phi trigger-jet < %3.2f\n", fDeltaPhiMaxCut) ; + printf("Phi trigger-jet > %3.2f\n", fDeltaPhiMinCut) ; + printf("pT Ratio trigger/jet < %3.2f\n", fRatioMaxCut) ; + printf("pT Ratio trigger/jet > %3.2f\n", fRatioMinCut) ; + printf("fConeSize = %3.2f\n", fConeSize) ; + printf("fPtThresholdInCone = %3.2f\n", fPtThresholdInCone) ; + printf("fUseJetRefTracks = %d\n", fUseJetRefTracks) ; + printf("fMakeCorrelationInHistoMaker = %d\n", fMakeCorrelationInHistoMaker) ; +} + diff --git a/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.h b/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.h new file mode 100644 index 00000000000..c61f241c980 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleJetFinderCorrelation.h @@ -0,0 +1,94 @@ +#ifndef AliAnaParticleJetFinderCorrelation_H +#define AliAnaParticleJetFinderCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliAnaParticleJetFinderCorrelation.h 21839 2007-10-29 13:49:42Z gustavo $ */ + + +//_________________________________________________________________________ +// Class that contains the algorithm for the analysis of particle (direct gamma) - jet +// (standard jet found with JETAN) correlation +// Particle and jet for correlation found by independent algorithms. +// For Example direct isolated photon found in AliAnaGammaDirect and the jet with JETAN +// +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TH2F; + +//---- Analysis system ---- +class AliLog; +#include "AliAnaPartCorrBaseClass.h" + +class AliAnaParticleJetFinderCorrelation : public AliAnaPartCorrBaseClass { + + public: + + AliAnaParticleJetFinderCorrelation() ; // default ctor + AliAnaParticleJetFinderCorrelation(const AliAnaParticleJetFinderCorrelation & g) ; // cpy ctor + AliAnaParticleJetFinderCorrelation & operator = (const AliAnaParticleJetFinderCorrelation & g) ;//cpy assignment + virtual ~AliAnaParticleJetFinderCorrelation() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + Float_t GetConeSize() const {return fConeSize ; } + Float_t GetPtThresholdInCone() const {return fPtThresholdInCone ; } + Double_t GetDeltaPhiMaxCut() const {return fDeltaPhiMaxCut ; } + Double_t GetDeltaPhiMinCut() const {return fDeltaPhiMinCut ; } + Double_t GetRatioMaxCut() const {return fRatioMaxCut ; } + Double_t GetRatioMinCut() const {return fRatioMinCut ; } + Bool_t AreJetRefTracks() const {return fUseJetRefTracks ; } + Bool_t IsCorrelationMadeInHistoMaker() const {return fMakeCorrelationInHistoMaker ;} + + void SetConeSize(Float_t cone) {fConeSize = cone; } + void SetPtThresholdInCone(Float_t pt){fPtThresholdInCone = pt; }; + void SetDeltaPhiCutRange(Double_t phimin, Double_t phimax) + {fDeltaPhiMaxCut =phimax; fDeltaPhiMinCut =phimin;} + void SetRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fRatioMaxCut =ratiomax; fRatioMinCut = ratiomin ; } + void UseJetRefTracks(Bool_t use) {fUseJetRefTracks = use ; } + void SetMakeCorrelationInHistoMaker(Bool_t make) {fMakeCorrelationInHistoMaker = make ;} + + private: + + Int_t SelectJet(AliAODParticleCorrelation * particle) ; + + void MakeAnalysisFillAOD() ; + void MakeAnalysisFillHistograms() ; + + private: + + //selection parameters + Double_t fDeltaPhiMaxCut ; //! Minimum Delta Phi Gamma-Leading + Double_t fDeltaPhiMinCut ; //! Maximum Delta Phi Gamma-Leading + Double_t fRatioMaxCut ; //! Jet/ particle Ratio cut maximum + Double_t fRatioMinCut ; //! Jet/particle Ratio cut minimum + + Double_t fConeSize ; //! Jet cone size + Double_t fPtThresholdInCone ; //! Jet pT threshold in jet cone + Bool_t fUseJetRefTracks ; //! Use track references from JETAN not the AOD tracks + Bool_t fMakeCorrelationInHistoMaker ; //!Make particle-jet correlation in histogram maker + + TH2F * fhDeltaEta; //! Difference of jet eta and trigger particle eta as function of trigger particle pT + TH2F * fhDeltaPhi; //! Difference of jet phi and trigger particle phi as function of trigger particle pT + TH2F * fhDeltaPt; //! Difference of jet pT and trigger particle pT as function of trigger particle pT + TH2F * fhPtRatio; //! Ratio of jet pT and trigger particle pT as function of trigger particle pT + TH2F * fhPt; //! jet pT vs trigger particle pT + + TH2F * fhFFz ; //! Accepted reconstructed jet fragmentation function, z=ptjet/pttrig + TH2F * fhFFxi; //! Accepted reconstructed jet fragmentation function, xsi = ln(pttrig/ptjet) + TH2F * fhFFpt; //! Jet particle pt distribution in cone + TH2F * fhNTracksInCone ; //! jet multiplicity in cone + + ClassDef(AliAnaParticleJetFinderCorrelation,1) + } ; + + +#endif //AliAnaParticleJetFinderCorrelation_H + + + diff --git a/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.cxx b/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.cxx new file mode 100644 index 00000000000..1c4a9c75262 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.cxx @@ -0,0 +1,1509 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the reconstruction of jet, cone around leading particle +// The seed is a backward particle (direct photon) +// 1)Take the trigger particle stored in AliAODParticleCorrelation, +// 2) Search for the highest pt leading particle opposite to the photon within a phi, pt window +// 3) Take all particles around leading in a cone R with pt larger than threshold and construct the jet +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include "TH2F.h" + +//---- Analysis system ---- +#include "AliAODTrack.h" +#include "AliAODCaloCluster.h" +#include "AliCaloTrackReader.h" +#include "AliNeutralMesonSelection.h" +#include "AliLog.h" +#include "AliAnaParticleJetLeadingConeCorrelation.h" + + +ClassImp(AliAnaParticleJetLeadingConeCorrelation) + + +//____________________________________________________________________________ + AliAnaParticleJetLeadingConeCorrelation::AliAnaParticleJetLeadingConeCorrelation() : + AliAnaPartCorrBaseClass(), fJetsOnlyInCTS(kFALSE), fPbPb(kFALSE), + fSeveralConeAndPtCuts(0), fReMakeJet(0), + fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), + fLeadingRatioMaxCut(0.), fLeadingRatioMinCut(0.), + fJetCTSRatioMaxCut(0.), fJetCTSRatioMinCut(0.), + fJetRatioMaxCut(0.), fJetRatioMinCut(0.), + fJetNCone(0),fJetNPt(0), fJetCone(0), + fJetPtThreshold(0),fJetPtThresPbPb(0), + fPtTriggerSelectionCut(0.0), fSelect(0), + //Histograms + fOutCont(0x0), + fhChargedLeadingPt(0),fhChargedLeadingPhi(0),fhChargedLeadingEta(0), + fhChargedLeadingDeltaPt(0),fhChargedLeadingDeltaPhi(0),fhChargedLeadingDeltaEta(0), + fhChargedLeadingRatioPt(0), + fhNeutralLeadingPt(0),fhNeutralLeadingPhi(0),fhNeutralLeadingEta(0), + fhNeutralLeadingDeltaPt(0),fhNeutralLeadingDeltaPhi(0),fhNeutralLeadingDeltaEta(0), + fhNeutralLeadingRatioPt(0), + fhJetPt(0),fhJetRatioPt(0),fhJetDeltaPhi(0), fhJetDeltaEta(0), + fhJetLeadingRatioPt(0),fhJetLeadingDeltaPhi(0),fhJetLeadingDeltaEta(0), + fhJetFFz(0),fhJetFFxi(0),fhJetFFpt(0),fhJetNTracksInCone(0), + fhBkgPt(0),fhBkgRatioPt(0),fhBkgDeltaPhi(0), fhBkgDeltaEta(0), + fhBkgLeadingRatioPt(0),fhBkgLeadingDeltaPhi(0),fhBkgLeadingDeltaEta(0), + fhBkgFFz(0),fhBkgFFxi(0),fhBkgFFpt(0),fhBkgNTracksInCone(0), + //Several cones and thres histograms + fhJetPts(),fhJetRatioPts(),fhJetDeltaPhis(), fhJetDeltaEtas(), + fhJetLeadingRatioPts(),fhJetLeadingDeltaPhis(),fhJetLeadingDeltaEtas(), + fhJetFFzs(),fhJetFFxis(),fhJetFFpts(),fhJetNTracksInCones(), + fhBkgPts(),fhBkgRatioPts(),fhBkgDeltaPhis(), fhBkgDeltaEtas(), + fhBkgLeadingRatioPts(),fhBkgLeadingDeltaPhis(),fhBkgLeadingDeltaEtas(), + fhBkgFFzs(),fhBkgFFxis(),fhBkgFFpts(),fhBkgNTracksInCones() +{ + //Default Ctor + + //Initialize parameters + + for(Int_t i = 0; i<6; i++){ + fJetXMin1[i] = 0.0 ; + fJetXMin2[i] = 0.0 ; + fJetXMax1[i] = 0.0 ; + fJetXMax2[i] = 0.0 ; + fBkgMean[i] = 0.0 ; + fBkgRMS[i] = 0.0 ; + if( i < 2 ){ + fJetE1[i] = 0.0 ; + fJetE2[i] = 0.0 ; + fJetSigma1[i] = 0.0 ; + fJetSigma2[i] = 0.0 ; + } + } + + //Several cones and thres histograms + for(Int_t i = 0; i<5; i++){ + fJetCones[i] = 0.0 ; + fJetNameCones[i] = "" ; + fJetPtThres[i] = 0.0 ; + fJetNamePtThres[i] = "" ; + for(Int_t j = 0; j<5; j++){ + fhJetPts[i][j]=0 ; + fhJetRatioPts[i][j]=0 ; + fhJetDeltaPhis[i][j]=0 ; + fhJetDeltaEtas[i][j]=0 ; + fhJetLeadingRatioPts[i][j]=0 ; + fhJetLeadingDeltaPhis[i][j]=0 ; + fhJetLeadingDeltaEtas[i][j]=0 ; + fhJetFFzs[i][j]=0 ; + fhJetFFxis[i][j]=0 ; + fhJetFFpts[i][j]=0 ; + fhJetNTracksInCones[i][j]=0 ; + fhBkgPts[i][j]=0 ; + fhBkgRatioPts[i][j]=0 ; + fhBkgDeltaPhis[i][j]=0 ; + fhBkgDeltaEtas[i][j]=0 ; + fhBkgLeadingRatioPts[i][j]=0 ; + fhBkgLeadingDeltaPhis[i][j]=0 ; + fhBkgLeadingDeltaEtas[i][j]=0 ; + fhBkgFFzs[i][j]=0 ; + fhBkgFFxis[i][j]=0 ; + fhBkgFFpts[i][j]=0 ; + fhBkgNTracksInCones[i][j]=0 ; + } + } + + InitParameters(); + +} + +//____________________________________________________________________________ +AliAnaParticleJetLeadingConeCorrelation::AliAnaParticleJetLeadingConeCorrelation(const AliAnaParticleJetLeadingConeCorrelation & jetlc) : + AliAnaPartCorrBaseClass(jetlc), fJetsOnlyInCTS(jetlc.fJetsOnlyInCTS), fPbPb(jetlc.fPbPb), + fSeveralConeAndPtCuts(jetlc.fSeveralConeAndPtCuts), fReMakeJet(jetlc. fReMakeJet), + fDeltaPhiMaxCut(jetlc. fDeltaPhiMaxCut), fDeltaPhiMinCut(jetlc.fDeltaPhiMinCut), + fLeadingRatioMaxCut(jetlc.fLeadingRatioMaxCut), fLeadingRatioMinCut(jetlc.fLeadingRatioMinCut), + fJetCTSRatioMaxCut(jetlc.fJetCTSRatioMaxCut), + fJetCTSRatioMinCut(jetlc.fJetCTSRatioMinCut), fJetRatioMaxCut(jetlc.fJetRatioMaxCut), + fJetRatioMinCut(jetlc.fJetRatioMinCut), fJetNCone(jetlc.fJetNCone), + fJetNPt(jetlc.fJetNPt), fJetCone(jetlc.fJetCone), + fJetPtThreshold(jetlc.fJetPtThreshold),fJetPtThresPbPb(jetlc.fJetPtThresPbPb), + fPtTriggerSelectionCut(jetlc.fPtTriggerSelectionCut), fSelect(jetlc.fSelect), + //Histograms + fOutCont(jetlc. fOutCont), + fhChargedLeadingPt(jetlc.fhChargedLeadingPt), fhChargedLeadingPhi(jetlc.fhChargedLeadingPhi), + fhChargedLeadingEta(jetlc.fhChargedLeadingEta), fhChargedLeadingDeltaPt(jetlc.fhChargedLeadingDeltaPt), + fhChargedLeadingDeltaPhi(jetlc.fhChargedLeadingDeltaPhi),fhChargedLeadingDeltaEta(jetlc.fhChargedLeadingDeltaEta), + fhChargedLeadingRatioPt(jetlc.fhChargedLeadingRatioPt), + fhNeutralLeadingPt(jetlc.fhNeutralLeadingPt),fhNeutralLeadingPhi(jetlc.fhNeutralLeadingPhi), + fhNeutralLeadingEta(jetlc.fhNeutralLeadingEta), fhNeutralLeadingDeltaPt(jetlc.fhNeutralLeadingDeltaPt), + fhNeutralLeadingDeltaPhi(jetlc.fhNeutralLeadingDeltaPhi),fhNeutralLeadingDeltaEta(jetlc.fhNeutralLeadingDeltaEta), + fhNeutralLeadingRatioPt(jetlc.fhNeutralLeadingRatioPt), + fhJetPt(jetlc.fhJetPt),fhJetRatioPt(jetlc.fhJetRatioPt),fhJetDeltaPhi(jetlc.fhJetDeltaPhi), + fhJetDeltaEta(jetlc.fhJetDeltaEta), fhJetLeadingRatioPt(jetlc.fhJetLeadingRatioPt), + fhJetLeadingDeltaPhi(jetlc.fhJetLeadingDeltaPhi),fhJetLeadingDeltaEta(jetlc.fhJetLeadingDeltaEta), + fhJetFFz(jetlc.fhJetFFz),fhJetFFxi(jetlc.fhJetFFxi),fhJetFFpt(jetlc.fhJetFFpt), + fhJetNTracksInCone(jetlc.fhJetNTracksInCone), + fhBkgPt(jetlc.fhBkgPt),fhBkgRatioPt(jetlc.fhBkgRatioPt),fhBkgDeltaPhi(jetlc.fhBkgDeltaPhi), + fhBkgDeltaEta(jetlc.fhBkgDeltaEta), fhBkgLeadingRatioPt(jetlc.fhBkgLeadingRatioPt), + fhBkgLeadingDeltaPhi(jetlc.fhBkgLeadingDeltaPhi),fhBkgLeadingDeltaEta(jetlc.fhBkgLeadingDeltaEta), + fhBkgFFz(jetlc.fhBkgFFz),fhBkgFFxi(jetlc.fhBkgFFxi),fhBkgFFpt(jetlc.fhBkgFFpt), + fhBkgNTracksInCone(jetlc.fhBkgNTracksInCone), + //Several cones and thres histograms + fhJetPts(),fhJetRatioPts(),fhJetDeltaPhis(), fhJetDeltaEtas(), + fhJetLeadingRatioPts(),fhJetLeadingDeltaPhis(),fhJetLeadingDeltaEtas(), + fhJetFFzs(),fhJetFFxis(),fhJetFFpts(),fhJetNTracksInCones(), + fhBkgPts(),fhBkgRatioPts(),fhBkgDeltaPhis(), fhBkgDeltaEtas(), + fhBkgLeadingRatioPts(),fhBkgLeadingDeltaPhis(),fhBkgLeadingDeltaEtas(), + fhBkgFFzs(),fhBkgFFxis(),fhBkgFFpts(),fhBkgNTracksInCones() +{ + // cpy ctor + + for(Int_t i = 0; i<6; i++){ + fJetXMin1[i] = jetlc.fJetXMin1[i] ; + fJetXMin2[i] = jetlc.fJetXMin2[i] ; + fJetXMax1[i] = jetlc.fJetXMax1[i] ; + fJetXMax2[i] = jetlc.fJetXMax2[i] ; + fBkgMean[i] = jetlc.fBkgMean[i] ; + fBkgRMS[i] = jetlc.fBkgRMS[i] ; + if( i < 2 ){ + fJetE1[i] = jetlc.fJetE1[i] ; + fJetE2[i] = jetlc.fJetE2[i] ; + fJetSigma1[i] = jetlc.fJetSigma1[i] ; + fJetSigma2[i] = jetlc.fJetSigma2[i] ; + } + } + + //Several cones and thres histograms + for(Int_t i = 0; i<5; i++){ + fJetCones[i] = jetlc.fJetCones[i] ; + fJetNameCones[i] = jetlc.fJetNameCones[i] ; + fJetPtThres[i] = jetlc.fJetPtThres[i] ; + fJetNamePtThres[i] = jetlc.fJetNamePtThres[i] ; + for(Int_t j = 0; j<5; j++){ + fhJetPts[i][j] = jetlc.fhJetPts[i][j] ; + fhJetRatioPts[i][j] = jetlc.fhJetRatioPts[i][j] ; + fhJetDeltaPhis[i][j] = jetlc.fhJetDeltaPhis[i][j] ; + fhJetDeltaEtas[i][j] = jetlc.fhJetDeltaEtas[i][j] ; + fhJetLeadingRatioPts[i][j] = jetlc.fhJetLeadingRatioPts[i][j] ; + fhJetLeadingDeltaPhis[i][j] = jetlc.fhJetLeadingDeltaPhis[i][j] ; + fhJetLeadingDeltaEtas[i][j] = jetlc.fhJetLeadingDeltaEtas[i][j] ; + fhJetFFzs[i][j] = jetlc.fhJetFFzs[i][j] ; + fhJetFFxis[i][j] = jetlc.fhJetFFxis[i][j] ; + fhJetFFpts[i][j] = jetlc.fhJetFFpts[i][j] ; + fhJetNTracksInCones[i][j] = fhJetNTracksInCones[i][j] ; + fhBkgPts[i][j] = jetlc.fhBkgPts[i][j] ; + fhBkgRatioPts[i][j] = jetlc.fhBkgRatioPts[i][j] ; + fhBkgDeltaPhis[i][j] = jetlc.fhBkgDeltaPhis[i][j] ; + fhBkgDeltaEtas[i][j] = jetlc.fhBkgDeltaEtas[i][j] ; + fhBkgLeadingRatioPts[i][j] = jetlc.fhBkgLeadingRatioPts[i][j] ; + fhBkgLeadingDeltaPhis[i][j] = jetlc.fhBkgLeadingDeltaPhis[i][j] ; + fhBkgLeadingDeltaEtas[i][j] = jetlc.fhBkgLeadingDeltaEtas[i][j] ; + fhBkgFFzs[i][j] = jetlc.fhBkgFFzs[i][j] ; + fhBkgFFxis[i][j] = jetlc.fhBkgFFxis[i][j] ; + fhBkgFFpts[i][j] = jetlc.fhBkgFFpts[i][j] ; + fhBkgNTracksInCones[i][j] = jetlc.fhBkgNTracksInCones[i][j] ; + } + } +} + +//_________________________________________________________________________ +AliAnaParticleJetLeadingConeCorrelation & AliAnaParticleJetLeadingConeCorrelation::operator = (const AliAnaParticleJetLeadingConeCorrelation & jetlc) +{ + // assignment operator + + if(this == &jetlc)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(jetlc); + + fSeveralConeAndPtCuts = jetlc.fSeveralConeAndPtCuts ; + fPbPb = jetlc.fPbPb ; + fReMakeJet = jetlc.fReMakeJet ; + fJetsOnlyInCTS = jetlc.fJetsOnlyInCTS; + + fDeltaPhiMaxCut = jetlc.fDeltaPhiMaxCut ; + fDeltaPhiMinCut = jetlc.fDeltaPhiMinCut ; + fLeadingRatioMaxCut = jetlc.fLeadingRatioMaxCut ; + fLeadingRatioMinCut = jetlc.fLeadingRatioMinCut ; + + fJetCTSRatioMaxCut = jetlc.fJetCTSRatioMaxCut ; + fJetCTSRatioMinCut = jetlc.fJetCTSRatioMinCut ; + fJetRatioMaxCut = jetlc.fJetRatioMaxCut ; + fJetRatioMinCut = jetlc.fJetRatioMinCut ; + + fJetNCone = jetlc.fJetNCone ; + fJetNPt = jetlc.fJetNPt ; fJetCone = jetlc.fJetCone ; + fJetPtThreshold = jetlc.fJetPtThreshold ; + fJetPtThresPbPb = jetlc.fJetPtThresPbPb ; + fPtTriggerSelectionCut = jetlc.fPtTriggerSelectionCut ; + fSelect = jetlc.fSelect ; + + for(Int_t i = 0; i<6; i++){ + fJetXMin1[i] = jetlc.fJetXMin1[i] ; + fJetXMin2[i] = jetlc.fJetXMin2[i] ; + fJetXMax1[i] = jetlc.fJetXMax1[i] ; + fJetXMax2[i] = jetlc.fJetXMax2[i] ; + fBkgMean[i] = jetlc.fBkgMean[i] ; + fBkgRMS[i] = jetlc.fBkgRMS[i] ; + if( i < 2 ){ + fJetE1[i] = jetlc.fJetE1[i] ; + fJetE2[i] = jetlc.fJetE2[i] ; + fJetSigma1[i] = jetlc.fJetSigma1[i] ; + fJetSigma2[i] = jetlc.fJetSigma2[i] ; + } + } + + //Histograms + fOutCont = jetlc. fOutCont ; + fhChargedLeadingPt = jetlc.fhChargedLeadingPt; fhChargedLeadingPhi = jetlc.fhChargedLeadingPhi; + fhChargedLeadingEta = jetlc.fhChargedLeadingEta; fhChargedLeadingDeltaPt = jetlc.fhChargedLeadingDeltaPt; + fhChargedLeadingDeltaPhi = jetlc.fhChargedLeadingDeltaPhi;fhChargedLeadingDeltaEta = jetlc.fhChargedLeadingDeltaEta; + fhChargedLeadingRatioPt = jetlc.fhChargedLeadingRatioPt; + fhNeutralLeadingPt = jetlc.fhNeutralLeadingPt;fhNeutralLeadingPhi = jetlc.fhNeutralLeadingPhi; + fhNeutralLeadingEta = jetlc.fhNeutralLeadingEta; fhNeutralLeadingDeltaPt = jetlc.fhNeutralLeadingDeltaPt; + fhNeutralLeadingDeltaPhi = jetlc.fhNeutralLeadingDeltaPhi;fhNeutralLeadingDeltaEta = jetlc.fhNeutralLeadingDeltaEta; + fhNeutralLeadingRatioPt = jetlc.fhNeutralLeadingRatioPt; + fhJetPt = jetlc.fhJetPt;fhJetRatioPt = jetlc.fhJetRatioPt;fhJetDeltaPhi = jetlc.fhJetDeltaPhi; + fhJetDeltaEta = jetlc.fhJetDeltaEta; fhJetLeadingRatioPt = jetlc.fhJetLeadingRatioPt; + fhJetLeadingDeltaPhi = jetlc.fhJetLeadingDeltaPhi;fhJetLeadingDeltaEta = jetlc.fhJetLeadingDeltaEta; + fhJetFFz = jetlc.fhJetFFz;fhJetFFxi = jetlc.fhJetFFxi;fhJetFFpt = jetlc.fhJetFFpt; + fhJetNTracksInCone = jetlc.fhJetNTracksInCone; + fhBkgPt = jetlc.fhBkgPt;fhBkgRatioPt = jetlc.fhBkgRatioPt;fhBkgDeltaPhi = jetlc.fhBkgDeltaPhi; + fhBkgDeltaEta = jetlc.fhBkgDeltaEta; fhBkgLeadingRatioPt = jetlc.fhBkgLeadingRatioPt; + fhBkgLeadingDeltaPhi = jetlc.fhBkgLeadingDeltaPhi;fhBkgLeadingDeltaEta = jetlc.fhBkgLeadingDeltaEta; + fhBkgFFz = jetlc.fhBkgFFz;fhBkgFFxi = jetlc.fhBkgFFxi;fhBkgFFpt = jetlc.fhBkgFFpt; + fhBkgNTracksInCone = jetlc.fhBkgNTracksInCone; + + + //Several cones and thres histograms + for(Int_t i = 0; i<5; i++){ + fJetCones[i] = jetlc.fJetCones[i] ; + fJetNameCones[i] = jetlc.fJetNameCones[i] ; + fJetPtThres[i] = jetlc.fJetPtThres[i] ; + fJetNamePtThres[i] = jetlc.fJetNamePtThres[i] ; + + for(Int_t j = 0; j<5; j++){ + fhJetPts[i][j] = jetlc.fhJetPts[i][j] ; + fhJetRatioPts[i][j] = jetlc.fhJetRatioPts[i][j] ; + fhJetDeltaPhis[i][j] = jetlc.fhJetDeltaPhis[i][j] ; + fhJetDeltaEtas[i][j] = jetlc.fhJetDeltaEtas[i][j] ; + fhJetLeadingRatioPts[i][j] = jetlc.fhJetLeadingRatioPts[i][j] ; + fhJetLeadingDeltaPhis[i][j] = jetlc.fhJetLeadingDeltaPhis[i][j] ; + fhJetLeadingDeltaEtas[i][j] = jetlc.fhJetLeadingDeltaEtas[i][j] ; + fhJetFFzs[i][j] = jetlc.fhJetFFzs[i][j] ; + fhJetFFxis[i][j] = jetlc.fhJetFFxis[i][j] ; + fhJetFFpts[i][j] = jetlc.fhJetFFpts[i][j] ; + fhJetNTracksInCones[i][j] = fhJetNTracksInCones[i][j] ; + fhBkgPts[i][j] = jetlc.fhBkgPts[i][j] ; + fhBkgRatioPts[i][j] = jetlc.fhBkgRatioPts[i][j] ; + fhBkgDeltaPhis[i][j] = jetlc.fhBkgDeltaPhis[i][j] ; + fhBkgDeltaEtas[i][j] = jetlc.fhBkgDeltaEtas[i][j] ; + fhBkgLeadingRatioPts[i][j] = jetlc.fhBkgLeadingRatioPts[i][j] ; + fhBkgLeadingDeltaPhis[i][j] = jetlc.fhBkgLeadingDeltaPhis[i][j] ; + fhBkgLeadingDeltaEtas[i][j] = jetlc.fhBkgLeadingDeltaEtas[i][j] ; + fhBkgFFzs[i][j] = jetlc.fhBkgFFzs[i][j] ; + fhBkgFFxis[i][j] = jetlc.fhBkgFFxis[i][j] ; + fhBkgFFpts[i][j] = jetlc.fhBkgFFpts[i][j] ; + fhBkgNTracksInCones[i][j] = jetlc.fhBkgNTracksInCones[i][j] ; + } + } + + return *this; + +} + +//____________________________________________________________________________ +AliAnaParticleJetLeadingConeCorrelation::~AliAnaParticleJetLeadingConeCorrelation() +{ + // Remove all pointers except analysis output pointers. + delete [] fJetE1; + delete [] fJetE2; + delete [] fJetSigma1; + delete [] fJetSigma2; + delete [] fBkgMean; + delete [] fBkgRMS; + delete [] fJetXMin1; + delete [] fJetXMin2; + delete [] fJetXMax1; + delete [] fJetXMax2; + delete [] fJetCones; + delete [] fJetNameCones; + delete [] fJetPtThres; + delete [] fJetNamePtThres; +} + +//____________________________________________________________________________ +Double_t AliAnaParticleJetLeadingConeCorrelation::CalculateJetRatioLimit(const Double_t ptg, const Double_t *par, const Double_t *x) { + //Calculate the ratio of the jet and trigger particle limit for the selection + //WARNING: need to check what it does + //Info("CalculateLimit","x1 %f, x2%f",x[0],x[1]); + Double_t Epp = par[0] + par[1] * ptg ; + Double_t Spp = par[2] + par[3] * ptg ; + Double_t f = x[0] + x[1] * ptg ; + Double_t Epb = Epp + par[4] ; + Double_t Spb = TMath::Sqrt(Spp*Spp+ par[5]*par[5]) ; + Double_t rat = (Epb - Spb * f) / ptg ; + //Info("CalculateLimit","Epp %f, Spp %f, f %f", Epp, Spp, f); + //Info("CalculateLimit","Epb %f, Spb %f, rat %f", Epb, Spb, rat); + return rat ; +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODParticleCorrelation * particle, const TLorentzVector leading, const TLorentzVector jet, const TString type, const TString lastname) +{ + //Fill jet and background histograms + Double_t ptTrig = particle->Pt(); + Double_t ptJet = jet.Pt(); + Double_t ptLead = leading.Pt(); + Double_t phiTrig = particle->Phi(); + Double_t phiJet = jet.Phi(); + Double_t phiLead = leading.Phi(); + Double_t etaTrig = particle->Eta(); + Double_t etaJet = jet.Eta(); + Double_t etaLead = leading.Eta(); + + dynamic_cast(GetOutputContainer()->FindObject(type+"Pt"+lastname))-> + Fill(ptTrig,ptJet); + dynamic_cast(GetOutputContainer()->FindObject(type+"RatioPt"+lastname))-> + Fill(ptTrig,ptJet/ptTrig); + dynamic_cast(GetOutputContainer()->FindObject(type+"LeadingRatioPt"+lastname))-> + Fill(ptTrig,ptLead/ptJet); +// dynamic_cast(GetOutputContainer()->FindObject(type+"Phi"+lastname))-> +// Fill(ptTrig,phiJet); + dynamic_cast(GetOutputContainer()->FindObject(type+"DeltaPhi"+lastname))-> + Fill(ptTrig,phiJet-phiTrig); + dynamic_cast(GetOutputContainer()->FindObject(type+"LeadingDeltaPhi"+lastname))-> + Fill(ptTrig,phiJet-phiLead); + + // dynamic_cast(GetOutputContainer()->FindObject(type+"Eta"+lastname))-> + // Fill(ptTrig,etaJet); + dynamic_cast(GetOutputContainer()->FindObject(type+"DeltaEta"+lastname))-> + Fill(ptTrig,etaJet-etaTrig); + dynamic_cast(GetOutputContainer()->FindObject(type+"LeadingDeltaEta"+lastname))-> + Fill(ptTrig,etaJet-etaLead); + + //Construct fragmentation function + TRefArray * pl = new TRefArray; + if(type == "Jet") pl = particle->GetRefTracks(); + else if(type == "Bkg") pl = particle->GetRefBackgroundTracks(); + + //Different pt cut for jet particles in different collisions systems + //Only needed when jet is recalculated from AODs + Float_t ptcut = fJetPtThreshold; + if(fPbPb && !fSeveralConeAndPtCuts && ptTrig > fPtTriggerSelectionCut) ptcut = fJetPtThresPbPb ; + + TVector3 p3; + Int_t nTracksInCone = 0; + for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast(pl->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + + //Recheck if particle is in jet cone + if(fReMakeJet || fSeveralConeAndPtCuts) + if(!IsParticleInJetCone(p3.Eta(), p3.Phi(), leading.Eta(), leading.Phi()) ) continue ; + + nTracksInCone++; + + dynamic_cast(GetOutputContainer()->FindObject(type+"FFz"+lastname)) + ->Fill(ptTrig,p3.Pt()/ptTrig); + dynamic_cast(GetOutputContainer()->FindObject(type+"FFxi"+lastname)) + ->Fill(ptTrig,TMath::Log(ptTrig/p3.Pt())); + dynamic_cast(GetOutputContainer()->FindObject(type+"FFpt"+lastname)) + ->Fill(ptTrig,p3.Pt()); + + }//track loop + + if(nTracksInCone > 0) dynamic_cast(GetOutputContainer()->FindObject(type+"NTracksInCone"+lastname)) + ->Fill(ptTrig, nTracksInCone); + +} + +//________________________________________________________________________ +TList * AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutCont + + if(GetDebug()>1) printf("Init histograms \n"); + + fOutCont = new TList() ; + fOutCont->SetName("ParticleJetLeadingInConeCorrelationHistograms") ; + + fhChargedLeadingPt = new TH2F("ChargedLeadingPt","p_{T leading charge} vs p_{T trigger}",120,0,120,120,0,120); + fhChargedLeadingPt->SetYTitle("p_{T leading charge} /p_{T trigger}"); + fhChargedLeadingPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingPhi = new TH2F("ChargedLeadingPhi","#phi_{h^{#pm}} vs p_{T trigger}", 120,0,120,120,0,TMath::TwoPi()); + fhChargedLeadingPhi->SetYTitle("#phi_{h^{#pm}} (rad)"); + fhChargedLeadingPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingEta = new TH2F("ChargedLeadingEta","#eta_{h^{#pm}} vs p_{T trigger}",120,0,120,120,-1,1); + fhChargedLeadingEta->SetYTitle("#eta_{h^{#pm}} "); + fhChargedLeadingEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingDeltaPt = new TH2F("ChargedLeadingDeltaPt","#p_{T trigger} - #p_{T h^{#pm}} vs p_{T trigger}",120,0,120,120,0,120); + fhChargedLeadingDeltaPt->SetYTitle("#Delta p_{T} (GeV/c)"); + fhChargedLeadingDeltaPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingDeltaPhi = new TH2F("ChargedLeadingDeltaPhi","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhChargedLeadingDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhChargedLeadingDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingDeltaEta = new TH2F("ChargedLeadingDeltaEta","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}",120,0,120,120,-2,2); + fhChargedLeadingDeltaEta->SetYTitle("#Delta #eta"); + fhChargedLeadingDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingRatioPt = new TH2F("ChargedLeadingRatioPt","p_{T leading charge} /p_{T trigger} vs p_{T trigger}",120,0,120,120,0,2); + fhChargedLeadingRatioPt->SetYTitle("p_{T lead charge} /p_{T trigger}"); + fhChargedLeadingRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhChargedLeadingPt) ; + fOutCont->Add(fhChargedLeadingPhi) ; + fOutCont->Add(fhChargedLeadingEta) ; + fOutCont->Add(fhChargedLeadingDeltaPt) ; + fOutCont->Add(fhChargedLeadingDeltaPhi) ; + fOutCont->Add(fhChargedLeadingDeltaEta) ; + fOutCont->Add(fhChargedLeadingRatioPt) ; + + if(!fJetsOnlyInCTS){ + + fhNeutralLeadingPt = new TH2F("NeutralLeadingPt","p_{T leading #pi^{0}} vs p_{T trigger}",120,0,120,120,0,120); + fhNeutralLeadingPt->SetYTitle("p_{T leading #pi^{0}} /p_{T trigger}"); + fhNeutralLeadingPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingPhi = new TH2F("NeutralLeadingPhi","#phi_{#pi^{0}} vs p_{T trigger}", 120,0,120,120,0,TMath::TwoPi()); + fhNeutralLeadingPhi->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhNeutralLeadingPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingEta = new TH2F("NeutralLeadingEta","#eta_{#pi^{0}} vs p_{T trigger}",120,0,120,120,-1,1); + fhNeutralLeadingEta->SetYTitle("#eta_{#pi^{0}} "); + fhNeutralLeadingEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingDeltaPt = new TH2F("NeutralLeadingDeltaPt","#p_{T trigger} - #p_{T #pi^{0}} vs p_{T trigger}",120,0,120,120,0,120); + fhNeutralLeadingDeltaPt->SetYTitle("#Delta p_{T} (GeV/c)"); + fhNeutralLeadingDeltaPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingDeltaPhi = new TH2F("NeutralLeadingDeltaPhi","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhNeutralLeadingDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhNeutralLeadingDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingDeltaEta = new TH2F("NeutralLeadingDeltaEta","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}",120,0,120,120,-2,2); + fhNeutralLeadingDeltaEta->SetYTitle("#Delta #eta"); + fhNeutralLeadingDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingRatioPt = new TH2F("NeutralLeadingRatioPt","p_{T leading #pi^{0}} /p_{T trigger} vs p_{T trigger}",120,0,120,120,0,2); + fhNeutralLeadingRatioPt->SetYTitle("p_{T lead #pi^{0}} /p_{T trigger}"); + fhNeutralLeadingRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhNeutralLeadingPt) ; + fOutCont->Add(fhNeutralLeadingPhi) ; + fOutCont->Add(fhNeutralLeadingEta) ; + fOutCont->Add(fhNeutralLeadingDeltaPt) ; + fOutCont->Add(fhNeutralLeadingDeltaPhi) ; + fOutCont->Add(fhNeutralLeadingDeltaEta) ; + fOutCont->Add(fhNeutralLeadingRatioPt) ; + + } + + if(!fSeveralConeAndPtCuts){// not several cones + + //Jet Distributions + fhJetPt = new TH2F("JetPt","p_{T jet} vs p_{T trigger}",120,0,120,120,0,120); + fhJetPt->SetYTitle("p_{T jet}"); + fhJetPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetRatioPt = new TH2F("JetRatioPt","p_{T jet}/p_{T trigger} vs p_{T trigger}",120,0,120,120,0,2); + fhJetRatioPt->SetYTitle("p_{T jet}/p_{T trigger}"); + fhJetRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetDeltaPhi = new TH2F("JetDeltaPhi","#phi_{jet} - #phi_{trigger} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhJetDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhJetDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetDeltaEta = new TH2F("JetDeltaEta","#eta_{jet} - #eta_{trigger} vs p_{T trigger}",120,0,120,120,-2,2); + fhJetDeltaEta->SetYTitle("#Delta #eta"); + fhJetDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingRatioPt = new TH2F("JetLeadingRatioPt","p_{T jet} vs p_{T trigger}",120,0,120,120,0,2); + fhJetLeadingRatioPt->SetYTitle("p_{T leading}/p_{T jet}"); + fhJetLeadingRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingDeltaPhi = new TH2F("JetLeadingDeltaPhi","#phi_{jet} - #phi_{leading} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhJetLeadingDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhJetLeadingDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingDeltaEta = new TH2F("JetLeadingDeltaEta","#eta_{jet} - #eta_{leading} vs p_{T trigger}",120,0,120,120,-2,2); + fhJetLeadingDeltaEta->SetYTitle("#Delta #eta"); + fhJetLeadingDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetFFz = new TH2F("JetFFz","z = p_{T i charged}/p_{T trigger} vs p_{T trigger}", 120,0.,120.,200,0.,2); + fhJetFFz->SetYTitle("z"); + fhJetFFz->SetXTitle("p_{T trigger}"); + + fhJetFFxi = new TH2F("JetFFxi","#xi = ln(p_{T trigger}/p_{T i charged}) vs p_{T trigger}", 120,0.,120.,100,0.,10.); + fhJetFFxi->SetYTitle("#xi"); + fhJetFFxi->SetXTitle("p_{T trigger}"); + + fhJetFFpt = new TH2F("JetFFpt","#xi = p_{T i charged}) vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhJetFFpt->SetYTitle("p_{T charged hadron}"); + fhJetFFpt->SetXTitle("p_{T trigger}"); + + fhJetNTracksInCone = new TH2F("JetNTracksInCone","N particles in cone vs p_{T trigger}",120,0,120,5000,0, 5000); + fhJetNTracksInCone->SetYTitle("N tracks in jet cone"); + fhJetNTracksInCone->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhJetPt) ; + fOutCont->Add(fhJetRatioPt) ; + fOutCont->Add(fhJetDeltaPhi) ; + fOutCont->Add(fhJetDeltaEta) ; + fOutCont->Add(fhJetLeadingRatioPt) ; + fOutCont->Add(fhJetLeadingDeltaPhi) ; + fOutCont->Add(fhJetLeadingDeltaEta) ; + fOutCont->Add(fhJetFFz) ; + fOutCont->Add(fhJetFFxi) ; + fOutCont->Add(fhJetFFpt) ; + fOutCont->Add(fhJetNTracksInCone) ; + + //Bkg Distributions + fhBkgPt = new TH2F("BkgPt","p_{T bkg} vs p_{T trigger}",120,0,120,120,0,120); + fhBkgPt->SetYTitle("p_{T bkg}"); + fhBkgPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgRatioPt = new TH2F("BkgRatioPt","p_{T bkg}/p_{T trigger} vs p_{T trigger}",120,0,120,120,0,2); + fhBkgRatioPt->SetYTitle("p_{T bkg}/p_{T trigger}"); + fhBkgRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgDeltaPhi = new TH2F("BkgDeltaPhi","#phi_{bkg} - #phi_{trigger} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhBkgDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhBkgDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgDeltaEta = new TH2F("BkgDeltaEta","#eta_{bkg} - #eta_{trigger} vs p_{T trigger}",120,0,120,120,-2,2); + fhBkgDeltaEta->SetYTitle("#Delta #eta"); + fhBkgDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingRatioPt = new TH2F("BkgLeadingRatioPt","p_{T bkg} vs p_{T trigger}",120,0,120,120,0,2); + fhBkgLeadingRatioPt->SetYTitle("p_{T leading}/p_{T bkg}"); + fhBkgLeadingRatioPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingDeltaPhi = new TH2F("BkgLeadingDeltaPhi","#phi_{bkg} - #phi_{leading} vs p_{T trigger}",120,0,120,120,0,TMath::TwoPi()); + fhBkgLeadingDeltaPhi->SetYTitle("#Delta #phi (rad)"); + fhBkgLeadingDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingDeltaEta = new TH2F("BkgLeadingDeltaEta","#eta_{bkg} - #eta_{leading} vs p_{T trigger}",120,0,120,120,-2,2); + fhBkgLeadingDeltaEta->SetYTitle("#Delta #eta"); + fhBkgLeadingDeltaEta->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgFFz = new TH2F("BkgFFz","z = p_{T i charged}/p_{T trigger} vs p_{T trigger}", 120,0.,120.,200,0.,2); + fhBkgFFz->SetYTitle("z"); + fhBkgFFz->SetXTitle("p_{T trigger}"); + + fhBkgFFxi = new TH2F("BkgFFxi","#xi = ln(p_{T trigger}/p_{T i charged}) vs p_{T trigger}", 120,0.,120.,100,0.,10.); + fhBkgFFxi->SetYTitle("#xi"); + fhBkgFFxi->SetXTitle("p_{T trigger}"); + + fhBkgFFpt = new TH2F("BkgFFpt","p_{T charged hadron } vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhBkgFFpt->SetYTitle("p_{T charged} hadron"); + fhBkgFFpt->SetXTitle("p_{T trigger}"); + + fhBkgNTracksInCone = new TH2F("BkgNTracksInCone","N particles in cone vs p_{T trigger}",120,0,120,5000,0, 5000); + fhBkgNTracksInCone->SetYTitle("N tracks in bkg cone"); + fhBkgNTracksInCone->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhBkgPt) ; + fOutCont->Add(fhBkgRatioPt) ; + fOutCont->Add(fhBkgDeltaPhi) ; + fOutCont->Add(fhBkgDeltaEta) ; + fOutCont->Add(fhBkgLeadingRatioPt) ; + fOutCont->Add(fhBkgLeadingDeltaPhi) ; + fOutCont->Add(fhBkgLeadingDeltaEta) ; + fOutCont->Add(fhBkgFFz) ; + fOutCont->Add(fhBkgFFxi) ; + fOutCont->Add(fhBkgFFpt) ; + fOutCont->Add(fhBkgNTracksInCone) ; + + }//not several cones + else{ //If we want to study the jet for different cones and pt + for(Int_t icone = 0; icone " +fJetNamePtThres[ipt]+" GeV/c"; + + //Jet Distributions + fhJetPts[icone][ipt] = new TH2F("JetPt"+lastnamehist,"p_{T jet} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,120); + fhJetPts[icone][ipt]->SetYTitle("p_{T jet}"); + fhJetPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetRatioPts[icone][ipt] = new TH2F("JetRatioPt"+lastnamehist,"p_{T jet}/p_{T trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,2); + fhJetRatioPts[icone][ipt]->SetYTitle("p_{T jet}/p_{T trigger}"); + fhJetRatioPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetDeltaPhis[icone][ipt] = new TH2F("JetDeltaPhi"+lastnamehist,"#phi_{jet} - #phi_{trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,TMath::TwoPi()); + fhJetDeltaPhis[icone][ipt]->SetYTitle("#Delta #phi (rad)"); + fhJetDeltaPhis[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetDeltaEtas[icone][ipt] = new TH2F("JetDeltaEta"+lastnamehist,"#eta_{jet} - #eta_{trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,-2,2); + fhJetDeltaEtas[icone][ipt]->SetYTitle("#Delta #eta"); + fhJetDeltaEtas[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingRatioPts[icone][ipt] = new TH2F("JetLeadingRatioPt"+lastnamehist,"p_{T jet} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,2); + fhJetLeadingRatioPts[icone][ipt]->SetYTitle("p_{T leading}/p_{T jet}"); + fhJetLeadingRatioPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingDeltaPhis[icone][ipt] = new TH2F("JetLeadingDeltaPhi"+lastnamehist,"#phi_{jet} - #phi_{leading} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,TMath::TwoPi()); + fhJetLeadingDeltaPhis[icone][ipt]->SetYTitle("#Delta #phi (rad)"); + fhJetLeadingDeltaPhis[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetLeadingDeltaEtas[icone][ipt] = new TH2F("JetLeadingDeltaEta"+lastnamehist,"#eta_{jet} - #eta_{leading} vs p_{T trigger}"+lastnametitle,120,0,120,120,-2,2); + fhJetLeadingDeltaEtas[icone][ipt]->SetYTitle("#Delta #eta"); + fhJetLeadingDeltaEtas[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhJetFFzs[icone][ipt] = new TH2F("JetFFz"+lastnamehist,"z = p_{T i charged}/p_{T trigger} vs p_{T trigger}", 120,0.,120.,200,0.,2); + fhJetFFzs[icone][ipt]->SetYTitle("z"); + fhJetFFzs[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhJetFFxis[icone][ipt] = new TH2F("JetFFxi"+lastnamehist,"#xi = ln(p_{T trigger}/p_{T i charged}) vs p_{T trigger}", 120,0.,120.,100,0.,10.); + fhJetFFxis[icone][ipt]->SetYTitle("#xi"); + fhJetFFxis[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhJetFFpts[icone][ipt] = new TH2F("JetFFpt"+lastnamehist,"p_{T charged hadron } in jet vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhJetFFpts[icone][ipt]->SetYTitle("p_{T charged hadron}"); + fhJetFFpts[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhJetNTracksInCones[icone][ipt] = new TH2F("JetNTracksInCone"+lastnamehist,"N particles in cone vs p_{T trigger}"+lastnametitle,120,0,120,5000,0, 5000); + fhJetNTracksInCones[icone][ipt]->SetYTitle("N tracks in jet cone"); + fhJetNTracksInCones[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhJetPts[icone][ipt]) ; + fOutCont->Add(fhJetRatioPts[icone][ipt]) ; + fOutCont->Add(fhJetDeltaPhis[icone][ipt]) ; + fOutCont->Add(fhJetDeltaEtas[icone][ipt]) ; + fOutCont->Add(fhJetLeadingRatioPts[icone][ipt]) ; + fOutCont->Add(fhJetLeadingDeltaPhis[icone][ipt]) ; + fOutCont->Add(fhJetLeadingDeltaEtas[icone][ipt]) ; + fOutCont->Add(fhJetFFzs[icone][ipt]) ; + fOutCont->Add(fhJetFFxis[icone][ipt]) ; + fOutCont->Add(fhJetFFpts[icone][ipt]) ; + fOutCont->Add(fhJetNTracksInCones[icone][ipt]) ; + + //Bkg Distributions + fhBkgPts[icone][ipt] = new TH2F("BkgPt"+lastnamehist,"p_{T bkg} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,120); + fhBkgPts[icone][ipt]->SetYTitle("p_{T bkg}"); + fhBkgPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgRatioPts[icone][ipt] = new TH2F("BkgRatioPt"+lastnamehist,"p_{T bkg}/p_{T trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,2); + fhBkgRatioPts[icone][ipt]->SetYTitle("p_{T bkg}/p_{T trigger}"); + fhBkgRatioPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgDeltaPhis[icone][ipt] = new TH2F("BkgDeltaPhi"+lastnamehist,"#phi_{bkg} - #phi_{trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,TMath::TwoPi()); + fhBkgDeltaPhis[icone][ipt]->SetYTitle("#Delta #phi (rad)"); + fhBkgDeltaPhis[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgDeltaEtas[icone][ipt] = new TH2F("BkgDeltaEta"+lastnamehist,"#eta_{bkg} - #eta_{trigger} vs p_{T trigger}"+lastnametitle,120,0,120,120,-2,2); + fhBkgDeltaEtas[icone][ipt]->SetYTitle("#Delta #eta"); + fhBkgDeltaEtas[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingRatioPts[icone][ipt] = new TH2F("BkgLeadingRatioPt"+lastnamehist,"p_{T bkg} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,2); + fhBkgLeadingRatioPts[icone][ipt]->SetYTitle("p_{T leading}/p_{T bkg}"); + fhBkgLeadingRatioPts[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingDeltaPhis[icone][ipt] = new TH2F("BkgLeadingDeltaPhi"+lastnamehist,"#phi_{bkg} - #phi_{leading} vs p_{T trigger}"+lastnametitle,120,0,120,120,0,TMath::TwoPi()); + fhBkgLeadingDeltaPhis[icone][ipt]->SetYTitle("#Delta #phi (rad)"); + fhBkgLeadingDeltaPhis[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgLeadingDeltaEtas[icone][ipt] = new TH2F("BkgLeadingDeltaEta"+lastnamehist,"#eta_{bkg} - #eta_{leading} vs p_{T trigger}"+lastnametitle,120,0,120,120,-2,2); + fhBkgLeadingDeltaEtas[icone][ipt]->SetYTitle("#Delta #eta"); + fhBkgLeadingDeltaEtas[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fhBkgFFzs[icone][ipt] = new TH2F("BkgFFz"+lastnamehist,"z = p_{T i charged}/p_{T trigger} vs p_{T trigger}", 120,0.,120.,200,0.,2); + fhBkgFFzs[icone][ipt]->SetYTitle("z"); + fhBkgFFzs[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhBkgFFxis[icone][ipt] = new TH2F("BkgFFxi"+lastnamehist,"#xi = ln(p_{T trigger}/p_{T i charged}) vs p_{T trigger}", 120,0.,120.,100,0.,10.); + fhBkgFFxis[icone][ipt]->SetYTitle("#xi"); + fhBkgFFxis[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhBkgFFpts[icone][ipt] = new TH2F("BkgFFpt"+lastnamehist,"p_{T charged hadron} in jet vs p_{T trigger}", 120,0.,120.,200,0.,50.); + fhBkgFFpts[icone][ipt]->SetYTitle("p_{T charged hadron}"); + fhBkgFFpts[icone][ipt]->SetXTitle("p_{T trigger}"); + + fhBkgNTracksInCones[icone][ipt] = new TH2F("BkgNTracksInCone"+lastnamehist,"N particles in cone vs p_{T trigger}"+lastnametitle,120,0,120,5000,0, 5000); + fhBkgNTracksInCones[icone][ipt]->SetYTitle("N tracks in bkg cone"); + fhBkgNTracksInCones[icone][ipt]->SetXTitle("p_{T trigger} (GeV/c)"); + + fOutCont->Add(fhBkgPts[icone][ipt]) ; + fOutCont->Add(fhBkgRatioPts[icone][ipt]) ; + fOutCont->Add(fhBkgDeltaPhis[icone][ipt]) ; + fOutCont->Add(fhBkgDeltaEtas[icone][ipt]) ; + fOutCont->Add(fhBkgLeadingRatioPts[icone][ipt]) ; + fOutCont->Add(fhBkgLeadingDeltaPhis[icone][ipt]) ; + fOutCont->Add(fhBkgLeadingDeltaEtas[icone][ipt]) ; + fOutCont->Add(fhBkgFFzs[icone][ipt]) ; + fOutCont->Add(fhBkgFFxis[icone][ipt]) ; + fOutCont->Add(fhBkgFFpts[icone][ipt]) ; + fOutCont->Add(fhBkgNTracksInCones[icone][ipt]) ; + + }//ipt + } //icone + }//If we want to study any cone or pt threshold + + if(GetDebug()>2){ + printf("All histograms names \n"); + + for(Int_t i = 0 ; i< fOutCont->GetEntries(); i++) + printf("Histo i %d name %s",i,((fOutCont->At(i))->GetName())); + //cout<< (fOutCont->At(i))->GetName()< 0 || ptpi > 0){ + if((ptch >= ptpi)){ + if(GetDebug() > 1)printf("Leading found in CTS \n"); + pLeading = pLeadingCh; + if(GetDebug() > 1) printf("Found Leading: pt %f, phi %f deg, eta %f\n", pLeading.Pt(),pLeading.Phi()*TMath::RadToDeg(),pLeading.Eta()) ; + //Put leading in AOD + particle->SetLeading(pLeadingCh); + particle->SetLeadingDetector("CTS"); + return kTRUE; + } + else{ + if(GetDebug() > 1)printf("Leading found in EMCAL \n"); + pLeading = pLeadingPi0; + if(GetDebug() > 1) printf("Found Leading: pt %f, phi %f, eta %f\n", pLeading.Pt(),pLeading.Phi()*TMath::RadToDeg(),pLeading.Eta()) ; + //Put leading in AOD + particle->SetLeading(pLeadingPi0); + particle->SetLeadingDetector("EMCAL"); + return kTRUE; + } + } + + if(GetDebug() > 1)printf ("NO LEADING PARTICLE FOUND \n"); + + return kFALSE; + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge(AliAODParticleCorrelation * particle, TLorentzVector & pLeading) +{ + //Search for the charged particle with highest pt and with + //Phi=Phi_trigger-Pi and pT=0.1E_gamma + + if(GetAODCTS()){ + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t rat = -100 ; + Double_t ptl = -100 ; + Double_t phil = -100 ; + Double_t pt = -100.; + Double_t phi = -100.; + TVector3 p3; + + for(Int_t ipr = 0;ipr < GetAODCTS()->GetEntriesFast() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast(GetAODCTS()->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + pt = p3.Pt(); + phi = p3.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + rat = pt/ptTrig ; + + //Selection within angular and energy limits + if(((phiTrig-phi) > fDeltaPhiMinCut) && ((phiTrig-phi) fLeadingRatioMinCut) && (rat < fLeadingRatioMaxCut) && (pt > ptl)) { + phil = phi ; + ptl = pt ; + pLeading.SetVect(p3); + } + }// track loop + + if(GetDebug() > 1&& ptl>0 ) printf("Leading in CTS: pt %f eta %f phi %f pt/ptTrig %f \n", ptl, pLeading.Eta(), phil,ptl/ptTrig) ; + + }//CTS list exist +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0(AliAODParticleCorrelation * particle, TLorentzVector & pLeading) +{ + //Search for the neutral pion with highest pt and with + //Phi=Phi_trigger-Pi and pT=0.1E_gamma + + if(GetAODEMCAL()){ + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t rat = -100 ; + Double_t ptl = -100 ; + Double_t phil = -100 ; + Double_t pt = -100.; + Double_t phi = -100.; + + TLorentzVector gammai; + TLorentzVector gammaj; + + Double_t vertex[] = {0,0,0}; + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Cluster loop, select pairs with good pt, phi and fill AODs or histograms + for(Int_t iclus = 0;iclus < GetAODEMCAL()->GetEntriesFast() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(GetAODEMCAL()->At(iclus)) ; + + //Cluster selection, not charged, with photon or pi0 id and in fidutial cut + Int_t pdgi=0; + if(!SelectCluster(calo,vertex, gammai, pdgi)) continue ; + + if(GetDebug() > 2) printf("neutral cluster: pt %f, phi %f \n", gammai.Pt(),gammai.Phi()); + + //2 gamma overlapped, found with PID + if(pdgi == AliCaloPID::kPi0){ + pt = gammai.Pt(); + rat = pt/ptTrig; + phi = gammai.Phi(); + if(phi<0) phi+=TMath::TwoPi(); + + //Selection within angular and energy limits + if(ptl > pt && rat > fLeadingRatioMinCut && rat < fLeadingRatioMaxCut && + (phiTrig-phil) > fDeltaPhiMinCut && (phiTrig-phil) < fDeltaPhiMaxCut ) + { + phi = phil ; + pt = ptl ; + pLeading.SetPxPyPzE(gammai.Px(),gammai.Py(),gammai.Pz(),gammai.E()); + }// cuts + }// pdg = AliCaloPID::kPi0 + //Make invariant mass analysis + else if(pdgi == AliCaloPID::kPhoton){ + //Search the photon companion in case it comes from a Pi0 decay + //Apply several cuts to select the good pair + for(Int_t jclus = iclus+1; jclus < GetAODEMCAL()->GetEntriesFast() ; jclus ++ ){ + AliAODCaloCluster * calo2 = dynamic_cast< AliAODCaloCluster *>(GetAODEMCAL()->At(jclus)) ; + + //Cluster selection, not charged with photon or pi0 id and in fidutial cut + Int_t pdgj=0; + if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; + + if(pdgj == AliCaloPID::kPhoton ){ + + pt = (gammai+gammaj).Pt(); + phi = (gammai+gammaj).Phi(); + rat = pt/ptTrig; + + //Selection within angular and energy limits + if(ptl > pt && rat > fLeadingRatioMinCut && rat < fLeadingRatioMaxCut && + (phiTrig-phil) > fDeltaPhiMinCut && (phiTrig-phil) < fDeltaPhiMaxCut ){ + //Select good pair (aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ + phi = phil ; + pt = ptl ; + pLeading=(gammai+gammaj); + }//pi0 selection + + if(GetDebug() > 3 ) printf("Neutral Hadron Correlation: Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f\n", + (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); + }//Pair selected as leading + }//if pair of gammas + }//2nd loop + }// if pdg = 22 + }// 1st Loop + + if(GetDebug()>2 && pLeading.Pt() >0 ) printf("Leading EMCAL: pt %f eta %f phi %f pt/Eg %f \n", pLeading.Pt(), pLeading.Eta(), pLeading.Phi(), pLeading.Pt()/ptTrig) ; + + }//EMCAL list exists + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + fJetsOnlyInCTS = kFALSE ; + fPbPb = kFALSE ; + fReMakeJet = kFALSE ; + + //Leading selection parameters + fDeltaPhiMinCut = 2.9 ; + fDeltaPhiMaxCut = 3.4 ; + fLeadingRatioMinCut = 0.1; + fLeadingRatioMaxCut = 1.5; + + //Jet selection parameters + //Fixed cut + fJetRatioMaxCut = 1.2 ; + fJetRatioMinCut = 0.3 ; + fJetCTSRatioMaxCut = 1.2 ; + fJetCTSRatioMinCut = 0.3 ; + fSelect = 0 ; //0, Accept all jets, 1, selection depends on energy, 2 fixed selection + + //Cut depending on gamma energy + fPtTriggerSelectionCut = 10.; //For Low pt jets+BKG, another limits applied + //Reconstructed jet energy dependence parameters + //e_jet = a1+e_gamma b2. + //Index 0-> Pt>2 GeV r = 0.3; Index 1-> Pt>0.5 GeV r = 0.3 + fJetE1[0] = -5.75; fJetE1[1] = -4.1; + fJetE2[0] = 1.005; fJetE2[1] = 1.05; + + //Reconstructed sigma of jet energy dependence parameters + //s_jet = a1+e_gamma b2. + //Index 0-> Pt>2 GeV r = 0.3; Index 1-> Pt>0.5 GeV r = 0.3 + fJetSigma1[0] = 2.65; fJetSigma1[1] = 2.75; + fJetSigma2[0] = 0.0018; fJetSigma2[1] = 0.033; + + //Background mean energy and RMS + //Index 0-> No BKG; Index 1-> BKG > 2 GeV; + //Index 2-> (low pt jets)BKG > 0.5 GeV; + //Index > 2, same for CTS conf + fBkgMean[0] = 0.; fBkgMean[1] = 8.8 ; fBkgMean[2] = 69.5; + fBkgMean[3] = 0.; fBkgMean[4] = 6.4; fBkgMean[5] = 48.6; + fBkgRMS[0] = 0.; fBkgRMS[1] = 7.5; fBkgRMS[2] = 22.0; + fBkgRMS[3] = 0.; fBkgRMS[4] = 5.4; fBkgRMS[5] = 13.2; + + //Factor x of min/max = E -+ x * sigma. Obtained after selecting the + //limits for monoenergetic jets. + //Index 0-> No BKG; Index 1-> BKG > 2 GeV; + //Index 2-> (low pt jets) BKG > 0.5 GeV; + //Index > 2, same for CTS conf + + fJetXMin1[0] =-0.69 ; fJetXMin1[1] = 0.39 ; fJetXMin1[2] =-0.88 ; + fJetXMin1[3] =-2.0 ; fJetXMin1[4] =-0.442 ; fJetXMin1[5] =-1.1 ; + fJetXMin2[0] = 0.066; fJetXMin2[1] = 0.038; fJetXMin2[2] = 0.034; + fJetXMin2[3] = 0.25 ; fJetXMin2[4] = 0.113; fJetXMin2[5] = 0.077 ; + fJetXMax1[0] =-3.8 ; fJetXMax1[1] =-0.76 ; fJetXMax1[2] =-3.6 ; + fJetXMax1[3] =-2.7 ; fJetXMax1[4] =-1.21 ; fJetXMax1[5] =-3.7 ; + fJetXMax2[0] =-0.012; fJetXMax2[1] =-0.022; fJetXMax2[2] = 0.016; + fJetXMax2[3] =-0.024; fJetXMax2[4] =-0.008; fJetXMax2[5] = 0.027; + + + //Different cones and pt thresholds to construct the jet + + fJetCone = 0.3 ; + fJetPtThreshold = 0.5 ; + fJetPtThresPbPb = 2. ; + fJetNCone = 4 ; + fJetNPt = 4 ; + fJetCones[0] = 0.2 ; fJetNameCones[0] = "02" ; + fJetCones[1] = 0.3 ; fJetNameCones[1] = "03" ; + fJetCones[2] = 0.4 ; fJetNameCones[2] = "04" ; + fJetCones[2] = 0.5 ; fJetNameCones[2] = "05" ; + + fJetPtThres[0] = 0.0 ; fJetNamePtThres[0] = "00" ; + fJetPtThres[1] = 0.5 ; fJetNamePtThres[1] = "05" ; + fJetPtThres[2] = 1.0 ; fJetNamePtThres[2] = "10" ; + fJetPtThres[3] = 2.0 ; fJetNamePtThres[3] = "20" ; +} + +//__________________________________________________________________________- +Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptTrig, const Double_t ptjet){ + //Given the pt of the jet and the trigger particle, select the jet or not + //3 options, fSelect=0 accepts all, fSelect=1 selects jets depending on a + //function energy dependent and fSelect=2 selects on simple fixed cuts + + if(ptjet == 0) return kFALSE; + + Double_t rat = ptTrig / ptjet ; + + //############################################################### + if(fSelect == 0) + return kTRUE; //Accept all jets, no restriction + //############################################################### + else if(fSelect == 1){ + //Check if the energy of the reconstructed jet is within an energy window + //WARNING: to be rechecked, don't remember what all the steps mean + Double_t par[6]; + Double_t xmax[2]; + Double_t xmin[2]; + + Int_t iCTS = 0; + if(fJetsOnlyInCTS) + iCTS = 3 ; + + if(!fPbPb){ + //Phythia alone, jets with pt_th > 0.2, r = 0.3 + par[0] = fJetE1[0]; par[1] = fJetE2[0]; + //Energy of the jet peak + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[0]; par[3] = fJetSigma2[0]; + //Sigma of the jet peak + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[0 + iCTS]; par[5] = fBkgRMS[0 + iCTS]; + //Parameters reserved for PbPb bkg. + xmax[0] = fJetXMax1[0 + iCTS]; xmax[1] = fJetXMax2[0 + iCTS]; + xmin[0] = fJetXMin1[0 + iCTS]; xmin[1] = fJetXMin2[0 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptTrig) + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + } + else{ + if(ptTrig > fPtTriggerSelectionCut){ + //Phythia +PbPb with pt_th > 2 GeV/c, r = 0.3 + par[0] = fJetE1[0]; par[1] = fJetE2[0]; + //Energy of the jet peak, same as in pp + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[0]; par[3] = fJetSigma2[0]; + //Sigma of the jet peak, same as in pp + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[1 + iCTS]; par[5] = fBkgRMS[1 + iCTS]; + //Mean value and RMS of PbPb Bkg + xmax[0] = fJetXMax1[1 + iCTS]; xmax[1] = fJetXMax2[1 + iCTS]; + xmin[0] = fJetXMin1[1 + iCTS]; xmin[1] = fJetXMin2[1 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptTrig) mixed with PbPb Bkg, + //pt_th > 2 GeV, r = 0.3 + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + } + else{ + //Phythia + PbPb with pt_th > 0.5 GeV/c, r = 0.3 + par[0] = fJetE1[1]; par[1] = fJetE2[1]; + //Energy of the jet peak, pt_th > 2 GeV/c, r = 0.3 + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[1]; par[3] = fJetSigma2[1]; + //Sigma of the jet peak, pt_th > 2 GeV/c, r = 0.3 + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[2 + iCTS]; par[5] = fBkgRMS[2 + iCTS]; + //Mean value and RMS of PbPb Bkg in a 0.3 cone, pt > 2 GeV. + xmax[0] = fJetXMax1[2 + iCTS]; xmax[1] = fJetXMax2[2 + iCTS]; + xmin[0] = fJetXMin1[2 + iCTS]; xmin[1] = fJetXMin2[2 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptTrig) mixed with PbPb Bkg, + //pt_th > 2 GeV, r = 0.3 + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + }//If low pt jet in bkg + }//if Bkg + + //Calculate minimum and maximum limits of the jet ratio. + Double_t min = CalculateJetRatioLimit(ptTrig, par, xmin); + Double_t max = CalculateJetRatioLimit(ptTrig, par, xmax); + + AliDebug(3,Form("Jet selection? : Limits min %f, max %f, pt_jet %f, pt_gamma %f, pt_jet / pt_gamma %f",min,max,ptjet,ptTrig,rat)); + + if(( min < rat ) && ( max > ptjet/rat)) + return kTRUE; + else + return kFALSE; + }//fSelect = 1 + //############################################################### + else if(fSelect == 2){ + //Simple selection + if(!fJetsOnlyInCTS){ + if((rat < fJetRatioMaxCut) && (rat > fJetRatioMinCut )) return kTRUE; + } + else{ + if((rat < fJetCTSRatioMaxCut) && (rat > fJetCTSRatioMinCut )) return kTRUE; + } + }// fSelect = 2 + //############################################################### + else{ + AliError("Jet selection option larger than 2, DON'T SELECT JETS"); + return kFALSE ; + } + + return kFALSE; + +} + +//___________________________________________________________________ +Bool_t AliAnaParticleJetLeadingConeCorrelation::IsParticleInJetCone(const Double_t eta, Double_t phi, const Double_t etal, Double_t phil) +{ + //Check if the particle is inside the cone defined by the leading particle + //WARNING: To be rechecked + + if(phi < 0) phi+=TMath::TwoPi(); + if(phil < 0) phil+=TMath::TwoPi(); + Double_t rad = 10000 + fJetCone; + + if(TMath::Abs(phi-phil) <= (TMath::TwoPi() - fJetCone)) + rad = TMath::Sqrt(TMath::Power(eta-etal,2)+TMath::Power(phi-phil,2)); + else{ + if(phi-phil > TMath::TwoPi() - fJetCone) + rad = TMath::Sqrt(TMath::Power(eta-etal,2)+TMath::Power((phi-TMath::TwoPi())-phil,2)); + if(phi-phil < -(TMath::TwoPi() - fJetCone)) + rad = TMath::Sqrt(TMath::Power(eta-etal,2)+TMath::Power((phi+TMath::TwoPi())-phil,2)); + } + + if(rad < fJetCone) return kTRUE ; + else return kFALSE ; + +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntriesFast()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntriesFast()); + } + + TLorentzVector pLeading(0,0,0,0); //It will contain the kinematics of the found leading particle + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + //Search leading particles in CTS and EMCAL + if(GetLeadingParticle(particle, pLeading)){ + + //Construct the jet around the leading, Fill AOD jet particle list, select jet + //and fill AOD with jet and background + MakeAODJet(particle, pLeading); + + }//Leading found + }//AOD trigger particle loop + + if(GetDebug() >1)printf("End of jet leading cone analysis, fill AODs \n"); + +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() +{ + + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntriesFast()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntriesFast()); + } + + TLorentzVector pLeading(0,0,0,0) ; + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + Double_t pt = particle->Pt(); + Double_t phi = particle->Phi(); + Double_t eta = particle->Eta(); + + //Get leading particle, fill histograms + pLeading = particle->GetLeading(); + TString det = particle->GetLeadingDetector(); + + if(det!="" && pLeading.Pt() > 0){ + Double_t ptL = pLeading.Pt(); + Double_t phiL = pLeading.Phi(); + if(phiL < 0 ) phiL+=TMath::TwoPi(); + Double_t etaL = pLeading.Eta(); + + if(GetDebug() > 1) printf("Leading found in %s, with pt %3.2f, phi %2.2f, eta %2.2f\n",det.Data(), ptL, phiL, etaL); + if(det == "CTS"){ + fhChargedLeadingPt->Fill(pt,ptL); + fhChargedLeadingPhi->Fill(pt,phiL); + fhChargedLeadingEta->Fill(pt,etaL); + fhChargedLeadingDeltaPt->Fill(pt,pt-ptL); + fhChargedLeadingDeltaPhi->Fill(pt,phi-phiL); + fhChargedLeadingDeltaEta->Fill(pt,eta-etaL); + fhChargedLeadingRatioPt->Fill(pt,ptL/pt); + } + else if(det== "EMCAL"){ + fhNeutralLeadingPt->Fill(pt,ptL); + fhNeutralLeadingPhi->Fill(pt,phiL); + fhNeutralLeadingEta->Fill(pt,etaL); + fhNeutralLeadingDeltaPt->Fill(pt,pt-ptL); + fhNeutralLeadingDeltaPhi->Fill(pt,phi-phiL); + fhNeutralLeadingDeltaEta->Fill(pt,eta-etaL); + fhNeutralLeadingRatioPt->Fill(pt,ptL/pt); + } + + //Fill Jet histograms + TLorentzVector bkg(0,0,0,0); + TLorentzVector jet(0,0,0,0); + if(!fSeveralConeAndPtCuts){//just fill histograms + if(!fReMakeJet){ + jet=particle->GetCorrelatedJet(); + bkg=particle->GetCorrelatedBackground(); + } + else MakeJetFromAOD(particle, pLeading, jet,bkg); + + if(jet.Pt() > 0){//Jet was found + FillJetHistos(particle, pLeading, jet,"Jet",""); + FillJetHistos(particle, pLeading, bkg,"Bkg",""); + } + } + else if(fSeveralConeAndPtCuts){ + for(Int_t icone = 0; icone 0) {//Jet was found + FillJetHistos(particle, pLeading, jet,"Jet",lastname); + FillJetHistos(particle, pLeading, bkg,"Bkg",lastname); + } + }//icone + }//ipt + }//fSeveralConeAndPtCuts + }//Leading + }//AOD trigger particle loop + + if(GetDebug() >1)printf("End of jet leading cone analysis, fill histograms \n"); + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::MakeAODJet(AliAODParticleCorrelation *particle, const TLorentzVector pLeading) +{ + //Fill the jet with the particles around the leading particle with + //R=fJetCone and pt_th = fJetPtThres. Calculate the energy of the jet and + //fill aod with found information + + TLorentzVector bkg(0,0,0,0); + TLorentzVector jet(0,0,0,0); + TLorentzVector lv (0,0,0,0); //Temporal container for jet particles kinematics + + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t phil = pLeading.Phi(); + if(phil<0) phil+=TMath::TwoPi(); + Double_t etal = pLeading.Eta(); + + //Different pt cut for jet particles in different collisions systems + Float_t ptcut = fJetPtThreshold; + if(fPbPb && !fSeveralConeAndPtCuts && ptTrig > fPtTriggerSelectionCut) ptcut = fJetPtThresPbPb ; + + //Add charged particles to jet if they are in cone around the leading particle + if(!GetAODCTS()) { + AliFatal("Cannot construct jets without tracks, STOP analysis"); + return; + } + + //Fill jet with tracks + TVector3 p3; + for(Int_t ipr = 0;ipr < (GetAODCTS())->GetEntriesFast() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast((GetAODCTS())->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + + //Particles in jet + if(IsParticleInJetCone(p3.Eta(), p3.Phi(), etal, phil)){ + particle->AddTrack(track); + if(p3.Pt() > ptcut ){ + lv.SetVect(p3); + jet+=lv; + } + } + //Background around (phi_gamma-pi, eta_leading) + else if(IsParticleInJetCone(p3.Eta(),p3.Phi(),etal, phiTrig)) { + particle->AddBackgroundTrack(track); + if(p3.Pt() > ptcut ){ + lv.SetVect(p3); + bkg+=lv; + } + } + }//Track loop + + //Add neutral particles to jet + if(!fJetsOnlyInCTS && GetAODEMCAL()){ + + Double_t vertex[] = {0,0,0}; + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + for(Int_t iclus = 0;iclus < (GetAODEMCAL())->GetEntriesFast() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(GetAODEMCAL()->At(iclus)) ; + + //Cluster selection, not charged + if(calo->GetNTracksMatched() > 0) continue ; + + calo->GetMomentum(lv,vertex); + //Particles in jet + if(IsParticleInJetCone(lv.Eta(),lv.Phi(), etal, phil)){ + particle->AddCluster(calo); + if(lv.Pt() > ptcut ) jet+=lv; + } + //Background around (phi_gamma-pi, eta_leading) + else if(IsParticleInJetCone(lv.Eta(),lv.Phi(),etal, phiTrig)){ + particle->AddBackgroundCluster(calo); + if(lv.Pt() > ptcut ) bkg+=lv; + } + }//cluster loop + }//jets with neutral particles + + //If there is any jet found, select after some criteria and + //and fill AOD with corresponding TLorentzVector kinematics + if(IsJetSelected(particle->Pt(), jet.Pt())) { + particle->SetCorrelatedJet(jet); + particle->SetCorrelatedBackground(bkg); + if(GetDebug()>1) printf("Found jet: Trigger pt %f, Jet pt %f, Bkg pt %f\n",ptTrig,jet.Pt(),bkg.Pt()); + } + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::MakeJetFromAOD(AliAODParticleCorrelation *particle, const TLorentzVector pLeading, TLorentzVector & jet, TLorentzVector & bkg) +{ + //Fill the jet with the particles around the leading particle with + //R=fJetCone and pt_th = fJetPtThres. Calculate the energy of the jet and + //fill aod tlorentzvectors with jet and bakcground found + + TLorentzVector lv (0,0,0,0); //Temporal container for jet particles kinematics + + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t phil = pLeading.Phi(); + Double_t etal = pLeading.Eta(); + + //Different pt cut for jet particles in different collisions systems + Float_t ptcut = fJetPtThreshold; + if(fPbPb && !fSeveralConeAndPtCuts && ptTrig > fPtTriggerSelectionCut) ptcut = fJetPtThresPbPb ; + + //Fill jet with tracks + //Particles in jet + TVector3 p3; + for(Int_t ipr = 0;ipr < (particle->GetRefTracks())->GetEntriesFast() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast((particle-> GetRefTracks())->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + if(p3.Pt() > ptcut && IsParticleInJetCone(p3.Eta(), p3.Phi(), etal, phil) ){ + lv.SetVect(p3); + jet+=lv; + } + }//jet Track loop + + //Particles in background + for(Int_t ipr = 0;ipr < (particle-> GetRefBackgroundTracks())->GetEntriesFast() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast((particle->GetRefBackgroundTracks())->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + if(p3.Pt() > ptcut && IsParticleInJetCone(p3.Eta(),p3.Phi(),etal, phiTrig) ) { + lv.SetVect(p3); + bkg+=lv; + } + }//background Track loop + + //Add neutral particles to jet + if(!fJetsOnlyInCTS && (particle->GetRefClusters())){ + + Double_t vertex[] = {0,0,0}; + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Loop on jet particles + for(Int_t iclus = 0;iclus < (particle->GetRefClusters())->GetEntriesFast() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>((particle->GetRefClusters())->At(iclus)) ; + calo->GetMomentum(lv,vertex); + if(lv.Pt() > ptcut && IsParticleInJetCone(lv.Eta(),lv.Phi(), etal, phil)) jet+=lv; + }//jet cluster loop + + //Loop on background particles + for(Int_t iclus = 0;iclus < (particle->GetRefClusters())->GetEntriesFast() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>((particle->GetRefClusters())->At(iclus)) ; + calo->GetMomentum(lv,vertex); + if( lv.Pt() > ptcut &&IsParticleInJetCone(lv.Eta(),lv.Phi(),etal, phiTrig)) bkg+=lv; + }//background cluster loop + }//clusters in jet + + //If there is any jet found, leave jet and bkg as they are, + //if not set them to 0. + if(!IsJetSelected(particle->Pt(), jet.Pt())) { + jet.SetPxPyPzE(0.,0.,0.,0.); + bkg.SetPxPyPzE(0.,0.,0.,0.); + } + else + if(GetDebug()>1) printf("Found jet: Trigger pt %f, Jet pt %f, Bkg pt %f\n",ptTrig,jet.Pt(),bkg.Pt()); + +} + +//____________________________________________________________________________ +Bool_t AliAnaParticleJetLeadingConeCorrelation::SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg){ + //Select cluster depending on its pid and acceptance selections + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) return kFALSE; + + //Check PID + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pdg = AliCaloPID::kPhoton; + if(IsCaloPIDOn()){ + //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) + //or redo PID, recommended option for EMCal. + if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) + pdg = GetCaloPID()->GetPdg("EMCAL",calo->PID(),mom.E());//PID with weights + else + pdg = GetCaloPID()->GetPdg("EMCAL",mom,calo->GetM02(),0,0,0,0);//PID recalculated + + if(GetDebug() > 1) printf("PDG of identified particle %d\n",pdg); + //If it does not pass pid, skip + if(pdg != AliCaloPID::kPhoton || pdg != AliCaloPID::kPi0) + return kFALSE ; + }//CaloPID + + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"EMCAL") ; + if(! in ) return kFALSE ; + } + + if(GetDebug() > 1) printf("cluster selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg); + + return kTRUE; + +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("Print", "%s %s", GetName(), GetTitle() ) ; + + if(fJetsOnlyInCTS)printf("Jets reconstructed in CTS \n"); + else printf("Jets reconstructed in CTS+EMCAL \n"); + + if(fPbPb) printf("PbPb events, pT cut in jet cone energy reconstruction %2.1f \n", fJetPtThreshold); + else printf("pp events, pT cut in jet cone energy reconstruction %2.1f \n", fJetPtThresPbPb); + + printf("If pT of trigger < %f, select jets as in pp? \n", fPtTriggerSelectionCut); + + printf("Phi gamma-Leading < %3.2f\n", fDeltaPhiMaxCut) ; + printf("Phi gamma-Leading > %3.2f\n", fDeltaPhiMinCut) ; + printf("pT Leading / pT Trigger < %3.2f\n", fLeadingRatioMaxCut) ; + printf("pT Leading / pT Trigger > %3.2f\n", fLeadingRatioMinCut) ; + + if(fSelect == 2){ + printf("pT Jet / pT Gamma < %3.2f\n", fJetRatioMaxCut) ; + printf("pT Jet / pT Gamma > %3.2f\n", fJetRatioMinCut) ; + printf("pT Jet (Only CTS)/ pT Trigger < %3.2f\n", fJetCTSRatioMaxCut) ; + printf("pT Jet (Only CTS)/ pT Trigger > %3.2f\n", fJetCTSRatioMinCut) ; + } + else if(fSelect == 0) + printf("Accept all reconstructed jets \n") ; + else if(fSelect == 1) + printf("Accept jets depending on trigger energy \n") ; + else + printf("Wrong jet selection option: %d \n", fSelect) ; + +} diff --git a/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.h b/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.h new file mode 100644 index 00000000000..88b6fd0b7d1 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticleJetLeadingConeCorrelation.h @@ -0,0 +1,253 @@ +#ifndef AliAnaParticleJetLeadingConeCorrelation_H +#define AliAnaParticleJetLeadingConeCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the reconstruction of jet, cone around leading particle +// The seed is a backward particle (direct photon) +// 1)Take the a trigger particle found stored in AliAODParticleCorrelation, +// 2) Search for the highest pt leading particle opposite to the trigger within a phi, pt window +// 3) Take all particles around leading in a cone R with pt larger than threshold and construct the jet +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) +// +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TH2F; + +//---- Analysis system ---- +class AliAODTrack; +class AliAODCaloCluster; +class AliCaloTrackReader; +class AliNeutralMesonSelection; +class AliLog; + +#include "AliAnaPartCorrBaseClass.h" + +class AliAnaParticleJetLeadingConeCorrelation : public AliAnaPartCorrBaseClass { + +public: + + AliAnaParticleJetLeadingConeCorrelation() ; // default ctor + AliAnaParticleJetLeadingConeCorrelation(const AliAnaParticleJetLeadingConeCorrelation & g) ; // cpy ctor + AliAnaParticleJetLeadingConeCorrelation & operator = (const AliAnaParticleJetLeadingConeCorrelation & g) ;//cpy assignment + virtual ~AliAnaParticleJetLeadingConeCorrelation() ; //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + Bool_t AreJetsRecalculated() const {return fReMakeJet ; } + void SwitchOnJetsRecalculation(){fReMakeJet = kTRUE; } + void SwitchOffJetsRecalculation(){fReMakeJet = kFALSE; } + + Bool_t AreJetsOnlyInCTS() const {return fJetsOnlyInCTS ; } + void SwitchOnJetsOnlyInCTS(){fJetsOnlyInCTS = kTRUE; } + void SwitchOffJetsOnlyInCTS(){fJetsOnlyInCTS = kFALSE; } + + Bool_t AreSeveralConeAndPtCuts() const {return fSeveralConeAndPtCuts ; } + void SwitchOnSeveralConeAndPtCuts(){fSeveralConeAndPtCuts = kTRUE ;} + void SwitchOffSeveralConeAndPtCuts(){fSeveralConeAndPtCuts = kFALSE ;} + + Bool_t IsPbPb() const {return fPbPb ; } + void SetppCollisions(){fPbPb = kFALSE; } + void SetPbPbCollisions(){fPbPb = kTRUE; } + + Double_t GetDeltaPhiMaxCut() const {return fDeltaPhiMaxCut ; } + Double_t GetDeltaPhiMinCut() const {return fDeltaPhiMinCut ; } + Double_t GetLeadingRatioMaxCut() const {return fLeadingRatioMaxCut ; } + Double_t GetLeadingRatioMinCut() const {return fLeadingRatioMinCut ; } + + Double_t GetPtTriggerSelectionCut() const {return fPtTriggerSelectionCut ; } + Double_t GetJetRatioMaxCut() const {return fJetRatioMaxCut ; } + Double_t GetJetRatioMinCut() const {return fJetRatioMinCut ; } + + void SetPtTriggerSelectionCut(Double_t cut){fPtTriggerSelectionCut = cut; } + void SetJetSelectionMode(UInt_t select){ fSelect= select ; } + + Int_t GetJetNCones() const {return fJetNCone ; } + Int_t GetJetNPtThres() const {return fJetNPt ; } + Float_t GetJetCone() const {return fJetCone ; } + Float_t GetJetPtThreshold() const {return fJetPtThreshold ; } + Float_t GetJetPtThresPbPb() const {return fJetPtThresPbPb ; } + Float_t GetJetCones(Int_t i) const {return fJetCones[i] ; } + Float_t GetJetPtThreshold(Int_t i) const {return fJetPtThres[i] ; } + TString GetJetConeName(Int_t i) const {return fJetNameCones[i] ; } + TString GetJetPtThresName(Int_t i) const {return fJetNamePtThres[i] ; } + + + void SetDeltaPhiCutRange(Double_t phimin, Double_t phimax) + {fDeltaPhiMaxCut =phimax; fDeltaPhiMinCut =phimin;} + void SetLeadingRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fLeadingRatioMaxCut =ratiomax; fLeadingRatioMinCut = ratiomin ; } + + void SetJetNCones(Int_t n){fJetNCone = n ; } + void SetJetNPtThresholds(Int_t n){fJetNPt = n ; } + void SetJetCones(Int_t i, Float_t cone, TString sc) + {fJetCones[i] = cone ; fJetNameCones[i] = sc; }; + void SetCone(Float_t cone) + {fJetCone = cone; } + void SetJetPtThreshold(Float_t pt){fJetPtThreshold = pt; }; + void SetJetPtThresPbPb(Float_t pt){fJetPtThresPbPb = pt; }; + void SetJetPtThresholds(Int_t i,Float_t pt, TString spt){fJetPtThres[i] = pt ; + fJetNamePtThres[i] = spt; }; + + void SetJetRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fJetRatioMaxCut =ratiomax; fJetRatioMinCut = ratiomin ; } + void SetJetCTSRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fJetCTSRatioMaxCut =ratiomax; fJetCTSRatioMinCut = ratiomin ; } + + private: + + Double_t CalculateJetRatioLimit(const Double_t ptTrig, const Double_t *param, const Double_t *x); + + void FillJetHistos(AliAODParticleCorrelation * particle, const TLorentzVector leading, const TLorentzVector jet, const TString type, const TString lastname); + + TList * GetOutputContainer() {return fOutCont; } + + Bool_t IsJetSelected(const Double_t ptTrig, const Double_t ptjet); + Bool_t IsParticleInJetCone(const Double_t eta, Double_t phi, const Double_t etal, Double_t phil); + + void GetLeadingCharge(AliAODParticleCorrelation *particle, TLorentzVector & pLeading) ; + void GetLeadingPi0 (AliAODParticleCorrelation *particle, TLorentzVector & pLeading) ; + Bool_t GetLeadingParticle(AliAODParticleCorrelation *particle, TLorentzVector & pLeading) ; + + void MakeAnalysisFillAOD(); + void MakeAnalysisFillHistograms(); + void MakeAODJet(AliAODParticleCorrelation * particle, const TLorentzVector pLeading); + void MakeJetFromAOD(AliAODParticleCorrelation * particle, const TLorentzVector pLeading, + TLorentzVector & jet, TLorentzVector & bkg); + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) ; + + private: + + Bool_t fJetsOnlyInCTS ; // Jets measured only in TPC+ITS. + Bool_t fPbPb; // PbPb event + Bool_t fSeveralConeAndPtCuts; // To play with the jet cone size and pt th. + Bool_t fReMakeJet ; //Re make the jet reconstruction from AODParticleCorrelation input + + //Leading particle selection parameters + Double_t fDeltaPhiMaxCut ; // Minimum Delta Phi Gamma-Leading + Double_t fDeltaPhiMinCut ; // Maximum Delta Phi Gamma-Leading + Double_t fLeadingRatioMaxCut ; // Leading /gamma Ratio cut maximum + Double_t fLeadingRatioMinCut ; // Leading/gamma Ratio cut minimum + + //Jet selection parameters + //Fixed cuts (old) + Double_t fJetCTSRatioMaxCut ; // Jet(CTS) /gamma Ratio cut maximum + Double_t fJetCTSRatioMinCut ; // Jet(CTS) /gamma Ratio cut maximum + Double_t fJetRatioMaxCut ; // Jet(EMCAL+CTS)/gamma Ratio cut maximum + Double_t fJetRatioMinCut ; // Jet(EMCAL+CTS)/gamma Ratio cut minimum + + //Cuts depending on jet pt + Double_t fJetE1[2]; //Rec. jet energy parameters + Double_t fJetE2[2]; //Rec. jet energy parameters + Double_t fJetSigma1[2];//Rec. sigma of jet energy parameters + Double_t fJetSigma2[2];//Rec. sigma of jet energy parameters + Double_t fBkgMean[6]; //Background mean energy + Double_t fBkgRMS[6]; //Background RMS + Double_t fJetXMin1[6]; //X Factor to set jet min limit for pp + Double_t fJetXMin2[6]; //X Factor to set jet min limit for PbPb + Double_t fJetXMax1[6]; //X Factor to set jet max limit for pp + Double_t fJetXMax2[6]; //X Factor to set jet max limit for PbPb + + Int_t fJetNCone ; // Number of jet cones sizes, maximum 5 + Int_t fJetNPt ; // Number of jet particle pT threshold, maximum 5 + Double_t fJetCone ; // Jet cone sizes under study (!fSeveralConeAndPtCuts) + Double_t fJetCones[5]; // Jet cone sizes under study (fSeveralConeAndPtCuts) + TString fJetNameCones[5]; // String name of cone to append to histos + Double_t fJetPtThreshold; // Jet pT threshold under study(!fSeveralConeAndPtCuts) + Double_t fJetPtThresPbPb; // Jet pT threshold under study(!fSeveralConeAndPtCuts) + Double_t fJetPtThres[5]; // Jet pT threshold under study(fSeveralConeAndPtCuts) + TString fJetNamePtThres[5]; // String name of pt th to append to histos + Double_t fPtTriggerSelectionCut; // Jet pt to change to low pt jets analysis + UInt_t fSelect ; //kTRUE: Selects all jets, no limits. + + //Histograms + //Leading particle distributions + TList * fOutCont ; //! Container for histograms + + TH2F * fhChargedLeadingPt ; //! Pt(Pt trigger) distribution of charged hadrons + TH2F * fhChargedLeadingPhi ; //! Phi(Pt trigger) distribution of charged hadrons + TH2F * fhChargedLeadingEta ; //! Eta(Pt trigger) distribution of charged hadrons + TH2F * fhChargedLeadingDeltaPt ; //! Difference of charged hadron and trigger pT as function of trigger p + TH2F * fhChargedLeadingDeltaPhi ; //! Difference of charged hadron and trigger phi as function of trigger pT + TH2F * fhChargedLeadingDeltaEta ; //! Difference of charged particle and trigger eta as function of trigger pT + TH2F * fhChargedLeadingRatioPt ; //! Ratio of Pt leading charge and trigger + + TH2F * fhNeutralLeadingPt ; //! Pt(Pt trigger) distribution of neutral hadrons + TH2F * fhNeutralLeadingPhi ; //! Phi(Pt trigger) distribution of neutral hadrons + TH2F * fhNeutralLeadingEta ; //! Eta(Pt trigger) distribution of neutral hadrons + TH2F * fhNeutralLeadingDeltaPt ; //! Difference of neutral hadron and trigger pT as function of trigger pT + TH2F * fhNeutralLeadingDeltaPhi ; //! Difference of neutral hadron and trigger phi as function of trigger pT + TH2F * fhNeutralLeadingDeltaEta ; //! Difference of charged particle and trigger eta as function of trigger pT + TH2F * fhNeutralLeadingRatioPt ; //! Ratio of Pt leading neutral and trigger + + // Jet distributions + // Fixed cone and pt threshold + TH2F * fhJetPt ; //! leading pt jet vs pt trigger + TH2F * fhJetRatioPt ; //! Ratio of pt jet and pt trigger + TH2F * fhJetDeltaPhi ; //! Delta phi jet-trigger + TH2F * fhJetDeltaEta ; //! Delta eta jet-trigger + TH2F * fhJetLeadingRatioPt ; //! Ratio of pt leading and pt jet + TH2F * fhJetLeadingDeltaPhi ; //! Delta phi jet-leading + TH2F * fhJetLeadingDeltaEta ; //! Delta eta jet-leading + TH2F * fhJetFFz; //! Accepted reconstructed jet fragmentation function, z=ptjet/pttrig + TH2F * fhJetFFxi; //! Accepted reconstructed jet fragmentation function, xsi = ln(pttrig/ptjet) + TH2F * fhJetFFpt; //! Jet particle pt distribution in cone + TH2F * fhJetNTracksInCone ; //! jet multiplicity in cone + + TH2F * fhBkgPt ; //! leading pt bakground vs pt trigger + TH2F * fhBkgRatioPt ; //! Ratio of pt background and pt trigger + TH2F * fhBkgDeltaPhi ; //! Delta phi background-trigger + TH2F * fhBkgDeltaEta ; //! Delta eta background-trigger + TH2F * fhBkgLeadingRatioPt ; //! Ratio of pt leading and pt background + TH2F * fhBkgLeadingDeltaPhi ; //! Delta phi background-leading + TH2F * fhBkgLeadingDeltaEta ; //! Delta eta background-leading + TH2F * fhBkgFFz; //! Accepted reconstructed background fragmentation function, z=ptjet/pttrig + TH2F * fhBkgFFxi; //! Accepted reconstructed background fragmentation function, xsi = ln(pttrig/ptjet) + TH2F * fhBkgFFpt; //! Background particle pt distribution in cone + TH2F * fhBkgNTracksInCone ; //! Background multiplicity in cone + + // Variable cone and pt threshold + + TH2F * fhJetPts[5][5]; //! leading pt jet vs pt trigger + TH2F * fhJetRatioPts[5][5]; //! Ratio of pt jet and pt trigger + TH2F * fhJetDeltaPhis[5][5]; //! Delta phi jet-trigger + TH2F * fhJetDeltaEtas[5][5]; //! Delta eta jet-trigger + TH2F * fhJetLeadingRatioPts[5][5]; //! Ratio of pt leading and pt jet + TH2F * fhJetLeadingDeltaPhis[5][5]; //! Delta phi jet-leading + TH2F * fhJetLeadingDeltaEtas[5][5]; //! Delta eta jet-leading + TH2F * fhJetFFzs[5][5]; //! Accepted reconstructed jet fragmentation function, z=ptjet/pttrig + TH2F * fhJetFFxis[5][5]; //! Accepted reconstructed jet fragmentation function, xsi = ln(pttrig/ptjet) + TH2F * fhJetFFpts[5][5]; //! Jet particle pt distribution in cone + TH2F * fhJetNTracksInCones[5][5]; //! jet multiplicity in cone + + TH2F * fhBkgPts[5][5]; //! leading pt bakground vs pt trigger + TH2F * fhBkgRatioPts[5][5]; //! Ratio of pt background and pt trigger + TH2F * fhBkgDeltaPhis[5][5]; //! Delta phi background-trigger + TH2F * fhBkgDeltaEtas[5][5]; //! Delta eta background-trigger + TH2F * fhBkgLeadingRatioPts[5][5]; //! Ratio of pt leading and pt background + TH2F * fhBkgLeadingDeltaPhis[5][5]; //! Delta phi background-leading + TH2F * fhBkgLeadingDeltaEtas[5][5]; //! Delta eta background-leading + TH2F * fhBkgFFzs[5][5]; //! Accepted reconstructed background fragmentation function, z=ptjet/pttrig + TH2F * fhBkgFFxis[5][5]; //! Accepted reconstructed background fragmentation function, xsi = ln(pttrig/ptjet) + TH2F * fhBkgFFpts[5][5]; //! Background particle pt distribution in cone + TH2F * fhBkgNTracksInCones[5][5]; //! Background multiplicity in cone + + + ClassDef(AliAnaParticleJetLeadingConeCorrelation,1) + } ; + + +#endif //AliAnaParticleJetLeadingConeCorrelation_H + + + diff --git a/PWG4/PartCorr/AliAnaParticlePartonCorrelation.cxx b/PWG4/PartCorr/AliAnaParticlePartonCorrelation.cxx new file mode 100644 index 00000000000..89b1ee78c60 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticlePartonCorrelation.cxx @@ -0,0 +1,295 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for the analysis of particle-parton correlations +// Particle (for example direct gamma) must be found in a previous analysis +// -- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + +// --- ROOT system --- +#include "Riostream.h" +#include "TH2F.h" +#include "TParticle.h" + +//---- ANALYSIS system ---- +#include "AliAnaParticlePartonCorrelation.h" +#include "AliLog.h" +#include "AliStack.h" + + ClassImp(AliAnaParticlePartonCorrelation) + + +//____________________________________________________________________________ + AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation() : + AliAnaPartCorrBaseClass(), + fhDeltaEtaNearParton(0), fhDeltaPhiNearParton(0), + fhDeltaPtNearParton(0), fhPtRatNearParton(0), + fhDeltaEtaAwayParton(0), fhDeltaPhiAwayParton(0), + fhDeltaPtAwayParton(0), fhPtRatAwayParton(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation(const AliAnaParticlePartonCorrelation & g) : + AliAnaPartCorrBaseClass(g), + fhDeltaEtaNearParton(g.fhDeltaEtaNearParton), fhDeltaPhiNearParton(g.fhDeltaPhiNearParton), + fhDeltaPtNearParton(g.fhDeltaPtNearParton), fhPtRatNearParton(g.fhPtRatNearParton), + fhDeltaEtaAwayParton(g.fhDeltaEtaAwayParton), fhDeltaPhiAwayParton(g.fhDeltaPhiAwayParton), + fhDeltaPtAwayParton(g.fhDeltaPtAwayParton), fhPtRatAwayParton(g.fhPtRatAwayParton) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaParticlePartonCorrelation & AliAnaParticlePartonCorrelation::operator = (const AliAnaParticlePartonCorrelation & source) +{ + // assignment operator + + if(this == &source)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(source); + + fhDeltaEtaAwayParton = source.fhDeltaEtaAwayParton; + fhDeltaPhiAwayParton = source.fhDeltaPhiAwayParton; + fhDeltaPtAwayParton = source.fhDeltaPtAwayParton; + fhPtRatAwayParton = source.fhPtRatAwayParton; + fhDeltaEtaNearParton = source.fhDeltaEtaNearParton; + fhDeltaPhiNearParton = source.fhDeltaPhiNearParton; + fhDeltaPtNearParton = source.fhDeltaPtNearParton; + fhPtRatNearParton = source.fhPtRatNearParton; + + return *this; + +} + + +//________________________________________________________________________ +TList * AliAnaParticlePartonCorrelation::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file + + AliDebug(1,"Init parton histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("ParticlePartonHistos") ; + + fhDeltaPhiNearParton = new TH2F + ("DeltaPhiNearParton","#phi_{particle} - #phi_{parton} vs p_{T particle}", + 200,0,120,200,0,6.4); + fhDeltaPhiNearParton->SetYTitle("#Delta #phi"); + fhDeltaPhiNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPhiNearParton); + + fhDeltaEtaNearParton = new TH2F + ("DeltaEtaNearParton","#eta_{particle} - #eta_{parton} vs p_{T particle}", + 200,0,120,200,-2,2); + fhDeltaEtaNearParton->SetYTitle("#Delta #eta"); + fhDeltaEtaNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaEtaNearParton); + + fhDeltaPtNearParton = new TH2F + ("DeltaPtNearParton","#p_{T particle} - #p_{T parton} vs p_{T particle}", + 200,0,120,100,-10,10); + fhDeltaPtNearParton->SetYTitle("#Delta #p_{T}"); + fhDeltaPtNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPtNearParton); + + fhPtRatNearParton = new TH2F + ("PtRatNearParton","#p_{T parton} / #p_{T particle} vs p_{T particle}", + 200,0,120,200,0,5); + fhPtRatNearParton->SetYTitle("ratio"); + fhPtRatNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhPtRatNearParton); + + fhDeltaPhiAwayParton = new TH2F + ("DeltaPhiAwayParton","#phi_{particle} - #phi_{parton} vs p_{T particle}", + 200,0,120,200,0,6.4); + fhDeltaPhiAwayParton->SetYTitle("#Delta #phi"); + fhDeltaPhiAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPhiAwayParton); + + fhDeltaEtaAwayParton = new TH2F + ("DeltaEtaAwayParton","#eta_{particle} - #eta_{parton} vs p_{T particle}", + 200,0,120,200,-2,2); + fhDeltaEtaAwayParton->SetYTitle("#Delta #eta"); + fhDeltaEtaAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaEtaAwayParton); + + fhDeltaPtAwayParton = new TH2F + ("DeltaPtAwayParton","#p_{T particle} - #p_{T parton} vs p_{T particle}", + 200,0,120,100,-10,10); + fhDeltaPtAwayParton->SetYTitle("#Delta #p_{T}"); + fhDeltaPtAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPtAwayParton); + + fhPtRatAwayParton = new TH2F + ("PtRatAwayParton","#p_{T parton} / #p_{T particle} vs p_{T particle}", + 200,0,120,200,0,5); + fhPtRatAwayParton->SetYTitle("ratio"); + fhPtRatAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhPtRatAwayParton); + + return outputContainer; +} + +//____________________________________________________________________________ +void AliAnaParticlePartonCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + ; + +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Parton Correlation Analysis, create AODs + //Add partons to the reference list of the trigger particle + //Partons are considered those in the first eight possitions in the stack + //being 0, and 1 the 2 protons, and 6 and 7 the outgoing final partons. + + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + } + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("No Stack available, STOP"); + + if(stack->GetNtrack() < 8) { + printf("*** small number of particles, not a PYTHIA simulation? ***: n tracks %d \n", stack->GetNprimary()); + continue ; + } + + //Fill AOD reference only with partons + TParticle * parton = new TParticle ; + + for(Int_t ipr = 0;ipr < 8; ipr ++ ){ + parton = stack->Particle(ipr) ; + particle->AddTrack(parton); + //parton->Print(); + } + + }//Aod branch loop + + if(GetDebug() > 1) printf("End parton correlation analysis, fill AODs \n"); +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() +{ + //Particle-Parton Correlation Analysis, fill histograms + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntriesFast()); + } + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("No Stack available, STOP"); + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + TParticle * mom =new TParticle ; + + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + Float_t ptTrigg = particle->Pt(); + Float_t phiTrigg = particle->Phi(); + Float_t etaTrigg = particle->Eta(); + Int_t imom = particle->GetLabel(); + Int_t iparent = 2000; + Int_t iawayparent = -1; + + if(!(particle->GetRefTracks()) || (particle->GetRefTracks())->GetEntriesFast() < 7) AliFatal("Reference list with partons not filled, STOP analysis"); + + //Check and get indeces of mother and parton + if(imom < 8 ) iparent = imom ; //mother is already a parton + else if (imom < stack->GetNtrack()) { + mom = stack->Particle(imom); + iparent=mom->GetFirstMother(); + cout<<" iparent "< 7 ){ + mom = stack->Particle(iparent); + imom = iparent ; //Mother label is of the inmediate parton daughter + iparent = mom->GetFirstMother(); + cout<<" while iparent "< 1) printf("N reference partons %d; labels: mother %d, parent %d \n", (particle->GetRefTracks())->GetEntriesFast(), imom, iparent); + + + if(iparent < 0 || iparent > 8) { + if(GetDebug() > 0 ) printf("Failed to find appropriate parton, index %d", iparent); + continue ; + } + + //Near parton is the parton that fragmented and created the mother + TParticle * nearParton = (TParticle*) (particle->GetRefTracks())->At(iparent); + Float_t ptNearParton = nearParton->Pt(); + Float_t phiNearParton = nearParton->Phi() ; + Float_t etaNearParton = nearParton->Eta() ; + + fhDeltaEtaNearParton->Fill(ptTrigg,etaTrigg-etaNearParton); + fhDeltaPhiNearParton->Fill(ptTrigg,phiTrigg-phiNearParton); + fhDeltaPtNearParton->Fill(ptTrigg,ptTrigg-ptNearParton); + fhPtRatNearParton->Fill(ptTrigg,ptNearParton/ptTrigg); + + if(iparent == 7) iawayparent =6; + else if(iparent == 6) iawayparent =7; + else{ + printf("Parent parton is not final state, skip \n"); + continue; + } + + //Away parton is the other final parton. + TParticle * awayParton = (TParticle*) (particle->GetRefTracks())->At(iawayparent); + Float_t ptAwayParton = awayParton->Pt(); + Float_t phiAwayParton = awayParton->Phi() ; + Float_t etaAwayParton = awayParton->Eta() ; + fhDeltaEtaAwayParton->Fill(ptTrigg,etaTrigg-etaAwayParton); + fhDeltaPhiAwayParton->Fill(ptTrigg,phiTrigg-phiAwayParton); + fhDeltaPtAwayParton->Fill(ptTrigg,ptTrigg-ptAwayParton); + fhPtRatAwayParton->Fill(ptTrigg,ptAwayParton/ptTrigg); + + + } + + if(GetDebug() > 1) printf("End parton correlation analysis, fill histograms \n"); + +} diff --git a/PWG4/PartCorr/AliAnaParticlePartonCorrelation.h b/PWG4/PartCorr/AliAnaParticlePartonCorrelation.h new file mode 100644 index 00000000000..0eecbbdf175 --- /dev/null +++ b/PWG4/PartCorr/AliAnaParticlePartonCorrelation.h @@ -0,0 +1,56 @@ +#ifndef AliAnaParticlePartonCorrelation_H +#define AliAnaParticlePartonCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the analysis of particle-parton correlation +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT --- +class TH2F ; + +// --- ANALYSIS --- +#include "AliAnaPartCorrBaseClass.h" + +class AliAnaParticlePartonCorrelation : public AliAnaPartCorrBaseClass { + + public: + + AliAnaParticlePartonCorrelation() ; // default ctor + AliAnaParticlePartonCorrelation(const AliAnaParticlePartonCorrelation & g) ; // cpy ctor + AliAnaParticlePartonCorrelation & operator = (const AliAnaParticlePartonCorrelation & g) ;//cpy assignment + virtual ~AliAnaParticlePartonCorrelation() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + private: + + TH2F * fhDeltaEtaNearParton; //! Difference of parton eta and prompt trigger particle eta + TH2F * fhDeltaPhiNearParton; //! Difference of parton phi and prompt trigger particle phi + TH2F * fhDeltaPtNearParton; //! Difference of parton pT and prompt trigger particle pT + TH2F * fhPtRatNearParton; //! Ratio of parton pT and prompt trigger particle pT + + TH2F * fhDeltaEtaAwayParton; //! Difference of parton eta and prompt trigger particle eta + TH2F * fhDeltaPhiAwayParton; //! Difference of parton phi and prompt trigger particle phi + TH2F * fhDeltaPtAwayParton; //! Difference of parton pT and prompt trigger particle pT + TH2F * fhPtRatAwayParton; //! Ratio of parton pT and prompt trigger particle pT + + ClassDef(AliAnaParticlePartonCorrelation,1) + } ; + + +#endif //AliAnaParticlePartonCorrelation_H + + + diff --git a/PWG4/PartCorr/AliAnaPi0.cxx b/PWG4/PartCorr/AliAnaPi0.cxx new file mode 100644 index 00000000000..e4a4c76dac2 --- /dev/null +++ b/PWG4/PartCorr/AliAnaPi0.cxx @@ -0,0 +1,557 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class to collect two-photon invariant mass distributions for +// extractin raw pi0 yield. +// +//-- Author: Dmitri Peressounko (RRC "KI") +//_________________________________________________________________________ + + +// --- ROOT system --- +#include "TClonesArray.h" +#include "TRefArray.h" +#include "TH3.h" + +//---- AliRoot system ---- +#include "AliAnaPi0.h" +#include "AliLog.h" +#include "AliCaloPhoton.h" +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliESDVertex.h" +#include "AliAODVertex.h" +#include "AliESDCaloCluster.h" +#include "AliAODCaloCluster.h" + +ClassImp(AliAnaPi0) + +//____________________________________________________________________________ + AliAnaPi0::AliAnaPi0() : AliAnalysisTaskSE(), + fNCentrBin(1),fNZvertBin(1),fNrpBin(1),fNPID(2),fNmaxMixEv(10), + fCurCentrBin(0),fCurZvertBin(0),fCurRPBin(0),fPtMin(0.),fZvtxCut(40.), + fMinDist(2.),fMinDist2(4.),fMinDist3(5.),fDispCut(1.5),fTOFCut(5.e-9),fPhotPID(0.6), + fEventsList(0x0),fCurrentEvent(0x0),fOutputList(0x0),fhEtalon(0x0), + fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0) +{ + //Default Ctor + +} +//____________________________________________________________________________ + AliAnaPi0::AliAnaPi0(const char *name): AliAnalysisTaskSE(name), + fNCentrBin(1),fNZvertBin(1),fNrpBin(1),fNPID(9),fNmaxMixEv(10), + fCurCentrBin(0),fCurZvertBin(0),fCurRPBin(0),fPtMin(0.),fZvtxCut(40.), + fMinDist(2.),fMinDist2(4.),fMinDist3(5.),fDispCut(1.5),fTOFCut(5.e-9),fPhotPID(0.6), + fEventsList(0x0),fCurrentEvent(0x0),fOutputList(0x0),fhEtalon(0x0), + fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0) +{ + //Ctor + DefineOutput(1,TList::Class()); +} + +//____________________________________________________________________________ +AliAnaPi0::AliAnaPi0(const AliAnaPi0 & ex) : AliAnalysisTaskSE(ex), + fNCentrBin(1),fNZvertBin(1),fNrpBin(1),fNPID(9),fNmaxMixEv(10), + fCurCentrBin(0),fCurZvertBin(0),fCurRPBin(0),fPtMin(0.),fZvtxCut(40.), + fMinDist(2.),fMinDist2(4.),fMinDist3(5.),fDispCut(1.5),fTOFCut(5.e-9),fPhotPID(0.6), + fEventsList(0x0),fCurrentEvent(0x0),fOutputList(0x0),fhEtalon(0x0), + fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0) +{ + // cpy ctor + //Do not need it +} +//_________________________________________________________________________ +AliAnaPi0 & AliAnaPi0::operator = (const AliAnaPi0 & ex) +{ + // assignment operator + + if(this == &ex)return *this; + ((AliAnalysisTaskSE *)this)->operator=(ex); + + return *this; + +} +//____________________________________________________________________________ +AliAnaPi0::~AliAnaPi0() { + // Remove event containers + if(fEventsList){ + for(Int_t ic=0; icDelete() ; + delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ; + } + } + } + delete[] fEventsList; + fEventsList=0 ; + } + + if(fhEtalon){ + delete fhEtalon ; + fhEtalon = 0; + } + if(fhRe1) delete[] fhRe1 ; //Do not delete histograms! + if(fhRe2) delete[] fhRe2 ; //Do not delete histograms! + if(fhRe3) delete[] fhRe3 ; //Do not delete histograms! + if(fhMi1) delete[] fhMi1 ; //Do not delete histograms! + if(fhMi2) delete[] fhMi2 ; //Do not delete histograms! + if(fhMi3) delete[] fhMi3 ; //Do not delete histograms! + +} +//________________________________________________________________________ +void AliAnaPi0::UserCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + AliDebug(1,"Init inv. mass histograms"); + OpenFile(1) ; + + //create event containers + fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ; + for(Int_t ic=0; icSetName(GetName()) ; + + fhRe1=new TH3D*[fNCentrBin*fNPID] ; + fhRe2=new TH3D*[fNCentrBin*fNPID] ; + fhRe3=new TH3D*[fNCentrBin*fNPID] ; + fhMi1=new TH3D*[fNCentrBin*fNPID] ; + fhMi2=new TH3D*[fNCentrBin*fNPID] ; + fhMi3=new TH3D*[fNCentrBin*fNPID] ; + + char key[255] ; + char title[255] ; + for(Int_t ic=0; icClone(key) ; + fhRe1[ic*fNPID+ipid]->SetName(key) ; + fhRe1[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhRe1[ic*fNPID+ipid]) ; + + sprintf(key,"hMi_cen%d_pid%d_dist1",ic,ipid) ; + sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; + fhMi1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; + fhMi1[ic*fNPID+ipid]->SetName(key) ; + fhMi1[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhMi1[ic*fNPID+ipid]) ; + + //Distance to bad module 2 + sprintf(key,"hRe_cen%d_pid%d_dist2",ic,ipid) ; + sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; + fhRe2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; + fhRe2[ic*fNPID+ipid]->SetName(key) ; + fhRe2[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhRe2[ic*fNPID+ipid]) ; + + sprintf(key,"hMi_cen%d_pid%d_dist2",ic,ipid) ; + sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; + fhMi2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; + fhMi2[ic*fNPID+ipid]->SetName(key) ; + fhMi2[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhMi2[ic*fNPID+ipid]) ; + + //Distance to bad module 3 + sprintf(key,"hRe_cen%d_pid%d_dist3",ic,ipid) ; + sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; + fhRe3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; + fhRe3[ic*fNPID+ipid]->SetName(key) ; + fhRe3[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhRe3[ic*fNPID+ipid]) ; + + sprintf(key,"hMi_cen%d_pid%d_dist3",ic,ipid) ; + sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; + fhMi3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; + fhMi3[ic*fNPID+ipid]->SetName(key) ; + fhMi3[ic*fNPID+ipid]->SetTitle(title) ; + fOutputList->Add(fhMi3[ic*fNPID+ipid]) ; + } + } + + fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin, + fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ; + fOutputList->Add(fhEvents) ; + + //Save parameters used for analysis + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + sprintf(onePar,"Number of bins in Centrality: %d \n",fNCentrBin) ; + parList+=onePar ; + sprintf(onePar,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ; + parList+=onePar ; + sprintf(onePar,"Number of bins in Reac. Plain: %d \n",fNrpBin) ; + parList+=onePar ; + sprintf(onePar,"Depth of event buffer: %d \n",fNmaxMixEv) ; + parList+=onePar ; + sprintf(onePar,"Number of different PID used: %d \n",fNPID) ; + parList+=onePar ; + sprintf(onePar,"Cuts: \n") ; + parList+=onePar ; + sprintf(onePar,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ; + parList+=onePar ; + sprintf(onePar,"Minimal P_t: %f \n", fPtMin) ; + parList+=onePar ; + sprintf(onePar,"fMinDist =%f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ; + parList+=onePar ; + sprintf(onePar,"fMinDist2=%f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ; + parList+=onePar ; + sprintf(onePar,"fMinDist3=%f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ; + parList+=onePar ; + sprintf(onePar,"fDispCut =%f (Cut on dispersion, used in PID evaluation) \n",fDispCut) ; + parList+=onePar ; + sprintf(onePar,"fTOFCut =%e (Cut on TOF, used in PID evaluation) \n",fTOFCut) ; + parList+=onePar ; + sprintf(onePar,"fPhotPID =%f (limit for Baesian PID for photon) \n",fPhotPID) ; + parList+=onePar ; + + TObjString *oString= new TObjString(parList) ; + fOutputList->Add(oString); + +} +//__________________________________________________ +void AliAnaPi0::InitParameters() +{ + //Initialize the parameters of the analysis. + +} + //__________________________________________________ +void AliAnaPi0::Init() +{ + //Make here all memory allocations + //create etalon histo for all later histograms + if(!fhEtalon){ // p_T alpha d m_gg + fhEtalon = new TH3D("hEtalon","Histo with binning parameters",20,0.,10.,10,0.,1.,200,0.,1.) ; + fhEtalon->SetXTitle("P_{T} (GeV)") ; + fhEtalon->SetYTitle("#alpha") ; + fhEtalon->SetZTitle("m_{#gamma#gamma} (GeV)") ; + } + +} +//__________________________________________________________________ +void AliAnaPi0::Print(const Option_t * /*opt*/) const +{ + //Print some relevant parameters set for the analysis + printf("Class AliAnaPi0 for gamma-gamma inv.mass construction \n") ; + printf("Number of bins in Centrality: %d \n",fNCentrBin) ; + printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ; + printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ; + printf("Depth of event buffer: %d \n",fNmaxMixEv) ; + printf("Number of different PID used: %d \n",fNPID) ; + printf("Cuts: \n") ; + printf("Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ; + printf("Minimal P_t: %f \n", fPtMin) ; + printf("fMinDist =%f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ; + printf("fMinDist2=%f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ; + printf("fMinDist3=%f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ; + printf("fDispCut =%f (Cut on dispersion, used in PID evaluation) \n",fDispCut) ; + printf("fTOFCut =%e (Cut on TOF, used in PID evaluation) \n",fTOFCut) ; + printf("fPhotPID =%f (limit for Baesian PID for photon) \n",fPhotPID) ; + printf("------------------------------------------------------\n") ; + +} +//__________________________________________________________________ +void AliAnaPi0::UserExec(Option_t *) +{ + //Process one event and extract photons + //impose cuts on bad modules and bad runs + //fill internal storage for subsequent histo filling + + AliVEvent* event = InputEvent(); + + //Apply some cuts on event: vertex position and centrality range + Int_t iRun=event->GetRunNumber() ; + if(IsBadRun(iRun)) + return ; + + AliESDEvent* esd = dynamic_cast(event) ; + AliAODEvent* aod = dynamic_cast(event) ; + if(esd){ + if(!FillFromESD(esd)) + return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + } + else if(aod){ + if(!FillFromAOD(aod)) + return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + } + else{ + printf("Input neither ESD nor AOD, do nothing \n") ; + return ; + } + + + fhEvents->Fill(fCurCentrBin+0.5,fCurZvertBin+0.5,fCurRPBin+0.5) ; + + if(fCurrentEvent->GetEntriesFast()>0){ + //Reduce size for storing + fCurrentEvent->Expand(fCurrentEvent->GetEntriesFast()) ; + FillHistograms() ; + } + + PostData(1, fOutputList); + +} +//__________________________________________________________________ +Bool_t AliAnaPi0::FillFromESD(AliESDEvent * esd){ + //Fill photon list from ESD applying + //some cut should be applyed + + //Impose cut on vertex and calculate Zvertex bin + const AliESDVertex *esdV = esd->GetVertex() ; + esdV->GetXYZ(fVert); + if(fVert[2]<-fZvtxCut || fVert[2]> fZvtxCut) + return kFALSE ; + fCurZvertBin=(Int_t)(0.5*fNZvertBin*(fVert[2]+fZvtxCut)/fZvtxCut) ; + + //Get Centrality and calculate centrality bin + //Does not exist in ESD yet??????? + fCurCentrBin=0 ; + + //Get Reaction Plain position and calculate RP bin + //does not exist in ESD yet???? + fCurRPBin=0 ; + + //************************ PHOS ************************************* + TRefArray * caloClustersArr = new TRefArray(); + esd->GetPHOSClusters(caloClustersArr); + + const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ; + //if fCurrentEvent!=0 it was not filled in previous event, still empty and can be used + if(!fCurrentEvent) + fCurrentEvent = new TClonesArray("AliCaloPhoton",kNumberOfPhosClusters) ; + Int_t inList=0 ; + + // loop over the PHOS Cluster + for(Int_t i = 0 ; i < kNumberOfPhosClusters ; i++) { + AliESDCaloCluster * calo = (AliESDCaloCluster *) caloClustersArr->At(i) ; + + //Make some tests + if(calo->E()GetDistanceToBadChannel() ; //Distance to bad in cm + if(distBad<0.)distBad=9999. ; //workout strange convension dist = -1. ; + if(distBad(fCurrentEvent->At(inList)) ; + inList++ ; + + //Set Momentum + calo->GetMomentum(*ph,fVert); + + //Dispersion/lambdas + Double_t disp=calo->GetClusterDisp() ; +// Double_t m20=calo->GetM20() ; +// Double_t m02=calo->GetM02() ; + ph->SetDispBit(dispGetTOF() ; + ph->SetTOFBit(TMath::Abs(tof)GetEmcCpvDistance() ; + Int_t itr=calo->GetNTracksMatched(); //number of track matched + ph->SetCPVBit(itr>0) ; //Temporary cut, should we evaluate distance? + + //Overall PID + Double_t *pid=calo->GetPid(); + ph->SetPCAPID(pid[AliPID::kPhoton]>fPhotPID) ; + + //Set Distance to Bad channel + if(distBad>fMinDist3) + ph->SetDistToBad(2) ; + else if(distBad>fMinDist2) + ph->SetDistToBad(1) ; + else + ph->SetDistToBad(0) ; + + }//loop + return kTRUE ; +} +//__________________________________________________________________ +Bool_t AliAnaPi0::FillFromAOD(AliAODEvent * aod){ + //Fill photon list from AOD applying + //some cuts + + //Impose cut on vertex and calculate Zvertex bin + const AliAODVertex *aodV = aod->GetPrimaryVertex() ; + fVert[0]=aodV->GetX(); + fVert[1]=aodV->GetY(); + fVert[2]=aodV->GetZ(); + if(fVert[2]<-fZvtxCut || fVert[2]> fZvtxCut) + return kFALSE ; + fCurZvertBin=(Int_t)(0.5*fNZvertBin*(fVert[2]+fZvtxCut)/fZvtxCut) ; + + //Get Centrality and calculate centrality bin + //Does not exist in ESD yet??????? + fCurCentrBin=0 ; + + //Get Reaction Plain position and calculate RP bin + //does not exist in ESD yet???? + fCurRPBin=0 ; + + //************************ PHOS ************************************* + const Int_t kNumberOfPhosClusters = aod->GetNCaloClusters() ; + if(!fCurrentEvent) + fCurrentEvent = new TClonesArray("AliCaloPhoton",kNumberOfPhosClusters) ; + Int_t inList=0 ; + + // loop over the PHOS Cluster + for(Int_t i = 0 ; i < kNumberOfPhosClusters ; i++) { + AliAODCaloCluster * calo = aod->GetCaloCluster(i); + + //Make some tests + if(calo->E()GetDistToBadChannel() ; + if(distBad(fCurrentEvent->At(inList)) ; + inList++ ; + + //Set Momentum + calo->GetMomentum(*ph,fVert); + + //Dispersion/lambdas + Double_t disp=calo->GetDispersion() ; +// Double_t m20=calo->GetM20() ; +// Double_t m02=calo->GetM02() ; + ph->SetDispBit(dispGetTOF() ; + ph->SetTOFBit(TMath::Abs(tof)GetEmcCpvDistance() ; + Int_t itr=calo->GetNTracksMatched(); //number of track matched + ph->SetCPVBit(itr>0) ; //Temporary cut !!!! + + //Overall PID + Double_t pid[13]; + calo->GetPID(pid); + ph->SetPCAPID(pid[AliAODCluster::kPhoton]>fPhotPID) ; + + //Distance to Bad + if(distBad>fMinDist3) + ph->SetDistToBad(2) ; + else if(distBad>fMinDist2) + ph->SetDistToBad(1) ; + else + ph->SetDistToBad(0) ; + + + }//loop + return kTRUE ; +} +//__________________________________________________________________ +void AliAnaPi0::FillHistograms() +{ + //Fill Real and Mixed invariant mass histograms + //then add current event to the buffer and + //remove redundant events from buffer if necessary + + //Fill histograms only if list of particles for current event was created + if(fCurrentEvent==0) + return ; + + //Fill Real distribution + Int_t nPhot = fCurrentEvent->GetEntriesFast() ; + for(Int_t i1=0; i1(fCurrentEvent->At(i1)) ; + for(Int_t i2=i1+1; i2(fCurrentEvent->At(i2)) ; + Double_t m =(*p1 + *p2).M() ; + Double_t pt=(*p1 + *p2).Pt(); + Double_t a = TMath::Abs(p1->Energy()-p2->Energy())/(p1->Energy()+p2->Energy()) ; + for(Int_t ipid=0; ipidIsPIDOK(ipid)&&p2->IsPIDOK(ipid)){ + fhRe1[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>0 && p2->DistToBad()>0){ + fhRe2[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>1 && p2->DistToBad()>1){ + fhRe3[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + } + } + } + } + } + } + + //Fill mixed + TList * evMixList=fEventsList[fCurCentrBin*fNZvertBin*fNrpBin+fCurZvertBin*fNrpBin+fCurRPBin] ; + Int_t nMixed = evMixList->GetSize() ; + for(Int_t ii=0; ii(evMixList->At(ii)); + Int_t nPhot2=ev2->GetEntriesFast() ; + for(Int_t i1=0; i1(fCurrentEvent->At(i1)) ; + for(Int_t i2=0; i2(ev2->At(i2)) ; + Double_t m =(*p1 + *p2).M() ; + Double_t pt=(*p1 + *p2).Pt(); + Double_t a = TMath::Abs(p1->Energy()-p2->Energy())/(p1->Energy()+p2->Energy()) ; + for(Int_t ipid=0; ipidIsPIDOK(ipid)&&p2->IsPIDOK(ipid)){ + fhMi1[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>0 && p2->DistToBad()>0){ + fhMi2[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>1 && p2->DistToBad()>1){ + fhMi3[fCurCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + } + } + } + } + } + } + } + + //Add current event to buffer and Remove redandant events + if(fCurrentEvent->GetEntriesFast()>0){ + evMixList->AddFirst(fCurrentEvent) ; + fCurrentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer + if(evMixList->GetSize()>=fNmaxMixEv){ + TClonesArray * tmp = dynamic_cast(evMixList->Last()) ; + evMixList->RemoveLast() ; + delete tmp ; + } + } + else{ //empty event + delete fCurrentEvent ; + fCurrentEvent=0 ; + } +} +//______________________________________________________________________________ +void AliAnaPi0::Terminate(Option_t *) +{ +} diff --git a/PWG4/PartCorr/AliAnaPi0.h b/PWG4/PartCorr/AliAnaPi0.h new file mode 100644 index 00000000000..44b1eb53ceb --- /dev/null +++ b/PWG4/PartCorr/AliAnaPi0.h @@ -0,0 +1,105 @@ +#ifndef ALIANAPI0_H +#define ALIANAPI0_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class to fill two-photon invariant mass hisograms +// to be used to extract pi0 raw yield. +// +//-- Author: Dmitri Peressounko (RRC "KI") + +class TH3D ; +class AliAODEvent ; +class AliESDEvent ; + +#include "AliAnalysisTaskSE.h" + +class AliAnaPi0 : public AliAnalysisTaskSE { + + public: + + AliAnaPi0() ; // default ctor + AliAnaPi0(const char *name) ; // default ctor + AliAnaPi0(const AliAnaPi0 & g) ; // cpy ctor + AliAnaPi0 & operator = (const AliAnaPi0 & api0) ;//cpy assignment + virtual ~AliAnaPi0() ;//virtual dtor + + //obligatory methods + virtual void UserCreateOutputObjects(); + virtual void Init() ; + virtual void LocalInit() { Init() ; } + virtual void UserExec(Option_t * opt = "") ; + virtual void Terminate(Option_t * opt = "") ; + + void InitParameters(); + void Print(const Option_t * opt) const; + + void SetBadRunsList(){} ; //Set list of runs which can be used for this analysis + void SetEtalonHisto(TH3D * h);//Provide etalon of binning for histograms + + //Setters for parameters of event buffers + void SetNCentrBin(Int_t n=5){fNCentrBin=n ;} //number of bins in centrality + void SetNZvertBin(Int_t n=5){fNZvertBin=n ;} //number of bins for vertex position + void SetNRPBin(Int_t n=6) {fNrpBin=n ;} //number of bins in reaction plain + void SetNMaxEvMix(Int_t n=20){fNmaxMixEv=n ;}//Maximal number of events for mixing + + //Setters for event selection + void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position + void SetPtMin(Float_t pt = 0.2) {fPtMin=pt ;} //Cut on minimal pt of photon + + private: + void FillHistograms() ; //fill invariant mass distributions + Bool_t FillFromAOD(AliAODEvent * aod) ; + Bool_t FillFromESD(AliESDEvent * esd) ; + + Bool_t IsBadRun(Int_t /*iRun*/) {return kFALSE;} //Tests if this run bad according to private list + + private: + + Int_t fNCentrBin ; //number of bins in event container for centrality + Int_t fNZvertBin ; //number of bins in event container for vertex position + Int_t fNrpBin ; //number of bins in event container for reaction plain + Int_t fNPID ; //Number of possible PID combinations + Int_t fNmaxMixEv ; //Maximal number of events stored in buffer for mixing + + Int_t fCurCentrBin ; //! bin for current event (centrality) + Int_t fCurZvertBin ; //! bin for current event (z position) + Int_t fCurRPBin ; //! bin for current event (reaction plain) + + Float_t fPtMin ; //Cut on minimum photon Pt + Float_t fZvtxCut ; //Cut on vertex position + Float_t fMinDist ; //Minimal distance to bad channel to accept cluster + Float_t fMinDist2; //Cuts on Minimal distance to study acceptance evaluation + Float_t fMinDist3; //One more cut on distance used for acceptance-efficiency study + Float_t fDispCut; //Cut on dispersion, used in PID evaluation + Float_t fTOFCut; //Cut on TOF, used in PID evaluation + Float_t fPhotPID; //Baesian PID for photon + + Double_t fVert[3] ; //Currecnt vertex position + TList ** fEventsList ; //! containers for photons in stored events + TClonesArray * fCurrentEvent ; //!Container with latest event + + TList * fOutputList ; //list of output objects + + //Histograms + TH3D * fhEtalon ; //Etalon histo, all distributions will have same binning as this one + + TH3D ** fhRe1 ; //!REAL two-photon invariant mass distribution for different centralities and PID + TH3D ** fhMi1 ; //!MIXED two-photon invariant mass distribution for different centralities and PID + TH3D ** fhRe2 ; //!REAL two-photon invariant mass distribution for different centralities and PID + TH3D ** fhMi2 ; //!MIXED two-photon invariant mass distribution for different centralities and PID + TH3D ** fhRe3 ; //!REAL two-photon invariant mass distribution for different centralities and PID + TH3D ** fhMi3 ; //!MIXED two-photon invariant mass distribution for different centralities and PID + TH3D * fhEvents; //!Number of events per centrality, RP, zbin + + //Calo Cells + ClassDef(AliAnaPi0,2) + } ; + + +#endif //ALIANAPI0_H + + + diff --git a/PWG4/PartCorr/AliAnaScale.cxx b/PWG4/PartCorr/AliAnaScale.cxx new file mode 100644 index 00000000000..3ea8fdc3f63 --- /dev/null +++ b/PWG4/PartCorr/AliAnaScale.cxx @@ -0,0 +1,138 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* $Id: */ + +//_________________________________________________________________________ +// A basic analysis task to analyse photon detected by PHOS +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#include "AliAnaScale.h" +#include "AliAnalysisManager.h" + +//______________________________________________________________________________ +AliAnaScale::AliAnaScale() : + fDebug(0), + fScale(1.0), + fInputList(0x0), + fOutputList(0x0), + fSumw2(0), + fhCount() +{ + //Default constructor +} +//______________________________________________________________________________ +AliAnaScale::AliAnaScale(const char *name) : + AliAnalysisTask(name,""), + fDebug(0), + fScale(1.0), + fInputList(0x0), + fOutputList(0x0), + fSumw2(0), + fhCount(0) +{ + // Constructor. + // Called only after the event loop + SetPostEventLoop(kTRUE); + // Input slot #0 + DefineInput(0, TList::Class()) ; + // Output slot + DefineOutput(0, TList::Class()) ; +} + +//______________________________________________________________________________ +AliAnaScale::~AliAnaScale() +{ + // dtor + +} + + +//______________________________________________________________________________ +void AliAnaScale::ConnectInputData(const Option_t*) +{ + // Initialisation of branch container and histograms + + if(fDebug > 1) printf("*** Initialization of %s \n", GetName()) ; + fInputList = dynamic_cast(GetInputData(0)) ; +} +//________________________________________________________________________ +void AliAnaScale::CreateOutputObjects() +{ + // Create the outputs containers + + fOutputList = new TList() ; + fOutputList->SetName(GetName()) ; + + fhCount =new TH1F("hCount","count files",1,0,1); + fOutputList->Add(fhCount); + +} + +//______________________________________________________________________________ +void AliAnaScale::Exec(Option_t *) +{ + // Do the Scaling + + if(fDebug > 0 ) printf(">>>>> Scaling factor %e, do Sumw2 %d <<<<< \n",fScale,fSumw2) ; + + TIter next(fInputList) ; + TObject * h ; + while ( (h = next()) ) { + if(h){ + if ( strcmp(h->ClassName(),"TNtuple") ) { + char name[128] ; + sprintf(name, "%sScaled", h->GetName()) ; + TH1 * hout = dynamic_cast (h->Clone(name)) ; + + if(fSumw2) hout->Sumw2(); + hout->Scale(fScale) ; + fOutputList->Add(hout) ; + } + else fOutputList->Add(h) ; + } + } + // number of files + + //File scaled, needed for file merging on grid + fhCount->Fill(0); + + PostData(0, fOutputList); +} + + +//______________________________________________________________________________ +void AliAnaScale::Init() +{ + // Intialisation of parameters + if(fDebug > 0 )printf("No initialization in scale class \n") ; + +} + +//______________________________________________________________________________ +void AliAnaScale::Terminate(Option_t *) +{ + // Processing when the event loop is ended + + +} diff --git a/PWG4/PartCorr/AliAnaScale.h b/PWG4/PartCorr/AliAnaScale.h new file mode 100644 index 00000000000..584de70cd57 --- /dev/null +++ b/PWG4/PartCorr/AliAnaScale.h @@ -0,0 +1,53 @@ +#ifndef ALIANASCALE_H +#define ALIANASCALE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +//______________________________________________________________________________ +// An post event loop analysis task that scales the input histograms +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include "AliAnalysisTask.h" + +class TH1D ; +class TH1I ; +class TH1F ; + +class AliAnaScale : public AliAnalysisTask { + +public: + AliAnaScale() ; + AliAnaScale(const char *name) ; + virtual ~AliAnaScale() ; + + virtual void ConnectInputData(Option_t * = ""); + virtual void CreateOutputObjects(); + virtual void Init() ; + virtual void LocalInit() { Init() ; } + virtual void Exec(Option_t * opt = "") ; + void Set(const Double_t val) { fScale = val ; } + void SetDebugLevel(Int_t level) { fDebug = level ; } + virtual void Terminate(Option_t * opt = "") ; + + void MakeSumw2(Bool_t sum) {fSumw2 = sum;} + +private: + AliAnaScale(const AliAnaScale&); // Not implemented + AliAnaScale& operator=(const AliAnaScale&); // Not implemented + + + // input and output + Int_t fDebug ; // Debug flag + // task parameters + Float_t fScale ; // Scaling factor + + // Histograms + TList * fInputList ; //! input data list + TList * fOutputList ; //! output data list + Bool_t fSumw2; //compute sum of squares of weights for bin content error calculation + TH1F * fhCount; //! counter histogram for file merging + + ClassDef(AliAnaScale, 2); // a post event loop scaling +}; +#endif // ALIANASCALE_H diff --git a/PWG4/PartCorr/AliAnalysisTaskGammaConversion.cxx b/PWG4/PartCorr/AliAnalysisTaskGammaConversion.cxx new file mode 100644 index 00000000000..074cb7ff003 --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskGammaConversion.cxx @@ -0,0 +1,651 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * + * Version 1.0 * + * * + * 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. * + **************************************************************************/ + +// root +#include +#include +#include +#include +#include +#include + +// analysis +//#include "AliAnalysisTaskSE.h" +#include "AliAnalysisTaskGammaConversion.h" +#include "AliAnalysisManager.h" +#include "AliESDInputHandler.h" +#include "AliMCEventHandler.h" +#include "AliMCEvent.h" +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliAODHandler.h" +#include "AliStack.h" +#include "AliLog.h" +//#include "TLorentzVector.h" +#include "AliKFVertex.h" + +ClassImp(AliAnalysisTaskGammaConversion) + + +AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(): + AliAnalysisTaskSE(), + fV0Reader(NULL), + fStack(NULL), + fOutputContainer(NULL), + fHistograms(NULL), + fDoMCTruth(kFALSE), + fMCAllGammas(), + fMCPi0s(), + fMCEtas(), + fMCGammaChi_c(), + fKFReconstructedGammas(), + fElectronMass(-1), + fGammaMass(-1), + fPi0Mass(-1), + fEtaMass(-1), + fGammaWidth(-1), + fPi0Width(-1), + fEtaWidth(-1), + fCalculateBackground(kFALSE) +{ + // Default constructor + // Common I/O in slot 0 + DefineInput (0, TChain::Class()); + DefineOutput(0, TTree::Class()); + + // Your private output + DefineOutput(1, TList::Class()); +} + +AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name): + AliAnalysisTaskSE(name), + fV0Reader(NULL), + fStack(NULL), + fOutputContainer(0x0), + fHistograms(NULL), + fDoMCTruth(kFALSE), + fMCAllGammas(), + fMCPi0s(), + fMCEtas(), + fMCGammaChi_c(), + fKFReconstructedGammas(), + fElectronMass(-1), + fGammaMass(-1), + fPi0Mass(-1), + fEtaMass(-1), + fGammaWidth(-1), + fPi0Width(-1), + fEtaWidth(-1), + fCalculateBackground(kFALSE) +{ + // Common I/O in slot 0 + DefineInput (0, TChain::Class()); + DefineOutput(0, TTree::Class()); + + // Your private output + DefineOutput(1, TList::Class()); +} + +AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion() +{ + // Remove all pointers + + if(fOutputContainer){ + fOutputContainer->Clear() ; + delete fOutputContainer ; + } + if(fHistograms){ + delete fHistograms; + } + if(fV0Reader){ + delete fV0Reader; + } +} + + +void AliAnalysisTaskGammaConversion::Init() +{ + // Initialization +} + + +void AliAnalysisTaskGammaConversion::Exec(Option_t */*option*/) +{ + // Execute analysis for current event + // + + ConnectInputData(""); + + //clear vectors + fMCAllGammas.clear(); + fMCPi0s.clear(); + fMCEtas.clear(); + fMCGammaChi_c.clear(); + /* + for(UInt_t ikf=0;ikfUpdateEventByEventData(); + // Process the v0 information + if(fDoMCTruth){ + ProcessMCData(); + } + + // Process the v0 information + ProcessV0s(); + + if(fCalculateBackground){//calculate background if flag is set + CalculateBackground(); + } + + // Process reconstructed gammas + ProcessGammasForNeutralMesonAnalysis(); + + PostData(1, fOutputContainer); + +} + +void AliAnalysisTaskGammaConversion::ConnectInputData(Option_t */*option*/){ + + if(fV0Reader == NULL){ + // Write warning here cuts and so on are default if this ever happens + } + fV0Reader->Initialize(); +} + +void AliAnalysisTaskGammaConversion::ProcessMCData(){ + + fStack = fV0Reader->GetMCStack(); + + for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++) { + TParticle* particle = (TParticle *)fStack->Particle(iTracks); + + if (!particle) { + //print warning here + continue; + } + + if(particle->Pt()GetPtCut()){ + continue; + } + + if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut()){ + continue; + } + + if(particle->R()>fV0Reader->GetMaxRCut()){ // cuts on distance from collision point + continue; + } + + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + + + //process the gammas + if (particle->GetPdgCode()== 22){ + fMCAllGammas.push_back(particle); + if(particle->GetMother(0)>-1){ //Means we have a mother + if( fStack->Particle(particle->GetMother(0))->GetPdgCode() != 22 ){//Checks for a non gamma mother. + if(fHistograms->fMC_Gamma_Energy){fHistograms->fMC_Gamma_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_Gamma_Pt){fHistograms->fMC_Gamma_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_Gamma_Eta){fHistograms->fMC_Gamma_Eta->Fill(particle->Eta());} + + /* Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + }*/ + if(fHistograms->fMC_Gamma_Phi){fHistograms->fMC_Gamma_Phi->Fill(tmpPhi);} + + //adding the conversion points from all gammas with e+e- daughters + if(particle->GetNDaughters() == 2){ + TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter()); + TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter()); + + if(daughter0->R()>fV0Reader->GetMaxRCut() || daughter1->R()>fV0Reader->GetMaxRCut()){ + continue; + } + + if(daughter0->GetPdgCode() == -11 && daughter1->GetPdgCode() == 11 || + daughter0->GetPdgCode() == 11 && daughter1->GetPdgCode() == -11){ + + // begin Mapping + Int_t rBin = fHistograms->GetRBin(daughter0->R()); + Int_t phiBin = fHistograms->GetPhiBin(daughter0->Phi()); + + if(fHistograms->fMC_Mapping[phiBin][rBin] != NULL){fHistograms->fMC_Mapping[phiBin][rBin]->Fill(daughter0->Vz(), particle->Eta());} + if(fHistograms->fMC_Mapping_Phi[phiBin] != NULL){fHistograms->fMC_Mapping_Phi[phiBin]->Fill(daughter0->Vz(), particle->Eta());} + if(fHistograms->fMC_Mapping_R[rBin] != NULL){fHistograms->fMC_Mapping_R[rBin]->Fill(daughter0->Vz(), particle->Eta());} + //end mapping + + + if(fHistograms->fMC_EP_R){fHistograms->fMC_EP_R->Fill(daughter0->R());} + if(fHistograms->fMC_EP_Z_R){fHistograms->fMC_EP_Z_R->Fill(daughter0->Vz(),daughter0->R());} + if(fHistograms->fMC_EP_X_Y){fHistograms->fMC_EP_X_Y->Fill(daughter0->Vx(),daughter0->Vy());} + if(fHistograms->fMC_EP_OpeningAngle){fHistograms->fMC_EP_OpeningAngle->Fill(GetMCOpeningAngle(daughter0, daughter1));} + + } + } + } + if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chi_c0 + fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi_2S + fStack->Particle(particle->GetMother(0))->GetPdgCode()==445 //chi_c2 + ){ + fMCGammaChi_c.push_back(particle); + } + } + else{//means we have a primary particle + if(fHistograms->fMC_DirectGamma_Energy){fHistograms->fMC_DirectGamma_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_DirectGamma_Pt){fHistograms->fMC_DirectGamma_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_DirectGamma_Eta){fHistograms->fMC_DirectGamma_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_DirectGamma_Phi){fHistograms->fMC_DirectGamma_Phi->Fill(tmpPhi);} + + //adding the conversion points from all gammas with e+e- daughters + if(particle->GetNDaughters() == 2){ + TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter()); + TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter()); + if(daughter0->GetPdgCode() == -11 && daughter1->GetPdgCode() == 11 || + daughter0->GetPdgCode() == 11 && daughter1->GetPdgCode() == -11){ + + if(fHistograms->fMC_EP_R){fHistograms->fMC_EP_R->Fill(daughter0->R());} + if(fHistograms->fMC_EP_Z_R){fHistograms->fMC_EP_Z_R->Fill(daughter0->Vz(),daughter0->R());} + if(fHistograms->fMC_EP_X_Y){fHistograms->fMC_EP_X_Y->Fill(daughter0->Vx(),daughter0->Vy());} + if(fHistograms->fMC_EP_OpeningAngle){fHistograms->fMC_EP_OpeningAngle->Fill(GetMCOpeningAngle(daughter0,daughter1));} + + } + } + + } + } + else if (TMath::Abs(particle->GetPdgCode())== 11){ // Means we have an electron or a positron + if(particle->GetMother(0)>-1){ // means we have a mother + if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==22 ){ // Means we have a gamma mother + if(particle->GetPdgCode() == 11){//electron + if(fHistograms->fMC_E_Energy){fHistograms->fMC_E_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_E_Pt){fHistograms->fMC_E_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_E_Eta){fHistograms->fMC_E_Eta->Fill(particle->Eta());} + /* Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + }*/ + if(fHistograms->fMC_E_Phi){fHistograms->fMC_E_Phi->Fill(tmpPhi);} + } + if(particle->GetPdgCode() == -11){//positron + if(fHistograms->fMC_P_Energy){fHistograms->fMC_P_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_P_Pt){fHistograms->fMC_P_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_P_Eta){fHistograms->fMC_P_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_P_Phi){fHistograms->fMC_P_Phi->Fill(tmpPhi);} + } + } + } + } + else if(particle->GetNDaughters() == 2){ + + TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter()); + TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter()); + if(daughter0->GetPdgCode() == 22 && daughter1->GetPdgCode() == 22){//check for gamma gamma daughters + + if(particle->GetPdgCode()==111){//Pi0 + if( iTracks >= fStack->GetNprimary()){ + + if(fHistograms->fMC_Pi0Secondaries_Eta){fHistograms->fMC_Pi0Secondaries_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_Pi0Secondaries_Phi){fHistograms->fMC_Pi0Secondaries_Phi->Fill(tmpPhi);} + if(fHistograms->fMC_Pi0Secondaries_Pt){fHistograms->fMC_Pi0Secondaries_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_Pi0Secondaries_Energy){fHistograms->fMC_Pi0Secondaries_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_Pi0Secondaries_R){fHistograms->fMC_Pi0Secondaries_R->Fill(particle->R());} + if(fHistograms->fMC_Pi0Secondaries_Z_R){fHistograms->fMC_Pi0Secondaries_Z_R->Fill(particle->Vz(),particle->R());} + if(fHistograms->fMC_Pi0Secondaries_OpeningAngleGamma){fHistograms->fMC_Pi0Secondaries_OpeningAngleGamma->Fill(GetMCOpeningAngle(daughter0,daughter1));} + if(fHistograms->fMC_Pi0Secondaries_X_Y){fHistograms->fMC_Pi0Secondaries_X_Y->Fill(particle->Vx(),particle->Vy());}//only fill from one daughter to avoid multiple filling + } + else{ + if(fHistograms->fMC_Pi0_Eta){fHistograms->fMC_Pi0_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_Pi0_Phi){fHistograms->fMC_Pi0_Phi->Fill(tmpPhi);} + if(fHistograms->fMC_Pi0_Pt){fHistograms->fMC_Pi0_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_Pi0_Energy){fHistograms->fMC_Pi0_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_Pi0_R){fHistograms->fMC_Pi0_R->Fill(particle->R());} + if(fHistograms->fMC_Pi0_Z_R){fHistograms->fMC_Pi0_Z_R->Fill(particle->Vz(),particle->R());} + if(fHistograms->fMC_Pi0_OpeningAngleGamma){fHistograms->fMC_Pi0_OpeningAngleGamma->Fill(GetMCOpeningAngle(daughter0,daughter1));} + if(fHistograms->fMC_Pi0_X_Y){fHistograms->fMC_Pi0_X_Y->Fill(particle->Vx(),particle->Vy());}//only fill from one daughter to avoid multiple filling + } + } + else if(particle->GetPdgCode()==221){//Eta + if(fHistograms->fMC_Eta_Eta){fHistograms->fMC_Eta_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_Eta_Phi){fHistograms->fMC_Eta_Phi->Fill(tmpPhi);} + if(fHistograms->fMC_Eta_Pt){fHistograms->fMC_Eta_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_Eta_Energy){fHistograms->fMC_Eta_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_Eta_R){fHistograms->fMC_Eta_R->Fill(particle->R());} + if(fHistograms->fMC_Eta_Z_R){fHistograms->fMC_Eta_Z_R->Fill(particle->Vz(),particle->R());} + if(fHistograms->fMC_Eta_OpeningAngleGamma){fHistograms->fMC_Eta_OpeningAngleGamma->Fill(GetMCOpeningAngle(daughter0,daughter1));} + if(fHistograms->fMC_Eta_X_Y){fHistograms->fMC_Eta_X_Y->Fill(particle->Vx(),particle->Vy());}//only fill from one daughter to avoid multiple filling + } + + //the match data should be filled no matter which mother the gamma-gamma comes from + if(fHistograms->fMC_Match_Gamma_R){fHistograms->fMC_Match_Gamma_R->Fill(particle->R());} + if(fHistograms->fMC_Match_Gamma_Z_R){fHistograms->fMC_Match_Gamma_Z_R->Fill(particle->Vz(),particle->R());} + if(fHistograms->fMC_Match_Gamma_X_Y){fHistograms->fMC_Match_Gamma_X_Y->Fill(particle->Vx(),particle->Vy());} + if(fHistograms->fMC_Match_Gamma_Mass){fHistograms->fMC_Match_Gamma_Mass->Fill(particle->GetCalcMass());} + if(fHistograms->fMC_Match_Gamma_OpeningAngle){fHistograms->fMC_Match_Gamma_OpeningAngle->Fill(GetMCOpeningAngle(daughter0,daughter1));} + if(fHistograms->fMC_Match_Gamma_Energy){fHistograms->fMC_Match_Gamma_Energy->Fill(particle->Energy());} + if(fHistograms->fMC_Match_Gamma_Pt){fHistograms->fMC_Match_Gamma_Pt->Fill(particle->Pt());} + if(fHistograms->fMC_Match_Gamma_Eta){fHistograms->fMC_Match_Gamma_Eta->Fill(particle->Eta());} + /* + Double_t tmpPhi=particle->Phi(); + if(particle->Phi()> TMath::Pi()){ + tmpPhi = particle->Phi()-(2*TMath::Pi()); + } + */ + if(fHistograms->fMC_Match_Gamma_Phi){fHistograms->fMC_Match_Gamma_Phi->Fill(tmpPhi);} + } + } + } +} + +void AliAnalysisTaskGammaConversion::ProcessV0s(){ + Int_t nSurvivingV0s=0; + while(fV0Reader->NextV0()){ + nSurvivingV0s++; + //-------------------------- filling v0 information ------------------------------------- + if(fHistograms->fESD_EP_OpeningAngle){fHistograms->fESD_EP_OpeningAngle->Fill(fV0Reader->GetOpeningAngle());} + if(fHistograms->fESD_EP_R){fHistograms->fESD_EP_R->Fill(fV0Reader->GetXYRadius());} + if(fHistograms->fESD_EP_Z_R){fHistograms->fESD_EP_Z_R->Fill(fV0Reader->GetZ(),fV0Reader->GetXYRadius());} + if(fHistograms->fESD_EP_X_Y){fHistograms->fESD_EP_X_Y->Fill(fV0Reader->GetX(),fV0Reader->GetY());} + + + if(fHistograms->fESD_E_Energy){fHistograms->fESD_E_Energy->Fill(fV0Reader->GetNegativeTrackEnergy());} + if(fHistograms->fESD_E_Pt){fHistograms->fESD_E_Pt->Fill(fV0Reader->GetNegativeTrackPt());} + if(fHistograms->fESD_E_Eta){fHistograms->fESD_E_Eta->Fill(fV0Reader->GetNegativeTrackEta());} + if(fHistograms->fESD_E_Phi){fHistograms->fESD_E_Phi->Fill(fV0Reader->GetNegativeTrackPhi());} + + if(fHistograms->fESD_P_Energy){fHistograms->fESD_P_Energy->Fill(fV0Reader->GetPositiveTrackEnergy());} + if(fHistograms->fESD_P_Pt){fHistograms->fESD_P_Pt->Fill(fV0Reader->GetPositiveTrackPt());} + if(fHistograms->fESD_P_Eta){fHistograms->fESD_P_Eta->Fill(fV0Reader->GetPositiveTrackEta());} + if(fHistograms->fESD_P_Phi){fHistograms->fESD_P_Phi->Fill(fV0Reader->GetPositiveTrackPhi());} + + if(fHistograms->fESD_Gamma_Energy){fHistograms->fESD_Gamma_Energy->Fill(fV0Reader->GetMotherCandidateEnergy());} + if(fHistograms->fESD_Gamma_Pt){fHistograms->fESD_Gamma_Pt->Fill(fV0Reader->GetMotherCandidatePt());} + if(fHistograms->fESD_Gamma_Eta){fHistograms->fESD_Gamma_Eta->Fill(fV0Reader->GetMotherCandidateEta());} + if(fHistograms->fESD_Gamma_Phi){fHistograms->fESD_Gamma_Phi->Fill(fV0Reader->GetMotherCandidatePhi());} + + + // begin mapping + Int_t rBin = fHistograms->GetRBin(fV0Reader->GetXYRadius()); + Int_t phiBin = fHistograms->GetPhiBin(fV0Reader->GetNegativeTrackPhi()); + Double_t motherCandidateEta= fV0Reader->GetMotherCandidateEta(); + if(fHistograms->fESD_Mapping[phiBin][rBin] != NULL){fHistograms->fESD_Mapping[phiBin][rBin]->Fill(fV0Reader->GetZ(),motherCandidateEta);} + if(fHistograms->fESD_Mapping_Phi[phiBin] != NULL){fHistograms->fESD_Mapping_Phi[phiBin]->Fill(fV0Reader->GetZ(),motherCandidateEta);} + if(fHistograms->fESD_Mapping_R[rBin] != NULL){fHistograms->fESD_Mapping_R[rBin]->Fill(fV0Reader->GetZ(),motherCandidateEta);} + // end mapping + + + fKFReconstructedGammas.push_back(*fV0Reader->GetMotherCandidateKFCombination()); + + //----------------------------------- checking for "real" conversions (MC match) -------------------------------------- + if(fDoMCTruth){ + if(fV0Reader->HasSameMCMother() == kFALSE){ + continue; + } + + TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle(); + TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle(); + if(negativeMC->GetPdgCode()!=11 || positiveMC->GetPdgCode()!=-11){ + continue; + } + + if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){ + if(fHistograms->fESD_Match_Gamma_X_Y){fHistograms->fESD_Match_Gamma_X_Y->Fill(fV0Reader->GetX(),fV0Reader->GetY());} + if(fHistograms->fESD_Match_Gamma_OpeningAngle){fHistograms->fESD_Match_Gamma_OpeningAngle->Fill(fV0Reader->GetOpeningAngle());} + if(fHistograms->fESD_Match_Gamma_Pt){fHistograms->fESD_Match_Gamma_Pt->Fill(fV0Reader->GetMotherCandidatePt());} + if(fHistograms->fESD_Match_Gamma_Energy){fHistograms->fESD_Match_Gamma_Energy->Fill(fV0Reader->GetMotherCandidateEnergy());} + if(fHistograms->fESD_Match_Gamma_Eta){fHistograms->fESD_Match_Gamma_Eta->Fill(fV0Reader->GetMotherCandidateEta());} + + if(fHistograms->fESD_Match_Gamma_Phi){fHistograms->fESD_Match_Gamma_Phi->Fill(fV0Reader->GetMotherCandidatePhi());} + if(fHistograms->fESD_Match_Gamma_Mass){fHistograms->fESD_Match_Gamma_Mass->Fill(fV0Reader->GetMotherCandidateMass());} + if(fHistograms->fESD_Match_Gamma_Width){fHistograms->fESD_Match_Gamma_Width->Fill(fV0Reader->GetMotherCandidateWidth());} + if(fHistograms->fESD_Match_Gamma_Chi2){fHistograms->fESD_Match_Gamma_Chi2->Fill(fV0Reader->GetMotherCandidateChi2());} + if(fHistograms->fESD_Match_Gamma_NDF){fHistograms->fESD_Match_Gamma_NDF->Fill(fV0Reader->GetMotherCandidateNDF());} + if(fHistograms->fESD_Match_Gamma_R){fHistograms->fESD_Match_Gamma_R->Fill(fV0Reader->GetXYRadius());} + if(fHistograms->fESD_Match_Gamma_Z_R){fHistograms->fESD_Match_Gamma_Z_R->Fill(fV0Reader->GetZ(),fV0Reader->GetXYRadius());} + + //resolution + Double_t mc_pt = fV0Reader->GetMotherMCParticle()->Pt(); + Double_t esd_pt = fV0Reader->GetMotherCandidatePt(); + Double_t res_dPt = ((esd_pt - mc_pt)/mc_pt)*100; + if(fHistograms->fResolution_dPt != NULL){fHistograms->fResolution_dPt->Fill(mc_pt,res_dPt);} + if(fHistograms->fResolution_MC_Pt != NULL){fHistograms->fResolution_MC_Pt->Fill(mc_pt);} + if(fHistograms->fResolution_ESD_Pt != NULL){fHistograms->fResolution_ESD_Pt->Fill(esd_pt);} + + Double_t res_dZ = ((fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz())/fV0Reader->GetNegativeMCParticle()->Vz())*100; + if(fHistograms->fResolution_dZ != NULL){fHistograms->fResolution_dZ->Fill(fV0Reader->GetNegativeMCParticle()->Vz(),res_dZ);} + if(fHistograms->fResolution_MC_Z != NULL){fHistograms->fResolution_MC_Z->Fill(fV0Reader->GetNegativeMCParticle()->Vz());} + if(fHistograms->fResolution_ESD_Z != NULL){fHistograms->fResolution_ESD_Z->Fill(fV0Reader->GetZ());} + + Double_t res_dR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100; + if(fHistograms->fResolution_dR != NULL){fHistograms->fResolution_dR->Fill(fV0Reader->GetNegativeMCParticle()->R(),res_dR);} + if(fHistograms->fResolution_MC_R != NULL){fHistograms->fResolution_MC_R->Fill(fV0Reader->GetNegativeMCParticle()->R());} + if(fHistograms->fResolution_ESD_R != NULL){fHistograms->fResolution_ESD_R->Fill(fV0Reader->GetXYRadius());} + if(fHistograms->fResolution_dR_dPt != NULL){fHistograms->fResolution_dR_dPt->Fill(res_dR,res_dPt);} + } + } + } + if(fHistograms->fNumberOfSurvivingV0s != NULL){fHistograms->fNumberOfSurvivingV0s->Fill(nSurvivingV0s);} + if(fHistograms->fNumberOfV0s != NULL){fHistograms->fNumberOfV0s->Fill(fV0Reader->GetNumberOfV0s());} +} + +void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){ + + for(UInt_t firstGammaIndex=0;firstGammaIndexSetMassConstraint(fPi0Mass,fPi0Width); + + Double_t massPi0 =0.; + Double_t widthPi0 = 0.; + Double_t chi2Pi0 =10000.; + pi0Candidate->GetMass(massPi0,widthPi0); + if(pi0Candidate->GetNDF()>0){ + chi2Pi0 = pi0Candidate->GetChi2()/pi0Candidate->GetNDF(); + // if(chi2Pi0>0 && chi2Pi00 && chi2Pi0<10000){//TODO find this out see line above + + /* + TVector3 vertexDaughter0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz()); + TVector3 vertexDaughter1(twoGammaDecayCandidateDaughter1->Px(),twoGammaDecayCandidateDaughter1->Py(),twoGammaDecayCandidateDaughter1->Pz()); + TVector3 vertexPi0Candidate(pi0Candidate->Px(),pi0Candidate->Py(),pi0Candidate->Pz()); + + Double_t openingAnglePi0 = vertexDaughter0.Angle(vertexDaughter1); + + Double_t radiusPi0 = sqrt( vertexPi0Candidate.x()*vertexPi0Candidate.x() + vertexPi0Candidate.y()*vertexPi0Candidate.y() ); + */ + + TVector3 vectorPi0Candidate(pi0Candidate->Px(),pi0Candidate->Py(),pi0Candidate->Pz()); + + Double_t openingAnglePi0 = twoGammaDecayCandidateDaughter0->GetAngle(*twoGammaDecayCandidateDaughter1); + + //Double_t vtx000[3] = {0,0,0}; + // NOT SURE IF THIS DOES WHAT WE WANT: remember to ask Sergey Double_t radiusPi0 = pi0Candidate->GetDistanceFromVertex(vtx000); + //Calculating by hand the radius + Double_t tmpX= pi0Candidate->GetX(); + Double_t tmpY= pi0Candidate->GetY(); + + Double_t radiusPi0 = TMath::Sqrt(tmpX*tmpX + tmpY*tmpY); + + if(fHistograms->fESD_Pi0_OpeningAngleGamma){fHistograms->fESD_Pi0_OpeningAngleGamma->Fill(openingAnglePi0);} + if(fHistograms->fESD_Pi0_Energy){fHistograms->fESD_Pi0_Energy->Fill(pi0Candidate->GetE());} + if(fHistograms->fESD_Pi0_Pt){fHistograms->fESD_Pi0_Pt->Fill(sqrt(pi0Candidate->GetPx()*pi0Candidate->GetPx()+pi0Candidate->GetPy()*pi0Candidate->GetPy()));} + if(fHistograms->fESD_Pi0_Eta){fHistograms->fESD_Pi0_Eta->Fill(vectorPi0Candidate.Eta());} + if(fHistograms->fESD_Pi0_Phi){fHistograms->fESD_Pi0_Phi->Fill(vectorPi0Candidate.Phi());} + if(fHistograms->fESD_Pi0_Mass){fHistograms->fESD_Pi0_Mass->Fill(massPi0);} + if(fHistograms->fESD_Pi0_R){fHistograms->fESD_Pi0_R->Fill(radiusPi0);} + if(fHistograms->fESD_Pi0_Z_R){fHistograms->fESD_Pi0_Z_R->Fill(tmpY,radiusPi0);} + if(fHistograms->fESD_Pi0_X_Y){fHistograms->fESD_Pi0_X_Y->Fill(tmpX,tmpY);} + } + } + delete pi0Candidate; + + //Eta's + AliKFParticle *etaCandidate = new AliKFParticle(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1); + + // etaCandidate->SetMassConstraint(fEtaMass,fEtaWidth); + Double_t massEta =0.; + Double_t widthEta = 0.; + Double_t chi2Eta =10000.; + etaCandidate->GetMass(massEta,widthEta); + if(etaCandidate->GetNDF()>0){ + chi2Eta = etaCandidate->GetChi2()/etaCandidate->GetNDF(); + // if(chi2Eta>0 && chi2Eta0 && chi2Eta<100000){// TODO find this out se line above + /* + TVector3 vertexDaughter0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz()); + TVector3 vertexDaughter1(twoGammaDecayCandidateDaughter1->Px(),twoGammaDecayCandidateDaughter1->Py(),twoGammaDecayCandidateDaughter1->Pz()); + TVector3 vertexEtaCandidate(etaCandidate->Px(),etaCandidate->Py(),etaCandidate->Pz()); + Double_t openingAngleEta = vertexDaughter0.Angle(vertexDaughter1); + + Double_t radiusEta = sqrt( etaCandidate->GetX()*etaCandidate->GetX() + vertexEtaCandidate.y()*vertexEtaCandidate.y() ); + */ + + //Calculating by hand the radius + Double_t tmpX= etaCandidate->GetX(); + Double_t tmpY= etaCandidate->GetY(); + + Double_t radiusEta = TMath::Sqrt(tmpX*tmpX + tmpY*tmpY); + + Double_t openingAngleEta = twoGammaDecayCandidateDaughter0->GetAngle(*twoGammaDecayCandidateDaughter1); + + TVector3 vectorEtaCandidate(etaCandidate->Px(),etaCandidate->Py(),etaCandidate->Pz()); + + if(fHistograms->fESD_Eta_OpeningAngleGamma){fHistograms->fESD_Eta_OpeningAngleGamma->Fill(openingAngleEta);} + if(fHistograms->fESD_Eta_Energy){fHistograms->fESD_Eta_Energy->Fill(etaCandidate->GetE());} + if(fHistograms->fESD_Eta_Pt){fHistograms->fESD_Eta_Pt->Fill(sqrt(etaCandidate->GetPx()*etaCandidate->GetPx()+etaCandidate->GetPy()*etaCandidate->GetPy()));} + if(fHistograms->fESD_Eta_Eta){fHistograms->fESD_Eta_Eta->Fill(vectorEtaCandidate.Eta());} + if(fHistograms->fESD_Eta_Phi){fHistograms->fESD_Eta_Phi->Fill(vectorEtaCandidate.Phi());} + if(fHistograms->fESD_Eta_Mass){fHistograms->fESD_Eta_Mass->Fill(massEta);} + if(fHistograms->fESD_Eta_R){fHistograms->fESD_Eta_R->Fill(radiusEta);} + if(fHistograms->fESD_Eta_Z_R){fHistograms->fESD_Eta_Z_R->Fill(etaCandidate->GetZ(),radiusEta);} + if(fHistograms->fESD_Eta_X_Y){fHistograms->fESD_Eta_X_Y->Fill(tmpX,tmpY);} + } + } + delete etaCandidate; + } + } + +} + +void AliAnalysisTaskGammaConversion::CalculateBackground(){ + + for(UInt_t iCurrent=0;iCurrentfCurrentEventGoodV0s.size();iCurrent++){ + AliKFParticle * currentEventGoodV0 = &fV0Reader->fCurrentEventGoodV0s.at(iCurrent); + for(UInt_t iPrevious=0;iPreviousfCurrentEventGoodV0s.size();iPrevious++){ + AliKFParticle * previousEventGoodV0 = &fV0Reader->fPreviousEventGoodV0s.at(iPrevious); + + AliKFParticle *backgroundCandidate = new AliKFParticle(*currentEventGoodV0,*previousEventGoodV0); + + Double_t massBG =0.; + Double_t widthBG = 0.; + Double_t chi2BG =10000.; + backgroundCandidate->GetMass(massBG,widthBG); + if(backgroundCandidate->GetNDF()>0){ + chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF(); + // if(chi2Pi0>0 && chi2Pi00 && chi2BGGetChi2Cut()){//TODO find this out see line above + + TVector3 vectorBGCandidate(backgroundCandidate->Px(),backgroundCandidate->Py(),backgroundCandidate->Pz()); + + Double_t openingAngleBG = currentEventGoodV0->GetAngle(*previousEventGoodV0); + + //Calculating by hand the radius (find a better way) + Double_t tmpX= backgroundCandidate->GetX(); + Double_t tmpY= backgroundCandidate->GetY(); + + Double_t radiusBG = TMath::Sqrt(tmpX*tmpX + tmpY*tmpY); + + if(fHistograms->fESD_Background_OpeningAngleGamma){fHistograms->fESD_Background_OpeningAngleGamma->Fill(openingAngleBG);} + if(fHistograms->fESD_Background_Energy){fHistograms->fESD_Background_Energy->Fill(backgroundCandidate->GetE());} + if(fHistograms->fESD_Background_Pt){fHistograms->fESD_Background_Pt->Fill(sqrt(backgroundCandidate->GetPx()*backgroundCandidate->GetPx()+backgroundCandidate->GetPy()*backgroundCandidate->GetPy()));} + if(fHistograms->fESD_Background_Eta){fHistograms->fESD_Background_Eta->Fill(vectorBGCandidate.Eta());} + if(fHistograms->fESD_Background_Phi){fHistograms->fESD_Background_Phi->Fill(vectorBGCandidate.Phi());} + if(fHistograms->fESD_Background_Mass){fHistograms->fESD_Background_Mass->Fill(massBG);} + if(fHistograms->fESD_Background_R){fHistograms->fESD_Background_R->Fill(radiusBG);} + if(fHistograms->fESD_Background_Z_R){fHistograms->fESD_Background_Z_R->Fill(tmpY,radiusBG);} + if(fHistograms->fESD_Background_X_Y){fHistograms->fESD_Background_X_Y->Fill(tmpX,tmpY);} + } + } + delete backgroundCandidate; + } + } +} + +void AliAnalysisTaskGammaConversion::Terminate(Option_t */*option*/) +{ + // Terminate analysis + // + AliDebug(1,"Do nothing in Terminate"); +} + +void AliAnalysisTaskGammaConversion::UserCreateOutputObjects() +{ + // Create the output container + + fOutputContainer = fHistograms->GetOutputContainer(); + fOutputContainer->SetName(GetName()) ; +} + +Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(TParticle* daughter0,TParticle* daughter1){ + //helper function + TVector3 V3D0(daughter0->Px(),daughter0->Py(),daughter0->Pz()); + TVector3 V3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz()); + return V3D0.Angle(V3D1); +} + diff --git a/PWG4/PartCorr/AliAnalysisTaskGammaConversion.h b/PWG4/PartCorr/AliAnalysisTaskGammaConversion.h new file mode 100644 index 00000000000..6f1e3aec985 --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskGammaConversion.h @@ -0,0 +1,93 @@ +#ifndef ALIANALYSISTASKGAMMACONVERSION_H +#define ALIANALYSISTASKGAMMACONVERSION_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliAnalysisTaskSE.h" +#include "AliV0Reader.h" +//#include "TH2F.h" +//#include "TH1F.h" +#include "AliGammaConversionHistograms.h" +#include "AliESDv0.h" +#include +//#include "TLorentzVector.h" +#include "AliKFParticle.h" + +//class AliAnaGamma; +class AliESDInputHandler; +class AliESDEvent; +class AliAODEvent; +class TList; +class AliStack; + +class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE +{ + public: + AliAnalysisTaskGammaConversion(); + AliAnalysisTaskGammaConversion(const char* name); + virtual ~AliAnalysisTaskGammaConversion() ;// virtual destructor + + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() {Init();} + virtual void Exec(Option_t *option); + virtual void Terminate(Option_t *option); + virtual void ConnectInputData(Option_t *); + + void ProcessMCData(); + void ProcessV0s(); + void ProcessGammasForNeutralMesonAnalysis(); + void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;} + void SetDoMCTruth(Bool_t flag){fDoMCTruth=flag;} + void SetElectronMass(Double_t electronMass){fElectronMass = electronMass;} + void SetGammaMass(Double_t gammaMass){fGammaMass = gammaMass;} + void SetGammaWidth(Double_t gammaWidth){fGammaWidth = gammaWidth;} + void SetPi0Mass(Double_t pi0Mass){fPi0Mass = pi0Mass;} + void SetPi0Width(Double_t pi0Width){fPi0Width = pi0Width;} + void SetEtaMass(Double_t etaMass){fEtaMass = etaMass;} + void SetEtaWidth(Double_t etaWidth){fEtaWidth = etaWidth;} + void SetV0Reader(AliV0Reader* reader){fV0Reader=reader;} + void SetCalculateBackground(Bool_t bg){fCalculateBackground=bg;} + void CalculateBackground(); + Double_t GetMCOpeningAngle(TParticle* daughter0,TParticle* daughter1); + + private: + AliAnalysisTaskGammaConversion(const AliAnalysisTaskGammaConversion&); // Not implemented + AliAnalysisTaskGammaConversion& operator=(const AliAnalysisTaskGammaConversion&); // Not implemented + + AliV0Reader* fV0Reader; + + AliStack * fStack; + + TList * fOutputContainer ; // Histogram container + + AliGammaConversionHistograms *fHistograms; + + Bool_t fDoMCTruth; + + vector fMCAllGammas; + vector fMCPi0s; + vector fMCEtas; + vector fMCGammaChi_c; + + vector fKFReconstructedGammas; + + //mass defines + Double_t fElectronMass; + Double_t fGammaMass; + Double_t fPi0Mass; + Double_t fEtaMass; + + // width defines + Double_t fGammaWidth; + Double_t fPi0Width; + Double_t fEtaWidth; + Bool_t fCalculateBackground; + + + ClassDef(AliAnalysisTaskGammaConversion, 0); // Analysis task for gamma conversions +}; + +#endif //ALIANALYSISTASKGAMMA_H diff --git a/PWG4/PartCorr/AliAnalysisTaskPHOSExample.cxx b/PWG4/PartCorr/AliAnalysisTaskPHOSExample.cxx new file mode 100644 index 00000000000..f44fb1cad0b --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskPHOSExample.cxx @@ -0,0 +1,314 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* $Id: */ + +//_________________________________________________________________________ +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// Adapted for AliAnalysisTaskSE and AOD production +// by Gustavo Conesa +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + +#include "AliAnalysisTaskPHOSExample.h" +#include "AliAnalysisManager.h" +#include "AliESDEvent.h" +#include "AliESDCaloCluster.h" +#include "AliAODEvent.h" +#include "AliAODPhoton.h" +#include "AliLog.h" +#include "AliESDVertex.h" + +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample() : + fDebug(0), + fAODPhotons(0x0), + fPhotonsInPhos(0), + fPhotonId(1.0), + fOutputList(0x0), + fhPHOSPos(0), + fhPHOS(0), + fhPHOSEnergy(0), + fhPHOSDigits(0), + fhPHOSRecParticles(0), + fhPHOSPhotons(0), + fhPHOSInvariantMass(0), + fhPHOSDigitsEvent(0) +{ + //Default constructor +} +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample(const char *name) : + AliAnalysisTaskSE(name), + fDebug(0), + fAODPhotons(0x0), + fPhotonsInPhos(0), + fPhotonId(1.0), + fOutputList(0x0), + fhPHOSPos(0), + fhPHOS(0), + fhPHOSEnergy(0), + fhPHOSDigits(0), + fhPHOSRecParticles(0), + fhPHOSPhotons(0), + fhPHOSInvariantMass(0), + fhPHOSDigitsEvent(0) +{ + // Constructor. + + // Output slots + DefineOutput(1, TList::Class()) ; +} + +//____________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample(const AliAnalysisTaskPHOSExample& ap) : + AliAnalysisTaskSE(ap.GetName()), + fDebug(ap.fDebug), + fAODPhotons(ap.fAODPhotons), + fPhotonsInPhos(ap.fPhotonsInPhos), + fPhotonId(ap.fPhotonId), + fOutputList(ap.fOutputList), + fhPHOSPos(ap.fhPHOSPos), + fhPHOS(ap.fhPHOS), + fhPHOSEnergy(ap.fhPHOSEnergy), + fhPHOSDigits(ap.fhPHOSDigits), + fhPHOSRecParticles(ap.fhPHOSRecParticles), + fhPHOSPhotons(ap.fhPHOSPhotons), + fhPHOSInvariantMass(ap.fhPHOSInvariantMass), + fhPHOSDigitsEvent(ap.fhPHOSDigitsEvent) +{ + // cpy ctor +} + +//_____________________________________________________________________________ +AliAnalysisTaskPHOSExample& AliAnalysisTaskPHOSExample::operator = (const AliAnalysisTaskPHOSExample& ap) +{ +// assignment operator + + this->~AliAnalysisTaskPHOSExample(); + new(this) AliAnalysisTaskPHOSExample(ap); + return *this; +} + +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::~AliAnalysisTaskPHOSExample() +{ + // dtor + if(fOutputList) { + fOutputList->Clear() ; + delete fOutputList ; + } +} + + +//________________________________________________________________________ +void AliAnalysisTaskPHOSExample::UserCreateOutputObjects() +{ + // Create the outputs containers + //AODs + fAODPhotons = new TClonesArray("AliAODPhoton", 0); + fAODPhotons->SetName("Photons"); + AddAODBranch("TClonesArray", &fAODPhotons); + + OpenFile(1) ; + + fhPHOSPos = new TNtuple("PHOSPos" , "Position in PHOS" , "x:y:z"); + fhPHOS = new TNtuple("PHOS" , "PHOS" , "event:digits:clusters:photons"); + fhPHOSEnergy = new TH1D("PHOSEnergy" , "PHOSEnergy" , 100, 0., 100. ) ; + fhPHOSDigits = new TH1I("PHOSDigitsCluster" , "PHOSDigits" , 20 , 0 , 20 ) ; + fhPHOSRecParticles = new TH1D("PHOSRecParticles" , "PHOSRecParticles" , 20 , 0., 20. ) ; + fhPHOSPhotons = new TH1I("PHOSPhotons" , "PHOSPhotons" , 20 , 0 , 20 ) ; + fhPHOSInvariantMass = new TH1D("PHOSInvariantMass" , "PHOSInvariantMass" , 400, 0., 400.) ; + fhPHOSDigitsEvent = new TH1I("PHOSDigitsEvent" , "PHOSDigitsEvent" , 30 , 0 , 30 ) ; + + // create output container + + fOutputList = new TList() ; + fOutputList->SetName(GetName()) ; + + fOutputList->AddAt(fhPHOSPos, 0) ; + fOutputList->AddAt(fhPHOS, 1) ; + fOutputList->AddAt(fhPHOSEnergy, 2) ; + fOutputList->AddAt(fhPHOSDigits, 3) ; + fOutputList->AddAt(fhPHOSRecParticles, 4) ; + fOutputList->AddAt(fhPHOSPhotons, 5) ; + fOutputList->AddAt(fhPHOSInvariantMass, 6) ; + fOutputList->AddAt(fhPHOSDigitsEvent, 7) ; + + +} + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::UserExec(Option_t *) +{ + // Processing of one event + + // if ( !((Entry()-1)%100) ) + AliInfo(Form(" Processing event # %lld", Entry())) ; + AliESDEvent* esd = (AliESDEvent*)InputEvent(); + + //************************ PHOS ************************************* + TRefArray * caloClustersArr = new TRefArray(); + esd->GetPHOSClusters(caloClustersArr); + + const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ; + + TVector3 ** phosVector = new TVector3*[kNumberOfPhosClusters] ; + Float_t * phosPhotonsEnergy = new Float_t[kNumberOfPhosClusters] ; + Int_t phosCluster ; + Int_t numberOfDigitsInPhos = 0 ; + Double_t v[3] ; //vertex ; + esd->GetVertex()->GetXYZ(v) ; + + fPhotonsInPhos = 0 ; + // loop over the PHOS Cluster + for(phosCluster = 0 ; phosCluster < kNumberOfPhosClusters ; phosCluster++) { + AliESDCaloCluster * caloCluster = (AliESDCaloCluster *) caloClustersArr->At(phosCluster) ; + + //AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ; + if (caloCluster) { + Float_t pos[3] ; + caloCluster->GetPosition( pos ) ; + fhPHOSEnergy->Fill( caloCluster->E() ) ; + fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ; + fhPHOSDigits->Fill(Entry(), caloCluster->GetNCells() ) ; + numberOfDigitsInPhos += caloCluster->GetNCells() ; + Double_t * pid = caloCluster->GetPid() ; + if(pid[AliPID::kPhoton] > GetPhotonId() ) { + phosVector[fPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ; + phosPhotonsEnergy[fPhotonsInPhos]=caloCluster->E() ; + TLorentzVector momentum ; + caloCluster->GetMomentum(momentum, v); + new ((*fAODPhotons)[fPhotonsInPhos++]) AliAODPhoton (momentum); + } + } + } //PHOS clusters + + fhPHOSRecParticles->Fill(kNumberOfPhosClusters); + fhPHOSPhotons->Fill(fPhotonsInPhos); + fhPHOSDigitsEvent->Fill(numberOfDigitsInPhos); + fhPHOS->Fill(Entry(), numberOfDigitsInPhos, kNumberOfPhosClusters, fPhotonsInPhos) ; + + // invariant Mass + if (fPhotonsInPhos > 1 ) { + Int_t phosPhoton1, phosPhoton2 ; + for(phosPhoton1 = 0 ; phosPhoton1 < fPhotonsInPhos ; phosPhoton1++) { + for(phosPhoton2 = phosPhoton1 + 1 ; phosPhoton2 < fPhotonsInPhos ; phosPhoton2++) { + Float_t tempMass = TMath::Sqrt( 2 * phosPhotonsEnergy[phosPhoton1] * phosPhotonsEnergy[phosPhoton2] * + ( 1 - TMath::Cos(phosVector[phosPhoton1]->Angle(*phosVector[phosPhoton2])) ) + ); + fhPHOSInvariantMass->Fill(tempMass*1000.); + } + } + } + + PostData(1, fOutputList); + + delete [] phosVector ; + delete [] phosPhotonsEnergy ; + +} + + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::Init() +{ + // Intialisation of parameters + AliInfo("Doing initialisation") ; + SetPhotonId(0.9) ; +} + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::Terminate(Option_t *) +{ + // Processing when the event loop is ended + + Bool_t problem = kFALSE ; + AliInfo(Form(" *** %s Report:", GetName())) ; + printf(" PHOSEnergy Mean : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(), fhPHOSEnergy->GetRMS() ) ; + printf(" PHOSDigits Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(), fhPHOSDigits->GetRMS() ) ; + printf(" PHOSRecParticles Mean : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(), fhPHOSRecParticles->GetRMS() ) ; + printf(" PHOSPhotons Mean : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(), fhPHOSPhotons->GetRMS() ) ; + printf(" PHOSInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(), fhPHOSInvariantMass->GetRMS() ) ; + printf(" PHOSDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(), fhPHOSDigitsEvent->GetRMS() ) ; + + TCanvas * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ; + cPHOS->Divide(3, 2); + + cPHOS->cd(1) ; + if ( fhPHOSEnergy->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSEnergy->SetAxisRange(0, 25.); + fhPHOSEnergy->SetLineColor(2); + fhPHOSEnergy->Draw(); + + cPHOS->cd(2) ; + fhPHOSDigits->SetAxisRange(0,25.); + fhPHOSDigits->SetLineColor(2); + fhPHOSDigits->Draw(); + + cPHOS->cd(3) ; + if ( fhPHOSRecParticles->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSRecParticles->SetAxisRange(0, 25.); + fhPHOSRecParticles->SetLineColor(2); + fhPHOSRecParticles->Draw(); + + cPHOS->cd(4) ; + if ( fhPHOSPhotons->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSPhotons->SetAxisRange(0,25.); + fhPHOSPhotons->SetLineColor(2); + fhPHOSPhotons->Draw(); + + cPHOS->cd(5) ; + fhPHOSInvariantMass->SetLineColor(2); + fhPHOSInvariantMass->Draw(); + + cPHOS->cd(6) ; + if ( fhPHOSDigitsEvent->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSDigitsEvent->SetAxisRange(0,40.); + fhPHOSDigitsEvent->SetLineColor(2); + fhPHOSDigitsEvent->Draw(); + + cPHOS->Print("PHOS.eps"); + + char line[1024] ; + sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + gROOT->ProcessLine(line); + sprintf(line, ".!rm -fR *.eps"); + gROOT->ProcessLine(line); + + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; + + char * report ; + if(problem) + report="Problems found, please check!!!"; + else + report="OK"; + + AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; +} diff --git a/PWG4/PartCorr/AliAnalysisTaskPHOSExample.h b/PWG4/PartCorr/AliAnalysisTaskPHOSExample.h new file mode 100644 index 00000000000..25ed2f06700 --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskPHOSExample.h @@ -0,0 +1,62 @@ +#ifndef ALIANALYSISTASKPHOSEXAMPLE_H +#define ALIANALYSISTASKPHOSEXAMPLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +//______________________________________________________________________________ +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// Adapted for AliAnalysisTaskSE and AOD production +// by Gustavo Conesa +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include +#include "AliAnalysisTaskSE.h" + +class AliESDEvent ; +class AliAODEvent ; +class TNtuple ; +class TH1D ; +class TH1I ; + +class AliAnalysisTaskPHOSExample : public AliAnalysisTaskSE { + +public: + AliAnalysisTaskPHOSExample() ; + AliAnalysisTaskPHOSExample(const char *name) ; + AliAnalysisTaskPHOSExample(const AliAnalysisTaskPHOSExample& ap) ; + AliAnalysisTaskPHOSExample& operator = (const AliAnalysisTaskPHOSExample& ap) ; + virtual ~AliAnalysisTaskPHOSExample() ; + + virtual void UserCreateOutputObjects(); + virtual void Init() ; + virtual void LocalInit() { Init() ; } + virtual void UserExec(Option_t * opt = "") ; + const Float_t GetPhotonId() const { return fPhotonId ; } + void SetDebugLevel(Int_t level) { fDebug = level ; } + void SetPhotonId(Float_t threshold) { fPhotonId = threshold ; } + virtual void Terminate(Option_t * opt = "") ; + +private: + // input and output + Int_t fDebug ; // Debug flag + TClonesArray * fAODPhotons ; //! reconstructed photons + Int_t fPhotonsInPhos ; //! number of photons found + // task parameters + Float_t fPhotonId ; // threshold for photon identification + + // Histograms + TList * fOutputList ; //! output data list + TNtuple * fhPHOSPos ; //! PHOS (x,y) + TNtuple * fhPHOS ; //! all PHOS parameters + TH1D * fhPHOSEnergy ; //! PHOS energy + TH1I * fhPHOSDigits ; //! PHOS numer of SDigits + TH1D * fhPHOSRecParticles ;//! PHOS number of RecParticles + TH1I * fhPHOSPhotons ; //! PHOS number of photons + TH1D * fhPHOSInvariantMass ; //! PHOS invariant mass + TH1I * fhPHOSDigitsEvent ; //! PHOS numbet of Sdigits per event + + ClassDef(AliAnalysisTaskPHOSExample, 1); // a PHOS photon analysis task +}; +#endif // ALIANALYSISTASKPHOSEXAMPLE_H diff --git a/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.cxx b/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.cxx new file mode 100644 index 00000000000..4703e3a5488 --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.cxx @@ -0,0 +1,155 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +// root +#include +#include +#include +#include +#include +#include + +// analysis +#include "AliAnalysisTaskParticleCorrelation.h" +#include "AliAnalysisManager.h" +#include "AliESDInputHandler.h" +#include "AliMCEventHandler.h" +#include "AliMCEvent.h" +#include "AliAnaPartCorrMaker.h" +#include "AliCaloTrackReader.h" +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliAODHandler.h" +#include "AliStack.h" +#include "AliLog.h" + +ClassImp(AliAnalysisTaskParticleCorrelation) + +//////////////////////////////////////////////////////////////////////// + + AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): + AliAnalysisTaskSE(), + fAna(0x0), + fOutputContainer(0x0), + fAODBranch(0x0), + fConfigName(0) +{ + // Default constructor +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): + AliAnalysisTaskSE(name), + fAna(0x0), + fOutputContainer(0x0), + fAODBranch(0x0), + fConfigName("ConfigAnalysis") +{ + // Default constructor + + DefineOutput(1, TList::Class()); + +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() +{ + // Remove all pointers + + if(fOutputContainer){ + fOutputContainer->Clear() ; + delete fOutputContainer ; + } + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() +{ + // Create the output container + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::CreateOutputData() \n"); + + //AODs + fAODBranch = new TClonesArray("AliAODParticleCorrelation", 0); + fAODBranch->SetName(fAna->GetAODBranchName()); + AddAODBranch("TClonesArray", &fAODBranch); + fAna->SetAODBranch(fAODBranch); + + //Histograms container + OpenFile(1); + fOutputContainer = fAna->GetOutputContainer(); + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::Init() +{ + // Initialization + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Init() \n"); + + // Call configuration file + + if(fConfigName == ""){ + fConfigName="ConfigAnalysis"; + } + + AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); + gROOT->LoadMacro(fConfigName+".C"); + fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); + + if(!fAna) + AliFatal("Analysis pointer not initialized, abort analysis!"); + + // Initialise analysis + fAna->Init(); + + AliDebug(1,"End"); + +} + + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) +{ + // Execute analysis for current event + // + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Exec() \n"); + + //Get the type of data, check if type is correct + Int_t datatype = fAna->GetReader()->GetDataType(); + if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && + datatype != AliCaloTrackReader::kMC){ + AliFatal("Wrong type of data"); + return ; + } + + fAna->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent()); + + //Process event + fAna->ProcessEvent((Int_t) Entry()); + + PostData(1, fOutputContainer); + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) +{ + // Terminate analysis + // + AliDebug(1,"Do nothing in Terminate"); + //fAna->Terminate(); +} + diff --git a/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.h b/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.h new file mode 100644 index 00000000000..3b8b992807f --- /dev/null +++ b/PWG4/PartCorr/AliAnalysisTaskParticleCorrelation.h @@ -0,0 +1,42 @@ +#ifndef AliAnalysisTaskParticleCorrelation_H +#define AliAnalysisTaskParticleCorrelation_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliAnalysisTaskSE.h" +class AliAnaPartCorrMaker; +class AliESDEvent; +class AliAODEvent; +class TList; + +class AliAnalysisTaskParticleCorrelation : public AliAnalysisTaskSE +{ + public: + AliAnalysisTaskParticleCorrelation(); + AliAnalysisTaskParticleCorrelation(const char* name); + virtual ~AliAnalysisTaskParticleCorrelation() ;// virtual dtor + + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() {Init();} + virtual void UserExec(Option_t *option); + virtual void Terminate(Option_t *option); + + void SetConfigFileName(TString name ) {fConfigName = name ; } + TString GetConfigFileName() const {return fConfigName ; } + + private: + AliAnalysisTaskParticleCorrelation(const AliAnalysisTaskParticleCorrelation&); // Not implemented + AliAnalysisTaskParticleCorrelation& operator=(const AliAnalysisTaskParticleCorrelation&); // Not implemented + + AliAnaPartCorrMaker* fAna; // Pointer to the jet finder + TList * fOutputContainer ; //! Histogram container + TClonesArray * fAODBranch; //! AOD branch + TString fConfigName ; //Configuration file name + + ClassDef(AliAnalysisTaskParticleCorrelation, 1); // Analysis task for standard gamma correlation analysis +}; + +#endif //AliAnalysisTaskParticleCorrelation_H diff --git a/PWG4/PartCorr/AliCaloPID.cxx b/PWG4/PartCorr/AliCaloPID.cxx new file mode 100644 index 00000000000..6f32f23a4a0 --- /dev/null +++ b/PWG4/PartCorr/AliCaloPID.cxx @@ -0,0 +1,257 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: AliCaloPID.cxx 21839 2007-10-29 13:49:42Z gustavo $ */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliCaloPID.h" +#include "AliAODCluster.h" + +ClassImp(AliCaloPID) + + +//________________________________________________ +AliCaloPID::AliCaloPID() : + TObject(), fEMCALPhotonWeight(0.), fEMCALPi0Weight(0.), + fEMCALElectronWeight(0.), fEMCALChargeWeight(0.), + fEMCALNeutralWeight(0.), + fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.), + fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , + fPHOSNeutralWeight(0.), fPHOSWeightFormula(0), + fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0) +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliCaloPID::AliCaloPID(const AliCaloPID & pid) : + TObject(pid), fEMCALPhotonWeight(pid.fEMCALPhotonWeight), + fEMCALPi0Weight(pid.fEMCALPi0Weight), + fEMCALElectronWeight(pid.fEMCALElectronWeight), + fEMCALChargeWeight(pid.fEMCALChargeWeight), + fEMCALNeutralWeight(pid.fEMCALNeutralWeight), + fPHOSPhotonWeight(pid.fPHOSPhotonWeight), + fPHOSPi0Weight(pid.fPHOSPi0Weight), + fPHOSElectronWeight(pid.fPHOSElectronWeight), + fPHOSChargeWeight(pid.fPHOSChargeWeight), + fPHOSNeutralWeight(pid.fPHOSNeutralWeight), + fPHOSWeightFormula(pid.fPHOSWeightFormula), + fPHOSPhotonWeightFormula(pid.fPHOSPhotonWeightFormula), + fPHOSPi0WeightFormula(pid.fPHOSPi0WeightFormula) + + +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliCaloPID & AliCaloPID::operator = (const AliCaloPID & pid) +{ + // assignment operator + + if(&pid == this) return *this; + + fEMCALPhotonWeight = pid. fEMCALPhotonWeight ; + fEMCALPi0Weight = pid.fEMCALPi0Weight ; + fEMCALElectronWeight = pid.fEMCALElectronWeight; + fEMCALChargeWeight = pid.fEMCALChargeWeight; + fEMCALNeutralWeight = pid.fEMCALNeutralWeight; + + fPHOSPhotonWeight = pid.fPHOSPhotonWeight ; + fPHOSPi0Weight = pid.fPHOSPi0Weight ; + fPHOSElectronWeight = pid.fPHOSElectronWeight; + fPHOSChargeWeight = pid.fPHOSChargeWeight; + fPHOSNeutralWeight = pid.fPHOSNeutralWeight; + + fPHOSWeightFormula = pid.fPHOSWeightFormula; + fPHOSPhotonWeightFormula = pid.fPHOSPhotonWeightFormula; + fPHOSPi0WeightFormula = pid.fPHOSPi0WeightFormula; + + return *this; + +} + +//_________________________________ +AliCaloPID::~AliCaloPID() { + //Dtor + + if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ; + if(fPHOSPi0WeightFormula) delete fPHOSPi0WeightFormula ; + +} + + +//_______________________________________________________________ +void AliCaloPID::InitParameters() +{ + //Initialize the parameters of the PID. + + fEMCALPhotonWeight = 0.8 ; + fEMCALPi0Weight = 0.5 ; + fEMCALElectronWeight = 0.8 ; + fEMCALChargeWeight = 0.5 ; + fEMCALNeutralWeight = 0.5 ; + + fPHOSPhotonWeight = 0.75 ; + fPHOSPi0Weight = 0.8 ; + fPHOSElectronWeight = 0.5 ; + fPHOSChargeWeight = 0.5 ; + fPHOSNeutralWeight = 0.5 ; + + //Formula to set the PID weight threshold for photon or pi0 + fPHOSWeightFormula = kTRUE; + fPHOSPhotonWeightFormula = + new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))"); + fPHOSPi0WeightFormula = + new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))"); +} + + +//________________________________________________________________ +void AliCaloPID::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + + printf("PHOS PID weight , photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f \n", + fPHOSPhotonWeight, fPHOSPi0Weight, + fPHOSElectronWeight, fPHOSChargeWeight, fPHOSNeutralWeight) ; + printf("EMCAL PID weight, photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f\n", + fEMCALPhotonWeight, fEMCALPi0Weight, + fEMCALElectronWeight, fEMCALChargeWeight, fEMCALNeutralWeight) ; + + printf("PHOS Parametrized weight on? = %d\n", fPHOSWeightFormula) ; +// if(fPHOSWeightFormula){ +// printf(">>>>>>>>>>> Photon weight formula<<<<<<<<<<<<\n"); +// fPHOSPhotonWeightFormula->Print(); +// printf(">>>>>>>>>>> Pi0 weight formula<<<<<<<<<<<<\n"); +// fPHOSPhotonWeightFormula->Print(); +// } + printf(" \n"); + +} + +//_______________________________________________________________ +Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t energy) const { + //Return most probable identity of the particle. + + if(!pid) AliFatal("pid pointer not initialized!!!"); + + Float_t wPh = fPHOSPhotonWeight ; + Float_t wPi0 = fPHOSPi0Weight ; + Float_t wE = fPHOSElectronWeight ; + Float_t wCh = fPHOSChargeWeight ; + Float_t wNe = fPHOSNeutralWeight ; + + + if(calo == "PHOS" && fPHOSWeightFormula){ + wPh = fPHOSPhotonWeightFormula->Eval(energy) ; + wPi0 = fPHOSPi0WeightFormula->Eval(energy); + } + + if(calo == "EMCAL"){ + + wPh = fEMCALPhotonWeight ; + wPi0 = fEMCALPi0Weight ; + wE = fEMCALElectronWeight ; + wCh = fEMCALChargeWeight ; + wNe = fEMCALNeutralWeight ; + + } + +// printf("PID: calo %s, ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n", +// calo.Data(),pid[AliAODCluster::kPhoton], pid[AliAODCluster::kPi0], +// pid[AliAODCluster::kElectron], pid[AliAODCluster::kEleCon], +// pid[AliAODCluster::kPion], pid[AliAODCluster::kKaon], pid[AliAODCluster::kProton], +// pid[AliAODCluster::kNeutron], pid[AliAODCluster::kKaon0]); + + Int_t pdg = kNeutralUnknown ; + Float_t chargedHadronWeight = pid[AliAODCluster::kProton]+pid[AliAODCluster::kKaon]+ + pid[AliAODCluster::kPion]+pid[AliAODCluster::kMuon]; + Float_t neutralHadronWeight = pid[AliAODCluster::kNeutron]+pid[AliAODCluster::kKaon0]; + Float_t allChargedWeight = pid[AliAODCluster::kElectron]+pid[AliAODCluster::kEleCon]+ chargedHadronWeight; + Float_t allNeutralWeight = pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kPi0]+ neutralHadronWeight; + + //Select most probable ID + if(calo=="PHOS"){ + if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ; + else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; + else if(pid[AliAODCluster::kElectron] > wE) pdg = kElectron ; + else if(pid[AliAODCluster::kEleCon] > wE) pdg = kEleCon ; + else if(chargedHadronWeight > wCh) pdg = kChargedHadron ; + else if(neutralHadronWeight > wNe) pdg = kNeutralHadron ; + else if(allChargedWeight > allNeutralWeight) + pdg = kChargedUnknown ; + else + pdg = kNeutralUnknown ; + } + else{//EMCAL + //Temporal solution, electrons and photons not differenciated + if(pid[AliAODCluster::kPhoton] + pid[AliAODCluster::kElectron] > wPh) pdg = kPhoton ; + else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; + else if(chargedHadronWeight + neutralHadronWeight > wCh) pdg = kChargedHadron ; + else if(neutralHadronWeight + chargedHadronWeight > wNe) pdg = kNeutralHadron ; + else pdg = kNeutralUnknown ; + + } + + + //printf("Final Pdg: %d \n", pdg); + + + + return pdg ; + +} + +//_______________________________________________________________ +Int_t AliCaloPID::GetPdg(const TString calo, const TLorentzVector mom, const Double_t l0, + const Double_t l1, const Double_t disp, const Double_t tof, + const Double_t distCPV) const { + //Recalculated PID with all parameters + AliDebug(2,Form("Calorimeter %s, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %3.2f, distCPV %3.2f", + calo.Data(),mom.E(),l0,l1,disp,tof,distCPV)); + + if(calo == "EMCAL") { + if(l0 < 0.25) return kPhoton ; + else return kNeutralHadron ; + } + + return kNeutralHadron ; + +} + diff --git a/PWG4/PartCorr/AliCaloPID.h b/PWG4/PartCorr/AliCaloPID.h new file mode 100644 index 00000000000..9f3e4cf81cb --- /dev/null +++ b/PWG4/PartCorr/AliCaloPID.h @@ -0,0 +1,117 @@ +#ifndef ALICALOPID_H +#define ALICALOPID_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +class TString ; +class Riostream ; +class TLorentzVector ; +class TFormula ; + +//--- AliRoot system --- +class AliLog ; + +class AliCaloPID : public TObject { + +public: + + AliCaloPID() ; // ctor + AliCaloPID(const AliCaloPID & g) ; // cpy ctor + AliCaloPID & operator = (const AliCaloPID & g) ;//cpy assignment + virtual ~AliCaloPID() ;//virtual dtor + + enum PidType { + kPhoton = 22, + kPi0 = 111, + kEta = 221, + kElectron = 11, + kEleCon = -11, + kNeutralHadron = 2112, + kChargedHadron = 211, + kNeutralUnknown = 130, + kChargedUnknown=321 + }; + + enum PhotonStatusType { + kPromptPhoton=2, + kFragmentPhoton=3, + kPi0DecayPhoton=4, + kEtaDecayPhoton=5, + kOtherDecayPhoton=6, + kUnknown=7 + }; + + void InitParameters(); + + void Print(const Option_t * opt)const; + + Int_t GetPdg(const TString calo, const Double_t * pid, const Float_t energy) const ; + Int_t GetPdg(const TString calo, const TLorentzVector mom, const Double_t l0, const Double_t l1, const Double_t disp, const Double_t tof, const Double_t distCPV) const ; + + //Weight getters + Float_t GetEMCALPhotonWeight() const { return fEMCALPhotonWeight ; } + Float_t GetEMCALPi0Weight() const { return fEMCALPi0Weight ; } + Float_t GetEMCALElectronWeight() const { return fEMCALElectronWeight ; } + Float_t GetEMCALChargeWeight() const { return fEMCALChargeWeight ; } + Float_t GetEMCALNeutralWeight() const { return fEMCALNeutralWeight ; } + Float_t GetPHOSPhotonWeight() const { return fPHOSPhotonWeight ; } + Float_t GetPHOSPi0Weight() const { return fPHOSPi0Weight ; } + Float_t GetPHOSElectronWeight() const { return fPHOSElectronWeight ; } + Float_t GetPHOSChargeWeight() const { return fPHOSChargeWeight ; } + Float_t GetPHOSNeutralWeight() const { return fPHOSNeutralWeight ; } + + Bool_t IsPHOSPIDWeightFormulaOn() const { return fPHOSWeightFormula ; } + TFormula * GetPHOSPhotonWeightFormula() const { return fPHOSPhotonWeightFormula ; } + TFormula * GetPHOSPi0WeightFormula() const { return fPHOSPi0WeightFormula ; } + + //Weight setters + void SetEMCALPhotonWeight(Float_t w){ fEMCALPhotonWeight = w ; } + void SetEMCALPi0Weight(Float_t w){ fEMCALPi0Weight = w ; } + void SetEMCALElectronWeight(Float_t w){ fEMCALElectronWeight = w ; } + void SetEMCALChargeWeight(Float_t w){ fEMCALChargeWeight = w ; } + void SetEMCALNeutralWeight(Float_t w){ fEMCALNeutralWeight = w ; } + void SetPHOSPhotonWeight(Float_t w){ fPHOSPhotonWeight = w ; } + void SetPHOSPi0Weight(Float_t w){ fPHOSPi0Weight = w ; } + void SetPHOSElectronWeight(Float_t w){ fPHOSElectronWeight = w ; } + void SetPHOSChargeWeight(Float_t w){ fPHOSChargeWeight = w ; } + void SetPHOSNeutralWeight(Float_t w){ fPHOSNeutralWeight = w ; } + + void UsePHOSPIDWeightFormula(Bool_t par) { fPHOSWeightFormula = par; } + void SetPHOSPhotonWeightFormula(TFormula * photon) { fPHOSPhotonWeightFormula = photon; } + void SetPHOSPi0WeightFormula(TFormula * pi0) { fPHOSPi0WeightFormula = pi0; } + + private: + + Float_t fEMCALPhotonWeight; //Bayesian PID weight for photons in EMCAL + Float_t fEMCALPi0Weight; //Bayesian PID weight for pi0 in EMCAL + Float_t fEMCALElectronWeight; //Bayesian PID weight for electrons in EMCAL + Float_t fEMCALChargeWeight; //Bayesian PID weight for charged hadrons in EMCAL + Float_t fEMCALNeutralWeight; //Bayesian PID weight for neutral hadrons in EMCAL + Float_t fPHOSPhotonWeight; //Bayesian PID weight for photons in PHOS + Float_t fPHOSPi0Weight; //Bayesian PID weight for pi0 in PHOS + Float_t fPHOSElectronWeight; //Bayesian PID weight for electrons in PHOS + Float_t fPHOSChargeWeight; //Bayesian PID weight for charged hadrons in PHOS + Float_t fPHOSNeutralWeight; //Bayesian PID weight for neutral hadrons in PHOS + + Bool_t fPHOSWeightFormula ; //Use parametrized weight threshold, function of energy + TFormula * fPHOSPhotonWeightFormula ; //Formula for photon weight + TFormula * fPHOSPi0WeightFormula ; //Formula for pi0 weight + + + ClassDef(AliCaloPID,1) +} ; + + +#endif //ALICALOPID_H + + + diff --git a/PWG4/PartCorr/AliCaloPhoton.cxx b/PWG4/PartCorr/AliCaloPhoton.cxx new file mode 100644 index 00000000000..fec573e5fe7 --- /dev/null +++ b/PWG4/PartCorr/AliCaloPhoton.cxx @@ -0,0 +1,59 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Minimal class to store photon infomation for pi0, tagged and isolated photon analysis +// +//-- Author: Dmitri Peressounko (RRC "KI") + +#include "AliCaloPhoton.h" +ClassImp(AliCaloPhoton) +//=============================================== +AliCaloPhoton::AliCaloPhoton():TLorentzVector(),fDisp(0), + fTof(0),fCpv(0),fPCA(0),fTrig(0), + fIsTagged(0),fIsIsolated(0), + fX(0.),fY(0.),fZ(0.), + fModule(0),fBadDist(0) +{ + + +} +//=============================================== +AliCaloPhoton::AliCaloPhoton(Double_t px,Double_t py,Double_t pz,Double_t energy): + TLorentzVector(px,py,pz,energy),fDisp(0), + fTof(0),fCpv(0),fPCA(0),fTrig(0), + fIsTagged(0),fIsIsolated(0), + fX(0.),fY(0.),fZ(0.), + fModule(0),fBadDist(0) +{ + +} +//=============================================== +Bool_t AliCaloPhoton::IsPIDOK(Int_t ipid)const{ + // returns true if photon satisfies given PID criterium + switch(ipid){ + case 0: return kTRUE ; //No PID at all + case 1: return fPCA; //Overall PID calculated in AliPHOSPIDv1 + case 2: return fDisp ; //only dispersion cut + case 3: return fTof ; //Only TOF cut + case 4: return fCpv ; //Only CPV cut + case 5: return fDisp&&fTof ; //Dispersion and TOF + case 6: return fDisp&&fCpv ; //Dispersion and CPV + case 7: return fTof && fCpv; //TOF and CPV + case 8: return fDisp&&fTof&&fCpv ; // all 3 cuts + default: return kFALSE ; //Not known combination + } +} diff --git a/PWG4/PartCorr/AliCaloPhoton.h b/PWG4/PartCorr/AliCaloPhoton.h new file mode 100644 index 00000000000..31236ed385a --- /dev/null +++ b/PWG4/PartCorr/AliCaloPhoton.h @@ -0,0 +1,73 @@ +#ifndef ALICALOPHOTON_H +#define ALICALOPHOTON_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class to fill two-photon invariant mass hisograms +// to be used to extract pi0 raw yield. +// +//-- Author: Dmitri Peressounko (RRC "KI") +// This class contains all (minimal) necessary information about photon to +// calculate invarint mass distr for pi0 +// and for tagging and isolation analysis + + +#include "TLorentzVector.h" + +class AliCaloPhoton :public TLorentzVector{ + + public: + + AliCaloPhoton() ; + AliCaloPhoton(Double_t px,Double_t py,Double_t pz,Double_t E) ; + ~AliCaloPhoton(){} + + Bool_t IsDispOK(void)const {return fDisp;} + Bool_t IsTOFOK(void)const {return fTof;} + Bool_t IsCPVOK(void)const {return fCpv;} + Bool_t IsIsolated(void)const{return fIsIsolated ;} + Bool_t IsTagged(void) const{return fIsTagged ;} + Double_t EMCx(void)const {return fZ;} + Double_t EMCy(void)const {return fZ;} + Double_t EMCz(void)const {return fZ;} + Int_t Module(void)const{return fModule;} + Bool_t IsPIDOK(const Int_t ipid) const ; + Int_t DistToBad()const {return fBadDist ;} + + + void SetDispBit(Bool_t chi2){fDisp = chi2 ;} + void SetTOFBit(Bool_t tof){fTof = tof ;} + void SetCPVBit(Bool_t cpv){fCpv = cpv; } + void SetPCAPID(Bool_t pca){fPCA = pca;} + void SetTrig(Bool_t trig){fTrig=trig;} + void SetEMCx(Double_t x){fX = x ;} + void SetEMCy(Double_t y){fY = y ;} + void SetEMCz(Double_t z){fZ = z ;} + void SetModule(Int_t mod){fModule = mod ;} + void SetDistToBad(Int_t dist){fBadDist=dist;} + void SetTagged(Bool_t bit){fIsTagged=bit;} + void SetIsolated(Bool_t bit){fIsIsolated=bit;} + +private: + Bool_t fDisp ; //Dispersion bit + Bool_t fTof ; //TOF bit + Bool_t fCpv ; //Charged bit + Bool_t fPCA ; //Principal Component Analysis bit + Bool_t fTrig ; //If this photon fired trigger + Bool_t fIsTagged; //If it is tagged + Bool_t fIsIsolated ; //it is isolated + Double_t fX ; //Cluster coordinates in ALICE ref system + Double_t fY ; //Cluster coordinates in ALICE ref system + Double_t fZ ; //Cluster coordinates in ALICE ref system + Int_t fModule ; //Module number + Int_t fBadDist ; //Distance to bad module in module units + + ClassDef(AliCaloPhoton,1) + +}; + +#endif // #ifdef ALICALOPHOTON_H + + diff --git a/PWG4/PartCorr/AliCaloTrackAODReader.cxx b/PWG4/PartCorr/AliCaloTrackAODReader.cxx new file mode 100644 index 00000000000..9de1aa32a8f --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackAODReader.cxx @@ -0,0 +1,214 @@ + +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (AODs) in order to do prompt gamma +// or other particle identification and correlations +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +//---- ANALYSIS system ---- +#include "AliCaloTrackAODReader.h" +#include "AliAODEvent.h" +#include "AliAODVertex.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" +#include "AliMCEvent.h" +#include "AliLog.h" +#include "Riostream.h" + +ClassImp(AliCaloTrackAODReader) + +//____________________________________________________________________________ +AliCaloTrackAODReader::AliCaloTrackAODReader() : + AliCaloTrackReader() +{ + //Default Ctor + + //Initialize parameters + fDataType=kAOD; + +} + +//____________________________________________________________________________ +AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) : + AliCaloTrackReader(g) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + return *this; + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputCTS() { + //Return array with CTS tracks + fAODCTS = new TClonesArray("AliAODTrack",0); + + Int_t nTracks = fAOD->GetNumberOfTracks() ; + Int_t naod = 0; + Double_t p[3]; + + for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + AliAODTrack * track = fAOD->GetTrack(itrack) ; // retrieve track from esd + + // //We want tracks fitted in the detectors: + // ULong_t status=AliAODTrack::kTPCrefit; + // status|=AliAODTrack::kITSrefit; + + //We want tracks whose PID bit is set: + // ULong_t status =AliAODTrack::kITSpid; + // status|=AliAODTrack::kTPCpid; + + // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set + + track->GetPxPyPz(p) ; + TLorentzVector momentum(p[0],p[1],p[2],0); + + if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){ + + if(fDebug > 2 && momentum.Pt() > 0.1)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + new((*fAODCTS)[naod++]) AliAODTrack(*track); + + }//Pt and Fidutial cut passed. + //}// track status + }// track loop + if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntriesFast()); +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputEMCAL() { + //Return array with EMCAL clusters in aod format + + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + TRefArray * caloClusters = new TRefArray(); + fAOD->GetEMCALClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) { + AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + + if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + new((*fAODEMCAL)[naod++]) AliAODCaloCluster(*clus); + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast()); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputPHOS() { + //Return array with PHOS clusters in aod format + + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + TRefArray * caloClusters = new TRefArray(); + fAOD->GetPHOSClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) { + AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + + if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus); + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntriesFast()); + + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputEMCALCells() { + //Return array with EMCAL cells in aod format + + fEMCALCells = (TNamed*) fAOD->GetEMCALCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputPHOSCells() { + //Return array with PHOS cells in aod format + + fPHOSCells = (TNamed*) fAOD->GetPHOSCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::GetVertex(Double_t v[3]) { + //Return vertex position + + v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!! + v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!! + v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!! +} + + +//____________________________________________________________________________ +void AliCaloTrackAODReader::SetInputEvent(TObject* input, TObject* aod, TObject* mc) { + // Connect the data pointers + + //If input is AOD, do analysis with input, if not, do analysis with the output aod. + if(!strcmp(input->GetName(),"AliESDEvent")) SetAOD((AliAODEvent*) aod); + else if(!strcmp(input->GetName(),"AliAODEvent")) SetAOD((AliAODEvent*) input); + else AliFatal(Form("Unknown data format: %s",input->GetName())); + + SetMC((AliMCEvent*) mc); + +} diff --git a/PWG4/PartCorr/AliCaloTrackAODReader.h b/PWG4/PartCorr/AliCaloTrackAODReader.h new file mode 100644 index 00000000000..925368ae58c --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackAODReader.h @@ -0,0 +1,47 @@ +#ifndef AliCaloTrackAODReader_H +#define AliCaloTrackAODReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (AODs) in order to do prompt gamma or other particle +// identification and correlations +// +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" + +class AliCaloTrackAODReader : public AliCaloTrackReader { + + public: + + AliCaloTrackAODReader() ; // ctor + AliCaloTrackAODReader(const AliCaloTrackAODReader & g) ; // cpy ctor + AliCaloTrackAODReader & operator = (const AliCaloTrackAODReader & g) ;//cpy assignment + virtual ~AliCaloTrackAODReader() {;} //virtual dtor + + void FillInputCTS(); + void FillInputEMCAL(); + void FillInputPHOS(); + + void FillInputEMCALCells(); + void FillInputPHOSCells(); + + void GetVertex(Double_t v[3]) ; + + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + + ClassDef(AliCaloTrackAODReader,1) + } ; + + +#endif //AliCaloTrackAODReader_H + + + diff --git a/PWG4/PartCorr/AliCaloTrackESDReader.cxx b/PWG4/PartCorr/AliCaloTrackESDReader.cxx new file mode 100644 index 00000000000..f93cd87c09d --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackESDReader.cxx @@ -0,0 +1,306 @@ + +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (ESDs) in order to do prompt gamma +// or other particle identification and correlations +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +//---- ANALYSIS system ---- +#include "AliCaloTrackESDReader.h" +#include "AliESDEvent.h" +#include "AliESDVertex.h" +#include "AliESDCaloCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" +#include "AliAODEvent.h" +#include "AliMCEvent.h" +#include "AliLog.h" +#include "Riostream.h" + +ClassImp(AliCaloTrackESDReader) + +//____________________________________________________________________________ +AliCaloTrackESDReader::AliCaloTrackESDReader() : + AliCaloTrackReader() +{ + //Default Ctor + + //Initialize parameters + fDataType=kESD; + +} + +//____________________________________________________________________________ +AliCaloTrackESDReader::AliCaloTrackESDReader(const AliCaloTrackESDReader & g) : + AliCaloTrackReader(g) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackESDReader & AliCaloTrackESDReader::operator = (const AliCaloTrackESDReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + return *this; + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputCTS() { + //Return array with CTS tracks + + fAODCTS = new TClonesArray("AliAODTrack",0); + + Int_t nTracks = fESD->GetNumberOfTracks() ; + Int_t naod = 0; + Double_t pos[3]; + Double_t p[3]; + Double_t covTr[21]; + Double_t pid[10]; + for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + AliESDtrack * track = fESD->GetTrack(itrack) ; // retrieve track from esd + + //We want tracks fitted in the detectors: + ULong_t status=AliESDtrack::kTPCrefit; + status|=AliESDtrack::kITSrefit; + + if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set + + track->GetPxPyPz(p) ; + TLorentzVector momentum(p[0],p[1],p[2],0); + + if(fCTSPtMin < momentum.Pt() &&fFidutialCut->IsInFidutialCut(momentum,"CTS")){ + + if(fDebug > 3 && momentum.Pt() > 0.2)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + track->GetXYZ(pos); + track->GetCovarianceXYZPxPyPz(covTr); + track->GetESDpid(pid); + + Float_t impactXY, impactZ; + + track->GetImpactParameters(impactXY,impactZ); + + if (impactXY<3) { + // track inside the beam pipe + + AliAODTrack *aodTrack = new((*fAODCTS)[naod++]) + AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), + pid, + 0x0,//primary, + kTRUE, // check if this is right + kTRUE, // check if this is right + AliAODTrack::kPrimary, + 0); + + aodTrack->SetFlags(track->GetStatus()); + aodTrack->ConvertAliPIDtoAODPID(); + } + else continue; // outside the beam pipe: orphan track + }//Pt and Fidutial cut passed. + }// track status + }// track loop + if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntriesFast()); +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputEMCAL() { + //Return array with EMCAL clusters in aod format + + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fESD->GetEMCALClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + Float_t pos[3] ; +// Double_t * pid = new Double_t[AliPID::kSPECIESN]; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) { + AliESDCaloCluster * clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + if(fDebug > 3 && momentum.E() > 0.1)printf("FillInputEMCAL():: all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// pid=clus->GetPid(); + clus->GetPosition(pos) ; +// printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", +// pid[AliPID::kPhoton],pid[AliPID::kPi0], +// pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], +// pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0], +// pid[AliPID::kNeutron], pid[AliPID::kMuon]); + Int_t id = clus->GetID(); + Int_t nLabel = clus->GetNLabels(); + Int_t *labels=0x0; + if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); + + Float_t energy = clus->E(); + Char_t ttype= AliAODCluster::kEMCALClusterv1; + AliAODCaloCluster *caloCluster = new((*fAODEMCAL)[naod++]) + AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0); + + caloCluster->SetPIDFromESD(clus->GetPid()); + caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), + clus->GetM20(), clus->GetM02(), + clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()) ; + caloCluster->SetNCells(clus->GetNCells()); + caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); + caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); + + TArrayI* matchedT = clus->GetTracksMatched(); + if (matchedT && clus->GetTrackMatched() > 0) { + for (Int_t im = 0; im < matchedT->GetSize(); im++) { + caloCluster->AddTrackMatched((fESD->GetTrack(im))); + } + } + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast()); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputPHOS() { + //Return array with PHOS clusters in aod format + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fESD->GetPHOSClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + Float_t pos[3] ; + Double_t * pid = new Double_t[AliPID::kSPECIESN]; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntriesFast(); iclus++) { + AliESDCaloCluster * clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + if(fDebug > 3 && momentum.E() > 0.1)printf("FillInputPHOS():: all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + pid=clus->GetPid(); + // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", + // pid[AliPID::kPhoton],pid[AliPID::kPi0], + // pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], + // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0], + // pid[AliPID::kNeutron], pid[AliPID::kMuon]); + + clus->GetPosition(pos) ; + Int_t id = clus->GetID(); + Int_t nLabel = clus->GetNLabels(); + Int_t *labels=0x0; + if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); + Float_t energy = clus->E(); + + //Phos cluster type + Char_t ttype= AliAODCluster::kPHOSNeutral; + Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0]; + Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ + pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion]; + if( wCharged > wNeutral) ttype= AliAODCluster::kPHOSCharged; + + AliAODCaloCluster *caloCluster = new((*fAODPHOS)[naod++]) + AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0); + caloCluster->SetPIDFromESD(clus->GetPid()); + caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), + clus->GetM20(), clus->GetM02(), + clus->GetEmcCpvDistance(), clus->GetNExMax()) ; + caloCluster->SetNCells(clus->GetNCells()); + caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); + caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); + TArrayI* matchedT = clus->GetTracksMatched(); + if (matchedT) { + for (Int_t im = 0; im < matchedT->GetSize(); im++) { + caloCluster->AddTrackMatched((fESD->GetTrack(im))); + } + } + + }//Pt and Fidutial cut passed. + }//esd cluster loop + if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntriesFast()); + + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputEMCALCells() { + //Return array with EMCAL cells in esd format + + fEMCALCells = (TNamed*) fESD->GetEMCALCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputPHOSCells() { + //Return array with PHOS cells in esd format + + fPHOSCells = (TNamed*) fESD->GetPHOSCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::GetVertex(Double_t v[3]) { + //Return vertex position + + fESD->GetVertex()->GetXYZ(v) ; + +} + + +//____________________________________________________________________________ +void AliCaloTrackESDReader::SetInputEvent(TObject* esd, TObject* aod, TObject* mc) { + // Connect the data pointers + + if(strcmp(esd->GetName(),"AliESDEvent")) + AliFatal(Form("Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName())); + + SetESD((AliESDEvent*) esd); + SetAOD ((AliAODEvent*) aod); + SetMC((AliMCEvent*) mc); + +} diff --git a/PWG4/PartCorr/AliCaloTrackESDReader.h b/PWG4/PartCorr/AliCaloTrackESDReader.h new file mode 100644 index 00000000000..0588de9b33f --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackESDReader.h @@ -0,0 +1,46 @@ +#ifndef AliCaloTrackESDReader_H +#define AliCaloTrackESDReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (ESDs) in order to do prompt gamma +// or other particle identification and correlations +// + +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" + +class AliCaloTrackESDReader : public AliCaloTrackReader { + + public: + + AliCaloTrackESDReader() ; // ctor + AliCaloTrackESDReader(const AliCaloTrackESDReader & g) ; // cpy ctor + AliCaloTrackESDReader & operator = (const AliCaloTrackESDReader & g) ;//cpy assignment + virtual ~AliCaloTrackESDReader() {;} //virtual dtor + + void FillInputCTS (); + void FillInputEMCAL(); + void FillInputPHOS (); + + void FillInputEMCALCells(); + void FillInputPHOSCells(); + + void GetVertex(Double_t v[3]) ; + + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + ClassDef(AliCaloTrackESDReader,1) + } ; + + +#endif //AliCaloTrackESDReader_H + + + diff --git a/PWG4/PartCorr/AliCaloTrackMCReader.cxx b/PWG4/PartCorr/AliCaloTrackMCReader.cxx new file mode 100644 index 00000000000..dcdfad3a2f2 --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackMCReader.cxx @@ -0,0 +1,830 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (Kinematics) in order to do prompt gamma +// or other particle identification and correlations +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +#include +#include +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliCaloTrackMCReader.h" +#include "Riostream.h" +#include "AliLog.h" +#include "AliGenEventHeader.h" +#include "AliStack.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" + +ClassImp(AliCaloTrackMCReader) + +//____________________________________________________________________________ +AliCaloTrackMCReader::AliCaloTrackMCReader() : + AliCaloTrackReader(), fDecayPi0(0), + fNeutralParticlesArray(0x0), fChargedParticlesArray(0x0), + fStatusArray(0x0), fKeepAllStatus(0), fClonesArrayType(0) +{ + //Ctor + + //Initialize parameters + InitParameters(); + fDataType = kMC; + +} + +//____________________________________________________________________________ +AliCaloTrackMCReader::AliCaloTrackMCReader(const AliCaloTrackMCReader & g) : + AliCaloTrackReader(g), fDecayPi0(g.fDecayPi0), + fNeutralParticlesArray(g.fNeutralParticlesArray?new TArrayI(*g.fNeutralParticlesArray):0x0), + fChargedParticlesArray(g.fChargedParticlesArray?new TArrayI(*g.fChargedParticlesArray):0x0), + fStatusArray(g.fStatusArray?new TArrayI(*g.fStatusArray):0x0), + fKeepAllStatus(g.fKeepAllStatus), fClonesArrayType(g.fClonesArrayType) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackMCReader & AliCaloTrackMCReader::operator = (const AliCaloTrackMCReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + fDecayPi0 = source.fDecayPi0; + + delete fChargedParticlesArray; + fChargedParticlesArray = source.fChargedParticlesArray?new TArrayI(*source.fChargedParticlesArray):0x0; + + delete fNeutralParticlesArray; + fNeutralParticlesArray = source.fNeutralParticlesArray?new TArrayI(*source.fNeutralParticlesArray):0x0; + + delete fStatusArray; + fStatusArray = source.fStatusArray?new TArrayI(*source.fStatusArray):0x0; + + fKeepAllStatus = source.fKeepAllStatus ; + fClonesArrayType = source.fClonesArrayType ; + + return *this; + +} + +//_________________________________ +AliCaloTrackMCReader::~AliCaloTrackMCReader() { + //Dtor + + if(fChargedParticlesArray) delete fChargedParticlesArray ; + if(fNeutralParticlesArray) delete fNeutralParticlesArray ; + if(fStatusArray) delete fStatusArray ; + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::GetVertex(Double_t v[3]) { + //Return vertex position + + TArrayF pv; + GetGenEventHeader()->PrimaryVertex(pv); + v[0]=pv.At(0); + v[1]=pv.At(1); + v[2]=pv.At(2); + +} + + +//_______________________________________________________________ +void AliCaloTrackMCReader::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fDecayPi0 = kFALSE; + + fChargedParticlesArray = new TArrayI(1); + fChargedParticlesArray->SetAt(11,0); + //Int_t pdgarray[]={12,14,16};// skip neutrinos + //fNeutralParticlesArray = new TArrayI(3, pdgarray); + fNeutralParticlesArray = new TArrayI(3); + fNeutralParticlesArray->SetAt(12,0); fNeutralParticlesArray->SetAt(14,1); fNeutralParticlesArray->SetAt(16,2); + fStatusArray = new TArrayI(1); + fStatusArray->SetAt(1,0); + + fKeepAllStatus = kTRUE; + fClonesArrayType = kAliAOD ; + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum, + Int_t &indexPHOS, Int_t &indexEMCAL){ + //Fill AODCaloClusters or TParticles lists of PHOS or EMCAL + + //In PHOS + if(fFillPHOS && fFidutialCut->IsInFidutialCut(momentum,"PHOS") && momentum.Pt() > fPHOSPtMin){ + + if(fClonesArrayType == kTParticle) new((*fAODPHOS)[indexPHOS++]) TParticle(*particle) ; + else{ + + Char_t ttype= AliAODCluster::kPHOSNeutral; + Int_t labels[] = {iParticle}; + Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()}; + AliAODCaloCluster *calo = new((*fAODPHOS)[indexPHOS++]) + AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0); + SetCaloClusterPID(particle->GetPdgCode(),calo) ; + } + } + //In EMCAL + else if(fFillEMCAL && fFidutialCut->IsInFidutialCut(momentum,"EMCAL") && momentum.Pt() > fEMCALPtMin){ + //cout<<"Reader : E "<GetPdgCode(),calo) ; + } + } +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::FillInputEvent() +{ + //Create list of particles from EMCAL, PHOS and CTS. + + if(fClonesArrayType == kTParticle){ + fAODCTS = new TClonesArray("TParticle",0); + fAODEMCAL = new TClonesArray("TParticle",0); + fAODPHOS = new TClonesArray("TParticle",0); + } + else if(fClonesArrayType == kAliAOD){ + fAODCTS = new TClonesArray("AliAODTrack",0); + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + } + else {AliFatal("Wrong clones type");} + + + Int_t indexCh = 0 ; + Int_t indexEMCAL = 0 ; + Int_t indexPHOS = 0 ; + + Int_t iParticle = 0 ; + Double_t charge = 0.; + + for (iParticle=0 ; iParticle < GetStack()->GetNprimary() ; iParticle++) { + TParticle * particle = GetStack()->Particle(iParticle); + TLorentzVector momentum; + Float_t p[3]; + Float_t x[3]; + Int_t pdg = particle->GetPdgCode(); + + //Keep particles with a given status + if(KeepParticleWithStatus(particle->GetStatusCode()) && (particle->Pt() > 0) ){ + + charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge(); + particle->Momentum(momentum); + //---------- Charged particles ---------------------- + if((charge != 0) && (momentum.Pt() > fCTSPtMin) && (fFidutialCut->IsInFidutialCut(momentum,"CTS"))){ + if(fFillCTS){ + //Particles in CTS acceptance + if(fDebug > 3 && momentum.Pt() > 0.2)printf("Fill MC CTS :: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + if(fClonesArrayType == kTParticle) new((*fAODCTS)[indexCh++]) TParticle(*particle) ; + else{ + x[0] = particle->Vx(); x[1] = particle->Vy(); x[2] = particle->Vz(); + p[0] = particle->Px(); p[1] = particle->Py(); p[2] = particle->Pz(); + AliAODTrack *aodTrack = new((*fAODCTS)[indexCh++]) + AliAODTrack(0, iParticle, p, kTRUE, x, kFALSE,NULL, 0, 0, + NULL, + 0x0,//primary, + kFALSE, // No fit performed + kFALSE, // No fit performed + AliAODTrack::kPrimary, + 0); + SetTrackChargeAndPID(pdg, aodTrack); + } + } + //Keep some charged particles in calorimeters lists + if((fFillPHOS || fFillEMCAL) && KeepChargedParticles(pdg)) FillCalorimeters(iParticle, particle, momentum, indexPHOS, indexEMCAL); + + }//Charged + + //-------------Neutral particles ---------------------- + else if(charge == 0 && (fFillPHOS || fFillEMCAL)){ + //Skip neutrinos or other neutral particles + if(SkipNeutralParticles(pdg) || particle->IsPrimary()) continue ; // protection added (MG) + + //Fill particle/calocluster arrays + if(!fDecayPi0) FillCalorimeters(iParticle, particle, momentum, indexPHOS, indexEMCAL); + else { + //Sometimes pi0 are stable for the generator, if needed decay it by hand + if(pdg == 111 ){ + if(momentum.Pt() > fPHOSPtMin || momentum.Pt() > fEMCALPtMin){ + TLorentzVector lvGamma1, lvGamma2 ; + //Double_t angle = 0; + + //Decay + MakePi0Decay(momentum,lvGamma1,lvGamma2);//,angle); + + //Check if Pi0 is in the acceptance of the calorimeters, if aperture angle is small, keep it + TParticle * pPhoton1 = new TParticle(22,1,iParticle,0,0,0,lvGamma1.Px(),lvGamma1.Py(), + lvGamma1.Pz(),lvGamma1.E(),0,0,0,0); + TParticle * pPhoton2 = new TParticle(22,1,iParticle,0,0,0,lvGamma2.Px(),lvGamma2.Py(), + lvGamma2.Pz(),lvGamma2.E(),0,0,0,0); + //Fill particle/calocluster arrays + FillCalorimeters(iParticle,pPhoton1,lvGamma1, indexPHOS, indexEMCAL); + FillCalorimeters(iParticle,pPhoton2,lvGamma2, indexPHOS, indexEMCAL); + }//pt cut + }//pi0 + else FillCalorimeters(iParticle,particle, momentum, indexPHOS, indexEMCAL); //Add the rest + } + }//neutral particles + } //particle with correct status + }//particle loop + +} + +//________________________________________________________________ +Bool_t AliCaloTrackMCReader::KeepParticleWithStatus(Int_t status) const { + //Check if status is equal to one of the list + //These particles will be used in analysis. + if(!fKeepAllStatus){ + for(Int_t i= 0; i < fStatusArray->GetSize(); i++) + if(status == fStatusArray->At(i)) return kTRUE ; + + return kFALSE; + + } + else + return kTRUE ; +} + +//________________________________________________________________ +Bool_t AliCaloTrackMCReader::KeepChargedParticles(Int_t pdg) const { + //Check if pdg is equal to one of the charged particles list + //These particles will be added to the calorimeters lists. + + for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++) + if(TMath::Abs(pdg) == fChargedParticlesArray->At(i)) return kTRUE ; + + return kFALSE; + +} + +//________________________________________________________________ +void AliCaloTrackMCReader::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("**** Print **** ", "%s %s", GetName(), GetTitle() ) ; + + printf("Decay Pi0? : %d\n", fDecayPi0) ; + printf("TClonesArray type : %d\n", fClonesArrayType) ; + printf("Keep all status? : %d\n", fKeepAllStatus) ; + + if(!fKeepAllStatus) printf("Keep particles with status : "); + for(Int_t i= 0; i < fStatusArray->GetSize(); i++) + printf(" %d ; ", fStatusArray->At(i)); + printf("\n"); + + printf("Skip neutral particles in calo : "); + for(Int_t i= 0; i < fNeutralParticlesArray->GetSize(); i++) + printf(" %d ; ", fNeutralParticlesArray->At(i)); + printf("\n"); + + printf("Keep charged particles in calo : "); + for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++) + printf(" %d ; ", fChargedParticlesArray->At(i)); + printf("\n"); + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, + TLorentzVector &p2){//, Double_t &angle) { + // Perform isotropic decay pi0 -> 2 photons + // p0 is pi0 4-momentum (inut) + // p1 and p2 are photon 4-momenta (output) + // cout<<"Boost vector"<GetParticle(111)->Mass(); + TVector3 b = p0.BoostVector(); + //cout<<"Parameters"<Rndm(); + Double_t cosThe = 2 * gRandom->Rndm() - 1; + Double_t cosPhi = TMath::Cos(phi); + Double_t sinPhi = TMath::Sin(phi); + Double_t sinThe = TMath::Sqrt(1-cosThe*cosThe); + Double_t ePi0 = mPi0/2.; + //cout<<"ePi0 "<GetSize(); i++) + if(TMath::Abs(pdg) == fNeutralParticlesArray->At(i)) return kTRUE ; + + return kFALSE; + +} + + +//____________________________________________________________________ +void AliCaloTrackMCReader::SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track) { + + Float_t PID[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}; + + switch (pdgCode) { + + case 22: // gamma + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 11: // e- + track->SetCharge(-1); + PID[AliAODTrack::kElectron] = 1.; + track->SetPID(PID); + break; + + case -11: // e+ + track->SetCharge(+1); + PID[AliAODTrack::kElectron] = 1.; + track->SetPID(PID); + break; + + case 13: // mu- + track->SetCharge(-1); + PID[AliAODTrack::kMuon] = 1.; + track->SetPID(PID); + break; + + case -13: // mu+ + track->SetCharge(+1); + PID[AliAODTrack::kMuon] = 1.; + track->SetPID(PID); + break; + + case 111: // pi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 211: // pi+ + track->SetCharge(+1); + PID[AliAODTrack::kPion] = 1.; + track->SetPID(PID); + break; + + case -211: // pi- + track->SetCharge(-1); + PID[AliAODTrack::kPion] = 1.; + track->SetPID(PID); + break; + + case 130: // K0L + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 321: // K+ + track->SetCharge(+1); + PID[AliAODTrack::kKaon] = 1.; + track->SetPID(PID); + break; + + case -321: // K- + track->SetCharge(-1); + PID[AliAODTrack::kKaon] = 1.; + track->SetPID(PID); + break; + + case 2112: // n + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 2212: // p + track->SetCharge(+1); + PID[AliAODTrack::kProton] = 1.; + track->SetPID(PID); + break; + + case -2212: // anti-p + track->SetCharge(-1); + PID[AliAODTrack::kProton] = 1.; + track->SetPID(PID); + break; + + case 310: // K0S + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 311: // K0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -311: // anti-K0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 221: // eta + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3122: // lambda + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3222: // Sigma+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3212: // Sigma0 + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3112: // Sigma- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3322: // Xi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3312: // Xi- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3334: // Omega- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -2112: // n-bar + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3122: // anti-Lambda + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3222: // anti-Sigma- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3212: // anti-Sigma0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3112: // anti-Sigma+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3322: // anti-Xi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3312: // anti-Xi+ + track->SetCharge(+1); + break; + + case -3334: // anti-Omega+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 411: // D+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -411: // D- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 421: // D0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -421: // anti-D0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + default : // unknown + track->SetCharge(-99); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + } + + return; +} + +//____________________________________________________________________ +void AliCaloTrackMCReader::SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo) { + + Float_t PID[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.}; + + switch (pdgCode) { + + case 22: // gamma + PID[AliAODCaloCluster::kPhoton] = 1.; + calo->SetPID(PID); + break; + + case 11: // e- + PID[AliAODCaloCluster::kElectron] = 1.; + calo->SetPID(PID); + break; + + case -11: // e+ + PID[AliAODCaloCluster::kElectron] = 1.; + calo->SetPID(PID); + break; + + case 13: // mu- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -13: // mu+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 111: // pi0 + PID[AliAODCaloCluster::kPi0] = 1.; + calo->SetPID(PID); + break; + + case 211: // pi+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -211: // pi- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 130: // K0L + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1; + calo->SetPID(PID); + break; + + case 321: // K+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -321: // K- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 2112: // n + PID[AliAODCaloCluster::kNeutron] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 2212: // p + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -2212: // anti-p + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 310: // K0S + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 311: // K0 + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case -311: // anti-K0 + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 221: // eta + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 3122: // lambda + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3222: // Sigma+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3212: // Sigma0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3112: // Sigma- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3322: // Xi0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3312: // Xi- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3334: // Omega- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -2112: // n-bar + PID[AliAODCaloCluster::kNeutron] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case -3122: // anti-Lambda + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3222: // anti-Sigma- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3212: // anti-Sigma0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3112: // anti-Sigma+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3322: // anti-Xi0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3312: // anti-Xi+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3334: // anti-Omega+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 411: // D+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -411: // D- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 421: // D0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -421: // anti-D0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + default : // unknown + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + } + + return; +} diff --git a/PWG4/PartCorr/AliCaloTrackMCReader.h b/PWG4/PartCorr/AliCaloTrackMCReader.h new file mode 100644 index 00000000000..ba470560e0d --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackMCReader.h @@ -0,0 +1,89 @@ +#ifndef AliCaloTrackMCReader_H +#define AliCaloTrackMCReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for reading data (Kinematics) in order to do prompt gamma or other particle correlations +// + +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" +class AliAODCaloCluster ; +class AliAODTrack ; + +class AliCaloTrackMCReader : public AliCaloTrackReader { + + public: + + AliCaloTrackMCReader() ; // ctor + AliCaloTrackMCReader(const AliCaloTrackMCReader & g) ; // cpy ctor + AliCaloTrackMCReader & operator = (const AliCaloTrackMCReader & g) ;//cpy assignment + virtual ~AliCaloTrackMCReader() ;//virtual dtor + + enum clonesType {kTParticle, kAliAOD}; + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void SwitchOnPi0Decay() { fDecayPi0 = kTRUE ; } + void SwitchOffPi0Decay() { fDecayPi0 = kFALSE ; } + Int_t IsPi0DecaySwitchedOn() const { return fDecayPi0 ; } + + void SetClonesArrayType(Int_t type){fClonesArrayType = type ;} + Bool_t GetClonesArrayType() const {return fClonesArrayType ;} + + void AddNeutralParticlesArray(TArrayI & array) + { fNeutralParticlesArray = new TArrayI(array) ; } + TArrayI * GetNeutralParticlesArray() const {return fNeutralParticlesArray;} + Bool_t SkipNeutralParticles(Int_t pdg) const ; + + void AddChargedParticlesArray(TArrayI & array) + { fChargedParticlesArray = new TArrayI(array) ; } + TArrayI * GetChargedParticlesArray() const {return fChargedParticlesArray;} + Bool_t KeepChargedParticles(Int_t pdg) const ; + + void AddStatusArray(TArrayI & array) + { fStatusArray = new TArrayI(array) ; } + TArrayI * GetStatusArray() const {return fStatusArray;} + + void SwitchOnStatusSelection() {fKeepAllStatus = kFALSE;} + void SwitchOffStatusSelection() {fKeepAllStatus = kTRUE;} + Bool_t KeepParticleWithStatus(Int_t status) const ; + + void GetVertex(Double_t v[3]); + + void FillInputEvent(); + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc); + + void SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo); + void SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track); + + private: + + void MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, TLorentzVector &p2);//, Double_t &angle); + void FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum, + Int_t &indexPHOS, Int_t &indexEMCAL); + + private: + Bool_t fDecayPi0; //If not decayed, decay pi0 by hand + TArrayI * fNeutralParticlesArray ; //Do not keep neutral particles of this list in calorimeter. + TArrayI * fChargedParticlesArray ; //Keep charged particles of this list in calorimeter. + TArrayI * fStatusArray ; //Keep particles with status of the list. + Bool_t fKeepAllStatus ; //Do or do not select particles depending on their status code. + Int_t fClonesArrayType; //Analysis with TParticles or AliAODCaloCluster/Track? + + ClassDef(AliCaloTrackMCReader,1) + } ; + + +#endif //AliCaloMCTrackReader_H + + + diff --git a/PWG4/PartCorr/AliCaloTrackReader.cxx b/PWG4/PartCorr/AliCaloTrackReader.cxx new file mode 100644 index 00000000000..1e85be8e641 --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackReader.cxx @@ -0,0 +1,246 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and +// Central Barrel Tracking detectors (CTS). +// Not all MC particles/tracks/clusters are kept, some kinematical/fidutial restrictions are done. +// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// +//-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliCaloTrackReader.h" +#include "AliLog.h" +#include "AliStack.h" +#include "AliHeader.h" +#include "AliGenEventHeader.h" + +ClassImp(AliCaloTrackReader) + + +//____________________________________________________________________________ + AliCaloTrackReader::AliCaloTrackReader() : + TObject(), fDataType(0), fDebug(0), fFidutialCut(0x0), + fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0), + fAODCTS(0x0), fAODEMCAL(0x0), fAODPHOS(0x0), + fEMCALCells(0x0), fPHOSCells(0x0), + fESD(0x0), fAOD(0x0),fMC(0x0), + fFillCTS(0),fFillEMCAL(0),fFillPHOS(0), + fFillEMCALCells(0),fFillPHOSCells(0) +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) : + TObject(g), fDataType(g.fDataType), fDebug(g.fDebug),fFidutialCut(g.fFidutialCut), + fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin), + fAODCTS(new TClonesArray(*g.fAODCTS)), + fAODEMCAL(new TClonesArray(*g.fAODEMCAL)), + fAODPHOS(new TClonesArray(*g.fAODPHOS)), + fEMCALCells(new TNamed(*g.fEMCALCells)), + fPHOSCells(new TNamed(*g.fPHOSCells)), + fESD(g.fESD), fAOD(g.fAOD), fMC(g.fMC), + fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS), + fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + fDataType = source.fDataType ; + fDebug = source.fDebug ; + + fFidutialCut = source.fFidutialCut; + + fCTSPtMin = source.fCTSPtMin ; + fEMCALPtMin = source.fEMCALPtMin ; + fPHOSPtMin = source.fPHOSPtMin ; + + fAODCTS = new TClonesArray(*source.fAODCTS) ; + fAODEMCAL = new TClonesArray(*source.fAODEMCAL) ; + fAODPHOS = new TClonesArray(*source.fAODPHOS) ; + fEMCALCells = new TNamed(*source.fEMCALCells) ; + fPHOSCells = new TNamed(*source.fPHOSCells) ; + + fESD = source.fESD; + fAOD= source.fAOD; + fMC = source.fMC; + + fFillCTS = source.fFillCTS; + fFillEMCAL = source.fFillEMCAL; + fFillPHOS = source.fFillPHOS; + fFillEMCALCells = source.fFillEMCALCells; + fFillPHOSCells = source.fFillPHOSCells; + + return *this; + +} + +//_________________________________ +AliCaloTrackReader::~AliCaloTrackReader() { + //Dtor + + if(fFidutialCut) delete fFidutialCut ; + + if(fAODCTS){ + fAODCTS->Clear() ; + delete fAODCTS ; + } + + if(fAODEMCAL){ + fAODEMCAL->Clear() ; + delete fAODEMCAL ; + } + + if(fAODPHOS){ + fAODPHOS->Clear() ; + delete fAODPHOS ; + } + + if(fEMCALCells){ + fEMCALCells->Clear() ; + delete fEMCALCells ; + } + + if(fPHOSCells){ + fPHOSCells->Clear() ; + delete fPHOSCells ; + } + + if(fESD) delete fESD ; + if(fAOD) delete fAOD ; + if(fMC) delete fMC ; +} + +//____________________________________________________________________________ +AliStack* AliCaloTrackReader::GetStack() const { + //Return pointer to stack + if(fMC) + return fMC->Stack(); + else{ + printf("stack is not available"); + return 0x0 ; + } +} + +//____________________________________________________________________________ +AliHeader* AliCaloTrackReader::GetHeader() const { + //Return pointer to header + if(fMC) + return fMC->Header(); + else{ + printf("header is not available"); + return 0x0 ; + } +} +//____________________________________________________________________________ +AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const { + //Return pointer to Generated event header + if(fMC) + return fMC->GenEventHeader(); + else{ + printf("GenEventHeader is not available"); + return 0x0 ; + } +} + +//_______________________________________________________________ +void AliCaloTrackReader::InitParameters() +{ + + //Initialize the parameters of the analysis. + fDataType = kESD ; + + fCTSPtMin = 0.2 ; + fEMCALPtMin = 0.5 ; + fPHOSPtMin = 0.5 ; + + fFillEMCAL = kTRUE; + fFillPHOS = kTRUE; + fFillCTS = kTRUE; + fFillEMCALCells = kFALSE; + fFillPHOSCells = kFALSE; + + fFidutialCut = new AliFidutialCut(); + +} + + +//________________________________________________________________ +void AliCaloTrackReader::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + printf("Data type : %d\n", fDataType) ; + printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; + printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; + printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; + printf("Use CTS = %d\n", fFillCTS) ; + printf("Use EMCAL = %d\n", fFillEMCAL) ; + printf("Use PHOS = %d\n", fFillPHOS) ; + printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; + printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; + printf(" \n") ; +} + +//___________________________________________________ +void AliCaloTrackReader::FillInputEvent() { + //Fill the input lists that are needed, called by the analysis maker. + + if(fFillCTS) FillInputCTS(); + if(fFillEMCAL) FillInputEMCAL(); + if(fFillPHOS) FillInputPHOS(); + if(fFillEMCALCells) FillInputEMCALCells(); + if(fFillPHOSCells) FillInputPHOSCells(); + +} + +//__________________________________________________ +void AliCaloTrackReader::ResetLists() { + // Reset lists, called by the analysis maker + + if(fAODCTS) fAODCTS -> Clear(); + if(fAODEMCAL) fAODEMCAL -> Clear(); + if(fAODPHOS) fAODPHOS -> Clear(); + if(fEMCALCells) fEMCALCells -> Clear(); + if(fPHOSCells) fPHOSCells -> Clear(); + +} diff --git a/PWG4/PartCorr/AliCaloTrackReader.h b/PWG4/PartCorr/AliCaloTrackReader.h new file mode 100644 index 00000000000..4f56e44bf13 --- /dev/null +++ b/PWG4/PartCorr/AliCaloTrackReader.h @@ -0,0 +1,157 @@ +#ifndef AliCaloTrackReader_H +#define AliCaloTrackReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and +// Central Barrel Tracking detectors. +// Not all MC particles/tracks/clusters are kept, some kinematical restrictions are done. +// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include "TObject.h" +class TClonesArray ; +class TLorentzVector ; +class TString ; +#include "TArrayF.h" +class Riostream ; + +//--- ANALYSIS system --- +/* #include "AliStack.h" */ +/* #include "AliHeader.h" */ +/* #include "AliGenEventHeader.h" */ +class AliStack ; +class AliHeader ; +class AliGenEventHeader ; +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliMCEvent.h" +class AliLog ; +#include "AliFidutialCut.h" + +class AliCaloTrackReader : public TObject { + +public: + + AliCaloTrackReader() ; // ctor + AliCaloTrackReader(const AliCaloTrackReader & g) ; // cpy ctor + AliCaloTrackReader & operator = (const AliCaloTrackReader & g) ;//cpy assignment + virtual ~AliCaloTrackReader() ;//virtual dtor + + enum inputDataType {kESD, kAOD, kMC}; + + void InitParameters(); + + virtual Int_t GetDebug() const { return fDebug ; } + virtual void SetDebug(Int_t d) { fDebug = d ; } + + virtual Int_t GetDataType() const { return fDataType ; } + virtual void SetDataType(Int_t data ){fDataType = data ; } + + virtual void Print(const Option_t * opt)const; + + //Minimum pt setters and getters + virtual Float_t GetEMCALPtMin() const { return fEMCALPtMin ; } + virtual Float_t GetPHOSPtMin() const { return fPHOSPtMin ; } + virtual Float_t GetCTSPtMin() const { return fCTSPtMin ; } + + virtual void SetEMCALPtMin(Float_t pt){ fEMCALPtMin = pt ; } + virtual void SetPHOSPtMin(Float_t pt){ fPHOSPtMin = pt ; } + virtual void SetCTSPtMin(Float_t pt){ fCTSPtMin = pt ; } + + //Input setters and getters + + Bool_t IsCTSSwitchedOn() const { return fFillCTS ; } + void SwitchOnCTS() {fFillCTS = kTRUE ; } + void SwitchOffCTS() {fFillCTS = kFALSE ; } + + Bool_t IsEMCALSwitchedOn() const { return fFillEMCAL ; } + void SwitchOnEMCAL() {fFillEMCAL = kTRUE ; } + void SwitchOffEMCAL() {fFillEMCAL = kFALSE ; } + + Bool_t IsPHOSSwitchedOn() const { return fFillPHOS ; } + void SwitchOnPHOS() {fFillPHOS = kTRUE ; } + void SwitchOffPHOS() {fFillPHOS = kFALSE ; } + + Bool_t IsEMCALCellsSwitchedOn() const { return fFillEMCALCells ; } + void SwitchOnEMCALCells() {fFillEMCALCells = kTRUE ; } + void SwitchOffEMCALCells() {fFillEMCALCells = kFALSE ; } + + Bool_t IsPHOSCellsSwitchedOn() const { return fFillPHOSCells ; } + void SwitchOnPHOSCells() {fFillPHOSCells = kTRUE ; } + void SwitchOffPHOSCells() {fFillPHOSCells = kFALSE ; } + + virtual void FillInputEvent(); + + virtual void FillInputCTS(){;} + virtual void FillInputEMCAL(){;} + virtual void FillInputPHOS(){;} + virtual void FillInputEMCALCells(){;} + virtual void FillInputPHOSCells(){;} + + virtual TClonesArray* GetAODCTS() const {return fAODCTS ;} + virtual TClonesArray* GetAODEMCAL() const {return fAODEMCAL ;} + virtual TClonesArray* GetAODPHOS() const {return fAODPHOS ;} + virtual TNamed* GetEMCALCells() const {return fEMCALCells ;} + virtual TNamed* GetPHOSCells() const {return fPHOSCells ;} + + virtual AliStack* GetStack() const ; + virtual AliHeader* GetHeader() const ; + virtual AliGenEventHeader* GetGenEventHeader() const ; + + virtual void GetVertex(Double_t * ) {;} + virtual AliESDEvent* GetESD() const {return fESD;} + virtual AliAODEvent* GetAOD() const {return fAOD;} + virtual AliMCEvent* GetMC() const {return fMC;} + + virtual void SetESD( AliESDEvent* esd) {fESD = esd;} + virtual void SetAOD(AliAODEvent* aod) {fAOD = aod;} + virtual void SetMC(AliMCEvent* mc) {fMC = mc;} + + virtual void ResetLists(); + + virtual AliFidutialCut * GetFidutialCut() const {return fFidutialCut ;} + virtual void SetFidutialCut(AliFidutialCut * fc) { fFidutialCut = fc ;} + + virtual void SetInputEvent(TObject* /*esd*/, TObject* /*aod*/, TObject* /*mc*/) {;} + + protected: + + Int_t fDataType ; //Select MC:Kinematics, Data:ESD/AOD, MCData:Both + Int_t fDebug; //Debugging level + AliFidutialCut * fFidutialCut; //Acceptance cuts + + Float_t fCTSPtMin; // pT Threshold on charged particles + Float_t fEMCALPtMin; //pT Threshold on emcal clusters + Float_t fPHOSPtMin; // pT Threshold on phos clusters + + TClonesArray* fAODCTS ; //! temporal array with tracks + TClonesArray* fAODEMCAL ; //! temporal array with EMCAL CaloClusters + TClonesArray* fAODPHOS ; //! temporal array with PHOS CaloClusters + TNamed * fEMCALCells ; //! temporal array with EMCAL CaloCells, ESD or AOD + TNamed * fPHOSCells ; //! temporal array with PHOS CaloCells, ESD or AOD + + AliESDEvent *fESD; //! pointer to esd + AliAODEvent *fAOD; //! pointer to aod + AliMCEvent *fMC; //! Monte Carlo Event Handler + + Bool_t fFillCTS; //use data from CTS + Bool_t fFillEMCAL; //use data from EMCAL + Bool_t fFillPHOS; //use data from PHOS + Bool_t fFillEMCALCells; //use data from EMCAL + Bool_t fFillPHOSCells; //use data from PHOS + + ClassDef(AliCaloTrackReader,1) +} ; + + +#endif //AliCaloTrackReader_H + + + diff --git a/PWG4/PartCorr/AliFidutialCut.cxx b/PWG4/PartCorr/AliFidutialCut.cxx new file mode 100644 index 00000000000..b6f73a9a800 --- /dev/null +++ b/PWG4/PartCorr/AliFidutialCut.cxx @@ -0,0 +1,353 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: AliFidutialCut.cxx 21839 2007-10-29 13:49:42Z gustavo $ */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include +//#include + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliFidutialCut.h" + +ClassImp(AliFidutialCut) + + +//____________________________________________________________________________ +AliFidutialCut::AliFidutialCut() : + TObject(), + fEMCALFidutialCut(0), fPHOSFidutialCut(0), fCTSFidutialCut(0), + fCTSFidCutMinEta(0x0),fCTSFidCutMinPhi(0x0),fCTSFidCutMaxEta(0x0), fCTSFidCutMaxPhi(0x0), + fEMCALFidCutMinEta(0x0),fEMCALFidCutMinPhi(0x0),fEMCALFidCutMaxEta(0x0), fEMCALFidCutMaxPhi(0x0), + fPHOSFidCutMinEta(0x0),fPHOSFidCutMinPhi(0x0),fPHOSFidCutMaxEta(0x0), fPHOSFidCutMaxPhi(0x0) + +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliFidutialCut::AliFidutialCut(const AliFidutialCut & g) : + TObject(g), + fEMCALFidutialCut(g.fEMCALFidutialCut), fPHOSFidutialCut(g.fPHOSFidutialCut), fCTSFidutialCut(g. fCTSFidutialCut), + fCTSFidCutMinEta(g.fCTSFidCutMinEta?new TArrayF(*g.fCTSFidCutMinEta):0x0), + fCTSFidCutMinPhi(g.fCTSFidCutMinPhi?new TArrayF(*g.fCTSFidCutMinPhi):0x0), + fCTSFidCutMaxEta(g.fCTSFidCutMaxEta?new TArrayF(*g.fCTSFidCutMaxEta):0x0), + fCTSFidCutMaxPhi(g.fCTSFidCutMaxPhi?new TArrayF(*g.fCTSFidCutMaxPhi):0x0), + fEMCALFidCutMinEta(g.fEMCALFidCutMinEta?new TArrayF(*g.fEMCALFidCutMinEta):0x0), + fEMCALFidCutMinPhi(g.fEMCALFidCutMinPhi?new TArrayF(*g.fEMCALFidCutMinPhi):0x0), + fEMCALFidCutMaxEta(g.fEMCALFidCutMaxEta?new TArrayF(*g.fEMCALFidCutMaxEta):0x0), + fEMCALFidCutMaxPhi(g.fEMCALFidCutMaxPhi?new TArrayF(*g.fEMCALFidCutMaxPhi):0x0), + fPHOSFidCutMinEta(g.fPHOSFidCutMinEta?new TArrayF(*g.fPHOSFidCutMinEta):0x0), + fPHOSFidCutMinPhi(g.fPHOSFidCutMinPhi?new TArrayF(*g.fPHOSFidCutMinPhi):0x0), + fPHOSFidCutMaxEta(g.fPHOSFidCutMaxEta?new TArrayF(*g.fPHOSFidCutMaxEta):0x0), + fPHOSFidCutMaxPhi(g.fPHOSFidCutMaxPhi?new TArrayF(*g.fPHOSFidCutMaxPhi):0x0) + +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliFidutialCut & AliFidutialCut::operator = (const AliFidutialCut & source) +{ + // assignment operator + + if(&source == this) return *this; + + fEMCALFidutialCut = source.fEMCALFidutialCut; + fPHOSFidutialCut = source.fPHOSFidutialCut; + fCTSFidutialCut = source.fCTSFidutialCut; + + fCTSFidCutMinEta = source.fCTSFidCutMinEta?new TArrayF(*source.fCTSFidCutMinEta):0x0; + fCTSFidCutMinPhi = source.fCTSFidCutMinPhi?new TArrayF(*source.fCTSFidCutMinPhi):0x0; + fCTSFidCutMaxEta = source.fCTSFidCutMaxEta?new TArrayF(*source.fCTSFidCutMaxEta):0x0; + fCTSFidCutMaxPhi = source.fCTSFidCutMaxPhi?new TArrayF(*source.fCTSFidCutMaxPhi):0x0; + fEMCALFidCutMinEta = source.fEMCALFidCutMinEta?new TArrayF(*source.fEMCALFidCutMinEta):0x0; + fEMCALFidCutMinPhi = source.fEMCALFidCutMinPhi?new TArrayF(*source.fEMCALFidCutMinPhi):0x0; + fEMCALFidCutMaxEta = source.fEMCALFidCutMaxEta?new TArrayF(*source.fEMCALFidCutMaxEta):0x0; + fEMCALFidCutMaxPhi = source.fEMCALFidCutMaxPhi?new TArrayF(*source.fEMCALFidCutMaxPhi):0x0; + fPHOSFidCutMinEta = source.fPHOSFidCutMinEta?new TArrayF(*source.fPHOSFidCutMinEta):0x0; + fPHOSFidCutMinPhi = source.fPHOSFidCutMinPhi?new TArrayF(*source.fPHOSFidCutMinPhi):0x0; + fPHOSFidCutMaxEta = source.fPHOSFidCutMaxEta?new TArrayF(*source.fPHOSFidCutMaxEta):0x0; + fPHOSFidCutMaxPhi = source.fPHOSFidCutMaxPhi?new TArrayF(*source.fPHOSFidCutMaxPhi):0x0; + + return *this; + +} + +//_________________________________ +AliFidutialCut::~AliFidutialCut() { + //Dtor + + delete fCTSFidCutMinEta ; + delete fCTSFidCutMinPhi ; + delete fCTSFidCutMaxEta ; + delete fCTSFidCutMaxPhi ; + + delete fEMCALFidCutMinEta ; + delete fEMCALFidCutMinPhi ; + delete fEMCALFidCutMaxEta ; + delete fEMCALFidCutMaxPhi ; + + delete fPHOSFidCutMinEta ; + delete fPHOSFidCutMinPhi ; + delete fPHOSFidCutMaxEta ; + delete fPHOSFidCutMaxPhi ; + +} + + +//_______________________________________________________________ +Bool_t AliFidutialCut::IsInFidutialCut(TLorentzVector momentum, TString det) const +{ + //Selects EMCAL or PHOS cluster or CTS track if it is inside eta-phi defined regions + + Double_t phi = momentum.Phi(); + if(phi<0) phi+=TMath::TwoPi() ; + Double_t eta = momentum.Eta(); + //printf("IsInFidutialCut::Det: %s, phi = %f, eta = %f\n", det.Data(),phi*TMath::RadToDeg(), eta); + + Float_t * maxeta = new Float_t; + Float_t * maxphi = new Float_t; + Float_t * mineta = new Float_t; + Float_t * minphi = new Float_t; + Int_t nphiregions = 0; + Int_t netaregions = 0; + Bool_t selection = kFALSE; + + if(det == "CTS"){ + netaregions = fCTSFidCutMaxEta->GetSize(); + nphiregions = fCTSFidCutMaxPhi->GetSize(); + if(netaregions != fCTSFidCutMinEta->GetSize() || nphiregions != fCTSFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of CTS fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fCTSFidCutMinEta->GetSize(), nphiregions, fCTSFidCutMinPhi->GetSize())); + + maxeta = fCTSFidCutMaxEta->GetArray(); + maxphi = fCTSFidCutMaxPhi->GetArray(); + mineta = fCTSFidCutMinEta->GetArray(); + minphi = fCTSFidCutMinPhi->GetArray(); + selection = fCTSFidutialCut ; + } + else if(det == "EMCAL"){ + netaregions = fEMCALFidCutMaxEta->GetSize(); + nphiregions = fEMCALFidCutMaxPhi->GetSize(); + if(netaregions != fEMCALFidCutMinEta->GetSize() || nphiregions != fEMCALFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of EMCAL fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fEMCALFidCutMinEta->GetSize(), nphiregions, fEMCALFidCutMinPhi->GetSize())); + + maxeta = fEMCALFidCutMaxEta->GetArray(); + maxphi = fEMCALFidCutMaxPhi->GetArray(); + mineta = fEMCALFidCutMinEta->GetArray(); + minphi = fEMCALFidCutMinPhi->GetArray(); + selection = fEMCALFidutialCut ; + } + else if(det == "PHOS"){ + netaregions = fPHOSFidCutMaxEta->GetSize(); + nphiregions = fPHOSFidCutMaxPhi->GetSize(); + if(netaregions != fPHOSFidCutMinEta->GetSize() || nphiregions != fPHOSFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of PHOS fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fPHOSFidCutMinEta->GetSize(), nphiregions, fPHOSFidCutMinPhi->GetSize())); + + maxeta = fPHOSFidCutMaxEta->GetArray(); + maxphi = fPHOSFidCutMaxPhi->GetArray(); + mineta = fPHOSFidCutMinEta->GetArray(); + minphi = fPHOSFidCutMinPhi->GetArray(); + selection = fPHOSFidutialCut ; + } + else + AliFatal(Form("Wrong detector name = %s", det.Data())); + + //printf("IsInFidutialCut::nphiregions = %d, netaregions = %d\n",nphiregions, netaregions); + + if(!selection) return kTRUE; //No cuts applied, all tracks/clusters used + + //Eta fidutial cut + Bool_t bInEtaFidCut = kFALSE; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + if(eta > mineta[ieta] && eta < maxeta[ieta]) bInEtaFidCut = kTRUE; + + if(bInEtaFidCut){ + //printf("Eta cut passed\n"); + //Phi fidutial cut + Bool_t bInPhiFidCut = kFALSE; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + if(phi > minphi[iphi] *TMath::DegToRad()&& phi < maxphi[iphi]*TMath::DegToRad()) bInPhiFidCut = kTRUE ; + + if(bInPhiFidCut) { + //printf("IsInFidutialCut:: %s cluster/track accepted\n",det.Data()); + return kTRUE; + } + else return kFALSE; + + }//In eta fid cut + else + return kFALSE; + +} + + +//_______________________________________________________________ +void AliFidutialCut::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fEMCALFidutialCut = kTRUE ; + fPHOSFidutialCut = kTRUE ; + fCTSFidutialCut = kTRUE ; + + fCTSFidCutMinEta = new TArrayF(1); + fCTSFidCutMinEta->SetAt(-0.9,0); + fCTSFidCutMaxEta = new TArrayF(1); + fCTSFidCutMaxEta->SetAt(0.9,0); + + fCTSFidCutMinPhi = new TArrayF(1); + fCTSFidCutMinPhi->SetAt(0,0); + fCTSFidCutMaxPhi = new TArrayF(1); + fCTSFidCutMaxPhi->SetAt(360.,0); + + fEMCALFidCutMinEta = new TArrayF(1); + fEMCALFidCutMinEta->SetAt(-0.7,0); + fEMCALFidCutMaxEta = new TArrayF(1); + fEMCALFidCutMaxEta->SetAt(0.7,0); + + fEMCALFidCutMinPhi = new TArrayF(1); + fEMCALFidCutMinPhi->SetAt(80.,0); + fEMCALFidCutMaxPhi = new TArrayF(1); + fEMCALFidCutMaxPhi->SetAt(190.,0); + + fPHOSFidCutMinEta = new TArrayF(1); + fPHOSFidCutMinEta->SetAt(-0.13,0); + fPHOSFidCutMaxEta = new TArrayF(1); + fPHOSFidCutMaxEta->SetAt(0.13,0); + + fPHOSFidCutMinPhi = new TArrayF(1); + fPHOSFidCutMinPhi->SetAt(220.,0); + fPHOSFidCutMaxPhi = new TArrayF(1); + fPHOSFidCutMaxPhi->SetAt(320.,0); + +} + + +//________________________________________________________________ +void AliFidutialCut::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + + if(fCTSFidutialCut){ + Int_t netaregions = fCTSFidCutMaxEta->GetSize(); + Int_t nphiregions = fCTSFidCutMaxPhi->GetSize(); + printf(">> CTS Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fCTSFidCutMinEta->GetAt(ieta), fCTSFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fCTSFidCutMinPhi->GetAt(iphi), fCTSFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in CTS\n"); + + if(fEMCALFidutialCut){ + Int_t netaregions = fEMCALFidCutMaxEta->GetSize(); + Int_t nphiregions = fEMCALFidCutMaxPhi->GetSize(); + printf(">>EMCAL Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fEMCALFidCutMinEta->GetAt(ieta), fEMCALFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fEMCALFidCutMinPhi->GetAt(iphi), fEMCALFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in EMCAL\n"); + + if(fPHOSFidutialCut){ + Int_t netaregions = fPHOSFidCutMaxEta->GetSize(); + Int_t nphiregions = fPHOSFidCutMaxPhi->GetSize(); + printf(">>PHOS Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fPHOSFidCutMinEta->GetAt(ieta), fPHOSFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fPHOSFidCutMinPhi->GetAt(iphi), fPHOSFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in PHOS\n"); + printf(" \n") ; +} + + +//_______________________________________________________________ +void AliFidutialCut::SetSimpleCTSFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + + //Method to set simple acceptance cut to CTS + fCTSFidCutMinEta->Set(1); + fCTSFidCutMaxEta->Set(1); + fCTSFidCutMinPhi->Set(1); + fCTSFidCutMaxPhi->Set(1); + + fCTSFidCutMinEta->SetAt(-eta,0); + fCTSFidCutMaxEta->SetAt(eta,0); + fCTSFidCutMinPhi->SetAt(minphi,0); + fCTSFidCutMaxPhi->SetAt(maxphi,0); + + +} + + +//_______________________________________________________________ +void AliFidutialCut::SetSimpleEMCALFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + //Method to set simple acceptance cut to EMCAL + + fEMCALFidCutMinEta->Set(1); + fEMCALFidCutMaxEta->Set(1); + fEMCALFidCutMinPhi->Set(1); + fEMCALFidCutMaxPhi->Set(1); + + fEMCALFidCutMinEta->SetAt(-eta,0); + fEMCALFidCutMaxEta->SetAt(eta,0); + fEMCALFidCutMinPhi->SetAt(minphi,0); + fEMCALFidCutMaxPhi->SetAt(maxphi,0); + + +} + +//_______________________________________________________________ +void AliFidutialCut::SetSimplePHOSFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + + //Method to set simple acceptance cut to PHOS + fPHOSFidCutMinEta->Set(1); + fPHOSFidCutMaxEta->Set(1); + fPHOSFidCutMinPhi->Set(1); + fPHOSFidCutMaxPhi->Set(1); + + fPHOSFidCutMinEta->SetAt(-eta,0); + fPHOSFidCutMaxEta->SetAt(eta,0); + fPHOSFidCutMinPhi->SetAt(minphi,0); + fPHOSFidCutMaxPhi->SetAt(maxphi,0); + + +} diff --git a/PWG4/PartCorr/AliFidutialCut.h b/PWG4/PartCorr/AliFidutialCut.h new file mode 100644 index 00000000000..89b5d4c8fc1 --- /dev/null +++ b/PWG4/PartCorr/AliFidutialCut.h @@ -0,0 +1,132 @@ +#ifndef ALIFIDUTIALCUT_H +#define ALIFIDUTIALCUT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include + + class TString ; +class Riostream ; +class TLorentzVector ; + +//--- AliRoot system --- + +class AliLog ; + +class AliFidutialCut : public TObject { + +public: + + AliFidutialCut() ; // ctor + AliFidutialCut(const AliFidutialCut & g) ; // cpy ctor + AliFidutialCut & operator = (const AliFidutialCut & g) ;//cpy assignment + virtual ~AliFidutialCut() ;//virtual dtor + + void InitParameters(); + + void Print(const Option_t * opt)const; + + Bool_t IsInFidutialCut(TLorentzVector l, TString det) const ; + + void DoCTSFidutialCut(Bool_t b) {fCTSFidutialCut = b; } + void DoEMCALFidutialCut(Bool_t b) {fEMCALFidutialCut = b; } + void DoPHOSFidutialCut(Bool_t b) {fPHOSFidutialCut = b; } + + Bool_t GetCTSFidutialCutStatus() const {return fCTSFidutialCut ; } + Bool_t GetEMCALFidutialCut() const {return fEMCALFidutialCut ; } + Bool_t GetPHOSFidutialCutStatus() const {return fPHOSFidutialCut ; } + + void SetSimpleCTSFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + void SetSimpleEMCALFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + void SetSimplePHOSFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + + void AddCTSFidCutMaxEtaArray(TArrayF & array) + { fCTSFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMaxEtaArray() const {return fCTSFidCutMaxEta;} + + void AddCTSFidCutMaxPhiArray(TArrayF & array) + { fCTSFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMaxPhiArray() const {return fCTSFidCutMaxPhi;} + + void AddCTSFidCutMinEtaArray(TArrayF & array) + { fCTSFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMinEtaArray() const {return fCTSFidCutMinEta;} + + void AddCTSFidCutMinPhiArray(TArrayF & array) + { fCTSFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMinPhiArray() const {return fCTSFidCutMinPhi;} + + void AddEMCALFidCutMaxEtaArray(TArrayF & array) + { fEMCALFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMaxEtaArray() const {return fEMCALFidCutMaxEta;} + + void AddEMCALFidCutMaxPhiArray(TArrayF & array) + { fEMCALFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMaxPhiArray() const {return fEMCALFidCutMaxPhi;} + + void AddEMCALFidCutMinEtaArray(TArrayF & array) + { fEMCALFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMinEtaArray() const {return fEMCALFidCutMinEta;} + + void AddEMCALFidCutMinPhiArray(TArrayF & array) + { fEMCALFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMinPhiArray() const {return fEMCALFidCutMinPhi;} + + void AddPHOSFidCutMaxEtaArray(TArrayF & array) + { fPHOSFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMaxEtaArray() const {return fPHOSFidCutMaxEta;} + + void AddPHOSFidCutMaxPhiArray(TArrayF & array) + { fPHOSFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMaxPhiArray() const {return fPHOSFidCutMaxPhi;} + + void AddPHOSFidCutMinEtaArray(TArrayF & array) + { fPHOSFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMinEtaArray() const {return fPHOSFidCutMinEta;} + + void AddPHOSFidCutMinPhiArray(TArrayF & array) + { fPHOSFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMinPhiArray() const {return fPHOSFidCutMinPhi;} + + + + protected: + + //Detector acceptance cuts + Bool_t fEMCALFidutialCut ; // Apply fidutial cuts to EMCAL clusters + Bool_t fPHOSFidutialCut ;// Apply fidutial cuts to PHOS clusters + Bool_t fCTSFidutialCut ;//Apply fidutial cuts to CTS tracks + + TArrayF * fCTSFidCutMinEta ; //Take particles in CTS with eta > fCTSFidCutMinEta + TArrayF * fCTSFidCutMinPhi ; //Take particles in CTS with phi > fCTSFidCutMinPhi + TArrayF * fCTSFidCutMaxEta ; //Take particles in CTS with eta < fCTSFidCutMaxEta + TArrayF * fCTSFidCutMaxPhi ; //Take particles in CTS with phi > fCTSFidCutMaxPhi + + TArrayF * fEMCALFidCutMinEta ; //Take particles in EMCAL with eta > fEMCALFidCutMinEta + TArrayF * fEMCALFidCutMinPhi ; //Take particles in EMCAL with phi > fEMCALFidCutMinPhi + TArrayF * fEMCALFidCutMaxEta ; //Take particles in EMCAL with eta < fEMCALFidCutMaxEta + TArrayF * fEMCALFidCutMaxPhi ; //Take particles in EMCAL with phi > fEMCALFidCutMaxPhi + + TArrayF * fPHOSFidCutMinEta ; //Take particles in PHOS with eta > fPHOSFidCutMinEta + TArrayF * fPHOSFidCutMinPhi ; //Take particles in PHOS with phi > fPHOSFidCutMinPhi + TArrayF * fPHOSFidCutMaxEta ; //Take particles in PHOS with eta < fPHOSFidCutMaxEta + TArrayF * fPHOSFidCutMaxPhi ; //Take particles in PHOS with phi > fPHOSFidCutMaxPhi + + + ClassDef(AliFidutialCut,1) +} ; + + +#endif //ALIFIDUTIALCUT_H + + + diff --git a/PWG4/PartCorr/AliGammaConversionHistograms.cxx b/PWG4/PartCorr/AliGammaConversionHistograms.cxx new file mode 100644 index 00000000000..0359bacf198 --- /dev/null +++ b/PWG4/PartCorr/AliGammaConversionHistograms.cxx @@ -0,0 +1,1552 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * + * Version 1.0 * + * * + * 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. * + **************************************************************************/ +/** + * Class containing histograms + //Change here + // here we need a description of the naming scheme of the histograms. + +*/ + +#include "AliGammaConversionHistograms.h" +#include "TMath.h" + +using namespace std; + +ClassImp(AliGammaConversionHistograms) + + +AliGammaConversionHistograms::AliGammaConversionHistograms() : + fOutputContainer(NULL), + fNPhiIndex(0), + fNRIndex(0), + fMinRadius(0.), + fMaxRadius(0.), + fDeltaR(0.), + fMinPhi(0.), + fMaxPhi(0.), + fDeltaPhi(0.), + fMC_EP_R(NULL), + fMC_EP_Z_R(NULL), + fMC_EP_X_Y(NULL), + fMC_EP_OpeningAngle(NULL), + fMC_E_Energy(NULL), + fMC_E_Pt(NULL), + fMC_E_Eta(NULL), + fMC_E_Phi(NULL), + fMC_P_Energy(NULL), + fMC_P_Pt(NULL), + fMC_P_Eta(NULL), + fMC_P_Phi(NULL), + fMC_Gamma_Energy(NULL), + fMC_Gamma_Pt(NULL), + fMC_Gamma_Eta(NULL), + fMC_Gamma_Phi(NULL), + fMC_DirectGamma_Energy(NULL), + fMC_DirectGamma_Pt(NULL), + fMC_DirectGamma_Eta(NULL), + fMC_DirectGamma_Phi(NULL), + fMC_Mapping(), + fMC_Mapping_Phi(), + fMC_Mapping_R(), + fMC_Match_Gamma_Eta(NULL), + fMC_Match_Gamma_Phi(NULL), + fMC_Match_Gamma_Pt(NULL), + fMC_Match_Gamma_Energy(NULL), + fMC_Match_Gamma_Mass(NULL), + fMC_Match_Gamma_OpeningAngle(NULL), + fMC_Match_Gamma_R(NULL), + fMC_Match_Gamma_Z_R(NULL), + fMC_Match_Gamma_X_Y(NULL), + fMC_Pi0_Eta(NULL), + fMC_Pi0_Phi(NULL), + fMC_Pi0_Pt(NULL), + fMC_Pi0_Energy(NULL), + fMC_Pi0_Mass(NULL), + fMC_Pi0_OpeningAngleGamma(NULL), + fMC_Pi0_R(NULL), + fMC_Pi0_Z_R(NULL), + fMC_Pi0_X_Y(NULL), + fMC_Pi0Secondaries_Eta(NULL), + fMC_Pi0Secondaries_Phi(NULL), + fMC_Pi0Secondaries_Pt(NULL), + fMC_Pi0Secondaries_Energy(NULL), + fMC_Pi0Secondaries_Mass(NULL), + fMC_Pi0Secondaries_OpeningAngleGamma(NULL), + fMC_Pi0Secondaries_R(NULL), + fMC_Pi0Secondaries_Z_R(NULL), + fMC_Pi0Secondaries_X_Y(NULL), + fMC_Eta_Eta(NULL), + fMC_Eta_Phi(NULL), + fMC_Eta_Pt(NULL), + fMC_Eta_Energy(NULL), + fMC_Eta_Mass(NULL), + fMC_Eta_OpeningAngleGamma(NULL), + fMC_Eta_R(NULL), + fMC_Eta_Z_R(NULL), + fMC_Eta_X_Y(NULL), + fESD_EP_R(NULL), + fESD_EP_Z_R(NULL), + fESD_EP_X_Y(NULL), + fESD_EP_OpeningAngle(NULL), + fESD_E_Energy(NULL), + fESD_E_Pt(NULL), + fESD_E_Eta(NULL), + fESD_E_Phi(NULL), + fESD_P_Energy(NULL), + fESD_P_Pt(NULL), + fESD_P_Eta(NULL), + fESD_P_Phi(NULL), + fESD_Gamma_Energy(NULL), + fESD_Gamma_Pt(NULL), + fESD_Gamma_Eta(NULL), + fESD_Gamma_Phi(NULL), + fESD_Mapping(), + fESD_Mapping_Phi(), + fESD_Mapping_R(), + fESD_Match_Gamma_OpeningAngle(NULL), + fESD_Match_Gamma_Energy(NULL), + fESD_Match_Gamma_Pt(NULL), + fESD_Match_Gamma_Eta(NULL), + fESD_Match_Gamma_Phi(NULL), + fESD_Match_Gamma_Mass(NULL), + fESD_Match_Gamma_Width(NULL), + fESD_Match_Gamma_Chi2(NULL), + fESD_Match_Gamma_NDF(NULL), + fESD_Match_Gamma_R(NULL), + fESD_Match_Gamma_Z_R(NULL), + fESD_Match_Gamma_X_Y(NULL), + fESD_Pi0_OpeningAngleGamma(NULL), + fESD_Pi0_Energy(NULL), + fESD_Pi0_Pt(NULL), + fESD_Pi0_Eta(NULL), + fESD_Pi0_Phi(NULL), + fESD_Pi0_Mass(NULL), + fESD_Pi0_R(NULL), + fESD_Pi0_Z_R(NULL), + fESD_Pi0_X_Y(NULL), + fESD_Eta_OpeningAngleGamma(NULL), + fESD_Eta_Energy(NULL), + fESD_Eta_Pt(NULL), + fESD_Eta_Eta(NULL), + fESD_Eta_Phi(NULL), + fESD_Eta_Mass(NULL), + fESD_Eta_R(NULL), + fESD_Eta_Z_R(NULL), + fESD_Eta_X_Y(NULL), + fESD_Background_OpeningAngleGamma(NULL), + fESD_Background_Energy(NULL), + fESD_Background_Pt(NULL), + fESD_Background_Eta(NULL), + fESD_Background_Phi(NULL), + fESD_Background_Mass(NULL), + fESD_Background_R(NULL), + fESD_Background_Z_R(NULL), + fESD_Background_X_Y(NULL), + fResolution_dPt(NULL), + fResolution_dR(NULL), + fResolution_dZ(NULL), + fResolution_dR_dPt(NULL), + fResolution_MC_Pt(NULL), + fResolution_MC_R(NULL), + fResolution_MC_Z(NULL), + fResolution_ESD_Pt(NULL), + fResolution_ESD_R(NULL), + fResolution_ESD_Z(NULL), + fNumberOfV0s(NULL), + fNumberOfSurvivingV0s(NULL), + fV0MassDebugCut1(NULL), + fV0MassDebugCut2(NULL), + fV0MassDebugCut3(NULL), + fV0MassDebugCut4(NULL), + fV0MassDebugCut5(NULL), + fV0MassDebugCut6(NULL), + fV0MassDebugCut7(NULL), + fV0MassDebugCut8(NULL) +{ + +} + + +AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConversionHistograms & original) : + fOutputContainer(original.fOutputContainer), + fNPhiIndex(0), + fNRIndex(0), + fMinRadius(0.), + fMaxRadius(0.), + fDeltaR(0.), + fMinPhi(0.), + fMaxPhi(0.), + fDeltaPhi(0.), + fMC_EP_R(original.fMC_EP_R), + fMC_EP_Z_R(original.fMC_EP_Z_R), + fMC_EP_X_Y(original.fMC_EP_X_Y), + fMC_EP_OpeningAngle(original.fMC_EP_OpeningAngle), + fMC_E_Energy(original.fMC_E_Energy), + fMC_E_Pt(original.fMC_E_Pt), + fMC_E_Eta(original.fMC_E_Eta), + fMC_E_Phi(original.fMC_E_Phi), + fMC_P_Energy(original.fMC_P_Energy), + fMC_P_Pt(original.fMC_P_Pt), + fMC_P_Eta(original.fMC_P_Eta), + fMC_P_Phi(original.fMC_P_Phi), + fMC_Gamma_Energy(original.fMC_Gamma_Energy), + fMC_Gamma_Pt(original.fMC_Gamma_Pt), + fMC_Gamma_Eta(original.fMC_Gamma_Eta), + fMC_Gamma_Phi(original.fMC_Gamma_Phi), + fMC_DirectGamma_Energy(original.fMC_Gamma_Energy), + fMC_DirectGamma_Pt(original.fMC_Gamma_Pt), + fMC_DirectGamma_Eta(original.fMC_Gamma_Eta), + fMC_DirectGamma_Phi(original.fMC_Gamma_Phi), + fMC_Mapping(), + fMC_Mapping_Phi(), + fMC_Mapping_R(), + fMC_Match_Gamma_Eta(original.fMC_Match_Gamma_Eta), + fMC_Match_Gamma_Phi(original.fMC_Match_Gamma_Phi), + fMC_Match_Gamma_Pt(original.fMC_Match_Gamma_Pt), + fMC_Match_Gamma_Energy(original.fMC_Match_Gamma_Energy), + fMC_Match_Gamma_Mass(original.fMC_Match_Gamma_Mass), + fMC_Match_Gamma_OpeningAngle(original.fMC_Match_Gamma_OpeningAngle), + fMC_Match_Gamma_R(original.fMC_Match_Gamma_R), + fMC_Match_Gamma_Z_R(original.fMC_Match_Gamma_Z_R), + fMC_Match_Gamma_X_Y(original.fMC_Match_Gamma_X_Y), + fMC_Pi0_Eta(original.fMC_Pi0_Eta), + fMC_Pi0_Phi(original.fMC_Pi0_Phi), + fMC_Pi0_Pt(original.fMC_Pi0_Pt), + fMC_Pi0_Energy(original.fMC_Pi0_Energy), + fMC_Pi0_Mass(original.fMC_Pi0_Mass), + fMC_Pi0_OpeningAngleGamma(original.fMC_Pi0_OpeningAngleGamma), + fMC_Pi0_R(original.fMC_Pi0_R), + fMC_Pi0_Z_R(original.fMC_Pi0_Z_R), + fMC_Pi0_X_Y(original.fMC_Pi0_X_Y), + fMC_Pi0Secondaries_Eta(original.fMC_Pi0_Eta), + fMC_Pi0Secondaries_Phi(original.fMC_Pi0_Phi), + fMC_Pi0Secondaries_Pt(original.fMC_Pi0_Pt), + fMC_Pi0Secondaries_Energy(original.fMC_Pi0_Energy), + fMC_Pi0Secondaries_Mass(original.fMC_Pi0_Mass), + fMC_Pi0Secondaries_OpeningAngleGamma(original.fMC_Pi0_OpeningAngleGamma), + fMC_Pi0Secondaries_R(original.fMC_Pi0_R), + fMC_Pi0Secondaries_Z_R(original.fMC_Pi0_Z_R), + fMC_Pi0Secondaries_X_Y(original.fMC_Pi0Secondaries_X_Y), + fMC_Eta_Eta(original.fMC_Eta_Eta), + fMC_Eta_Phi(original.fMC_Eta_Phi), + fMC_Eta_Pt(original.fMC_Eta_Pt), + fMC_Eta_Energy(original.fMC_Eta_Energy), + fMC_Eta_Mass(original.fMC_Eta_Mass), + fMC_Eta_OpeningAngleGamma(original.fMC_Eta_OpeningAngleGamma), + fMC_Eta_R(original.fMC_Eta_R), + fMC_Eta_Z_R(original.fMC_Eta_Z_R), + fMC_Eta_X_Y(original.fMC_Eta_X_Y), + fESD_EP_R(original.fESD_EP_R), + fESD_EP_Z_R(original.fESD_EP_Z_R), + fESD_EP_X_Y(original.fESD_EP_X_Y), + fESD_EP_OpeningAngle(original.fESD_EP_OpeningAngle), + fESD_E_Energy(original.fESD_E_Energy), + fESD_E_Pt(original.fESD_E_Pt), + fESD_E_Eta(original.fESD_E_Eta), + fESD_E_Phi(original.fESD_E_Phi), + fESD_P_Energy(original.fESD_P_Energy), + fESD_P_Pt(original.fESD_P_Pt), + fESD_P_Eta(original.fESD_P_Eta), + fESD_P_Phi(original.fESD_P_Phi), + fESD_Gamma_Energy(original.fESD_Gamma_Energy), + fESD_Gamma_Pt(original.fESD_Gamma_Pt), + fESD_Gamma_Eta(original.fESD_Gamma_Eta), + fESD_Gamma_Phi(original.fESD_Gamma_Phi), + fESD_Mapping(original.fESD_Mapping), + fESD_Mapping_Phi(original.fESD_Mapping_Phi), + fESD_Mapping_R(original.fESD_Mapping_R), + fESD_Match_Gamma_OpeningAngle(original.fESD_Match_Gamma_OpeningAngle), + fESD_Match_Gamma_Energy(original.fESD_Match_Gamma_Energy), + fESD_Match_Gamma_Pt(original.fESD_Match_Gamma_Pt), + fESD_Match_Gamma_Eta(original.fESD_Match_Gamma_Eta), + fESD_Match_Gamma_Phi(original.fESD_Match_Gamma_Phi), + fESD_Match_Gamma_Mass(original.fESD_Match_Gamma_Mass), + fESD_Match_Gamma_Width(original.fESD_Match_Gamma_Width), + fESD_Match_Gamma_Chi2(original.fESD_Match_Gamma_Chi2), + fESD_Match_Gamma_NDF(original.fESD_Match_Gamma_NDF), + fESD_Match_Gamma_R(original.fESD_Match_Gamma_R), + fESD_Match_Gamma_Z_R(original.fESD_Match_Gamma_Z_R), + fESD_Match_Gamma_X_Y(original.fESD_Match_Gamma_X_Y), + fESD_Pi0_OpeningAngleGamma(original.fESD_Pi0_OpeningAngleGamma), + fESD_Pi0_Energy(original.fESD_Pi0_Energy), + fESD_Pi0_Pt(original.fESD_Pi0_Pt), + fESD_Pi0_Eta(original.fESD_Pi0_Eta), + fESD_Pi0_Phi(original.fESD_Pi0_Phi), + fESD_Pi0_Mass(original.fESD_Pi0_Mass), + fESD_Pi0_R(original.fESD_Pi0_R), + fESD_Pi0_Z_R(original.fESD_Pi0_Z_R), + fESD_Pi0_X_Y(original.fESD_Pi0_X_Y), + fESD_Eta_OpeningAngleGamma(original.fESD_Eta_OpeningAngleGamma), + fESD_Eta_Energy(original.fESD_Eta_Energy), + fESD_Eta_Pt(original.fESD_Eta_Pt), + fESD_Eta_Eta(original.fESD_Eta_Eta), + fESD_Eta_Phi(original.fESD_Eta_Phi), + fESD_Eta_Mass(original.fESD_Eta_Mass), + fESD_Eta_R(original.fESD_Eta_R), + fESD_Eta_Z_R(original.fESD_Eta_Z_R), + fESD_Eta_X_Y(original.fESD_Eta_X_Y), + fESD_Background_OpeningAngleGamma(original.fESD_Background_OpeningAngleGamma), + fESD_Background_Energy(original.fESD_Background_Energy), + fESD_Background_Pt(original.fESD_Background_Pt), + fESD_Background_Eta(original.fESD_Background_Eta), + fESD_Background_Phi(original.fESD_Background_Phi), + fESD_Background_Mass(original.fESD_Background_Mass), + fESD_Background_R(original.fESD_Background_R), + fESD_Background_Z_R(original.fESD_Background_Z_R), + fESD_Background_X_Y(original.fESD_Background_X_Y), + fResolution_dPt(original.fResolution_dPt), + fResolution_dR(original.fResolution_dR), + fResolution_dZ(original.fResolution_dZ), + fResolution_dR_dPt(original.fResolution_dR_dPt), + fResolution_MC_Pt(original.fResolution_MC_Pt), + fResolution_MC_R(original.fResolution_MC_R), + fResolution_MC_Z(original.fResolution_MC_Z), + fResolution_ESD_Pt(original.fResolution_ESD_Pt), + fResolution_ESD_R(original.fResolution_ESD_R), + fResolution_ESD_Z(original.fResolution_ESD_Z), + fNumberOfV0s(original.fNumberOfV0s), + fNumberOfSurvivingV0s(original.fNumberOfSurvivingV0s), + fV0MassDebugCut1(original.fV0MassDebugCut1), + fV0MassDebugCut2(original.fV0MassDebugCut2), + fV0MassDebugCut3(original.fV0MassDebugCut3), + fV0MassDebugCut4(original.fV0MassDebugCut4), + fV0MassDebugCut5(original.fV0MassDebugCut5), + fV0MassDebugCut6(original.fV0MassDebugCut6), + fV0MassDebugCut7(original.fV0MassDebugCut7), + fV0MassDebugCut8(original.fV0MassDebugCut8) +{ + +} + + +AliGammaConversionHistograms & AliGammaConversionHistograms::operator = (const AliGammaConversionHistograms & /*source*/) +{ + // assignment operator + return *this; +} + + +AliGammaConversionHistograms::~AliGammaConversionHistograms() { + if(fOutputContainer != NULL){ delete fOutputContainer;} + + if(fMC_EP_R != NULL){ delete fMC_EP_R;} + if(fMC_EP_Z_R != NULL){ delete fMC_EP_Z_R;} + if(fMC_EP_X_Y != NULL){ delete fMC_EP_X_Y;} + if(fMC_EP_OpeningAngle != NULL){ delete fMC_EP_OpeningAngle;} + + if(fMC_E_Energy != NULL){ delete fMC_E_Energy;} + if(fMC_E_Pt != NULL){ delete fMC_E_Pt;} + if(fMC_E_Eta != NULL){ delete fMC_E_Eta;} + if(fMC_E_Phi != NULL){ delete fMC_E_Phi;} + + if(fMC_P_Energy != NULL){ delete fMC_P_Energy;} + if(fMC_P_Pt != NULL){ delete fMC_P_Pt;} + if(fMC_P_Eta != NULL){ delete fMC_P_Eta;} + if(fMC_P_Phi != NULL){ delete fMC_P_Phi;} + + if(fMC_Gamma_Energy != NULL){ delete fMC_Gamma_Energy;} + if(fMC_Gamma_Pt != NULL){ delete fMC_Gamma_Pt;} + if(fMC_Gamma_Eta != NULL){ delete fMC_Gamma_Eta;} + if(fMC_Gamma_Phi != NULL){ delete fMC_Gamma_Phi;} + + if(fMC_DirectGamma_Energy != NULL){ delete fMC_DirectGamma_Energy;} + if(fMC_DirectGamma_Pt != NULL){ delete fMC_DirectGamma_Pt;} + if(fMC_DirectGamma_Eta != NULL){ delete fMC_DirectGamma_Eta;} + if(fMC_DirectGamma_Phi != NULL){ delete fMC_DirectGamma_Phi;} + + //mapping + for(UInt_t i=0;iSetName("Mapping Histograms"); + + if(fMC_EP_R != NULL){ fOutputContainer->Add(fMC_EP_R);} + if(fMC_EP_Z_R != NULL){ fOutputContainer->Add(fMC_EP_Z_R);} + if(fMC_EP_X_Y != NULL){ fOutputContainer->Add(fMC_EP_X_Y);} + if(fMC_EP_OpeningAngle != NULL){ fOutputContainer->Add(fMC_EP_OpeningAngle);} + + if(fMC_E_Energy != NULL){ fOutputContainer->Add(fMC_E_Energy);} + if(fMC_E_Pt != NULL){ fOutputContainer->Add(fMC_E_Pt);} + if(fMC_E_Eta != NULL){ fOutputContainer->Add(fMC_E_Eta);} + if(fMC_E_Phi != NULL){ fOutputContainer->Add(fMC_E_Phi);} + + if(fMC_P_Energy != NULL){ fOutputContainer->Add(fMC_P_Energy);} + if(fMC_P_Pt != NULL){ fOutputContainer->Add(fMC_P_Pt);} + if(fMC_P_Eta != NULL){ fOutputContainer->Add(fMC_P_Eta);} + if(fMC_P_Phi != NULL){ fOutputContainer->Add(fMC_P_Phi);} + + if(fMC_Gamma_Energy != NULL){ fOutputContainer->Add(fMC_Gamma_Energy);} + if(fMC_Gamma_Pt != NULL){ fOutputContainer->Add(fMC_Gamma_Pt);} + if(fMC_Gamma_Eta != NULL){ fOutputContainer->Add(fMC_Gamma_Eta);} + if(fMC_Gamma_Phi != NULL){ fOutputContainer->Add(fMC_Gamma_Phi);} + + if(fMC_DirectGamma_Energy != NULL){ fOutputContainer->Add(fMC_DirectGamma_Energy);} + if(fMC_DirectGamma_Pt != NULL){ fOutputContainer->Add(fMC_DirectGamma_Pt);} + if(fMC_DirectGamma_Eta != NULL){ fOutputContainer->Add(fMC_DirectGamma_Eta);} + if(fMC_DirectGamma_Phi != NULL){ fOutputContainer->Add(fMC_DirectGamma_Phi);} + + //mapping + for(UInt_t i=0;iAdd(fMC_Mapping[i][j]);} + } + } + for(UInt_t i=0;iAdd(fMC_Mapping_Phi[i]);} + } + for(UInt_t i=0;iAdd(fMC_Mapping_R[i]);} + } + if(fMC_Match_Gamma_Eta != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Eta);} + if(fMC_Match_Gamma_Phi != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Phi);} + if(fMC_Match_Gamma_Pt != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Pt);} + if(fMC_Match_Gamma_Energy != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Energy);} + if(fMC_Match_Gamma_Mass != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Mass);} + if(fMC_Match_Gamma_OpeningAngle != NULL){ fOutputContainer->Add(fMC_Match_Gamma_OpeningAngle);} + if(fMC_Match_Gamma_R != NULL){ fOutputContainer->Add(fMC_Match_Gamma_R);} + if(fMC_Match_Gamma_Z_R != NULL){ fOutputContainer->Add(fMC_Match_Gamma_Z_R);} + if(fMC_Match_Gamma_X_Y != NULL){ fOutputContainer->Add(fMC_Match_Gamma_X_Y);} + + if(fMC_Pi0_Eta != NULL){ fOutputContainer->Add(fMC_Pi0_Eta);} + if(fMC_Pi0_Phi != NULL){ fOutputContainer->Add(fMC_Pi0_Phi);} + if(fMC_Pi0_Pt != NULL){ fOutputContainer->Add(fMC_Pi0_Pt);} + if(fMC_Pi0_Energy != NULL){ fOutputContainer->Add(fMC_Pi0_Energy);} + if(fMC_Pi0_Mass != NULL){ fOutputContainer->Add(fMC_Pi0_Mass);} + if(fMC_Pi0_OpeningAngleGamma != NULL){ fOutputContainer->Add(fMC_Pi0_OpeningAngleGamma);} + if(fMC_Pi0_R != NULL){ fOutputContainer->Add(fMC_Pi0_R);} + if(fMC_Pi0_Z_R != NULL){ fOutputContainer->Add(fMC_Pi0_Z_R);} + if(fMC_Pi0_X_Y != NULL){ fOutputContainer->Add(fMC_Pi0_X_Y);} + if(fMC_Pi0Secondaries_X_Y != NULL){ fOutputContainer->Add(fMC_Pi0Secondaries_X_Y);} + + if(fMC_Eta_Eta != NULL){ fOutputContainer->Add(fMC_Eta_Eta);} + if(fMC_Eta_Phi != NULL){ fOutputContainer->Add(fMC_Eta_Phi);} + if(fMC_Eta_Pt != NULL){ fOutputContainer->Add(fMC_Eta_Pt);} + if(fMC_Eta_Energy != NULL){ fOutputContainer->Add(fMC_Eta_Energy);} + if(fMC_Eta_Mass != NULL){ fOutputContainer->Add(fMC_Eta_Mass);} + if(fMC_Eta_OpeningAngleGamma != NULL){ fOutputContainer->Add(fMC_Eta_OpeningAngleGamma);} + if(fMC_Eta_R != NULL){ fOutputContainer->Add(fMC_Eta_R);} + if(fMC_Eta_Z_R != NULL){ fOutputContainer->Add(fMC_Eta_Z_R);} + if(fMC_Eta_X_Y != NULL){ fOutputContainer->Add(fMC_Eta_X_Y);} + + // Histograms from esd tracks + if(fESD_EP_R != NULL){ fOutputContainer->Add(fESD_EP_R);} + if(fESD_EP_Z_R != NULL){ fOutputContainer->Add(fESD_EP_Z_R);} + if(fESD_EP_X_Y != NULL){ fOutputContainer->Add(fESD_EP_X_Y);} + if(fESD_EP_OpeningAngle != NULL){ fOutputContainer->Add(fESD_EP_OpeningAngle);} + + if(fESD_E_Energy != NULL){ fOutputContainer->Add(fESD_E_Energy);} + if(fESD_E_Pt != NULL){ fOutputContainer->Add(fESD_E_Pt);} + if(fESD_E_Eta != NULL){ fOutputContainer->Add(fESD_E_Eta);} + if(fESD_E_Phi != NULL){ fOutputContainer->Add(fESD_E_Phi);} + + if(fESD_P_Energy != NULL){ fOutputContainer->Add(fESD_P_Energy);} + if(fESD_P_Pt != NULL){ fOutputContainer->Add(fESD_P_Pt);} + if(fESD_P_Eta != NULL){ fOutputContainer->Add(fESD_P_Eta);} + if(fESD_P_Phi != NULL){ fOutputContainer->Add(fESD_P_Phi);} + + if(fESD_Gamma_Energy != NULL){ fOutputContainer->Add(fESD_Gamma_Energy);} + if(fESD_Gamma_Pt != NULL){ fOutputContainer->Add(fESD_Gamma_Pt);} + if(fESD_Gamma_Eta != NULL){ fOutputContainer->Add(fESD_Gamma_Eta);} + if(fESD_Gamma_Phi != NULL){ fOutputContainer->Add(fESD_Gamma_Phi);} + + //mapping + for(UInt_t i=0;iAdd(fESD_Mapping[i][j]);} + } + } + for(UInt_t i=0;iAdd(fESD_Mapping_Phi[i]);} + } + for(UInt_t i=0;iAdd(fESD_Mapping_R[i]);} + } + + fOutputContainer->Add(fMappingContainer); + + if(fESD_Match_Gamma_OpeningAngle != NULL){ fOutputContainer->Add(fESD_Match_Gamma_OpeningAngle);} + if(fESD_Match_Gamma_Energy != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Energy);} + if(fESD_Match_Gamma_Pt != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Pt);} + if(fESD_Match_Gamma_Eta != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Eta);} + if(fESD_Match_Gamma_Phi != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Phi);} + if(fESD_Match_Gamma_Mass != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Mass);} + if(fESD_Match_Gamma_Width != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Width);} + if(fESD_Match_Gamma_Chi2 != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Chi2);} + if(fESD_Match_Gamma_NDF != NULL){ fOutputContainer->Add(fESD_Match_Gamma_NDF);} + if(fESD_Match_Gamma_R != NULL){ fOutputContainer->Add(fESD_Match_Gamma_R);} + if(fESD_Match_Gamma_Z_R != NULL){ fOutputContainer->Add(fESD_Match_Gamma_Z_R);} + if(fESD_Match_Gamma_X_Y != NULL){ fOutputContainer->Add(fESD_Match_Gamma_X_Y);} + + if(fESD_Pi0_OpeningAngleGamma != NULL){ fOutputContainer->Add(fESD_Pi0_OpeningAngleGamma);} + if(fESD_Pi0_Energy != NULL){ fOutputContainer->Add(fESD_Pi0_Energy);} + if(fESD_Pi0_Pt != NULL){ fOutputContainer->Add(fESD_Pi0_Pt);} + if(fESD_Pi0_Eta != NULL){ fOutputContainer->Add(fESD_Pi0_Eta);} + if(fESD_Pi0_Phi != NULL){ fOutputContainer->Add(fESD_Pi0_Phi);} + if(fESD_Pi0_Mass != NULL){ fOutputContainer->Add(fESD_Pi0_Mass);} + if(fESD_Pi0_R != NULL){ fOutputContainer->Add(fESD_Pi0_R);} + if(fESD_Pi0_Z_R != NULL){ fOutputContainer->Add(fESD_Pi0_Z_R);} + if(fESD_Pi0_X_Y != NULL){ fOutputContainer->Add(fESD_Pi0_X_Y);} + + if(fESD_Eta_OpeningAngleGamma != NULL){ fOutputContainer->Add(fESD_Eta_OpeningAngleGamma);} + if(fESD_Eta_Energy != NULL){ fOutputContainer->Add(fESD_Eta_Energy);} + if(fESD_Eta_Pt != NULL){ fOutputContainer->Add(fESD_Eta_Pt);} + if(fESD_Eta_Eta != NULL){ fOutputContainer->Add(fESD_Eta_Eta);} + if(fESD_Eta_Phi != NULL){ fOutputContainer->Add(fESD_Eta_Phi);} + if(fESD_Eta_Mass != NULL){ fOutputContainer->Add(fESD_Eta_Mass);} + if(fESD_Eta_R != NULL){ fOutputContainer->Add(fESD_Eta_R);} + if(fESD_Eta_Z_R != NULL){ fOutputContainer->Add(fESD_Eta_Z_R);} + if(fESD_Eta_X_Y != NULL){ fOutputContainer->Add(fESD_Eta_X_Y);} + + if(fESD_Background_OpeningAngleGamma != NULL){ fOutputContainer->Add(fESD_Background_OpeningAngleGamma);} + if(fESD_Background_Energy != NULL){ fOutputContainer->Add(fESD_Background_Energy);} + if(fESD_Background_Pt != NULL){ fOutputContainer->Add(fESD_Background_Pt);} + if(fESD_Background_Eta != NULL){ fOutputContainer->Add(fESD_Background_Eta);} + if(fESD_Background_Phi != NULL){ fOutputContainer->Add(fESD_Background_Phi);} + if(fESD_Background_Mass != NULL){ fOutputContainer->Add(fESD_Background_Mass);} + if(fESD_Background_R != NULL){ fOutputContainer->Add(fESD_Background_R);} + if(fESD_Background_Z_R != NULL){ fOutputContainer->Add(fESD_Background_Z_R);} + if(fESD_Background_X_Y != NULL){ fOutputContainer->Add(fESD_Background_X_Y);} + + if(fResolution_dPt != NULL){ fOutputContainer->Add(fResolution_dPt);} + if(fResolution_dR != NULL){ fOutputContainer->Add(fResolution_dR);} + if(fResolution_dZ != NULL){ fOutputContainer->Add(fResolution_dZ);} + if(fResolution_dR_dPt != NULL){ fOutputContainer->Add(fResolution_dR_dPt);} + if(fResolution_MC_Pt != NULL){ fOutputContainer->Add(fResolution_MC_Pt);} + if(fResolution_MC_R != NULL){ fOutputContainer->Add(fResolution_MC_R);} + if(fResolution_MC_Z != NULL){ fOutputContainer->Add(fResolution_MC_Z);} + if(fResolution_ESD_Pt != NULL){ fOutputContainer->Add(fResolution_ESD_Pt);} + if(fResolution_ESD_R != NULL){ fOutputContainer->Add(fResolution_ESD_R);} + if(fResolution_ESD_Z != NULL){ fOutputContainer->Add(fResolution_ESD_Z);} + + if(fNumberOfV0s != NULL){fOutputContainer->Add(fNumberOfV0s);} + if(fNumberOfSurvivingV0s != NULL){fOutputContainer->Add(fNumberOfSurvivingV0s);} + if(fV0MassDebugCut1 != NULL){fOutputContainer->Add(fV0MassDebugCut1);} + if(fV0MassDebugCut2 != NULL){fOutputContainer->Add(fV0MassDebugCut2);} + if(fV0MassDebugCut3 != NULL){fOutputContainer->Add(fV0MassDebugCut3);} + if(fV0MassDebugCut4 != NULL){fOutputContainer->Add(fV0MassDebugCut4);} + if(fV0MassDebugCut5 != NULL){fOutputContainer->Add(fV0MassDebugCut5);} + if(fV0MassDebugCut6 != NULL){fOutputContainer->Add(fV0MassDebugCut6);} + if(fV0MassDebugCut7 != NULL){fOutputContainer->Add(fV0MassDebugCut7);} + if(fV0MassDebugCut8 != NULL){fOutputContainer->Add(fV0MassDebugCut8);} + + return fOutputContainer; +} + +Int_t AliGammaConversionHistograms::GetRBin(Double_t radius){ + Int_t iResult=0; + if(fDeltaR>0){ + iResult = (Int_t)((radius - fMinRadius)/fDeltaR); + } + return iResult; +} + +Int_t AliGammaConversionHistograms::GetPhiBin(Double_t phi){ + Int_t iResult=0; + if(fDeltaPhi>0){ + if(phi>TMath::Pi()){ + phi-=2*TMath::Pi(); + } + iResult = (Int_t)((phi - fMinPhi)/fDeltaPhi); + } + return iResult; +} + + + +// Initializing the valuse for the mapping +void AliGammaConversionHistograms::Initialize_MappingValues(Int_t nPhiIndex, Int_t nRIndex, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi){ + fNPhiIndex = nPhiIndex; + fNRIndex = nRIndex; + fMinRadius = minRadius; + fMaxRadius = maxRadius; + if(nBinsR>0){ + fDeltaR = (fMaxRadius - fMinRadius)/nRIndex; + } + fMinPhi = minPhi; + fMaxPhi = maxPhi; + if(nBinsPhi>0){ + fDeltaPhi = (fMaxPhi-fMinPhi)/nPhiIndex; + } +} + +//Initializing functions for the histograms +void AliGammaConversionHistograms::Initialize_MC_EP_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_EP_R = new TH1F("MC_EP_R", "", nXBins, firstX, lastX); + fMC_EP_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_EP_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_EP_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_EP_Z_R = new TH2F("MC_EP_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_EP_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_EP_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_EP_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_EP_X_Y = new TH2F("MC_EP_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_EP_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fMC_EP_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_EP_OpeningAngle(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_EP_OpeningAngle = new TH1F("MC_EP_OpeningAngle", "", nXBins, firstX, lastX); + fMC_EP_OpeningAngle->GetXaxis()->SetTitle(xAxisTitle); + fMC_EP_OpeningAngle->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_E_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_E_Energy = new TH1F("MC_E_Energy", "", nXBins, firstX, lastX); + fMC_E_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_E_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_E_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_E_Pt = new TH1F("MC_E_Pt", "", nXBins, firstX, lastX); + fMC_E_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_E_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_E_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_E_Eta = new TH1F("MC_E_Eta", "", nXBins, firstX, lastX); + fMC_E_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_E_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_E_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_E_Phi = new TH1F("MC_E_Phi", "", nXBins, firstX, lastX); + fMC_E_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_E_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_P_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_P_Energy = new TH1F("MC_P_Energy", "", nXBins, firstX, lastX); + fMC_P_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_P_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_P_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_P_Pt = new TH1F("MC_P_Pt", "", nXBins, firstX, lastX); + fMC_P_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_P_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_P_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_P_Eta = new TH1F("MC_P_Eta", "", nXBins, firstX, lastX); + fMC_P_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_P_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_P_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_P_Phi = new TH1F("MC_P_Phi", "", nXBins, firstX, lastX); + fMC_P_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_P_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Gamma_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Gamma_Energy = new TH1F("MC_Gamma_Energy", "", nXBins, firstX, lastX); + fMC_Gamma_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_Gamma_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Gamma_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Gamma_Pt = new TH1F("MC_Gamma_Pt", "", nXBins, firstX, lastX); + fMC_Gamma_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_Gamma_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Gamma_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Gamma_Eta = new TH1F("MC_Gamma_Eta", "", nXBins, firstX, lastX); + fMC_Gamma_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_Gamma_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Gamma_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Gamma_Phi = new TH1F("MC_Gamma_Phi", "", nXBins, firstX, lastX); + fMC_Gamma_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_Gamma_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_DirectGamma_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_DirectGamma_Energy = new TH1F("MC_DirectGamma_Energy", "", nXBins, firstX, lastX); + fMC_DirectGamma_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_DirectGamma_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_DirectGamma_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_DirectGamma_Pt = new TH1F("MC_DirectGamma_Pt", "", nXBins, firstX, lastX); + fMC_DirectGamma_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_DirectGamma_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_DirectGamma_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_DirectGamma_Eta = new TH1F("MC_DirectGamma_Eta", "", nXBins, firstX, lastX); + fMC_DirectGamma_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_DirectGamma_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_DirectGamma_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_DirectGamma_Phi = new TH1F("MC_DirectGamma_Phi", "", nXBins, firstX, lastX); + fMC_DirectGamma_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_DirectGamma_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +//mapping + + +void AliGammaConversionHistograms::Initialize_MappingHistograms(Int_t nPhiIndex, Int_t nRIndex,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + + for(Int_t phi =0; phi<=fNPhiIndex;phi++){ + AliConversionMappingVector tmpRowMC; + AliConversionMappingVector tmpRowESD; + for(Int_t r =0; rSetXTitle(xAxisTitle); + tmpMC->SetYTitle(yAxisTitle); + tmpRowMC.push_back(tmpMC); + //ESD + Char_t nameESD[100]; + sprintf(nameESD,"ESD_EP_Mapping-Phi%02d-R%02d",phi,r); + TH2F * tmpESD = new TH2F(nameESD,nameESD,nXBins,firstX,lastX,nYBins,firstY,lastY); + tmpESD->SetXTitle(xAxisTitle); + tmpESD->SetYTitle(yAxisTitle); + tmpRowESD.push_back(tmpESD); + } + fMC_Mapping.push_back(tmpRowMC); + fESD_Mapping.push_back(tmpRowESD); + } + + for(Int_t phi =0; phi<=nPhiIndex;phi++){ + //MC + Char_t nameMC[100]; + sprintf(nameMC,"MC_EP_Mapping-Phi%02d",phi); + TH2F * tmpMC = new TH2F(nameMC,nameMC,nXBins,firstX,lastX,nYBins,firstY,lastY); + tmpMC->SetXTitle(xAxisTitle); + tmpMC->SetYTitle(yAxisTitle); + fMC_Mapping_Phi.push_back(tmpMC); + //ESD + Char_t nameESD[100]; + sprintf(nameESD,"ESD_EP_Mapping-Phi%02d",phi); + TH2F * tmpESD = new TH2F(nameESD,nameESD,nXBins,firstX,lastX,nYBins,firstY,lastY); + tmpESD->SetXTitle(xAxisTitle); + tmpESD->SetYTitle(yAxisTitle); + fESD_Mapping_Phi.push_back(tmpESD); + } + for(Int_t r =0; r<=nRIndex;r++){ + //MC + Char_t nameMC[100]; + sprintf(nameMC,"MC_EP_Mapping-R%02d",r); + TH2F * tmpMC = new TH2F(nameMC,nameMC,nXBins,firstX,lastX,nYBins,firstY,lastY); + tmpMC->SetXTitle(xAxisTitle); + tmpMC->SetYTitle(yAxisTitle); + fMC_Mapping_R.push_back(tmpMC); + //ESD + Char_t nameESD[100]; + sprintf(nameESD,"ESD_EP_Mapping-R%02d",r); + TH2F * tmpESD = new TH2F(nameESD,nameESD,nXBins,firstX,lastX,nYBins,firstY,lastY); + tmpESD->SetXTitle(xAxisTitle); + tmpESD->SetYTitle(yAxisTitle); + fESD_Mapping_R.push_back(tmpESD); + } +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Eta = new TH1F("MC_Match_Gamma_Eta", "", nXBins, firstX, lastX); + fMC_Match_Gamma_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Phi = new TH1F("MC_Match_Gamma_Phi", "", nXBins, firstX, lastX); + fMC_Match_Gamma_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Pt = new TH1F("MC_Match_Gamma_Pt", "", nXBins, firstX, lastX); + fMC_Match_Gamma_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Energy = new TH1F("MC_Match_Gamma_Energy", "", nXBins, firstX, lastX); + fMC_Match_Gamma_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Mass = new TH1F("MC_Match_Gamma_Mass", "", nXBins, firstX, lastX); + fMC_Match_Gamma_Mass->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_OpeningAngle(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_OpeningAngle = new TH1F("MC_Match_Gamma_OpeningAngle", "", nXBins, firstX, lastX); + fMC_Match_Gamma_OpeningAngle->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_OpeningAngle->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_R = new TH1F("MC_Match_Gamma_R", "", nXBins, firstX, lastX); + fMC_Match_Gamma_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_Z_R = new TH2F("MC_Match_Gamma_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Match_Gamma_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Match_Gamma_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Match_Gamma_X_Y = new TH2F("MC_Match_Gamma_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Match_Gamma_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fMC_Match_Gamma_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Eta = new TH1F("MC_Pi0_Eta", "", nXBins, firstX, lastX); + fMC_Pi0_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Phi = new TH1F("MC_Pi0_Phi", "", nXBins, firstX, lastX); + fMC_Pi0_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Pt = new TH1F("MC_Pi0_Pt", "", nXBins, firstX, lastX); + fMC_Pi0_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Energy = new TH1F("MC_Pi0_Energy", "", nXBins, firstX, lastX); + fMC_Pi0_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Mass = new TH1F("MC_Pi0_Mass", "", nXBins, firstX, lastX); + fMC_Pi0_Mass->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_OpeningAngleGamma(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_OpeningAngleGamma = new TH1F("MC_Pi0_OpeningAngleGamma", "", nXBins, firstX, lastX); + fMC_Pi0_OpeningAngleGamma->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_OpeningAngleGamma->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_R = new TH1F("MC_Pi0_R", "", nXBins, firstX, lastX); + fMC_Pi0_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_Z_R = new TH2F("MC_Pi0_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Pi0_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0_X_Y = new TH2F("MC_Pi0_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Pi0_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Pi0Secondaries_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Pi0Secondaries_X_Y = new TH2F("MC_Pi0Secondaries_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Pi0Secondaries_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fMC_Pi0Secondaries_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Eta = new TH1F("MC_Eta_Eta", "", nXBins, firstX, lastX); + fMC_Eta_Eta->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Phi = new TH1F("MC_Eta_Phi", "", nXBins, firstX, lastX); + fMC_Eta_Phi->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Pt = new TH1F("MC_Eta_Pt", "", nXBins, firstX, lastX); + fMC_Eta_Pt->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Energy = new TH1F("MC_Eta_Energy", "", nXBins, firstX, lastX); + fMC_Eta_Energy->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Mass = new TH1F("MC_Eta_Mass", "", nXBins, firstX, lastX); + fMC_Eta_Mass->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_OpeningAngleGamma(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_OpeningAngleGamma = new TH1F("MC_Eta_OpeningAngleGamma", "", nXBins, firstX, lastX); + fMC_Eta_OpeningAngleGamma->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_OpeningAngleGamma->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_R = new TH1F("MC_Eta_R", "", nXBins, firstX, lastX); + fMC_Eta_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_Z_R = new TH2F("MC_Eta_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Eta_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_MC_Eta_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fMC_Eta_X_Y = new TH2F("MC_Eta_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fMC_Eta_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fMC_Eta_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} +// esd + +void AliGammaConversionHistograms::Initialize_ESD_EP_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_EP_R = new TH1F("ESD_EP_R", "", nXBins, firstX, lastX); + fESD_EP_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_EP_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_EP_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_EP_Z_R = new TH2F("ESD_EP_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_EP_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_EP_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_EP_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_EP_X_Y = new TH2F("ESD_EP_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_EP_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fESD_EP_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_EP_OpeningAngle(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_EP_OpeningAngle = new TH1F("ESD_EP_OpeningAngle", "", nXBins, firstX, lastX); + fESD_EP_OpeningAngle->GetXaxis()->SetTitle(xAxisTitle); + fESD_EP_OpeningAngle->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_E_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_E_Energy = new TH1F("ESD_E_Energy", "", nXBins, firstX, lastX); + fESD_E_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_E_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_E_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_E_Pt = new TH1F("ESD_E_Pt", "", nXBins, firstX, lastX); + fESD_E_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_E_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_E_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_E_Eta = new TH1F("ESD_E_Eta", "", nXBins, firstX, lastX); + fESD_E_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_E_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_E_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_E_Phi = new TH1F("ESD_E_Phi", "", nXBins, firstX, lastX); + fESD_E_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_E_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_P_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_P_Energy = new TH1F("ESD_P_Energy", "", nXBins, firstX, lastX); + fESD_P_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_P_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_P_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_P_Pt = new TH1F("ESD_P_Pt", "", nXBins, firstX, lastX); + fESD_P_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_P_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_P_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_P_Eta = new TH1F("ESD_P_Eta", "", nXBins, firstX, lastX); + fESD_P_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_P_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_P_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_P_Phi = new TH1F("ESD_P_Phi", "", nXBins, firstX, lastX); + fESD_P_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_P_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Gamma_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Gamma_Energy = new TH1F("ESD_Gamma_Energy", "", nXBins, firstX, lastX); + fESD_Gamma_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_Gamma_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Gamma_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Gamma_Pt = new TH1F("ESD_Gamma_Pt", "", nXBins, firstX, lastX); + fESD_Gamma_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_Gamma_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Gamma_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Gamma_Eta = new TH1F("ESD_Gamma_Eta", "", nXBins, firstX, lastX); + fESD_Gamma_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_Gamma_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Gamma_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Gamma_Phi = new TH1F("ESD_Gamma_Phi", "", nXBins, firstX, lastX); + fESD_Gamma_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_Gamma_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_OpeningAngle(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_OpeningAngle = new TH1F("ESD_Match_Gamma_OpeningAngle", "", nXBins, firstX, lastX); + fESD_Match_Gamma_OpeningAngle->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_OpeningAngle->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Energy = new TH1F("ESD_Match_Gamma_Energy", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Pt = new TH1F("ESD_Match_Gamma_Pt", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Eta = new TH1F("ESD_Match_Gamma_Eta", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Phi = new TH1F("ESD_Match_Gamma_Phi", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Mass = new TH1F("ESD_Match_Gamma_Mass", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Mass->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Width(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Width = new TH1F("ESD_Match_Gamma_Width", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Width->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Width->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Chi2(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Chi2 = new TH1F("ESD_Match_Gamma_Chi2", "", nXBins, firstX, lastX); + fESD_Match_Gamma_Chi2->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Chi2->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_NDF(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_NDF = new TH1F("ESD_Match_Gamma_NDF", "", nXBins, firstX, lastX); + fESD_Match_Gamma_NDF->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_NDF->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_R = new TH1F("ESD_Match_Gamma_R", "", nXBins, firstX, lastX); + fESD_Match_Gamma_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_Z_R = new TH2F("ESD_Match_Gamma_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Match_Gamma_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Match_Gamma_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Match_Gamma_X_Y = new TH2F("ESD_Match_Gamma_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Match_Gamma_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fESD_Match_Gamma_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_OpeningAngleGamma(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_OpeningAngleGamma = new TH1F("ESD_Pi0_OpeningAngleGamma", "", nXBins, firstX, lastX); + fESD_Pi0_OpeningAngleGamma->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_OpeningAngleGamma->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Energy = new TH1F("ESD_Pi0_Energy", "", nXBins, firstX, lastX); + fESD_Pi0_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Pt = new TH1F("ESD_Pi0_Pt", "", nXBins, firstX, lastX); + fESD_Pi0_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Eta = new TH1F("ESD_Pi0_Eta", "", nXBins, firstX, lastX); + fESD_Pi0_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Phi = new TH1F("ESD_Pi0_Phi", "", nXBins, firstX, lastX); + fESD_Pi0_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Mass = new TH1F("ESD_Pi0_Mass", "", nXBins, firstX, lastX); + fESD_Pi0_Mass->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_R = new TH1F("ESD_Pi0_R", "", nXBins, firstX, lastX); + fESD_Pi0_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_Z_R = new TH2F("ESD_Pi0_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Pi0_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Pi0_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Pi0_X_Y = new TH2F("ESD_Pi0_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Pi0_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fESD_Pi0_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_OpeningAngleGamma(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_OpeningAngleGamma = new TH1F("ESD_Eta_OpeningAngleGamma", "", nXBins, firstX, lastX); + fESD_Eta_OpeningAngleGamma->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_OpeningAngleGamma->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Energy = new TH1F("ESD_Eta_Energy", "", nXBins, firstX, lastX); + fESD_Eta_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Pt = new TH1F("ESD_Eta_Pt", "", nXBins, firstX, lastX); + fESD_Eta_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Eta = new TH1F("ESD_Eta_Eta", "", nXBins, firstX, lastX); + fESD_Eta_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Phi = new TH1F("ESD_Eta_Phi", "", nXBins, firstX, lastX); + fESD_Eta_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Mass = new TH1F("ESD_Eta_Mass", "", nXBins, firstX, lastX); + fESD_Eta_Mass->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_R = new TH1F("ESD_Eta_R", "", nXBins, firstX, lastX); + fESD_Eta_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_Z_R = new TH2F("ESD_Eta_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Eta_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Eta_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Eta_X_Y = new TH2F("ESD_Eta_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Eta_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fESD_Eta_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} +void AliGammaConversionHistograms::Initialize_ESD_Background_OpeningAngleGamma(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_OpeningAngleGamma = new TH1F("ESD_Background_OpeningAngleGamma", "", nXBins, firstX, lastX); + fESD_Background_OpeningAngleGamma->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_OpeningAngleGamma->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Energy(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Energy = new TH1F("ESD_Background_Energy", "", nXBins, firstX, lastX); + fESD_Background_Energy->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Energy->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Pt = new TH1F("ESD_Background_Pt", "", nXBins, firstX, lastX); + fESD_Background_Pt->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Eta(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Eta = new TH1F("ESD_Background_Eta", "", nXBins, firstX, lastX); + fESD_Background_Eta->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Eta->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Phi(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Phi = new TH1F("ESD_Background_Phi", "", nXBins, firstX, lastX); + fESD_Background_Phi->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Phi->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Mass(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Mass = new TH1F("ESD_Background_Mass", "", nXBins, firstX, lastX); + fESD_Background_Mass->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Mass->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_R = new TH1F("ESD_Background_R", "", nXBins, firstX, lastX); + fESD_Background_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_Z_R(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_Z_R = new TH2F("ESD_Background_Z_R", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Background_Z_R->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_Z_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_ESD_Background_X_Y(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fESD_Background_X_Y = new TH2F("ESD_Background_X_Y", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fESD_Background_X_Y->GetXaxis()->SetTitle(xAxisTitle); + fESD_Background_X_Y->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_dPt(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fResolution_dPt = new TH2F("Resolution_dPt", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fResolution_dPt->GetXaxis()->SetTitle(xAxisTitle); + fResolution_dPt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_dR(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fResolution_dR = new TH2F("Resolution_dR", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fResolution_dR->GetXaxis()->SetTitle(xAxisTitle); + fResolution_dR->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_dZ(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fResolution_dZ = new TH2F("Resolution_dZ", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fResolution_dZ->GetXaxis()->SetTitle(xAxisTitle); + fResolution_dZ->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_dR_dPt(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){ + fResolution_dR_dPt = new TH2F("Resolution_dR_dPt", "", nXBins, firstX, lastX, nYBins, firstY, lastY); + fResolution_dR_dPt->GetXaxis()->SetTitle(xAxisTitle); + fResolution_dR_dPt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_MC_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_MC_Pt = new TH1F("Resolution_MC_Pt", "", nXBins, firstX, lastX); + fResolution_MC_Pt->GetXaxis()->SetTitle(xAxisTitle); + fResolution_MC_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_MC_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_MC_R = new TH1F("Resolution_MC_R", "", nXBins, firstX, lastX); + fResolution_MC_R->GetXaxis()->SetTitle(xAxisTitle); + fResolution_MC_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_MC_Z(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_MC_Z = new TH1F("Resolution_MC_Z", "", nXBins, firstX, lastX); + fResolution_MC_Z->GetXaxis()->SetTitle(xAxisTitle); + fResolution_MC_Z->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_ESD_Pt(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_ESD_Pt = new TH1F("Resolution_ESD_Pt", "", nXBins, firstX, lastX); + fResolution_ESD_Pt->GetXaxis()->SetTitle(xAxisTitle); + fResolution_ESD_Pt->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_ESD_R(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_ESD_R = new TH1F("Resolution_ESD_R", "", nXBins, firstX, lastX); + fResolution_ESD_R->GetXaxis()->SetTitle(xAxisTitle); + fResolution_ESD_R->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_Resolution_ESD_Z(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fResolution_ESD_Z = new TH1F("Resolution_ESD_Z", "", nXBins, firstX, lastX); + fResolution_ESD_Z->GetXaxis()->SetTitle(xAxisTitle); + fResolution_ESD_Z->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_NumberOfV0s(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fNumberOfV0s = new TH1F("NumberOfV0s", "", nXBins, firstX, lastX); + fNumberOfV0s->GetXaxis()->SetTitle(xAxisTitle); + fNumberOfV0s->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_NumberOfSurvivingV0s(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fNumberOfSurvivingV0s = new TH1F("NumberOfSurvivingV0s", "", nXBins, firstX, lastX); + fNumberOfSurvivingV0s->GetXaxis()->SetTitle(xAxisTitle); + fNumberOfSurvivingV0s->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut1(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut1 = new TH1F("V0MassDebugCut1", "", nXBins, firstX, lastX); + fV0MassDebugCut1->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut1->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut2(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut2 = new TH1F("V0MassDebugCut2", "", nXBins, firstX, lastX); + fV0MassDebugCut2->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut2->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut3(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut3 = new TH1F("V0MassDebugCut3", "", nXBins, firstX, lastX); + fV0MassDebugCut3->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut3->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut4(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut4 = new TH1F("V0MassDebugCut4", "", nXBins, firstX, lastX); + fV0MassDebugCut4->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut4->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut5(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut5 = new TH1F("V0MassDebugCut5", "", nXBins, firstX, lastX); + fV0MassDebugCut5->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut5->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut6(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut6 = new TH1F("V0MassDebugCut6", "", nXBins, firstX, lastX); + fV0MassDebugCut6->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut6->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut7(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut7 = new TH1F("V0MassDebugCut7", "", nXBins, firstX, lastX); + fV0MassDebugCut7->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut7->GetYaxis()->SetTitle(yAxisTitle); +} + +void AliGammaConversionHistograms::Initialize_V0MassDebugCut8(Int_t nXBins, Double_t firstX, Double_t lastX, TString xAxisTitle, TString yAxisTitle){ + fV0MassDebugCut8 = new TH1F("V0MassDebugCut8", "", nXBins, firstX, lastX); + fV0MassDebugCut8->GetXaxis()->SetTitle(xAxisTitle); + fV0MassDebugCut8->GetYaxis()->SetTitle(yAxisTitle); +} diff --git a/PWG4/PartCorr/AliGammaConversionHistograms.h b/PWG4/PartCorr/AliGammaConversionHistograms.h new file mode 100644 index 00000000000..8d9f2a10503 --- /dev/null +++ b/PWG4/PartCorr/AliGammaConversionHistograms.h @@ -0,0 +1,388 @@ +#ifndef ALIGAMMACONVERSIONHISTOGRAMS_H +#define ALIGAMMACONVERSIONHISTOGRAMS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "TH1F.h" +#include "TH2F.h" +#include +#include +#include "TString.h" +#include "TList.h" + +class AliGammaConversionHistograms{ + + public: + + AliGammaConversionHistograms(); //constructor + AliGammaConversionHistograms(const AliGammaConversionHistograms & g); //copy constructor + AliGammaConversionHistograms & operator = (const AliGammaConversionHistograms & g); //assignment operator + virtual ~AliGammaConversionHistograms(); //virtual destructor + + + TList * GetOutputContainer(); + + Int_t GetRBin(Double_t radius); + Int_t GetPhiBin(Double_t phi); + + //Setters/Initializers + + void Initialize_MappingValues(Int_t nPhiHistograms, Int_t nRHistograms, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi); + + void Initialize_MC_EP_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_EP_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_EP_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_EP_OpeningAngle(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_E_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_E_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_E_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_E_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_P_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_P_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_P_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_P_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_Gamma_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Gamma_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Gamma_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Gamma_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_DirectGamma_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_DirectGamma_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_DirectGamma_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_DirectGamma_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + //mapping + void Initialize_MappingHistograms(Int_t nPhiHistograms, Int_t nRHistograms,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle); + + void Initialize_MC_Match_Gamma_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_OpeningAngle(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Match_Gamma_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_Pi0_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_OpeningAngleGamma(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Pi0Secondaries_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_MC_Eta_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_OpeningAngleGamma(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_MC_Eta_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + // esd + + void Initialize_ESD_EP_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_EP_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_EP_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_EP_OpeningAngle(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_ESD_E_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_E_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_E_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_E_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_ESD_P_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_P_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_P_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_P_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + + void Initialize_ESD_Gamma_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Gamma_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Gamma_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Gamma_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_ESD_Match_Gamma_OpeningAngle(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Width(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Chi2(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_NDF(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Match_Gamma_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + + void Initialize_ESD_Pi0_OpeningAngleGamma(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Pi0_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + + void Initialize_ESD_Eta_OpeningAngleGamma(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Eta_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_ESD_Background_OpeningAngleGamma(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Energy(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Eta(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Phi(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Mass(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_Z_R(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_ESD_Background_X_Y(Int_t nXBins,Double_t firstX,Double_t lastX,Int_t nYBins,Double_t firstY,Double_t lastY,TString xAxisTitle="", TString yAxisTitle=""); + + + void Initialize_Resolution_dPt(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle); + void Initialize_Resolution_dR(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle); + void Initialize_Resolution_dZ(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle); + void Initialize_Resolution_dR_dPt(Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle); + + void Initialize_Resolution_MC_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_Resolution_MC_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_Resolution_MC_Z(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_Resolution_ESD_Pt(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_Resolution_ESD_R(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_Resolution_ESD_Z(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_NumberOfV0s(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_NumberOfSurvivingV0s(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + void Initialize_V0MassDebugCut1(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut2(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut3(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut4(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut5(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut6(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut7(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + void Initialize_V0MassDebugCut8(Int_t nXBins,Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle=""); + + private: + TList* fOutputContainer; + + Int_t fNPhiIndex; + Int_t fNRIndex; + Double_t fMinRadius; + Double_t fMaxRadius; + Double_t fDeltaR; + Double_t fMinPhi; + Double_t fMaxPhi; + Double_t fDeltaPhi; + + + + // Pure MonteCarlo histograms + TH1F * fMC_EP_R; //! transient + TH2F * fMC_EP_Z_R; //! transient + TH2F * fMC_EP_X_Y; //! transient + TH1F * fMC_EP_OpeningAngle; //! transient + + TH1F * fMC_E_Energy; //! transient + TH1F * fMC_E_Pt; //! transient + TH1F * fMC_E_Eta; //! transient + TH1F * fMC_E_Phi; //! transient + + TH1F * fMC_P_Energy; //! transient + TH1F * fMC_P_Pt; //! transient + TH1F * fMC_P_Eta; //! transient + TH1F * fMC_P_Phi; //! transient + + TH1F * fMC_Gamma_Energy; //! transient + TH1F * fMC_Gamma_Pt; //! transient + TH1F * fMC_Gamma_Eta; //! transient + TH1F * fMC_Gamma_Phi; //! transient + + TH1F * fMC_DirectGamma_Energy; //! transient + TH1F * fMC_DirectGamma_Pt; //! transient + TH1F * fMC_DirectGamma_Eta; //! transient + TH1F * fMC_DirectGamma_Phi; //! transient + + //mapping + //begin double vector + typedef vector AliConversionMappingVector; //! transient + vector fMC_Mapping; //! transient + //end double vector + + vector fMC_Mapping_Phi; //! transient + vector fMC_Mapping_R; //! transient + + TH1F * fMC_Match_Gamma_Eta; //! transient + TH1F * fMC_Match_Gamma_Phi; //! transient + TH1F * fMC_Match_Gamma_Pt; //! transient + TH1F * fMC_Match_Gamma_Energy; //! transient + TH1F * fMC_Match_Gamma_Mass; //! transient + TH1F * fMC_Match_Gamma_OpeningAngle;//! transient + TH1F * fMC_Match_Gamma_R; //! transient + TH2F * fMC_Match_Gamma_Z_R; //! transient + TH2F * fMC_Match_Gamma_X_Y; //! transient + + + TH1F * fMC_Pi0_Eta; //! transient + TH1F * fMC_Pi0_Phi; //! transient + TH1F * fMC_Pi0_Pt; //! transient + TH1F * fMC_Pi0_Energy; //! transient + TH1F * fMC_Pi0_Mass; //! transient Not filled, no point, we know the montecarlo mass + TH1F * fMC_Pi0_OpeningAngleGamma; //! transient + TH1F * fMC_Pi0_R; //! transient + TH2F * fMC_Pi0_Z_R; //! transient + TH2F * fMC_Pi0_X_Y; //! transient + + TH1F * fMC_Pi0Secondaries_Eta; //! transient + TH1F * fMC_Pi0Secondaries_Phi; //! transient + TH1F * fMC_Pi0Secondaries_Pt; //! transient + TH1F * fMC_Pi0Secondaries_Energy; //! transient + TH1F * fMC_Pi0Secondaries_Mass; //! transient Not filled, no point, we know the monteacrlo mass + TH1F * fMC_Pi0Secondaries_OpeningAngleGamma; //! transient + TH1F * fMC_Pi0Secondaries_R; //! transient + TH2F * fMC_Pi0Secondaries_Z_R; //! transient + TH2F * fMC_Pi0Secondaries_X_Y; + + TH1F * fMC_Eta_Eta; //! transient + TH1F * fMC_Eta_Phi; //! transient + TH1F * fMC_Eta_Pt; //! transient + TH1F * fMC_Eta_Energy; //! transient + TH1F * fMC_Eta_Mass; //! transient Not Filled, no point we know the montecarlo mass + TH1F * fMC_Eta_OpeningAngleGamma; //! transient + TH1F * fMC_Eta_R; //! transient We have very few eta secondaries, so the question is if we keep this + TH2F * fMC_Eta_Z_R; //! transient Same here, do we really need it? + TH2F * fMC_Eta_X_Y; //! transient all the etas has their vertex in a square in the collision point + + // Histograms from esd tracks + TH1F * fESD_EP_R; //! transient + TH2F * fESD_EP_Z_R; //! transient + TH2F * fESD_EP_X_Y; //! transient + TH1F * fESD_EP_OpeningAngle; //! transient + + TH1F * fESD_E_Energy; //! transient + TH1F * fESD_E_Pt; //! transient + TH1F * fESD_E_Eta; //! transient + TH1F * fESD_E_Phi; //! transient + + TH1F * fESD_P_Energy; //! transient + TH1F * fESD_P_Pt; //! transient + TH1F * fESD_P_Eta; //! transient + TH1F * fESD_P_Phi; //! transient + + + TH1F * fESD_Gamma_Energy; //! transient + TH1F * fESD_Gamma_Pt; //! transient + TH1F * fESD_Gamma_Eta; //! transient + TH1F * fESD_Gamma_Phi; //! transient + + + //mapping + //begin double vector + typedef vector fESDPhiRVector; //! transient + vector fESD_Mapping; //! transient + //end double vector + vector fESD_Mapping_Phi; //! transient + vector fESD_Mapping_R; //! transient + + TH1F * fESD_Match_Gamma_OpeningAngle; //! transient + TH1F * fESD_Match_Gamma_Energy; //! transient + TH1F * fESD_Match_Gamma_Pt; //! transient + TH1F * fESD_Match_Gamma_Eta; //! transient + TH1F * fESD_Match_Gamma_Phi; //! transient + TH1F * fESD_Match_Gamma_Mass; //! transient + TH1F * fESD_Match_Gamma_Width; //! transient + TH1F * fESD_Match_Gamma_Chi2; //! transient + TH1F * fESD_Match_Gamma_NDF; //! transient + TH1F * fESD_Match_Gamma_R; //! transient + TH2F * fESD_Match_Gamma_Z_R; //! transient + TH2F * fESD_Match_Gamma_X_Y; //! transient + + + TH1F * fESD_Pi0_OpeningAngleGamma; //! transient + TH1F * fESD_Pi0_Energy; //! transient + TH1F * fESD_Pi0_Pt; //! transient + TH1F * fESD_Pi0_Eta; //! transient + TH1F * fESD_Pi0_Phi; //! transient + TH1F * fESD_Pi0_Mass; //! transient + TH1F * fESD_Pi0_R; //! transient + TH2F * fESD_Pi0_Z_R; //! transient + TH2F * fESD_Pi0_X_Y; //! transient + + TH1F * fESD_Eta_OpeningAngleGamma; //! transient + TH1F * fESD_Eta_Energy; //! transient + TH1F * fESD_Eta_Pt; //! transient + TH1F * fESD_Eta_Eta; //! transient + TH1F * fESD_Eta_Phi; //! transient + TH1F * fESD_Eta_Mass; //! transient + TH1F * fESD_Eta_R; //! transient + TH2F * fESD_Eta_Z_R; //! transient + TH2F * fESD_Eta_X_Y; //! transient + + TH1F * fESD_Background_OpeningAngleGamma; //! transient + TH1F * fESD_Background_Energy; //! transient + TH1F * fESD_Background_Pt; //! transient + TH1F * fESD_Background_Eta; //! transient + TH1F * fESD_Background_Phi; //! transient + TH1F * fESD_Background_Mass; //! transient + TH1F * fESD_Background_R; //! transient + TH2F * fESD_Background_Z_R; //! transient + TH2F * fESD_Background_X_Y; //! transient + + TH2F * fResolution_dPt; //! transient + TH2F * fResolution_dR; //! transient + TH2F * fResolution_dZ; //! transient + + TH2F * fResolution_dR_dPt; //! transient + + TH1F * fResolution_MC_Pt; //! transient + TH1F * fResolution_MC_R; //! transient + TH1F * fResolution_MC_Z; //! transient + + TH1F * fResolution_ESD_Pt; //! transient + TH1F * fResolution_ESD_R; //! transient + TH1F * fResolution_ESD_Z; //! transient + + TH1F * fNumberOfV0s; //! transient + TH1F * fNumberOfSurvivingV0s; //! transient + + // debug histograms + TH1F * fV0MassDebugCut1; //! transient + TH1F * fV0MassDebugCut2; //! transient + TH1F * fV0MassDebugCut3; //! transient + TH1F * fV0MassDebugCut4; //! transient + TH1F * fV0MassDebugCut5; //! transient + TH1F * fV0MassDebugCut6; //! transient + TH1F * fV0MassDebugCut7; //! transient + TH1F * fV0MassDebugCut8; //! transient + + + friend class AliAnalysisTaskGammaConversion; + friend class AliV0Reader; + + ClassDef(AliGammaConversionHistograms,0) +} ; + + +#endif + + + diff --git a/PWG4/PartCorr/AliIsolationCut.cxx b/PWG4/PartCorr/AliIsolationCut.cxx new file mode 100644 index 00000000000..4bd74bc0011 --- /dev/null +++ b/PWG4/PartCorr/AliIsolationCut.cxx @@ -0,0 +1,204 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: $ */ + +//_________________________________________________________________________ +// Class containing methods for the isolation cut. +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include + +// --- AliRoot system --- +#include "AliIsolationCut.h" +#include "AliLog.h" +#include "AliAODParticleCorrelation.h" +#include "AliAODTrack.h" +#include "AliAODCaloCluster.h" + +ClassImp(AliIsolationCut) + +//____________________________________________________________________________ + AliIsolationCut::AliIsolationCut() : + TObject(), + fConeSize(0.),fPtThreshold(0.), fPtFraction(0.), fICMethod(0) + +{ + //default ctor + + //Initialize parameters + InitParameters(); + +} + +//____________________________________________________________________________ +AliIsolationCut::AliIsolationCut(const AliIsolationCut & g) : + TObject(g), + fConeSize(g.fConeSize), + fPtThreshold(g.fPtThreshold), + fPtFraction(g.fPtFraction), + fICMethod(g.fICMethod) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliIsolationCut & AliIsolationCut::operator = (const AliIsolationCut & source) +{ + // assignment operator + + if(&source == this) return *this; + + fConeSize = source.fConeSize ; + fPtThreshold = source.fPtThreshold ; + fICMethod = source.fICMethod ; + fPtFraction = source.fPtFraction ; + + return *this; + +} + + + + + //____________________________________________________________________________ +void AliIsolationCut::InitParameters() +{ + //Initialize the parameters of the analysis. + + fConeSize = 0.4 ; + fPtThreshold = 1. ; + fPtFraction = 0.1 ; + + fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method + +} + +//__________________________________________________________________ +void AliIsolationCut::MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex, + const Bool_t fillAOD, AliAODParticleCorrelation *pCandidate, + const Int_t index1, const Int_t index2, + Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) +{ + //Search in cone around a candidate particle if it is isolated + Float_t phiC = pCandidate->Phi() ; + Float_t etaC = pCandidate->Eta() ; + Float_t ptC = pCandidate->Pt() ; + Float_t pt = -100. ; + Float_t eta = -100. ; + Float_t phi = -100. ; + Float_t rad = -100 ; + + n = 0 ; + coneptsum = 0.; + isolated = kFALSE; + + //Check charged particles in cone. + if(plCTS){ + TVector3 p3; + for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){ + if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate + AliAODTrack* track = dynamic_cast(plCTS->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + pt = p3.Pt(); + eta = p3.Eta(); + phi = p3.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + + //Check if there is any particle inside cone with pt larger than fPtThreshold + rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); + + if(rad < fConeSize){ + if(fillAOD) pCandidate->AddIsolationConeTrack(track); + //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); + coneptsum+=pt; + if(pt > fPtThreshold ) n++; + if(pt > fPtFraction*ptC ) nfrac++; + } + }// charged particle loop + }//Tracks + + //Check neutral particles in cone. + if(plNe){ + TLorentzVector mom ; + for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){ + if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(plNe->At(ipr)) ; + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) continue ; + + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pt = mom.Pt(); + eta = mom.Eta(); + phi = mom.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + + //Check if there is any particle inside cone with pt larger than fPtThreshold + rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); + if(rad < fConeSize){ + if(fillAOD) pCandidate->AddIsolationConeCluster(calo); + //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); + coneptsum+=pt; + if(pt > fPtThreshold ) n++; + if(pt > fPtFraction*ptC ) nfrac++; + }//in cone + }// neutral particle loop + }//neutrals + + //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac); + + //Check isolation, depending on method. + if( fICMethod == kPtThresIC){ + if(n==0) isolated = kTRUE ; + } + else if( fICMethod == kSumPtIC){ + if(coneptsum < fPtThreshold) + isolated = kTRUE ; + } + else if( fICMethod == kPtFracIC){ + if(nfrac==0) isolated = kTRUE ; + } + else if( fICMethod == kSumPtFracIC){ + if(coneptsum < fPtFraction*ptC) + isolated = kTRUE ; + } +} + +//__________________________________________________________________ +void AliIsolationCut::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ; + + printf("IC method = %d\n", fICMethod) ; + printf("Cone Size = %1.2f\n", fConeSize) ; + printf("pT threshold = %2.1f\n", fPtThreshold) ; + printf("pT fraction = %3.1f\n", fPtFraction) ; + + printf(" \n") ; + +} diff --git a/PWG4/PartCorr/AliIsolationCut.h b/PWG4/PartCorr/AliIsolationCut.h new file mode 100644 index 00000000000..5152dcb327d --- /dev/null +++ b/PWG4/PartCorr/AliIsolationCut.h @@ -0,0 +1,74 @@ +#ifndef AliIsolationCut_H +#define AliIsolationCut_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: */ + +//_________________________________________________________________________ + +// Class containing methods for the isolation cut. +// +// +// + +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +//#include +class TSeqCollection ; + +// --- ANALYSIS system --- +//#include +class AliAODParticleCorrelation ; + +class AliIsolationCut : public TObject { + + public: + + AliIsolationCut() ; // default ctor + AliIsolationCut(const AliIsolationCut & g) ; // cpy ctor + AliIsolationCut & operator = (const AliIsolationCut & g) ;//cpy assignment + virtual ~AliIsolationCut() {;} //virtual dtalr + + enum type {kPtThresIC, kSumPtIC, kPtFracIC, kSumPtFracIC}; + + Float_t GetConeSize() const {return fConeSize ; } + Float_t GetPtThreshold() const {return fPtThreshold ; } + Float_t GetPtFraction() const {return fPtFraction ; } + Int_t GetICMethod() const {return fICMethod ; } + + void MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex, + const Bool_t fillAOD, AliAODParticleCorrelation * pCandidate, + const Int_t index1, const Int_t index2, + Int_t &n, Int_t & nfrac, Float_t &ptsum, Bool_t & isolated) ; + + void Print(const Option_t * opt)const; + + void SetConeSize(Float_t r) {fConeSize = r ; } + void SetPtThreshold(Float_t pt) {fPtThreshold = pt; } + void SetPtFraction(Float_t pt) {fPtFraction = pt; } + void SetICMethod(Int_t i ) {fICMethod = i ; } + + void InitParameters(); + + + private: + + Float_t fConeSize ; //Size of the isolation cone + Float_t fPtThreshold ; //Mimium pt of the particles in the cone or sum in cone + Float_t fPtFraction ; //Fraction of the momentum of particles in cone or sum in cone + Int_t fICMethod ; //Isolation cut method to be used + // kPtIC: Pt threshold method + // kSumPtIC: Cone pt sum method + // kPtFracIC: Pt threshold, fraction of candidate pt, method + // kSumPtFracIC: Cone pt sum , fraction of cone sum, method + + ClassDef(AliIsolationCut,1) +} ; + + +#endif //AliIsolationCut_H + + + diff --git a/PWG4/PartCorr/AliNeutralMesonSelection.cxx b/PWG4/PartCorr/AliNeutralMesonSelection.cxx new file mode 100644 index 00000000000..15143c9fef2 --- /dev/null +++ b/PWG4/PartCorr/AliNeutralMesonSelection.cxx @@ -0,0 +1,277 @@ + /************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ +/* $Id: AliNeutralMesonSelection.cxx 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ +// Class that contains methods to select candidate pairs to neutral meson +// 2 main selections, invariant mass around pi0 (also any other mass), +// apperture angle to distinguish from combinatorial. +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include +#include +#include + +//---- AliRoot system ---- +#include "AliNeutralMesonSelection.h" +#include "AliLog.h" + +ClassImp(AliNeutralMesonSelection) + + +//____________________________________________________________________________ + AliNeutralMesonSelection::AliNeutralMesonSelection() : + TObject(), fM(0), + fInvMassMaxCut(0.), fInvMassMinCut(0.), + fAngleMaxParam(), fKeepNeutralMesonHistos(0), + fhAnglePairNoCut(0), fhAnglePairOpeningAngleCut(0), + fhAnglePairAllCut(0), + fhInvMassPairNoCut(0), fhInvMassPairOpeningAngleCut(0), + fhInvMassPairAllCut(0) +{ + //Default Ctor + + //Initialize parameters + + // kGammaHadron and kGammaJet + fAngleMaxParam.Set(4) ; + fAngleMaxParam.Reset(0.); + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliNeutralMesonSelection::AliNeutralMesonSelection(const AliNeutralMesonSelection & g) : + TObject(), fM(g.fM), + fInvMassMaxCut(g.fInvMassMaxCut), fInvMassMinCut(g.fInvMassMinCut), + fAngleMaxParam(g.fAngleMaxParam), + fKeepNeutralMesonHistos(g.fKeepNeutralMesonHistos), + fhAnglePairNoCut(g. fhAnglePairNoCut), + fhAnglePairOpeningAngleCut(g. fhAnglePairOpeningAngleCut), + fhAnglePairAllCut(g. fhAnglePairAllCut), + fhInvMassPairNoCut(g.fhInvMassPairNoCut), + fhInvMassPairOpeningAngleCut(g.fhInvMassPairOpeningAngleCut), + fhInvMassPairAllCut(g.fhInvMassPairAllCut) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliNeutralMesonSelection & AliNeutralMesonSelection::operator = (const AliNeutralMesonSelection & source) +{ + // assignment operator + + if(this == &source)return *this; + ((TObject *)this)->operator=(source); + + fM = source.fM ; + fInvMassMaxCut = source.fInvMassMaxCut ; + fInvMassMinCut = source.fInvMassMinCut ; + fAngleMaxParam = source.fAngleMaxParam ; + fKeepNeutralMesonHistos = source.fKeepNeutralMesonHistos; + + fhAnglePairNoCut = source. fhAnglePairNoCut ; + fhAnglePairOpeningAngleCut = source. fhAnglePairOpeningAngleCut ; + fhAnglePairAllCut = source. fhAnglePairAllCut ; + fhInvMassPairNoCut = source.fhInvMassPairNoCut ; + fhInvMassPairOpeningAngleCut = source.fhInvMassPairOpeningAngleCut ; + fhInvMassPairAllCut = source.fhInvMassPairAllCut ; + + return *this; + +} + +//____________________________________________________________________________ +AliNeutralMesonSelection::~AliNeutralMesonSelection() +{ + //dtor + + if(!fKeepNeutralMesonHistos){ + //Histograms initialized and filled but not passed to output container + //delete here, I am not sure this is correct + + if(fhAnglePairNoCut) delete fhAnglePairNoCut; + if(fhAnglePairOpeningAngleCut) delete fhAnglePairOpeningAngleCut; + if(fhAnglePairAllCut) delete fhAnglePairAllCut; + if(fhInvMassPairNoCut) delete fhInvMassPairNoCut; + if(fhInvMassPairOpeningAngleCut) delete fhInvMassPairOpeningAngleCut; + if(fhInvMassPairAllCut) delete fhInvMassPairAllCut; + + } + +} +//________________________________________________________________________ +TList * AliNeutralMesonSelection::GetCreateOutputObjects() +{ + + // Create histograms to be saved in output file and + // store them in outputContainer of the analysis class that calls this class. + + TList * outputContainer = new TList() ; + outputContainer->SetName("MesonDecayHistos") ; + + fhAnglePairNoCut = new TH2F + ("AnglePairNoCut", + "Angle between all #gamma pair vs E_{#pi^{0}}",200,0,50,200,0,0.2); + fhAnglePairNoCut->SetYTitle("Angle (rad)"); + fhAnglePairNoCut->SetXTitle("E_{ #pi^{0}} (GeV)"); + + fhAnglePairOpeningAngleCut = new TH2F + ("AnglePairOpeningAngleCut", + "Angle between all #gamma pair (opening angle + azimuth cut) vs E_{#pi^{0}}" + ,200,0,50,200,0,0.2); + fhAnglePairOpeningAngleCut->SetYTitle("Angle (rad)"); + fhAnglePairOpeningAngleCut->SetXTitle("E_{ #pi^{0}} (GeV)"); + + fhAnglePairAllCut = new TH2F + ("AnglePairAllCut", + "Angle between all #gamma pair (opening angle + inv mass cut+azimuth) vs E_{#pi^{0}}" + ,200,0,50,200,0,0.2); + fhAnglePairAllCut->SetYTitle("Angle (rad)"); + fhAnglePairAllCut->SetXTitle("E_{ #pi^{0}} (GeV)"); + + // + fhInvMassPairNoCut = new TH2F + ("InvMassPairNoCut","Invariant Mass of all #gamma pair vs E_{#pi^{0}}", + 120,0,120,360,0,0.5); + fhInvMassPairNoCut->SetYTitle("Invariant Mass (GeV/c^{2})"); + fhInvMassPairNoCut->SetXTitle("E_{ #pi^{0}} (GeV)"); + + fhInvMassPairOpeningAngleCut = new TH2F + ("InvMassPairOpeningAngleCut", + "Invariant Mass of #gamma pair (angle cut) vs E_{#pi^{0}}", + 120,0,120,360,0,0.5); + fhInvMassPairOpeningAngleCut->SetYTitle("Invariant Mass (GeV/c^{2})"); + fhInvMassPairOpeningAngleCut->SetXTitle(" E_{#pi^{0}}(GeV)"); + + fhInvMassPairAllCut = new TH2F + ("InvMassPairAllCut", + "Invariant Mass of #gamma pair (opening angle+invmass cut) vs E_{#pi^{0}}", + 120,0,120,360,0,0.5); + fhInvMassPairAllCut->SetYTitle("Invariant Mass (GeV/c^{2})"); + fhInvMassPairAllCut->SetXTitle("E_{#pi^{0}}(GeV)"); + + outputContainer->Add(fhAnglePairNoCut) ; + outputContainer->Add(fhAnglePairOpeningAngleCut) ; + outputContainer->Add(fhAnglePairAllCut) ; + + outputContainer->Add(fhInvMassPairNoCut) ; + outputContainer->Add(fhInvMassPairOpeningAngleCut) ; + outputContainer->Add(fhInvMassPairAllCut) ; + + return outputContainer; +} + + //____________________________________________________________________________ +void AliNeutralMesonSelection::InitParameters() +{ + + //Initialize the parameters of the analysis. + fKeepNeutralMesonHistos = kFALSE ; + + //-------------kHadron, kJetLeadCone----------------- + fAngleMaxParam.Set(4) ; + fAngleMaxParam.AddAt(0.4,0);//={0.4,-0.25,0.025,-2e-4}; + fAngleMaxParam.AddAt(-0.25,1) ; + fAngleMaxParam.AddAt(0.025,2) ; + fAngleMaxParam.AddAt(-2e-4,3) ; + + fInvMassMaxCut = 0.16 ; + fInvMassMinCut = 0.11 ; + + fM = 0.1349766;//neutralMeson mass +} + +//__________________________________________________________________________- +Bool_t AliNeutralMesonSelection::IsAngleInWindow(const Float_t angle,const Float_t e) const { + //Check if the opening angle of the candidate pairs is inside + //our selection windowd + + Bool_t result = kFALSE; + Double_t max = fAngleMaxParam.At(0)*TMath::Exp(fAngleMaxParam.At(1)*e) + +fAngleMaxParam.At(2)+fAngleMaxParam.At(3)*e; + Double_t arg = (e*e-2*fM*fM)/(e*e); + Double_t min = 100. ; + if(arg>0.) + min = TMath::ACos(arg); + + if((angle=min)) + result = kTRUE; + + return result; +} + +//____________________________________________________________________________ +Bool_t AliNeutralMesonSelection::SelectPair(TLorentzVector gammai, TLorentzVector gammaj) +{ + + //Search for the neutral pion within selection cuts + Bool_t goodpair = kFALSE ; + + Double_t pt = (gammai+gammaj).Pt(); + Double_t phi = (gammai+gammaj).Phi(); + if(phi < 0) + phi+=TMath::TwoPi(); + Double_t invmass = (gammai+gammaj).M(); + Double_t angle = gammaj.Angle(gammai.Vect()); + Double_t e = (gammai+gammaj).E(); + + //Fill histograms with no cuts applied. + fhAnglePairNoCut->Fill(e,angle); + fhInvMassPairNoCut->Fill(e,invmass); + + //Cut on the aperture of the pair + if(IsAngleInWindow(angle,e)){ + fhAnglePairOpeningAngleCut ->Fill(e,angle); + fhInvMassPairOpeningAngleCut->Fill(e,invmass); + AliDebug(2,Form("Angle cut: pt %f, phi %f",pt,phi)); + + //Cut on the invariant mass of the pair + if((invmass>fInvMassMinCut) && (invmassFill(e,invmass); + fhAnglePairAllCut ->Fill(e,angle); + goodpair = kTRUE; + AliDebug(2,Form("IM cut: pt %f, phi %f",pt,phi)); + }//(invmass>0.125) && (invmass<0.145) + }//Opening angle cut + + return goodpair; + +} + +//__________________________________________________________________ +void AliNeutralMesonSelection::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("Print", "%s %s", GetName(), GetTitle() ) ; + + printf("mass : %f \n", fM ); + printf("Invariant mass limits : %f < m < %f \n", fInvMassMinCut , fInvMassMinCut ); + printf("Angle selection param: \n"); + printf("p0 : %f", fAngleMaxParam.At(0)); + printf("p1 : %f", fAngleMaxParam.At(1)); + printf("p2 : %f", fAngleMaxParam.At(2)); + printf("p3 : %f", fAngleMaxParam.At(3)); + + printf("Keep Neutral Meson Histos = %d\n",fKeepNeutralMesonHistos); + +} diff --git a/PWG4/PartCorr/AliNeutralMesonSelection.h b/PWG4/PartCorr/AliNeutralMesonSelection.h new file mode 100644 index 00000000000..cf31db96542 --- /dev/null +++ b/PWG4/PartCorr/AliNeutralMesonSelection.h @@ -0,0 +1,81 @@ +#ifndef ALINEUTRALMESONSELECTION_H +#define ALINEUTRALMESONSELECTION_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliNeutralMesonSelection.h 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ +// Class that contains methods to select candidate pairs to neutral meson +// 2 main selections, invariant mass around pi0 (also any other mass), +// apperture angle to distinguish from combinatorial. +// There is a 3rd cut based on the gamma correlation on phi or pt. +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include + +class TLorentzVector ; +class TList ; +class TH2F ; +class Riostream ; + +//--- ANALYSIS system --- +class AliLog ; + +class AliNeutralMesonSelection : public TObject { + + public: + + AliNeutralMesonSelection() ; // default ctor + AliNeutralMesonSelection(const AliNeutralMesonSelection & g) ; // cpy ctor + AliNeutralMesonSelection & operator = (const AliNeutralMesonSelection & g) ;//cpy assignment + virtual ~AliNeutralMesonSelection() ; //virtual dtor + + TList * GetCreateOutputObjects(); + + Double_t GetAngleMaxParam(Int_t i) const {return fAngleMaxParam.At(i) ; } + void SetAngleMaxParam(Int_t i, Double_t par){fAngleMaxParam.AddAt(par,i) ; } + + Double_t GetInvMassMaxCut() const {return fInvMassMaxCut ; } + Double_t GetInvMassMinCut() const {return fInvMassMinCut ; } + void SetInvMassCutRange(Double_t invmassmin, Double_t invmassmax) + {fInvMassMaxCut =invmassmax; fInvMassMinCut =invmassmin;} + + Double_t GetMass() const {return fM ; } + void SetMass(Double_t m) { fM =m ; } + + Bool_t AreNeutralMesonSelectionHistosKept() const { return fKeepNeutralMesonHistos ; } + void KeepNeutralMesonSelectionHistos(Bool_t keep) { fKeepNeutralMesonHistos = keep ; } + + void InitParameters(); + Bool_t IsAngleInWindow(const Float_t angle, const Float_t e) const ; + void Print(const Option_t * opt) const; + + Bool_t SelectPair(TLorentzVector particlei, TLorentzVector particlej) ; + + private: + Double_t fM ; //mass of the neutral meson + Double_t fInvMassMaxCut ; // Invariant Mass cut maximum + Double_t fInvMassMinCut ; // Invariant Masscut minimun + TArrayD fAngleMaxParam ; //Max opening angle selection parameters + + Bool_t fKeepNeutralMesonHistos ; // Keep neutral meson selection histograms + + //Histograms + TH2F * fhAnglePairNoCut ; //Aperture angle of decay photons, no cuts + TH2F * fhAnglePairOpeningAngleCut ; //Aperture angle of decay photons, cut on opening angle + TH2F * fhAnglePairAllCut ; //Aperture angle of decay photons, all cuts + TH2F * fhInvMassPairNoCut ; //Invariant mass of decay photons, no cuts + TH2F * fhInvMassPairOpeningAngleCut ; //Invariant mass of decay photons, cut on opening angle + TH2F * fhInvMassPairAllCut ; //Invariant mass of decay photons, all cuts + + ClassDef(AliNeutralMesonSelection,1) + + } ; + + +#endif //ALINEUTRALMESONSELECTION_H + + + diff --git a/PWG4/PartCorr/AliV0Reader.cxx b/PWG4/PartCorr/AliV0Reader.cxx new file mode 100644 index 00000000000..f97f2f781f4 --- /dev/null +++ b/PWG4/PartCorr/AliV0Reader.cxx @@ -0,0 +1,482 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * + * Version 1.0 * + * * + * 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. * + **************************************************************************/ +/** + * Class for reading V0's + */ + +// --- ROOT system --- +#include +#include + +//---- ANALYSIS system ---- +#include "AliV0Reader.h" +#include "AliAnalysisManager.h" +#include "AliESDInputHandler.h" +#include "AliESDv0.h" +#include "AliMCEvent.h" +#include "AliKFVertex.h" +#include + +using namespace std; + +ClassImp(AliV0Reader) + + + +AliV0Reader::AliV0Reader() : + TObject(), + fCurrentEventGoodV0s(), + fPreviousEventGoodV0s(), + fMCStack(NULL), + fMCTruth(NULL), + fChain(NULL), + fESDHandler(NULL), + fESDEvent(NULL), + fHistograms(NULL), + fCurrentV0IndexNumber(0), + fCurrentV0(NULL), + fCurrentNegativeKFParticle(NULL), + fCurrentPositiveKFParticle(NULL), + fCurrentMotherKFCandidate(NULL), + fCurrentNegativeESDTrack(NULL), + fCurrentPositiveESDTrack(NULL), + fNegativeTrackLorentzVector(NULL), + fPositiveTrackLorentzVector(NULL), + fMotherCandidateLorentzVector(NULL), + fCurrentXValue(0), + fCurrentYValue(0), + fCurrentZValue(0), + fPositiveTrackPID(0), + fNegativeTrackPID(0), + fNegativeMCParticle(NULL), + fPositiveMCParticle(NULL), + fMotherMCParticle(NULL), + fMotherCandidateKFMass(0), + fMotherCandidateKFWidth(0), + fUseKFParticle(kTRUE), + fUseESDTrack(kFALSE), + fDoMC(kFALSE), + fMaxR(10000),// 100 meter(outside of ALICE) + fEtaCut(0.), + fPtCut(0.), + fChi2Cut(0.), + fPIDProbabilityCutNegativeParticle(0), + fPIDProbabilityCutPositiveParticle(0), + fXVertexCut(0.), + fYVertexCut(0.), + fZVertexCut(0.), + fNSigmaMass(0.), + fUseImprovedVertex(kFALSE) +{ + +} + + +AliV0Reader::AliV0Reader(const AliV0Reader & original) : + TObject(original), + fCurrentEventGoodV0s(original.fCurrentEventGoodV0s), + fPreviousEventGoodV0s(original.fPreviousEventGoodV0s), + fMCStack(original.fMCStack), + fMCTruth(original.fMCTruth), + fChain(original.fChain), + fESDHandler(original.fESDHandler), + fESDEvent(original.fESDEvent), + fHistograms(original.fHistograms), + fCurrentV0IndexNumber(original.fCurrentV0IndexNumber), + fCurrentV0(original.fCurrentV0), + fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle), + fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle), + fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate), + fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack), + fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack), + fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector), + fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector), + fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector), + fCurrentXValue(original.fCurrentXValue), + fCurrentYValue(original.fCurrentYValue), + fCurrentZValue(original.fCurrentZValue), + fPositiveTrackPID(original.fPositiveTrackPID), + fNegativeTrackPID(original.fNegativeTrackPID), + fNegativeMCParticle(original.fNegativeMCParticle), + fPositiveMCParticle(original.fPositiveMCParticle), + fMotherMCParticle(original.fMotherMCParticle), + fMotherCandidateKFMass(original.fMotherCandidateKFMass), + fMotherCandidateKFWidth(original.fMotherCandidateKFWidth), + fUseKFParticle(kTRUE), + fUseESDTrack(kFALSE), + fDoMC(kFALSE), + fMaxR(original.fMaxR), + fEtaCut(original.fEtaCut), + fPtCut(original.fPtCut), + fChi2Cut(original.fChi2Cut), + fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle), + fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle), + fXVertexCut(original.fXVertexCut), + fYVertexCut(original.fYVertexCut), + fZVertexCut(original.fZVertexCut), + fNSigmaMass(original.fNSigmaMass), + fUseImprovedVertex(original.fUseImprovedVertex) +{ + +} + + +AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/) +{ + // assignment operator + return *this; +} + +void AliV0Reader::Initialize(){ + // Get the input handler from the manager + fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); + if(fESDHandler == NULL){ + //print warning here + } + + // Get pointer to esd event from input handler + fESDEvent = fESDHandler->GetEvent(); + if(fESDEvent == NULL){ + //print warning here + } + + //Get pointer to MCTruth + fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); + if(fMCTruth == NULL){ + //print warning here + } + + //Get pointer to the mc stack + fMCStack = fMCTruth->MCEvent()->Stack(); + if(fMCStack == NULL){ + //print warning here + } + + AliKFParticle::SetField(fESDEvent->GetMagneticField()); + +} + +AliESDv0* AliV0Reader::GetV0(Int_t index){ + fCurrentV0 = fESDEvent->GetV0(index); + UpdateV0Information(); + return fCurrentV0; +} + + +Bool_t AliV0Reader::NextV0(){ + Bool_t iResult=kFALSE; + while(fCurrentV0IndexNumberGetNumberOfV0s()){ + fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber); + + //checks if on the fly mode is set + if ( !fCurrentV0->GetOnFlyStatus() ){ + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut1){fHistograms->fV0MassDebugCut1->Fill(GetMotherCandidateMass());} + continue; + } + + if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {//checks if we have a vertex + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut2){fHistograms->fV0MassDebugCut2->Fill(GetMotherCandidateMass());} + continue; + } + + if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){ + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut3){fHistograms->fV0MassDebugCut3->Fill(GetMotherCandidateMass());} + continue; + } + + + fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue); + + if(GetXYRadius()>fMaxR){ // cuts on distance from collision point + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut4){fHistograms->fV0MassDebugCut4->Fill(GetMotherCandidateMass());} + continue; + } + + UpdateV0Information(); + + if(fUseKFParticle){ + if(fCurrentMotherKFCandidate->GetNDF()<=0){ + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut5){fHistograms->fV0MassDebugCut5->Fill(GetMotherCandidateMass());} + continue; + } + Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF(); + if(chi2V0 > fChi2Cut || chi2V0 <=0){ + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut6){fHistograms->fV0MassDebugCut6->Fill(GetMotherCandidateMass());} + continue; + } + + if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){ + fCurrentV0IndexNumber++; + if(fHistograms->fV0MassDebugCut7){fHistograms->fV0MassDebugCut7->Fill(GetMotherCandidateMass());} + continue; + } + + if(fMotherCandidateLorentzVector->Pt()fV0MassDebugCut8){fHistograms->fV0MassDebugCut8->Fill(GetMotherCandidateMass());} + continue; + } + + } + else if(fUseESDTrack){ + //TODO + } + + iResult=kTRUE;//means we have a v0 who survived all the cuts applied + + fCurrentV0IndexNumber++; + + break; + } + return iResult; +} + +void AliV0Reader::UpdateV0Information(){ + if(fCurrentNegativeKFParticle != NULL){ + delete fCurrentNegativeKFParticle; + // fCurrentNegativeKFParticle = NULL; + } + fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID); + + if(fCurrentPositiveKFParticle != NULL){ + delete fCurrentPositiveKFParticle; + // fCurrentPositiveKFParticle = NULL; + } + fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID); + + if(fCurrentMotherKFCandidate != NULL){ + // cout<<"fCurrentMotherKFCandidate: "<GetTrack(fCurrentV0->GetNindex()); + + fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); + + if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){ + fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass); + } + + if(fUseImprovedVertex == kTRUE){ + AliKFVertex primaryVertexImproved(*GetPrimaryVertex()); + primaryVertexImproved+=*fCurrentMotherKFCandidate; + fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved); + } + + fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth); + + + if(fNegativeTrackLorentzVector != NULL){ + delete fNegativeTrackLorentzVector; + } + if(fUseKFParticle){ + fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz()); + } + else if(fUseESDTrack){ + fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz()); + } + + if(fPositiveTrackLorentzVector != NULL){ + delete fPositiveTrackLorentzVector; + } + if(fUseKFParticle){ + fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz()); + } + else if(fUseESDTrack){ + fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz()); + } + + if(fMotherCandidateLorentzVector != NULL){ + delete fMotherCandidateLorentzVector; + } + if(fUseKFParticle){ + fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector); + // new TLorentzVector(fCurrentMotherKFCandidate->Px(),fCurrentMotherKFCandidate->Py(),fCurrentMotherKFCandidate->Pz()); + } + else if(fUseESDTrack){ + fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector); + // new TLorentzVector(fCurrentNegativeESDTrack->Px()+fCurrentPositiveESDTrack->Px(),fCurrentNegativeESDTrack->Py()+fCurrentPositiveESDTrack->Py(),fCurrentNegativeESDTrack->Pz()+fCurrentPositiveESDTrack->Pz()); + } + + if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){ + fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); + } + + if(fDoMC){ + fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel())); + fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel())); + } +} + +Bool_t AliV0Reader::HasSameMCMother(){ + Bool_t iResult = kFALSE; + if(fDoMC == kTRUE){ + if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){ + if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0)) + fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0)); + iResult = kTRUE; + } + } + return iResult; +} + +AliKFParticle* AliV0Reader::GetNegativeKFParticle(){ + return fCurrentNegativeKFParticle; +} + +AliKFParticle* AliV0Reader::GetPositiveKFParticle(){ + return fCurrentPositiveKFParticle; +} + +AliKFParticle* AliV0Reader::GetMotherCandidateKFCombination(){ + return fCurrentMotherKFCandidate; +} + +Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){ + Bool_t iResult=kFALSE; + + Double_t *posProbArray = new Double_t[10]; + Double_t *negProbArray = new Double_t[10]; + AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex()); + AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex()); + + negTrack->GetTPCpid(negProbArray); + posTrack->GetTPCpid(posProbArray); + + if(negProbArray!=NULL && posProbArray!=NULL){ + if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){ + iResult=kTRUE; + } + } + delete [] posProbArray; + delete [] negProbArray; + return iResult; +} + +void AliV0Reader::UpdateEventByEventData(){ + fPreviousEventGoodV0s.clear(); + fPreviousEventGoodV0s = fCurrentEventGoodV0s; + fCurrentEventGoodV0s.clear(); + + fCurrentV0IndexNumber=0; +} + +Double_t AliV0Reader::GetNegativeTrackPhi(){ + Double_t offset=0; + if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){ + offset = -2*TMath::Pi(); + } + return fNegativeTrackLorentzVector->Phi()+offset; +} + +Double_t AliV0Reader::GetPositiveTrackPhi(){ + Double_t offset=0; + if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){ + offset = -2*TMath::Pi(); + } + return fPositiveTrackLorentzVector->Phi()+offset; +} + +Double_t AliV0Reader::GetMotherCandidatePhi(){ + Double_t offset=0; + if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){ + offset = -2*TMath::Pi(); + } + return fMotherCandidateLorentzVector->Phi()+offset; +} + +Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){ + + Int_t iResult = 10; // Unknown particle + + if(chargeOfTrack==-1){ //negative track + switch(abs(fNegativeTrackPID)){ + case 11: //electron + iResult = 0; + break; + case 13: //muon + iResult = 1; + break; + case 211: //pion + iResult = 2; + break; + case 321: //kaon + iResult = 3; + break; + case 2212: //proton + iResult = 4; + break; + case 22: //photon + iResult = 5; + break; + case 111: //pi0 + iResult = 6; + break; + case 2112: //neutron + iResult = 7; + break; + case 311: //K0 + iResult = 8; + break; + + //Put in here for kSPECIES::kEleCon ???? + } + } + else if(chargeOfTrack==1){ //positive track + switch(abs(fPositiveTrackPID)){ + case 11: //electron + iResult = 0; + break; + case 13: //muon + iResult = 1; + break; + case 211: //pion + iResult = 2; + break; + case 321: //kaon + iResult = 3; + break; + case 2212: //proton + iResult = 4; + break; + case 22: //photon + iResult = 5; + break; + case 111: //pi0 + iResult = 6; + break; + case 2112: //neutron + iResult = 7; + break; + case 311: //K0 + iResult = 8; + break; + + //Put in here for kSPECIES::kEleCon ???? + } + } + else{ + //Wrong parameter.. Print warning + } + return iResult; +} diff --git a/PWG4/PartCorr/AliV0Reader.h b/PWG4/PartCorr/AliV0Reader.h new file mode 100644 index 00000000000..fd2ec0434d2 --- /dev/null +++ b/PWG4/PartCorr/AliV0Reader.h @@ -0,0 +1,295 @@ +#ifndef ALIV0READER_H +#define ALIV0READER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +// --- ROOT system --- +#include "TObject.h" +#include "TChain.h" +#include "AliESDv0.h" +#include "AliESDVertex.h" +#include "AliESDInputHandler.h" +#include "AliMCEventHandler.h" +#include "AliESDEvent.h" +#include "AliESDtrack.h" +#include "AliKFParticle.h" +#include "TParticle.h" +#include "AliStack.h" +#include "AliGammaConversionHistograms.h" +#include + +class TClonesArray ; +class TFormula ; +class TParticle ; +class Riostream ; +class TChain; +//--- AliRoot system --- + +class AliStack ; +class AliESDEvent ; +class AliMCEventHandler; +class AliLog ; + +class AliV0Reader : public TObject { + + public: + + AliV0Reader(); //constructor + AliV0Reader(const AliV0Reader & g); //copy constructor + AliV0Reader & operator = (const AliV0Reader & g); //assignment operator + virtual ~AliV0Reader() {;} //virtual destructor + /* + *Initialize the reader + */ + void Initialize(); + + /* + *Returns the number of v0s in the event, no cuts applied. + */ + Int_t GetNumberOfV0s(){return fESDEvent->GetNumberOfV0s();} + + /* + * Check if there are any more good v0s left in the v0 stack + * if so, fCurrent v0 is set to this v0 and can be retrieved + * by GetCurrentV0 function. + * returns kFALSE if there is no more good v0s in the v0 stack + */ + Bool_t NextV0(); + + /* + * Returns the v0 at the given index, no checks are done on the v0. + */ + AliESDv0* GetV0(Int_t index); + + /* + * Returns the current v0 + */ + AliESDv0* GetCurrentV0(){return fCurrentV0;} + + /* + * Returns the negative ESD track which belongs to fCurrentV0 + */ + AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());} + + /* + * Returns the positive ESD track which belongs to fCurrentV0 + */ + AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());} + + /* + * Returns the negative KF particle which belongs to fCurrentV0 + */ + AliKFParticle* GetNegativeKFParticle(); + + /* + * Returns the positive KF particle which belongs to fCurrentV0 + */ + AliKFParticle* GetPositiveKFParticle(); + /* + * Returns the KFParticle object of the 2 tracks. + */ + AliKFParticle* GetMotherCandidateKFCombination(); + /* + * Checks the probablity that the PID of the particle is what we want it to be. + */ + Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut); + + /* + *Get the negative MC TParticle from the stack + */ + TParticle * GetNegativeMCParticle(){return fNegativeMCParticle;}//fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));} + + /* + *Get the positive MC TParticle from the stack + */ + TParticle * GetPositiveMCParticle(){return fPositiveMCParticle;}//{return fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));} + + /* + *Get the mother MC TParticle from the stack + */ + TParticle * GetMotherMCParticle(){return fMotherMCParticle;} + + Bool_t HasSameMCMother(); + + /* + *Get the MC stack + */ + AliStack* GetMCStack(){return fMCStack;} + + /* + *Get the magnetic field from the ESD event + */ + Double_t GetMagneticField(){return fESDEvent->GetMagneticField();} + + /* + *Get the primary vertex from the esd event + */ + const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();} + + /* + * Set the PID of the negative track + */ + void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;} + + /* + * Set the PID of the positive track + */ + void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;} + + /* + * Set the flag to use the kfparticle class. Will also disable the use of esd tracks + */ + void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;} + + /* + * Set the flag to use the esd track class. Will also disable the use of kf particles + */ + void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;} + + /* + * Set the flag to use improved vertex or not + */ + void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;} + + /* + * Return the number in the species array belonging to the negative or positive track pid. + */ + Int_t GetSpeciesIndex(Int_t chargeOfTrack); + + /* + * Return the x coordinate of the v0 + */ + Double_t GetX(){return fCurrentXValue;} + + /* + * Return the y coordinate of the v0 + */ + Double_t GetY(){return fCurrentYValue;} + + /* + * Return the Z coordinate of the v0 + */ + Double_t GetZ(){return fCurrentZValue;} + + /* + * Return the radius of the v0 + */ + Double_t GetXYRadius(){return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));} + + /* + * Get the opening angle between the two tracks + */ + Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());} + + Double_t GetNegativeTrackEnergy(){return fCurrentNegativeKFParticle->E();} + Double_t GetPositiveTrackEnergy(){return fCurrentPositiveKFParticle->E();} + Double_t GetMotherCandidateEnergy(){return fCurrentMotherKFCandidate->E();} + + Double_t GetNegativeTrackPt(){return fNegativeTrackLorentzVector->Pt();} + Double_t GetPositiveTrackPt(){return fPositiveTrackLorentzVector->Pt();} + Double_t GetMotherCandidatePt(){return fMotherCandidateLorentzVector->Pt();} + + Double_t GetNegativeTrackEta(){return fNegativeTrackLorentzVector->Eta();} + Double_t GetPositiveTrackEta(){return fPositiveTrackLorentzVector->Eta();} + Double_t GetMotherCandidateEta(){return fMotherCandidateLorentzVector->Eta();} + + Double_t GetMotherCandidateNDF(){return fCurrentMotherKFCandidate->GetNDF();} + Double_t GetMotherCandidateChi2(){return fCurrentMotherKFCandidate->GetChi2();} + Double_t GetMotherCandidateMass(){return fMotherCandidateKFMass;} + Double_t GetMotherCandidateWidth(){return fMotherCandidateKFWidth;} + + Double_t GetNegativeTrackPhi(); + Double_t GetPositiveTrackPhi(); + Double_t GetMotherCandidatePhi(); + + void UpdateEventByEventData(); + + Double_t GetMaxRCut(){return fMaxR;} + Double_t GetEtaCut(){return fEtaCut;} + Double_t GetPtCut(){return fPtCut;} + Double_t GetChi2Cut(){return fChi2Cut;} + + void SetMaxRCut(Double_t maxR){fMaxR=maxR;} + void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;} + void SetPtCut(Double_t ptCut){fPtCut=ptCut;} + void SetChi2Cut(Double_t chi2){fChi2Cut=chi2;} + + void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;} + void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;} + void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;} + void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;} + void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;} + void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;} + void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;} + void UpdateV0Information(); + + void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;} + + std::vector fCurrentEventGoodV0s; + std::vector fPreviousEventGoodV0s; + + private: + AliStack * fMCStack; // pointer to MonteCarlo particle stack + AliMCEventHandler* fMCTruth; // pointer to the MC event handler + TChain * fChain; // pointer to the TChain + + AliESDInputHandler* fESDHandler; //! pointer to esd object + AliESDEvent *fESDEvent; //! pointer to esd object + + AliGammaConversionHistograms *fHistograms; + + Int_t fCurrentV0IndexNumber; + AliESDv0 * fCurrentV0; //! pointer to the current v0 + AliKFParticle * fCurrentNegativeKFParticle; //! pointer to the negative KF particle + AliKFParticle * fCurrentPositiveKFParticle; //! pointer to the positive KF particle + AliKFParticle * fCurrentMotherKFCandidate; //! pointer to the positive KF particle + + AliESDtrack * fCurrentNegativeESDTrack; //! pointer to the negative ESD track + AliESDtrack * fCurrentPositiveESDTrack; //! pointer to the positive ESD track + + TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector + TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector + TLorentzVector * fMotherCandidateLorentzVector; //! pointer to the mother candidate Track Lorentz Vector + + Double_t fCurrentXValue; + Double_t fCurrentYValue; + Double_t fCurrentZValue; + + Int_t fPositiveTrackPID; + Int_t fNegativeTrackPID; + + TParticle *fNegativeMCParticle; //! + TParticle *fPositiveMCParticle; //! + TParticle *fMotherMCParticle; //! + + Double_t fMotherCandidateKFMass; + Double_t fMotherCandidateKFWidth; + + Bool_t fUseKFParticle; + Bool_t fUseESDTrack; + Bool_t fDoMC; + + //cuts + Double_t fMaxR; + Double_t fEtaCut; + Double_t fPtCut; + Double_t fChi2Cut; + Double_t fPIDProbabilityCutNegativeParticle; + Double_t fPIDProbabilityCutPositiveParticle; + Double_t fXVertexCut; + Double_t fYVertexCut; + Double_t fZVertexCut; + + Double_t fNSigmaMass; + + Bool_t fUseImprovedVertex; + + ClassDef(AliV0Reader,0) +}; + + +#endif + + +