From 1c5acb87786ba70bd3eb5e3db08b784c7d5aa075 Mon Sep 17 00:00:00 2001 From: gconesab Date: Tue, 2 Dec 2008 10:25:57 +0000 Subject: [PATCH 1/1] PartCorr split in 2 Base and Dep; coding violations corrected; PHOS geometry can be loaded when needed from par file; new analysis class added AliAnaPi0EbE; AliAnaGammaDirect removed and substituted by AliAnaPhoton and AliAnaParticleIsolation; AliAnaPi0 not independent task, loads PHOS geometry if needed, needs input of AliAnaPhoton; AliCaloPhoton removed; AliAODParticleCorrelation substituted by AliAODPWG4Particle and its daughter class AliAODPWG4ParticleCorrelation --- PWG4/CMakeLists.txt | 7 +- PWG4/CMake_libPWG4PartCorrBase.txt | 18 + PWG4/CMake_libPWG4PartCorrDep.txt | 18 + PWG4/Makefile | 14 +- PWG4/PROOF-INF.PWG4PartCorrBase/BUILD.sh | 3 + PWG4/PROOF-INF.PWG4PartCorrBase/SETUP.C | 13 + PWG4/PROOF-INF.PWG4PartCorrDep/BUILD.sh | 3 + PWG4/PROOF-INF.PWG4PartCorrDep/SETUP.C | 13 + PWG4/PWG4PartCorrBaseLinkDef.h | 22 + PWG4/PWG4PartCorrDepLinkDef.h | 20 + PWG4/PartCorrBase/AliAODPWG4Particle.cxx | 164 ++ PWG4/PartCorrBase/AliAODPWG4Particle.h | 111 ++ .../AliAODPWG4ParticleCorrelation.cxx | 152 ++ .../AliAODPWG4ParticleCorrelation.h | 102 ++ PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx | 389 +++++ PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h | 207 +++ PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx | 225 +++ PWG4/PartCorrBase/AliAnaPartCorrMaker.h | 86 + PWG4/PartCorrBase/AliAnaScale.cxx | 138 ++ PWG4/PartCorrBase/AliAnaScale.h | 53 + .../AliAnalysisTaskParticleCorrelation.cxx | 173 ++ .../AliAnalysisTaskParticleCorrelation.h | 50 + PWG4/PartCorrBase/AliCaloPID.cxx | 411 +++++ PWG4/PartCorrBase/AliCaloPID.h | 133 ++ PWG4/PartCorrBase/AliCaloTrackAODReader.cxx | 214 +++ PWG4/PartCorrBase/AliCaloTrackAODReader.h | 47 + PWG4/PartCorrBase/AliCaloTrackESDReader.cxx | 319 ++++ PWG4/PartCorrBase/AliCaloTrackESDReader.h | 46 + PWG4/PartCorrBase/AliCaloTrackMCReader.cxx | 846 +++++++++ PWG4/PartCorrBase/AliCaloTrackMCReader.h | 90 + PWG4/PartCorrBase/AliCaloTrackReader.cxx | 246 +++ PWG4/PartCorrBase/AliCaloTrackReader.h | 151 ++ PWG4/PartCorrBase/AliFidutialCut.cxx | 353 ++++ PWG4/PartCorrBase/AliFidutialCut.h | 131 ++ PWG4/PartCorrBase/AliIsolationCut.cxx | 225 +++ PWG4/PartCorrBase/AliIsolationCut.h | 72 + .../PartCorrBase/AliNeutralMesonSelection.cxx | 313 ++++ PWG4/PartCorrBase/AliNeutralMesonSelection.h | 137 ++ PWG4/PartCorrDep/AliAnaCaloTrigger.cxx | 258 +++ PWG4/PartCorrDep/AliAnaCaloTrigger.h | 56 + PWG4/PartCorrDep/AliAnaCaloTriggerMC.cxx | 283 +++ PWG4/PartCorrDep/AliAnaCaloTriggerMC.h | 56 + PWG4/PartCorrDep/AliAnaExample.cxx | 374 ++++ PWG4/PartCorrDep/AliAnaExample.h | 67 + .../AliAnaParticleHadronCorrelation.cxx | 542 ++++++ .../AliAnaParticleHadronCorrelation.h | 75 + PWG4/PartCorrDep/AliAnaParticleIsolation.cxx | 988 +++++++++++ PWG4/PartCorrDep/AliAnaParticleIsolation.h | 180 ++ .../AliAnaParticleJetFinderCorrelation.cxx | 358 ++++ .../AliAnaParticleJetFinderCorrelation.h | 95 + ...liAnaParticleJetLeadingConeCorrelation.cxx | 1529 +++++++++++++++++ .../AliAnaParticleJetLeadingConeCorrelation.h | 251 +++ .../AliAnaParticlePartonCorrelation.cxx | 301 ++++ .../AliAnaParticlePartonCorrelation.h | 56 + PWG4/PartCorrDep/AliAnaPhoton.cxx | 508 ++++++ PWG4/PartCorrDep/AliAnaPhoton.h | 97 ++ PWG4/PartCorrDep/AliAnaPi0.cxx | 480 ++++++ PWG4/PartCorrDep/AliAnaPi0.h | 110 ++ PWG4/PartCorrDep/AliAnaPi0EbE.cxx | 551 ++++++ PWG4/PartCorrDep/AliAnaPi0EbE.h | 102 ++ .../AliAnalysisTaskPHOSExample.cxx | 331 ++++ PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.h | 62 + PWG4/libPWG4PartCorrBase.pkg | 22 + PWG4/libPWG4PartCorrDep.pkg | 25 + 64 files changed, 13468 insertions(+), 4 deletions(-) create mode 100755 PWG4/CMake_libPWG4PartCorrBase.txt create mode 100755 PWG4/CMake_libPWG4PartCorrDep.txt create mode 100755 PWG4/PROOF-INF.PWG4PartCorrBase/BUILD.sh create mode 100755 PWG4/PROOF-INF.PWG4PartCorrBase/SETUP.C create mode 100755 PWG4/PROOF-INF.PWG4PartCorrDep/BUILD.sh create mode 100755 PWG4/PROOF-INF.PWG4PartCorrDep/SETUP.C create mode 100755 PWG4/PWG4PartCorrBaseLinkDef.h create mode 100755 PWG4/PWG4PartCorrDepLinkDef.h create mode 100755 PWG4/PartCorrBase/AliAODPWG4Particle.cxx create mode 100755 PWG4/PartCorrBase/AliAODPWG4Particle.h create mode 100755 PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.cxx create mode 100755 PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.h create mode 100755 PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx create mode 100755 PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h create mode 100755 PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx create mode 100755 PWG4/PartCorrBase/AliAnaPartCorrMaker.h create mode 100755 PWG4/PartCorrBase/AliAnaScale.cxx create mode 100755 PWG4/PartCorrBase/AliAnaScale.h create mode 100755 PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx create mode 100755 PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h create mode 100755 PWG4/PartCorrBase/AliCaloPID.cxx create mode 100755 PWG4/PartCorrBase/AliCaloPID.h create mode 100755 PWG4/PartCorrBase/AliCaloTrackAODReader.cxx create mode 100755 PWG4/PartCorrBase/AliCaloTrackAODReader.h create mode 100755 PWG4/PartCorrBase/AliCaloTrackESDReader.cxx create mode 100755 PWG4/PartCorrBase/AliCaloTrackESDReader.h create mode 100755 PWG4/PartCorrBase/AliCaloTrackMCReader.cxx create mode 100755 PWG4/PartCorrBase/AliCaloTrackMCReader.h create mode 100755 PWG4/PartCorrBase/AliCaloTrackReader.cxx create mode 100755 PWG4/PartCorrBase/AliCaloTrackReader.h create mode 100755 PWG4/PartCorrBase/AliFidutialCut.cxx create mode 100755 PWG4/PartCorrBase/AliFidutialCut.h create mode 100755 PWG4/PartCorrBase/AliIsolationCut.cxx create mode 100755 PWG4/PartCorrBase/AliIsolationCut.h create mode 100755 PWG4/PartCorrBase/AliNeutralMesonSelection.cxx create mode 100755 PWG4/PartCorrBase/AliNeutralMesonSelection.h create mode 100755 PWG4/PartCorrDep/AliAnaCaloTrigger.cxx create mode 100755 PWG4/PartCorrDep/AliAnaCaloTrigger.h create mode 100755 PWG4/PartCorrDep/AliAnaCaloTriggerMC.cxx create mode 100755 PWG4/PartCorrDep/AliAnaCaloTriggerMC.h create mode 100755 PWG4/PartCorrDep/AliAnaExample.cxx create mode 100755 PWG4/PartCorrDep/AliAnaExample.h create mode 100755 PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx create mode 100755 PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h create mode 100755 PWG4/PartCorrDep/AliAnaParticleIsolation.cxx create mode 100755 PWG4/PartCorrDep/AliAnaParticleIsolation.h create mode 100755 PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx create mode 100755 PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.h create mode 100755 PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx create mode 100755 PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.h create mode 100755 PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.cxx create mode 100755 PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.h create mode 100755 PWG4/PartCorrDep/AliAnaPhoton.cxx create mode 100755 PWG4/PartCorrDep/AliAnaPhoton.h create mode 100755 PWG4/PartCorrDep/AliAnaPi0.cxx create mode 100755 PWG4/PartCorrDep/AliAnaPi0.h create mode 100755 PWG4/PartCorrDep/AliAnaPi0EbE.cxx create mode 100755 PWG4/PartCorrDep/AliAnaPi0EbE.h create mode 100755 PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx create mode 100755 PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.h create mode 100755 PWG4/libPWG4PartCorrBase.pkg create mode 100755 PWG4/libPWG4PartCorrDep.pkg diff --git a/PWG4/CMakeLists.txt b/PWG4/CMakeLists.txt index e43a3f9a2f4..da66df4f8af 100644 --- a/PWG4/CMakeLists.txt +++ b/PWG4/CMakeLists.txt @@ -6,9 +6,11 @@ set(INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/PWG4 -${CMAKE_SOURCE_DIR}/PWG4/PartCorr +${CMAKE_SOURCE_DIR}/PWG4/PartCorrBase +${CMAKE_SOURCE_DIR}/PWG4/PartCorrDep ${CMAKE_SOURCE_DIR}/PWG4/JetTasks ${CMAKE_SOURCE_DIR}/PWG4/GammaConv +${CMAKE_SOURCE_DIR}/PHOS ${CMAKE_SOURCE_DIR}/STEER ${CMAKE_SOURCE_DIR}/ANALYSIS ${CMAKE_SOURCE_DIR}/JETAN @@ -25,6 +27,7 @@ link_directories( ${LINK_DIRECTORIES}) SetModule() -include(CMake_libPWG4PartCorr.txt) +include(CMake_libPWG4PartCorrBase.txt) +include(CMake_libPWG4PartCorrDep.txt) include(CMake_libPWG4JetTasks.txt) include(CMake_libPWG4GammaConv.txt) diff --git a/PWG4/CMake_libPWG4PartCorrBase.txt b/PWG4/CMake_libPWG4PartCorrBase.txt new file mode 100755 index 00000000000..4fd80f3181d --- /dev/null +++ b/PWG4/CMake_libPWG4PartCorrBase.txt @@ -0,0 +1,18 @@ +# -*- mode: cmake -*- + +set(SRCS + PartCorrBase/AliAODPWG4Particle.cxx PartCorrBase/AliAODPWG4ParticleCorrelation.cxx + PartCorrBase/AliNeutralMesonSelection.cxx PartCorrBase/AliFidutialCut.cxx + PartCorrBase/AliCaloPID.cxx PartCorrBase/AliIsolationCut.cxx + PartCorrBase/AliAnaScale.cxx PartCorrBase/AliAnaPartCorrMaker.cxx + PartCorrBase/AliAnaPartCorrBaseClass.cxx PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx + PartCorrBase/AliCaloTrackReader.cxx PartCorrBase/AliCaloTrackESDReader.cxx + PartCorrBase/AliCaloTrackAODReader.cxx PartCorrBase/AliCaloTrackMCReader.cxx +) + +# fill list of header files from list of source files +# by exchanging the file extension +String(REPLACE ".cxx" ".h" HDRS "${SRCS}") + +AddLibrary(PWG4PartCorrBase "${SRCS}" "${HDRS}") + diff --git a/PWG4/CMake_libPWG4PartCorrDep.txt b/PWG4/CMake_libPWG4PartCorrDep.txt new file mode 100755 index 00000000000..fbb4f66e054 --- /dev/null +++ b/PWG4/CMake_libPWG4PartCorrDep.txt @@ -0,0 +1,18 @@ +# -*- mode: cmake -*- + +set(SRCS + PartCorrDep/AliAnaCaloTrigger.cxx PartCorrDep/AliAnaCaloTriggerMC.cxx + PartCorrDep/AliAnalysisTaskPHOSExample.cxx PartCorrDep/AliAnaExample.cxx + PartCorrDep/AliAnaPhoton.cxx PartCorrDep/AliAnaPi0.cxx PartCorrDep/AliAnaPi0EbE.cxx + PartCorrDep/AliAnaParticleIsolation.cxx PartCorrDep/AliAnaParticlePartonCorrelation.cxx + PartCorrDep/AliAnaParticleHadronCorrelation.cxx PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx + PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx + +) + +# fill list of header files from list of source files +# by exchanging the file extension +String(REPLACE ".cxx" ".h" HDRS "${SRCS}") + +AddLibrary(PWG4PartCorrDep "${SRCS}" "${HDRS}") + diff --git a/PWG4/Makefile b/PWG4/Makefile index 638e74dcc3b..43ebfe337a2 100644 --- a/PWG4/Makefile +++ b/PWG4/Makefile @@ -34,8 +34,18 @@ ifneq ($(JETAN_INCLUDE),) ALICEINC += -I../$(JETAN_INCLUDE) endif -ifneq ($(PWG4PartCorr_INCLUDE),) - ALICEINC += -I../$(PWG4PartCorr_INCLUDE) +ifneq ($(PHOSUtils_INCLUDE),) + ALICEINC += -I../$(PHOSUtils_INCLUDE) + CXXFLAGS+=-D__PHOSGEO__ +endif + +ifneq ($(PWG4PartCorrBase_INCLUDE),) + ALICEINC += -I../$(PWG4PartCorrBase_INCLUDE) +endif + +ifneq ($(PWG4PartCorrDep_INCLUDE),) + ALICEINC += -I../$(PWG4PartCorrBase_INCLUDE) + ALICEINC += -I../$(PWG4PartCorrDep_INCLUDE) endif ifneq ($(PWG4GammaConv_INCLUDE),) diff --git a/PWG4/PROOF-INF.PWG4PartCorrBase/BUILD.sh b/PWG4/PROOF-INF.PWG4PartCorrBase/BUILD.sh new file mode 100755 index 00000000000..fc9490a6c2d --- /dev/null +++ b/PWG4/PROOF-INF.PWG4PartCorrBase/BUILD.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +make diff --git a/PWG4/PROOF-INF.PWG4PartCorrBase/SETUP.C b/PWG4/PROOF-INF.PWG4PartCorrBase/SETUP.C new file mode 100755 index 00000000000..c91b29d59df --- /dev/null +++ b/PWG4/PROOF-INF.PWG4PartCorrBase/SETUP.C @@ -0,0 +1,13 @@ +void SETUP() +{ + + // Load the ESD library + gSystem->Load("libPWG4PartCorrBase"); + + // Set the Include paths + gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG4PartCorrBase"); + gROOT->ProcessLine(".include PWG4PartCorrBase/PartCorrBase"); + + // Set our location, so that other packages can find us + gSystem->Setenv("PWG4PartCorrBase_INCLUDE", "PWG4PartCorrBase/PartCorrBase"); +} diff --git a/PWG4/PROOF-INF.PWG4PartCorrDep/BUILD.sh b/PWG4/PROOF-INF.PWG4PartCorrDep/BUILD.sh new file mode 100755 index 00000000000..fc9490a6c2d --- /dev/null +++ b/PWG4/PROOF-INF.PWG4PartCorrDep/BUILD.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +make diff --git a/PWG4/PROOF-INF.PWG4PartCorrDep/SETUP.C b/PWG4/PROOF-INF.PWG4PartCorrDep/SETUP.C new file mode 100755 index 00000000000..fbc2d01a119 --- /dev/null +++ b/PWG4/PROOF-INF.PWG4PartCorrDep/SETUP.C @@ -0,0 +1,13 @@ +void SETUP() +{ + + // Load the ESD library + gSystem->Load("libPWG4PartCorrDep"); + + // Set the Include paths + gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG4PartCorrDep"); + gROOT->ProcessLine(".include PWG4PartCorrDep/PartCorrDep"); + + // Set our location, so that other packages can find us + gSystem->Setenv("PWG4PartCorrDep_INCLUDE", "PWG4PartCorrDep/PartCorrDep"); +} diff --git a/PWG4/PWG4PartCorrBaseLinkDef.h b/PWG4/PWG4PartCorrBaseLinkDef.h new file mode 100755 index 00000000000..316ae4cd2e9 --- /dev/null +++ b/PWG4/PWG4PartCorrBaseLinkDef.h @@ -0,0 +1,22 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliAODPWG4Particle+; +#pragma link C++ class AliAODPWG4ParticleCorrelation+; +#pragma link C++ class AliAnaScale+; +#pragma link C++ class AliNeutralMesonSelection+; +#pragma link C++ class AliFidutialCut+; +#pragma link C++ class AliCaloPID+; +#pragma link C++ class AliIsolationCut+; +#pragma link C++ class AliAnaPartCorrMaker+; +#pragma link C++ class AliAnaPartCorrBaseClass+; +#pragma link C++ class AliAnalysisTaskParticleCorrelation+; +#pragma link C++ class AliCaloTrackReader+; +#pragma link C++ class AliCaloTrackESDReader+; +#pragma link C++ class AliCaloTrackAODReader+; +#pragma link C++ class AliCaloTrackMCReader+; + +#endif diff --git a/PWG4/PWG4PartCorrDepLinkDef.h b/PWG4/PWG4PartCorrDepLinkDef.h new file mode 100755 index 00000000000..90ffaa9ee9b --- /dev/null +++ b/PWG4/PWG4PartCorrDepLinkDef.h @@ -0,0 +1,20 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliAnaCaloTrigger+; +#pragma link C++ class AliAnaCaloTriggerMC+; +#pragma link C++ class AliAnalysisTaskPHOSExample+; +#pragma link C++ class AliAnaExample+; +#pragma link C++ class AliAnaPhoton+; +#pragma link C++ class AliAnaPi0+; +#pragma link C++ class AliAnaPi0EbE+; +#pragma link C++ class AliAnaParticleIsolation+; +#pragma link C++ class AliAnaParticlePartonCorrelation+; +#pragma link C++ class AliAnaParticleHadronCorrelation+; +#pragma link C++ class AliAnaParticleJetFinderCorrelation+; +#pragma link C++ class AliAnaParticleJetLeadingConeCorrelation+; + +#endif diff --git a/PWG4/PartCorrBase/AliAODPWG4Particle.cxx b/PWG4/PartCorrBase/AliAODPWG4Particle.cxx new file mode 100755 index 00000000000..b42a1719584 --- /dev/null +++ b/PWG4/PartCorrBase/AliAODPWG4Particle.cxx @@ -0,0 +1,164 @@ +/************************************************************************** + * 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: AliAODPWG4Particle.h $ */ + +//------------------------------------------------------------------------- +// AOD class for photon and other particles storage and +// correlation studies +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +//-- ROOT system -- + +//-- Analysis system +#include "AliAODPWG4Particle.h" + +ClassImp(AliAODPWG4Particle) + + +//______________________________________________________________________________ +AliAODPWG4Particle::AliAODPWG4Particle() : +AliVParticle(), +fMomentum(0),fPdg(-1), fTag(-1), fLabel(-1), fCaloLabel(), fTrackLabel(), +fDetector(""), fDisp(0), fTof(0), fCharged(0), fBadDist(0) +{ + // constructor + fCaloLabel [0] = -1; + fCaloLabel [1] = -1; + fTrackLabel[0] = -1; + fTrackLabel[1] = -1; +} + +//______________________________________________________________________________ +AliAODPWG4Particle::AliAODPWG4Particle(Double_t px, Double_t py, Double_t pz, Double_t e): +AliVParticle(), +fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fCaloLabel(), fTrackLabel(), +fDetector(""), fDisp(0),fTof(0),fCharged(0), fBadDist(0) +{ + // constructor + fMomentum = new TLorentzVector(px, py, pz, e); + + fCaloLabel [0] = -1; + fCaloLabel [1] = -1; + fTrackLabel[0] = -1; + fTrackLabel[1] = -1; +} + +//______________________________________________________________________________ +AliAODPWG4Particle::AliAODPWG4Particle(TLorentzVector & p): +AliVParticle(), +fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fCaloLabel(), fTrackLabel(), +fDetector(""), fDisp(0),fTof(0),fCharged(0),fBadDist(0) +{ + // constructor + fMomentum = new TLorentzVector(p); + + fCaloLabel [0] = -1; + fCaloLabel [1] = -1; + fTrackLabel[0] = -1; + fTrackLabel[1] = -1; +} + + +//______________________________________________________________________________ +AliAODPWG4Particle::~AliAODPWG4Particle() +{ + // destructor + delete fMomentum; +} + +//______________________________________________________________________________ +AliAODPWG4Particle::AliAODPWG4Particle(const AliAODPWG4Particle& part) : +AliVParticle(part), +fMomentum(0), fPdg(part.fPdg), fTag(part.fTag), fLabel(part.fLabel), fCaloLabel(), fTrackLabel(), +fDetector(part.fDetector),fDisp(part.fDisp), fTof(part.fTof), fCharged(part.fCharged), fBadDist(part.fBadDist) + +{ + // Copy constructor + fMomentum = new TLorentzVector(*part.fMomentum); + + fCaloLabel [0] = part.fCaloLabel[0]; + fCaloLabel [1] = part.fCaloLabel[1]; + fTrackLabel[0] = part.fTrackLabel[0]; + fTrackLabel[1] = part.fTrackLabel[1]; +} + +//______________________________________________________________________________ +AliAODPWG4Particle& AliAODPWG4Particle::operator=(const AliAODPWG4Particle& part) +{ + // Assignment operator + if(this!=&part) { + + fPdg = part.fPdg; + fTag = part.fTag; + fLabel = part.fLabel; + fCaloLabel [0] = part.fCaloLabel[0]; + fCaloLabel [1] = part.fCaloLabel[1]; + fTrackLabel[0] = part.fTrackLabel[0]; + fTrackLabel[1] = part.fTrackLabel[1]; + fDetector =part.fDetector; + + fDisp = part.fDisp; + fTof = part.fTof; + fCharged = part.fCharged; + fBadDist=part.fBadDist; + + if (fMomentum ) delete fMomentum; + fMomentum = new TLorentzVector(*part.fMomentum); + } + + return *this; +} + + +//_______________________________________________________________ +Bool_t AliAODPWG4Particle::IsPIDOK(const Int_t ipid, const Int_t pdgwanted) const{ + // returns true if particle satisfies given PID criterium + switch(ipid){ + case 0: return kTRUE ; //No PID at all + case 1: + { + if (fPdg == pdgwanted) return kTRUE; + else return kFALSE; //Overall PID calculated with bayesian methods. + } + case 2: return fDisp ; //only dispersion cut + case 3: return fTof ; //Only TOF cut + case 4: return fCharged ; //Only Charged cut + case 5: return fDisp && fTof ; //Dispersion and TOF + case 6: return fDisp && fCharged ; //Dispersion and Charged + case 7: return fTof && fCharged ; //TOF and Charged + case 8: return fDisp && fTof && fCharged ; // all 3 cuts + default: return kFALSE ; //Not known combination + } +} + +//______________________________________________________________________________ +void AliAODPWG4Particle::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("TOF bit : %d\n",fTof); + printf("Charged bit : %d\n",fCharged); + printf("Dispersion bit : %d\n",fDisp); + printf("pdg : %d\n",fPdg); + printf("tag : %d\n",fTag); + printf("Trigger Detector : %s\n",fDetector.Data()); + +} diff --git a/PWG4/PartCorrBase/AliAODPWG4Particle.h b/PWG4/PartCorrBase/AliAODPWG4Particle.h new file mode 100755 index 00000000000..40547b81e06 --- /dev/null +++ b/PWG4/PartCorrBase/AliAODPWG4Particle.h @@ -0,0 +1,111 @@ +#ifndef ALIAODPWG4PARTICLE_H +#define ALIAODPWG4PARTICLE_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliAODPWG4Particle.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 "AliVParticle.h" + +class AliAODPWG4Particle : public AliVParticle { + + public: + AliAODPWG4Particle(); + AliAODPWG4Particle(Double_t px, Double_t py, Double_t pz, Double_t e); + AliAODPWG4Particle(TLorentzVector & p); + virtual ~AliAODPWG4Particle(); + AliAODPWG4Particle(const AliAODPWG4Particle& photon); + AliAODPWG4Particle& operator=(const AliAODPWG4Particle& 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 Int_t GetPdg() const {return fPdg ; } + virtual Int_t GetTag() const {return fTag ; } + virtual Int_t GetLabel() const {return fLabel ; } + virtual Int_t GetCaloLabel (Int_t i) const {return fCaloLabel[i];} + virtual Int_t GetTrackLabel(Int_t i) const {return fTrackLabel[i];} + virtual TString GetDetector() const {return fDetector ; } + + virtual Bool_t GetDispBit(void) const {return fDisp;} + virtual Bool_t GetTOFBit(void) const {return fTof;} + virtual Bool_t GetChargedBit(void) const {return fCharged;} + virtual Int_t DistToBad() const {return fBadDist ;} + + 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 SetCaloLabel (Int_t a, Int_t b) {fCaloLabel [0] = a; fCaloLabel [1] = b ; } + virtual void SetTrackLabel(Int_t a, Int_t b) {fTrackLabel[0] = a; fTrackLabel[1] = b ; } + virtual void SetDetector(TString d) {fDetector = d ; } + + virtual void SetDispBit(Bool_t chi2){fDisp = chi2 ;} + virtual void SetTOFBit(Bool_t tof){fTof = tof ;} + virtual void SetChargedBit(Bool_t ch){fCharged = ch; } + virtual void SetDistToBad(Int_t dist){fBadDist=dist;} + + TLorentzVector * Momentum() const {return fMomentum ; } + virtual void SetMomentum(TLorentzVector *lv) {fMomentum = lv ; } + + Bool_t IsPIDOK(const Int_t ipid, const Int_t pdgwanted) const; + + 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 + Int_t fCaloLabel[2]; // CaloCluster index, 1 for photons, 2 for pi0. + Int_t fTrackLabel[2]; // Track lable, 1 for pions, 2 for conversion photons + TString fDetector; // Detector where particle was measured. + + Bool_t fDisp ; //Dispersion bit + Bool_t fTof ; //TOF bit + Bool_t fCharged ; //Charged bit + Int_t fBadDist ; //Distance to bad module in module units + + ClassDef(AliAODPWG4Particle,1); +}; + +inline Double_t AliAODPWG4Particle::Phi() const +{ + // Return phi + Double_t phi = fMomentum->Phi(); + if (phi < 0.) phi += 2. * TMath::Pi(); + return phi; +} + +#endif //ALIAODPWG4PARTICLE_H diff --git a/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.cxx b/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.cxx new file mode 100755 index 00000000000..60f06750c2f --- /dev/null +++ b/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.cxx @@ -0,0 +1,152 @@ +/************************************************************************** + * 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: AliAODPWG4ParticleCorrelation.h $ */ + +//------------------------------------------------------------------------- +// AOD class for photon and other particles storage and +// correlation studies +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +//-- ROOT system -- + +//-- Analysis system +#include "AliAODPWG4ParticleCorrelation.h" +#include "AliAODJet.h" + +ClassImp(AliAODPWG4ParticleCorrelation) + + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::AliAODPWG4ParticleCorrelation() : + AliAODPWG4Particle(), fIsolated(kFALSE), + 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 +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::AliAODPWG4ParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e): + AliAODPWG4Particle(), fIsolated(kFALSE), + 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 + SetMomentum(new TLorentzVector(px, py, pz, e)); +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::AliAODPWG4ParticleCorrelation(TLorentzVector & p): + AliAODPWG4Particle(p), fIsolated(kFALSE), + 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 +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::AliAODPWG4ParticleCorrelation(AliAODPWG4Particle & p): + AliAODPWG4Particle(p), fIsolated(kFALSE), + 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 + +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::~AliAODPWG4ParticleCorrelation() +{ + // destructor + delete fRefTracks; + delete fRefClusters; + delete fRefIsolationConeTracks; + delete fRefIsolationConeClusters; + delete fRefBackgroundTracks; + delete fRefBackgroundClusters; + +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation::AliAODPWG4ParticleCorrelation(const AliAODPWG4ParticleCorrelation& part) : + AliAODPWG4Particle(part), fIsolated(part.fIsolated), + fRefTracks(), fRefClusters(), + fRefIsolationConeTracks(), fRefIsolationConeClusters(), + fRefBackgroundTracks(), fRefBackgroundClusters(), + fLeadingDetector(part.fLeadingDetector), fLeading(part.fLeading), + fCorrJet(part.fCorrJet), fCorrBkg(part.fCorrBkg), fRefJet(part.fRefJet) +{ + // Copy constructor + 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); +} + +//______________________________________________________________________________ +AliAODPWG4ParticleCorrelation& AliAODPWG4ParticleCorrelation::operator=(const AliAODPWG4ParticleCorrelation& part) +{ + // Assignment operator + if(this!=&part) { + + fIsolated = part.fIsolated; + fRefJet = part.fRefJet ; + fLeadingDetector =part.fLeadingDetector; + fLeading = part.fLeading; + fCorrJet = part.fCorrJet ; + fCorrBkg = part.fCorrBkg; + + if( fRefTracks ) delete fRefTracks ; + if( fRefClusters) delete fRefClusters ; + if( fRefIsolationConeTracks ) delete fRefIsolationConeTracks ; + if( fRefIsolationConeClusters) delete fRefIsolationConeClusters ; + if( fRefBackgroundTracks ) delete fRefBackgroundTracks ; + if( fRefBackgroundClusters ) delete fRefBackgroundClusters ; + + 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 AliAODPWG4ParticleCorrelation::Print(Option_t* /*option*/) const +{ + // Print information of all data members + AliAODPWG4Particle::Print(""); + if(fIsolated) printf("Isolated! \n"); + printf("Leading Detector : %s\n",fLeadingDetector.Data()); + // if(fRefJet) fRefJet.Print(); + +} diff --git a/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.h b/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.h new file mode 100755 index 00000000000..618e78bb953 --- /dev/null +++ b/PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.h @@ -0,0 +1,102 @@ +#ifndef ALIAODPWG4PARTICLECORRELATION_H +#define ALIAODPWG4PARTICLECORRELATION_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliAODPWG4ParticleCorrelation.h $ */ + +//------------------------------------------------------------------------- +// Copy of AOD photon class, adapted for particle identification +// and correlations analysis +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +//-- ROOT system -- + +//-- Analysis system +#include "AliAODJet.h" +#include "AliAODPWG4Particle.h" + +class AliAODPWG4ParticleCorrelation : public AliAODPWG4Particle { + + public: + AliAODPWG4ParticleCorrelation(); + AliAODPWG4ParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e); + AliAODPWG4ParticleCorrelation(TLorentzVector & p); + AliAODPWG4ParticleCorrelation(AliAODPWG4Particle & p); + + virtual ~AliAODPWG4ParticleCorrelation(); + AliAODPWG4ParticleCorrelation(const AliAODPWG4ParticleCorrelation& photon); + AliAODPWG4ParticleCorrelation& operator=(const AliAODPWG4ParticleCorrelation& photon); + + virtual Float_t IsIsolated() const { return fIsolated ;} + virtual void SetIsolated(Bool_t iso) {fIsolated = iso ;} + + virtual TRefArray* GetRefTracks() const { return fRefTracks;} + virtual void AddTrack(TObject *tr) {fRefTracks->Add(tr);} + virtual TObject* GetTrack(Int_t i) const { return fRefTracks->At(i);} + + virtual TRefArray* GetRefClusters() const { return fRefClusters;} + virtual void AddCluster(TObject *tr) {fRefClusters->Add(tr);} + virtual TObject* GetCluster(Int_t i) const { return fRefClusters->At(i);} + + virtual TRefArray* GetRefIsolationConeTracks() const { return fRefIsolationConeTracks;} + virtual void AddIsolationConeTrack(TObject *tr) {fRefIsolationConeTracks->Add(tr);} + virtual TObject* GetIsolationConeTrack(Int_t i) const { return fRefIsolationConeTracks->At(i);} + + virtual TRefArray* GetRefIsolationConeClusters() const { return fRefIsolationConeClusters;} + virtual void AddIsolationConeCluster(TObject *tr) {fRefIsolationConeClusters->Add(tr);} + virtual TObject* GetIsolationConeCluster(Int_t i) const { return fRefIsolationConeClusters->At(i);} + + virtual TRefArray* GetRefBackgroundTracks() const { return fRefBackgroundTracks;} + virtual void AddBackgroundTrack(TObject *tr) {fRefBackgroundTracks->Add(tr);} + virtual TObject* GetBackgroundTrack(Int_t i) const { return fRefBackgroundTracks->At(i);} + + virtual TRefArray* GetRefBackgroundClusters() const { return fRefBackgroundClusters;} + virtual void AddBackgroundCluster(TObject *tr) {fRefBackgroundClusters->Add(tr);} + virtual TObject* GetBackgroundCluster(Int_t i) const { return fRefBackgroundClusters->At(i);} + + virtual TString GetLeadingDetector() const {return fLeadingDetector ; } + virtual void SetLeadingDetector(TString d) {fLeadingDetector = d ; } + + 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;} + + virtual void SetRefJet(AliAODJet* jet) { fRefJet = jet;} + virtual AliAODJet* GetJet() const {return ((AliAODJet*) fRefJet.GetObject());} + virtual TRef GetRefJet() const {return fRefJet;} + + virtual void Print(Option_t* /*option*/) const; + + private: + + Float_t fIsolated ; //Particle is isolated or not + + 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(AliAODPWG4ParticleCorrelation,1); +}; + + +#endif //ALIAODPWG4PARTICLECORRELATION_H diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx new file mode 100755 index 00000000000..ed52d4aae64 --- /dev/null +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx @@ -0,0 +1,389 @@ +/************************************************************************** + * 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 analysis algorithms +//-- Author: Gustavo Conesa (LNF-INFN) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include + +//---- AliRoot system ---- +#include "AliAODPWG4Particle.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCells.h" +#include "AliAODTrack.h" +#include "AliAnaPartCorrBaseClass.h" +#include "AliCaloTrackReader.h" +#include "AliCaloPID.h" +#include "AliFidutialCut.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" +#include "AliLog.h" +#include "AliAODPWG4ParticleCorrelation.h" + +ClassImp(AliAnaPartCorrBaseClass) + + +//_______________________________________________ + AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass() : + TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0), + fCheckCaloPID(0), fRecalculateCaloPID(0), fMinPt(0), fMaxPt(0), + fReader(0x0), + fInputAODBranch(0x0), fInputAODName(""), + fOutputAODBranch(0x0), fNewAOD(kFALSE), + fOutputAODName(""), fOutputAODClassName(""), + fAODCaloClusters(0x0), fAODCaloCells(0x0), + fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fNMS(0x0), + fHistoNPtBins(0), fHistoPtMax(0.), fHistoPtMin(0.), + fHistoNPhiBins(0), fHistoPhiMax(0.), fHistoPhiMin(0.), + fHistoNEtaBins(0), fHistoEtaMax(0.), fHistoEtaMin(0.) +{ + //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), + fInputAODBranch(new TClonesArray(*abc.fInputAODBranch)), fInputAODName(abc.fInputAODName), + fOutputAODBranch(new TClonesArray(*abc.fOutputAODBranch)),fNewAOD(abc.fNewAOD), + fOutputAODName(abc.fOutputAODName), fOutputAODClassName(abc.fOutputAODClassName), + fAODCaloClusters(new TClonesArray(*abc.fAODCaloClusters)), + fAODCaloCells(new AliAODCaloCells(*abc.fAODCaloCells)), + fCaloPID(abc.fCaloPID), fFidCut(abc.fFidCut), fIC(abc.fIC),fNMS(abc.fNMS), + fHistoNPtBins(abc.fHistoNPtBins), fHistoPtMax(abc.fHistoPtMax), fHistoPtMin(abc.fHistoPtMin), + fHistoNPhiBins(abc.fHistoNPhiBins), fHistoPhiMax(abc.fHistoPhiMax), fHistoPhiMin(abc.fHistoPhiMin), + fHistoNEtaBins(abc.fHistoNEtaBins), fHistoEtaMax(abc.fHistoEtaMax), fHistoEtaMin(abc.fHistoEtaMin) +{ + // 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 ; + 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; + + fInputAODBranch = new TClonesArray(*abc.fInputAODBranch) ; + fInputAODName = abc.fInputAODName; + fOutputAODBranch = new TClonesArray(*abc.fOutputAODBranch) ; + fNewAOD = abc.fNewAOD ; + fOutputAODName = abc.fOutputAODName; + fOutputAODClassName = abc.fOutputAODClassName; + + + fHistoNPtBins = abc.fHistoNPtBins; fHistoPtMax = abc.fHistoPtMax; fHistoPtMin = abc.fHistoPtMin; + fHistoNPhiBins = abc.fHistoNPhiBins; fHistoPhiMax = abc.fHistoPhiMax; fHistoPhiMin = abc.fHistoPhiMin; + fHistoNEtaBins = abc.fHistoNEtaBins; fHistoEtaMax = abc.fHistoEtaMax; fHistoEtaMin = abc.fHistoEtaMin; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass() +{ + // Remove all pointers except analysis output pointers. + + if(fOutputAODBranch){ + fOutputAODBranch->Clear() ; + delete fOutputAODBranch ; + } + + if(fInputAODBranch){ + fInputAODBranch->Clear() ; + delete fInputAODBranch ; + } + + 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::AddAODParticle(AliAODPWG4Particle pc) { + //Put AOD calo cluster in the AODParticleCorrelation array + + if(fOutputAODBranch){ + + Int_t i = fOutputAODBranch->GetEntriesFast(); + //new((*fOutputAODBranch)[i]) AliAODPWG4Particle(pc); + if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0) + new((*fOutputAODBranch)[i]) AliAODPWG4Particle(pc); + else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0) + new((*fOutputAODBranch)[i]) AliAODPWG4ParticleCorrelation(pc); + else + AliFatal(Form(">>> Cannot add an object of type < %s >, to the AOD TClonesArray \n", + fOutputAODBranch->GetClass()->GetName())); + } + else AliFatal("AddAODParticle: No AOD branch available!!!"); + +} + + +//___________________________________________________ +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(); + +} + +//___________________________________________________ +void AliAnaPartCorrBaseClass::ConnectInputOutputAODBranches() { + //Recover ouput and input AOD pointers for each event in the maker + fOutputAODBranch = (TClonesArray *) fReader->GetAOD()->FindListObject(fOutputAODName); + fInputAODBranch = (TClonesArray *) fReader->GetAOD()->FindListObject(fInputAODName); +} + +//__________________________________________________ +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(); + +} + +//__________________________________________________ +TString AliAnaPartCorrBaseClass::GetBaseParametersList() { + //Put data member values in string to keep in output container + + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + sprintf(onePar,"--- AliAnaPartCorrBaseClass ---\n") ; + parList+=onePar ; + sprintf(onePar,"Minimal P_t: %2.2f ; Max\n", fMinPt) ; + parList+=onePar ; + sprintf(onePar,"Minimal P_t: %2.2f ; Max\n", fMaxPt) ; + parList+=onePar ; + sprintf(onePar,"fDataMC =%d (Check MC information, on/off) \n",fDataMC) ; + parList+=onePar ; + sprintf(onePar,"fCheckFidCut=%d (Check Fidutial cut selection on/off) \n",fCheckFidCut) ; + parList+=onePar ; + sprintf(onePar,"fCheckCaloPIC =%d (Use Bayesian PID in calorimetes, on/off) \n",fCheckCaloPID) ; + parList+=onePar ; + sprintf(onePar,"fRecalculateCaloPID =%d (Calculate PID from shower/tof/tracking parameters, on/off) \n",fRecalculateCaloPID) ; + parList+=onePar ; + + return parList; + +} + +//__________________________________________________ + TClonesArray * AliAnaPartCorrBaseClass::GetCreateOutputAODBranch() { + //Create AOD branch filled in the analysis + + //if(fDebug > 0 ) + printf("Create AOD branch of %s objects and with name < %s >\n", + fOutputAODClassName.Data(),fOutputAODName.Data()) ; + + TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0); + aodBranch->SetName(fOutputAODName); + + return aodBranch ; + + } + +//__________________________________________________ +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; + fNewAOD = kFALSE ; + fOutputAODName = "PartCorr"; + fOutputAODClassName = "AliAODPWG4Particle"; + fInputAODName = "PartCorr"; + + //Histogrammes settings + fHistoNPtBins = 240 ; + fHistoPtMax = 120 ; + fHistoPtMin = 0. ; + + fHistoNPhiBins = 120 ; + fHistoPhiMax = TMath::TwoPi(); + fHistoPhiMin = 0. ; + + fHistoNEtaBins = 100 ; + fHistoEtaMax = 1 ; + fHistoEtaMin = -1 ; + +} + +//__________________________________________________________________ +void AliAnaPartCorrBaseClass::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + + if(! opt) + return; + printf("New AOD: = %d\n",fNewAOD); + printf("Input AOD name: = %s\n",fInputAODName.Data()); + printf("Output AOD name: = %s\n",fOutputAODName.Data()); + printf("Output AOD Class name: = %s\n",fOutputAODClassName.Data()); + printf("Min Photon pT = %2.2f\n", fMinPt) ; + printf("Max Photon pT = %3.2f\n", fMaxPt) ; + printf("Check PID = %d\n", fCheckCaloPID) ; + printf("Recalculate PID = %d\n", fRecalculateCaloPID) ; + printf("Check Fidutial cut = %d\n", fCheckFidCut) ; + printf("Check MC labels = %d\n", fDataMC); + printf("Debug Level = %d\n", fDebug); + printf("Histograms: %3.1f < pT < %3.1f, Nbin = %d\n", fHistoPtMin, fHistoPtMax, fHistoNPtBins); + printf("Histograms: %3.1f < phi < %3.1f, Nbin = %d\n", fHistoPhiMin, fHistoPhiMax, fHistoNPhiBins); + printf("Histograms: %3.1f < eta < %3.1f, Nbin = %d\n", fHistoEtaMin, fHistoEtaMax, fHistoNEtaBins); + + printf(" \n") ; + +} diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h new file mode 100755 index 00000000000..3766480ad30 --- /dev/null +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h @@ -0,0 +1,207 @@ +#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 "AliAODPWG4Particle.h" +class AliCaloTrackReader ; +class AliCaloPID ; +class AliFidutialCut ; +class AliIsolationCut ; +class AliNeutralMesonSelection ; +class AliStack ; +class AliHeader ; +class AliGenEventHeader ; + + +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 AddAODParticle(AliAODPWG4Particle pc) ; + + virtual void ConnectAODCaloClusters(); + virtual void ConnectAODPHOSCells(); + virtual void ConnectAODEMCALCells(); + virtual void ConnectInputOutputAODBranches(); + + virtual TList * GetCreateOutputObjects() { return (new TList) ;} + + virtual void Init() {;} + virtual void InitParameters() ; + + 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 ; } + + //analysis AOD branch + virtual TClonesArray * GetCreateOutputAODBranch() ; + //{return (new TClonesArray("AliAODPWG4Particle",0)) ;} + virtual TString GetInputAODName() const {return fInputAODName ; } + virtual void SetInputAODName(TString name) { fInputAODName = name; } + virtual TString GetOutputAODName() const {return fOutputAODName ; } + virtual void SetOutputAODName(TString name) { fNewAOD = kTRUE ; fOutputAODName = name; } + virtual Bool_t NewOutputAOD() const {return fNewAOD;} + virtual TString GetOutputAODClassName() const {return fOutputAODClassName;} + virtual void SetOutputAODClassName(TString name) {fOutputAODClassName = name; } + + virtual TClonesArray* GetInputAODBranch() const {return fInputAODBranch ;} + virtual TClonesArray* GetOutputAODBranch() const {return fOutputAODBranch ;} + + 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 TString GetBaseParametersList(); + + virtual TNamed * GetEMCALCells() const ; + virtual TNamed * GetPHOSCells() const ; + + virtual AliStack * GetMCStack() const ; + virtual AliHeader* GetMCHeader() const ; + virtual AliGenEventHeader* GetMCGenEventHeader() const ; + + + 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() const {return fCheckFidCut ; } + virtual void SwitchOnFidutialCut() { fCheckFidCut = kTRUE;} + virtual void SwitchOffFidutialCut() { fCheckFidCut = kFALSE;} + + virtual Bool_t IsCaloPIDOn() const {return fCheckCaloPID ; } + virtual void SwitchOnCaloPID() { fCheckCaloPID = kTRUE;} + virtual void SwitchOffCaloPID() { fCheckCaloPID = kFALSE;} + + virtual Bool_t IsCaloPIDRecalculationOn() const {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;} + + + //Histogrammes setters and getters + virtual void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNPtBins = n ; + fHistoPtMax = max ; + fHistoPtMin = min ; + } + + Int_t GetHistoNPtBins() const { return fHistoNPtBins ; } + Float_t GetHistoPtMin() const { return fHistoPtMin ; } + Float_t GetHistoPtMax() const { return fHistoPtMax ; } + + virtual void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNPhiBins = n ; + fHistoPhiMax = max ; + fHistoPhiMin = min ; + } + + Int_t GetHistoNPhiBins() const { return fHistoNPhiBins ; } + Float_t GetHistoPhiMin() const { return fHistoPhiMin ; } + Float_t GetHistoPhiMax() const { return fHistoPhiMax ; } + + virtual void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNEtaBins = n ; + fHistoEtaMax = max ; + fHistoEtaMin = min ; + } + + Int_t GetHistoNEtaBins() const { return fHistoNEtaBins ; } + Float_t GetHistoEtaMin() const { return fHistoEtaMin ; } + Float_t GetHistoEtaMax() const { return fHistoEtaMax ; } + + + 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* fInputAODBranch ; //! Selected input particles branch + TString fInputAODName ; // Name of input AOD branch; + TClonesArray* fOutputAODBranch ; //! Selected output particles branch + Bool_t fNewAOD ; // Flag, new aod branch added to the analysis or not. + TString fOutputAODName ; // Name of output AOD branch; + TString fOutputAODClassName; // Type of aod objects to be stored in the TClonesArray (AliAODPWG4Particle, AliAODPWG4ParticleCorrelation ...) + + 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 + + //Histograms binning and range + Int_t fHistoNPtBins ; //Number of bins in pt axis + Float_t fHistoPtMax ; //Maximum value of pt histogram range + Float_t fHistoPtMin ; //Minimum value of pt histogram range + Int_t fHistoNPhiBins ; //Number of bins in phi axis + Float_t fHistoPhiMax ; //Maximum value of phi histogram range + Float_t fHistoPhiMin ; //Minimum value of phi histogram range + Int_t fHistoNEtaBins ; //Number of bins in eta axis + Float_t fHistoEtaMax ; //Maximum value of eta histogram range + Float_t fHistoEtaMin ; //Minimum value of eta histogram range + + ClassDef(AliAnaPartCorrBaseClass,2) +} ; + + +#endif //ALIANAPARTCORRBASECLASS_H + + + diff --git a/PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx b/PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx new file mode 100755 index 00000000000..22104e898dd --- /dev/null +++ b/PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx @@ -0,0 +1,225 @@ +/************************************************************************** + * 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 --- +class TClonesArray; +class TString ; +//#include "Riostream.h" + +//---- 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), fAODBranchList(new TList ) +{ + //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), fAODBranchList(g.fAODBranchList) +{ + // 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; + + fReader = source.fReader ; + fAODBranchList = source.fAODBranchList; + + 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(fAODBranchList){ +// for(Int_t iaod = 0; iaod < fAODBranchList->GetEntries(); iaod++) +// fAODBranchList->At(iaod)->Clear(); + + fAODBranchList->Clear(); + delete fAODBranchList ; + } + +} + +//________________________________________________________________________ +TList * AliAnaPartCorrMaker::GetAODBranchList() +{ + +// Get any new output AOD branches from analysis and put them in a list +// The list is filled in the maker, and new branch passed to the analysis frame +// AliAnalysisTaskPartCorr + + for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){ + + AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ; + if(ana->NewOutputAOD()) fAODBranchList->Add(ana->GetCreateOutputAODBranch()); + } + + return fAODBranchList ; + +} + +//________________________________________________________________________ +void AliAnaPartCorrMaker::Init() +{ + //Init container histograms and other common variables + + if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0) + AliFatal("Analysis job list not initialized"); + + for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){ + + AliAnaPartCorrBaseClass * ana = ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ; + ana->SetReader(fReader); //SetReader for each analysis + ana->Init(); + + if(fMakeHisto){// Analysis with histograms as output on + //Fill container with appropriate histograms + TList * templist = ana -> GetCreateOutputObjects(); + for(Int_t i = 0; i < templist->GetEntries(); i++) + fOutputContainer->Add(templist->At(i)) ; + }// Analysis with histograms as output on + }//Loop on analysis defined +} + +//____________________________________________________________________________ +void AliAnaPartCorrMaker::InitParameters() +{ + + //Init data members + fMakeHisto = kTRUE; + fMakeAOD = kTRUE; + fAnaDebug = 0; // No debugging info displayed by default + +} + +//__________________________________________________________________ +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("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 + for(Int_t iaod = 0; iaod < fAODBranchList->GetEntries(); iaod++) + fAODBranchList->At(iaod)->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)) ; + + ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis + + //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() ; + + } + + fReader->ResetLists(); + + if(fAnaDebug > 0 ) printf("*** End analysis *** \n"); + + return kTRUE ; + +} diff --git a/PWG4/PartCorrBase/AliAnaPartCorrMaker.h b/PWG4/PartCorrBase/AliAnaPartCorrMaker.h new file mode 100755 index 00000000000..f453e78f17c --- /dev/null +++ b/PWG4/PartCorrBase/AliAnaPartCorrMaker.h @@ -0,0 +1,86 @@ +#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 --- +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 * GetAODBranchList() ; + 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 AddAnalysis(TObject* ana, Int_t n) { + if ( fAnalysisContainer) fAnalysisContainer->AddAt(ana,n); + else { printf("AnalysisContainer not initialized"); + abort();} + } + + 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 + TList * fAODBranchList ; //! List with AOD branches created and needed in analysis + + ClassDef(AliAnaPartCorrMaker,2) +} ; + + +#endif //ALIANAPARTCORRMAKER_H + + + diff --git a/PWG4/PartCorrBase/AliAnaScale.cxx b/PWG4/PartCorrBase/AliAnaScale.cxx new file mode 100755 index 00000000000..b2cbc20515a --- /dev/null +++ b/PWG4/PartCorrBase/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/PartCorrBase/AliAnaScale.h b/PWG4/PartCorrBase/AliAnaScale.h new file mode 100755 index 00000000000..5d3e08d0ba2 --- /dev/null +++ b/PWG4/PartCorrBase/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/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx new file mode 100755 index 00000000000..744405ffe08 --- /dev/null +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx @@ -0,0 +1,173 @@ +/************************************************************************** + * 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: $ */ + +//_________________________________________________________________________ +// Analysis task that executes the analysis classes +// that depend on the PartCorr frame, frame for Particle identification and correlations. +// Specially designed for calorimeters but also can be used for charged tracks +// Input of this task is a configuration file that contains all the settings of the analyis +// +// -- Author: Gustavo Conesa (INFN-LNF) + + +// 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"); + + +// TClonesArray * aodBranch = new TClonesArray(fAna->GetAODBranchClassName(), 0); +// aodBranch->SetName(fAna->GetAODBranchName()); +// AddAODBranch("TClonesArray", &aodBranch); +// fAna->SetAODBranch(aodBranch); + + //Get list of aod arrays, add each aod array to analysis frame + TClonesArray * array = 0; + TList * list = fAna->GetAODBranchList(); + for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ + array = (TClonesArray*) list->At(iaod); + AddAODBranch("TClonesArray", &array); + } + + //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/PartCorrBase/AliAnalysisTaskParticleCorrelation.h b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h new file mode 100755 index 00000000000..757f4d288b4 --- /dev/null +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h @@ -0,0 +1,50 @@ +#ifndef ALIANALYSISTASKPARTICLECORRELATION_H +#define ALIANALYSISTASKPARTICLECORRELATION_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//_________________________________________________________________________ +// Analysis task that executes the analysis classes +// that depend on the PartCorr frame, frame for Particle identification and correlations. +// Specially designed for calorimeters but also can be used for charged tracks +// Input of this task is a configuration file that contains all the settings of the analyis +// +// -- Author: Gustavo Conesa (INFN-LNF) + +#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, 2); // Analysis task for standard gamma correlation analysis +}; + +#endif //ALIANALYSISTASKPARTICLECORRELATION_H diff --git a/PWG4/PartCorrBase/AliCaloPID.cxx b/PWG4/PartCorrBase/AliCaloPID.cxx new file mode 100755 index 00000000000..040dccacbb8 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloPID.cxx @@ -0,0 +1,411 @@ +/************************************************************************** + * 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 "AliAODCaloCluster.h" +#include "AliAODPWG4Particle.h" +#include "AliStack.h" +#include "TParticle.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), +fDispCut(0.),fTOFCut(0.), fDebug(-1) +{ + //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), +fDispCut(pid.fDispCut),fTOFCut(pid.fTOFCut), +fDebug(pid.fDebug) +{ + // 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; + + fDispCut = pid.fDispCut; + fTOFCut = pid.fTOFCut; + fDebug = pid.fDebug; + + return *this; + +} + +//_________________________________ +AliCaloPID::~AliCaloPID() { + //Dtor + + if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ; + if(fPHOSPi0WeightFormula) delete fPHOSPi0WeightFormula ; + +} + + +//_________________________________________________________________________ +Int_t AliCaloPID::CheckOrigin(const Int_t label, AliStack * stack) const { + //Play with the MC stack if available + //Check origin of the candidates, good for PYTHIA + + 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(fDebug > 0 && label < 8 ) printf("AliCaloPID::CheckOrigin: 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 if(fDebug > 0 ) printf("AliCaloPID::CheckOrigin: Parent with label %d\n",iParent); + + //return tag + if(mPdg == 22){ + if(mStatus == 1){ + if(iParent < 8) { + if(pPdg == 22) return kMCPrompt; + else return kMCFragmentation; + } + else if(pStatus == 11){ + if(pPdg == 111) return kMCPi0Decay ; + else if (pPdg == 321) return kMCEtaDecay ; + else return kMCOtherDecay ; + } + }//Status 1 : Pythia generated + else if(mStatus == 0){ + if(pPdg ==22 || pPdg ==11) return kMCConversion ; + if(pPdg == 111) return kMCPi0Decay ; + else if (pPdg == 221) return kMCEtaDecay ; + else return kMCOtherDecay ; + }//status 0 : geant generated + }//Mother Photon + else if(mPdg == 111) return kMCPi0 ; + else if(mPdg == 221) return kMCEta ; + else if(mPdg ==11){ + if(mStatus == 0) return kMCConversion ; + else return kMCElectron ; + } + else return kMCUnknown; + }//Good label value + else{ + if(label < 0 ) printf("AliCaloPID::CheckOrigin: *** bad label or no stack ***: label %d \n", label); + if(label >= stack->GetNtrack()) printf("AliCaloPID::CheckOrigin: *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack()); + return kMCUnknown; + }//Bad label + + return kMCUnknown; + +} + +//_______________________________________________________________ +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))"); + + fDispCut = 1.5; + fTOFCut = 5.e-9; + fDebug = -1; +} + +//_______________________________________________________________ +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 ; + + } + + if(fDebug > 0) printf("AliCaloPID::GetPdg: 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 ; + + } + + + if(fDebug > 0)printf("AliCaloPID::GetPdg:Final Pdg: %d \n", pdg); + + + + return pdg ; + +} + +//_______________________________________________________________ +Int_t AliCaloPID::GetPdg(const TString calo,const TLorentzVector mom, const AliAODCaloCluster * cluster) const { + //Recalculated PID with all parameters + if(fDebug > 0)printf("AliCaloPID::GetPdg: Calorimeter %s, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %1.11f, distCPV %3.2f, distToBC %1.1f, NMax %d\n", + calo.Data(),mom.E(),cluster->GetM02(),cluster->GetM20(),cluster->GetDispersion(),cluster->GetTOF(), + cluster->GetEmcCpvDistance(), cluster->GetDistToBadChannel(),cluster->GetNExMax()); + + if(calo == "EMCAL") { + if(cluster->GetM02()< 0.25) return kPhoton ; + else return kNeutralHadron ; + } + + // if(calo == "PHOS") { + // if(cluster->GetM02()< 0.25) return kPhoton ; + // else return kNeutralHadron ; + // } + + return kNeutralHadron ; + +} + +//__________________________________________________ +TString AliCaloPID::GetPIDParametersList() { + //Put data member values in string to keep in output container + + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + sprintf(onePar,"--- AliCaloPID ---\n") ; + parList+=onePar ; + sprintf(onePar,"fDispCut =%2.2f (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,"fEMCALPhotonWeight =%2.2f (EMCAL bayesian weight for photons)\n",fEMCALPhotonWeight) ; + parList+=onePar ; + sprintf(onePar,"fEMCALPi0Weight =%2.2f (EMCAL bayesian weight for pi0)\n",fEMCALPi0Weight) ; + parList+=onePar ; + sprintf(onePar,"fEMCALElectronWeight =%2.2f(EMCAL bayesian weight for electrons)\n",fEMCALElectronWeight) ; + parList+=onePar ; + sprintf(onePar,"fEMCALChargeWeight =%2.2f (EMCAL bayesian weight for charged hadrons)\n",fEMCALChargeWeight) ; + parList+=onePar ; + sprintf(onePar,"fEMCALNeutralWeight =%2.2f (EMCAL bayesian weight for neutral hadrons)\n",fEMCALNeutralWeight) ; + parList+=onePar ; + sprintf(onePar,"fPHOSPhotonWeight =%2.2f (PHOS bayesian weight for photons)\n",fPHOSPhotonWeight) ; + parList+=onePar ; + sprintf(onePar,"fPHOSPi0Weight =%2.2f (PHOS bayesian weight for pi0)\n",fPHOSPi0Weight) ; + parList+=onePar ; + sprintf(onePar,"fPHOSElectronWeight =%2.2f(PHOS bayesian weight for electrons)\n",fPHOSElectronWeight) ; + parList+=onePar ; + sprintf(onePar,"fPHOSChargeWeight =%2.2f (PHOS bayesian weight for charged hadrons)\n",fPHOSChargeWeight) ; + parList+=onePar ; + sprintf(onePar,"fPHOSNeutralWeight =%2.2f (PHOS bayesian weight for neutral hadrons)\n",fPHOSNeutralWeight) ; + parList+=onePar ; + + if(fPHOSWeightFormula){ + parList+="PHOS Photon Weight Formula: "+(fPHOSPhotonWeightFormula->GetExpFormula("p")); + parList+="PHOS Pi0 Weight Formula: "+(fPHOSPi0WeightFormula->GetExpFormula("p")); + } + + return parList; + +} + +//________________________________________________________________ +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 = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data()); + printf("Pi0 weight formula = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data()); + } + + printf("TOF cut = %e\n",fTOFCut); + printf("Dispersion cut = %2.2f\n",fDispCut); + printf("Debug level = %d\n",fDebug); + + printf(" \n"); + +} + +//_______________________________________________________________ +void AliCaloPID::SetPIDBits(const TString calo, const AliAODCaloCluster * cluster, AliAODPWG4Particle * ph) { + //Set Bits for PID selection + + //Dispersion/lambdas + Double_t disp=cluster->GetDispersion() ; + // Double_t m20=calo->GetM20() ; + // Double_t m02=calo->GetM02() ; + ph->SetDispBit(dispGetTOF() ; + ph->SetTOFBit(TMath::Abs(tof)GetEmcCpvDistance() ; + Int_t ntr=cluster->GetNTracksMatched(); //number of track matched + ph->SetChargedBit(ntr>0) ; //Temporary cut, should we evaluate distance? + + //Set PID pdg + ph->SetPdg(GetPdg(calo,cluster->PID(),ph->E())); + + if(fDebug > 0){ + printf("AliCaloPID::SetPIDBits: TOF %e, Dispersion %2.2f, NTracks %d\n",tof , disp, ntr); + printf("AliCaloPID::SetPIDBits: pdg %d, bits: TOF %d, Dispersion %d, Charge %d\n", + ph->GetPdg(), ph->GetTOFBit() , ph->GetDispBit() , ph->GetChargedBit()); + } +} + + diff --git a/PWG4/PartCorrBase/AliCaloPID.h b/PWG4/PartCorrBase/AliCaloPID.h new file mode 100755 index 00000000000..b55c1a231c3 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloPID.h @@ -0,0 +1,133 @@ +#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 TLorentzVector ; +class TFormula ; + +//--- AliRoot system --- +class AliLog ; +class AliAODCaloCluster; +class AliAODPWG4Particle; +#include "AliStack.h" + +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 mcTypes {kMCPrompt, kMCFragmentation, kMCPi0Decay, kMCEtaDecay, kMCOtherDecay, kMCPi0, kMCEta, kMCElectron, kMCConversion, kMCUnknown}; + + void InitParameters(); + Int_t CheckOrigin(const Int_t label, AliStack * stack) 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 AliAODCaloCluster * cluster) const ; + + TString GetPIDParametersList(); + + void SetPIDBits(const TString calo, const AliAODCaloCluster * cluster, AliAODPWG4Particle *aodph); + + void Print(const Option_t * opt)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; } + + //PID bits setters and getters + void SetDispersionCut(Float_t dcut ) {fDispCut = dcut; } + Float_t GetDispersionCut() const {return fDispCut ;} + + void SetTOFCut(Float_t tcut ) {fTOFCut = tcut; } + Float_t GetTOFCut() const {return fTOFCut ;} + + void SetDebug(Int_t deb) {fDebug=deb;} + Int_t GetDebug() const {return fDebug;} + +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 + + Float_t fDispCut; //Cut on dispersion, used in PID evaluation + Float_t fTOFCut; //Cut on TOF, used in PID evaluation + + Int_t fDebug; //Debug level + + ClassDef(AliCaloPID,2) +} ; + + +#endif //ALICALOPID_H + + + diff --git a/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx b/PWG4/PartCorrBase/AliCaloTrackAODReader.cxx new file mode 100755 index 00000000000..74a5f606126 --- /dev/null +++ b/PWG4/PartCorrBase/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 --- +//#include "Riostream.h" + +//---- 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" + +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]) const { + //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/PartCorrBase/AliCaloTrackAODReader.h b/PWG4/PartCorrBase/AliCaloTrackAODReader.h new file mode 100755 index 00000000000..e8ebc8c5124 --- /dev/null +++ b/PWG4/PartCorrBase/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]) const ; + + AliVEvent* GetInputEvent() const {return GetAOD();} + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + + ClassDef(AliCaloTrackAODReader,1) +} ; + + +#endif //ALICALOTRACKAODREADER_H + + + diff --git a/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx b/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx new file mode 100755 index 00000000000..ad4791d1948 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloTrackESDReader.cxx @@ -0,0 +1,319 @@ + +/************************************************************************** + * 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 --- +//#include "Riostream.h" + +//---- 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" + +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.2)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()) ; + + + if(fDebug > 3 && momentum.E() > 0.2) + printf("FillInputEMCAL():: Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, NexMax %d, TOF %e\n", + clus->GetDistanceToBadChannel(), clus->GetClusterDisp(),clus->GetM20(), clus->GetM02(), + 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()) ; + + if(fDebug > 3 && momentum.E() > 0.2) + printf("FillInputPHOS():: Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, EmcCpvDist %3.3f, NexMax %d, TOF %e\n", + 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) { + 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]) const { + //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/PartCorrBase/AliCaloTrackESDReader.h b/PWG4/PartCorrBase/AliCaloTrackESDReader.h new file mode 100755 index 00000000000..6c7135f10b3 --- /dev/null +++ b/PWG4/PartCorrBase/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]) const ; + + AliVEvent* GetInputEvent() const {return GetESD();} + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + ClassDef(AliCaloTrackESDReader,1) +} ; + + +#endif //ALICALOTRACKESDREADER_H + + + diff --git a/PWG4/PartCorrBase/AliCaloTrackMCReader.cxx b/PWG4/PartCorrBase/AliCaloTrackMCReader.cxx new file mode 100755 index 00000000000..600a52abff1 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloTrackMCReader.cxx @@ -0,0 +1,846 @@ +/************************************************************************** + * 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 "Riostream.h" + +//---- ANALYSIS system ---- +#include "AliCaloTrackMCReader.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]) const { + //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) ; + if(fDebug > 3 && momentum.Pt() > 0.2) + printf("Fill MC PHOS :: Selected tracks %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + } + } + //In EMCAL + else if(fFillEMCAL && fFidutialCut->IsInFidutialCut(momentum,"EMCAL") && momentum.Pt() > fEMCALPtMin){ + if(fClonesArrayType == kTParticle) new((*fAODEMCAL)[indexEMCAL++]) TParticle(*particle) ; + else{ + Char_t ttype= AliAODCluster::kEMCALClusterv1; + Int_t labels[] = {iParticle}; + Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()}; + AliAODCaloCluster *calo = new((*fAODEMCAL)[indexEMCAL++]) + AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0); + SetCaloClusterPID(particle->GetPdgCode(),calo) ; + if(fDebug > 3 && momentum.Pt() > 0.2) + printf("Fill MC EMCAL :: Selected tracks %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + } + } +} + +//____________________________________________________________________________ +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()->GetNtrack() ; 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) ){ + + //Skip bizarre particles, they crash when charge is calculated + if(TMath::Abs(pdg) == 3124 || TMath::Abs(pdg) > 10000000) continue ; + + 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) + if(SkipNeutralParticles(pdg)) continue ; + + //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) const {//, 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) const { +//Give a PID weight for tracks equal to 1 depending on the particle type + + 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); + } + + track->SetPID(pid); + + return; +} + +//____________________________________________________________________ +void AliCaloTrackMCReader::SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo) const { +//Give a PID weight for CaloClusters equal to 1 depending on the particle type + + Float_t pid[13] = {0., 0., 0., 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/PartCorrBase/AliCaloTrackMCReader.h b/PWG4/PartCorrBase/AliCaloTrackMCReader.h new file mode 100755 index 00000000000..48077d69631 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloTrackMCReader.h @@ -0,0 +1,90 @@ +#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]) const ; + + void FillInputEvent() ; + AliVEvent* GetInputEvent() const {return GetMC();} + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + void SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo) const ; + void SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track) const ; + + private: + + void MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, TLorentzVector &p2) const ;//, 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 //ALICALOTRACKMCREADER_H + + + diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx new file mode 100755 index 00000000000..1e85be8e641 --- /dev/null +++ b/PWG4/PartCorrBase/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/PartCorrBase/AliCaloTrackReader.h b/PWG4/PartCorrBase/AliCaloTrackReader.h new file mode 100755 index 00000000000..7d383759a75 --- /dev/null +++ b/PWG4/PartCorrBase/AliCaloTrackReader.h @@ -0,0 +1,151 @@ +#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" + +//--- ANALYSIS system --- +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}; + + virtual void InitParameters(); + virtual void Print(const Option_t * opt) const; + + 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 ; } + + + //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 AliESDEvent* GetESD() const {return fESD;} + virtual AliAODEvent* GetAOD() const {return fAOD;} + virtual AliMCEvent* GetMC() const {return fMC;} + virtual AliVEvent* GetInputEvent() const {return (new AliESDEvent());} + virtual void GetVertex(Double_t * ) const {;} + + 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/PartCorrBase/AliFidutialCut.cxx b/PWG4/PartCorrBase/AliFidutialCut.cxx new file mode 100755 index 00000000000..b6f73a9a800 --- /dev/null +++ b/PWG4/PartCorrBase/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/PartCorrBase/AliFidutialCut.h b/PWG4/PartCorrBase/AliFidutialCut.h new file mode 100755 index 00000000000..881c5245705 --- /dev/null +++ b/PWG4/PartCorrBase/AliFidutialCut.h @@ -0,0 +1,131 @@ +#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 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/PartCorrBase/AliIsolationCut.cxx b/PWG4/PartCorrBase/AliIsolationCut.cxx new file mode 100755 index 00000000000..51aa77b3cf5 --- /dev/null +++ b/PWG4/PartCorrBase/AliIsolationCut.cxx @@ -0,0 +1,225 @@ +/************************************************************************** + * 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" +class AliLog ; +#include "AliAODPWG4ParticleCorrelation.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; + +} + + +//____________________________________________________________________________ +TString AliIsolationCut::GetICParametersList() +{ + //Put data member values in string to keep in output container + + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + + sprintf(onePar,"--- AliIsolationCut ---\n") ; + parList+=onePar ; + sprintf(onePar,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ; + parList+=onePar ; + sprintf(onePar,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ; + parList+=onePar ; + sprintf(onePar,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ; + parList+=onePar ; + sprintf(onePar,"fICMethod=%d (isolation cut case) \n",fICMethod) ; + parList+=onePar ; + + return parList; +} + +//____________________________________________________________________________ +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, AliAODPWG4ParticleCorrelation *pCandidate, + Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) const +{ + //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 ++ ){ + AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ; + //Do not count the candidate (pion, conversion photon) or the daughters of the candidate + if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)) continue ; + 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 ++ ){ + AliAODCaloCluster * calo = (AliAODCaloCluster *)(plNe->At(ipr)) ; + + //Do not count the candidate (photon or pi0) or the daughters of the candidate + if(calo->GetID() == pCandidate->GetCaloLabel(0) || calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; //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/PartCorrBase/AliIsolationCut.h b/PWG4/PartCorrBase/AliIsolationCut.h new file mode 100755 index 00000000000..c464f486d78 --- /dev/null +++ b/PWG4/PartCorrBase/AliIsolationCut.h @@ -0,0 +1,72 @@ +#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 +class TSeqCollection ; + +// --- ANALYSIS system --- +class AliAODPWG4ParticleCorrelation ; + +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 ; } + TString GetICParametersList() ; + + void MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex, + const Bool_t fillAOD, AliAODPWG4ParticleCorrelation * pCandidate, + Int_t &n, Int_t & nfrac, Float_t &ptsum, Bool_t & isolated) const ; + + 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/PartCorrBase/AliNeutralMesonSelection.cxx b/PWG4/PartCorrBase/AliNeutralMesonSelection.cxx new file mode 100755 index 00000000000..93f8b4be469 --- /dev/null +++ b/PWG4/PartCorrBase/AliNeutralMesonSelection.cxx @@ -0,0 +1,313 @@ + /************************************************************************** + * 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), + fHistoNEBins(0), fHistoEMax(0.), fHistoEMin(0.), + fHistoNPtBins(0), fHistoPtMax(0.), fHistoPtMin(0.), + fHistoNAngleBins(0), fHistoAngleMax(0.), fHistoAngleMin(0.), + fHistoNIMBins(0), fHistoIMMax(0.), fHistoIMMin(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), + fHistoNEBins(g.fHistoNEBins), fHistoEMax(g.fHistoEMax), fHistoEMin(g.fHistoEMin), + fHistoNPtBins(g.fHistoNPtBins), fHistoPtMax(g.fHistoPtMax), fHistoPtMin(g.fHistoPtMin), + fHistoNAngleBins(g.fHistoNAngleBins), fHistoAngleMax(g.fHistoAngleMax), fHistoAngleMin(g.fHistoAngleMin), + fHistoNIMBins(g.fHistoNIMBins), fHistoIMMax(g.fHistoIMMax), fHistoIMMin(g.fHistoIMMin) +{ + // 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 ; + + fHistoNEBins = source.fHistoNEBins; fHistoEMax = source.fHistoEMax; fHistoEMin = source.fHistoEMin; + fHistoNPtBins = source.fHistoNPtBins; fHistoPtMax = source.fHistoPtMax; fHistoPtMin = source.fHistoPtMin; + fHistoNAngleBins = source.fHistoNAngleBins; fHistoAngleMax = source.fHistoAngleMax; fHistoAngleMin = source.fHistoAngleMin; + fHistoNIMBins = source.fHistoNIMBins; fHistoIMMax = source.fHistoIMMax; fHistoIMMin = source.fHistoIMMin; + + 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}}",fHistoNEBins,fHistoEMin,fHistoEMax,fHistoNAngleBins,fHistoAngleMin,fHistoAngleMax); + 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}}" + ,fHistoNEBins,fHistoEMin,fHistoEMax,fHistoNAngleBins,fHistoAngleMin,fHistoAngleMax); + 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}}" + ,fHistoNEBins,fHistoEMin,fHistoEMax,fHistoNAngleBins,fHistoAngleMin,fHistoAngleMax); + fhAnglePairAllCut->SetYTitle("Angle (rad)"); + fhAnglePairAllCut->SetXTitle("E_{ #pi^{0}} (GeV)"); + + // + fhInvMassPairNoCut = new TH2F + ("InvMassPairNoCut","Invariant Mass of all #gamma pair vs E_{#pi^{0}}", + fHistoNPtBins,fHistoPtMin,fHistoPtMax,fHistoNIMBins,fHistoIMMin,fHistoIMMax); + 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}}", + fHistoNPtBins,fHistoPtMin,fHistoPtMax,fHistoNIMBins,fHistoIMMin,fHistoIMMax); + 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}}", + fHistoNPtBins,fHistoPtMin,fHistoPtMax,fHistoNIMBins,fHistoIMMin,fHistoIMMax); + 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 ; + + 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, pi0 + + //Histogrammes settings + fHistoNEBins = 100 ; + fHistoEMax = 50 ; + fHistoEMin = 0. ; + + fHistoNPtBins = 240 ; + fHistoPtMax = 120 ; + fHistoPtMin = 0. ; + + fHistoNAngleBins = 200 ; + fHistoAngleMax = 0.2; + fHistoAngleMin = 0. ; + + fHistoNIMBins = 300 ; + fHistoIMMax = 0.5 ; + fHistoIMMin = 0. ; +} + +//__________________________________________________________________________- +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); + + if(fKeepNeutralMesonHistos){ + printf("Histograms: %3.1f < E < %3.1f, Nbin = %d\n", fHistoEMin, fHistoEMax, fHistoNEBins); + printf("Histograms: %3.1f < pT < %3.1f, Nbin = %d\n", fHistoPtMin, fHistoPtMax, fHistoNPtBins); + printf("Histograms: %3.1f < angle < %3.1f, Nbin = %d\n", fHistoAngleMin, fHistoAngleMax, fHistoNAngleBins); + printf("Histograms: %3.1f < IM < %3.1f, Nbin = %d\n", fHistoIMMin, fHistoIMMax, fHistoNIMBins); + + } + +} diff --git a/PWG4/PartCorrBase/AliNeutralMesonSelection.h b/PWG4/PartCorrBase/AliNeutralMesonSelection.h new file mode 100755 index 00000000000..e26b3d2ba3a --- /dev/null +++ b/PWG4/PartCorrBase/AliNeutralMesonSelection.h @@ -0,0 +1,137 @@ +#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 ; + +//--- 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) ; + + //Histogrammes setters and getters + + virtual void SetHistoERangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNEBins = n ; + fHistoEMax = max ; + fHistoEMin = min ; + } + + Int_t GetHistoNEBins() const { return fHistoNEBins ; } + Float_t GetHistoEMin() const { return fHistoEMin ; } + Float_t GetHistoEMax() const { return fHistoEMax ; } + + virtual void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNPtBins = n ; + fHistoPtMax = max ; + fHistoPtMin = min ; + } + + Int_t GetHistoNPtBins() const { return fHistoNPtBins ; } + Float_t GetHistoPtMin() const { return fHistoPtMin ; } + Float_t GetHistoPtMax() const { return fHistoPtMax ; } + + virtual void SetHistoAngleRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNAngleBins = n ; + fHistoAngleMax = max ; + fHistoAngleMin = min ; + } + + Int_t GetHistoNAngleBins() const { return fHistoNAngleBins ; } + Float_t GetHistoAngleMin() const { return fHistoAngleMin ; } + Float_t GetHistoAngleMax() const { return fHistoAngleMax ; } + + virtual void SetHistoIMRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNIMBins = n ; + fHistoIMMax = max ; + fHistoIMMin = min ; + } + + Int_t GetHistoNIMBins() const { return fHistoNIMBins ; } + Float_t GetHistoIMMin() const { return fHistoIMMin ; } + Float_t GetHistoIMMax() const { return fHistoIMMax ; } + + +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 + + //Histograms binning and range + Int_t fHistoNEBins ; //Number of bins in pi0 E axis + Float_t fHistoEMax ; //Maximum value of pi0 E histogram range + Float_t fHistoEMin ; //Minimum value of pi0 E histogram range + Int_t fHistoNPtBins ; //Number of bins in Pt trigger axis + Float_t fHistoPtMax ; //Maximum value of Pt trigger histogram range + Float_t fHistoPtMin ; //Minimum value of Pt trigger histogram range + Int_t fHistoNAngleBins ; //Number of bins in angle axis + Float_t fHistoAngleMax ;//Maximum value of angle histogram range + Float_t fHistoAngleMin ;//Minimum value of angle histogram range + Int_t fHistoNIMBins ; //Number of bins in Invariant Mass axis + Float_t fHistoIMMax ; //Maximum value of Invariant Mass histogram range + Float_t fHistoIMMin ; //Minimum value of Invariant Mass histogram range + + ClassDef(AliNeutralMesonSelection,2) + +} ; + + +#endif //ALINEUTRALMESONSELECTION_H + + + diff --git a/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx b/PWG4/PartCorrDep/AliAnaCaloTrigger.cxx new file mode 100755 index 00000000000..140ce55cd51 --- /dev/null +++ b/PWG4/PartCorrDep/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 *) const +//{ +// // Processing when the event loop is ended +// +//} diff --git a/PWG4/PartCorrDep/AliAnaCaloTrigger.h b/PWG4/PartCorrDep/AliAnaCaloTrigger.h new file mode 100755 index 00000000000..c173eacbaff --- /dev/null +++ b/PWG4/PartCorrDep/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 = "") const ; + + 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/PartCorrDep/AliAnaCaloTriggerMC.cxx b/PWG4/PartCorrDep/AliAnaCaloTriggerMC.cxx new file mode 100755 index 00000000000..277624cd855 --- /dev/null +++ b/PWG4/PartCorrDep/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 *) const +//{ +// // Processing when the event loop is ended +// +//} diff --git a/PWG4/PartCorrDep/AliAnaCaloTriggerMC.h b/PWG4/PartCorrDep/AliAnaCaloTriggerMC.h new file mode 100755 index 00000000000..4a8a254bad0 --- /dev/null +++ b/PWG4/PartCorrDep/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 = "") const ; + + 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/PartCorrDep/AliAnaExample.cxx b/PWG4/PartCorrDep/AliAnaExample.cxx new file mode 100755 index 00000000000..f77a62eff82 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaExample.cxx @@ -0,0 +1,374 @@ +/************************************************************************** + * 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) +//_________________________________________________________________________ + + +// --- ROOT system --- +//#include "Riostream.h" +#include "TClonesArray.h" +#include "TParticle.h" + +//---- AliRoot system ---- +#include "AliAnaExample.h" +#include "AliCaloTrackReader.h" +#include "AliLog.h" +#include "AliAODPWG4Particle.h" +#include "AliESDCaloCells.h" +#include "AliStack.h" +#include "AliCaloPID.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") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + fhPt = new TH1F ("hPt","p_T distribution", nptbins,ptmin,ptmax); + fhPt->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPt); + + fhPhi = new TH1F ("hPhi","#phi distribution",nphibins,phimin,phimax); + fhPhi->SetXTitle("#phi (rad)"); + outputContainer->Add(fhPhi); + + fhEta = new TH1F ("hEta","#eta distribution",netabins,etamin,etamax); + 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", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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", nphibins,phimin,phimax, nphibins,phimin,phimax); + fh2Phi->SetXTitle("#phi_{rec} (rad)"); + fh2Phi->SetYTitle("#phi_{gen} (rad)"); + outputContainer->Add(fh2Phi); + + fh2Eta = new TH2F ("h2Eta","#eta distribution, reconstructed vs generated", netabins,etamin,etamax,netabins,etamin,etamax); + fh2Eta->SetXTitle("#eta_{rec} "); + fh2Eta->SetYTitle("#eta_{gen} "); + outputContainer->Add(fh2Eta); + + } + return outputContainer; +} + + //__________________________________________________ +void AliAnaExample::InitParameters() +{ + //Initialize the parameters of the analysis. + SetOutputAODClassName("AliAODPWG4Particle"); + SetOutputAODName("example"); + 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 AODParticle 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 = (AliAODCaloCluster*) (partList->At(i)); + + //Fill AODCaloClusters + if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + AddAODCaloCluster(AliAODCaloCluster(*(calo))); + + //Fill AODParticle 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()); + //pdg = GetCaloPID()->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) { + AliAODPWG4Particle ph = AliAODPWG4Particle(mom); + //AddAODParticleCorrelation(AliAODPWG4ParticleCorrelation(mom)); + ph.SetLabel(calo->GetLabel(0)); + ph.SetPdg(pdg); + ph.SetDetector(fDetector); + AddAODParticle(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(); + } + + if(!esdCell) AliFatal("No CELLS available for analysis"); + + //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 AODParticle with CTS aods + TVector3 p3; + for(Int_t i = 0; i < GetAODCTS()->GetEntriesFast(); i++){ + + AliAODTrack * track = (AliAODTrack*) (GetAODCTS()->At(i)); + + //Fill AODParticle 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) { + AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0); + tr.SetDetector("CTS"); + AddAODParticle(tr); + }//selection + }//loop + }//CTS analysis + + if(GetDebug() > 0) { + if(fDetector!="CTS" && GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + printf("Example: final aod calocluster entries %d\n", GetAODCaloClusters()->GetEntriesFast()); + printf("Example: final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast()); + if(fDetector!="CTS" && GetReader()->GetDataType()!= AliCaloTrackReader::kMC) + 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 = GetOutputAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("histo aod branch entries %d\n", naod); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->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/PartCorrDep/AliAnaExample.h b/PWG4/PartCorrDep/AliAnaExample.h new file mode 100755 index 00000000000..cac88c15d37 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaExample.h @@ -0,0 +1,67 @@ +#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) + +#include "TH2F.h" +#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/PartCorrDep/AliAnaParticleHadronCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx new file mode 100755 index 00000000000..bc5c925ea37 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx @@ -0,0 +1,542 @@ +/************************************************************************** + * 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 "TH2F.h" + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliNeutralMesonSelection.h" +#include "AliAnaParticleHadronCorrelation.h" +#include "AliCaloTrackReader.h" +#include "AliCaloPID.h" +#include "AliAODPWG4ParticleCorrelation.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") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + //Correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn()) { + fhPhiCharged = new TH2F + ("PhiCharged","#phi_{h^{#pm}} vs p_{T trigger}", + nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiCharged->SetYTitle("#phi_{h^{#pm}} (rad)"); + fhPhiCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaCharged = new TH2F + ("EtaCharged","#eta_{h^{#pm}} vs p_{T trigger}", + nptbins,ptmin,ptmax,netabins,etamin,etamax); + 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}", + nptbins,ptmin,ptmax,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}}", + nptbins,ptmin,ptmax,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}", + nptbins,ptmin,ptmax,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}", + nptbins,ptmin,ptmax,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}", + nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaNeutral = new TH2F + ("EtaNeutral","#eta_{#pi^{0}} vs p_{T trigger}", + nptbins,ptmin,ptmax,netabins,etamin,etamax); + 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}", + nptbins,ptmin,ptmax,nphibins,phimin,phimax); + 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}}}", + nptbins,ptmin,ptmax,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}", + nptbins,ptmin,ptmax,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}", + nptbins,ptmin,ptmax,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() ; + if(GetNeutralMesonSelection()->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. + SetInputAODName("photons"); + 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(!GetInputAODBranch()) + AliFatal(Form("ParticleHadronCorrelation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->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 = GetInputAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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 histograms + + if(!GetInputAODBranch()) + AliFatal(Form("ParticleHadronCorrelation::FillHistos: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast()); + } + + //Loop on stored AOD particles + Int_t naod = GetInputAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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(AliAODPWG4ParticleCorrelation *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 = (AliAODTrack *) (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(AliAODPWG4ParticleCorrelation * 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 = (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 = (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) const { + //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);//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/PartCorrDep/AliAnaParticleHadronCorrelation.h b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h new file mode 100755 index 00000000000..27333aa4604 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h @@ -0,0 +1,75 @@ +#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 AliAODPWG4ParticleCorrelation ; + +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(AliAODPWG4ParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + void MakeNeutralCorrelation(AliAODPWG4ParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) const ; + + 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/PartCorrDep/AliAnaParticleIsolation.cxx b/PWG4/PartCorrDep/AliAnaParticleIsolation.cxx new file mode 100755 index 00000000000..293539d4a07 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleIsolation.cxx @@ -0,0 +1,988 @@ +/************************************************************************** + * 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 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: AliAnaParticleIsolation.cxx 28688 2008-09-11 15:04:07Z gconesab $ */ + +//_________________________________________________________________________ +// Class for analysis of particle isolation +// Input is selected particles put in AOD branch (AliAODPWG4ParticleCorrelation) +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) +// +// -- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include + +// --- Analysis system --- +#include "AliAnaParticleIsolation.h" +#include "AliLog.h" +#include "AliCaloTrackReader.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" +#include "AliAODPWG4ParticleCorrelation.h" +#include "AliCaloPID.h" + +ClassImp(AliAnaParticleIsolation) + +//____________________________________________________________________________ + AliAnaParticleIsolation::AliAnaParticleIsolation() : + AliAnaPartCorrBaseClass(), fCalorimeter(""), fVertex(), + fReMakeIC(0), fMakeSeveralIC(0), fMakeInvMass(0), + fhPtIso(0),fhPhiIso(0),fhEtaIso(0), fhConeSumPt(0), fhPtInCone(0), + //Several IC + fNCones(0),fNPtThresFrac(0), fConeSizes(), fPtThresholds(), fPtFractions(), + //MC + fhPtIsoPrompt(0),fhPhiIsoPrompt(0),fhEtaIsoPrompt(0), + fhPtThresIsolatedPrompt(), fhPtFracIsolatedPrompt(), fhPtSumIsolatedPrompt(), + fhPtIsoFragmentation(0),fhPhiIsoFragmentation(0),fhEtaIsoFragmentation(0), + fhPtThresIsolatedFragmentation(), fhPtFracIsolatedFragmentation(), fhPtSumIsolatedFragmentation(), + fhPtIsoPi0Decay(0),fhPhiIsoPi0Decay(0),fhEtaIsoPi0Decay(0), + fhPtThresIsolatedPi0Decay(), fhPtFracIsolatedPi0Decay(), fhPtSumIsolatedPi0Decay(), + fhPtIsoOtherDecay(0),fhPhiIsoOtherDecay(0),fhEtaIsoOtherDecay(0), + fhPtThresIsolatedOtherDecay(), fhPtFracIsolatedOtherDecay(), fhPtSumIsolatedOtherDecay(), + fhPtIsoConversion(0),fhPhiIsoConversion(0),fhEtaIsoConversion(0), + fhPtThresIsolatedConversion(), fhPtFracIsolatedConversion(), fhPtSumIsolatedConversion(), + fhPtIsoUnknown(0),fhPhiIsoUnknown(0),fhEtaIsoUnknown(0), + fhPtThresIsolatedUnknown(), fhPtFracIsolatedUnknown(), fhPtSumIsolatedUnknown(), + //Histograms settings + fHistoNPtSumBins(0), fHistoPtSumMax(0.), fHistoPtSumMin(0.), + fHistoNPtInConeBins(0), fHistoPtInConeMax(0.), fHistoPtInConeMin(0.) +{ + //default ctor + + //Initialize parameters + InitParameters(); + + fVertex[0] = 0.; fVertex[1] = 0.; fVertex[2] = 0.; + + 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 ; + } + + +} + +//____________________________________________________________________________ +AliAnaParticleIsolation::AliAnaParticleIsolation(const AliAnaParticleIsolation & g) : + AliAnaPartCorrBaseClass(g), fCalorimeter(g.fCalorimeter),fVertex(), + fReMakeIC(g.fReMakeIC), fMakeSeveralIC(g.fMakeSeveralIC), fMakeInvMass(g.fMakeInvMass), + fhPtIso(g.fhPtIso),fhPhiIso(g.fhPhiIso),fhEtaIso(g.fhEtaIso), + fhConeSumPt(g.fhConeSumPt), fhPtInCone(g.fhPtInCone), + //Several IC + fNCones(g.fNCones),fNPtThresFrac(g.fNPtThresFrac), fConeSizes(), fPtThresholds(), fPtFractions(), + fhPtThresIsolated(), fhPtFracIsolated(), fhPtSumIsolated(), + //MC + fhPtIsoPrompt(g.fhPtIsoPrompt),fhPhiIsoPrompt(g.fhPhiIsoPrompt),fhEtaIsoPrompt(g.fhEtaIsoPrompt), + fhPtThresIsolatedPrompt(), fhPtFracIsolatedPrompt(), fhPtSumIsolatedPrompt(), + fhPtIsoFragmentation(g.fhPtIsoFragmentation),fhPhiIsoFragmentation(g.fhPhiIsoFragmentation),fhEtaIsoFragmentation(g.fhEtaIsoFragmentation), + fhPtThresIsolatedFragmentation(), fhPtFracIsolatedFragmentation(), fhPtSumIsolatedFragmentation(), + fhPtIsoPi0Decay(g.fhPtIsoPi0Decay),fhPhiIsoPi0Decay(g.fhPhiIsoPi0Decay),fhEtaIsoPi0Decay(g.fhEtaIsoPi0Decay), + fhPtThresIsolatedPi0Decay(), fhPtFracIsolatedPi0Decay(), fhPtSumIsolatedPi0Decay(), + fhPtIsoOtherDecay(g.fhPtIsoOtherDecay),fhPhiIsoOtherDecay(g.fhPhiIsoOtherDecay),fhEtaIsoOtherDecay(g.fhEtaIsoOtherDecay), + fhPtThresIsolatedOtherDecay(), fhPtFracIsolatedOtherDecay(), fhPtSumIsolatedOtherDecay(), + fhPtIsoConversion(g. fhPtIsoConversion),fhPhiIsoConversion(g.fhPhiIsoConversion),fhEtaIsoConversion(g.fhEtaIsoConversion), + fhPtThresIsolatedConversion(), fhPtFracIsolatedConversion(), fhPtSumIsolatedConversion(), + fhPtIsoUnknown(g.fhPtIsoUnknown),fhPhiIsoUnknown(g.fhPhiIsoUnknown),fhEtaIsoUnknown(g.fhEtaIsoUnknown), + fhPtThresIsolatedUnknown(), fhPtFracIsolatedUnknown(), fhPtSumIsolatedUnknown(), + //Histograms + fHistoNPtSumBins(g.fHistoNPtSumBins), fHistoPtSumMax(g.fHistoPtSumMax), fHistoPtSumMin(g.fHistoPtSumMax), + fHistoNPtInConeBins(g.fHistoNPtInConeBins), fHistoPtInConeMax(g.fHistoPtInConeMax), fHistoPtInConeMin(g.fHistoPtInConeMin) +{ + // cpy ctor + + fVertex[0] = g.fVertex[0]; + fVertex[1] = g.fVertex[1]; + fVertex[2] = g.fVertex[2]; + + //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]; + } + +} + +//_________________________________________________________________________ +AliAnaParticleIsolation & AliAnaParticleIsolation::operator = (const AliAnaParticleIsolation & g) +{ + // assignment operator + + if(&g == this) return *this; + + fReMakeIC = g.fReMakeIC ; + fMakeSeveralIC = g.fMakeSeveralIC ; + fMakeInvMass = g.fMakeInvMass ; + fCalorimeter = g.fCalorimeter ; + fVertex[0] = g.fVertex[0]; + fVertex[1] = g.fVertex[1]; + fVertex[2] = g.fVertex[2]; + + fhConeSumPt = g.fhConeSumPt ; + fhPtInCone = g.fhPtInCone; + + fhPtIso = g.fhPtIso ; + fhPhiIso = g.fhPhiIso ; + fhEtaIso = g.fhEtaIso ; + + fhPtIsoPrompt = g.fhPtIsoPrompt; + fhPhiIsoPrompt = g.fhPhiIsoPrompt; + fhEtaIsoPrompt = g.fhEtaIsoPrompt; + fhPtIsoFragmentation = g.fhPtIsoFragmentation; + fhPhiIsoFragmentation = g.fhPhiIsoFragmentation; + fhEtaIsoFragmentation = g.fhEtaIsoFragmentation; + fhPtIsoPi0Decay = g.fhPtIsoPi0Decay; + fhPhiIsoPi0Decay = g.fhPhiIsoPi0Decay; + fhEtaIsoPi0Decay = g.fhEtaIsoPi0Decay; + fhPtIsoOtherDecay = g.fhPtIsoOtherDecay; + fhPhiIsoOtherDecay = g.fhPhiIsoOtherDecay; + fhEtaIsoOtherDecay = g.fhEtaIsoOtherDecay; + fhPtIsoConversion = g. fhPtIsoConversion; + fhPhiIsoConversion = g.fhPhiIsoConversion; + fhEtaIsoConversion = g.fhEtaIsoConversion; + fhPtIsoUnknown = g.fhPtIsoUnknown; + fhPhiIsoUnknown = g.fhPhiIsoUnknown; + fhEtaIsoUnknown = g.fhEtaIsoUnknown; + + //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]; + } + + + fHistoNPtSumBins = g.fHistoNPtSumBins; + fHistoPtSumMax = g.fHistoPtSumMax; + fHistoPtSumMin = g.fHistoPtSumMax; + fHistoNPtInConeBins = g.fHistoNPtInConeBins; + fHistoPtInConeMax = g.fHistoPtInConeMax; + fHistoPtInConeMin = g.fHistoPtInConeMin; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaParticleIsolation::~AliAnaParticleIsolation() +{ + //dtor + //do not delete histograms + + delete [] fConeSizes ; + delete [] fPtThresholds ; + delete [] fPtFractions ; + delete [] fVertex ; +} + +//_________________________________________________________________________ +Bool_t AliAnaParticleIsolation::CheckInvMass(const Int_t iaod, const AliAODPWG4ParticleCorrelation * part1) const +{ + // Search if there is a companion decay photon to the candidate + // and discard it in such case + // Use it only if isolation candidates are photons + // Make sure that no selection on photon pt is done in the input aod photon list. + TLorentzVector mom1 = *(part1->Momentum()); + TLorentzVector mom2 ; + for(Int_t jaod = 0; jaod < GetInputAODBranch()->GetEntriesFast(); jaod++){ + if(iaod == jaod) continue ; + AliAODPWG4ParticleCorrelation * part2 = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(jaod)); + mom2 = *(part2->Momentum()); + //Select good pair (good phi, pt cuts, aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)){ + if(GetDebug() > 1)printf("Selected gamma pair: pt %f, phi %f, eta%f",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta()); + return kTRUE ; + } + }//loop + + return kFALSE; +} + +//________________________________________________________________________ +TList * AliAnaParticleIsolation::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in outputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("IsolatedParticleHistos") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + Int_t nptsumbins = fHistoNPtSumBins; + Float_t ptsummax = fHistoPtSumMax; + Float_t ptsummin = fHistoPtSumMin; + Int_t nptinconebins = fHistoNPtInConeBins; + Float_t ptinconemax = fHistoPtInConeMax; + Float_t ptinconemin = fHistoPtInConeMin; + + if(!fMakeSeveralIC){ + + fhConeSumPt = new TH2F + ("hConePtSum","#Sigma p_{T} in cone ",nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + fhConeSumPt->SetYTitle("#Sigma p_{T}"); + fhConeSumPt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhConeSumPt) ; + + fhPtInCone = new TH2F + ("hPtInCone","p_{T} in cone ",nptbins,ptmin,ptmax,nptinconebins,ptinconemin,ptinconemax); + fhPtInCone->SetYTitle("p_{T in cone} (GeV/c)"); + fhPtInCone->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPtInCone) ; + + fhPtIso = new TH1F("hPtIso","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIso->SetYTitle("N"); + fhPtIso->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIso) ; + + fhPhiIso = new TH2F + ("hPhiIso","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIso->SetYTitle("#phi"); + fhPhiIso->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIso) ; + + fhEtaIso = new TH2F + ("hEtaIso","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIso->SetYTitle("#eta"); + fhEtaIso->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIso) ; + + if(IsDataMC()){ + + fhPtIsoPrompt = new TH1F("hPtIsoPrompt","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoPrompt->SetYTitle("N"); + fhPtIsoPrompt->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoPrompt) ; + + fhPhiIsoPrompt = new TH2F + ("hPhiIsoPrompt","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoPrompt->SetYTitle("#phi"); + fhPhiIsoPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoPrompt) ; + + fhEtaIsoPrompt = new TH2F + ("hEtaIsoPrompt","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoPrompt->SetYTitle("#eta"); + fhEtaIsoPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoPrompt) ; + + fhPtIsoFragmentation = new TH1F("hPtIsoFragmentation","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoFragmentation->SetYTitle("N"); + fhPtIsoFragmentation->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoFragmentation) ; + + fhPhiIsoFragmentation = new TH2F + ("hPhiIsoFragmentation","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoFragmentation->SetYTitle("#phi"); + fhPhiIsoFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoFragmentation) ; + + fhEtaIsoFragmentation = new TH2F + ("hEtaIsoFragmentation","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoFragmentation->SetYTitle("#eta"); + fhEtaIsoFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoFragmentation) ; + + fhPtIsoPi0Decay = new TH1F("hPtIsoPi0Decay","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoPi0Decay->SetYTitle("N"); + fhPtIsoPi0Decay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoPi0Decay) ; + + fhPhiIsoPi0Decay = new TH2F + ("hPhiIsoPi0Decay","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoPi0Decay->SetYTitle("#phi"); + fhPhiIsoPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoPi0Decay) ; + + fhEtaIsoPi0Decay = new TH2F + ("hEtaIsoPi0Decay","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoPi0Decay->SetYTitle("#eta"); + fhEtaIsoPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoPi0Decay) ; + + fhPtIsoOtherDecay = new TH1F("hPtIsoOtherDecay","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoOtherDecay->SetYTitle("N"); + fhPtIsoOtherDecay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoOtherDecay) ; + + fhPhiIsoOtherDecay = new TH2F + ("hPhiIsoOtherDecay","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoOtherDecay->SetYTitle("#phi"); + fhPhiIsoOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoOtherDecay) ; + + fhEtaIsoOtherDecay = new TH2F + ("hEtaIsoOtherDecay","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoOtherDecay->SetYTitle("#eta"); + fhEtaIsoOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoOtherDecay) ; + + fhPtIsoConversion = new TH1F("hPtIsoConversion","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoConversion->SetYTitle("N"); + fhPtIsoConversion->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoConversion) ; + + fhPhiIsoConversion = new TH2F + ("hPhiIsoConversion","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoConversion->SetYTitle("#phi"); + fhPhiIsoConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoConversion) ; + + fhEtaIsoConversion = new TH2F + ("hEtaIsoConversion","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoConversion->SetYTitle("#eta"); + fhEtaIsoConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoConversion) ; + + fhPtIsoUnknown = new TH1F("hPtIsoUnknown","Isolated Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtIsoUnknown->SetYTitle("N"); + fhPtIsoUnknown->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtIsoUnknown) ; + + fhPhiIsoUnknown = new TH2F + ("hPhiIsoUnknown","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiIsoUnknown->SetYTitle("#phi"); + fhPhiIsoUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiIsoUnknown) ; + + fhEtaIsoUnknown = new TH2F + ("hEtaIsoUnknown","Isolated #phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaIsoUnknown->SetYTitle("#eta"); + fhEtaIsoUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaIsoUnknown) ; + }//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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax); + 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() ; + if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept()) + for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ; + } + + + //Save parameters used for analysis + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + + sprintf(onePar,"--- AliAnaParticleIsolation ---\n") ; + parList+=onePar ; + sprintf(onePar,"Calorimeter: %s\n",fCalorimeter.Data()) ; + parList+=onePar ; + sprintf(onePar,"fReMakeIC =%d (Flag for reisolation during histogram filling) \n",fReMakeIC) ; + parList+=onePar ; + sprintf(onePar,"fMakeSeveralIC=%d (Flag for isolation with several cuts at the same time ) \n",fMakeSeveralIC) ; + parList+=onePar ; + sprintf(onePar,"fMakeInvMass=%d (Flag for rejection of candidates with a pi0 inv mass pair) \n",fMakeInvMass) ; + parList+=onePar ; + + if(fMakeSeveralIC){ + sprintf(onePar,"fNCones =%d (Number of cone sizes) \n",fNCones) ; + parList+=onePar ; + sprintf(onePar,"fNPtThresFrac=%d (Flag for isolation with several cuts at the same time ) \n",fNPtThresFrac) ; + parList+=onePar ; + + for(Int_t icone = 0; icone < fNCones ; icone++){ + sprintf(onePar,"fConeSizes[%d]=%1.2f (isolation cone size) \n",icone, fConeSizes[icone]) ; + parList+=onePar ; + } + for(Int_t ipt = 0; ipt < fNPtThresFrac ; ipt++){ + sprintf(onePar,"fPtThresholds[%d]=%1.2f (isolation pt threshold) \n",ipt, fPtThresholds[ipt]) ; + parList+=onePar ; + } + for(Int_t ipt = 0; ipt < fNPtThresFrac ; ipt++){ + sprintf(onePar,"fPtFractions[%d]=%1.2f (isolation pt fraction threshold) \n",ipt, fPtFractions[ipt]) ; + parList+=onePar ; + } + } + + //Get parameters set in base class. + parList += GetBaseParametersList() ; + + //Get parameters set in IC class. + if(!fMakeSeveralIC)parList += GetIsolationCut()->GetICParametersList() ; + + TObjString *oString= new TObjString(parList) ; + outputContainer->Add(oString); + + + return outputContainer ; + +} + +//__________________________________________________________________ +void AliAnaParticleIsolation::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + //Search for the isolated photon in fCalorimeter with pt > GetMinPt() + + if(!GetInputAODBranch()) + AliFatal(Form("ParticleIsolation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + Int_t n = 0, nfrac = 0; + Bool_t isolated = kFALSE ; + Float_t coneptsum = 0 ; + TClonesArray * pl = new TClonesArray; + + //Select the calorimeter for candidate isolation with neutral particles + if(fCalorimeter == "PHOS") + pl = GetAODPHOS(); + else if (fCalorimeter == "EMCAL") + pl = GetAODEMCAL(); + + //Get vertex for photon momentum calculation + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(fVertex); + + //Loop on AOD branch, filled previously in AliAnaPhoton + TLorentzVector mom ; + + for(Int_t iaod = 0; iaod < GetInputAODBranch()->GetEntriesFast(); iaod++){ + AliAODPWG4ParticleCorrelation * aod = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod)); + + //If too small or too large pt, skip + if(aod->Pt() < GetMinPt() || aod->Pt() > GetMaxPt() ) continue ; + + //Check invariant mass, if pi0, skip. + Bool_t decay = kFALSE ; + if(fMakeInvMass) decay = CheckInvMass(iaod,aod); + if(decay) continue ; + + n=0; nfrac = 0; isolated = kFALSE; coneptsum = 0; + GetIsolationCut()->MakeIsolationCut((TSeqCollection*)GetAODCTS(), (TSeqCollection*)pl, + fVertex, kTRUE, aod, n,nfrac,coneptsum, isolated); + aod->SetIsolated(isolated); + + }//loop + + if(GetDebug() > 1) printf("End fill AODs "); + +} + +//__________________________________________________________________ +void AliAnaParticleIsolation::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + Int_t n = 0, nfrac = 0; + Bool_t isolated = kFALSE ; + Float_t coneptsum = 0 ; + //cout<<"MakeAnalysisFillHistograms"<GetEntriesFast(); + if(GetDebug() > 0) printf("histo aod branch entries %d\n", naod); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* aod = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod)); + Bool_t isolation = aod->IsIsolated(); + Float_t ptcluster = aod->Pt(); + Float_t phicluster = aod->Phi(); + Float_t etacluster = aod->Eta(); + + //is pt too small skip it + if(ptcluster < GetMinPt() || ptcluster > GetMaxPt() ) continue ; + + if(fMakeSeveralIC) { + //Analysis of multiple IC at same time + MakeSeveralICAnalysis(aod); + 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*)aod->GetRefIsolationConeTracks(), + (TSeqCollection*)aod->GetRefIsolationConeClusters(), + fVertex, kFALSE, aod, + n,nfrac,coneptsum, isolated); + fhConeSumPt->Fill(ptcluster,coneptsum); + } + + //Fill pt distribution of particles in cone + //Tracks + coneptsum=0; + for(Int_t itrack=0; itrack < (aod->GetRefIsolationConeTracks())->GetEntriesFast(); itrack++){ + AliAODTrack* track = (AliAODTrack *)((aod->GetRefIsolationConeTracks())->At(itrack)); + fhPtInCone->Fill(ptcluster,TMath::Sqrt(track->Px()*track->Px()+track->Py()*track->Py())); + coneptsum+=track->Pt(); + } + //CaloClusters + TLorentzVector mom ; + for(Int_t icalo=0; icalo < (aod->GetRefIsolationConeClusters())->GetEntriesFast(); icalo++){ + AliAODCaloCluster* calo = (AliAODCaloCluster *)((aod->GetRefIsolationConeClusters())->At(icalo)); + calo->GetMomentum(mom,fVertex);//Assume that come from vertex in straight line + fhPtInCone->Fill(ptcluster, mom.Pt()); + coneptsum+=mom.Pt(); + } + + if(!fReMakeIC) fhConeSumPt->Fill(ptcluster,coneptsum); + + if(isolation){ + fhPtIso ->Fill(ptcluster); + fhPhiIso ->Fill(ptcluster,phicluster); + fhEtaIso ->Fill(ptcluster,etacluster); + + if(IsDataMC()){ + Int_t tag =aod->GetTag(); + + if(tag == AliCaloPID::kMCPrompt){ + fhPtIsoPrompt ->Fill(ptcluster); + fhPhiIsoPrompt ->Fill(ptcluster,phicluster); + fhEtaIsoPrompt ->Fill(ptcluster,etacluster); + } + else if(tag == AliCaloPID::kMCFragmentation) + { + fhPtIsoFragmentation ->Fill(ptcluster); + fhPhiIsoFragmentation ->Fill(ptcluster,phicluster); + fhEtaIsoFragmentation ->Fill(ptcluster,etacluster); + } + else if(tag == AliCaloPID::kMCPi0Decay) + { + fhPtIsoPi0Decay ->Fill(ptcluster); + fhPhiIsoPi0Decay ->Fill(ptcluster,phicluster); + fhEtaIsoPi0Decay ->Fill(ptcluster,etacluster); + } + else if(tag == AliCaloPID::kMCEtaDecay || tag == AliCaloPID::kMCOtherDecay) + { + fhPtIsoOtherDecay ->Fill(ptcluster); + fhPhiIsoOtherDecay ->Fill(ptcluster,phicluster); + fhEtaIsoOtherDecay ->Fill(ptcluster,etacluster); + } + else if(tag == AliCaloPID::kMCConversion) + { + fhPtIsoConversion ->Fill(ptcluster); + fhPhiIsoConversion ->Fill(ptcluster,phicluster); + fhEtaIsoConversion ->Fill(ptcluster,etacluster); + } + else + { + fhPtIsoUnknown ->Fill(ptcluster); + fhPhiIsoUnknown ->Fill(ptcluster,phicluster); + fhEtaIsoUnknown ->Fill(ptcluster,etacluster); + } + }//Histograms with MC + + }//Isolated histograms + + }// aod loop + +} + +//____________________________________________________________________________ +void AliAnaParticleIsolation::InitParameters() +{ + + //Initialize the parameters of the analysis. + SetInputAODName("photons"); + + fCalorimeter = "PHOS" ; + fReMakeIC = kFALSE ; + fMakeSeveralIC = kFALSE ; + fMakeInvMass = kFALSE ; + + //----------- Several IC----------------- + fNCones = 5 ; + fNPtThresFrac = 5 ; + fConeSizes[0] = 0.1; fConeSizes[1] = 0.2; fConeSizes[2] = 0.3; fConeSizes[3] = 0.4; fConeSizes[4] = 0.5; + fPtThresholds[0] = 1.; fPtThresholds[1] = 2.; fPtThresholds[2] = 3.; fPtThresholds[3] = 4.; fPtThresholds[4] = 5.; + fPtFractions[0] = 0.05; fPtFractions[1] = 0.075; fPtFractions[2] = 0.1; fPtFractions[3] = 1.25; fPtFractions[4] = 1.5; + +//------------- Histograms settings ------- + fHistoNPtSumBins = 100 ; + fHistoPtSumMax = 50 ; + fHistoPtSumMin = 0. ; + + fHistoNPtInConeBins = 100 ; + fHistoPtInConeMax = 50 ; + fHistoPtInConeMin = 0. ; + +} + +//__________________________________________________________________ +void AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelation* ph) +{ + //Isolation Cut Analysis for both methods and different pt cuts and cones + Float_t ptC = ph->Pt(); + Int_t tag = ph->GetTag(); + + //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; + + //Loop on cone sizes + for(Int_t icone = 0; iconeSetConeSize(fConeSizes[icone]); + coneptsum = 0 ; + //Loop on ptthresholds + for(Int_t ipt = 0; iptSetPtThreshold(fPtThresholds[ipt]); + GetIsolationCut()->MakeIsolationCut((TSeqCollection*)ph->GetRefIsolationConeTracks(), + (TSeqCollection*)ph->GetRefIsolationConeClusters(), + fVertex, kFALSE, ph, + n[icone][ipt],nfrac[icone][ipt],coneptsum, isolated); + //Normal ptThreshold cut + if(n[icone][ipt] == 0) { + fhPtThresIsolated[icone][ipt]->Fill(ptC); + if(IsDataMC()){ + if(tag == AliCaloPID::kMCPrompt) fhPtThresIsolatedPrompt[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCConversion) fhPtThresIsolatedConversion[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCFragmentation) fhPtThresIsolatedFragmentation[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCPi0Decay) fhPtThresIsolatedPi0Decay[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCOtherDecay || tag == AliCaloPID::kMCEtaDecay) fhPtThresIsolatedOtherDecay[icone][ipt]->Fill(ptC) ; + else fhPtThresIsolatedUnknown[icone][ipt]->Fill(ptC) ; + } + } + + //Pt threshold on pt cand/ pt in cone fraction + if(nfrac[icone][ipt] == 0) { + fhPtFracIsolated[icone][ipt]->Fill(ptC); + if(IsDataMC()){ + if(tag == AliCaloPID::kMCPrompt) fhPtFracIsolatedPrompt[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCConversion) fhPtFracIsolatedConversion[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCFragmentation) fhPtFracIsolatedFragmentation[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCPi0Decay) fhPtFracIsolatedPi0Decay[icone][ipt]->Fill(ptC) ; + else if(tag == AliCaloPID::kMCOtherDecay || tag == AliCaloPID::kMCEtaDecay) fhPtFracIsolatedOtherDecay[icone][ipt]->Fill(ptC) ; + else fhPtFracIsolatedUnknown[icone][ipt]->Fill(ptC) ; + } + } + }//pt thresh loop + + //Sum in cone histograms + fhPtSumIsolated[icone]->Fill(ptC,coneptsum) ; + if(IsDataMC()){ + if(tag == AliCaloPID::kMCPrompt) fhPtSumIsolatedPrompt[icone]->Fill(ptC,coneptsum) ; + else if(tag == AliCaloPID::kMCConversion) fhPtSumIsolatedConversion[icone]->Fill(ptC,coneptsum) ; + else if(tag == AliCaloPID::kMCFragmentation) fhPtSumIsolatedFragmentation[icone]->Fill(ptC,coneptsum) ; + else if(tag == AliCaloPID::kMCPi0Decay) fhPtSumIsolatedPi0Decay[icone]->Fill(ptC,coneptsum) ; + else if(tag == AliCaloPID::kMCOtherDecay || tag == AliCaloPID::kMCEtaDecay) 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 AliAnaParticleIsolation::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()) ; + + printf("ReMake Isolation = %d \n", fReMakeIC) ; + printf("Make Several Isolation = %d \n", fMakeSeveralIC) ; + printf("Calorimeter for isolation = %s \n", fCalorimeter.Data()) ; + + 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("Histograms: %3.1f < pT sum < %3.1f, Nbin = %d\n", fHistoPtSumMin, fHistoPtSumMax, fHistoNPtSumBins); + printf("Histograms: %3.1f < pT in cone < %3.1f, Nbin = %d\n", fHistoPtInConeMin, fHistoPtInConeMax, fHistoNPtInConeBins); + + printf(" \n") ; + +} + diff --git a/PWG4/PartCorrDep/AliAnaParticleIsolation.h b/PWG4/PartCorrDep/AliAnaParticleIsolation.h new file mode 100755 index 00000000000..32724095919 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleIsolation.h @@ -0,0 +1,180 @@ +#ifndef ALIANAPARTICLEISOLATION_H +#define ALIANAPARTICLEISOLATION_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliAnaParticleIsolation.h 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ + +// Class for the analysis of particle isolation +// Input is selected particles put in AOD branch (AliAODPWG4ParticleCorrelation) +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) + +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include + +// --- ANALYSIS system --- +#include "AliAnaPartCorrBaseClass.h" +class AliAODPWG4ParticleCorrelation ; + +class TList ; + +class AliAnaParticleIsolation : public AliAnaPartCorrBaseClass { + +public: + + AliAnaParticleIsolation() ; // default ctor + AliAnaParticleIsolation(const AliAnaParticleIsolation & g) ; // cpy ctor + AliAnaParticleIsolation & operator = (const AliAnaParticleIsolation & g) ;//cpy assignment + virtual ~AliAnaParticleIsolation() ; //virtual dtor + + Bool_t CheckInvMass(const Int_t icalo,const AliAODPWG4ParticleCorrelation * ph) const ; + + TList * GetCreateOutputObjects(); + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + void MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelation * ph); + + void Print(const Option_t * opt)const; + + TString GetCalorimeter() const {return fCalorimeter ; } + void SetCalorimeter(TString det) {fCalorimeter = 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 IsReIsolationOn() const {return fReMakeIC ; } + void SwitchOnReIsolation() { fReMakeIC = kTRUE;} + void SwitchOffReIsolation() { fReMakeIC = kFALSE;} + + Bool_t IsSeveralIsolationOn() const {return fMakeSeveralIC ; } + void SwitchOnSeveralIsolation() { fMakeSeveralIC = kTRUE;} + void SwitchOffSeveralIsolation() { fMakeSeveralIC = kFALSE;} + + Bool_t IsInvariantMassOn() const {return fMakeInvMass ; } + void SwitchOnInvariantMass() { fMakeInvMass = kTRUE;} + void SwitchOffInvariantMass() { fMakeInvMass = kFALSE;} + + //Histogrammes setters and getters + virtual void SetHistoPtSumRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNPtSumBins = n ; + fHistoPtSumMax = max ; + fHistoPtSumMin = min ; + } + + Int_t GetHistoNPtSumBins() const { return fHistoNPtSumBins ; } + Float_t GetHistoPtSumMin() const { return fHistoPtSumMin ; } + Float_t GetHistoPtSumMax() const { return fHistoPtSumMax ; } + + virtual void SetHistoPtInConeRangeAndNBins(Float_t min, Float_t max, Int_t n) { + fHistoNPtInConeBins = n ; + fHistoPtInConeMax = max ; + fHistoPtInConeMin = min ; + } + + Int_t GetHistoNPtInConeBins() const { return fHistoNPtInConeBins ; } + Float_t GetHistoPtInConeMin() const { return fHistoPtInConeMin ; } + Float_t GetHistoPtInConeMax() const { return fHistoPtInConeMax ; } + + +private: + + TString fCalorimeter ; // Calorimeter where neutral particles in cone for isolation are; + Double_t fVertex[3] ; //! Event Vertex + 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 * fhPtIso ; //! Number of isolated particles + TH2F * fhPhiIso ; //! Phi of isolated particles + TH2F * fhEtaIso ; //! eta of isolated particles + TH2F * fhConeSumPt ; //! Sum Pt in the cone + TH2F * fhPtInCone ; //! Particle 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 particle with pt threshold + TH1F* fhPtFracIsolated[5][5] ; //! Isolated particle with pt threshold + TH2F* fhPtSumIsolated[5] ; //! Isolated particle with threshold on cone pt sum + + //MC + TH1F * fhPtIsoPrompt; //! Number of isolated prompt gamma + TH2F * fhPhiIsoPrompt; //! Phi of isolated prompt gamma + TH2F * fhEtaIsoPrompt; //! eta of 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 * fhPtIsoFragmentation; //! Number of isolated fragmentation gamma + TH2F * fhPhiIsoFragmentation; //! Phi of isolated fragmentation gamma + TH2F * fhEtaIsoFragmentation; //! eta of 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 * fhPtIsoPi0Decay; //!Number of isolated Pi0Decay gamma + TH2F * fhPhiIsoPi0Decay; //! Phi of isolated Pi0Decay gamma + TH2F * fhEtaIsoPi0Decay; //! eta of 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 * fhPtIsoOtherDecay; //! Number of isolated OtherDecay gamma + TH2F * fhPhiIsoOtherDecay; //! Phi of isolated OtherDecay gamma + TH2F * fhEtaIsoOtherDecay; //! eta of 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 * fhPtIsoConversion; //! Number of isolated Conversion gamma + TH2F * fhPhiIsoConversion; //! Phi of isolated Conversion gamma + TH2F * fhEtaIsoConversion; //! eta of 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 * fhPtIsoUnknown; //! Number of isolated Unknown + TH2F * fhPhiIsoUnknown; //! Phi of isolated Unknown + TH2F * fhEtaIsoUnknown; //! eta of isolated Unknown + 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 + + //Histograms settings + Int_t fHistoNPtSumBins; // Number of bins in PtSum histograms + Float_t fHistoPtSumMax; // PtSum maximum in histogram + Float_t fHistoPtSumMin; // PtSum minimum in histogram + Int_t fHistoNPtInConeBins; // Number of bins in PtInCone histogram + Float_t fHistoPtInConeMax; // PtInCone maximum in histogram + Float_t fHistoPtInConeMin; // PtInCone maximum in histogram + + ClassDef(AliAnaParticleIsolation,2) +} ; + + +#endif //ALIANAPARTICLEISOLATION_H + + + diff --git a/PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx new file mode 100755 index 00000000000..24deede89f6 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx @@ -0,0 +1,358 @@ +/************************************************************************** + * 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" +#include "AliAODPWG4ParticleCorrelation.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") ; + + Int_t nptbins = GetHistoNPtBins(); +// Int_t nphibins = GetHistoNPhiBins(); +// Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); +// Float_t phimax = GetHistoPhiMax(); +// Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); +// Float_t phimin = GetHistoPhiMin(); +// Float_t etamin = GetHistoEtaMin(); + + fhDeltaPhi = new TH2F("DeltaPhi","#phi_{jet} - #phi_{trigger} vs p_{T trigger}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,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}", nptbins,ptmin,ptmax,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}", nptbins,ptmin,ptmax,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}", nptbins,ptmin,ptmax,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. + SetInputAODName("photons"); + 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(AliAODPWG4ParticleCorrelation * particle) const +{ + //Returns the index of the jet that is opposite to the particle + + Int_t njets = (GetReader()->GetAOD())->GetNJets() ; + + AliAODJet * jet = new AliAODJet ; + Int_t index = -1; + for(Int_t ijet = 0; ijet < njets ; ijet++){ + jet = (GetReader()->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 + if(!GetInputAODBranch()) + AliFatal(Form("ParticleJetCorrelation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + Int_t ntrig = GetInputAODBranch()->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++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod)); + + //Correlate with jets + Int_t ijet = SelectJet(particle); + if(ijet > -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 + + if(!GetInputAODBranch()) + AliFatal(Form("ParticleJetCorrelation::FillHistos: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + Int_t ntrig = GetInputAODBranch()->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++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod)); + + //Recover the jet correlated, found previously. + AliAODJet * jet = particle->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 = (AliAODTrack *) (GetAODCTS()->At(ipr)) ; + else //If you want to use jet tracks from JETAN + track = (AliAODTrack *) ((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/PartCorrDep/AliAnaParticleJetFinderCorrelation.h b/PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.h new file mode 100755 index 00000000000..9b60fe7d2d1 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleJetFinderCorrelation.h @@ -0,0 +1,95 @@ +#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 AliAODPWG4ParticleCorrelation ; + +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(AliAODPWG4ParticleCorrelation * particle) const ; + + 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/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx new file mode 100755 index 00000000000..99d7c17b831 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx @@ -0,0 +1,1529 @@ +/************************************************************************** + * 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 AliAODPWG4ParticleCorrelation, +// 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" +#include "AliCaloPID.h" +#include "AliAODPWG4ParticleCorrelation.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) const { + //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 ePbPb = ePP + par[4] ; + Double_t sPbPb = TMath::Sqrt(sPP*sPP+ par[5]*par[5]) ; + Double_t rat = (ePbPb - sPbPb * f) / ptg ; + //Info("CalculateLimit","ePP %f, sPP %f, f %f", ePP, sPP, f); + //Info("CalculateLimit","ePbPb %f, sPbPb %f, rat %f", ePbPb, sPbPb, rat); + return rat ; +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCorrelation * 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") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + fhChargedLeadingPt = new TH2F("ChargedLeadingPt","p_{T leading charge} vs p_{T trigger}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}", nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhChargedLeadingPhi->SetYTitle("#phi_{h^{#pm}} (rad)"); + fhChargedLeadingPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhChargedLeadingEta = new TH2F("ChargedLeadingEta","#eta_{h^{#pm}} vs p_{T trigger}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + 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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhNeutralLeadingPhi->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhNeutralLeadingPhi->SetXTitle("p_{T trigger} (GeV/c)"); + + fhNeutralLeadingEta = new TH2F("NeutralLeadingEta","#eta_{#pi^{0}} vs p_{T trigger}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + 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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,100,0.,10.); + fhJetFFxi->SetYTitle("#xi"); + fhJetFFxi->SetXTitle("p_{T trigger}"); + + fhJetFFpt = new TH2F("JetFFpt","#xi = p_{T i charged}) vs p_{T trigger}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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}", nptbins,ptmin,ptmax,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}", nptbins,ptmin,ptmax,100,0.,10.); + fhBkgFFxi->SetYTitle("#xi"); + fhBkgFFxi->SetXTitle("p_{T trigger}"); + + fhBkgFFpt = new TH2F("BkgFFpt","p_{T charged hadron } vs p_{T trigger}", nptbins,ptmin,ptmax,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}",nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); + 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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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,nptbins,ptmin,ptmax,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(AliAODPWG4ParticleCorrelation * particle, TLorentzVector & pLeading) const +{ + //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 = (AliAODTrack *)(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(AliAODPWG4ParticleCorrelation * particle, TLorentzVector & pLeading) const +{ + //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 = (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 = (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. + + SetInputAODName("photons"); + 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) const { + //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) + const { + //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(!GetInputAODBranch()) + AliFatal(Form("ParticleJetLCCorrelation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->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 = GetInputAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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 histograms + + if(!GetInputAODBranch()) + AliFatal(Form("ParticleJetLCCorrelation::FillHistos: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->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 = GetInputAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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(AliAODPWG4ParticleCorrelation *particle, const TLorentzVector pLeading) +const { + //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 = (AliAODTrack *)((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 = (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(AliAODPWG4ParticleCorrelation *particle, const TLorentzVector pLeading, TLorentzVector & jet, TLorentzVector & bkg) +const { + //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 = (AliAODTrack *) ((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 = (AliAODTrack *) ((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 = (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 = (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) const { + //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);//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/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.h b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.h new file mode 100755 index 00000000000..752a2ed05dc --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.h @@ -0,0 +1,251 @@ +#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 AliAODPWG4ParticleCorrelation, +// 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; +class AliAODPWG4ParticleCorrelation ; + +#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) const ; + + void FillJetHistos(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector leading, const TLorentzVector jet, const TString type, const TString lastname); + + TList * GetOutputContainer() const {return fOutCont; } + + Bool_t IsJetSelected(const Double_t ptTrig, const Double_t ptjet) const ; + Bool_t IsParticleInJetCone(const Double_t eta, Double_t phi, const Double_t etal, Double_t phil) const ; + + void GetLeadingCharge(AliAODPWG4ParticleCorrelation *particle, TLorentzVector & pLeading) const ; + void GetLeadingPi0 (AliAODPWG4ParticleCorrelation *particle, TLorentzVector & pLeading) const ; + Bool_t GetLeadingParticle(AliAODPWG4ParticleCorrelation *particle, TLorentzVector & pLeading) const ; + + void MakeAnalysisFillAOD(); + void MakeAnalysisFillHistograms(); + void MakeAODJet(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector pLeading) const ; + void MakeJetFromAOD(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector pLeading, + TLorentzVector & jet, TLorentzVector & bkg) const ; + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) const ; + + 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/PartCorrDep/AliAnaParticlePartonCorrelation.cxx b/PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.cxx new file mode 100755 index 00000000000..d1178973ffe --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.cxx @@ -0,0 +1,301 @@ +/************************************************************************** + * 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" +#include "AliAODPWG4ParticleCorrelation.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. + SetInputAODName("photons"); + +} + +//__________________________________________________________________ +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(!GetInputAODBranch()) + AliFatal(Form("ParticlePartonCorrelation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast()); + } + + //Loop on stored AOD particles + Int_t naod = GetInputAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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(!GetInputAODBranch()) + AliFatal(Form("ParticlePartonCorrelation::FillHistos: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); + + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast()); + } + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("No Stack available, STOP"); + + //Loop on stored AOD particles + Int_t naod = GetInputAODBranch()->GetEntriesFast(); + TParticle * mom =new TParticle ; + + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->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/PartCorrDep/AliAnaParticlePartonCorrelation.h b/PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.h new file mode 100755 index 00000000000..57e1a5efe50 --- /dev/null +++ b/PWG4/PartCorrDep/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/PartCorrDep/AliAnaPhoton.cxx b/PWG4/PartCorrDep/AliAnaPhoton.cxx new file mode 100755 index 00000000000..50221bce248 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPhoton.cxx @@ -0,0 +1,508 @@ +/************************************************************************** + * 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 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: AliAnaPhoton.cxx 28688 2008-09-11 15:04:07Z gconesab $ */ + +//_________________________________________________________________________ +// +// Class for the photon identification. +// Clusters from calorimeters are identified as photons +// and kept in the AOD. Few histograms produced. +// +// -- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include + +// --- Analysis system --- +#include "AliAnaPhoton.h" +#include "AliCaloTrackReader.h" +#include "AliCaloPID.h" + +ClassImp(AliAnaPhoton) + +//____________________________________________________________________________ + AliAnaPhoton::AliAnaPhoton() : + AliAnaPartCorrBaseClass(), fCalorimeter(""), + fMinDist(0.),fMinDist2(0.),fMinDist3(0.), + fhPtPhoton(0),fhPhiPhoton(0),fhEtaPhoton(0), + //MC + fhPtPrompt(0),fhPhiPrompt(0),fhEtaPrompt(0), + fhPtFragmentation(0),fhPhiFragmentation(0),fhEtaFragmentation(0), + fhPtPi0Decay(0),fhPhiPi0Decay(0),fhEtaPi0Decay(0), + fhPtOtherDecay(0),fhPhiOtherDecay(0),fhEtaOtherDecay(0), + fhPtConversion(0),fhPhiConversion(0),fhEtaConversion(0), + fhPtUnknown(0),fhPhiUnknown(0),fhEtaUnknown(0) +{ + //default ctor + + //Initialize parameters + InitParameters(); + +} + +//____________________________________________________________________________ +AliAnaPhoton::AliAnaPhoton(const AliAnaPhoton & g) : + AliAnaPartCorrBaseClass(g), fCalorimeter(g.fCalorimeter), + fMinDist(g.fMinDist),fMinDist2(g.fMinDist2), fMinDist3(g.fMinDist3), + fhPtPhoton(g.fhPtPhoton),fhPhiPhoton(g.fhPhiPhoton),fhEtaPhoton(g.fhEtaPhoton), + //MC + 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) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaPhoton & AliAnaPhoton::operator = (const AliAnaPhoton & g) +{ + // assignment operator + + if(&g == this) return *this; + + fCalorimeter = g.fCalorimeter ; + fMinDist = g.fMinDist; + fMinDist2 = g.fMinDist2; + fMinDist3 = g.fMinDist3; + + fhPtPhoton = g.fhPtPhoton ; + fhPhiPhoton = g.fhPhiPhoton ; + fhEtaPhoton = g.fhEtaPhoton ; + + 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; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaPhoton::~AliAnaPhoton() +{ + //dtor + +} + + +//________________________________________________________________________ +TList * AliAnaPhoton::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in outputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("PhotonHistos") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + //Histograms of highest Photon identified in Event + fhPtPhoton = new TH1F("hPtPhoton","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtPhoton->SetYTitle("N"); + fhPtPhoton->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtPhoton) ; + + fhPhiPhoton = new TH2F + ("hPhiPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiPhoton->SetYTitle("#phi"); + fhPhiPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiPhoton) ; + + fhEtaPhoton = new TH2F + ("hEtaPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaPhoton->SetYTitle("#eta"); + fhEtaPhoton->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaPhoton) ; + + if(IsDataMC()){ + + fhPtPrompt = new TH1F("hPtPrompt","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtPrompt->SetYTitle("N"); + fhPtPrompt->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtPrompt) ; + + fhPhiPrompt = new TH2F + ("hPhiPrompt","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiPrompt->SetYTitle("#phi"); + fhPhiPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiPrompt) ; + + fhEtaPrompt = new TH2F + ("hEtaPrompt","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaPrompt->SetYTitle("#eta"); + fhEtaPrompt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaPrompt) ; + + fhPtFragmentation = new TH1F("hPtFragmentation","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtFragmentation->SetYTitle("N"); + fhPtFragmentation->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtFragmentation) ; + + fhPhiFragmentation = new TH2F + ("hPhiFragmentation","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiFragmentation->SetYTitle("#phi"); + fhPhiFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiFragmentation) ; + + fhEtaFragmentation = new TH2F + ("hEtaFragmentation","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaFragmentation->SetYTitle("#eta"); + fhEtaFragmentation->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaFragmentation) ; + + fhPtPi0Decay = new TH1F("hPtPi0Decay","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtPi0Decay->SetYTitle("N"); + fhPtPi0Decay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtPi0Decay) ; + + fhPhiPi0Decay = new TH2F + ("hPhiPi0Decay","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiPi0Decay->SetYTitle("#phi"); + fhPhiPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiPi0Decay) ; + + fhEtaPi0Decay = new TH2F + ("hEtaPi0Decay","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaPi0Decay->SetYTitle("#eta"); + fhEtaPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaPi0Decay) ; + + fhPtOtherDecay = new TH1F("hPtOtherDecay","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtOtherDecay->SetYTitle("N"); + fhPtOtherDecay->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtOtherDecay) ; + + fhPhiOtherDecay = new TH2F + ("hPhiOtherDecay","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiOtherDecay->SetYTitle("#phi"); + fhPhiOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiOtherDecay) ; + + fhEtaOtherDecay = new TH2F + ("hEtaOtherDecay","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaOtherDecay->SetYTitle("#eta"); + fhEtaOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaOtherDecay) ; + + fhPtConversion = new TH1F("hPtConversion","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtConversion->SetYTitle("N"); + fhPtConversion->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtConversion) ; + + fhPhiConversion = new TH2F + ("hPhiConversion","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiConversion->SetYTitle("#phi"); + fhPhiConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiConversion) ; + + fhEtaConversion = new TH2F + ("hEtaConversion","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaConversion->SetYTitle("#eta"); + fhEtaConversion->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaConversion) ; + + fhPtUnknown = new TH1F("hPtUnknown","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); + fhPtUnknown->SetYTitle("N"); + fhPtUnknown->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhPtUnknown) ; + + fhPhiUnknown = new TH2F + ("hPhiUnknown","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiUnknown->SetYTitle("#phi"); + fhPhiUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPhiUnknown) ; + + fhEtaUnknown = new TH2F + ("hEtaUnknown","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaUnknown->SetYTitle("#eta"); + fhEtaUnknown->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhEtaUnknown) ; + }//Histos with MC + + //Save parameters used for analysis + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + + sprintf(onePar,"--- AliAnaPhoton ---\n") ; + parList+=onePar ; + sprintf(onePar,"Calorimeter: %s\n",fCalorimeter.Data()) ; + parList+=onePar ; + sprintf(onePar,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ; + parList+=onePar ; + sprintf(onePar,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ; + parList+=onePar ; + sprintf(onePar,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ; + parList+=onePar ; + + //Get parameters set in base class. + parList += GetBaseParametersList() ; + + //Get parameters set in PID class. + parList += GetCaloPID()->GetPIDParametersList() ; + + //Get parameters set in FidutialCut class (not available yet) + //parlist += GetCaloPID()->GetFidCutParametersList() + + TObjString *oString= new TObjString(parList) ; + outputContainer->Add(oString); + + return outputContainer ; + +} + +//____________________________________________________________________________ +void AliAnaPhoton::InitParameters() +{ + + //Initialize the parameters of the analysis. + SetOutputAODClassName("AliAODPWG4Particle"); + SetOutputAODName("photons"); + fCalorimeter = "PHOS" ; + fMinDist = 2.; + fMinDist2 = 4.; + fMinDist3 = 5.; + +} + +//__________________________________________________________________ +void AliAnaPhoton::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + //Search for photons in fCalorimeter + + 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 Calorimeter of the photon + if(fCalorimeter == "PHOS") + pl = GetAODPHOS(); + else if (fCalorimeter == "EMCAL") + pl = GetAODEMCAL(); + //Fill AODCaloClusters and AODParticle with PHOS aods + TLorentzVector mom ; + for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){ + AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo)); + + //Cluster selection, not charged, with photon id and in fidutial cut + //Get Momentum vector, + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + //If too small or big pt, skip it + if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ; + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,fCalorimeter) ; + if(! in ) continue ; + } + + //Create AOD for analysis + AliAODPWG4Particle aodph = AliAODPWG4Particle(mom); + aodph.SetLabel(calo->GetLabel(0)); + //printf("Index %d, Id %d\n",icalo, calo->GetID()); + //Set the indeces of the original caloclusters + aodph.SetCaloLabel(calo->GetID(),-1); + aodph.SetDetector(fCalorimeter); + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta()); + + //Check Distance to Bad channel, set bit. + Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel + if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ; + if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm) + continue ; + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Bad channel cut passed %4.2f\n",distBad); + + if(distBad > fMinDist3) aodph.SetDistToBad(2) ; + else if(distBad > fMinDist2) aodph.SetDistToBad(1) ; + else aodph.SetDistToBad(0) ; + + //Check PID + //PID selection or bit setting + if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){ + //Get most probable PID, check PID weights (in MC this option is mandatory) + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg()); + //If primary is not photon, skip it. + if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; + } + else if(IsCaloPIDOn()){ + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) continue ; + + //Get most probable PID, 2 options check PID weights + //or redo PID, recommended option for EMCal. + if(!IsCaloPIDRecalculationOn()) + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + else + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg()); + + //If cluster does not pass pid, not photon, skip it. + if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; + + } + else{ + //Set PID bits for later selection (AliAnaPi0 for example) + //GetPDG already called in SetPIDBits. + GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph); + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PID Bits set \n"); + } + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg()); + + //Play with the MC stack if available + //Check origin of the candidates + if(IsDataMC()){ + aodph.SetTag(GetCaloPID()->CheckOrigin(calo->GetLabel(0),GetMCStack())); + if(GetDebug() > 0) printf("AliAnaPhoton::FillAOD: Origin of candidate %d\n",aodph.GetTag()); + }//Work with stack also + + //Add AOD with photon object to aod branch + AddAODParticle(aodph); + + }//loop + +if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: End fill AODs \n"); + +} + +//__________________________________________________________________ +void AliAnaPhoton::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + + //Get vertex for photon momentum calculation + Double_t v[]={0,0,0} ; //vertex ; + //if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) + GetReader()->GetVertex(v); + + //Loop on stored AOD photons + Int_t naod = GetOutputAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("AliAnaPhoton::FillHistos: aod branch entries %d\n", naod); + + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); + Int_t pdg = ph->GetPdg(); + + if(GetDebug() > 3) printf("AliAnaPhoton::FillHistos: PDG %d, MC TAG %d, Calorimeter %s\n", ph->GetPdg(),ph->GetTag(), (ph->GetDetector()).Data()) ; + + //If PID used, fill histos with photons in Calorimeter fCalorimeter + if(IsCaloPIDOn()) + if(pdg != AliCaloPID::kPhoton) continue; + if(ph->GetDetector() != fCalorimeter) continue; + + if(GetDebug() > 1) printf("AliAnaPhoton::FillHistos: ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ; + + //Fill photon histograms + Float_t ptcluster = ph->Pt(); + Float_t phicluster = ph->Phi(); + Float_t etacluster = ph->Eta(); + + fhPtPhoton ->Fill(ptcluster); + fhPhiPhoton ->Fill(ptcluster,phicluster); + fhEtaPhoton ->Fill(ptcluster,etacluster); + + if(IsDataMC()){ + Int_t tag =ph->GetTag(); + if(tag == AliCaloPID::kMCPrompt){ + fhPtPrompt ->Fill(ptcluster); + fhPhiPrompt ->Fill(ptcluster,phicluster); + fhEtaPrompt ->Fill(ptcluster,etacluster); + } + else if(tag==AliCaloPID::kMCFragmentation) + { + fhPtFragmentation ->Fill(ptcluster); + fhPhiFragmentation ->Fill(ptcluster,phicluster); + fhEtaFragmentation ->Fill(ptcluster,etacluster); + } + else if(tag==AliCaloPID::kMCPi0Decay) + { + fhPtPi0Decay ->Fill(ptcluster); + fhPhiPi0Decay ->Fill(ptcluster,phicluster); + fhEtaPi0Decay ->Fill(ptcluster,etacluster); + } + else if(tag==AliCaloPID::kMCEtaDecay || tag==AliCaloPID::kMCOtherDecay) + { + fhPtOtherDecay ->Fill(ptcluster); + fhPhiOtherDecay ->Fill(ptcluster,phicluster); + fhEtaOtherDecay ->Fill(ptcluster,etacluster); + } + else if(tag==AliCaloPID::kMCConversion) + { + 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 AliAnaPhoton::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + + if(! opt) + return; + + printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; + AliAnaPartCorrBaseClass::Print(" "); + printf("Calorimeter = %s\n", fCalorimeter.Data()) ; + printf("Min Distance to Bad Channel = %2.1f\n",fMinDist); + printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2); + printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3); + printf(" \n") ; + +} diff --git a/PWG4/PartCorrDep/AliAnaPhoton.h b/PWG4/PartCorrDep/AliAnaPhoton.h new file mode 100755 index 00000000000..d913dba2274 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPhoton.h @@ -0,0 +1,97 @@ +#ifndef ALIANAPHOTON_H +#define ALIANAPHOTON_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliAnaPhoton.h 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ +// +// Class for the photon identification. +// Clusters from calorimeters are identified as photons +// and kept in the AOD. Few histograms produced. +// + +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TH2F ; +class TString ; + +// --- ANALYSIS system --- +#include "AliAnaPartCorrBaseClass.h" + +class TList ; + +class AliAnaPhoton : public AliAnaPartCorrBaseClass { + +public: + + AliAnaPhoton() ; // default ctor + AliAnaPhoton(const AliAnaPhoton & g) ; // cpy ctor + AliAnaPhoton & operator = (const AliAnaPhoton & g) ;//cpy assignment + virtual ~AliAnaPhoton() ; //virtual dtor + + TList * GetCreateOutputObjects(); + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + void Print(const Option_t * opt)const; + + TString GetCalorimeter() const {return fCalorimeter ; } + void SetCalorimeter(TString det) {fCalorimeter = det ; } + + void InitParameters(); + + void SetMinDistanceToBadChannel(Float_t m1, Float_t m2, Float_t m3) { + fMinDist = m1; + fMinDist2 = m2; + fMinDist3 = m3; + } + + private: + + TString fCalorimeter ; // Calorimeter where the gamma is searched; + 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 + + //Histograms + TH1F * fhPtPhoton ; //! Number of identified photon vs transerse momentum + TH2F * fhPhiPhoton ; //! Azimuthal angle of identified photon vs transerse momentum + TH2F * fhEtaPhoton ; //! Pseudorapidity of identified photon vs transerse momentum + + //MC + TH1F * fhPtPrompt; //! Number of identified prompt gamma + TH2F * fhPhiPrompt; //! Phi of identified prompt gamma + TH2F * fhEtaPrompt; //! eta of identified prompt gamma + + TH1F * fhPtFragmentation; //! Number of identified fragmentation gamma + TH2F * fhPhiFragmentation; //! Phi of identified fragmentation gamma + TH2F * fhEtaFragmentation; //! eta of identified fragmentation gamma + + TH1F * fhPtPi0Decay; //! Number of identified Pi0Decay gamma + TH2F * fhPhiPi0Decay; //! Phi of identified Pi0Decay gamma + TH2F * fhEtaPi0Decay; //! eta of identified Pi0Decay gamma + + TH1F * fhPtOtherDecay; //! Number of identified OtherDecay gamma + TH2F * fhPhiOtherDecay; //! Phi of identified OtherDecay gamma + TH2F * fhEtaOtherDecay; //! eta of identified OtherDecay gamma + + TH1F * fhPtConversion; //! Number of identified Conversion gamma + TH2F * fhPhiConversion; //! Phi of identified Conversion gamma + TH2F * fhEtaConversion; //! eta of identified Conversion gamma + + TH1F * fhPtUnknown; //! Number of identified Unknown gamma + TH2F * fhPhiUnknown; //! Phi of identified Unknown gamma + TH2F * fhEtaUnknown; //! eta of identified Unknown gamma + + ClassDef(AliAnaPhoton,1) +} ; + + +#endif//ALIANAPHOTON_H + + + diff --git a/PWG4/PartCorrDep/AliAnaPi0.cxx b/PWG4/PartCorrDep/AliAnaPi0.cxx new file mode 100755 index 00000000000..a7195a68f13 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPi0.cxx @@ -0,0 +1,480 @@ +/************************************************************************** + * 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") +//-- Adapted to PartCorr frame by Lamia Benhabib (SUBATECH) +//-- and Gustavo Conesa (INFN-Frascati) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include "TH3.h" +//#include "Riostream.h" + +//---- AliRoot system ---- +#include "AliAnaPi0.h" +#include "AliCaloTrackReader.h" +#include "AliCaloPID.h" + +#ifdef __PHOSGEO__ + #include "AliPHOSGeoUtils.h" +#endif + +ClassImp(AliAnaPi0) + +//________________________________________________________________________________________________________________________________________________ +AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(), +fNCentrBin(0),fNZvertBin(0),fNrpBin(0), +fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""), +fEventsList(0x0), fhEtalon(0x0), +fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0), +fhPrimPt(0x0), fhPrimAccPt(0x0), fhPrimY(0x0), fhPrimAccY(0x0), fhPrimPhi(0x0), fhPrimAccPhi(0x0) +{ +//Default Ctor + InitParameters(); + +} + +//________________________________________________________________________________________________________________________________________________ +AliAnaPi0::AliAnaPi0(const AliAnaPi0 & ex) : AliAnaPartCorrBaseClass(ex), +fNCentrBin(ex.fNCentrBin),fNZvertBin(ex.fNZvertBin),fNrpBin(ex.fNrpBin), +fNPID(ex.fNPID),fNmaxMixEv(ex.fNmaxMixEv),fZvtxCut(ex.fZvtxCut), fCalorimeter(ex.fCalorimeter), +fEventsList(ex.fEventsList), fhEtalon(ex.fhEtalon), +fhRe1(ex.fhRe1),fhMi1(ex.fhMi1),fhRe2(ex.fhRe2),fhMi2(ex.fhMi2),fhRe3(ex.fhRe3),fhMi3(ex.fhMi3),fhEvents(ex.fhEvents), +fhPrimPt(ex.fhPrimPt), fhPrimAccPt(ex.fhPrimAccPt), fhPrimY(ex.fhPrimY), +fhPrimAccY(ex.fhPrimAccY), fhPrimPhi(ex.fhPrimPhi), fhPrimAccPhi(ex.fhPrimAccPhi) +{ + // cpy ctor + //Do not need it +} + +//________________________________________________________________________________________________________________________________________________ +AliAnaPi0 & AliAnaPi0::operator = (const AliAnaPi0 & ex) +{ + // assignment operator + + if(this == &ex)return *this; + ((AliAnaPartCorrBaseClass *)this)->operator=(ex); + + fNCentrBin = ex.fNCentrBin ; fNZvertBin = ex.fNZvertBin ; fNrpBin = ex.fNrpBin ; + fNPID = ex.fNPID ; fNmaxMixEv = ex.fNmaxMixEv ; fZvtxCut = ex.fZvtxCut ; fCalorimeter = ex.fCalorimeter ; + fEventsList = ex.fEventsList ; fhEtalon = ex.fhEtalon ; + fhRe1 = ex.fhRe1 ; fhMi1 = ex.fhMi1 ; fhRe2 = ex.fhRe2 ; fhMi2 = ex.fhMi2 ; + fhRe3 = ex.fhRe3 ; fhMi3 = ex.fhMi3 ; fhEvents = ex.fhEvents ; + fhPrimPt = ex.fhPrimPt ; fhPrimAccPt = ex.fhPrimAccPt ; fhPrimY = ex.fhPrimY ; + fhPrimAccY = ex.fhPrimAccY ; fhPrimPhi = ex.fhPrimPhi ; fhPrimAccPhi = ex.fhPrimAccPhi ; + + 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 ; + } + +#ifdef __PHOSGEO__ + if(fPHOSGeo) delete fPHOSGeo ; +#endif +} + +//________________________________________________________________________________________________________________________________________________ +void AliAnaPi0::InitParameters() +{ +//Init parameters when first called the analysis +//Set default parameters + SetInputAODName("photons"); + fNCentrBin = 1; + fNZvertBin = 1; + fNrpBin = 1; + fNPID = 9; + fNmaxMixEv = 10; + fZvtxCut = 40; + fCalorimeter = "PHOS"; +} +//________________________________________________________________________________________________________________________________________________ +void AliAnaPi0::Init() +{ +//Init some data members needed in analysis + +//Histograms binning and range + if(!fhEtalon){ // p_T alpha d m_gg + fhEtalon = new TH3D("hEtalon","Histo with binning parameters",50,0.,25.,10,0.,1.,200,0.,1.) ; + fhEtalon->SetXTitle("P_{T} (GeV)") ; + fhEtalon->SetYTitle("#alpha") ; + fhEtalon->SetZTitle("m_{#gamma#gamma} (GeV)") ; + } + + +//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]=(TH3D*)fhEtalon->Clone(key) ; + fhRe1[ic*fNPID+ipid]->SetName(key) ; + fhRe1[ic*fNPID+ipid]->SetTitle(title) ; + outputContainer->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) ; + outputContainer->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) ; + outputContainer->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) ; + outputContainer->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) ; + outputContainer->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) ; + outputContainer->Add(fhMi3[ic*fNPID+ipid]) ; + } + } + + + fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin, + fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ; + outputContainer->Add(fhEvents) ; + + //Histograms filled only if MC data is requested + if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){ + if(fhEtalon->GetXaxis()->GetXbins() && fhEtalon->GetXaxis()->GetXbins()->GetSize()){ //Variable bin size + fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXbins()->GetArray()) ; + fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",fhEtalon->GetXaxis()->GetNbins(), + fhEtalon->GetXaxis()->GetXbins()->GetArray()) ; + } + else{ + fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ; + fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance", + fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ; + } + outputContainer->Add(fhPrimPt) ; + outputContainer->Add(fhPrimAccPt) ; + + fhPrimY = new TH1D("hPrimaryRapidity","Rapidity of primary pi0",100,-5.,5.) ; + outputContainer->Add(fhPrimY) ; + + fhPrimAccY = new TH1D("hPrimAccRapidity","Rapidity of primary pi0",100,-5.,5.) ; + outputContainer->Add(fhPrimAccY) ; + + fhPrimPhi = new TH1D("hPrimaryPhi","Azimithal of primary pi0",180,0.,360.) ; + outputContainer->Add(fhPrimPhi) ; + + fhPrimAccPhi = new TH1D("hPrimAccPhi","Azimithal of primary pi0 with accepted daughters",180,-0.,360.) ; + outputContainer->Add(fhPrimAccPhi) ; + } + + //Save parameters used for analysis + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + sprintf(onePar,"--- AliAnaPi0 ---\n") ; + parList+=onePar ; + 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,"Calorimeter: %s \n",fCalorimeter.Data()) ; + parList+=onePar ; + + TObjString *oString= new TObjString(parList) ; + outputContainer->Add(oString); + + return outputContainer; +} + +//_________________________________________________________________________________________________________________________________________________ +void AliAnaPi0::Print(const Option_t * /*opt*/) const +{ + //Print some relevant parameters set for the analysis + AliAnaPartCorrBaseClass::Print(" "); + 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: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ; + printf("------------------------------------------------------\n") ; +} + + +//____________________________________________________________________________________________________________________________________________________ +void AliAnaPi0:: MakeAnalysisFillHistograms() +{ + //Process one event and extract photons from AOD branch + // filled with AliAnaPhoton and fill histos with invariant mass + + //Apply some cuts on event: vertex position and centrality range + Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ; + if(IsBadRun(iRun)) return ; + + Double_t vert[]={0,0,0} ; //vertex ; + GetReader()->GetVertex(vert); + if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) + + //Get Centrality and calculate centrality bin + //Does not exist in ESD yet??????? + Int_t curCentrBin=0 ; + + //Get Reaction Plain position and calculate RP bin + //does not exist in ESD yet???? + Int_t curRPBin=0 ; + + Int_t curZvertBin=(Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ; + + fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ; + + Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ; + if(GetDebug() > 1) printf("AliAnaPi0::FillHistos: photon entries %d\n", nPhot); + + for(Int_t i1=0; i1At(i1)) ; + TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); + for(Int_t i2=i1+1; i2At(i2)) ; + TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); + Double_t m = (photon1 + photon2).M() ; + Double_t pt = (photon1 + photon2).Pt(); + Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; + if(GetDebug() > 2) + printf("AliAnaPi0::FillHistos: Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", + p1->Pt(), p2->Pt(), pt,m,a); + for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ + fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>0 && p2->DistToBad()>0){ + fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>1 && p2->DistToBad()>1){ + fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + } + } + } + } + } + } + + //Fill mixed + + TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ; + Int_t nMixed = evMixList->GetSize() ; + for(Int_t ii=0; iiAt(ii)); + Int_t nPhot2=ev2->GetEntriesFast() ; + Double_t m = -999; + if(GetDebug() > 1) printf("AliAnaPi0::FillHistos: Mixed event %d photon entries %d\n", ii, nPhot); + + for(Int_t i1=0; i1At(i1)) ; + TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); + for(Int_t i2=0; i2At(i2)) ; + + TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); + m = (photon1+photon2).M() ; + Double_t pt = (photon1 + photon2).Pt(); + Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; + if(GetDebug() > 2) + printf("AliAnaPi0::FillHistos: Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", + p1->Pt(), p2->Pt(), pt,m,a); + for(Int_t ipid=0; ipidIsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ + fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>0 && p2->DistToBad()>0){ + fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + if(p1->DistToBad()>1 && p2->DistToBad()>1){ + fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; + } + + } + } + } + } + } + } + + TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch()); + //Add current event to buffer and Remove redandant events + if(currentEvent->GetEntriesFast()>0){ + evMixList->AddFirst(currentEvent) ; + currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer + if(evMixList->GetSize()>=fNmaxMixEv) + { + TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ; + evMixList->RemoveLast() ; + delete tmp ; + } + } + else{ //empty event + delete currentEvent ; + currentEvent=0 ; + } + + //Acceptance + AliStack * stack = GetMCStack(); + if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){ + for(Int_t i=0 ; iGetNprimary(); i++){ + TParticle * prim = stack->Particle(i) ; + if(prim->GetPdgCode() == 111){ + Double_t pi0Pt = prim->Pt() ; + //printf("pi0, pt %2.2f\n",pi0Pt); + Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ; + Double_t phi = TMath::RadToDeg()*prim->Phi() ; + if(TMath::Abs(pi0Y) < 0.5){ + fhPrimPt->Fill(pi0Pt) ; + } + fhPrimY ->Fill(pi0Y) ; + fhPrimPhi->Fill(phi) ; + + //Check if both photons hit Calorimeter + Int_t iphot1=prim->GetFirstDaughter() ; + Int_t iphot2=prim->GetLastDaughter() ; + if(iphot1>-1 && iphot1GetNtrack() && iphot2>-1 && iphot2GetNtrack()){ + TParticle * phot1 = stack->Particle(iphot1) ; + TParticle * phot2 = stack->Particle(iphot2) ; + if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){ + //printf("2 photons: photon 1: pt %2.2f, phi %3.2f, eta %1.2f; photon 2: pt %2.2f, phi %3.2f, eta %1.2f\n", + // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta()); + Bool_t inacceptance = kFALSE; +#ifdef __PHOSGEO__ + Int_t mod ; + Double_t x,z ; + if(fCalorimeter == "PHOS" && fPHOSGeo->ImpactOnEmc(phot1,mod,z,x) && fPHOSGeo->ImpactOnEmc(phot1,mod,z,x)) + inacceptance = kTRUE; + //printf("In REAL PHOS acceptance? %d\n",inacceptance); +#else + TLorentzVector lv1, lv2; + phot1->Momentum(lv1); + phot2->Momentum(lv2); + if(GetFidutialCut()->IsInFidutialCut(lv1,fCalorimeter) && GetFidutialCut()->IsInFidutialCut(lv2,fCalorimeter)) + inacceptance = kTRUE ; + //printf("In %s fidutial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); +#endif + if(inacceptance){ + fhPrimAccPt->Fill(pi0Pt) ; + fhPrimAccPhi->Fill(phi) ; + fhPrimAccY->Fill(pi0Y) ; + }//Accepted + }// 2 photons + }//Check daughters exist + }// Primary pi0 + }//loop on primaries + }//stack exists and data is MC + +} + + + + + + + + + + + diff --git a/PWG4/PartCorrDep/AliAnaPi0.h b/PWG4/PartCorrDep/AliAnaPi0.h new file mode 100755 index 00000000000..3c7cdfb7992 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPi0.h @@ -0,0 +1,110 @@ +#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") +//-- Adapted to PartCorr frame by Lamia Benhabib (SUBATECH) +//-- and Gustavo Conesa (INFN-Frascati) + +//Root +class TList; +class TH3D ; + +//Analysis +class AliAODEvent ; +class AliESDEvent ; +#include "AliAnaPartCorrBaseClass.h" + +#ifdef __PHOSGEO__ + class AliPHOSGeoUtils; +#endif + +class AliAnaPi0 : public AliAnaPartCorrBaseClass { + +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 + + TList * GetCreateOutputObjects(); + + void Print(const Option_t * opt) const; + + void Init(); + void InitParameters(); + + //void MakeAnalysisFillAOD() {;} //Not needed + void MakeAnalysisFillHistograms(); + +// void SetBadRunsList(){;} ; //Set list of runs which can be used for this analysis + //To be defined in future. + 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 + + TString GetCalorimeter() const {return fCalorimeter ; } + void SetCalorimeter(TString det) {fCalorimeter = det ; } + +private: + Bool_t IsBadRun(Int_t /*iRun*/) const {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 + Float_t fZvtxCut ; //Cut on vertex position + TString fCalorimeter ; //Select Calorimeter for IM + + TList ** fEventsList ; //! containers for photons in stored events + + //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 + + //Acceptance + TH1D * fhPrimPt ; //! Spectrum of Primary + TH1D * fhPrimAccPt ; //! Spectrum of primary with accepted daughters + TH1D * fhPrimY ; //! Rapidity distribution of primary particles + TH1D * fhPrimAccY ; //! Rapidity distribution of primary with accepted daughters + TH1D * fhPrimPhi ; //! Azimutal distribution of primary particles + TH1D * fhPrimAccPhi; //! Azimutal distribution of primary with accepted daughters + +#ifdef __PHOSGEO__ + AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer +#endif + + ClassDef(AliAnaPi0,3) +} ; + + +#endif //ALIANAPI0_H + + + diff --git a/PWG4/PartCorrDep/AliAnaPi0EbE.cxx b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx new file mode 100755 index 00000000000..b8ed86f4492 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx @@ -0,0 +1,551 @@ +/************************************************************************** + * 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: AliAnaPi0EbE.cxx 28688 2008-09-11 15:04:07Z gconesab $ */ + +//_________________________________________________________________________ +// Class for the analysis of high pT pi0 event by event +// Pi0 identified by one of the following: +// -Invariant mass of 2 cluster in calorimeter +// -Shower shape analysis in calorimeter +// -Invariant mass of one cluster in calorimeter and one photon reconstructed in TPC (in near future) +// +// -- Author: Gustavo Conesa (LNF-INFN) & Raphaelle Ichou (SUBATECH) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +//#include "Riostream.h" + +// --- Analysis system --- +#include "AliAnaPi0EbE.h" +#include "AliLog.h" +#include "AliCaloTrackReader.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" +#include "AliCaloPID.h" +#include "AliAODPWG4ParticleCorrelation.h" + +ClassImp(AliAnaPi0EbE) + +//____________________________________________________________________________ +AliAnaPi0EbE::AliAnaPi0EbE() : +AliAnaPartCorrBaseClass(), fAnaType(kIMCalo),fCalorimeter(""), +fMinDist(0.),fMinDist2(0.),fMinDist3(0.), +fInputAODGammaConv(0x0),fInputAODGammaConvName(""), +fhPtPi0(0),fhPhiPi0(0),fhEtaPi0(0), +fhPtMCNoPi0(0),fhPhiMCNoPi0(0),fhEtaMCNoPi0(0), +fhPtMCPi0(0),fhPhiMCPi0(0),fhEtaMCPi0(0) +{ + //default ctor + + //Initialize parameters + InitParameters(); + +} + +//____________________________________________________________________________ +AliAnaPi0EbE::AliAnaPi0EbE(const AliAnaPi0EbE & p) : +AliAnaPartCorrBaseClass(p), fAnaType(p.fAnaType), fCalorimeter(p.fCalorimeter), +fMinDist(p.fMinDist),fMinDist2(p.fMinDist2), fMinDist3(p.fMinDist3), +fInputAODGammaConv(new TClonesArray(*p.fInputAODGammaConv)), +fInputAODGammaConvName(p.fInputAODGammaConvName), +fhPtPi0(p.fhPtPi0),fhPhiPi0(p.fhPhiPi0),fhEtaPi0(p.fhEtaPi0), +fhPtMCNoPi0(p.fhPtMCNoPi0),fhPhiMCNoPi0(p.fhPhiMCNoPi0),fhEtaMCNoPi0(p.fhEtaMCNoPi0), +fhPtMCPi0(p.fhPtMCPi0),fhPhiMCPi0(p.fhPhiMCPi0),fhEtaMCPi0(p.fhEtaMCPi0) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliAnaPi0EbE & AliAnaPi0EbE::operator = (const AliAnaPi0EbE & p) +{ + // assignment operator + + if(&p == this) return *this; + + fAnaType = p.fAnaType ; + fCalorimeter = p.fCalorimeter ; + fMinDist = p.fMinDist; + fMinDist2 = p.fMinDist2; + fMinDist3 = p.fMinDist3; + + fInputAODGammaConv = new TClonesArray(*p.fInputAODGammaConv) ; + fInputAODGammaConvName = p.fInputAODGammaConvName ; + + fhPtPi0 = p.fhPtPi0; fhPhiPi0 = p.fhPhiPi0; fhEtaPi0 = p.fhEtaPi0; + fhPtMCNoPi0 = p.fhPtMCNoPi0; fhPhiMCNoPi0 = p.fhPhiMCNoPi0; fhEtaMCNoPi0 = p.fhEtaMCPi0; + fhPtMCPi0 = p.fhPtMCPi0; fhPhiMCPi0 = p.fhPhiMCPi0; fhEtaMCPi0 = p.fhEtaMCPi0; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaPi0EbE::~AliAnaPi0EbE() +{ + //dtor + if(fInputAODGammaConv){ + fInputAODGammaConv->Clear() ; + delete fInputAODGammaConv ; + } +} + +//________________________________________________________________________ +TList * AliAnaPi0EbE::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in outputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("Pi0EbEHistos") ; + + Int_t nptbins = GetHistoNPtBins(); + Int_t nphibins = GetHistoNPhiBins(); + Int_t netabins = GetHistoNEtaBins(); + Float_t ptmax = GetHistoPtMax(); + Float_t phimax = GetHistoPhiMax(); + Float_t etamax = GetHistoEtaMax(); + Float_t ptmin = GetHistoPtMin(); + Float_t phimin = GetHistoPhiMin(); + Float_t etamin = GetHistoEtaMin(); + + fhPtPi0 = new TH1F("hPtPi0","Number of identified #pi^{0} decay",nptbins,ptmin,ptmax); + fhPtPi0->SetYTitle("N"); + fhPtPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)"); + outputContainer->Add(fhPtPi0) ; + + fhPhiPi0 = new TH2F + ("hPhiPi0","#phi_{#pi^{0}}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiPi0->SetYTitle("#phi"); + fhPhiPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhPhiPi0) ; + + fhEtaPi0 = new TH2F + ("hEtaPi0","#phi_{#pi^{0}}",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaPi0->SetYTitle("#eta"); + fhEtaPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhEtaPi0) ; + + if(IsDataMC()){ + + fhPtMCPi0 = new TH1F("hPtMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax); + fhPtMCPi0->SetYTitle("N"); + fhPtMCPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)"); + outputContainer->Add(fhPtMCPi0) ; + + fhPhiMCPi0 = new TH2F + ("hPhiMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiMCPi0->SetYTitle("#phi"); + fhPhiMCPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhPhiMCPi0) ; + + fhEtaMCPi0 = new TH2F + ("hEtaMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaMCPi0->SetYTitle("#eta"); + fhEtaMCPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhEtaMCPi0) ; + + fhPtMCNoPi0 = new TH1F("hPtMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax); + fhPtMCNoPi0->SetYTitle("N"); + fhPtMCNoPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)"); + outputContainer->Add(fhPtMCNoPi0) ; + + fhPhiMCNoPi0 = new TH2F + ("hPhiMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax,nphibins,phimin,phimax); + fhPhiMCNoPi0->SetYTitle("#phi"); + fhPhiMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhPhiMCNoPi0) ; + + fhEtaMCNoPi0 = new TH2F + ("hEtaMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax,netabins,etamin,etamax); + fhEtaMCNoPi0->SetYTitle("#eta"); + fhEtaMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)"); + outputContainer->Add(fhEtaMCNoPi0) ; + + }//Histos with MC + + + //Keep neutral meson selection histograms if requiered + //Setting done in AliNeutralMesonSelection + + if(fAnaType!=kSSCalo && GetNeutralMesonSelection()){ + + TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ; + if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept()) + for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ; + } + + //Save parameters used for analysis + TString parList ; //this will be list of parameters used for this analysis. + char onePar[255] ; + + sprintf(onePar,"--- AliAnaPi0EbE ---\n") ; + parList+=onePar ; + sprintf(onePar,"fAnaType=%d (Pi0 selection type) \n",fAnaType) ; + parList+=onePar ; + + if(fAnaType == kSSCalo){ + sprintf(onePar,"Calorimeter: %s\n",fCalorimeter.Data()) ; + parList+=onePar ; + sprintf(onePar,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ; + parList+=onePar ; + sprintf(onePar,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ; + parList+=onePar ; + sprintf(onePar,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ; + parList+=onePar ; + } + + //Get parameters set in base class. + parList += GetBaseParametersList() ; + + //Get parameters set in PID class. + if(fAnaType == kSSCalo) parList += GetCaloPID()->GetPIDParametersList() ; + + TObjString *oString= new TObjString(parList) ; + outputContainer->Add(oString); + + return outputContainer ; + +} + +//__________________________________________________________________ +void AliAnaPi0EbE::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + + switch(fAnaType) + { + case kIMCalo: + MakeInvMassInCalorimeter(); + break; + + case kSSCalo: + MakeShowerShapeIdentification(); + break; + + case kIMCaloTracks: + MakeInvMassInCalorimeterAndCTS(); + break; + + } +} + +//__________________________________________________________________ +void AliAnaPi0EbE::MakeInvMassInCalorimeter() +{ + //Do analysis and fill aods + //Search for the photon decay in calorimeters + //Read photon list from AOD, produced in class AliAnaPhoton + //Check if 2 photons have the mass of the pi0. + + TLorentzVector mom1; + TLorentzVector mom2; + TLorentzVector mom ; + Int_t tag1 =-1; + Int_t tag2 =-1; + Int_t tag = -1; + + if(!GetInputAODBranch()) + AliFatal(Form("MakeInvMassInCalo: No input calo photons in AOD with name branch < %s > \n",GetInputAODName().Data())); + + for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){ + AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton)); + mom1 = *(photon1->Momentum()); + + //Play with the MC stack if available + + for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast()-1; jphoton++){ + + AliAODPWG4ParticleCorrelation * photon2 = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(jphoton)); + mom2 = *(photon2->Momentum()); + //Select good pair (good phi, pt cuts, aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)) + { + if(GetDebug()>1) printf("Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta()); + + + if(IsDataMC()){ + //Check origin of the candidates + tag1 = GetCaloPID()->CheckOrigin(photon1->GetLabel(), GetMCStack()); + tag2 = GetCaloPID()->CheckOrigin(photon2->GetLabel(), GetMCStack()); + if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2); + if(tag1 == AliCaloPID::kMCPi0Decay && tag2 == AliCaloPID::kMCPi0Decay) tag = AliCaloPID::kMCPi0; + }//Work with stack also + + //Create AOD for analysis + mom = mom1+mom2; + AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom); + //pi0.SetLabel(calo->GetLabel(0)); + pi0.SetPdg(AliCaloPID::kPi0); + pi0.SetDetector(photon1->GetDetector()); + pi0.SetTag(tag); + //Set the indeces of the original caloclusters + pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0)); + AddAODParticle(pi0); + }//pi0 + }//2n photon loop + + }//1st photon loop + + if(GetDebug() > 1) printf("End fill AODs \n"); + +} + +//__________________________________________________________________ +void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() +{ + //Do analysis and fill aods + //Search for the photon decay in calorimeters + //Read photon list from AOD, produced in class AliAnaPhoton and AliGammaConversion + //Check if 2 photons have the mass of the pi0. + + TLorentzVector mom1; + TLorentzVector mom2; + TLorentzVector mom ; + Int_t tag1 =-1; + Int_t tag2 =-1; + Int_t tag = -1; + + if(!GetInputAODBranch()) + AliFatal(Form("MakeInvMassInCalo: No input calo photons in AOD branch with name < %s > \n",GetInputAODName().Data())); + + for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){ + AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton)); + mom1 = *(photon1->Momentum()); + + //Play with the MC stack if available + fInputAODGammaConv = (TClonesArray *) GetReader()->GetAOD()->FindListObject(fInputAODGammaConvName); + if(!fInputAODGammaConv) + AliFatal(Form("MakeInvMassInCaloAndCTS: No input gamma conversions in AOD branch with name < %s >",fInputAODGammaConvName.Data())); + + for(Int_t jphoton = iphoton+1; jphoton < fInputAODGammaConv->GetEntriesFast()-1; jphoton++){ + AliAODPWG4ParticleCorrelation * photon2 = (AliAODPWG4ParticleCorrelation*) (fInputAODGammaConv->At(jphoton)); + mom2 = *(photon2->Momentum()); + //Select good pair (good phi, pt cuts, aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)){ + if(GetDebug() > 1) printf("Selected gamma pair: pt %f, phi %f, eta%f\n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta()); + + if(IsDataMC()){ + //Check origin of the candidates + tag1 = GetCaloPID()->CheckOrigin(photon1->GetLabel(), GetMCStack()); + tag2 = GetCaloPID()->CheckOrigin(photon2->GetLabel(), GetMCStack()); + if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2); + if(tag1 == AliCaloPID::kMCPi0Decay && tag2 == AliCaloPID::kMCPi0Decay) tag = AliCaloPID::kMCPi0; + }//Work with stack also + + //Create AOD for analysis + mom = mom1+mom2; + AliAODPWG4ParticleCorrelation pi0 = AliAODPWG4ParticleCorrelation(mom); + //pi0.SetLabel(calo->GetLabel(0)); + pi0.SetPdg(AliCaloPID::kPi0); + pi0.SetDetector(photon1->GetDetector()); + pi0.SetTag(tag); + //Set the indeces of the original tracks or caloclusters + pi0.SetCaloLabel(photon1->GetCaloLabel(0), -1); + pi0.SetTrackLabel(photon2->GetTrackLabel(0), photon2->GetTrackLabel(1)); + AddAODParticle(pi0); + }//pi0 + }//2n photon loop + + }//1st photon loop + + if(GetDebug() > 1) printf("End fill AODs \n"); + +} + + +//__________________________________________________________________ +void AliAnaPi0EbE::MakeShowerShapeIdentification() +{ + //Search for pi0 in fCalorimeter with shower shape analysis + + 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 Calorimeter of the photon + if(fCalorimeter == "PHOS") + pl = GetAODPHOS(); + else if (fCalorimeter == "EMCAL") + pl = GetAODEMCAL(); + //Fill AODCaloClusters and AODParticle with PHOS aods + TLorentzVector mom ; + for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){ + AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo)); + + //Cluster selection, not charged, with photon id and in fidutial cut + //Get Momentum vector, + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + //If too small or big pt, skip it + if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ; + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,fCalorimeter) ; + if(! in ) continue ; + } + + //Create AOD for analysis + AliAODPWG4Particle aodph = AliAODPWG4Particle(mom); + aodph.SetLabel(calo->GetLabel(0)); + aodph.SetDetector(fCalorimeter); + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta()); + + //Check Distance to Bad channel, set bit. + Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel + if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ; + if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm) + continue ; + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Bad channel cut passed %4.2f\n",distBad); + + if(distBad > fMinDist3) aodph.SetDistToBad(2) ; + else if(distBad > fMinDist2) aodph.SetDistToBad(1) ; + else aodph.SetDistToBad(0) ; + + //Check PID + //PID selection or bit setting + if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){ + //Get most probable PID, check PID weights (in MC this option is mandatory) + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg()); + //If primary is not photon, skip it. + if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; + } + else if(IsCaloPIDOn()){ + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) continue ; + + //Get most probable PID, 2 options check PID weights + //or redo PID, recommended option for EMCal. + if(!IsCaloPIDRecalculationOn()) + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights + else + aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg()); + + //If cluster does not pass pid, not photon, skip it. + if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ; + + } + else{ + //Set PID bits for later selection (AliAnaPi0 for example) + //GetPDG already called in SetPIDBits. + GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph); + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PID Bits set \n"); + } + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg()); + + //Play with the MC stack if available + //Check origin of the candidates + if(IsDataMC()){ + aodph.SetTag(GetCaloPID()->CheckOrigin(calo->GetLabel(0),GetMCStack())); + if(GetDebug() > 0) printf("AliAnaPi0EbE::FillAOD: Origin of candidate %d\n",aodph.GetTag()); + }//Work with stack also + + //Add AOD with photon object to aod branch + AddAODParticle(aodph); + + }//loop + + if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: End fill AODs \n"); + +} +//__________________________________________________________________ +void AliAnaPi0EbE::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + + if(!GetOutputAODBranch()) + AliFatal(Form("MakeInvMassInCalo: No output pi0 in AOD branch with name < %s > \n",GetOutputAODName().Data())); + + //Loop on stored AOD pi0 + Int_t naod = GetOutputAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("pi0 aod branch entries %d\n", naod); + + for(Int_t iaod = 0; iaod < naod ; iaod++){ + + AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); + Int_t pdg = pi0->GetPdg(); + + if(pdg != AliCaloPID::kPi0) continue; + + //Fill pi0 histograms + Float_t pt = pi0->Pt(); + Float_t phi = pi0->Phi(); + Float_t eta = pi0->Eta(); + + + fhPtPi0 ->Fill(pt); + fhPhiPi0 ->Fill(pt,phi); + fhEtaPi0 ->Fill(pt,eta); + + if(IsDataMC()){ + if(pi0->GetTag()== AliCaloPID::kMCPi0Decay){ + fhPtMCPi0 ->Fill(pt); + fhPhiMCPi0 ->Fill(pt,phi); + fhEtaMCPi0 ->Fill(pt,eta); + } + else{ + fhPtMCNoPi0 ->Fill(pt); + fhPhiMCNoPi0 ->Fill(pt,phi); + fhEtaMCNoPi0 ->Fill(pt,eta); + } + }//Histograms with MC + + }// aod loop + +} + + +//____________________________________________________________________________ +void AliAnaPi0EbE::InitParameters() +{ + + //Initialize the parameters of the analysis. + SetOutputAODClassName("AliAODPWG4Particle"); + SetOutputAODName("pi0s"); + fInputAODGammaConvName = "gammaconv" ; + fAnaType = kIMCalo ; + fCalorimeter = "PHOS" ; + fMinDist = 2.; + fMinDist2 = 4.; + fMinDist3 = 5.; + +} + +//__________________________________________________________________ +void AliAnaPi0EbE::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; + AliAnaPartCorrBaseClass::Print(""); + printf("Analysis Type = %d \n", fAnaType) ; + if(fAnaType == kSSCalo){ + printf("Calorimeter = %s\n", fCalorimeter.Data()) ; + printf("Min Distance to Bad Channel = %2.1f\n",fMinDist); + printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2); + printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3); + } + printf(" \n") ; + +} diff --git a/PWG4/PartCorrDep/AliAnaPi0EbE.h b/PWG4/PartCorrDep/AliAnaPi0EbE.h new file mode 100755 index 00000000000..26a7162b078 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnaPi0EbE.h @@ -0,0 +1,102 @@ +#ifndef ALIANAPI0EBE_H +#define ALIANAPI0EBE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: AliAnaPi0EbE.h 27413 2008-07-18 13:28:12Z gconesab $ */ + +//_________________________________________________________________________ +// +// Class for the analysis of high pT pi0 event by event +// Pi0 identified by one of the following: +// -Invariant mass of 2 cluster in calorimeter +// -Shower shape analysis in calorimeter +// -Invariant mass of one cluster in calorimeter and one photon reconstructed in TPC (in near future) +// +//-- Author: Gustavo Conesa (INFN-LNF) & Raphaelle Ichou (SUBATECH) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include +#include + +// --- ANALYSIS system --- +#include "AliAnaPartCorrBaseClass.h" +class AliAODPWG4ParticleCorrelation ; + +class TList ; + +class AliAnaPi0EbE : public AliAnaPartCorrBaseClass { + +public: + + AliAnaPi0EbE() ; // default ctor + AliAnaPi0EbE(const AliAnaPi0EbE & g) ; // cpy ctor + AliAnaPi0EbE & operator = (const AliAnaPi0EbE & g) ;//cpy assignment + virtual ~AliAnaPi0EbE() ; //virtual dtor + + enum anaTypes {kIMCalo, kSSCalo, kIMCaloTracks}; + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void MakeAnalysisFillAOD() ; + void MakeAnalysisFillHistograms() ; + + void MakeInvMassInCalorimeter() ; + void MakeInvMassInCalorimeterAndCTS() ; + void MakeShowerShapeIdentification() ; + + void Print(const Option_t * opt)const; + + anaTypes GetAnalysisType() const {return fAnaType ; } + void SetAnalysisType(anaTypes ana) {fAnaType = ana ; } + + TString GetInputAODGammaConvName() const {return fInputAODGammaConvName ; } + void SetInputAODGammaConvName(TString name) {fInputAODGammaConvName = name ; } + + //Only for pi0 SS identification case + void SetCalorimeter(TString det) {fCalorimeter = det ; } + + void SetMinDistanceToBadChannel(Float_t m1, Float_t m2, Float_t m3) { + fMinDist = m1; + fMinDist2 = m2; + fMinDist3 = m3; + } + +private: + + anaTypes fAnaType; //Select analysis type + + //Only for pi0 SS identification case, kSSCalo + TString fCalorimeter ; // Calorimeter where the gamma is searched; + 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 + + //Only for combination of calorimeter and conversion photons, kIMCaloTracks + TClonesArray * fInputAODGammaConv; //AOD array with conversion photons reconstructed in CTS + TString fInputAODGammaConvName; //Name of AOD branch with conversion photons + + //Histograms + TH1F * fhPtPi0 ; //! Number of identified pi0 + TH2F * fhPhiPi0 ; //! Phi of identified pi0 + TH2F * fhEtaPi0 ; //! eta of identified pi0 + + //MC + TH1F * fhPtMCNoPi0; //! Number of identified pi0, not coming from pi0 + TH2F * fhPhiMCNoPi0; //! Phi of identified pi0, not coming from pi0 + TH2F * fhEtaMCNoPi0; //! eta of identified pi0, not coming from pi0 + TH1F * fhPtMCPi0; //! Number of identified pi0, coming from pi0 + TH2F * fhPhiMCPi0; //! Phi of identified pi0, coming from pi0 + TH2F * fhEtaMCPi0; //! eta of identified pi0, coming from pi0 + + ClassDef(AliAnaPi0EbE,1) +} ; + + +#endif //ALIANAPI0EBE_H + + + diff --git a/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx b/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx new file mode 100755 index 00000000000..0b976497f17 --- /dev/null +++ b/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx @@ -0,0 +1,331 @@ +/************************************************************************** + * 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 +////////////////////////////////////////////////////////////////////////////// +//Root system +#include +#include +#include +#include +#include +#include +#include + +//Analysis system +#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); + + 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; + + 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") ; + fPhotonId = 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/PartCorrDep/AliAnalysisTaskPHOSExample.h b/PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.h new file mode 100755 index 00000000000..b322c105f9b --- /dev/null +++ b/PWG4/PartCorrDep/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 +////////////////////////////////////////////////////////////////////////////// + +class TTree ; +#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/libPWG4PartCorrBase.pkg b/PWG4/libPWG4PartCorrBase.pkg new file mode 100755 index 00000000000..030e7f5c72c --- /dev/null +++ b/PWG4/libPWG4PartCorrBase.pkg @@ -0,0 +1,22 @@ +#-*- Mode: Makefile -*- + +SRCS = PartCorrBase/AliAODPWG4Particle.cxx PartCorrBase/AliAODPWG4ParticleCorrelation.cxx \ + PartCorrBase/AliNeutralMesonSelection.cxx PartCorrBase/AliFidutialCut.cxx \ + PartCorrBase/AliCaloPID.cxx PartCorrBase/AliIsolationCut.cxx\ + PartCorrBase/AliAnaScale.cxx PartCorrBase/AliAnaPartCorrMaker.cxx \ + PartCorrBase/AliAnaPartCorrBaseClass.cxx PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx \ + PartCorrBase/AliCaloTrackReader.cxx PartCorrBase/AliCaloTrackESDReader.cxx \ + PartCorrBase/AliCaloTrackAODReader.cxx PartCorrBase/AliCaloTrackMCReader.cxx + + +HDRS:= $(SRCS:.cxx=.h) + +DHDR:= PWG4PartCorrBaseLinkDef.h + +EXPORT:=$(SRCS:.cxx=.h) + +ifeq (win32gcc,$(ALICE_TARGET)) +PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \ + -lESD -lAOD -lANALYSIS -lANALYSISalice \ + -L$(shell root-config --libdir) -lEG +endif diff --git a/PWG4/libPWG4PartCorrDep.pkg b/PWG4/libPWG4PartCorrDep.pkg new file mode 100755 index 00000000000..1c34a0591ec --- /dev/null +++ b/PWG4/libPWG4PartCorrDep.pkg @@ -0,0 +1,25 @@ +#-*- Mode: Makefile -*- + +SRCS = PartCorrDep/AliAnaCaloTrigger.cxx PartCorrDep/AliAnaCaloTriggerMC.cxx \ + PartCorrDep/AliAnalysisTaskPHOSExample.cxx \ + PartCorrDep/AliAnaExample.cxx PartCorrDep/AliAnaParticleIsolation.cxx \ + PartCorrDep/AliAnaParticlePartonCorrelation.cxx \ + PartCorrDep/AliAnaParticleHadronCorrelation.cxx \ + PartCorrDep/AliAnaParticleJetFinderCorrelation.cxx \ + PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx \ + PartCorrDep/AliAnaPhoton.cxx PartCorrDep/AliAnaPi0.cxx PartCorrDep/AliAnaPi0EbE.cxx + + +HDRS:= $(SRCS:.cxx=.h) + +DHDR:= PWG4PartCorrDepLinkDef.h + +EXPORT:=$(SRCS:.cxx=.h) + +EINCLUDE= PWG4/PartCorrBase PWG4PartCorrBase/PartCorrBase + +ifeq (win32gcc,$(ALICE_TARGET)) +PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \ + -lESD -lAOD -lANALYSIS -lANALYSISalice -lPWG4PartCorrBase \ + -L$(shell root-config --libdir) -lEG +endif -- 2.39.3