]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
authormorsch <andreas.morsch@cern.ch>
Sat, 25 Oct 2014 18:25:17 +0000 (20:25 +0200)
committermorsch <andreas.morsch@cern.ch>
Sat, 25 Oct 2014 18:25:17 +0000 (20:25 +0200)
Conflicts:
LHAPDF/CMakeliblhapdf5_9_1.pkg

271 files changed:
AD/AliADdigit.cxx
AD/AliADdigit.h
ANALYSIS/AliPhysicsSelection.cxx
ANALYSIS/AliTriggerAnalysis.cxx
ANALYSIS/AliTriggerAnalysis.h
ANALYSIS/macros/train/AddMCGenAmpt.C
EMCAL/macros/DumpEMCalTriggerOCDB.C [new file with mode: 0644]
EVE/CMakelibEveDet.pkg
EVE/CMakelibEveHLT.pkg
EVE/macros/alieve_online_new.C
EVGEN/AliGenEMCocktail.cxx
EVGEN/AliGenEMCocktail.h
EVGEN/AliGenEMlib.cxx
EVGEN/AliGenEMlib.h
FASTSIM/fastGenEMCocktail.C
HLT/TPCLib/HWCFemulator/AliHLTTPCHWClusterMerger.h
ITS/UPGRADE/AliITSURecoDet.cxx
ITS/UPGRADE/AliITSURecoDet.h
ITS/UPGRADE/AliITSURecoLayer.h
ITS/UPGRADE/AliITSURecoSens.h
ITS/UPGRADE/AliITSUReconstructor.cxx
LHAPDF/CMakeliblhapdf.pkg
LHAPDF/CMakeliblhapdf5_9_1.pkg
MFT/AliAnalysisTaskMFTExample.cxx
MFT/AliMFTAnalysisTools.cxx
MFT/AliMFTAnalysisTools.h
MFT/AliMFTPlane.cxx
MONITOR/CMakelibMONITOR.pkg
MONITOR/alieventserver/AliEventServer.cxx
MONITOR/alieventserver/AliEventServerReconstruction.cxx
MONITOR/alieventserver/AliEventServerReconstruction.h
MONITOR/alieventserver/alieventserver.rootrc
MONITOR/alistoragemanager/setupStorageDatabase.sh [deleted file]
OADB/CMakelibOADB.pkg
OADB/COMMON/CENTRALITY/data/centrality.root
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.cxx
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.h
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx
PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelationM.cxx
PWG/CaloTrackCorrBase/AliAnalysisTaskCounter.cxx
PWG/CaloTrackCorrBase/AliCaloPID.cxx
PWG/CaloTrackCorrBase/AliCaloTrackAODReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackESDReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackMCReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackMCReader.h
PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackReader.h
PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx
PWG/CaloTrackCorrBase/AliCalorimeterUtils.h
PWG/CaloTrackCorrBase/AliFiducialCut.cxx
PWG/CaloTrackCorrBase/AliFiducialCut.h
PWG/CaloTrackCorrBase/AliIsolationCut.cxx
PWG/CaloTrackCorrBase/AliIsolationCut.h
PWG/CaloTrackCorrBase/AliMCAnalysisUtils.cxx
PWG/CaloTrackCorrBase/AliMCAnalysisUtils.h
PWG/CaloTrackCorrBase/AliNeutralMesonSelection.cxx
PWG/CaloTrackCorrBase/AliNeutralMesonSelection.h
PWG/EMCAL/AliAnalysisTaskEmcal.cxx
PWG/EMCAL/AliAnalysisTaskEmcal.h
PWG/EMCAL/AliClusterContainer.cxx
PWG/EMCAL/AliClusterContainer.h
PWG/EMCAL/AliEmcalContainer.cxx
PWG/EMCAL/AliEmcalContainer.h
PWG/EMCAL/AliParticleContainer.cxx
PWG/EMCAL/AliParticleContainer.h
PWGCF/CMakelibPWGCFCorrelationsDPhi.pkg
PWGCF/CMakelibPWGCFfemtoscopyUser.pkg
PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorr.cxx
PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorr.h
PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.cxx [new file with mode: 0644]
PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.h [new file with mode: 0644]
PWGCF/Correlations/macros/TriggerPID/AddTaskTwoParticlePIDCorrKine.C [new file with mode: 0644]
PWGCF/Correlations/macros/dptdptcorrelations/AddTaskDptDptCorr_dca1.C
PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.cxx [new file with mode: 0644]
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.h [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb_MC/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb_MC/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp_MC/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/PWGCFCorrelationsDPhiLinkDef.h
PWGCF/PWGCFfemtoscopyUserLinkDef.h
PWGGA/CMakelibPWGGAEMCALTasks.pkg
PWGGA/CMakelibPWGGAPHOSTasks.pkg
PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA.cxx
PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA.h
PWGGA/CaloTrackCorrelations/AliAnaChargedParticles.cxx
PWGGA/CaloTrackCorrelations/AliAnaChargedParticles.h
PWGGA/CaloTrackCorrelations/AliAnaClusterPileUp.cxx
PWGGA/CaloTrackCorrelations/AliAnaClusterPileUp.h
PWGGA/CaloTrackCorrelations/AliAnaEMCALTriggerClusters.cxx
PWGGA/CaloTrackCorrelations/AliAnaEMCALTriggerClusters.h
PWGGA/CaloTrackCorrelations/AliAnaElectron.cxx
PWGGA/CaloTrackCorrelations/AliAnaElectron.h
PWGGA/CaloTrackCorrelations/AliAnaGeneratorKine.cxx
PWGGA/CaloTrackCorrelations/AliAnaGeneratorKine.h
PWGGA/CaloTrackCorrelations/AliAnaInsideClusterInvariantMass.cxx
PWGGA/CaloTrackCorrelations/AliAnaInsideClusterInvariantMass.h
PWGGA/CaloTrackCorrelations/AliAnaOmegaToPi0Gamma.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.h
PWGGA/CaloTrackCorrelations/AliAnaParticleIsolation.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleIsolation.h
PWGGA/CaloTrackCorrelations/AliAnaParticleJetFinderCorrelation.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleJetFinderCorrelation.h
PWGGA/CaloTrackCorrelations/AliAnaParticleJetLeadingConeCorrelation.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleJetLeadingConeCorrelation.h
PWGGA/CaloTrackCorrelations/AliAnaParticlePartonCorrelation.cxx
PWGGA/CaloTrackCorrelations/AliAnaPhoton.cxx
PWGGA/CaloTrackCorrelations/AliAnaPhoton.h
PWGGA/CaloTrackCorrelations/AliAnaPhotonConvInCalo.cxx
PWGGA/CaloTrackCorrelations/AliAnaPhotonConvInCalo.h
PWGGA/CaloTrackCorrelations/AliAnaPi0.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0.h
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.h
PWGGA/CaloTrackCorrelations/AliAnaRandomTrigger.cxx
PWGGA/CaloTrackCorrelations/AliAnaRandomTrigger.h
PWGGA/CaloTrackCorrelations/macros/QA/AddTaskPi0IMGammaCorrQA.C
PWGGA/CaloTrackCorrelations/macros/QA/DrawAnaCaloTrackQA.C
PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.h
PWGGA/EMCALTasks/AliAnalysisTaskEMCALIsoPhoton.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALIsoPhoton.h
PWGGA/GammaConv/AliAnalysisTaskGammaCalo.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliCaloPhotonCuts.cxx
PWGGA/GammaConv/AliCaloPhotonCuts.h
PWGGA/GammaConv/AliConvEventCuts.cxx
PWGGA/GammaConv/AliConvEventCuts.h
PWGGA/GammaConv/macros/AddTask_GammaCalo_pp.C
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_PbPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_pPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_pp.C
PWGGA/GammaConv/macros/AddTask_GammaConvDalitzQAV1_pPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvDalitzV1_pPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_PbPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pp.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pp2.C
PWGGA/PHOSTasks/PHOS_Tagging/AliAnalysisTaskTaggedPhotons.cxx
PWGHF/hfe/AliAnalysisTaskFlowTPCTOFEPSP.cxx
PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx
PWGHF/hfe/AliAnalysisTaskHFEemcQA.h
PWGHF/hfe/AliHFEpidTPC.cxx
PWGHF/hfe/AliHFEpidTPC.h
PWGHF/hfe/AliHFEtpcPIDqa.cxx
PWGHF/hfe/macros/AddTaskHFEFlowTPCTOFEPSP.C
PWGHF/hfe/macros/AddTaskHFEemcQA.C
PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C
PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root [new file with mode: 0644]
PWGHF/vertexingHF/AliAnalysisTaskCombinHF.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.h
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelorTMVA.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelorTMVA.h
PWGHF/vertexingHF/AliCFTaskVertexingHF.cxx
PWGHF/vertexingHF/AliCFTaskVertexingHF.h
PWGHF/vertexingHF/AliCFVertexingHFCascade.cxx
PWGHF/vertexingHF/AliCFVertexingHFCascade.h
PWGHF/vertexingHF/AliRDHFCutsLctoV0.cxx
PWGHF/vertexingHF/AliRDHFCutsLctoV0.h
PWGHF/vertexingHF/macros/AddTaskCFVertexingHFLctoV0bachelorTMVA.C
PWGHF/vertexingHF/macros/AddTaskLc2V0bachelor.C
PWGHF/vertexingHF/macros/makeTFile4CutsLctoV0bachelor.C
PWGJE/EMCALJetTasks/AliAnalysisTaskDeltaPt.cxx
PWGJE/EMCALJetTasks/AliAnalysisTaskDeltaPt.h
PWGJE/EMCALJetTasks/AliEmcalJetTask.cxx
PWGJE/EMCALJetTasks/AliJetContainer.cxx
PWGJE/EMCALJetTasks/AliJetContainer.h
PWGJE/EMCALJetTasks/AliJetModelBaseTask.h
PWGJE/EMCALJetTasks/AliJetResponseMaker.cxx
PWGJE/EMCALJetTasks/AliJetResponseMaker.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskDijetHadron.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskDijetHadron.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalQGTagging.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.h
PWGJE/EMCALJetTasks/macros/AddTaskDijetHadron.C
PWGJE/FlavourJetTasks/AliAnalysisTaskEmcalJetHF.cxx
PWGLF/RESONANCES/macros/mini/ConfigD0.C
PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStar.C
PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarMC.C
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysisPbPbAOD.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskV2AllChAOD.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.h
PWGLF/STRANGENESS/Cascades/AliAnalysisTaskStrangenessVsMultiplicityMC.cxx
PWGLF/STRANGENESS/Cascades/AliAnalysisTaskStrangenessVsMultiplicityMC.h
PWGLF/STRANGENESS/Correlations/AliAnalysisTaskLambdaOverK0sJets.cxx
PWGPP/CMakelibPWGPP.pkg
PWGPP/CMakelibPWGPPMUONdep.pkg
PWGPP/CalibMacros/CPass0/makeOCDB.C
PWGPP/CalibMacros/CPass0/mergeMakeOCDB.byComponent.sh
PWGPP/CalibMacros/CPass1/AddTOFAnalysisTaskCalibTree.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/makeOCDB.C
PWGPP/CalibMacros/CPass1/mergeMakeOCDB.byComponent.sh
PWGPP/MUON/dep/AliAnalysisTaskMuonFakes.cxx
PWGPP/MUON/lite/MakeTrend.C
PWGPP/QA/detectorQAscripts/MU.sh
PWGPP/QA/detectorQAscripts/V0.sh [new file with mode: 0755]
PWGPP/QA/scripts/alienSync.conf
PWGPP/QA/scripts/runQA.sh
PWGPP/TOF/trending/localMergeFiles.C [new file with mode: 0644]
PWGPP/VZERO/trending/DrawTrendingV0QA.C [new file with mode: 0755]
PWGPP/VZERO/trending/MakeTrendingV0QA.C [new file with mode: 0755]
PWGPP/analysisQA/README
PWGPP/analysisQA/processDrawAnaCaloTrackQA.C
PWGPP/analysisQA/processFemtoQA.C [new file with mode: 0644]
PWGPP/pid/AliAnalysisTaskK0sBayes.cxx
PWGPP/pid/AliAnalysisTaskLambdaBayes.cxx
PWGPP/pid/AliAnalysisTaskPhiBayes.cxx
PWGPP/pid/doeffKa.C
PWGPP/pid/doeffPi.C
PWGPP/pid/doeffPr.C
PWGUD/DIFFRACTIVE/QA/AddTaskCPQA.C [new file with mode: 0755]
PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.cxx [new file with mode: 0755]
PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.h [new file with mode: 0755]
PWGUD/UPC/AliAnalysisTaskUpcPsi2s.cxx
PWGUD/UPC/AliAnalysisTaskUpcPsi2s.h
PYTHIA6/AliDecayerPythia.cxx
RAW/AliRawEventHeaderBase.cxx
RAW/AliRawReaderDate.cxx
RAW/AliRawReaderDate.h
RAW/dateStream.cxx
STARLIGHT/AliGenStarLight.cxx
STARLIGHT/AliGenStarLight.h
STARLIGHT/AliStarLightLinkDef.h
STARLIGHT/CMakelibStarLight.pkg
STARLIGHT/starlight/CMakeLists.txt
STARLIGHT/starlight/Makefile
STARLIGHT/starlight/Readme
STARLIGHT/starlight/TStarLight/testsl.C
STARLIGHT/starlight/cmake_modules/FindROOT.cmake
STARLIGHT/starlight/config/slight.in
STARLIGHT/starlight/include/inputParameters.h
STARLIGHT/starlight/include/randomgenerator.h
STARLIGHT/starlight/src/gammaavm.cpp
STARLIGHT/starlight/src/gammagammaleptonpair.cpp
STARLIGHT/starlight/src/inputParameters.cpp
STARLIGHT/starlight/src/randomgenerator.cpp
STARLIGHT/starlight/src/starlight.cpp
STARLIGHT/starlight/utils/ana.C
STARLIGHT/starlight/utils/convertStarlightAsciiToTree.C
STARLIGHT/test/Config.C
STEER/AOD/AliAODZDC.cxx
STEER/ESD/AliESDZDC.h
STEER/STEER/AliReconstruction.cxx
STEER/STEERBase/AliPIDCombined.cxx
STEER/STEERBase/AliPIDResponse.cxx
STEER/STEERBase/AliTOFPIDResponse.cxx
STEER/STEERBase/AliTOFPIDResponse.h
TOF/AddTOFAnalysisTaskCalibTree.C
TOF/AliTOFAnalysisTaskCalibTree.cxx
TOF/AliTOFAnalysisTaskCalibTree.h
TRD/CMakelibTRDbase.pkg
VZERO/AliVZERODigitizer.cxx
ZDC/AliZDCDigitizer.cxx
ZDC/AliZDCQADataMakerRec.cxx
ZDC/AliZDCRawStream.cxx
ZDC/AliZDCReconstructor.cxx
ZDC/AliZDCTriggerProcessor.cxx
ZDC/CMakeLists.txt
cmake/CMakemacosx64.cmake

index 4d031269629eccebae6d2f293d98ec738b4c7257..cfad82fb723a9378e3573e8147ba77e09c2a6501 100644 (file)
@@ -58,8 +58,16 @@ fIntegrator(integrator)
   if (labels)
     for(Int_t iTrack = 0; iTrack < 3; ++iTrack) fTracks[iTrack] = labels[iTrack];
 }
-
-
+//__________________________________________________________________________
+Bool_t AliADdigit::GetIntegratorFlag(Int_t clock)
+{
+if (clock >= 0 && clock < kNClocks){
+       if(clock%2 == 0) return fIntegrator;
+       else return !fIntegrator;
+       }
+       
+else return kFALSE;
+}
 //__________________________________________________________________________
 void AliADdigit::Print(const Option_t*) const
 {
index ab567881b8559327ad150f3577ee73269abc7ec9..38a61a1de5ca4b55f52743f8335e92f7ce2ff015 100644 (file)
@@ -27,6 +27,7 @@ public:
     Float_t Width()      const {return fWidth;} 
     Bool_t  Integrator() const {return fIntegrator;}
     Short_t ChargeADC(Int_t clock) const {return (clock >= 0 && clock < kNClocks) ? fChargeADC[clock] : 0;}
+    Bool_t  GetIntegratorFlag(Int_t clock);
     
   protected:
     Int_t   fPMNumber;      // PhotoMultiplier number (0 to 16)
index fc6e185dc2441c3dc8f8f934face92457f2c713c..5df8b5384278784eb5f2bdf5d3c507a3c0fa5de1 100644 (file)
@@ -132,36 +132,36 @@ using std::endl;
 ClassImp(AliPhysicsSelection)
 
 AliPhysicsSelection::AliPhysicsSelection() :
-  AliAnalysisCuts("AliPhysicsSelection", "AliPhysicsSelection"),
-  fPassName(""),
-  fCurrentRun(-1),
-  fMC(kFALSE),
-  fCollTrigClasses(),
-  fBGTrigClasses(),
-  fTriggerAnalysis(),
+AliAnalysisCuts("AliPhysicsSelection", "AliPhysicsSelection"),
+fPassName(""),
+fCurrentRun(-1),
+fMC(kFALSE),
+fCollTrigClasses(),
+fBGTrigClasses(),
+fTriggerAnalysis(),
 //  fHistStatisticsTokens(0),
-  fHistBunchCrossing(0),
-  fHistTriggerPattern(0),
-  fSkipTriggerClassSelection(0),
-  fUsingCustomClasses(0),
-  fSkipV0(0),
-  fBIFactorA(-1),
-  fBIFactorC(-1),
-  fBIFactorAC(-1), 
-  fComputeBG(0),
-  fBGStatOffset(-1),
-  fUseBXNumbers(1),
-  fUseMuonTriggers(0),
-  fFillingScheme(""),
-  fBin0CallBack(""),
-  fBin0CallBackPointer(0),
-  fIsPP(kFALSE),
-  fPSOADB(0),
-  fFillOADB(0),
-  fTriggerOADB(0),
-  fRegexp(0),
-  fCashedTokens(0)
-  
+fHistBunchCrossing(0),
+fHistTriggerPattern(0),
+fSkipTriggerClassSelection(0),
+fUsingCustomClasses(0),
+fSkipV0(0),
+fBIFactorA(-1),
+fBIFactorC(-1),
+fBIFactorAC(-1), 
+fComputeBG(0),
+fBGStatOffset(-1),
+fUseBXNumbers(1),
+fUseMuonTriggers(0),
+fFillingScheme(""),
+fBin0CallBack(""),
+fBin0CallBackPointer(0),
+fIsPP(kFALSE),
+fPSOADB(0),
+fFillOADB(0),
+fTriggerOADB(0),
+fRegexp(0),
+fCashedTokens(0)
+
 {
   // constructor
   
@@ -177,15 +177,15 @@ AliPhysicsSelection::AliPhysicsSelection() :
   
   AliLog::SetClassDebugLevel("AliPhysicsSelection", AliLog::kWarning);
 }
-    
+
 AliPhysicsSelection::~AliPhysicsSelection()
 {
   // destructor
-
+  
   fCollTrigClasses.Delete();
   fBGTrigClasses.Delete();
   fTriggerAnalysis.Delete();
-
+  
   if (fHistStatistics[0])
   {
     delete fHistStatistics[0];
@@ -210,7 +210,7 @@ AliPhysicsSelection::~AliPhysicsSelection()
     delete fHistTriggerPattern;
     fHistTriggerPattern = 0;
   }
-
+  
   if (fPSOADB)
   { 
     delete fPSOADB;
@@ -232,14 +232,14 @@ AliPhysicsSelection::~AliPhysicsSelection()
     delete fRegexp;
     fRegexp = 0;
   }
-    
+  
   if (fCashedTokens)
   {
     delete fCashedTokens;
     fCashedTokens = 0;
   }
-
-
+  
+  
 }
 
 UInt_t AliPhysicsSelection::CheckTriggerClass(const AliESDEvent* aEsd, const char* trigger, Int_t& triggerLogic) const
@@ -302,7 +302,7 @@ UInt_t AliPhysicsSelection::CheckTriggerClass(const AliESDEvent* aEsd, const cha
     else if (str2[0] == '#')
     {
       foundBCRequirement = kTRUE;
-    
+      
       str2.Remove(0, 1);
       
       Int_t bcNumber = str2.Atoi();
@@ -341,14 +341,14 @@ UInt_t AliPhysicsSelection::CheckTriggerClass(const AliESDEvent* aEsd, const cha
 //______________________________________________________________________________
 TObject *AliPhysicsSelection::GetStatistics(const Option_t *option) const
 {
-// Get the statistics histograms ("ALL" and "BIN0" and "TOK")
-   TString opt(option);
-   opt.ToUpper();
-   Int_t ihist = 0;
-   if (opt == "ALL") ihist = kStatIdxAll;
-   if (opt == "BIN0") ihist = kStatIdxBin0;
-   //   if (opt == "TOK") return fHistStatisticsTokens;
-   return fHistStatistics[ihist];
+  // Get the statistics histograms ("ALL" and "BIN0" and "TOK")
+  TString opt(option);
+  opt.ToUpper();
+  Int_t ihist = 0;
+  if (opt == "ALL") ihist = kStatIdxAll;
+  if (opt == "BIN0") ihist = kStatIdxBin0;
+  //   if (opt == "TOK") return fHistStatisticsTokens;
+  return fHistStatistics[ihist];
 }   
 
 //______________________________________________________________________________
@@ -367,10 +367,10 @@ Bool_t AliPhysicsSelection::EvaluateTriggerLogic(const AliESDEvent* aEsd, AliTri
     
     TArrayI pos;
     Int_t nMatches = fRegexp->Match(trigger, "", 0, 2, &pos);
-
+    
     if (nMatches <= 0)
       break;
-      
+    
     TString token(trigger(pos[0], pos[1]-pos[0]+1));
     
     TParameter<Int_t>* param = (TParameter<Int_t>*) fCashedTokens->FindObject(token);
@@ -399,7 +399,7 @@ Bool_t AliPhysicsSelection::EvaluateTriggerLogic(const AliESDEvent* aEsd, AliTri
       //      if(fHistStatisticsTokens)              
     }
   }
-
+  
   TFormula formula("formula", trigger);
   if (formula.Compile() > 0)
     AliFatal(Form("Could not evaluate trigger logic %s (evaluated to %s)", triggerLogic, trigger.Data()));
@@ -423,7 +423,7 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
   } 
   mgr->LoadBranch("AliESDHeader.");
   mgr->LoadBranch("AliESDRun.");
-
+  
   if (fCurrentRun != aEsd->GetRunNumber()) {
     if (!Initialize(aEsd))
       AliFatal(Form("Could not initialize for run %d", aEsd->GetRunNumber()));
@@ -449,7 +449,7 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
   }
   
   mgr->LoadBranch("AliMultiplicity.");
-//mgr->LoadBranch("AliESDFMD.");
+  //mgr->LoadBranch("AliESDFMD.");
   mgr->LoadBranch("AliESDVZERO.");
   mgr->LoadBranch("AliESDZDC.");
   mgr->LoadBranch("SPDVertex.");
@@ -457,9 +457,9 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
   mgr->LoadBranch("TPCVertex.");
   mgr->LoadBranch("Tracks");
   mgr->LoadBranch("SPDPileupVertices");
-
+  
   UInt_t accept = 0;
-    
+  
   Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries();
   for (Int_t i=0; i < count; i++)
   {
@@ -468,11 +468,11 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       triggerClass = ((TObjString*) fCollTrigClasses.At(i))->String();
     else
       triggerClass = ((TObjString*) fBGTrigClasses.At(i - fCollTrigClasses.GetEntries()))->String();
-  
+    
     AliDebug(AliLog::kDebug+1, Form("Processing trigger class %s", triggerClass));
-  
+    
     AliTriggerAnalysis* triggerAnalysis = static_cast<AliTriggerAnalysis*> (fTriggerAnalysis.At(i));
-  
+    
     triggerAnalysis->FillTriggerClasses(aEsd);
     
     Int_t triggerLogic = 0; 
@@ -481,12 +481,12 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
     if (singleTriggerResult)
     {
       triggerAnalysis->FillHistograms(aEsd);
-  
+      
       Bool_t isBin0 = kFALSE;
       if (fBin0CallBack != "") {
-         isBin0 = ((AliAnalysisTaskSE*)mgr->GetTask(fBin0CallBack.Data()))->IsEventInBinZero();
+        isBin0 = ((AliAnalysisTaskSE*)mgr->GetTask(fBin0CallBack.Data()))->IsEventInBinZero();
       } else if (fBin0CallBackPointer) {
-         isBin0 = (*fBin0CallBackPointer)(aEsd);
+        isBin0 = (*fBin0CallBackPointer)(aEsd);
       }
       
       // ---->
@@ -494,10 +494,10 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       // tables. Decide wethere we are switching to a new stat table
       // (with all AliTriggerAnalysis tokens? Only we the tokens
       // actually used in the selection?) and clean up
-
+      
       AliESDVZERO *esdV0 = aEsd->GetVZEROData();
       if(!esdV0) fSkipV0 = kTRUE;
-
+      
       // hardware trigger
       Int_t fastORHW   = triggerAnalysis->EvaluateTrigger(aEsd, AliTriggerAnalysis::kSPDGFO); // SPD number of chips from trigger bits (!)
       //      Int_t fastORHWL1 = triggerAnalysis->EvaluateTrigger(aEsd, AliTriggerAnalysis::kSPDGFOL1); // SPD number of chips from trigger bits in second layer (!)
@@ -515,12 +515,12 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       Bool_t t0       = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kT0    ));
       Bool_t t0BG     = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kT0BG    ));
       Bool_t t0PileUp = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kT0Pileup));
-
+      
       // fmd
       // Bool_t fmdA = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kFMDA));
       // Bool_t fmdC = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kFMDC));
       // Bool_t fmd  = fmdA || fmdC;
-    
+      
       // SSD
       //Int_t ssdClusters = triggerAnalysis->SSDClusters(aEsd);
       
@@ -532,14 +532,14 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       Bool_t zdcTime = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kZDCTime));
       Bool_t znABG   = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kZNABG));
       Bool_t znCBG   = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kZNCBG));
-
+      
       Bool_t laserCut = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kTPCLaserWarmUp));
       Bool_t hvDipCut = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kTPCHVdip));
-
+      
       // Some "macros"
       Bool_t mb1 = (fastOROffline > 0 || v0A || v0C) && (!v0BG);
       Bool_t mb1prime = (fastOROffline > 1 || (fastOROffline > 0 && (v0A || v0C)) || (v0A && v0C) ) && (!v0BG);
-
+      
       // Background rejection
       Bool_t bgID = kFALSE;
       bgID = triggerAnalysis->EvaluateTrigger(aEsd,  (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kSPDClsVsTrkBG | AliTriggerAnalysis::kOfflineFlag)); // FIXME: temporarily, we keep both ways to validate the new one. if the external BG id is not set, it will use the new one
@@ -549,17 +549,17 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       if(v0C)              ntrig += 1; //v0C alone is enough
       if(fmd)              ntrig += 1;
       if(ssdClusters>1)    ntrig += 1;*/
-
+      
       // // EMCAL offline trigger validation
       // Bool_t emcCut = triggerAnalysis->EvaluateTrigger(aEsd, (AliTriggerAnalysis::Trigger) (AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kEMCAL));
       
       // <---
-
+      
       TString triggerLogicOnline  = fPSOADB->GetHardwareTrigger(triggerLogic);
       TString triggerLogicOffline = fPSOADB->GetOfflineTrigger(triggerLogic);
-
+      
       AliDebug(AliLog::kDebug, Form("Triggers from OADB [0x%x][%d][%s][%s]",singleTriggerResult,AliOADBPhysicsSelection::GetActiveBit(singleTriggerResult),triggerLogicOffline.Data(),triggerLogicOnline.Data()));
-
+      
       // replay hardware trigger (should only remove events for MC)
       Bool_t onlineTrigger  = EvaluateTriggerLogic(aEsd, triggerAnalysis, triggerLogicOnline, kFALSE);
       // offline selection
@@ -567,124 +567,79 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
       
       // Printf("%s %s", triggerLogicOnline.Data(), triggerLogicOffline.Data());
       // Printf("%d %d", onlineTrigger, offlineTrigger);
-          
-
+      
+      
       // Fill trigger pattern histo
       Int_t tpatt = 0;
       if (fastORHW>0) tpatt+=1;
       if (v0AHW)      tpatt+=2;
       if (v0CHW)      tpatt+=4;
       fHistTriggerPattern->Fill( tpatt );
-
+      
       // fill statistics and return decision
       const Int_t nHistStat = 2;
       for(Int_t iHistStat = 0; iHistStat < nHistStat; iHistStat++){
-       if (iHistStat == kStatIdxBin0 && !isBin0) continue; // skip the filling of bin0 stats if the event is not in the bin0
-      
-       fHistStatistics[iHistStat]->Fill(kStatTriggerClass, i);
-       if(iHistStat == kStatIdxAll) fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i); // Fill only for all (avoid double counting)
-
-       // We fill the rest only if hw trigger is ok
-       if (!onlineTrigger)
-         {
-           AliDebug(AliLog::kDebug, "Rejecting event because hardware trigger is not fired");
-           continue;
-         } else {       
-         fHistStatistics[iHistStat]->Fill(kStatHWTrig, i);
-       }
-      
-
-       // v0 BG stats
-       if (v0ABG)
-         fHistStatistics[iHistStat]->Fill(kStatV0ABG, i);
-       if (v0CBG)
-         fHistStatistics[iHistStat]->Fill(kStatV0CBG, i);
-
-       // T0 stats
-       if(t0)
-         fHistStatistics[iHistStat]->Fill(kStatT0BB,     i);
-       if(t0BG)
-         fHistStatistics[iHistStat]->Fill(kStatT0BG,     i);
-       if(t0PileUp)
-         fHistStatistics[iHistStat]->Fill(kStatT0PileUp, i);
-
-       // mb 1
-       if (mb1)
-         fHistStatistics[iHistStat]->Fill(kStatMB1, i);
-
-       if (mb1prime)
-         fHistStatistics[iHistStat]->Fill(kStatMB1Prime, i);
-
-       if (laserCut)
-         fHistStatistics[iHistStat]->Fill(kStatLaserCut, i);
-
-       if (hvDipCut)
-         fHistStatistics[iHistStat]->Fill(kHVdipCut, i);
-
-       //if(ntrig >= 2 && !v0BG) 
-       //  fHistStatistics[iHistStat]->Fill(kStatAny2Hits, i);
-
-       if (fastOROffline > 0)
-         fHistStatistics[iHistStat]->Fill(kStatFO1, i);
-       if (fastOROffline > 1)
-         fHistStatistics[iHistStat]->Fill(kStatFO2, i);
-       if (fastOROfflineL1 > 1)
-         fHistStatistics[iHistStat]->Fill(kStatFO2L1, i);
+        if (iHistStat == kStatIdxBin0 && !isBin0) continue; // skip the filling of bin0 stats if the event is not in the bin0
         
-       if (v0A)
-         fHistStatistics[iHistStat]->Fill(kStatV0A, i);
-       if (v0C)
-         fHistStatistics[iHistStat]->Fill(kStatV0C, i);
-         
-       if (zdcA)
-         fHistStatistics[iHistStat]->Fill(kStatZDCA, i);
-       if (zdcC)
-         fHistStatistics[iHistStat]->Fill(kStatZDCC, i);
-       if (zdcA && zdcC)
-         fHistStatistics[iHistStat]->Fill(kStatZDCAC, i);
-
-       if (zdcTime)
-         fHistStatistics[iHistStat]->Fill(kStatZDCTime, i);
-       if (znABG)
-         fHistStatistics[iHistStat]->Fill(kStatZNABG, i);
-       if (znCBG)
-         fHistStatistics[iHistStat]->Fill(kStatZNCBG, i);
-  
-       if (v0A && v0C && !v0BG && (!bgID && fIsPP))
-         fHistStatistics[iHistStat]->Fill(kStatV0, i);
-
-       if (v0A && v0C && !v0BG && (!bgID && fIsPP) && !znABG && !znCBG)
-         fHistStatistics[iHistStat]->Fill(kStatV0ZN, i);
-
-       if (bgID && !v0BG) 
-         fHistStatistics[iHistStat]->Fill(kStatBG, i);
-
-       // FIXME: check lines below
-       if ( offlineTrigger )
-         {
-           if (!v0BG || fSkipV0)
-             {
-               if (!v0BG) fHistStatistics[iHistStat]->Fill(kStatOffline, i);
-               AliDebug(AliLog::kDebug, Form("Accepted event for histograms with trigger logic %d", triggerLogic));
+        fHistStatistics[iHistStat]->Fill(kStatTriggerClass, i);
+        if(iHistStat == kStatIdxAll) fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i); // Fill only for all (avoid double counting)
+        
+        // We fill the rest only if hw trigger is ok
+        if (!onlineTrigger) {
+          AliDebug(AliLog::kDebug, "Rejecting event because hardware trigger is not fired");
+          continue;
+        } else {
+          fHistStatistics[iHistStat]->Fill(kStatHWTrig, i);
+        }
+        
+        if (v0ABG)               fHistStatistics[iHistStat]->Fill(kStatV0ABG, i);
+        if (v0CBG)               fHistStatistics[iHistStat]->Fill(kStatV0CBG, i);
+        if (t0)                  fHistStatistics[iHistStat]->Fill(kStatT0BB,     i);
+        if (t0BG)                fHistStatistics[iHistStat]->Fill(kStatT0BG,     i);
+        if (t0PileUp)            fHistStatistics[iHistStat]->Fill(kStatT0PileUp, i);
+        if (mb1)                 fHistStatistics[iHistStat]->Fill(kStatMB1, i);
+        if (mb1prime)            fHistStatistics[iHistStat]->Fill(kStatMB1Prime, i);
+        if (laserCut)            fHistStatistics[iHistStat]->Fill(kStatLaserCut, i);
+        if (hvDipCut)            fHistStatistics[iHistStat]->Fill(kHVdipCut, i);
+        if (fastOROffline > 0)   fHistStatistics[iHistStat]->Fill(kStatFO1, i);
+        if (fastOROffline > 1)   fHistStatistics[iHistStat]->Fill(kStatFO2, i);
+        if (fastOROfflineL1 > 1) fHistStatistics[iHistStat]->Fill(kStatFO2L1, i);
+        if (v0A)                 fHistStatistics[iHistStat]->Fill(kStatV0A, i);
+        if (v0C)                 fHistStatistics[iHistStat]->Fill(kStatV0C, i);
+        if (zdcA)                fHistStatistics[iHistStat]->Fill(kStatZDCA, i);
+        if (zdcC)                fHistStatistics[iHistStat]->Fill(kStatZDCC, i);
+        if (zdcA && zdcC)        fHistStatistics[iHistStat]->Fill(kStatZDCAC, i);
+        if (zdcTime)             fHistStatistics[iHistStat]->Fill(kStatZDCTime, i);
+        if (znABG)               fHistStatistics[iHistStat]->Fill(kStatZNABG, i);
+        if (znCBG)               fHistStatistics[iHistStat]->Fill(kStatZNCBG, i);
+        if (bgID && !v0BG)       fHistStatistics[iHistStat]->Fill(kStatBG, i);
+        if (v0A && v0C && !v0BG && (!bgID && fIsPP)) fHistStatistics[iHistStat]->Fill(kStatV0, i);
+        if (v0A && v0C && !v0BG && (!bgID && fIsPP) && !znABG && !znCBG) fHistStatistics[iHistStat]->Fill(kStatV0ZN, i);
+        
+        // FIXME: check lines below
+        if ( offlineTrigger ) {
+          if (!v0BG || fSkipV0) {
+            if (!v0BG) fHistStatistics[iHistStat]->Fill(kStatOffline, i);
+            AliDebug(AliLog::kDebug, Form("Accepted event for histograms with trigger logic %d", triggerLogic));
+            
+            fHistStatistics[iHistStat]->Fill(kStatAccepted, i);
+            
+            if (aEsd->IsPileupFromSPD())
+              fHistStatistics[iHistStat]->Fill(kStatAcceptedPileUp, i);
             
-               fHistStatistics[iHistStat]->Fill(kStatAccepted, i);
-               
-               if (aEsd->IsPileupFromSPD())
-                 fHistStatistics[iHistStat]->Fill(kStatAcceptedPileUp, i);
-               
-                   // if(iHistStat == kStatIdxAll) fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i); // Fill only for all (avoid double counting)
-               if((i < fCollTrigClasses.GetEntries() || fSkipTriggerClassSelection) && (iHistStat==kStatIdxAll))
-                 accept |= singleTriggerResult; // only set for "all" (should not really matter)
-             }
-           else
-             AliDebug(AliLog::kDebug, "Rejecting event because of V0 BG flag");
-         }
-       else
-         AliDebug(AliLog::kDebug, Form("Rejecting event because trigger logic %d is not fulfilled", triggerLogic));
+            // if(iHistStat == kStatIdxAll) fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i); // Fill only for all (avoid double counting)
+            if((i < fCollTrigClasses.GetEntries() || fSkipTriggerClassSelection) && (iHistStat==kStatIdxAll))
+              accept |= singleTriggerResult; // only set for "all" (should not really matter)
+          }
+          else
+            AliDebug(AliLog::kDebug, "Rejecting event because of V0 BG flag");
+        }
+        else
+          AliDebug(AliLog::kDebug, Form("Rejecting event because trigger logic %d is not fulfilled", triggerLogic));
       }
     }
   }
+  
   if (accept)
     AliDebug(AliLog::kDebug, Form("Accepted event as collision candidate with bit mask %d", accept));
   
@@ -848,7 +803,7 @@ UInt_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd)
 //     else if (!strcmp("CINT1C-ABCE-NOPF-ALL",trigger)) return "   #3019  #3119  #3219  #3319  #3519 ";
 //     else if (!strcmp("CINT1-E-NOPF-ALL",trigger)) return " #1835 #2726";
 //     //    else AliError(Form("Unknown trigger: %s", trigger));
-    
+
 //   } 
 //   else if (runNumber >= 130148 && runNumber <= 130375) {
 //     TString triggerString = trigger;
@@ -887,25 +842,25 @@ Bool_t AliPhysicsSelection::Initialize(const AliESDEvent* aEsd)
   fIsPP = kTRUE;
   if (strcmp(aEsd->GetESDRun()->GetBeamType(), "A-A") == 0)
     fIsPP = kFALSE;
-
+  
   return Initialize(aEsd->GetRunNumber());
 }
 
 Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
 {
   // initializes the object for the given run  
-
-
+  
+  
   Bool_t oldStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
-
+  
   /// Open OADB file and fetch OADB objects
   TString oadbfilename = AliPhysicsSelection::GetOADBFileName();
-
+  
   TFile * foadb = TFile::Open(oadbfilename);
   if(!foadb->IsOpen()) AliFatal(Form("Cannot open OADB file %s", oadbfilename.Data()));
-
-
+  
+  
   if(!fPSOADB || !fUsingCustomClasses) { // if it's already set and custom class is required, we use the one provided by the user
     AliInfo("Using Standard OADB");
     AliOADBContainer * psContainer = (AliOADBContainer*) foadb->Get("physSel");
@@ -928,17 +883,17 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
     fTriggerOADB->Print();
     if (!fTriggerOADB) AliFatal(Form("Cannot find  trigger analysis object for run %d", runNumber));
   }
-
+  
   
   if(!fBin0CallBack) 
     AliError("Bin0 Callback not set: will not fill the statistics for the bin 0");
-
+  
   if (fMC) {
     // override BX and bg options in case of MC
     fComputeBG    = kFALSE;
     fUseBXNumbers = kFALSE;
   }
-
+  
   // FIXME: think how to implement this check with the OADB, trigger scheme is not a int number here 
   // Int_t triggerScheme = GetTriggerScheme(runNumber);
   // if (!fUsingCustomClasses && fCurrentRun != -1 && triggerScheme != GetTriggerScheme(fCurrentRun))
@@ -946,15 +901,15 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
   
   if(fComputeBG && fCurrentRun != -1 && fCurrentRun != runNumber) 
     AliFatal("Cannot process several runs because BG computation is requested");
-
+  
   if(fComputeBG && !fUseBXNumbers) 
     AliFatal("Cannot compute BG if BX numbers are not used");
   
   if(fUseBXNumbers && fFillingScheme != "" && fFillingScheme != fFillOADB->GetFillingSchemeName())
     AliFatal("Cannot process runs with different filling scheme if usage of BX numbers is requested");
-
+  
   fFillingScheme      = fFillOADB->GetFillingSchemeName();
-
+  
   AliInfo(Form("Initializing for run %d", runNumber));
   
   // initialize first time?
@@ -967,20 +922,20 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
       TIterator * bgIter   = fPSOADB->GetBGTrigClass(ibit)->MakeIterator();
       TObjString * obj = 0;
       while((obj = (TObjString*) collIter->Next())){
-       if (obj->String() != "") {
-         fCollTrigClasses.Add(new TObjString(GetTriggerString(obj)));
-       }
+        if (obj->String() != "") {
+          fCollTrigClasses.Add(new TObjString(GetTriggerString(obj)));
+        }
       }
       // BG classes only make sense for real data
       if(!fMC) {
-       obj = 0 ;
-       while((obj = (TObjString*) bgIter->Next())){
-         if (obj->String() != "") {
-           fBGTrigClasses.Add(new TObjString(GetTriggerString(obj)));
-         }
-       }
+        obj = 0 ;
+        while((obj = (TObjString*) bgIter->Next())){
+          if (obj->String() != "") {
+            fBGTrigClasses.Add(new TObjString(GetTriggerString(obj)));
+          }
+        }
       }
-
+      
     }
     // not sure how to handle this in the case of > x cuts
     // // Book the token histo with the tokens actually used here!
@@ -994,23 +949,23 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
     //         Int_t ntokens = fCashedTokens->GetEntries();
     //         Int_t count = fCollTrigClasses->GetEntries() + fBGTrigClasses->GetEntries();
     //         fHistStatisticsTokens = new TH2F("fHistStatisticsTokens", "fHistStatisticsTokens", ntokens + 2, 0.5, ntokens+2+0.5, count, -0.5, -0.5 + count);
-       
+    
     //         Int_t nrow = 0;
     //         fHistStatisticsTokens->GetXaxis()->SetBinLabel(nrow++,  "Trigger class");
     //         for(Int_t itoken = 0; itoken < ntoken; itoken++){
     //           TParameter<Int_t> * param = fCashedTokens->At(itoken);
     //           fHistStatisticsTokens->GetXaxis()->SetBinLabel(nrow++,  param->GetName());      
     //         }
-       
+    
     //         fHistStatisticsTokens->GetXaxis()->SetBinLabel(nrow++,      "Accepted");
-
+    
     // }
-
+    
     
     
     // TODO: 
     // Add a new statistics histo containing only the tokens actually used in the selection
-
+    
     Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries();
     
     for (Int_t i=0; i<count; i++)
@@ -1022,30 +977,30 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
       triggerAnalysis->SetSPDGFOThreshhold(1);
       triggerAnalysis->SetDoFMD(kFALSE);
       triggerAnalysis->SetCorrZDCCutParams(fTriggerOADB->GetZDCCutRefSumCorr(),
-                                          fTriggerOADB->GetZDCCutRefDeltaCorr(), 
-                                          fTriggerOADB->GetZDCCutSigmaSumCorr(),
-                                          fTriggerOADB->GetZDCCutSigmaDeltaCorr());
+          fTriggerOADB->GetZDCCutRefDeltaCorr(), 
+          fTriggerOADB->GetZDCCutSigmaSumCorr(),
+          fTriggerOADB->GetZDCCutSigmaDeltaCorr());
       triggerAnalysis->SetZNCorrCutParams(fTriggerOADB->GetZDCCutZNATimeCorrMin(),fTriggerOADB->GetZDCCutZNATimeCorrMax(),
-                                         fTriggerOADB->GetZDCCutZNCTimeCorrMin(),fTriggerOADB->GetZDCCutZNCTimeCorrMax());
+          fTriggerOADB->GetZDCCutZNCTimeCorrMin(),fTriggerOADB->GetZDCCutZNCTimeCorrMax());
       fTriggerAnalysis.Add(triggerAnalysis);
     }
-
+    
     
     // TODO: shall I really delete this?
     if (fHistStatistics[0])
       delete fHistStatistics[0];
     if (fHistStatistics[1])
       delete fHistStatistics[1];
-  
+    
     fHistStatistics[kStatIdxBin0] = BookHistStatistics("_Bin0");
     fHistStatistics[kStatIdxAll]  = BookHistStatistics("");
     
-
+    
     if (fHistBunchCrossing)
       delete fHistBunchCrossing;
-  
+    
     fHistBunchCrossing = new TH2F("fHistBunchCrossing", "fHistBunchCrossing;bunch crossing number;", 4000, -0.5, 3999.5,  count, -0.5, -0.5 + count);
-
+    
     // TODO: remove fHistTriggerPattern
     if (fHistTriggerPattern)
       delete fHistTriggerPattern;
@@ -1053,9 +1008,9 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
     const int ntrig=3;
     Int_t n = 1;
     const Int_t nbinTrig = TMath::Nint(TMath::Power(2,ntrig));
-
+    
     fHistTriggerPattern = new TH1F("fHistTriggerPattern", "Trigger pattern: FO + 2*v0A + 4*v0C", 
-                                  nbinTrig, -0.5, nbinTrig-0.5);    
+        nbinTrig, -0.5, nbinTrig-0.5);    
     fHistTriggerPattern->GetXaxis()->SetBinLabel(1,"NO TRIG");
     fHistTriggerPattern->GetXaxis()->SetBinLabel(2,"FO");
     fHistTriggerPattern->GetXaxis()->SetBinLabel(3,"v0A");
@@ -1064,8 +1019,8 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
     fHistTriggerPattern->GetXaxis()->SetBinLabel(6,"FO & v0C");
     fHistTriggerPattern->GetXaxis()->SetBinLabel(7,"v0A & v0C");
     fHistTriggerPattern->GetXaxis()->SetBinLabel(8,"FO & v0A & v0C");
-
-  
+    
+    
     n = 1;
     for (Int_t i=0; i < fCollTrigClasses.GetEntries(); i++)
     {
@@ -1079,31 +1034,31 @@ Bool_t AliPhysicsSelection::Initialize(Int_t runNumber)
       fHistBunchCrossing->GetYaxis()->SetBinLabel(n, ((TObjString*) fBGTrigClasses.At(i))->String());
       n++;
     }
-
     
-
-  }
     
+    
+  }
+  
   Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries();
   for (Int_t i=0; i<count; i++)
   {
     
     AliTriggerAnalysis* triggerAnalysis = static_cast<AliTriggerAnalysis*> (fTriggerAnalysis.At(i));
-  
+    
     switch (runNumber)
     {
-      case 104315:
-      case 104316:
-      case 104320:
-      case 104321:
-      case 104439:
-        triggerAnalysis->SetV0TimeOffset(7.5);
-        break;
-      default:
-        triggerAnalysis->SetV0TimeOffset(0);
+    case 104315:
+    case 104316:
+    case 104320:
+    case 104321:
+    case 104439:
+      triggerAnalysis->SetV0TimeOffset(7.5);
+      break;
+    default:
+      triggerAnalysis->SetV0TimeOffset(0);
     }
   }
-    
+  
   fCurrentRun = runNumber;
   
   TH1::AddDirectory(oldStatus);
@@ -1117,7 +1072,7 @@ TH2F * AliPhysicsSelection::BookHistStatistics(const char * tag) {
   // BG and the ratio of BG and accidentals to total +ratio goot to
   // first col + 2 for error on good.
   // TODO: Remember the the indexes of rows for the BG selection. Add new member fBGRows[] and use kStat as indexes
-
+  
   Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries();
 #ifdef VERBOSE_STAT
   Int_t extrarows = fComputeBG != 0 ? 11 : 0;
@@ -1125,7 +1080,7 @@ TH2F * AliPhysicsSelection::BookHistStatistics(const char * tag) {
   Int_t extrarows = fComputeBG != 0 ? 6 : 0;
 #endif
   TH2F * h = new TH2F(Form("fHistStatistics%s",tag), Form("fHistStatistics - %s ;;",tag), kStatAccepted, 0.5, kStatAccepted+0.5, count+extrarows, -0.5, -0.5 + count+extrarows);
-
+  
   h->GetXaxis()->SetBinLabel(kStatTriggerClass,  "Trigger class");
   h->GetXaxis()->SetBinLabel(kStatHWTrig,       "Hardware trigger");
   h->GetXaxis()->SetBinLabel(kStatFO1,          "FO >= 1");
@@ -1156,20 +1111,20 @@ TH2F * AliPhysicsSelection::BookHistStatistics(const char * tag) {
   h->GetXaxis()->SetBinLabel(kStatBG,           "Background identification");
   h->GetXaxis()->SetBinLabel(kStatAcceptedPileUp, "Pile up (in accepted)");
   h->GetXaxis()->SetBinLabel(kStatAccepted,      "Accepted");
-
-
+  
+  
   Int_t n = 1;
   for (Int_t i=0; i < fCollTrigClasses.GetEntries(); i++)
-    {
-      h->GetYaxis()->SetBinLabel(n, ((TObjString*) fCollTrigClasses.At(i))->String());
-      n++;
-    }
+  {
+    h->GetYaxis()->SetBinLabel(n, ((TObjString*) fCollTrigClasses.At(i))->String());
+    n++;
+  }
   for (Int_t i=0; i < fBGTrigClasses.GetEntries(); i++)
-    {
-      h->GetYaxis()->SetBinLabel(n, ((TObjString*) fBGTrigClasses.At(i))->String());
-      n++;
-    }
-
+  {
+    h->GetYaxis()->SetBinLabel(n, ((TObjString*) fBGTrigClasses.At(i))->String());
+    n++;
+  }
+  
   if(fComputeBG) {
     fBGStatOffset = n;
     h->GetYaxis()->SetBinLabel(n++, "All B");
@@ -1186,7 +1141,7 @@ TH2F * AliPhysicsSelection::BookHistStatistics(const char * tag) {
 #endif
     h->GetYaxis()->SetBinLabel(n++, "GOOD");
   }
-
+  
   return h;
 }
 
@@ -1204,7 +1159,7 @@ void AliPhysicsSelection::Print(const Option_t *option) const
   Printf("Background trigger classes:");
   for (Int_t i=0; i < fBGTrigClasses.GetEntries(); i++)
     Printf("%s", ((TObjString*) fBGTrigClasses.At(i))->String().Data());
-
+  
   AliTriggerAnalysis* triggerAnalysis = dynamic_cast<AliTriggerAnalysis*> (fTriggerAnalysis.At(0));
   
   if (triggerAnalysis)
@@ -1222,46 +1177,46 @@ void AliPhysicsSelection::Print(const Option_t *option) const
       TObjString* obj = 0;
       static TString alreadyFoundTriggers;
       while ((obj = dynamic_cast<TObjString*> (iter->Next())))
-       {
-         TString strTrigger = obj->GetString();    
-         TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (triggers->GetValue(obj));
-         Long_t counts =  (Long_t)param->GetVal();
-         TObjArray* tokens = obj->String().Tokenize(" ");
-         for (Int_t i=0; i<tokens->GetEntries(); i++)
-           {
-             TString singleTrigStr = ((TObjString*) tokens->At(i))->String();
-             singleTrigStr.Strip(TString::kBoth, ' ' );
-             const char * singleTrig = singleTrigStr.Data();
-             //            Printf("%s", singleTrig);
-             TString singleTrigStrFull;
-             Bool_t found = kFALSE;
-             Int_t nCollTriggers = fCollTrigClasses.GetEntries();
-             for(Int_t iCollTriggers = 0; iCollTriggers < nCollTriggers; iCollTriggers++){
-               singleTrigStrFull = ((TObjString*)fCollTrigClasses.At(iCollTriggers))->String();
-               if(singleTrigStrFull.Contains(singleTrigStr)) {
-                 found = kTRUE;
-                 break;
-               }
-               singleTrigStrFull = singleTrigStr;
-             }
-             Int_t nBGTriggers = fBGTrigClasses.GetEntries();
-             for(Int_t iBGTriggers = 0; iBGTriggers < nBGTriggers; iBGTriggers++){
-               singleTrigStrFull = ((TObjString*)fBGTrigClasses.At(iBGTriggers))->String();
-               if(singleTrigStrFull.Contains(singleTrigStr)) {
-                 found = kTRUE;
-                 break;
-               }
-               singleTrigStrFull = singleTrigStr;
-             }
-             
-             TString blacklist = "CEMC7WU-B-NOPF-ALL, CEMC7WU-AC-NOPF-ALL CEMC7WU-E-NOPF-ALL C0LSR-ABCE-NOPF-TPC CBEAMB-B-NOPF-ALLNOTRD"; // We know we dont support those, so we print no warning           
-             if(counts>0 && !found && !blacklist.Contains(singleTrig) && !singleTrigStr.Contains("WU") && !alreadyFoundTriggers.Contains(singleTrig)) {
-               Printf("WARNING: Found unknown trigger [%s] with %ld counts in the ESD!", singleTrig, counts);
-               alreadyFoundTriggers += singleTrig; // Avoid printing warning twice for the same trigger
-             }       
-           }    
-         delete tokens;        
-       }
+      {
+        TString strTrigger = obj->GetString();    
+        TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (triggers->GetValue(obj));
+        Long_t counts =  (Long_t)param->GetVal();
+        TObjArray* tokens = obj->String().Tokenize(" ");
+        for (Int_t i=0; i<tokens->GetEntries(); i++)
+        {
+          TString singleTrigStr = ((TObjString*) tokens->At(i))->String();
+          singleTrigStr.Strip(TString::kBoth, ' ' );
+          const char * singleTrig = singleTrigStr.Data();
+          //       Printf("%s", singleTrig);
+          TString singleTrigStrFull;
+          Bool_t found = kFALSE;
+          Int_t nCollTriggers = fCollTrigClasses.GetEntries();
+          for(Int_t iCollTriggers = 0; iCollTriggers < nCollTriggers; iCollTriggers++){
+            singleTrigStrFull = ((TObjString*)fCollTrigClasses.At(iCollTriggers))->String();
+            if(singleTrigStrFull.Contains(singleTrigStr)) {
+              found = kTRUE;
+              break;
+            }
+            singleTrigStrFull = singleTrigStr;
+          }
+          Int_t nBGTriggers = fBGTrigClasses.GetEntries();
+          for(Int_t iBGTriggers = 0; iBGTriggers < nBGTriggers; iBGTriggers++){
+            singleTrigStrFull = ((TObjString*)fBGTrigClasses.At(iBGTriggers))->String();
+            if(singleTrigStrFull.Contains(singleTrigStr)) {
+              found = kTRUE;
+              break;
+            }
+            singleTrigStrFull = singleTrigStr;
+          }
+          
+          TString blacklist = "CEMC7WU-B-NOPF-ALL, CEMC7WU-AC-NOPF-ALL CEMC7WU-E-NOPF-ALL C0LSR-ABCE-NOPF-TPC CBEAMB-B-NOPF-ALLNOTRD"; // We know we dont support those, so we print no warning              
+          if(counts>0 && !found && !blacklist.Contains(singleTrig) && !singleTrigStr.Contains("WU") && !alreadyFoundTriggers.Contains(singleTrig)) {
+            Printf("WARNING: Found unknown trigger [%s] with %ld counts in the ESD!", singleTrig, counts);
+            alreadyFoundTriggers += singleTrig; // Avoid printing warning twice for the same trigger
+          }          
+        }    
+        delete tokens; 
+      }
       delete iter;
     }
   }
@@ -1269,7 +1224,7 @@ void AliPhysicsSelection::Print(const Option_t *option) const
   if (fHistStatistics[kStatIdxAll])
   {
     static TString alreadyFoundTriggers; // avoids printing twice the same warning
-       
+    
     for (Int_t i=0; i<fCollTrigClasses.GetEntries(); i++)
     {
       Printf("\nSelection statistics for collision trigger %s:", ((TObjString*) fCollTrigClasses.At(i))->String().Data());
@@ -1277,7 +1232,7 @@ void AliPhysicsSelection::Print(const Option_t *option) const
       
       Float_t allEvents       = fHistStatistics[kStatIdxAll]->GetBinContent(1, i+1); 
       Float_t triggeredEvents = fHistStatistics[kStatIdxAll]->GetBinContent(fHistStatistics[kStatIdxAll]->GetXaxis()->FindBin("Accepted"), i+1); 
-
+      
       Printf("Total events with correct trigger class: %d", (Int_t) fHistStatistics[kStatIdxAll]->GetBinContent(1, i+1));
       msg += Form("Total events with correct trigger class: %d\n", (Int_t) fHistStatistics[kStatIdxAll]->GetBinContent(1, i+1));
       Printf("Selected collision candidates: %d", (Int_t) fHistStatistics[kStatIdxAll]->GetBinContent(fHistStatistics[kStatIdxAll]->GetXaxis()->FindBin("Accepted"), i+1));
@@ -1286,12 +1241,12 @@ void AliPhysicsSelection::Print(const Option_t *option) const
       // If the fraction of accepted events is too low, print a warning.
       Float_t eff = allEvents > 0 ? triggeredEvents/allEvents : 0;
       if(allEvents > 0 && (eff < 0.5) &&  // FIXME: make threshold programmable in OADB
-        !alreadyFoundTriggers.Contains(((TObjString*) fCollTrigClasses.At(i))->String().Data())) {
-       Printf("WARNING: Trigger class %s has a very low efficiency (%d/%d=%.2f)",((TObjString*) fCollTrigClasses.At(i))->String().Data(), (Int_t) triggeredEvents, (Int_t) allEvents, eff);
-       alreadyFoundTriggers += ((TObjString*) fCollTrigClasses.At(i))->String().Data();
-       Printf("%s", alreadyFoundTriggers.Data());
+          !alreadyFoundTriggers.Contains(((TObjString*) fCollTrigClasses.At(i))->String().Data())) {
+        Printf("WARNING: Trigger class %s has a very low efficiency (%d/%d=%.2f)",((TObjString*) fCollTrigClasses.At(i))->String().Data(), (Int_t) triggeredEvents, (Int_t) allEvents, eff);
+        alreadyFoundTriggers += ((TObjString*) fCollTrigClasses.At(i))->String().Data();
+        Printf("%s", alreadyFoundTriggers.Data());
       }
-
+      
     }
   }
   
@@ -1308,7 +1263,7 @@ void AliPhysicsSelection::Print(const Option_t *option) const
       for (Int_t j=1; j<=fHistBunchCrossing->GetNbinsX(); j++)
         if (fHistBunchCrossing->GetBinContent(j, i) > 0)
           str += Form("%d, ", (Int_t) fHistBunchCrossing->GetXaxis()->GetBinCenter(j));
-             
+      
       Printf("%s", str.Data());
       msg += str;
       msg += "\n";
@@ -1332,7 +1287,7 @@ void AliPhysicsSelection::Print(const Option_t *option) const
         Printf("WARNING: Bunch crossing %d has collision and BG trigger classes active. Check BPTX functioning for this run!", (Int_t) fHistBunchCrossing->GetXaxis()->GetBinCenter(j));
     }
   }
-
+  
   if (fUsingCustomClasses)        
     Printf("WARNING: Using custom trigger classes!");
   if (fSkipTriggerClassSelection) 
@@ -1344,8 +1299,8 @@ void AliPhysicsSelection::Print(const Option_t *option) const
   TString opt(option);
   opt.ToUpper();
   if (opt == "STAT") {
-     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-     if (mgr) mgr->AddStatisticsMsg(msg);
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+    if (mgr) mgr->AddStatisticsMsg(msg);
   }
 }
 
@@ -1354,23 +1309,23 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
   // Merge a list of AliMultiplicityCorrection objects with this (needed for
   // PROOF).
   // Returns the number of merged objects (including this).
-
+  
   if (!list)
     return 0;
-
+  
   if (list->IsEmpty())
     return 1;
-
+  
   TIterator* iter = list->MakeIterator();
   TObject* obj;
   
   // collections of all histograms
   const Int_t nHists = 8;
   TList collections[nHists];
-
+  
   Int_t count = 0;
   while ((obj = iter->Next())) {
-
+    
     AliPhysicsSelection* entry = dynamic_cast<AliPhysicsSelection*> (obj);
     if (entry == 0) 
       continue;
@@ -1391,22 +1346,22 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
         fBGTrigClasses.Add(entry->fBGTrigClasses.At(i)->Clone());
     }
     if (fCurrentRun != currentRun)
-       AliWarning(Form("Current run %d not matching the one to be merged with %d", fCurrentRun, currentRun));
-
+      AliWarning(Form("Current run %d not matching the one to be merged with %d", fCurrentRun, currentRun));
+    
     // With the same strategy update fBGStatOffset
     Int_t bgstatoffset = entry->GetBGStatOffset();
     
     // Nothing to merge with since BG was not initialized.
     if (!(bgstatoffset < 0)){
       if (fBGStatOffset < 0) 
-       {
-         fBGStatOffset = bgstatoffset;
-       }
+      {
+        fBGStatOffset = bgstatoffset;
+      }
     }
     if (fBGStatOffset != bgstatoffset)
       AliWarning(Form("Current run %d not matching the one to be merged with %d", fBGStatOffset, bgstatoffset));
     
-
+    
     
     // Merge the OADBs (Take just the first instance you find
     if (!fPSOADB && entry->GetOADBPhysicsSelection()) {
@@ -1415,7 +1370,7 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
     if (!fFillOADB && entry->GetOADBFillingScheme()){
       fFillOADB = (AliOADBFillingScheme*) entry->GetOADBFillingScheme()->Clone();
     }
-
+    
     if (entry->fTriggerAnalysis.GetEntries() > 0)
       collections[0].Add(&(entry->fTriggerAnalysis));
     if (entry->fHistStatistics[0])
@@ -1428,10 +1383,10 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
       collections[3].Add(entry->fHistBunchCrossing);
     if (entry->fHistTriggerPattern)
       collections[4].Add(entry->fHistTriggerPattern);
-
+    
     count++;
   }
-
+  
   if (fTriggerAnalysis.GetEntries() == 0 && collections[0].GetEntries() > 0)
   {
     TList* firstList = (TList*) collections[0].First();
@@ -1450,7 +1405,7 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
   }
   if (fHistStatistics[0])
     fHistStatistics[0]->Merge(&collections[1]);
-    
+  
   if (!fHistStatistics[1] && collections[2].GetEntries() > 0)
   {
     fHistStatistics[1] = (TH2F*) collections[2].First()->Clone();
@@ -1458,7 +1413,7 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
   }
   if (fHistStatistics[1])
     fHistStatistics[1]->Merge(&collections[2]);
-    
+  
   if (!fHistBunchCrossing && collections[3].GetEntries() > 0)
   {
     fHistBunchCrossing = (TH2F*) collections[3].First()->Clone();
@@ -1474,9 +1429,9 @@ Long64_t AliPhysicsSelection::Merge(TCollection* list)
   }
   if (fHistTriggerPattern)
     fHistTriggerPattern->Merge(&collections[4]);
-    
+  
   delete iter;
-
+  
   return count+1;
 }
 
@@ -1486,18 +1441,18 @@ void AliPhysicsSelection::SaveHistograms(const char* folder)
   
   if (!fHistStatistics[0] || !fHistStatistics[1])
     return;
-    
+  
   if (folder)
   {
     gDirectory->mkdir(folder);
     gDirectory->cd(folder);
   }
   
-
+  
   // Fill the last rows of fHistStatistics before saving
   if (fComputeBG) {      
     AliInfo("BG estimate assumes that for a given run you only have A and C triggers separately or"
-           " toghether as a AC class! Make sure this assumption holds in your case"); 
+        " toghether as a AC class! Make sure this assumption holds in your case"); 
     
     // use an anum for the different trigger classes, to make loops easier to read
     enum {kClassB =0 , kClassA, kClassC, kClassAC, kClassE, kNClasses};
@@ -1514,24 +1469,24 @@ void AliPhysicsSelection::SaveHistograms(const char* folder)
     // Those are used to rescale the different classes to the same number of bx ids
     // TODO: pass names of the rows for B, CA and E and look names of the rows. How do I handle the case in which both AC are in the same row?         
     Int_t nBXIds[kNClasses] = {0};
-      //      cout <<"Computing BG:" << endl;
+    //      cout <<"Computing BG:" << endl;
     
     for(Int_t iTrigClass = 0; iTrigClass < kNClasses; iTrigClass++){
       for(Int_t irow = 0; irow < nrows[iTrigClass]; irow++) {
-       if(irow==0) cout << "- Class " << classFlags[iTrigClass] << endl;   
-       for (Int_t j=1; j<=fHistBunchCrossing->GetNbinsX(); j++) {
-         if (fHistBunchCrossing->GetBinContent(j, rows[iTrigClass][irow]) > 0) {
-           nBXIds[iTrigClass]++;        
-         }
-       }
-       if(nBXIds[iTrigClass]>0) cout << "   Using row " << rows[iTrigClass][irow] <<  ": " 
-                                     << fHistBunchCrossing->GetYaxis()->GetBinLabel(rows[iTrigClass][irow]) 
-                                     << " (nBXID "<< nBXIds[iTrigClass] << ")"<< endl;
-
+        if(irow==0) cout << "- Class " << classFlags[iTrigClass] << endl;   
+        for (Int_t j=1; j<=fHistBunchCrossing->GetNbinsX(); j++) {
+          if (fHistBunchCrossing->GetBinContent(j, rows[iTrigClass][irow]) > 0) {
+            nBXIds[iTrigClass]++;       
+          }
+        }
+        if(nBXIds[iTrigClass]>0) cout << "   Using row " << rows[iTrigClass][irow] <<  ": " 
+            << fHistBunchCrossing->GetYaxis()->GetBinLabel(rows[iTrigClass][irow]) 
+            << " (nBXID "<< nBXIds[iTrigClass] << ")"<< endl;
+        
       }
-
+      
     }
-
+    
     Float_t ratioToB[kNClasses];
     ratioToB[kClassE]  = nBXIds[kClassE]  >0 ? Float_t(nBXIds[kClassB])/nBXIds[kClassE]   : 0;
     ratioToB[kClassA]  = nBXIds[kClassA]  >0 ? Float_t(nBXIds[kClassB])/nBXIds[kClassA]   : 0;
@@ -1543,127 +1498,127 @@ void AliPhysicsSelection::SaveHistograms(const char* folder)
     Printf("  B/C  = %d/%d = %f", nBXIds[kClassB],nBXIds[kClassC], ratioToB[kClassC] );
     Printf("  B/AC = %d/%d = %f", nBXIds[kClassB],nBXIds[kClassAC],ratioToB[kClassAC]);
     Int_t nHistStat = 2;
-
+    
     // 1. loop over all cols
     for(Int_t iHistStat = 0; iHistStat < nHistStat; iHistStat++){
       Int_t ncol = fHistStatistics[iHistStat]->GetNbinsX();
       Float_t good1 = 0;      
       for(Int_t icol = 1; icol <= ncol; icol++) {
-       Int_t nEvents[kNClasses] = {0}; // number of events should be reset at every column
-       // For all trigger classes, add up over row matching trigger mask (as selected before)
-       for(Int_t iTrigClass = 0; iTrigClass < kNClasses; iTrigClass++){
-         for(Int_t irow = 0; irow < nrows[iTrigClass]; irow++) {         
-           nEvents[iTrigClass] += (Int_t) fHistStatistics[iHistStat]->GetBinContent(icol,rows[iTrigClass][irow]);      
-         }
-         //        cout << "Events " << classFlags[iTrigClass] << " ("<<icol<<") " << nEvents[iTrigClass] << endl;         
-       }
-       if (nEvents[kClassB]>0) {
-         Float_t acc  = ratioToB[kClassE]*nEvents[kClassE]; 
-         Double_t accErr = TMath::Sqrt(ratioToB[kClassE]*ratioToB[kClassE]*nEvents[kClassE]);
-         //      Int_t bg   = cint1A + cint1C - 2*acc;
-           
-         // If intensity measurements are available, they already
-         // contain the scaling for BX ratios, so we reset the
-         // ratioToB entries
-         if(icol == 1) {
-           if(fBIFactorAC > 0 || fBIFactorA > 0 || fBIFactorC > 0) {
-             if (fBIFactorAC <= 0 && (fBIFactorA <= 0 || fBIFactorC <= 0)) {
-               AliError("Not all intensities set!, assuming equal intensities");
-               fBIFactorA  = 1;
-               fBIFactorC  = 1;
-               fBIFactorAC = 1;
-             } else {
-               AliInfo("Using ratio of number of bunch crossing embedded in the intensity measurements");
-               ratioToB[kClassA]  = ratioToB[kClassA]  >0 ? 1  : 0;
-               ratioToB[kClassC]  = ratioToB[kClassC]  >0 ? 1  : 0;
-               ratioToB[kClassAC] = ratioToB[kClassAC] >0 ? 1  : 0;
-               AliInfo(Form(" - BI Factor A:  %f",  fBIFactorA ));
-               AliInfo(Form(" - BI Factor C:  %f",  fBIFactorC ));
-               AliInfo(Form(" - BI Factor AC: %f",  fBIFactorAC ));
-               
-             }
-           } else {
-             AliWarning("Intensities not set!, assuming equal intensities");
-             fBIFactorA  = 1;
-             fBIFactorC  = 1;
-             fBIFactorAC = 1;
-           }
-         }
-         // Assuming that for a given class the triggers are either recorded as A+C or AC
-         Float_t bg  = nEvents[kClassAC] > 0 ?
-           fBIFactorAC*(ratioToB[kClassAC]*nEvents[kClassAC] - 2*acc):
-           fBIFactorA* (ratioToB[kClassA]*nEvents[kClassA]-acc) + 
-           fBIFactorC* (ratioToB[kClassC]*nEvents[kClassC]-acc) ;
-
-         // cout << "-----------------------" << endl;
-         // cout << "Factors: " << fBIFactorA << " " << fBIFactorC << " " << fBIFactorAC << endl;
-         // cout << "Ratios: "  << ratioToB[kClassA] << " " << ratioToB[kClassC] << " " << ratioToB[kClassAC] << endl;
-         // cout << "Evts:   "  << nEvents[kClassA] << " " << nEvents[kClassC] << " " << nEvents[kClassAC] << " " <<  nEvents[kClassB] << endl;
-         // cout << "Acc: " << acc << endl;
-         // cout << "BG: " << bg << endl;
-         // cout  << "  " <<   fBIFactorA* (ratioToB[kClassA]*nEvents[kClassA]-acc) <<endl;
-         // cout  << "  " <<   fBIFactorC* (ratioToB[kClassC]*nEvents[kClassC]-acc) <<endl;
-         // cout  << "  " <<   fBIFactorAC*(ratioToB[kClassAC]*nEvents[kClassAC] - 2*acc) << endl;
-         // cout << "-----------------------" << endl;
-
-         Float_t good = Float_t(nEvents[kClassB]) - bg - acc;
-         if (icol ==1) good1 = good;
-         //      Float_t errGood     = TMath::Sqrt(2*(nEvents[kClassA]+nEvents[kClassC]+nEvents[kClassE]));// Error on the number of goods assuming only bg fluctuates
-         //      DeltaG^2 = B + FA^2 A + FC^2 C + Ratio^2 (FA+FC-1)^2 E.
-         Float_t errGood     = nEvents[kClassAC] > 0 ? 
-           TMath::Sqrt( nEvents[kClassB] +
-                        fBIFactorAC*fBIFactorAC*ratioToB[kClassAC]*ratioToB[kClassAC]*nEvents[kClassAC] +
-                        ratioToB[kClassE] * ratioToB[kClassE] * 
-                        (fBIFactorAC - 1)*(fBIFactorAC - 1)*nEvents[kClassE]) :  
-           TMath::Sqrt( nEvents[kClassB] + 
-                        fBIFactorA*fBIFactorA*ratioToB[kClassA]*ratioToB[kClassA]*nEvents[kClassA] +
-                        fBIFactorC*fBIFactorC*ratioToB[kClassC]*ratioToB[kClassC]*nEvents[kClassC] +
-                        ratioToB[kClassE] * ratioToB[kClassE] * 
-                        (fBIFactorA + fBIFactorC - 1)*(fBIFactorA + fBIFactorC - 1)*nEvents[kClassE]);
-
-         Float_t errBG = nEvents[kClassAC] > 0 ? 
-           TMath::Sqrt(fBIFactorAC*fBIFactorAC*ratioToB[kClassAC]*ratioToB[kClassAC]*nEvents[kClassAC]+
-                       4*ratioToB[kClassE]*ratioToB[kClassE]*(fBIFactorAC*fBIFactorAC)*nEvents[kClassE]) :
-           TMath::Sqrt(fBIFactorA*fBIFactorA*ratioToB[kClassA]*ratioToB[kClassA]*nEvents[kClassA]+
-                       fBIFactorC*fBIFactorC*ratioToB[kClassC]*ratioToB[kClassC]*nEvents[kClassC]+
-                       ratioToB[kClassE]*ratioToB[kClassE]*(fBIFactorA+fBIFactorC)*(fBIFactorA+fBIFactorC)*nEvents[kClassE]);
-       
-       
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllB, nEvents[kClassB]); 
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllAC,nEvents[kClassA]+nEvents[kClassC]+nEvents[kClassAC]);      
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllE, nEvents[kClassE]); 
-
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowBG,bg);  
-         fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowBG,errBG);       
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAcc,acc);        
-         fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowAcc,accErr);     
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowGood,good);    
-         fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowGood,errGood);    
-
+        Int_t nEvents[kNClasses] = {0}; // number of events should be reset at every column
+        // For all trigger classes, add up over row matching trigger mask (as selected before)
+        for(Int_t iTrigClass = 0; iTrigClass < kNClasses; iTrigClass++){
+          for(Int_t irow = 0; irow < nrows[iTrigClass]; irow++) {        
+            nEvents[iTrigClass] += (Int_t) fHistStatistics[iHistStat]->GetBinContent(icol,rows[iTrigClass][irow]);     
+          }
+          //       cout << "Events " << classFlags[iTrigClass] << " ("<<icol<<") " << nEvents[iTrigClass] << endl;         
+        }
+        if (nEvents[kClassB]>0) {
+          Float_t acc  = ratioToB[kClassE]*nEvents[kClassE]; 
+          Double_t accErr = TMath::Sqrt(ratioToB[kClassE]*ratioToB[kClassE]*nEvents[kClassE]);
+          //      Int_t bg   = cint1A + cint1C - 2*acc;
+          
+          // If intensity measurements are available, they already
+          // contain the scaling for BX ratios, so we reset the
+          // ratioToB entries
+          if(icol == 1) {
+            if(fBIFactorAC > 0 || fBIFactorA > 0 || fBIFactorC > 0) {
+              if (fBIFactorAC <= 0 && (fBIFactorA <= 0 || fBIFactorC <= 0)) {
+                AliError("Not all intensities set!, assuming equal intensities");
+                fBIFactorA  = 1;
+                fBIFactorC  = 1;
+                fBIFactorAC = 1;
+              } else {
+                AliInfo("Using ratio of number of bunch crossing embedded in the intensity measurements");
+                ratioToB[kClassA]  = ratioToB[kClassA]  >0 ? 1  : 0;
+                ratioToB[kClassC]  = ratioToB[kClassC]  >0 ? 1  : 0;
+                ratioToB[kClassAC] = ratioToB[kClassAC] >0 ? 1  : 0;
+                AliInfo(Form(" - BI Factor A:  %f",  fBIFactorA ));
+                AliInfo(Form(" - BI Factor C:  %f",  fBIFactorC ));
+                AliInfo(Form(" - BI Factor AC: %f",  fBIFactorAC ));
+                
+              }
+            } else {
+              AliWarning("Intensities not set!, assuming equal intensities");
+              fBIFactorA  = 1;
+              fBIFactorC  = 1;
+              fBIFactorAC = 1;
+            }
+          }
+          // Assuming that for a given class the triggers are either recorded as A+C or AC
+          Float_t bg  = nEvents[kClassAC] > 0 ?
+              fBIFactorAC*(ratioToB[kClassAC]*nEvents[kClassAC] - 2*acc):
+              fBIFactorA* (ratioToB[kClassA]*nEvents[kClassA]-acc) + 
+              fBIFactorC* (ratioToB[kClassC]*nEvents[kClassC]-acc) ;
+          
+          // cout << "-----------------------" << endl;
+          // cout << "Factors: " << fBIFactorA << " " << fBIFactorC << " " << fBIFactorAC << endl;
+          // cout << "Ratios: "  << ratioToB[kClassA] << " " << ratioToB[kClassC] << " " << ratioToB[kClassAC] << endl;
+          // cout << "Evts:   "  << nEvents[kClassA] << " " << nEvents[kClassC] << " " << nEvents[kClassAC] << " " <<  nEvents[kClassB] << endl;
+          // cout << "Acc: " << acc << endl;
+          // cout << "BG: " << bg << endl;
+          // cout  << "  " <<   fBIFactorA* (ratioToB[kClassA]*nEvents[kClassA]-acc) <<endl;
+          // cout  << "  " <<   fBIFactorC* (ratioToB[kClassC]*nEvents[kClassC]-acc) <<endl;
+          // cout  << "  " <<   fBIFactorAC*(ratioToB[kClassAC]*nEvents[kClassAC] - 2*acc) << endl;
+          // cout << "-----------------------" << endl;
+          
+          Float_t good = Float_t(nEvents[kClassB]) - bg - acc;
+          if (icol ==1) good1 = good;
+          //      Float_t errGood     = TMath::Sqrt(2*(nEvents[kClassA]+nEvents[kClassC]+nEvents[kClassE]));// Error on the number of goods assuming only bg fluctuates
+          //      DeltaG^2 = B + FA^2 A + FC^2 C + Ratio^2 (FA+FC-1)^2 E.
+          Float_t errGood     = nEvents[kClassAC] > 0 ? 
+              TMath::Sqrt( nEvents[kClassB] +
+                  fBIFactorAC*fBIFactorAC*ratioToB[kClassAC]*ratioToB[kClassAC]*nEvents[kClassAC] +
+                  ratioToB[kClassE] * ratioToB[kClassE] * 
+                  (fBIFactorAC - 1)*(fBIFactorAC - 1)*nEvents[kClassE]) :  
+                  TMath::Sqrt( nEvents[kClassB] + 
+                      fBIFactorA*fBIFactorA*ratioToB[kClassA]*ratioToB[kClassA]*nEvents[kClassA] +
+                      fBIFactorC*fBIFactorC*ratioToB[kClassC]*ratioToB[kClassC]*nEvents[kClassC] +
+                      ratioToB[kClassE] * ratioToB[kClassE] * 
+                      (fBIFactorA + fBIFactorC - 1)*(fBIFactorA + fBIFactorC - 1)*nEvents[kClassE]);
+          
+          Float_t errBG = nEvents[kClassAC] > 0 ? 
+              TMath::Sqrt(fBIFactorAC*fBIFactorAC*ratioToB[kClassAC]*ratioToB[kClassAC]*nEvents[kClassAC]+
+                  4*ratioToB[kClassE]*ratioToB[kClassE]*(fBIFactorAC*fBIFactorAC)*nEvents[kClassE]) :
+                  TMath::Sqrt(fBIFactorA*fBIFactorA*ratioToB[kClassA]*ratioToB[kClassA]*nEvents[kClassA]+
+                      fBIFactorC*fBIFactorC*ratioToB[kClassC]*ratioToB[kClassC]*nEvents[kClassC]+
+                      ratioToB[kClassE]*ratioToB[kClassE]*(fBIFactorA+fBIFactorC)*(fBIFactorA+fBIFactorC)*nEvents[kClassE]);
+          
+          
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllB, nEvents[kClassB]);        
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllAC,nEvents[kClassA]+nEvents[kClassC]+nEvents[kClassAC]);     
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAllE, nEvents[kClassE]);        
+          
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowBG,bg); 
+          fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowBG,errBG);      
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAcc,acc);       
+          fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowAcc,accErr);    
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowGood,good);    
+          fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowGood,errGood);    
+          
 #ifdef VERBOSE_STAT
-         //kStatRowBG=0,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowGood,kStatRowErrGood
-         Float_t accFrac   = Float_t(acc) / nEvents[kClassB]  *100;
-         Float_t errAccFrac= Float_t(accErr) / nEvents[kClassB]  *100;
-         Float_t bgFrac    = Float_t(bg)  / nEvents[kClassB]  *100;
-         Float_t goodFrac  = Float_t(good)  / good1 *100;
-         Float_t errGoodFrac = errGood/good1 * 100;
-         Float_t errFracBG = bg > 0 ? TMath::Sqrt((errBG/bg)*(errBG/bg) + 1/nEvents[kClassB])*bgFrac : 0;
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowBGFrac,bgFrac);  
-         fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowBGFrac,errFracBG);       
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAccFrac,accFrac);    
-         fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowAccFrac,errAccFrac);    
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowGoodFrac,goodFrac);    
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowErrGoodFrac,errGoodFrac);    
-         fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowErrGood,errGood);    
+          //kStatRowBG=0,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowGood,kStatRowErrGood
+          Float_t accFrac   = Float_t(acc) / nEvents[kClassB]  *100;
+          Float_t errAccFrac= Float_t(accErr) / nEvents[kClassB]  *100;
+          Float_t bgFrac    = Float_t(bg)  / nEvents[kClassB]  *100;
+          Float_t goodFrac  = Float_t(good)  / good1 *100;
+          Float_t errGoodFrac = errGood/good1 * 100;
+          Float_t errFracBG = bg > 0 ? TMath::Sqrt((errBG/bg)*(errBG/bg) + 1/nEvents[kClassB])*bgFrac : 0;
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowBGFrac,bgFrac); 
+          fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowBGFrac,errFracBG);      
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowAccFrac,accFrac);    
+          fHistStatistics[iHistStat]->SetBinError  (icol,fBGStatOffset+kStatRowAccFrac,errAccFrac);    
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowGoodFrac,goodFrac);    
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowErrGoodFrac,errGoodFrac);    
+          fHistStatistics[iHistStat]->SetBinContent(icol,fBGStatOffset+kStatRowErrGood,errGood);    
 #endif
-       }
+        }
       }
     }
     for (Int_t iTrigClass = 0; iTrigClass < kNClasses; iTrigClass++){
       delete [] rows[iTrigClass];
     }  
   } // end of ComputeBackground  
-
+  
   fHistStatistics[0]->Write();
   fHistStatistics[1]->Write();
   if(fHistBunchCrossing ) fHistBunchCrossing ->Write();
@@ -1671,21 +1626,21 @@ void AliPhysicsSelection::SaveHistograms(const char* folder)
   
   Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries();
   for (Int_t i=0; i < count; i++)
-    {
-      TString triggerClass = "trigger_histograms_";
-      if (i < fCollTrigClasses.GetEntries())
-       triggerClass += ((TObjString*) fCollTrigClasses.At(i))->String();
-      else
-       triggerClass += ((TObjString*) fBGTrigClasses.At(i - fCollTrigClasses.GetEntries()))->String();
-      
-      gDirectory->mkdir(triggerClass);
-      gDirectory->cd(triggerClass);
-      
-      static_cast<AliTriggerAnalysis*> (fTriggerAnalysis.At(i))->SaveHistograms();
-      
-      gDirectory->cd("..");
-    }
+  {
+    TString triggerClass = "trigger_histograms_";
+    if (i < fCollTrigClasses.GetEntries())
+      triggerClass += ((TObjString*) fCollTrigClasses.At(i))->String();
+    else
+      triggerClass += ((TObjString*) fBGTrigClasses.At(i - fCollTrigClasses.GetEntries()))->String();
     
+    gDirectory->mkdir(triggerClass);
+    gDirectory->cd(triggerClass);
+    
+    static_cast<AliTriggerAnalysis*> (fTriggerAnalysis.At(i))->SaveHistograms();
+    
+    gDirectory->cd("..");
+  }
+  
   if (folder)
     gDirectory->cd("..");
   
@@ -1698,18 +1653,18 @@ Int_t AliPhysicsSelection::GetStatRow(const char * triggerBXClass, UInt_t offlin
   // triggerBXClass can be either "A", "AC", "B" or "E"
   // offlineTriggerType is one of the types defined in AliVEvent
   // User should delete rowIDs if no longer needed
-
+  
   if(!fHistStatistics[0]) {
     AliWarning("Not initialized, returning 0");
     return 0;
   }
   const Int_t nrows = fHistStatistics[0]->GetNbinsY();
-
+  
   // allocate memory for at maximum nrows
   Int_t nMatches = 0;
   (*rowIDs) = new UInt_t[nrows];
-
-
+  
+  
   // Loop over rows and find matching ones, using the PS OADB
   // FIXME: check BG estimates
   for(Int_t irow = 1; irow <= nrows; irow++){
@@ -1720,13 +1675,13 @@ Int_t AliPhysicsSelection::GetStatRow(const char * triggerBXClass, UInt_t offlin
       UInt_t tType = ((TObjString*)arr->At(1))->GetString().Atoi();
       
       if (tType == offlineTriggerType && fPSOADB->GetBeamSide(triggerClassCurrent.Data()) == triggerBXClass) {
-       (*rowIDs)[nMatches] = irow;
-       nMatches++;
+        (*rowIDs)[nMatches] = irow;
+        nMatches++;
       }
-
+      
     }
     delete arr;
-
+    
   }
   
   return nMatches;
@@ -1745,12 +1700,12 @@ void AliPhysicsSelection::SetBIFactors(const AliESDEvent * aESD) {
     Double_t intCB = esdRun->GetMeanIntensityIntecting(1);
     Double_t intAA = esdRun->GetMeanIntensityNonIntecting(0);
     Double_t intCC = esdRun->GetMeanIntensityNonIntecting(1);
-
+    
     // cout << "INT " <<intAB <<endl;
     // cout << "INT " <<intCB <<endl;
     // cout << "INT " <<intAA <<endl;
     // cout << "INT " <<intCC <<endl;
-
+    
     if (intAB > 0 && intAA > 0) {
       fBIFactorA = intAB/intAA;
     } else {
@@ -1762,14 +1717,14 @@ void AliPhysicsSelection::SetBIFactors(const AliESDEvent * aESD) {
     } else {
       AliWarning("Cannot set fBIFactorC");
     }
-      
+    
     if (intAB > 0 && intAA > 0 &&
-       intCB > 0 && intCC > 0) {
+        intCB > 0 && intCC > 0) {
       fBIFactorAC = (intAB+intCB)/(intAA+intCC);
     } else {
       AliWarning("Cannot set fBIFactorAC");
     }
-        
+    
   }  
   else {
     // First runs. Intensities hardcoded
@@ -1891,7 +1846,7 @@ void AliPhysicsSelection::SetBIFactors(const AliESDEvent * aESD) {
       fBIFactorC = 1;
     }
   }
-
+  
 }
 
 const char * AliPhysicsSelection::GetTriggerString(TObjString * obj) { 
@@ -1899,17 +1854,17 @@ const char * AliPhysicsSelection::GetTriggerString(TObjString * obj) {
   static TString retString;
   
   retString.Form("%s%s", 
-                obj->String().Data(), 
-                fUseBXNumbers ? fFillOADB->GetBXIDs(fPSOADB->GetBeamSide(obj->String().Data())) : ""  
-                );
-
+      obj->String().Data(), 
+      fUseBXNumbers ? fFillOADB->GetBXIDs(fPSOADB->GetBeamSide(obj->String().Data())) : ""  
+  );
+  
   if (fMC) {
     TPRegexp stripClasses("\\+\\S* ");
     stripClasses.Substitute(retString,"","g");
     stripClasses=TPRegexp("\\-\\S* ");
     stripClasses.Substitute(retString,"","g");
   }
-
+  
   return retString.Data();
 }
 
@@ -1920,7 +1875,7 @@ void AliPhysicsSelection::AddCollisionTriggerClass(const char* className){
     fPSOADB->SetHardwareTrigger         ( 0,"SPDGFO >= 1 || V0A || V0C");
     fPSOADB->SetOfflineTrigger          ( 0,"(SPDGFO >= 1 || V0A || V0C) && !V0ABG && !V0CBG");
   }
-
+  
   // Strip all which is not needed, if BX ids are provided, they are still used here
   // offline trigger and logics are appended automagically, so we strip-em out if they are provided
   TString classNameStripped = className;
@@ -1928,24 +1883,24 @@ void AliPhysicsSelection::AddCollisionTriggerClass(const char* className){
     classNameStripped.Remove(classNameStripped.Index("*")); // keep only the class name (no bx, offline trigger...)   
   if(classNameStripped.Index("&")>0)
     classNameStripped.Remove(classNameStripped.Index("&")); // keep only the class name (no bx, offline trigger...)   
-
+  
   fPSOADB->AddCollisionTriggerClass   ( AliVEvent::kUserDefined,classNameStripped.Data(),"B",0);
   
   fUsingCustomClasses = kTRUE;
-
-
+  
+  
 }
 
 void AliPhysicsSelection::AddBGTriggerClass(const char* className){
   // Add custom BG trigger class
+  
   AliError("This method is deprecated! Will be removed soon! Please use SetCustomOADBObjects() instead!");
   if(!fPSOADB) {
     fPSOADB = new AliOADBPhysicsSelection("CustomPS");   
     fPSOADB->SetHardwareTrigger         ( 0,"SPDGFO >= 1 || V0A || V0C");
     fPSOADB->SetOfflineTrigger          ( 0,"(SPDGFO >= 1 || V0A || V0C) && !V0ABG && !V0CBG");
   }
-
+  
   // Strip all which is not needed, if BX ids are provided, they are still used here
   // offline trigger and logics are appended automagically, so we strip-em out if they are provided
   TString classNameStripped = className;
@@ -1953,11 +1908,11 @@ void AliPhysicsSelection::AddBGTriggerClass(const char* className){
     classNameStripped.Remove(classNameStripped.Index("*")); // keep only the class name (no bx, offline trigger...)   
   if(classNameStripped.Index("&")>0)
     classNameStripped.Remove(classNameStripped.Index("&")); // keep only the class name (no bx, offline trigger...)   
-
+  
   fPSOADB->AddBGTriggerClass   ( AliVEvent::kUserDefined,classNameStripped.Data(),"AC",0);
-
+  
   fUsingCustomClasses = kTRUE;
-
+  
 }       
 
 
@@ -1981,9 +1936,9 @@ void AliPhysicsSelection::DetectPassName(){
     }
     delete tokens;
   } 
-
+  
   TString passName="";
-
+  
   TObjArray* tokens = filePath.Tokenize("/");
   for (Int_t i=0;i<=tokens->GetLast();i++) {
     TObjString* stObj = (TObjString*) tokens->At(i);
@@ -2003,20 +1958,20 @@ void AliPhysicsSelection::DetectPassName(){
       TObjString* stObj = (TObjString*) tokens2->At(i);
       TString s = stObj->GetString();
       if (s.Contains("pass")) {
-       passName = s;
-       break;
+        passName = s;
+        break;
       }
     }
     delete tokens2;
   }
-
-
+  
+  
   if (!passName.Contains("pass")){
     AliError(" Failed to find reconstruction pass name:");
     AliError(" --> If these are MC data: please set kTRUE first argument of AddTaskPhysicsSelection");
     AliFatal(" --> If these are real data: please insert pass name inside the path of your local file, e.g. /your_path/pass2/AliESDs.root");
   }
-
+  
   AliInfo(Form("pass name: %s\n",passName.Data()));
   fPassName = passName;
 }
index a6fd140a3e619d23bd91683fcc3b9cad1492c794..a3afe3ce5fe9e2c6b99c3b56d5167fcdcc6e9c28 100644 (file)
 //   Origin: Jan Fiete Grosse-Oetringhaus, CERN
 //-------------------------------------------------------------------------
 
-#include <Riostream.h>
-#include <TH1F.h>
-#include <TH2F.h>
-#include <TList.h>
-#include <TIterator.h>
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TList.h"
+#include "TIterator.h"
 #include "TParameter.h"
-#include <TMap.h>
-#include <TRandom.h>
-
-#include <AliTriggerAnalysis.h>
-
-#include <AliLog.h>
-#include <AliAnalysisManager.h>
-
-#include <AliESDEvent.h>
-
-#include <AliMultiplicity.h>
-#include <AliESDVZERO.h>
-#include <AliESDZDC.h>
-#include <AliESDFMD.h>
-#include <AliESDVertex.h>
-#include <AliESDtrackCuts.h>
-#include <AliDAQ.h>
-#include <AliESDTrdTrack.h>
+#include "TMap.h"
+#include "TRandom.h"
+#include "AliTriggerAnalysis.h"
+#include "AliLog.h"
+#include "AliVEvent.h"
+#include "AliESDEvent.h"
+#include "AliMultiplicity.h"
+#include "AliESDVZERO.h"
+#include "AliESDZDC.h"
+#include "AliESDFMD.h"
+#include "AliESDVertex.h"
+#include "AliESDtrackCuts.h"
+#include "AliDAQ.h"
+#include "AliESDTrdTrack.h"
+#include "AliVCaloTrigger.h"
 
 ClassImp(AliTriggerAnalysis)
 
 AliTriggerAnalysis::AliTriggerAnalysis() :
-  fSPDGFOThreshold(2),
-  fSPDGFOEfficiency(0),
-  fV0TimeOffset(0),
-  fV0AdcThr(0),
-  fV0HwAdcThr(2.5),
-  fV0HwWinLow(61.5),
-  fV0HwWinHigh(86.5),
-  fZDCCutRefSum(-568.5),
-  fZDCCutRefDelta(-2.1),
-  fZDCCutSigmaSum(3.25),
-  fZDCCutSigmaDelta(2.25),
-  fZDCCutRefSumCorr(-65.5),
-  fZDCCutRefDeltaCorr(-2.1),
-  fZDCCutSigmaSumCorr(6.0),
-  fZDCCutSigmaDeltaCorr(1.2),
-  fZDCCutZNATimeCorrMin(0.0),
-  fZDCCutZNATimeCorrMax(2.0),
-  fZDCCutZNCTimeCorrMin(0.0),
-  fZDCCutZNCTimeCorrMax(5.0),
-  fASPDCvsTCut(65),
-  fBSPDCvsTCut(4),
-  fTRDptHSE(3.),
-  fTRDpidHSE(144),
-  fTRDptHQU(2.),
-  fTRDpidHQU(164.),
-  fTRDptHEE(3.),
-  fTRDpidHEE(144),
-  fTRDminSectorHEE(6),
-  fTRDmaxSectorHEE(8),
-  fTRDptHJT(3.),
-  fTRDnHJT(3),
-  fDoFMD(kTRUE),
-  fFMDLowCut(0.2),
-  fFMDHitCut(0.5),
-  fHistBitsSPD(0),
-  fHistFiredBitsSPD(0),
-  fHistSPDClsVsTrk(0),
-  fHistV0A(0),       
-  fHistV0C(0),
-  fHistZDC(0),    
-  fHistTDCZDC(0),    
-  fHistTimeZDC(0),    
-  fHistTimeCorrZDC(0),    
-  fHistFMDA(0),    
-  fHistFMDC(0),   
-  fHistFMDSingle(0),
-  fHistFMDSum(0),
-  fHistT0(0),
-  fTriggerClasses(0),
-  fMC(kFALSE),
-  fEsdTrackCuts(0),
-  fTPCOnly(kFALSE)
+fSPDGFOThreshold(2),
+fSPDGFOEfficiency(0),
+fV0TimeOffset(0),
+fV0AdcThr(0),
+fV0HwAdcThr(2.5),
+fV0HwWinLow(61.5),
+fV0HwWinHigh(86.5),
+fZDCCutRefSum(-568.5),
+fZDCCutRefDelta(-2.1),
+fZDCCutSigmaSum(3.25),
+fZDCCutSigmaDelta(2.25),
+fZDCCutRefSumCorr(-65.5),
+fZDCCutRefDeltaCorr(-2.1),
+fZDCCutSigmaSumCorr(6.0),
+fZDCCutSigmaDeltaCorr(1.2),
+fZDCCutZNATimeCorrMin(0.0),
+fZDCCutZNATimeCorrMax(2.0),
+fZDCCutZNCTimeCorrMin(0.0),
+fZDCCutZNCTimeCorrMax(5.0),
+fASPDCvsTCut(65),
+fBSPDCvsTCut(4),
+fTRDptHSE(3.),
+fTRDpidHSE(144),
+fTRDptHQU(2.),
+fTRDpidHQU(164.),
+fTRDptHEE(3.),
+fTRDpidHEE(144),
+fTRDminSectorHEE(6),
+fTRDmaxSectorHEE(8),
+fTRDptHJT(3.),
+fTRDnHJT(3),
+fDoFMD(kTRUE),
+fFMDLowCut(0.2),
+fFMDHitCut(0.5),
+fHistBitsSPD(0),
+fHistFiredBitsSPD(0),
+fHistSPDClsVsTrk(0),
+fHistV0A(0),
+fHistV0C(0),
+fHistZDC(0),
+fHistTDCZDC(0),
+fHistTimeZDC(0),
+fHistTimeCorrZDC(0),
+fHistFMDA(0),
+fHistFMDC(0),
+fHistFMDSingle(0),
+fHistFMDSum(0),
+fHistT0(0),
+fTriggerClasses(0),
+fMC(kFALSE),
+fEsdTrackCuts(0),
+fTPCOnly(kFALSE)
 {
   // constructor
 }
 
-AliTriggerAnalysis::~AliTriggerAnalysis()
-{
+//-------------------------------------------------------------------------------------------------
+AliTriggerAnalysis::~AliTriggerAnalysis(){
   // destructor
-  
-  if (fHistBitsSPD)
-  {
-    delete fHistBitsSPD;
-    fHistBitsSPD = 0;
-  }
-
-  if (fHistFiredBitsSPD)
-  {
-    delete fHistFiredBitsSPD;
-    fHistFiredBitsSPD = 0;
-  }
-
-  if (fHistSPDClsVsTrk)
-  {
-    delete fHistSPDClsVsTrk;
-    fHistSPDClsVsTrk = 0;
-  }
-
-  if (fHistV0A)
-  {
-    delete fHistV0A;
-    fHistV0A = 0;
-  }
-
-  if (fHistV0C)
-  {
-    delete fHistV0C;
-    fHistV0C = 0;
-  }
-
-  if (fHistZDC)
-  {
-    delete fHistZDC;
-    fHistZDC = 0;
-  }
-  if (fHistTDCZDC)
-  {
-    delete fHistTDCZDC;
-    fHistTDCZDC = 0;
-  }
-  if (fHistTimeZDC)
-  {
-    delete fHistTimeZDC;
-    fHistTimeZDC = 0;
-  }
-  if (fHistTimeCorrZDC)
-  {
-    delete fHistTimeCorrZDC;
-    fHistTimeCorrZDC = 0;
-  }
-
-  if (fHistFMDA)
-  {
-    delete fHistFMDA;
-    fHistFMDA = 0;
-  }
-
-  if (fHistFMDC)
-  {
-    delete fHistFMDC;
-    fHistFMDC = 0;
-  }
-
-  if (fHistFMDSingle)
-  {
-    delete fHistFMDSingle;
-    fHistFMDSingle = 0;
-  }
-
-  if (fHistFMDSum)
-  {
-    delete fHistFMDSum;
-    fHistFMDSum = 0;
-  }
-
-  if (fHistT0)
-  {
-    delete fHistT0;
-    fHistT0 = 0;
-  }
-
-  if (fTriggerClasses)
-  {
-    fTriggerClasses->DeleteAll();
-    delete fTriggerClasses;
-    fTriggerClasses = 0;
-  }
-
-  if (fEsdTrackCuts){
-    delete fEsdTrackCuts;
-    fEsdTrackCuts =0;
-  }
+  if (fHistBitsSPD)      { delete fHistBitsSPD;      fHistBitsSPD = 0;      }
+  if (fHistFiredBitsSPD) { delete fHistFiredBitsSPD; fHistFiredBitsSPD = 0; }
+  if (fHistSPDClsVsTrk)  { delete fHistSPDClsVsTrk;  fHistSPDClsVsTrk = 0;  }
+  if (fHistV0A)          { delete fHistV0A;          fHistV0A = 0;          }
+  if (fHistV0C)          { delete fHistV0C;          fHistV0C = 0;          }
+  if (fHistZDC)          { delete fHistZDC;          fHistZDC = 0;          }
+  if (fHistTDCZDC)       { delete fHistTDCZDC;       fHistTDCZDC = 0;       }
+  if (fHistTimeZDC)      { delete fHistTimeZDC;      fHistTimeZDC = 0;      }
+  if (fHistTimeCorrZDC)  { delete fHistTimeCorrZDC;  fHistTimeCorrZDC = 0;  }
+  if (fHistFMDA)         { delete fHistFMDA;         fHistFMDA = 0;         }
+  if (fHistFMDC)         { delete fHistFMDC;         fHistFMDC = 0;         }
+  if (fHistFMDSingle)    { delete fHistFMDSingle;    fHistFMDSingle = 0;    }
+  if (fHistFMDSum)       { delete fHistFMDSum;       fHistFMDSum = 0;       }
+  if (fHistT0)           { delete fHistT0;           fHistT0 = 0;           }
+  if (fEsdTrackCuts)     { delete fEsdTrackCuts;     fEsdTrackCuts =0;      }
+  if (fTriggerClasses)   { fTriggerClasses->DeleteAll(); delete fTriggerClasses; fTriggerClasses = 0; }
 }
 
-void AliTriggerAnalysis::EnableHistograms(Bool_t isLowFlux)
-{
-  // creates the monitoring histograms (dynamical range of histograms can be adapted for pp and pPb via isLowFlux flag)
+
+//-------------------------------------------------------------------------------------------------
+void AliTriggerAnalysis::EnableHistograms(Bool_t isLowFlux){
+  // creates the monitoring histograms 
+  // dynamical range of histograms can be adapted for pp and pPb via isLowFlux flag)
+  // TODO check limits for FMD
   
-  // do not add this hists to the directory
-  Bool_t oldStatus = TH1::AddDirectoryStatus();
-  TH1::AddDirectory(kFALSE);
-  //
-  Int_t nBins = isLowFlux ? 600 : 1202;
-  fHistBitsSPD = new TH2F("fHistBitsSPD", "SPD GFO;number of fired chips (offline);number of fired chips (hardware)", nBins, -1.5, -1.5 + nBins, nBins, -1.5, -1.5+nBins);
-  //
-  fHistFiredBitsSPD = new TH1F("fHistFiredBitsSPD", "SPD GFO Hardware;chip number;events", 1200, -0.5, 1199.5);
-  //
-  Int_t nBinsX = isLowFlux ? 100  : 300;
-  Int_t nBinsY = isLowFlux ? 500  : 1000;
-  Float_t xMax = isLowFlux ? 400  : 2999.5;
+  Int_t nBins  = isLowFlux ?  600 : 1202;
+  Int_t nBinsX = isLowFlux ?  100 :  300;
+  Int_t nBinsY = isLowFlux ?  500 : 1000;
+  Float_t xMax = isLowFlux ?  400 : 2999.5;
   Float_t yMax = isLowFlux ? 4000 : 9999.5;
-  fHistSPDClsVsTrk = new TH2F("fHistSPDClsVsTrk", "SPD Clusters vs Tracklets; n tracklets; n clusters", nBinsX, -0.5, xMax, nBinsY, -0.5, yMax);
-  //
-  fHistV0A = new TH1F("fHistV0A", "V0A;leading time (ns);events", 400, -100, 100);
-  fHistV0C = new TH1F("fHistV0C", "V0C;leading time (ns);events", 400, -100, 100);
-  fHistZDC = new TH1F("fHistZDC", "ZDC;trigger bits;events", 8, -1.5, 6.5);
-  fHistTDCZDC = new TH1F("fHistTDCZDC", "ZDC;TDC bits;events", 32, -0.5, 32-0.5);
-  fHistTimeZDC = new TH2F("fHistTimeZDC", "ZDC;TDC timing A+C vs C-A; events", 120,-30,30,120,-600,-540);
-  fHistTimeCorrZDC = new TH2F("fHistTimeCorrZDC", "ZDC;Corrected TDC timing A+C vs C-A; events", 120,-30,30,260,-100,30);
-  
-  // TODO check limits
-  fHistFMDA = new TH1F("fHistFMDA", "FMDA;combinations above threshold;events", 102, -1.5, 100.5);
-  fHistFMDC = new TH1F("fHistFMDC", "FMDC;combinations above threshold;events", 102, -1.5, 100.5);
-  fHistFMDSingle = new TH1F("fHistFMDSingle", "FMD single;multiplicity value;counts", 1000, 0, 10);
-  fHistFMDSum = new TH1F("fHistFMDSum", "FMD sum;multiplicity value;counts", 1000, 0, 10);
-  fHistT0 = new TH1F("fHistT0", "T0;time (ns);events", 100, -25, 25);
   
+  // do not add these hists to the directory
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE); 
+  fHistBitsSPD      = new TH2F("fHistBitsSPD", "SPD GFO;number of fired chips (offline);number of fired chips (hardware)", nBins, -1.5, -1.5 + nBins, nBins, -1.5, -1.5+nBins);
+  fHistFiredBitsSPD = new TH1F("fHistFiredBitsSPD", "SPD GFO Hardware;chip number;events", 1200, -0.5, 1199.5);
+  fHistSPDClsVsTrk  = new TH2F("fHistSPDClsVsTrk", "SPD Clusters vs Tracklets; n tracklets; n clusters", nBinsX, -0.5, xMax, nBinsY, -0.5, yMax);
+  fHistV0A          = new TH1F("fHistV0A", "V0A;leading time (ns);events", 400, -100, 100);
+  fHistV0C          = new TH1F("fHistV0C", "V0C;leading time (ns);events", 400, -100, 100);
+  fHistZDC          = new TH1F("fHistZDC", "ZDC;trigger bits;events", 8, -1.5, 6.5);
+  fHistTDCZDC       = new TH1F("fHistTDCZDC", "ZDC;TDC bits;events", 32, -0.5, 32-0.5);
+  fHistTimeZDC      = new TH2F("fHistTimeZDC", "ZDC;TDC timing C-A;TDC timing C+A", 120,-30,30,120,-600,-540);
+  fHistTimeCorrZDC  = new TH2F("fHistTimeCorrZDC", "ZDC;Corrected TDC timing C-A; Corrected TDC timing C+A", 120,-30,30,260,-100,30);
+  fHistFMDA         = new TH1F("fHistFMDA", "FMDA;combinations above threshold;events", 102, -1.5, 100.5);
+  fHistFMDC         = new TH1F("fHistFMDC", "FMDC;combinations above threshold;events", 102, -1.5, 100.5);
+  fHistFMDSingle    = new TH1F("fHistFMDSingle", "FMD single;multiplicity value;counts", 1000, 0, 10);
+  fHistFMDSum       = new TH1F("fHistFMDSum", "FMD sum;multiplicity value;counts", 1000, 0, 10);
+  fHistT0           = new TH1F("fHistT0", "T0;time (ns);events", 100, -25, 25);
   fTriggerClasses = new TMap;
   fTriggerClasses->SetOwner();
-  
   TH1::AddDirectory(oldStatus);
 }
 
-//____________________________________________________________________
-const char* AliTriggerAnalysis::GetTriggerName(Trigger trigger) 
-{
+
+//-------------------------------------------------------------------------------------------------
+const char* AliTriggerAnalysis::GetTriggerName(Trigger trigger){
   // returns the name of the requested trigger
   // the returned string will only be valid until the next call to this function [not thread-safe]
   
@@ -253,914 +168,314 @@ const char* AliTriggerAnalysis::GetTriggerName(Trigger trigger)
   
   UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags;
   
-  switch (triggerNoFlags)
-  {
-    case kAcceptAll : str = "ACCEPT ALL (bypass!)"; break;
-    case kMB1 : str = "MB1"; break;
-    case kMB2 : str = "MB2"; break;
-    case kMB3 : str = "MB3"; break;
-    case kSPDGFO : str = "SPD GFO"; break;
-    case kSPDGFOBits : str = "SPD GFO Bits"; break;
-    case kSPDGFOL0 : str = "SPD GFO L0 (first layer)"; break;
-    case kSPDGFOL1 : str = "SPD GFO L1 (second layer)"; break;
-    case kSPDClsVsTrkBG :  str = "Cluster vs Tracklets"; break;
-    case kV0A : str = "V0 A BB"; break;
-    case kV0C : str = "V0 C BB"; break;
-    case kV0OR : str = "V0 OR BB"; break;
-    case kV0AND : str = "V0 AND BB"; break;
-    case kV0ABG : str = "V0 A BG"; break;
-    case kV0CBG : str = "V0 C BG"; break;
-    case kZDC : str = "ZDC"; break;
-    case kZDCA : str = "ZDC A"; break;
-    case kZDCC : str = "ZDC C"; break;
-    case kZNA : str = "ZN A"; break;
-    case kZNC : str = "ZN C"; break;
-    case kZNABG : str = "ZN A BG"; break;
-    case kZNCBG : str = "ZN C BG"; break;
-    case kFMDA : str = "FMD A"; break;
-    case kFMDC : str = "FMD C"; break;
-    case kFPANY : str = "SPD GFO | V0 | ZDC | FMD"; break;
-    case kNSD1 : str = "NSD1"; break;
-    case kMB1Prime: str = "MB1prime"; break;
-    case kZDCTDCA : str = "ZDC TDC A"; break;
-    case kZDCTDCC : str = "ZDC TDC C"; break;
-    case kZDCTime : str = "ZDC Time Cut"; break;
-    case kCentral : str = "V0 Central"; break;
-    case kSemiCentral : str = "V0 Semi-central"; break;
-    case kEMCAL : str = "EMCAL"; break;
-    case kTRDHCO : str = "TRD cosmics"; break;
-    case kTRDHJT : str = "TRD Jet"; break;
-    case kTRDHSE : str = "TRD Single Electron"; break;
-    case kTRDHQU : str = "TRD Quarkonia"; break;
-    case kTRDHEE : str = "TRD Dielectron"; break;
-    default: str = ""; break;
-  }
-   
-  if (trigger & kOfflineFlag)
-    str += " OFFLINE";  
-  
-  if (trigger & kOneParticle)
-    str += " OneParticle";  
-
-  if (trigger & kOneTrack)
-    str += " OneTrack";  
-
+  switch (triggerNoFlags)  {
+    case kAcceptAll :      str = "ACCEPT ALL (bypass!)";      break;
+    case kMB1 :            str = "MB1";                       break;
+    case kMB2 :            str = "MB2";                       break;
+    case kMB3 :            str = "MB3";                       break;
+    case kSPDGFO :         str = "SPD GFO";                   break;
+    case kSPDGFOBits :     str = "SPD GFO Bits";              break;
+    case kSPDGFOL0 :       str = "SPD GFO L0 (first layer)";  break;
+    case kSPDGFOL1 :       str = "SPD GFO L1 (second layer)"; break;
+    case kSPDClsVsTrkBG :  str = "Cluster vs Tracklets";      break;
+    case kV0A :            str = "V0 A BB";                   break;
+    case kV0C :            str = "V0 C BB";                   break;
+    case kV0OR :           str = "V0 OR BB";                  break;
+    case kV0AND :          str = "V0 AND BB";                 break;
+    case kV0ABG :          str = "V0 A BG";                   break;
+    case kV0CBG :          str = "V0 C BG";                   break;
+    case kZDC :            str = "ZDC";                       break;
+    case kZDCA :           str = "ZDC A";                     break;
+    case kZDCC :           str = "ZDC C";                     break;
+    case kZNA :            str = "ZN A";                      break;
+    case kZNC :            str = "ZN C";                      break;
+    case kZNABG :          str = "ZN A BG";                   break;
+    case kZNCBG :          str = "ZN C BG";                   break;
+    case kFMDA :           str = "FMD A";                     break;
+    case kFMDC :           str = "FMD C";                     break;
+    case kFPANY :          str = "SPD GFO | V0 | ZDC | FMD";  break;
+    case kNSD1 :           str = "NSD1";                      break;
+    case kMB1Prime:        str = "MB1prime";                  break;
+    case kZDCTDCA :        str = "ZDC TDC A";                 break;
+    case kZDCTDCC :        str = "ZDC TDC C";                 break;
+    case kZDCTime :        str = "ZDC Time Cut";              break;
+    case kCentral :        str = "V0 Central";                break;
+    case kSemiCentral :    str = "V0 Semi-central";           break;
+    case kEmcalL0 :        str = "EMCAL";                     break;
+    case kTRDHCO :         str = "TRD cosmics";               break;
+    case kTRDHJT :         str = "TRD Jet";                   break;
+    case kTRDHSE :         str = "TRD Single Electron";       break;
+    case kTRDHQU :         str = "TRD Quarkonia";             break;
+    case kTRDHEE :         str = "TRD Dielectron";            break;
+    default:               str = "";                          break;
+  }
+  if (trigger & kOfflineFlag) str += " OFFLINE";  
+  if (trigger & kOneParticle) str += " OneParticle";  
+  if (trigger & kOneTrack)    str += " OneTrack";  
   return str;
 }
 
-Bool_t AliTriggerAnalysis::IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger)
-{
-  // checks if an event has been triggered
 
-  if (trigger & kOfflineFlag)
-    return IsOfflineTriggerFired(aEsd, trigger);
-    
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger){
+  // checks if an event has been triggered
+  if (trigger & kOfflineFlag) return IsOfflineTriggerFired(aEsd, trigger);
   return IsTriggerBitFired(aEsd, trigger);
 }
 
-Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const
-{
-  // checks if an event is fired using the trigger bits
 
-  return IsTriggerBitFired(aEsd->GetTriggerMask(), trigger);
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* /*aEsd*/, Trigger /*trigger*/) const { 
+  AliFatal("This IsTriggerBitFired function is obsolete.\n"); 
+  return 0; 
 }
 
-Bool_t AliTriggerAnalysis::IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const
-{
-  // checks if an event is fired using the trigger bits
-  //
-  // this function needs the branch TriggerMask in the ESD
-  
-  // definitions from p-p.cfg
-  ULong64_t spdFO = (1 << 14);
-  ULong64_t v0left = (1 << 10);
-  ULong64_t v0right = (1 << 11);
-
-  switch (trigger)
-  {
-    case kAcceptAll:
-    {
-      return kTRUE;
-      break;
-    }
-    case kMB1:
-    {
-      if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right)))
-        return kTRUE;
-      break;
-    }
-    case kMB2:
-    {
-      if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
-        return kTRUE;
-      break;
-    }
-    case kMB3:
-    {
-      if (triggerMask & spdFO && (triggerMask & v0left) && (triggerMask & v0right))
-        return kTRUE;
-      break;
-    }
-    case kSPDGFO:
-    {
-      if (triggerMask & spdFO)
-        return kTRUE;
-      break;
-    }
-    default:
-      Printf("IsEventTriggered: ERROR: Trigger type %d not implemented in this method", (Int_t) trigger);
-      break;
-  }
-
-  return kFALSE;
-}
 
-Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const
-{
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const {
   // Checks if corresponding bit in mask is on
-  
   ULong64_t trigmask = aEsd->GetTriggerMask();
   return (trigmask & (1ull << (tclass-1)));
 }
-  
-Int_t AliTriggerAnalysis::EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger)
-{
-  // evaluates a given trigger "offline"
+
+
+//-------------------------------------------------------------------------------------------------
+Int_t AliTriggerAnalysis::EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger){
+  // evaluates a given trigger
   // trigger combinations are not supported, for that see IsOfflineTriggerFired
-  
+
   UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags;
-  Bool_t offline = kFALSE;
-  if (trigger & kOfflineFlag)
-    offline = kTRUE;
-  
-  Int_t decision = 0;
-  switch (triggerNoFlags)
-  {
-    case kSPDGFO:
-    {
-      decision = SPDFiredChips(aEsd, (offline) ? 0 : 1);
-      break;
-    }
-    case kSPDGFOL0:
-    {
-      decision = SPDFiredChips(aEsd, (offline) ? 0 : 1, kFALSE, 1);
-      break;
-    }
-    case kSPDGFOL1:
-    {
-      decision = SPDFiredChips(aEsd, (offline) ? 0 : 1, kFALSE, 2);
-      break;
-    } 
-    case kSPDClsVsTrkBG:
-    {
-      if(!offline) 
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      decision = IsSPDClusterVsTrackletBG(aEsd);
-      break;
-    }
-    case kV0A:
-    {
-      if (V0Trigger(aEsd, kASide, !offline) == kV0BB)
-        decision = 1;
-      break;
-    }
-    case kV0C:
-    {
-      if (V0Trigger(aEsd, kCSide, !offline) == kV0BB)
-        decision = 1;
-      break;
-    }
-    case kV0ABG:
-    {
-      if (V0Trigger(aEsd, kASide, !offline) == kV0BG)
-        decision = 1;
-      break;
-    }
-    case kV0CBG:
-    {
-      if (V0Trigger(aEsd, kCSide, !offline) == kV0BG)
-        decision = 1;
-      break;
-    }
-    case kT0:
-    {
-      if (T0Trigger(aEsd, !offline) == kT0BB)
-        decision = 1;
-      break;
-    }
-    case kT0BG:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (T0Trigger(aEsd, !offline) == kT0DecBG)
-        decision = 1;
-      break;
-    }
-    case kT0Pileup:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (T0Trigger(aEsd, !offline) == kT0DecPileup)
-        decision = 1;
-      break;
-    }
-    case kZDCA:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTrigger(aEsd, kASide))
-        decision = 1;
-      break;
-    }
-    case kZDCC:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTrigger(aEsd, kCSide))
-        decision = 1;
-      break;
-    }
-    case kZDCTDCA:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTDCTrigger(aEsd, kASide))
-        decision = 1;
-      break;
-    }
-    case kZDCTDCC:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTDCTrigger(aEsd, kCSide))
-        decision = 1;
-      break;
-    }
-    case kZDCTime:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTimeTrigger(aEsd))
-        decision = 1;
-      break;
-    }
-    case kZNA:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE))
-       decision = 1;
-      break;
-    }
-    case kZNC:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE))
-       decision = 1;
-      break;
-    }
-    case kZNABG:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTimeBGTrigger(aEsd,kASide))
-       decision = 1;
-      break;
-    }
-    case kZNCBG:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (ZDCTimeBGTrigger(aEsd,kCSide))
-       decision = 1;
-      break;
-    }
-    case kFMDA:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (FMDTrigger(aEsd, kASide))
-        decision = 1;
-      break;
-    }
-    case kFMDC:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (FMDTrigger(aEsd, kCSide))
-        decision = 1;
-      break;
-    }
-    case kCTPV0A:
-    {
-      if (offline)
-        AliFatal(Form("Offline trigger not available for trigger %d", triggerNoFlags));
-      if (IsL0InputFired(aEsd, 2))
-        decision = 1;
-      break;
-    }
-    case kCTPV0C:
-    {
-      if (offline)
-        AliFatal(Form("Offline trigger not available for trigger %d", triggerNoFlags));
-      if (IsL0InputFired(aEsd, 3))
-        decision = 1;
-      break;
-    }
-    case kTPCLaserWarmUp:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      return IsLaserWarmUpTPCEvent(aEsd);
-    }
-    case kTPCHVdip:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      return IsHVdipTPCEvent(aEsd);
-    }
-    case kIncompleteEvent:
-    {
-      if (!offline)
-        AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      return IsIncompleteEvent(aEsd);
-    }
-    case kCentral:
-    {
-      if (offline)
-        AliFatal(Form("Offline trigger not available for trigger %d - use centrality selection", triggerNoFlags));
-      if (aEsd->GetVZEROData()) {
-       if (aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) {
-         if (aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA2andCTC2))
-           decision = kTRUE;
-       }
-       else
-         AliWarning("V0 centrality trigger bits were not filled!");
-      }
-      break;
-    }
-    case kSemiCentral:
-    {
-      if (offline)
-        AliFatal(Form("Offline trigger not available for trigger %d - use centrality selection", triggerNoFlags));
-      if (aEsd->GetVZEROData()) {
-       if (aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) {
-         if (aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA1andCTC1))
-           decision = kTRUE;
-       }
-       else
-         AliWarning("V0 centrality trigger bits were not filled!");
-      }
-      break;
-    }
-  case kEMCAL:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if (EMCALCellsTrigger(aEsd)) 
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHCO:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if(TRDTrigger(aEsd,kTRDHCO))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHJT:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if(TRDTrigger(aEsd,kTRDHJT))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHSE:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if(TRDTrigger(aEsd,kTRDHSE))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHQU:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if(TRDTrigger(aEsd,kTRDHQU))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHEE:
-    {
-      if(!offline) 
-       AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
-      if(TRDTrigger(aEsd,kTRDHEE))
-       decision = kTRUE;
-      break;
-    }
-    default:
-    {
-      AliFatal(Form("Trigger type %d not implemented", triggerNoFlags));
-    }
-  }  
+  Bool_t offline = trigger & kOfflineFlag;
   
-  return decision;
-}
-
-Bool_t AliTriggerAnalysis::IsLaserWarmUpTPCEvent(const AliESDEvent* esd)
-{
-  //
-  // This function flags noisy TPC events which can happen during laser warm-up.
-  //
+  if (!offline) {
+    if ( triggerNoFlags==kT0BG
+      || triggerNoFlags==kT0Pileup
+      || triggerNoFlags==kSPDClsVsTrkBG
+      || triggerNoFlags==kZDCA
+      || triggerNoFlags==kZDCC
+      || triggerNoFlags==kZDCTDCA
+      || triggerNoFlags==kZDCTDCC
+      || triggerNoFlags==kZDCTime
+      || triggerNoFlags==kZNA
+      || triggerNoFlags==kZNC
+      || triggerNoFlags==kZNABG
+      || triggerNoFlags==kZNCBG
+      || triggerNoFlags==kFMDA
+      || triggerNoFlags==kFMDC
+      || triggerNoFlags==kTPCLaserWarmUp
+      || triggerNoFlags==kTPCHVdip
+      || triggerNoFlags==kIncompleteEvent
+      || triggerNoFlags==kEMCAL
+      || triggerNoFlags==kEmcalL0
+      || triggerNoFlags==kEmcalL1GammaHigh
+      || triggerNoFlags==kEmcalL1GammaLow
+      || triggerNoFlags==kEmcalL1JetHigh
+      || triggerNoFlags==kEmcalL1JetLow
+      || triggerNoFlags==kTRDHCO
+      || triggerNoFlags==kTRDHJT
+      || triggerNoFlags==kTRDHSE
+      || triggerNoFlags==kTRDHQU
+      || triggerNoFlags==kTRDHEE
+      ) AliFatal(Form("Online trigger not available for trigger %d", triggerNoFlags));
+  } else {
+    if (  triggerNoFlags==kCTPV0A 
+        ||triggerNoFlags==kCTPV0C
+        ||triggerNoFlags==kCentral
+        ||triggerNoFlags==kSemiCentral
+      ) AliFatal(Form("Offline trigger not available for trigger %d", triggerNoFlags));
+  }
   
-  Int_t trackCounter = 0;
-  for (Int_t i=0; i<esd->GetNumberOfTracks(); ++i) 
-  {
-    AliESDtrack *track = esd->GetTrack(i);
-    if (!track) 
-      continue;
-      
-    if (track->GetTPCNcls() < 30) continue;
-    if (TMath::Abs(track->Eta()) > 0.005) continue;
-    if (track->Pt() < 4) continue;
-    if (track->GetKinkIndex(0) > 0) continue;
-    
-    UInt_t status = track->GetStatus();
-    if ((status&AliESDtrack::kITSrefit)==AliESDtrack::kITSrefit) continue; // explicitly ask for tracks without ITS refit
-    if ((status&AliESDtrack::kTPCrefit)!=AliESDtrack::kTPCrefit) continue;
-    
-    if (track->GetTPCsignal() > 10) continue;          // explicitly ask for tracks without dE/dx
-    
-    trackCounter++;
+  switch (triggerNoFlags) {
+    case kCTPV0A:          return aEsd->GetHeader()->IsTriggerInputFired("V0A");
+    case kCTPV0C:          return aEsd->GetHeader()->IsTriggerInputFired("V0C");
+    case kSPDGFO:          return SPDFiredChips(aEsd, !offline, kFALSE, 0); 
+    case kSPDGFOL0:        return SPDFiredChips(aEsd, !offline, kFALSE, 1);
+    case kSPDGFOL1:        return SPDFiredChips(aEsd, !offline, kFALSE, 2);
+    case kSPDClsVsTrkBG:   return IsSPDClusterVsTrackletBG(aEsd);
+    case kV0A:             return V0Trigger(aEsd, kASide, !offline) == kV0BB; 
+    case kV0C:             return V0Trigger(aEsd, kCSide, !offline) == kV0BB;
+    case kV0ABG:           return V0Trigger(aEsd, kASide, !offline) == kV0BG;
+    case kV0CBG:           return V0Trigger(aEsd, kCSide, !offline) == kV0BG;
+    case kT0:              return T0Trigger(aEsd, !offline) == kT0BB;
+    case kT0BG:            return T0Trigger(aEsd, !offline) == kT0DecBG;
+    case kT0Pileup:        return T0Trigger(aEsd, !offline) == kT0DecPileup;
+    case kZDCA:            return ZDCTrigger(aEsd, kASide);
+    case kZDCC:            return ZDCTrigger(aEsd, kCSide);
+    case kZDCTDCA:         return ZDCTDCTrigger(aEsd, kASide);
+    case kZDCTDCC:         return ZDCTDCTrigger(aEsd, kCSide);
+    case kZDCTime:         return ZDCTimeTrigger(aEsd);
+    case kZNA:             return ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE);
+    case kZNC:             return ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE);
+    case kZNABG:           return ZDCTimeBGTrigger(aEsd,kASide);
+    case kZNCBG:           return ZDCTimeBGTrigger(aEsd,kCSide);
+    case kFMDA:            return FMDTrigger(aEsd, kASide);
+    case kFMDC:            return FMDTrigger(aEsd, kCSide);
+    case kTPCLaserWarmUp:  return IsLaserWarmUpTPCEvent(aEsd);
+    case kTPCHVdip:        return IsHVdipTPCEvent(aEsd);
+    case kIncompleteEvent: return IsIncompleteEvent(aEsd);
+    case kEMCAL:           return EMCALCellsTrigger(aEsd);
+    case kEmcalL0:         return EMCALTrigger(aEsd,kEmcalL0);
+    case kEmcalL1GammaHigh:return EMCALTrigger(aEsd,kEmcalL1GammaHigh);
+    case kEmcalL1GammaLow: return EMCALTrigger(aEsd,kEmcalL1GammaLow);
+    case kEmcalL1JetHigh:  return EMCALTrigger(aEsd,kEmcalL1JetHigh);
+    case kEmcalL1JetLow:   return EMCALTrigger(aEsd,kEmcalL1JetLow);
+    case kTRDHCO:          return TRDTrigger(aEsd,kTRDHCO);
+    case kTRDHJT:          return TRDTrigger(aEsd,kTRDHJT);
+    case kTRDHSE:          return TRDTrigger(aEsd,kTRDHSE);
+    case kTRDHQU:          return TRDTrigger(aEsd,kTRDHQU);
+    case kTRDHEE:          return TRDTrigger(aEsd,kTRDHEE);
+    case kCentral: {
+      if (!aEsd->GetVZEROData()) { AliWarning("V0 centrality trigger bits were not filled!"); return kFALSE; }
+      if (!aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) return kFALSE;
+      return aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA2andCTC2);
+    }
+    case kSemiCentral: {
+      if (!aEsd->GetVZEROData()) { AliWarning("V0 centrality trigger bits were not filled!"); return kFALSE; }
+      if (!aEsd->GetVZEROData()->TestBit(AliESDVZERO::kTriggerChargeBitsFilled)) return kFALSE;
+      return aEsd->GetVZEROData()->GetTriggerBits() & (1<<AliESDVZERO::kCTA1andCTC1);
+    }
+    default: AliFatal(Form("Trigger type %d not implemented", triggerNoFlags));
   }
-  if (trackCounter > 15) 
-    return kTRUE;
   return kFALSE;
 }
 
-Bool_t AliTriggerAnalysis::IsHVdipTPCEvent(const AliESDEvent* esd) {
-  //
-  // This function flags events in which the TPC chamber HV is not at its nominal value
-  //
-  if (fMC) return kFALSE; // there are no dip events in MC
-  if (!esd->IsDetectorOn(AliDAQ::kTPC)) return kTRUE;
-  return kFALSE;
-
-}
 
-Bool_t AliTriggerAnalysis::IsIncompleteEvent(const AliESDEvent* esd) 
-{
-  //
-  // Check whether the event is incomplete 
-  // (due to DAQ-HLT issues, it could be only part of the event was saved)
-  //
-  if (fMC) return kFALSE; // there are no incomplete events on MC
-  if ((esd->GetEventType() == 7) &&
-      (esd->GetDAQDetectorPattern() & (1<<4)) &&
-     !(esd->GetDAQAttributes() & (1<<7))) return kTRUE;
-
-  return kFALSE;
-}
-
-
-Bool_t AliTriggerAnalysis::IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger)
-{
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger){
   // checks if an event has been triggered "offline"
-
   UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) kStartOfFlags;
   
   Bool_t decision = kFALSE;
-  switch (triggerNoFlags)
-  {
-    case kAcceptAll:
-    {
-      decision = kTRUE;
-      break;
-    }
-    case kMB1:
-    {
-      if (SPDGFOTrigger(aEsd, 0) || V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kMB2:
-    {
-      if (SPDGFOTrigger(aEsd, 0) && (V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB))
-        decision = kTRUE;
-      break;
-    }
-    case kMB3:
-    {
-      if (SPDGFOTrigger(aEsd, 0) && V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kSPDGFO:
-    {
-      if (SPDGFOTrigger(aEsd, 0))
-        decision = kTRUE;
-      break;
-    }
-    case kSPDGFOBits:
-    {
-      if (SPDGFOTrigger(aEsd, 1))
-        decision = kTRUE;
-      break;
-    }
-    case kV0A:
-    {
-      if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kV0C:
-    {
-      if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kV0OR:
-    {
-      if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kV0AND:
-    {
-      if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        decision = kTRUE;
-      break;
-    }
-    case kV0ABG:
-    {
-      if (V0Trigger(aEsd, kASide, kFALSE) == kV0BG)
-        decision = kTRUE;
-      break;
-    }
-    case kV0CBG:
-    {
-      if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BG)
-        decision = kTRUE;
-      break;
-    }
-    case kZDC:
-    {
-      if (ZDCTrigger(aEsd, kASide) || ZDCTrigger(aEsd, kCentralBarrel) || ZDCTrigger(aEsd, kCSide))
-        decision = kTRUE;
-      break;
-    }
-    case kZDCA:
-    {
-      if (ZDCTrigger(aEsd, kASide))
-        decision = kTRUE;
-      break;
-    }
-    case kZDCC:
-    {
-      if (ZDCTrigger(aEsd, kCSide))
-        decision = kTRUE;
-      break;
-    }
-    case kZNA:
-    {
-      if (ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE))
-       decision = kTRUE;
-      break;
-    }
-    case kZNC:
-    {
-      if (ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE))
-       decision = kTRUE;
-      break;
-    }
-    case kZNABG:
-    {
-      if (ZDCTimeBGTrigger(aEsd,kASide))
-       decision = kTRUE;
-      break;
-    }
-    case kZNCBG:
-    {
-      if (ZDCTimeBGTrigger(aEsd,kCSide))
-       decision = kTRUE;
-      break;
-    }
-    case kFMDA:
-    {
-      if (FMDTrigger(aEsd, kASide))
-        decision = kTRUE;
-      break;
-    }
-    case kFMDC:
-    {
-      if (FMDTrigger(aEsd, kCSide))
-        decision = kTRUE;
-      break;
-    }
-    case kFPANY:
-    {
-      if (SPDGFOTrigger(aEsd, 0) || V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB || ZDCTrigger(aEsd, kASide) || ZDCTrigger(aEsd, kCentralBarrel) || ZDCTrigger(aEsd, kCSide) || FMDTrigger(aEsd, kASide) || FMDTrigger(aEsd, kCSide))
-        decision = kTRUE;
-      break;
-    }
-    case kNSD1:
-    {
-      if (SPDFiredChips(aEsd, 0) >= 5 || (V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB))
-        decision = kTRUE;
-       break;
-    }
-    case kMB1Prime:
-    {
-      Int_t count = 0;
-      if (SPDGFOTrigger(aEsd, 0))
-        count++;
-      if (V0Trigger(aEsd, kASide, kFALSE) == kV0BB)
-        count++;
-      if (V0Trigger(aEsd, kCSide, kFALSE) == kV0BB)
-        count++;
-      
-      if (count >= 2)
-        decision = kTRUE;
-        
-      break;
-    }
-  case kEMCAL:
-    {
-      if (EMCALCellsTrigger(aEsd))
-       decision = kTRUE;
-      break;
-    }  
-  case kTRDHCO:
-    {
-      if(TRDTrigger(aEsd,kTRDHCO))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHJT:
-    {
-      if(TRDTrigger(aEsd,kTRDHJT))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHSE:
-    {
-      if(TRDTrigger(aEsd,kTRDHSE))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHQU:
-    {
-      if(TRDTrigger(aEsd,kTRDHQU))
-       decision = kTRUE;
-      break;
-    }
-  case kTRDHEE:
-    {
-      if(TRDTrigger(aEsd,kTRDHEE))
-       decision = kTRUE;
-      break;
-    }
-  default:
-      {
-      AliFatal(Form("Trigger type %d not implemented", triggerNoFlags));
-    }
+  switch (triggerNoFlags) {
+    case kAcceptAll:        decision = kTRUE; break;
+    case kMB1:              decision = SPDGFOTrigger(aEsd, 0) ||  V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB;  break;
+    case kMB2:              decision = SPDGFOTrigger(aEsd, 0) && (V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB); break;
+    case kMB3:              decision = SPDGFOTrigger(aEsd, 0) &&  V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB;  break;
+    case kSPDGFO:           decision = SPDGFOTrigger(aEsd, 0); break;
+    case kSPDGFOBits:       decision = SPDGFOTrigger(aEsd, 1); break;
+    case kV0A:              decision = V0Trigger(aEsd, kASide, kFALSE) == kV0BB; break;
+    case kV0C:              decision = V0Trigger(aEsd, kCSide, kFALSE) == kV0BB; break;
+    case kV0OR:             decision = V0Trigger(aEsd, kASide, kFALSE) == kV0BB || V0Trigger(aEsd, kCSide, kFALSE) == kV0BB; break;
+    case kV0AND:            decision = V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB; break;
+    case kV0ABG:            decision = V0Trigger(aEsd, kASide, kFALSE) == kV0BG; break;
+    case kV0CBG:            decision = V0Trigger(aEsd, kCSide, kFALSE) == kV0BG; break;
+    case kZDC:              decision = ZDCTrigger(aEsd, kASide) || ZDCTrigger(aEsd, kCentralBarrel) || ZDCTrigger(aEsd, kCSide); break;
+    case kZDCA:             decision = ZDCTrigger(aEsd, kASide); break;
+    case kZDCC:             decision = ZDCTrigger(aEsd, kCSide); break;
+    case kZNA:              decision = ZDCTDCTrigger(aEsd,kASide,kTRUE,kFALSE,kFALSE); break;
+    case kZNC:              decision = ZDCTDCTrigger(aEsd,kCSide,kTRUE,kFALSE,kFALSE); break;
+    case kZNABG:            decision = ZDCTimeBGTrigger(aEsd,kASide); break;
+    case kZNCBG:            decision = ZDCTimeBGTrigger(aEsd,kCSide); break;
+    case kFMDA:             decision = FMDTrigger(aEsd, kASide); break;
+    case kFMDC:             decision = FMDTrigger(aEsd, kCSide); break;
+    case kEMCAL:            decision = EMCALCellsTrigger(aEsd); break;
+    case kEmcalL0:          decision = EMCALTrigger(aEsd,kEmcalL0);          break;
+    case kEmcalL1GammaHigh: decision = EMCALTrigger(aEsd,kEmcalL1GammaHigh); break;
+    case kEmcalL1GammaLow:  decision = EMCALTrigger(aEsd,kEmcalL1GammaLow);  break;
+    case kEmcalL1JetHigh:   decision = EMCALTrigger(aEsd,kEmcalL1JetHigh);   break;
+    case kEmcalL1JetLow:    decision = EMCALTrigger(aEsd,kEmcalL1JetLow);    break;
+    case kTRDHCO:           decision = TRDTrigger(aEsd,kTRDHCO); break;
+    case kTRDHJT:           decision = TRDTrigger(aEsd,kTRDHJT); break;
+    case kTRDHSE:           decision = TRDTrigger(aEsd,kTRDHSE); break;
+    case kTRDHQU:           decision = TRDTrigger(aEsd,kTRDHQU); break;
+    case kTRDHEE:           decision = TRDTrigger(aEsd,kTRDHEE); break;
+    case kNSD1:             decision = SPDFiredChips(aEsd, 0) >= 5 || (V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB); break;
+    case kFPANY:            decision |= SPDGFOTrigger(aEsd, 0); 
+                            decision |= V0Trigger(aEsd, kASide, kFALSE) == kV0BB;
+                            decision |= V0Trigger(aEsd, kCSide, kFALSE) == kV0BB;
+                            decision |= ZDCTrigger(aEsd, kASide);
+                            decision |= ZDCTrigger(aEsd, kCentralBarrel);
+                            decision |= ZDCTrigger(aEsd, kCSide);
+                            decision |= FMDTrigger(aEsd, kASide);
+                            decision |= FMDTrigger(aEsd, kCSide);
+                            break; 
+    case kMB1Prime:         decision |= SPDGFOTrigger(aEsd, 0) && V0Trigger(aEsd, kASide, kFALSE) == kV0BB;
+                            decision |= SPDGFOTrigger(aEsd, 0) && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB;
+                            decision |= V0Trigger(aEsd, kASide, kFALSE) == kV0BB && V0Trigger(aEsd, kCSide, kFALSE) == kV0BB;
+                            break; 
+    default:                AliFatal(Form("Trigger type %d not implemented", triggerNoFlags));
   }
   
-  // hadron-level requirement
-  if (decision && (trigger & kOneParticle))
-  {
+  // hadron-level requirement: SPD tracklets
+  if (decision && (trigger & kOneParticle))  {
     decision = kFALSE;
     
     const AliESDVertex* vertex = aEsd->GetPrimaryVertexSPD();
     const AliMultiplicity* mult = aEsd->GetMultiplicity();
-
-    if (mult && vertex && vertex->GetNContributors() > 0 && (!vertex->IsFromVertexerZ() || vertex->GetDispersion() < 0.02) && TMath::Abs(vertex->GetZv()) < 5.5) 
-    {
-      for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i)
-      {
-        if (TMath::Abs(mult->GetEta(i)) < 1)
-        {
+    
+    if (mult && vertex && vertex->GetNContributors() > 0 && (!vertex->IsFromVertexerZ() || vertex->GetDispersion() < 0.02) && TMath::Abs(vertex->GetZv()) < 5.5)    {
+      for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i) {
+        if (TMath::Abs(mult->GetEta(i)) < 1) {
           decision = kTRUE;
           break;
         }
       }
     }
   }
-
-  // hadron level definition for TPC tracks
-
-  if (decision && (trigger & kOneTrack))
-  {
+  
+  // hadron level requirement: TPC tracks
+  if (decision && (trigger & kOneTrack)) {
     decision = kFALSE;
     const AliESDVertex* vertex =0x0;
     vertex = aEsd->GetPrimaryVertexTracks();
-    if (!vertex || vertex->GetNContributors() <= 0)
-    {
-      vertex = aEsd->GetPrimaryVertexSPD();
-    }
+    if (!vertex || vertex->GetNContributors() <= 0) vertex = aEsd->GetPrimaryVertexSPD();
     Float_t ptmin, ptmax;
     fEsdTrackCuts->GetPtRange(ptmin,ptmax);
     AliDebug(3, Form("ptmin = %f, ptmax = %f\n",ptmin, ptmax));
-
+    
     if (vertex && vertex->GetNContributors() > 0 && (!vertex->IsFromVertexerZ() || vertex->GetDispersion() < 0.02) && TMath::Abs(vertex->GetZv()) < 10.) {
       AliDebug(3,Form("Check on the vertex passed\n"));
       for (Int_t i=0; i<aEsd->GetNumberOfTracks(); ++i){
-       if (fTPCOnly == kFALSE){
+        if (fTPCOnly == kFALSE){
           if (fEsdTrackCuts->AcceptTrack(aEsd->GetTrack(i))){
-           AliDebug(2, Form("pt of track = %f --> check passed\n",aEsd->GetTrack(i)->Pt()));
-           decision = kTRUE;
-            break;
+            AliDebug(2, Form("pt of track = %f --> check passed\n",aEsd->GetTrack(i)->Pt()));
+            decision = kTRUE;
+            break;
+          }
+        }
+        else {
+          // TPC only tracks
+          AliESDtrack *tpcTrack = fEsdTrackCuts->GetTPCOnlyTrack((AliESDEvent*)aEsd, i);
+          if (!tpcTrack){
+            AliDebug(3,Form("track %d is NOT a TPC track",i));
+            continue;
           }
-       }
-       else {
-         // TPC only tracks
-         AliESDtrack *tpcTrack = fEsdTrackCuts->GetTPCOnlyTrack((AliESDEvent*)aEsd, i);
-         if (!tpcTrack){
-           AliDebug(3,Form("track %d is NOT a TPC track",i));
-           continue;
-         }
-         else{
-           AliDebug(3,Form("track %d IS a TPC track",i));
-           if (!(fEsdTrackCuts->AcceptTrack(tpcTrack))) {
-             AliDebug(2, Form("TPC track %d NOT ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta()));
-             delete tpcTrack; tpcTrack = 0x0;
-             continue;
-           } // end if the TPC track is not accepted
-           else{
-             AliDebug(2, Form("TPC track %d ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta()));
-             decision = kTRUE;
-             delete tpcTrack; tpcTrack = 0x0;
-             break;
-           } // end if the TPC track is accepted
-         } // end if it is a TPC track
-       } // end if you are looking at TPC only tracks                  
+          else{
+            AliDebug(3,Form("track %d IS a TPC track",i));
+            if (!(fEsdTrackCuts->AcceptTrack(tpcTrack))) {
+              AliDebug(2, Form("TPC track %d NOT ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta()));
+              delete tpcTrack; tpcTrack = 0x0;
+              continue;
+            } // end if the TPC track is not accepted
+            else{
+              AliDebug(2, Form("TPC track %d ACCEPTED, pt = %f, eta = %f",i,tpcTrack->Pt(), tpcTrack->Eta()));
+              decision = kTRUE;
+              delete tpcTrack; tpcTrack = 0x0;
+              break;
+            } // end if the TPC track is accepted
+          } // end if it is a TPC track
+        } // end if you are looking at TPC only tracks                 
       } // end loop on tracks
     } // end check on vertex
     else{
       AliDebug(4,Form("Check on the vertex not passed\n"));
       for (Int_t i=0; i<aEsd->GetNumberOfTracks(); ++i){
         if (fEsdTrackCuts->AcceptTrack(aEsd->GetTrack(i))){
-         AliDebug(4,Form("pt of track = %f --> check would be passed if the vertex was ok\n",aEsd->GetTrack(i)->Pt()));
-         break;
-       }
+          AliDebug(4,Form("pt of track = %f --> check would be passed if the vertex was ok\n",aEsd->GetTrack(i)->Pt()));
+          break;
+        }
       }
     }
     if (!decision) AliDebug(3,("Check for kOneTrack NOT passed\n"));
   }
-
-  return decision;
-}
-
-Bool_t AliTriggerAnalysis::IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const 
-{
-  // tclass is logical function of inputs, e.g. 01 && 02 || 03 && 11 && 21
-  // = L0 inp 1 && L0 inp 2 || L0 inp 3 && L1 inp 1 && L2 inp 1
-  // NO brackets in logical function !
-  // Spaces between operators and inputs.
-  // Not all logical functions are available in CTP= 
-  // =any function of first 4 inputs; 'AND' of other inputs, check not done
-  // This method will be replaced/complemened by similar one
-  // which works withh class and inputs names as in CTP cfg file
-  
-  TString TClass(tclass);
-  TObjArray* tcltokens = TClass.Tokenize(" ");
-  Char_t level=((TObjString*)tcltokens->At(0))->String()[0];
-  UInt_t input=atoi((((TObjString*)tcltokens->At(0))->String()).Remove(0));
-  Bool_t tcl = IsInputFired(aEsd,level,input);
-  for (Int_t i=1;i<tcltokens->GetEntriesFast();i=i+2) {
-    level=((TObjString*)tcltokens->At(i+1))->String()[0];
-    input=atoi((((TObjString*)tcltokens->At(i+1))->String()).Remove(0));
-    Bool_t inpnext = IsInputFired(aEsd,level,input);
-    Char_t op =((TObjString*)tcltokens->At(i))->String()[0];
-    if (op == '&') tcl=tcl && inpnext;
-    else if (op == '|') tcl =tcl || inpnext;
-    else {
-       AliError(Form("Syntax error in %s", tclass));
-       delete tcltokens;
-       tcltokens = 0;
-       //      tcltokens->Delete();
-       return kFALSE;
-    }
-  }
-  delete tcltokens;
-  tcltokens = 0;
-       //  tcltokens->Delete();
-  return tcl;
-}
-
-Bool_t AliTriggerAnalysis::IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const
-{
-  // Checks trigger input of any level
-  
-  switch (level)
-  {
-    case '0': return IsL0InputFired(aEsd,input);
-    case '1': return IsL1InputFired(aEsd,input);
-    case '2': return IsL2InputFired(aEsd,input);
-    default:
-      AliError(Form("Wrong level %i",level));
-      return kFALSE;
-  }
-}
-
-Bool_t AliTriggerAnalysis::IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const 
-{
-  // Checks if corresponding bit in mask is on
-  
-  UInt_t inpmask = aEsd->GetHeader()->GetL0TriggerInputs();
-  return (inpmask & (1<<(input-1)));
-}
-
-Bool_t AliTriggerAnalysis::IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const
-{
-  // Checks if corresponding bit in mask is on
-  
-  UInt_t inpmask = aEsd->GetHeader()->GetL1TriggerInputs();
-  return (inpmask & (1<<(input-1)));
-}
-
-Bool_t AliTriggerAnalysis::IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const 
-{
-  // Checks if corresponding bit in mask is on
-  
-  UInt_t inpmask = aEsd->GetHeader()->GetL2TriggerInputs();
-  return (inpmask & (1<<(input-1)));
-}
-
-void AliTriggerAnalysis::FillHistograms(const AliESDEvent* aEsd) 
-{
-  // fills the histograms with the info from the ESD
-  
-  fHistBitsSPD->Fill(SPDFiredChips(aEsd, 0), SPDFiredChips(aEsd, 1, kTRUE));
   
-  V0Trigger(aEsd, kASide, kFALSE, kTRUE);
-  V0Trigger(aEsd, kCSide, kFALSE, kTRUE);
-  T0Trigger(aEsd, kFALSE, kTRUE);
-  ZDCTDCTrigger(aEsd,kASide,kFALSE,kFALSE,kTRUE);
-  ZDCTimeTrigger(aEsd,kTRUE);
-  IsSPDClusterVsTrackletBG(aEsd, kTRUE);
-
-  AliESDZDC* zdcData = aEsd->GetESDZDC();
-  if (zdcData)
-  {
-    UInt_t quality = zdcData->GetESDQuality();
-    
-    // from Nora's presentation, general first physics meeting 16.10.09
-    static UInt_t zpc  = 0x20;
-    static UInt_t znc  = 0x10;
-    static UInt_t zem1 = 0x08;
-    static UInt_t zem2 = 0x04;
-    static UInt_t zpa  = 0x02;
-    static UInt_t zna  = 0x01;
-   
-    fHistZDC->Fill(1, (quality & zna)  ? 1 : 0);
-    fHistZDC->Fill(2, (quality & zpa)  ? 1 : 0);
-    fHistZDC->Fill(3, (quality & zem2) ? 1 : 0);
-    fHistZDC->Fill(4, (quality & zem1) ? 1 : 0);
-    fHistZDC->Fill(5, (quality & znc)  ? 1 : 0);
-    fHistZDC->Fill(6, (quality & zpc)  ? 1 : 0);
-  }
-  else
-  {
-    fHistZDC->Fill(-1);
-    AliError("AliESDZDC not available");
-  }
-  
-  if (fDoFMD) {
-    fHistFMDA->Fill(FMDHitCombinations(aEsd, kASide, kTRUE));
-    fHistFMDC->Fill(FMDHitCombinations(aEsd, kCSide, kTRUE));
-  }
-}
-  
-void AliTriggerAnalysis::FillTriggerClasses(const AliESDEvent* aEsd)
-{
-  // fills trigger classes map
-  
-  TParameter<Long64_t>* count = dynamic_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(aEsd->GetFiredTriggerClasses().Data()));
-  if (!count)
-  {
-    count = new TParameter<Long64_t>(aEsd->GetFiredTriggerClasses(), 0);
-    fTriggerClasses->Add(new TObjString(aEsd->GetFiredTriggerClasses().Data()), count);
-  }
-  count->SetVal(count->GetVal() + 1);
+  return decision;
 }
 
-Int_t AliTriggerAnalysis::SSDClusters(const AliESDEvent* aEsd)
-{
-  // returns the number of clusters in the SSD
-  const AliMultiplicity* mult = aEsd->GetMultiplicity();
-  Int_t clusters = mult->GetNumberOfITSClusters(4)+mult->GetNumberOfITSClusters(5);
-  return clusters;
-}
 
 
-Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists, Int_t layer)
-{
+//-------------------------------------------------------------------------------------------------
+Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists, Int_t layer){
   // returns the number of fired chips in the SPD
   //
   // origin = 0 --> aEsd->GetMultiplicity()->GetNumberOfFiredChips() (filled from clusters)
@@ -1170,43 +485,26 @@ Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, B
   // layer  = 2 --> outer
   
   const AliMultiplicity* mult = aEsd->GetMultiplicity();
-  if (!mult)
-  {
-    AliError("AliMultiplicity not available");
-    return -1;
-  }
+  if (!mult) { AliFatal("AliMultiplicity not available"); }
   
-  if (origin == 0){
-    if (layer == 0) 
-      return mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
-
+  if (origin == 0) {
+    if (layer == 0) return mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
     return mult->GetNumberOfFiredChips(layer-1); 
   }
-    
-  if (origin == 1)
-  {
+  
+  if (origin == 1) {
     Int_t nChips = 0;
     Int_t firstChip = 0;
     Int_t lastChip  = 1200;
-    if(layer == 1)
-      lastChip  = 400;
-    if(layer == 2)
-      firstChip = 400;
-
-    for (Int_t i=firstChip; i<lastChip; i++)
-    {
-      if (mult->TestFastOrFiredChips(i) == kTRUE)
-      {
+    if(layer == 1) lastChip  = 400;
+    if(layer == 2) firstChip = 400;
+
+    for (Int_t i=firstChip; i<lastChip; i++) {
+      if (mult->TestFastOrFiredChips(i)) {
         // efficiency simulation (if enabled)
-        if (fSPDGFOEfficiency)
-        {
-          if (gRandom->Uniform() > fSPDGFOEfficiency->GetBinContent(i+1))
-            continue;
-        }
-        
+        if (fSPDGFOEfficiency) if (gRandom->Uniform() > fSPDGFOEfficiency->GetBinContent(i+1)) continue;
         nChips++;
-        if (fillHists)
-          fHistFiredBitsSPD->Fill(i);
+        if (fillHists) fHistFiredBitsSPD->Fill(i);
       }
     }
     return nChips;
@@ -1215,47 +513,15 @@ Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, B
   return -1;
 }
 
-Bool_t AliTriggerAnalysis::SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin)
-{
-  // Returns if the SPD gave a global Fast OR trigger
-  
-  Int_t firedChips = SPDFiredChips(aEsd, origin);
-  
-  if (firedChips >= fSPDGFOThreshold)
-    return kTRUE;
-  return kFALSE;
-}
-
-Bool_t AliTriggerAnalysis::IsSPDClusterVsTrackletBG(const AliESDEvent* aEsd, Bool_t fillHists){
-  //rejects BG based on the cluster vs tracklet correlation
-  // returns true if the event is BG
-  const AliMultiplicity* mult = aEsd->GetMultiplicity();
-  if (!mult){
-    AliFatal("No multiplicity object"); // TODO: Should this be fatal?
-  }
-  Int_t ntracklet = mult->GetNumberOfTracklets();
-
-  Int_t spdClusters = 0;
-  for(Int_t ilayer = 0; ilayer < 2; ilayer++){
-    spdClusters += mult->GetNumberOfITSClusters(ilayer);
-  }
-
-  if(fillHists) {
-    fHistSPDClsVsTrk->Fill(ntracklet,spdClusters);
-  }
-
-  Bool_t isCvsTOk = kFALSE;
-  Float_t limit = Float_t(fASPDCvsTCut) + Float_t(ntracklet) * fBSPDCvsTCut;  
-  if (spdClusters > limit)        isCvsTOk = kTRUE;
-  else                            isCvsTOk = kFALSE ;
-
-  return isCvsTOk;
 
+//-------------------------------------------------------------------------------------------------
+Int_t AliTriggerAnalysis::SSDClusters(const AliVEvent* event){ 
+  return event->GetNumberOfITSClusters(4)+event->GetNumberOfITSClusters(5); 
 }
-  
 
-AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists)
-{
+
+//-------------------------------------------------------------------------------------------------
+AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists){
   // Returns the V0 trigger decision in V0A | V0C
   //
   // Returns kV0Fake if the calculated average time is in a window where neither BB nor BG is expected. 
@@ -1265,93 +531,62 @@ AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent*
   // argument 'online' is used as a switch between online and offline trigger algorithms
   //
   // Based on an algorithm by Cvetan Cheshkov
-
+  
   AliESDVZERO* esdV0 = aEsd->GetVZEROData();
-  if (!esdV0)
-  {
-    AliError("AliESDVZERO not available");
-    return kV0Invalid;
-  }
+  if (!esdV0) { AliError("AliESDVZERO not available");  return kV0Invalid; }
+  if (side != kASide && side != kCSide) return kV0Invalid;
+  
   AliDebug(2,Form("In V0Trigger: %f %f",esdV0->GetV0ATime(),esdV0->GetV0CTime()));
-
-  Int_t begin = -1;
-  Int_t end = -1;
   
-  if (side == kASide)
-  {
-    begin = 32;
-    end = 64;
-  } 
-  else if (side == kCSide)
-  {
-    begin = 0;
-    end = 32;
-  }
-  else
-    return kV0Invalid;
-    
-   if (esdV0->TestBit(AliESDVZERO::kDecisionFilled)) {
+  Int_t begin = (side == kASide) ? 32 :  0;
+  Int_t end   = (side == kASide) ? 64 : 32;
+  
+  if (esdV0->TestBit(AliESDVZERO::kDecisionFilled)) {
     if (online) {
       if (esdV0->TestBit(AliESDVZERO::kOnlineBitsFilled)) {
-       for (Int_t i = begin; i < end; ++i) {
-         if (esdV0->GetBBFlag(i)) return kV0BB;
-       }
-       for (Int_t i = begin; i < end; ++i) {
-         if (esdV0->GetBGFlag(i)) return kV0BG;
-       }
-       return kV0Empty;
+        for (Int_t i = begin; i < end; ++i) if (esdV0->GetBBFlag(i)) return kV0BB;
+        for (Int_t i = begin; i < end; ++i) if (esdV0->GetBGFlag(i)) return kV0BG;
+        return kV0Empty;
       }
       else {
-       AliWarning("V0 online trigger analysis is not yet available!");
-       return kV0BB;
+        AliWarning("V0 online trigger analysis is not yet available!");
+        return kV0BB;
       }
     }
     else {
-
       if (fillHists) {
-       if (side == kASide && fHistV0A)
-         fHistV0A->Fill(esdV0->GetV0ATime());
-       if (side == kCSide && fHistV0C)
-         fHistV0C->Fill(esdV0->GetV0CTime());
+        if (side == kASide && fHistV0A) fHistV0A->Fill(esdV0->GetV0ATime());
+        if (side == kCSide && fHistV0C) fHistV0C->Fill(esdV0->GetV0CTime());
       }
-
-      if (side == kASide) return (V0Decision)esdV0->GetV0ADecision();
-      else if (side == kCSide) return (V0Decision)esdV0->GetV0CDecision();
-      else return kV0Invalid;
+      if      (side == kASide) return (V0Decision) esdV0->GetV0ADecision();
+      else if (side == kCSide) return (V0Decision) esdV0->GetV0CDecision();
     }
   }
-
+  
   Float_t time = 0;
   Float_t weight = 0;
-  if (fMC)
-  {
+  if (fMC) {
     Int_t runRange;
-    if (aEsd->GetRunNumber() <= 104803) runRange = 0;
+    if      (aEsd->GetRunNumber() <= 104803) runRange = 0;
     else if (aEsd->GetRunNumber() <= 104876) runRange = 1;
     else runRange = 2;
-
+    
     Float_t factors[3][64] = {
-      // runs: 104792-104803
-      {4.6,5.9,6.3,6.0,4.7,5.9,4.9,5.4,4.8,4.1,4.9,4.6,4.5,5.5,5.1,5.8,4.3,4.0,4.0,3.3,3.1,2.9,3.0,5.6,3.3,4.9,3.9,5.3,4.1,4.4,3.9,5.5,5.7,9.5,5.1,5.3,6.6,7.1,8.9,4.4,4.1,5.9,9.0,4.5,4.1,6.0,4.7,7.1,4.2,4.7,3.9,6.3,5.9,4.8,4.7,4.5,4.7,5.4,5.8,5.0,5.1,5.9,5.3,3.6},
-      // runs: 104841-104876
-      {4.6,4.8,4.9,4.8,4.3,4.9,4.4,4.5,4.6,5.0,4.7,4.6,4.7,4.6,4.6,5.5,4.7,4.5,4.7,5.0,6.5,7.6,5.3,4.9,5.5,4.8,4.6,4.9,4.5,4.5,4.6,4.9,5.7,9.8,4.9,5.2,7.1,7.1,8.1,4.4,4.0,6.0,8.3,4.6,4.2,5.6,4.6,6.4,4.4,4.7,4.5,6.5,6.0,4.7,4.5,4.4,4.8,5.5,5.9,5.3,5.0,5.7,5.1,3.6},
-      // runs: 104890-92
-      {4.7,5.2,4.8,5.0,4.4,5.0,4.4,4.6,4.6,4.5,4.4,4.6,4.5,4.6,4.8,5.5,4.8,4.5,4.4,4.3,5.4,7.7,5.6,5.0,5.4,4.3,4.5,4.8,4.5,4.5,4.6,5.3,5.7,9.6,4.9,5.4,6.1,7.2,8.6,4.4,4.0,5.4,8.8,4.4,4.2,5.8,4.7,6.7,4.3,4.7,4.0,6.1,6.0,4.9,4.8,4.6,4.7,5.2,5.7,5.0,5.0,5.8,5.3,3.6}
+      /*104792-104803*/ {4.6,5.9,6.3,6.0,4.7,5.9,4.9,5.4,4.8,4.1,4.9,4.6,4.5,5.5,5.1,5.8,4.3,4.0,4.0,3.3,3.1,2.9,3.0,5.6,3.3,4.9,3.9,5.3,4.1,4.4,3.9,5.5,5.7,9.5,5.1,5.3,6.6,7.1,8.9,4.4,4.1,5.9,9.0,4.5,4.1,6.0,4.7,7.1,4.2,4.7,3.9,6.3,5.9,4.8,4.7,4.5,4.7,5.4,5.8,5.0,5.1,5.9,5.3,3.6},
+      /*104841-104876*/ {4.6,4.8,4.9,4.8,4.3,4.9,4.4,4.5,4.6,5.0,4.7,4.6,4.7,4.6,4.6,5.5,4.7,4.5,4.7,5.0,6.5,7.6,5.3,4.9,5.5,4.8,4.6,4.9,4.5,4.5,4.6,4.9,5.7,9.8,4.9,5.2,7.1,7.1,8.1,4.4,4.0,6.0,8.3,4.6,4.2,5.6,4.6,6.4,4.4,4.7,4.5,6.5,6.0,4.7,4.5,4.4,4.8,5.5,5.9,5.3,5.0,5.7,5.1,3.6},
+      /*104890-104892*/ {4.7,5.2,4.8,5.0,4.4,5.0,4.4,4.6,4.6,4.5,4.4,4.6,4.5,4.6,4.8,5.5,4.8,4.5,4.4,4.3,5.4,7.7,5.6,5.0,5.4,4.3,4.5,4.8,4.5,4.5,4.6,5.3,5.7,9.6,4.9,5.4,6.1,7.2,8.6,4.4,4.0,5.4,8.8,4.4,4.2,5.8,4.7,6.7,4.3,4.7,4.0,6.1,6.0,4.9,4.8,4.6,4.7,5.2,5.7,5.0,5.0,5.8,5.3,3.6}
     };
     Float_t dA = 77.4 - 11.0;
     Float_t dC = 77.4 - 2.9;
     // Time misalignment
     Float_t timeShift[64] = {0.477957 , 0.0889999 , 0.757669 , 0.205439 , 0.239666 , -0.183705 , 0.442873 , -0.281366 , 0.260976 , 0.788995 , 0.974758 , 0.548532 , 0.495023 , 0.868472 , 0.661167 , 0.358307 , 0.221243 , 0.530179 , 1.26696 , 1.33082 , 1.27086 , 1.77133 , 1.10253 , 0.634806 , 2.14838 , 1.50212 , 1.59253 , 1.66122 , 1.16957 , 1.52056 , 1.47791 , 1.81905 , -1.94123 , -1.29124 , -2.16045 , -1.78939 , -3.11111 , -1.87178 , -1.57671 , -1.70311 , -1.81208 , -1.94475 , -2.53058 , -1.7042 , -2.08109 , -1.84416 , -0.61073 , -1.77145 , 0.16999 , -0.0585339 , 0.00401133 , 0.397726 , 0.851111 , 0.264187 , 0.59573 , -0.158263 , 0.584362 , 1.20835 , 0.927573 , 1.13895 , 0.64648 , 2.18747 , 1.68909 , 0.451194};
     Float_t dA2 = 2.8, dC2 = 3.3;
-
+    
     if (online) {
       for (Int_t i = begin; i < end; ++i) {
         Float_t tempAdc = esdV0->GetAdc(i)/factors[runRange][i];
         Float_t tempTime = (i >= 32) ? esdV0->GetTime(i)+dA+timeShift[i]+dA2 : esdV0->GetTime(i)+dC+timeShift[i]+dC2;
-        if (esdV0->GetTime(i) >= 1e-6 &&
-            tempTime > fV0HwWinLow && tempTime < fV0HwWinHigh &&
-            tempAdc > fV0HwAdcThr)
-          return kV0BB;
+        if (esdV0->GetTime(i) >= 1e-6 && tempTime > fV0HwWinLow && tempTime < fV0HwWinHigh && tempAdc > fV0HwAdcThr) return kV0BB;
       }
       return kV0Empty;
     }
@@ -1360,9 +595,7 @@ AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent*
         Float_t tempAdc = esdV0->GetAdc(i)/factors[runRange][i];
         Float_t tempTime = (i >= 32) ? esdV0->GetTime(i)+dA : esdV0->GetTime(i)+dC;
         Float_t tempRawTime = (i >= 32) ? esdV0->GetTime(i)+dA+timeShift[i]+dA2 : esdV0->GetTime(i)+dC+timeShift[i]+dC2;
-        if (esdV0->GetTime(i) >= 1e-6 &&
-            tempRawTime < 125.0 &&
-            tempAdc > fV0AdcThr) {
+        if (esdV0->GetTime(i) >= 1e-6 && tempRawTime < 125.0 && tempAdc > fV0AdcThr) {
           weight += 1.0;
           time += tempTime;
         }
@@ -1372,266 +605,191 @@ AliTriggerAnalysis::V0Decision AliTriggerAnalysis::V0Trigger(const AliESDEvent*
   else {
     if (online) {
       for (Int_t i = begin; i < end; ++i) {
-        if (esdV0->GetTime(i) >= 1e-6 &&
-            esdV0->GetTime(i) > fV0HwWinLow && esdV0->GetTime(i) < fV0HwWinHigh &&
-            esdV0->GetAdc(i) > fV0HwAdcThr)
-          return kV0BB;
+        if (esdV0->GetTime(i) >= 1e-6 && esdV0->GetTime(i) > fV0HwWinLow && esdV0->GetTime(i) < fV0HwWinHigh && esdV0->GetAdc(i) > fV0HwAdcThr) return kV0BB;
       }
       return kV0Empty;
     }
     else {
       for (Int_t i = begin; i < end; ++i) {
-       if (esdV0->GetTime(i) > 1e-6 && esdV0->GetAdc(i) > fV0AdcThr) {
-         Float_t correctedTime = V0CorrectLeadingTime(i, esdV0->GetTime(i), esdV0->GetAdc(i),aEsd->GetRunNumber());
-         Float_t timeWeight = V0LeadingTimeWeight(esdV0->GetAdc(i));
-         time += correctedTime*timeWeight;
-            
-         weight += timeWeight;
-       }
+        if (esdV0->GetTime(i) > 1e-6 && esdV0->GetAdc(i) > fV0AdcThr) {
+          Float_t correctedTime = V0CorrectLeadingTime(i, esdV0->GetTime(i), esdV0->GetAdc(i),aEsd->GetRunNumber());
+          Float_t timeWeight = V0LeadingTimeWeight(esdV0->GetAdc(i));
+          time += correctedTime*timeWeight;
+          weight += timeWeight;
+        }
       }
     }
   }
-
-  if (weight > 0) 
-    time /= weight;
+  
+  if (weight > 0) time /= weight;
   time += fV0TimeOffset;
-
-  if (fillHists)
-  {
-    if (side == kASide && fHistV0A)
-      fHistV0A->Fill(time);
-    if (side == kCSide && fHistV0C)
-      fHistV0C->Fill(time);
-  }
   
-  if (side == kASide)
-  {
-    if (time > 68 && time < 100)
-      return kV0BB;
-    if (time > 54 && time < 57.5) 
-      return kV0BG;
-    if (time > 57.5 && time < 68)
-      return kV0Fake;
+  if (fillHists) {
+    if (side == kASide && fHistV0A) fHistV0A->Fill(time);
+    if (side == kCSide && fHistV0C) fHistV0C->Fill(time);
   }
   
-  if (side == kCSide)
-  {
-    if (time > 75.5 && time < 100)
-      return kV0BB;
-    if (time > 69.5 && time < 73)
-      return kV0BG; 
-    if (time > 55 && time < 69.5)
-      return kV0Fake;
+  if (side == kASide) {
+    if (time > 68 && time < 100)  return kV0BB;
+    if (time > 54 && time < 57.5) return kV0BG;
+    if (time > 57.5 && time < 68) return kV0Fake;
+  }
+  if (side == kCSide) {
+    if (time > 75.5 && time < 100) return kV0BB;
+    if (time > 69.5 && time < 73)  return kV0BG; 
+    if (time > 55 && time < 69.5)  return kV0Fake;
   }
   
   return kV0Empty;
 }
 
-Float_t AliTriggerAnalysis::V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const
-{
+
+//-------------------------------------------------------------------------------------------------
+Float_t AliTriggerAnalysis::V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const {
   // Correct for slewing and align the channels
-  //
   // Authors: Cvetan Cheshkov / Raphael Tieulent
-
   if (time == 0) return 0;
 
   // Time alignment
   Float_t timeShift[64] = {0.477957 , 0.0889999 , 0.757669 , 0.205439 , 0.239666 , -0.183705 , 0.442873 , -0.281366 , 0.260976 , 0.788995 , 0.974758 , 0.548532 , 0.495023 , 0.868472 , 0.661167 , 0.358307 , 0.221243 , 0.530179 , 1.26696 , 1.33082 , 1.27086 , 1.77133 , 1.10253 , 0.634806 , 2.14838 , 1.50212 , 1.59253 , 1.66122 , 1.16957 , 1.52056 , 1.47791 , 1.81905 , -1.94123 , -1.29124 , -2.16045 , -1.78939 , -3.11111 , -1.87178 , -1.57671 , -1.70311 , -1.81208 , -1.94475 , -2.53058 , -1.7042 , -2.08109 , -1.84416 , -0.61073 , -1.77145 , 0.16999 , -0.0585339 , 0.00401133 , 0.397726 , 0.851111 , 0.264187 , 0.59573 , -0.158263 , 0.584362 , 1.20835 , 0.927573 , 1.13895 , 0.64648 , 2.18747 , 1.68909 , 0.451194};
-
-  if(runNumber < 106031)
-    time -= timeShift[i];
-
+  
+  if(runNumber < 106031) time -= timeShift[i];
+  
   // Slewing correction
   if (adc == 0) return time;
-
-  Float_t p1 = 1.57345e1;
-  Float_t p2 =-4.25603e-1;
-
+  
+  Double_t p1 = 1.57345e+1;
+  Double_t p2 =-4.25603e-1;
+  
   if(runNumber >= 106031) adc *= (2.5/4.0);
   return (time - p1*TMath::Power(adc,p2));
 }
 
-Float_t AliTriggerAnalysis::V0LeadingTimeWeight(Float_t adc) const
-{
-  if (adc < 1e-6) return 0;
 
+//-------------------------------------------------------------------------------------------------
+Float_t AliTriggerAnalysis::V0LeadingTimeWeight(Float_t adc) const {
+  if (adc < 1e-6) return 0;
+  
   Float_t p1 = 40.211;
   Float_t p2 =-4.25603e-1;
   Float_t p3 = 0.5646;
-
+  
   return 1./(p1*p1*TMath::Power(adc,2.*(p2-1.))+p3*p3);
 }
 
 
-Bool_t AliTriggerAnalysis::ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN, Bool_t useZP, Bool_t fillHists) const
-{
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN, Bool_t useZP, Bool_t fillHists) const{
   // Returns if ZDC triggered, based on TDC information 
   
   AliESDZDC *esdZDC = aEsd->GetESDZDC();
-
+  
   Bool_t zdcNA = kFALSE;
   Bool_t zdcNC = kFALSE;
   Bool_t zdcPA = kFALSE;
   Bool_t zdcPC = kFALSE;
-
-  if (fMC) {
-        // If it's MC, we use the energy
+  
+  if (fMC) { // If it's MC, we use the energy
     Double_t minEnergy = 0;
-    Double_t  zNCEnergy = esdZDC->GetZDCN1Energy();
-    Double_t  zPCEnergy = esdZDC->GetZDCP1Energy();
-    Double_t  zNAEnergy = esdZDC->GetZDCN2Energy();
-    Double_t  zPAEnergy = esdZDC->GetZDCP2Energy();
-    zdcNA = (zNAEnergy>minEnergy);
-    zdcNC = (zNCEnergy>minEnergy);
-    zdcPA = (zPAEnergy>minEnergy);
-    zdcPC = (zPCEnergy>minEnergy);
-
+    zdcNA = esdZDC->GetZDCN2Energy()>minEnergy;
+    zdcNC = esdZDC->GetZDCN1Energy()>minEnergy;
+    zdcPA = esdZDC->GetZDCP2Energy()>minEnergy;
+    zdcPC = esdZDC->GetZDCP1Energy()>minEnergy;
   }
   else {
-
     Bool_t tdc[32] = {kFALSE};
     for(Int_t itdc=0; itdc<32; itdc++){
-      for(Int_t i=0; i<4; i++){
-       if (esdZDC->GetZDCTDCData(itdc, i) != 0){
-         tdc[itdc] = kTRUE;
-       }
-      }
-      if(fillHists && tdc[itdc]) {
-       fHistTDCZDC->Fill(itdc);
-      }    
+      for(Int_t i=0; i<4; i++) tdc[itdc] |= esdZDC->GetZDCTDCData(itdc, i)!=0;
+      if(fillHists && tdc[itdc]) fHistTDCZDC->Fill(itdc);
     }
     zdcNA = tdc[12];
     zdcNC = tdc[10];
     zdcPA = tdc[13];
     zdcPC = tdc[11];
   }
-
-  if (side == kASide) return ((useZP&&zdcPA) || (useZN&&zdcNA)); 
-  if (side == kCSide) return ((useZP&&zdcPC) || (useZN&&zdcNC)); 
+  
+  if (side == kASide) return ((useZP && zdcPA) || (useZN && zdcNA)); 
+  if (side == kCSide) return ((useZP && zdcPC) || (useZN && zdcNC)); 
   return kFALSE;
 }
 
-Bool_t AliTriggerAnalysis::ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists) const
-{
-  // This method implements a selection
-  // based on the timing in both sides of zdcN
-  // It can be used in order to eliminate
-  // parasitic collisions
-  Bool_t zdcAccept = kFALSE;
-  AliESDZDC *esdZDC = aEsd->GetESDZDC();
 
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists) const {
+  // This method implements a selection based on the timing in both sides of zdcN
+  // It can be used in order to eliminate parasitic collisions
+  AliESDZDC *esdZDC = aEsd->GetESDZDC();
+  
   if(fMC) {
-     UInt_t esdFlag =  esdZDC->GetESDQuality();
-
-     Bool_t znaFired=kFALSE, zpaFired=kFALSE;
-     Bool_t zem1Fired=kFALSE, zem2Fired=kFALSE;
-     Bool_t zncFired=kFALSE, zpcFired=kFALSE;
-     //
-     // **** Trigger patterns
-     if((esdFlag & 0x00000001) == 0x00000001) znaFired=kTRUE;
-     if((esdFlag & 0x00000002) == 0x00000002) zpaFired=kTRUE;
-     if((esdFlag & 0x00000004) == 0x00000004) zem1Fired=kTRUE;
-     if((esdFlag & 0x00000008) == 0x00000008) zem2Fired=kTRUE;
-     if((esdFlag & 0x00000010) == 0x00000010) zncFired=kTRUE;
-     if((esdFlag & 0x00000020) == 0x00000020) zpcFired=kTRUE;
-     zdcAccept = (znaFired | zncFired);
+    UInt_t esdFlag =  esdZDC->GetESDQuality();
+    Bool_t znaFired  = (esdFlag & 0x01) == 0x01;
+    Bool_t zncFired  = (esdFlag & 0x10) == 0x10;
+    return znaFired | zncFired;
   }
   else {
-    for(Int_t i = 0; i < 4; ++i) {
-      if (esdZDC->GetZDCTDCData(10,i) != 0) {
-       Float_t tdcC = 0.025*(esdZDC->GetZDCTDCData(10,i)-esdZDC->GetZDCTDCData(14,i)); 
-       Float_t tdcCcorr = esdZDC->GetZDCTDCCorrected(10,i); 
-       for(Int_t j = 0; j < 4; ++j) {
-         if (esdZDC->GetZDCTDCData(12,j) != 0) {
-           Float_t tdcA = 0.025*(esdZDC->GetZDCTDCData(12,j)-esdZDC->GetZDCTDCData(14,j));
-
-           Float_t tdcAcorr = esdZDC->GetZDCTDCCorrected(12,j);
-           if(fillHists) {
-             fHistTimeZDC->Fill(tdcC-tdcA,tdcC+tdcA);
-             fHistTimeCorrZDC->Fill(tdcCcorr-tdcAcorr,tdcCcorr+tdcAcorr);
-           }
-           if (esdZDC->TestBit(AliESDZDC::kCorrectedTDCFilled)) {
-             if (((tdcCcorr-tdcAcorr-fZDCCutRefDeltaCorr)*(tdcCcorr-tdcAcorr-fZDCCutRefDeltaCorr)/(fZDCCutSigmaDeltaCorr*fZDCCutSigmaDeltaCorr) +
-                  (tdcCcorr+tdcAcorr-fZDCCutRefSumCorr)*(tdcCcorr+tdcAcorr-fZDCCutRefSumCorr)/(fZDCCutSigmaSumCorr*fZDCCutSigmaSumCorr))< 1.0)
-               zdcAccept = kTRUE;
-           }
-           else {
-             if (((tdcC-tdcA-fZDCCutRefDelta)*(tdcC-tdcA-fZDCCutRefDelta)/(fZDCCutSigmaDelta*fZDCCutSigmaDelta) +
-                  (tdcC+tdcA-fZDCCutRefSum)*(tdcC+tdcA-fZDCCutRefSum)/(fZDCCutSigmaSum*fZDCCutSigmaSum))< 1.0)
-               zdcAccept = kTRUE;
-           }
-         }
-       }
+    for(Int_t i=0;i<4;++i) {
+      if (esdZDC->GetZDCTDCData(10,i)==0) continue;
+      Float_t tdcC = 0.025*(esdZDC->GetZDCTDCData(10,i)-esdZDC->GetZDCTDCData(14,i)); 
+      Float_t tdcCcorr = esdZDC->GetZDCTDCCorrected(10,i); 
+      for(Int_t j=0;j<4;++j) {
+        if (esdZDC->GetZDCTDCData(12,j)==0) continue;
+        Float_t tdcA = 0.025*(esdZDC->GetZDCTDCData(12,j)-esdZDC->GetZDCTDCData(14,j));
+        Float_t tdcAcorr = esdZDC->GetZDCTDCCorrected(12,j);
+        if(fillHists) {
+          fHistTimeZDC->Fill(tdcC-tdcA,tdcC+tdcA);
+          fHistTimeCorrZDC->Fill(tdcCcorr-tdcAcorr,tdcCcorr+tdcAcorr);
+        }
+        if (esdZDC->TestBit(AliESDZDC::kCorrectedTDCFilled)) {
+          if (TMath::Power((tdcCcorr-tdcAcorr-fZDCCutRefDeltaCorr)/fZDCCutSigmaDeltaCorr,2.)+
+              TMath::Power((tdcCcorr+tdcAcorr-fZDCCutRefSumCorr  )/fZDCCutSigmaSumCorr,2.) < 1.) return kTRUE;
+        }
+        else {
+          if (TMath::Power((tdcC-tdcA-fZDCCutRefDelta)/fZDCCutSigmaDelta,2.)+
+              TMath::Power((tdcC+tdcA-fZDCCutRefSum  )/fZDCCutSigmaSum,2.  )<1.0) return kTRUE;
+        }
       }
     }
   }
-  return zdcAccept;
+  return kFALSE;
 }
 
-Bool_t AliTriggerAnalysis::ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const
-{
-  // This method implements a selection
-  // based on the timing in of zdcN
-  // It can be used in order to flag background
-  // ** So far only implemented for the 2012 pA run **
 
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const{
+  // This method implements a selection based on the timing in zdcN
+  // It can be used in order to flag background
   if(fMC) return kFALSE;
-
-  AliESDZDC *zdcData = aEsd->GetESDZDC();
-  Bool_t zna = kFALSE;
-  Bool_t znc = kFALSE;
+  
+  AliESDZDC* zdcData = aEsd->GetESDZDC();
   Bool_t znabadhit = kFALSE;
   Bool_t zncbadhit = kFALSE;
-
-  //  Float_t tdcC=999, tdcA=999;
+  
   Float_t tdcCcorr=999, tdcAcorr=999;
   for(Int_t i = 0; i < 4; ++i) {
-    if (zdcData->GetZDCTDCData(10,i) != 0) {
-      znc = kTRUE;
-      //      tdcC = 0.025*(zdcData->GetZDCTDCData(10,i)-zdcData->GetZDCTDCData(14,i));
-      tdcCcorr = zdcData->GetZDCTDCCorrected(10,i);
-      if((TMath::Abs(tdcCcorr)<fZDCCutZNCTimeCorrMax) && (TMath::Abs(tdcCcorr)>fZDCCutZNCTimeCorrMin)) zncbadhit = kTRUE;
-    }
-  }
-  for(Int_t j = 0; j < 4; ++j) {
-    if (zdcData->GetZDCTDCData(12,j) != 0) {
-      zna = kTRUE;
-      //      tdcA = 0.025*(zdcData->GetZDCTDCData(12,j)-zdcData->GetZDCTDCData(14,j));
-      tdcAcorr = zdcData->GetZDCTDCCorrected(12,j);
-      if((TMath::Abs(tdcAcorr)<fZDCCutZNATimeCorrMax) && (TMath::Abs(tdcAcorr)>fZDCCutZNATimeCorrMin)) znabadhit = kTRUE;
-    }
+    if (zdcData->GetZDCTDCData(10,i)==0) continue;
+    tdcCcorr = TMath::Abs(zdcData->GetZDCTDCCorrected(10,i));
+    if(tdcCcorr<fZDCCutZNCTimeCorrMax && tdcCcorr>fZDCCutZNCTimeCorrMin) zncbadhit = kTRUE;
   }
-
-  const Int_t runNumber = aEsd->GetRunNumber();
-  if(runNumber<188124 || (runNumber>188374 && runNumber<194713)){ // FIXME: end of pA-run is not known
-    AliDebug(3,Form(" ZN BG time cut not implemented for run %d",runNumber));
-    return kFALSE;
+  for(Int_t i = 0; i < 4; ++i) {
+    if (zdcData->GetZDCTDCData(12,i)==0) continue;
+    tdcAcorr = TMath::Abs(zdcData->GetZDCTDCCorrected(12,i));
+    if(tdcAcorr<fZDCCutZNATimeCorrMax && tdcAcorr>fZDCCutZNATimeCorrMin) znabadhit = kTRUE;
   }
+  
+  if (side == kASide) return znabadhit;
+  if (side == kCSide) return zncbadhit;
 
-  Bool_t znabg = (zna && znabadhit);
-  Bool_t zncbg = (znc && zncbadhit);
-
-  // Printf("Checking ZN background (time) for run %d, A = %d, time=%2.2f, C = %d, time=%2.2f",runNumber,(Int_t)zna,tdcAcorr,(Int_t)znc,tdcCcorr);
-  // Printf("Checking ZN background (time) for run %d, A-BG = %d, C-BG = %d",runNumber,(Int_t)znabg,(Int_t)zncbg);
-
-  if (side == kASide) return znabg;
-  if (side == kCSide) return zncbg;
   return kFALSE;
 }
 
-Bool_t AliTriggerAnalysis::ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) const
-{
+
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) const {
   // Returns if ZDC triggered
   
   AliESDZDC* zdcData = aEsd->GetESDZDC();
-  if (!zdcData)
-  {
-    AliError("AliESDZDC not available");
-    return kFALSE;
-  }
-  
   UInt_t quality = zdcData->GetESDQuality();
-  
+
   // from Nora's presentation, general first physics meeting 16.10.09
   static UInt_t zpc  = 0x20;
   static UInt_t znc  = 0x10;
@@ -1640,112 +798,283 @@ Bool_t AliTriggerAnalysis::ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) c
   static UInt_t zpa  = 0x02;
   static UInt_t zna  = 0x01;
   
-  if (side == kASide && ((quality & zpa) || (quality & zna)))
-    return kTRUE;
-  if (side == kCentralBarrel && ((quality & zem1) || (quality & zem2)))
-    return kTRUE;
-  if (side == kCSide && ((quality & zpc) || (quality & znc)))
-    return kTRUE;
+  if (side == kASide         && ((quality & zpa)  || (quality & zna ))) return kTRUE;
+  if (side == kCentralBarrel && ((quality & zem1) || (quality & zem2))) return kTRUE;
+  if (side == kCSide         && ((quality & zpc)  || (quality & znc ))) return kTRUE;
   
   return kFALSE;
 }
 
-Int_t AliTriggerAnalysis::FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists)
-{
-  // returns number of hit combinations agove threshold
-  //
-  // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger)
-
-  if (!fDoFMD)
-    return -1;
 
+//-------------------------------------------------------------------------------------------------
+Int_t AliTriggerAnalysis::FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists){
+  // returns number of hit combinations above threshold
+  // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger)
+  if (!fDoFMD) return -1;
+  
   // Workaround for AliESDEvent::GetFMDData is not const!
   const AliESDFMD* fmdData = (const_cast<AliESDEvent*>(aEsd))->GetFMDData();
-  if (!fmdData)
-  {
+  if (!fmdData) {
     AliError("AliESDFMD not available");
     return -1;
   }
+  
+  Int_t detFrom = (side == kASide) ? 1 : 3;
+  Int_t detTo   = (side == kASide) ? 2 : 3;
+  
+  Int_t triggers = 0;
+  Float_t totalMult = 0;
+  for (UShort_t det=detFrom;det<=detTo;det++) {
+    Int_t nRings = (det == 1 ? 1 : 2);
+    for (UShort_t ir = 0; ir < nRings; ir++) {
+      Char_t   ring = (ir == 0 ? 'I' : 'O');
+      UShort_t nsec = (ir == 0 ? 20  : 40);
+      UShort_t nstr = (ir == 0 ? 512 : 256);
+      for (UShort_t sec =0; sec < nsec;  sec++) {
+        for (UShort_t strip = 0; strip < nstr; strip++) {
+          Float_t mult = fmdData->Multiplicity(det,ring,sec,strip);
+          if (mult == AliESDFMD::kInvalidMult) continue;
+          if (fillHists) fHistFMDSingle->Fill(mult);
+          if (mult > fFMDLowCut)
+            totalMult = totalMult + mult;
+          else {
+            if (totalMult > fFMDHitCut) triggers++;
+            if (fillHists) fHistFMDSum->Fill(totalMult);
+            totalMult = 0;
+          }
+        }
+      }
+    }
+  }
+  return triggers;
+}
+
+
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::FMDTrigger(const AliESDEvent* aEsd, AliceSide side){
+  // Returns if the FMD triggered
+  // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger)
+  return FMDHitCombinations(aEsd, side, kFALSE);
+}
+
+
+//-------------------------------------------------------------------------------------------------
+AliTriggerAnalysis::T0Decision AliTriggerAnalysis::T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists){
+  // Returns the T0 TVDC trigger decision
+  //  
+  // argument 'online' is used as a switch between online and offline trigger algorithms
+  // in online mode return 0TVX 
+  // in offline mode in addition check pile-up and background :
+  // pile-up readed from ESD: check if TVDC (0TVX module name) has more 1 hit;
+  // backgroud flag readed from ESD : check in given time interval OrA and OrC were correct but TVDC not  
+  // 
+  // Based on an algorithm by Alla Maevskaya 
+  
+  const AliESDTZERO* esdT0 = aEsd->GetESDTZERO();
+  if (!esdT0) {
+    AliError("AliESDTZERO not available");
+    return kT0Invalid;
+  }
+
+  Float_t  tvdc0 = esdT0->GetTVDC(0);
+  if(fillHists) fHistT0->Fill(tvdc0);
+  
+  if (online) {
+    if( aEsd->GetHeader()->IsTriggerInputFired("0TVX")) return kT0BB;
+  }
+  else {
+    if (esdT0->GetPileupFlag()) return kT0DecPileup;
+    if (esdT0->GetBackgroundFlag()) return kT0DecBG;
+    if (tvdc0>-5 && tvdc0<5 && tvdc0!=0) return kT0BB; 
+  }
+  
+  if (fMC) if(esdT0->GetT0zVertex()>-12.3 && esdT0->GetT0zVertex() < 10.3) return kT0BB; 
+  return kT0Empty;
+}
+
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::EMCALCellsTrigger(const AliESDEvent *aEsd){
+  //
+  // Returns the EMCAL trigger decision
+  // so far only implemented for LHC11a data
+  // see http://alisoft.cern.ch/viewvc/trunk/PWGGA/EMCALTasks/AliEmcalPhysicsSelection.cxx?view=markup&root=AliRoot Revision 56136
+  //
+  
+  Bool_t isFired = kTRUE;
+  const Int_t runNumber = aEsd->GetRunNumber();
+  
+  /*
+  // Load EMCAL branches from the manager
+  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
+  am->LoadBranch("EMCALCells.");
+  am->LoadBranch("CaloClusters");
+   */
+  
+  // Get EMCAL cells
+  AliVCaloCells *cells = aEsd->GetEMCALCells();
+  const Short_t nCells = cells->GetNumberOfCells();
+  
+  // count cells above threshold per sm
+  Int_t nCellCount[10] = {0,0,0,0,0,0,0,0,0,0};
+  for(Int_t iCell=0; iCell<nCells; ++iCell) {
+    Short_t cellId = cells->GetCellNumber(iCell);
+    Double_t cellE = cells->GetCellAmplitude(cellId);
+    Int_t sm       = cellId / (24*48);
+    if (cellE>0.1)
+      ++nCellCount[sm];
+  }
+  
+  // Trigger decision for LHC11a
+  Bool_t isLedEvent = kFALSE;
+  if ((runNumber>=144871) && (runNumber<=146860)) {
+    if (nCellCount[4] > 100)
+      isLedEvent = kTRUE;
+    else {
+      if ((runNumber>=146858) && (runNumber<=146860)) {
+        if (nCellCount[3]>=35)
+          isLedEvent = kTRUE;
+      }
+    }
+  }
+  
+  if (isLedEvent) {
+    isFired = kFALSE;
+  }
+  
+  return isFired;
+}
+
+
+//----------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::TRDTrigger(const AliESDEvent *esd, Trigger trigger){
+  // evaluate the TRD trigger conditions,
+  // so far HCO, HSE, HQU, HJT, HEE
+  if(trigger!=kTRDHCO && trigger!=kTRDHJT && trigger!=kTRDHSE && trigger!=kTRDHQU && trigger!=kTRDHEE) {
+    AliWarning("Beware you are erroneously trying to use this function (wrong trigger)");
+    return kFALSE;
+  }
+  
+  Int_t nTrdTracks = esd->GetNumberOfTrdTracks();
+  if (nTrdTracks<=0) return kFALSE;
+  if      (trigger==kTRDHCO) return kTRUE;
+  else if (trigger!=kTRDHJT) {
+    for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) {
+      AliESDTrdTrack *trdTrack = esd->GetTrdTrack(iTrack);
+      if (!trdTrack) continue;
+      // for the electron triggers we only consider matched tracks
+      if(trigger==kTRDHQU) if (TMath::Abs(trdTrack->Pt())>fTRDptHQU && trdTrack->GetPID()>fTRDpidHQU) return kTRUE;
+      if(trigger==kTRDHSE) if (TMath::Abs(trdTrack->Pt())>fTRDptHSE && trdTrack->GetPID()>fTRDpidHSE) return kTRUE; 
+      if(trigger==kTRDHEE) if (TMath::Abs(trdTrack->Pt())>fTRDptHSE && trdTrack->GetPID()>fTRDpidHSE && trdTrack->GetSector()>=fTRDminSectorHEE && trdTrack->GetSector()<=fTRDmaxSectorHEE) return kTRUE;
+    }
+  } 
+  else if (trigger==kTRDHJT) {
+    Int_t nTracks[90] = { 0 }; // stack-wise counted number of tracks above pt threshold
+    for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) {
+      AliESDTrdTrack *trdTrack = esd->GetTrdTrack(iTrack);    
+      if (!trdTrack) continue;
+      Int_t globalStack = 5*trdTrack->GetSector() + trdTrack->GetStack();
+      // stack-wise counting of tracks above pt threshold for jet trigger
+      if (TMath::Abs(trdTrack->GetPt()) >= fTRDptHJT) ++nTracks[globalStack];
+    }
+    // check if HJT condition is fulfilled in any stack
+    for (Int_t iStack = 0; iStack < 90; iStack++) if (nTracks[iStack] >= fTRDnHJT) return kTRUE;
+  }
+  return kFALSE;
+}
+
+
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::EMCALTrigger(const AliVEvent* event, Trigger trigger){
+  AliVCaloTrigger* emcalTrigger = event->GetCaloTrigger("EMCAL");
+  if (!emcalTrigger) return kFALSE;
+  Int_t emcalTriggerBits = 0;
+  emcalTrigger->GetTriggerBits(emcalTriggerBits);
+  if      (trigger==kEmcalL0         ) { return emcalTriggerBits & 1<<0; }
+  else if (trigger==kEmcalL1GammaHigh) { return emcalTriggerBits & 1<<1; }
+  else if (trigger==kEmcalL1GammaLow ) { return emcalTriggerBits & 1<<2; }
+  else if (trigger==kEmcalL1JetHigh  ) { return emcalTriggerBits & 1<<3; }
+  else if (trigger==kEmcalL1JetLow   ) { return emcalTriggerBits & 1<<4; }
+  else {
+    AliWarning("Beware you are erroneously trying to use this function (wrong trigger)");
+    return kFALSE;
+  }
+  return kFALSE;
+}
+
 
-  Int_t detFrom = (side == kASide) ? 1 : 3;
-  Int_t detTo   = (side == kASide) ? 2 : 3;
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsSPDClusterVsTrackletBG(const AliVEvent* event, Bool_t fillHists){
+  // rejects BG based on the cluster vs tracklet correlation
+  // returns true if the event is BG
+  const AliVMultiplicity* mult = event->GetMultiplicity();
+  if (!mult) { AliFatal("No multiplicity object"); }
+  Int_t ntracklet   = mult->GetNumberOfTracklets();
+  Int_t spdClusters = event->GetNumberOfITSClusters(0) + event->GetNumberOfITSClusters(1);
+  if(fillHists) fHistSPDClsVsTrk->Fill(ntracklet,spdClusters);
+  return spdClusters > Float_t(fASPDCvsTCut) + Float_t(ntracklet)*fBSPDCvsTCut;
+}
 
-  Int_t triggers = 0;
-  Float_t totalMult = 0;
-  for (UShort_t det=detFrom;det<=detTo;det++) {
-    Int_t nRings = (det == 1 ? 1 : 2);
-    for (UShort_t ir = 0; ir < nRings; ir++) {
-      Char_t   ring = (ir == 0 ? 'I' : 'O');
-      UShort_t nsec = (ir == 0 ? 20  : 40);
-      UShort_t nstr = (ir == 0 ? 512 : 256);
-      for (UShort_t sec =0; sec < nsec;  sec++) {
-        for (UShort_t strip = 0; strip < nstr; strip++) {
-          Float_t mult = fmdData->Multiplicity(det,ring,sec,strip);
-          if (mult == AliESDFMD::kInvalidMult) continue;
-          
-          if (fillHists)
-            fHistFMDSingle->Fill(mult);
-          
-          if (mult > fFMDLowCut)
-            totalMult = totalMult + mult;
-          else
-          {
-            if (totalMult > fFMDHitCut)
-              triggers++;
-              
-            if (fillHists)
-              fHistFMDSum->Fill(totalMult);
-              
-            totalMult = 0;
-          }
-        }
-      }
-    }
+
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsLaserWarmUpTPCEvent(const AliESDEvent* esd){
+  // This function flags noisy TPC events which can happen during laser warm-up.
+  Int_t trackCounter = 0;
+  for (Int_t i=0; i<esd->GetNumberOfTracks(); ++i) {
+    AliESDtrack *track = esd->GetTrack(i);
+    if (!track) continue;
+    if (track->GetTPCNcls() < 30) continue;
+    if (TMath::Abs(track->Eta()) > 0.005) continue;
+    if (track->Pt() < 4) continue;
+    if (track->GetKinkIndex(0) > 0) continue;
+    UInt_t status = track->GetStatus();
+    if ((status&AliESDtrack::kITSrefit)==AliESDtrack::kITSrefit) continue; // explicitly ask for tracks without ITS refit
+    if ((status&AliESDtrack::kTPCrefit)!=AliESDtrack::kTPCrefit) continue;
+    if (track->GetTPCsignal() > 10) continue;          // explicitly ask for tracks without dE/dx
+    trackCounter++;
   }
-  
-  return triggers;
+  if (trackCounter > 15) return kTRUE;
+  return kFALSE;
 }
 
-Bool_t AliTriggerAnalysis::FMDTrigger(const AliESDEvent* aEsd, AliceSide side)
-{
-  // Returns if the FMD triggered
-  //
-  // Authors: FMD team, Hans Dalsgaard (code merged from FMD/AliFMDOfflineTrigger)
 
-  Int_t triggers = FMDHitCombinations(aEsd, side, kFALSE);
-  
-  if (triggers > 0)
-    return kTRUE;
-    
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsHVdipTPCEvent(const AliESDEvent* esd) {
+  // This function flags events in which the TPC chamber HV is not at its nominal value
+  if (fMC) return kFALSE; // there are no dip events in MC
+  if (!esd->IsDetectorOn(AliDAQ::kTPC)) return kTRUE;
   return kFALSE;
 }
 
-Long64_t AliTriggerAnalysis::Merge(TCollection* list)
-{
-  // Merge a list of AliMultiplicityCorrection objects with this (needed for
-  // PROOF).
-  // Returns the number of merged objects (including this).
 
-  if (!list)
-    return 0;
+//-------------------------------------------------------------------------------------------------
+Bool_t AliTriggerAnalysis::IsIncompleteEvent(const AliESDEvent* esd){
+  // Check whether the event is incomplete 
+  // (due to DAQ-HLT issues, it could be only part of the event was saved)
+  if (fMC) return kFALSE; // there are no incomplete events on MC
+  if ((esd->GetEventType() == 7) &&
+      (esd->GetDAQDetectorPattern() & (1<<4)) &&
+      !(esd->GetDAQAttributes() & (1<<7))) return kTRUE;
+  return kFALSE;
+}
 
-  if (list->IsEmpty())
-    return 1;
 
+//-------------------------------------------------------------------------------------------------
+Long64_t AliTriggerAnalysis::Merge(TCollection* list){
+  // Merge a list of objects with this (needed for PROOF).
+  // Returns the number of merged objects (including this).
+  if (!list) return 0;
+  if (list->IsEmpty()) return 1;
   TIterator* iter = list->MakeIterator();
   TObject* obj;
-
+  
   // collections of all histograms
   const Int_t nHists = 14;
   TList collections[nHists];
-
+  
   Int_t count = 0;
   while ((obj = iter->Next())) {
-
     AliTriggerAnalysis* entry = dynamic_cast<AliTriggerAnalysis*> (obj);
-    if (entry == 0) 
-      continue;
-
+    if (entry == 0) continue;
     Int_t n = 0;
     collections[n++].Add(entry->fHistV0A);
     collections[n++].Add(entry->fHistV0C);
@@ -1761,44 +1090,30 @@ Long64_t AliTriggerAnalysis::Merge(TCollection* list)
     collections[n++].Add(entry->fHistFiredBitsSPD);
     collections[n++].Add(entry->fHistSPDClsVsTrk);
     collections[n++].Add(entry->fHistT0);
-
+    
     // merge fTriggerClasses
     TIterator* iter2 = entry->fTriggerClasses->MakeIterator();
     TObjString* obj2 = 0;
-    while ((obj2 = dynamic_cast<TObjString*> (iter2->Next())))
-    {
+    while ((obj2 = dynamic_cast<TObjString*> (iter2->Next()))) {
       TParameter<Long64_t>* param2 = static_cast<TParameter<Long64_t>*> (entry->fTriggerClasses->GetValue(obj2));
-      
       TParameter<Long64_t>* param1 = dynamic_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(obj2));
-      if (param1)
-      {
-        param1->SetVal(param1->GetVal() + param2->GetVal());
-      }
-      else
-      {
+      if (param1) { param1->SetVal(param1->GetVal() + param2->GetVal()); }
+      else {        
         param1 = dynamic_cast<TParameter<Long64_t>*> (param2->Clone());
         fTriggerClasses->Add(new TObjString(obj2->String()), param1);
       }
     }
-    
     delete iter2;
-  
     count++;
   }
-
+  
   Int_t n = 0;
   fHistV0A->Merge(&collections[n++]);
   fHistV0C->Merge(&collections[n++]);
   fHistZDC->Merge(&collections[n++]);
   fHistTDCZDC->Merge(&collections[n++]);
-  if (fHistTimeZDC)
-    fHistTimeZDC->Merge(&collections[n++]);
-  else
-    n++;
-  if (fHistTimeCorrZDC)
-    fHistTimeCorrZDC->Merge(&collections[n++]);
-  else
-    n++;
+  if (fHistTimeZDC)     fHistTimeZDC->Merge(&collections[n++]);     else n++;
+  if (fHistTimeCorrZDC) fHistTimeCorrZDC->Merge(&collections[n++]); else n++;
   fHistFMDA->Merge(&collections[n++]);
   fHistFMDC->Merge(&collections[n++]);
   fHistFMDSingle->Merge(&collections[n++]);
@@ -1808,279 +1123,120 @@ Long64_t AliTriggerAnalysis::Merge(TCollection* list)
   fHistSPDClsVsTrk->Merge(&collections[n++]);
   fHistT0->Merge(&collections[n++]);
   delete iter;
-
   return count+1;
 }
 
-void AliTriggerAnalysis::SaveHistograms() const
-{
-  // write histograms to current directory
+
+//-------------------------------------------------------------------------------------------------
+void AliTriggerAnalysis::FillHistograms(const AliESDEvent* aEsd){
+  // fills the histograms with the info from the ESD
+  
+  fHistBitsSPD->Fill(SPDFiredChips(aEsd, 0), SPDFiredChips(aEsd, 1, kTRUE));
+  
+  V0Trigger(aEsd, kASide, kFALSE, kTRUE);
+  V0Trigger(aEsd, kCSide, kFALSE, kTRUE);
+  T0Trigger(aEsd, kFALSE, kTRUE);
+  ZDCTDCTrigger(aEsd,kASide,kFALSE,kFALSE,kTRUE);
+  ZDCTimeTrigger(aEsd,kTRUE);
+  IsSPDClusterVsTrackletBG(aEsd, kTRUE);
   
-  if (!fHistBitsSPD)
-    return;
+  AliESDZDC* zdcData = aEsd->GetESDZDC();
+  if (zdcData)  {
+    UInt_t quality = zdcData->GetESDQuality();
+    
+    // from Nora's presentation, general first physics meeting 16.10.09
+    static UInt_t zpc  = 0x20;
+    static UInt_t znc  = 0x10;
+    static UInt_t zem1 = 0x08;
+    static UInt_t zem2 = 0x04;
+    static UInt_t zpa  = 0x02;
+    static UInt_t zna  = 0x01;
     
-  if (fHistBitsSPD) {
-    fHistBitsSPD->Write();
-    //fHistBitsSPD->ProjectionX();
-    //fHistBitsSPD->ProjectionY();
+    fHistZDC->Fill(1, (quality & zna)  ? 1 : 0);
+    fHistZDC->Fill(2, (quality & zpa)  ? 1 : 0);
+    fHistZDC->Fill(3, (quality & zem2) ? 1 : 0);
+    fHistZDC->Fill(4, (quality & zem1) ? 1 : 0);
+    fHistZDC->Fill(5, (quality & znc)  ? 1 : 0);
+    fHistZDC->Fill(6, (quality & zpc)  ? 1 : 0);
+  }
+  else {
+    fHistZDC->Fill(-1);
+    AliError("AliESDZDC not available");
+  }
+  
+  if (fDoFMD) {
+    fHistFMDA->Fill(FMDHitCombinations(aEsd, kASide, kTRUE));
+    fHistFMDC->Fill(FMDHitCombinations(aEsd, kCSide, kTRUE));
   }
-  else Printf("Cannot save fHistBitsSPD");
+}
+
+
+//-------------------------------------------------------------------------------------------------
+void AliTriggerAnalysis::SaveHistograms() const {
+  // write histograms to current directory
+  if (fHistBitsSPD)      fHistBitsSPD->Write();
   if (fHistFiredBitsSPD) fHistFiredBitsSPD->Write();
-  else Printf("Cannot save fHistFiredBitsSPD");
-  if (fHistV0A) fHistV0A->Write();
-  else Printf("Cannot save fHistV0A");
-  if (fHistV0C) fHistV0C->Write();
-  else Printf("Cannot save fHistV0C");
-  if (fHistZDC) fHistZDC->Write();
-  else Printf("Cannot save fHistZDC");
-  if (fHistTDCZDC) fHistTDCZDC->Write();
-  else Printf("Cannot save fHistTDCZDC");
-  if (fHistTimeZDC) fHistTimeZDC->Write();
-  else Printf("Cannot save fHistTimeZDC");
-  if (fHistTimeCorrZDC) fHistTimeCorrZDC->Write();
-  else Printf("Cannot save fHistTimeCorrZDC");
-  if (fHistFMDA) fHistFMDA->Write();
-  else Printf("Cannot save fHistFMDA");
-  if (fHistFMDC) fHistFMDC->Write();
-  else Printf("Cannot save fHistFMDC");
-  if (fHistFMDSingle) fHistFMDSingle->Write();
-  else Printf("Cannot save fHistFMDSingle");
-  if (fHistFMDSum) fHistFMDSum->Write();
-  else Printf("Cannot save fHistFMDSum");
+  if (fHistV0A)          fHistV0A->Write();
+  if (fHistV0C)          fHistV0C->Write();
+  if (fHistZDC)          fHistZDC->Write();
+  if (fHistTDCZDC)       fHistTDCZDC->Write();
+  if (fHistTimeZDC)      fHistTimeZDC->Write();
+  if (fHistTimeCorrZDC)  fHistTimeCorrZDC->Write();
+  if (fHistFMDA)         fHistFMDA->Write();
+  if (fHistFMDC)         fHistFMDC->Write();
+  if (fHistFMDSingle)    fHistFMDSingle->Write();
+  if (fHistFMDSum)       fHistFMDSum->Write();
   if (fSPDGFOEfficiency) fSPDGFOEfficiency->Write("fSPDGFOEfficiency");
-  if (fHistSPDClsVsTrk) fHistSPDClsVsTrk->Write("fHistSPDClsVsTrk");
-  if (fHistT0) fHistT0->Write("fHistT0");
-
-  //  else Printf("Cannot save fSPDGFOEfficiency");
-  
+  if (fHistSPDClsVsTrk)  fHistSPDClsVsTrk->Write("fHistSPDClsVsTrk");
+  if (fHistT0)           fHistT0->Write("fHistT0");
   fTriggerClasses->Write("fTriggerClasses", TObject::kSingleKey);
 }
 
-void AliTriggerAnalysis::PrintTriggerClasses() const
-{
+
+//-------------------------------------------------------------------------------------------------
+void AliTriggerAnalysis::FillTriggerClasses(const AliESDEvent* aEsd){
+  // fills trigger classes map
+  TParameter<Long64_t>* count = dynamic_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(aEsd->GetFiredTriggerClasses().Data()));
+  if (!count) {
+    count = new TParameter<Long64_t>(aEsd->GetFiredTriggerClasses(), 0);
+    fTriggerClasses->Add(new TObjString(aEsd->GetFiredTriggerClasses().Data()), count);
+  }
+  count->SetVal(count->GetVal() + 1);
+}
+
+
+//-------------------------------------------------------------------------------------------------
+void AliTriggerAnalysis::PrintTriggerClasses() const {
   // print trigger classes
   
   Printf("Trigger Classes:");
-  
   Printf("Event count for trigger combinations:");
-  
   TMap singleTrigger;
   singleTrigger.SetOwner();
-  
   TIterator* iter = fTriggerClasses->MakeIterator();
   TObjString* obj = 0;
-  while ((obj = dynamic_cast<TObjString*> (iter->Next())))
-  {
+  while ((obj = dynamic_cast<TObjString*> (iter->Next()))) {
     TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (fTriggerClasses->GetValue(obj));
-    
     Printf(" %s: %ld triggers", obj->String().Data(), (Long_t)param->GetVal());
-    
     TObjArray* tokens = obj->String().Tokenize(" ");
-    for (Int_t i=0; i<tokens->GetEntries(); i++)
-    {
+    for (Int_t i=0; i<tokens->GetEntries(); i++) {
       TParameter<Long64_t>* count = dynamic_cast<TParameter<Long64_t>*> (singleTrigger.GetValue(((TObjString*) tokens->At(i))->String().Data()));
-      if (!count)
-      {
+      if (!count) {
         count = new TParameter<Long64_t>(((TObjString*) tokens->At(i))->String().Data(), 0);
         singleTrigger.Add(new TObjString(((TObjString*) tokens->At(i))->String().Data()), count);
       }
       count->SetVal(count->GetVal() + param->GetVal());
     }
-    
     delete tokens;
   }
   delete iter;
   
   Printf("Event count for single trigger:");
-  
   iter = singleTrigger.MakeIterator();
-  while ((obj = dynamic_cast<TObjString*> (iter->Next())))
-  {
+  while ((obj = dynamic_cast<TObjString*> (iter->Next()))) {
     TParameter<Long64_t>* param = static_cast<TParameter<Long64_t>*> (singleTrigger.GetValue(obj));
-    
     Printf("  %s: %ld triggers", obj->String().Data(), (Long_t)param->GetVal());
   }
   delete iter;
-  
   singleTrigger.DeleteAll();
 }
-
-
-//----------------------------------------------------------------------------------------------------
-AliTriggerAnalysis::T0Decision AliTriggerAnalysis::T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists) 
-{
-  // Returns the T0 TVDC trigger decision
-  //  
-  // argument 'online' is used as a switch between online and offline trigger algorithms
-  // in online mode return 0TVX 
-  // in offline mode in addition check pile-up and background :
-  // pile-up readed from ESD: check if TVDC (0TVX module name) has more 1 hit;
-  // backgroud flag readed from ESD : check in given time interval OrA and OrC were correct but TVDC not  
-  // 
-  // Based on an algorithm by Alla Maevskaya 
-
-  const AliESDTZERO* esdT0 = aEsd->GetESDTZERO();
-  if (!esdT0)
-  {
-    AliError("AliESDTZERO not available");
-    return kT0Invalid;
-  }
-  //????  AliDebug(2,Form("In T0Trigger: %f %f",esdV0->GetV0ATime(),esdV0->GetV0CTime()));
-  Float_t  tvdc[5] ;
-  for (Int_t ii=0; ii<5; ii++)
-    tvdc[ii] = esdT0->GetTVDC(ii);
-  //  Int_t trig=esdT0->GetT0Trig();
-  //  cout<<" T0 trig "<<trig<<endl;   
-
-  if(fillHists) fHistT0->Fill(tvdc[0]);
-    
-  if (online) {
-    if(aEsd->GetHeader()->GetFiredTriggerInputs().Contains("0TVX") ) return kT0BB;
-  }
-  else {
-  
-    if (esdT0->GetPileupFlag()) return kT0DecPileup;
-    if (esdT0->GetBackgroundFlag()) return kT0DecBG;
-    if (tvdc[0]>-5 && tvdc[0]<5 && tvdc[0] != 0) return kT0BB; 
-  }
-
-  if (fMC)
-    if( esdT0->GetT0zVertex()>-12.3 && esdT0->GetT0zVertex() < 10.3) return kT0BB; 
-  return kT0Empty;
-}
-
-//----------------------------------------------------------------------------------------------------
-Bool_t AliTriggerAnalysis::EMCALCellsTrigger(const AliESDEvent *aEsd)
-{
-  //
-  // Returns the EMCAL trigger decision
-  // so far only implemented for LHC11a data
-  // see http://alisoft.cern.ch/viewvc/trunk/PWGGA/EMCALTasks/AliEmcalPhysicsSelection.cxx?view=markup&root=AliRoot Revision 56136
-  //
-
-  Bool_t isFired = kTRUE;
-  const Int_t runNumber = aEsd->GetRunNumber();
-
-  /*
-  // Load EMCAL branches from the manager
-  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
-  am->LoadBranch("EMCALCells.");
-  am->LoadBranch("CaloClusters");
-  */
-
-  // Get EMCAL cells
-  AliVCaloCells *cells = aEsd->GetEMCALCells();
-  const Short_t nCells = cells->GetNumberOfCells();
-
-  // count cells above threshold per sm
-  Int_t nCellCount[10] = {0,0,0,0,0,0,0,0,0,0};
-  for(Int_t iCell=0; iCell<nCells; ++iCell) {
-    Short_t cellId = cells->GetCellNumber(iCell);
-    Double_t cellE = cells->GetCellAmplitude(cellId);
-    Int_t sm       = cellId / (24*48);
-    if (cellE>0.1)
-      ++nCellCount[sm];
-  }
-
-  // Trigger decision for LHC11a
-  Bool_t isLedEvent = kFALSE;
-  if ((runNumber>=144871) && (runNumber<=146860)) {
-    if (nCellCount[4] > 100)
-      isLedEvent = kTRUE;
-    else {
-      if ((runNumber>=146858) && (runNumber<=146860)) {
-       if (nCellCount[3]>=35)
-         isLedEvent = kTRUE;
-      }
-    }
-  }
-  
-  if (isLedEvent) {
-    isFired = kFALSE;
-  }
-
-  return isFired;
-}
-
-//__________________________________________________________________________________________
-Bool_t AliTriggerAnalysis::TRDTrigger(const AliESDEvent *esd, Trigger trigger)
-{
-  // evaluate the TRD trigger conditions,
-  // so far HCO, HSE, HQU, HJT, HEE
-
-  Bool_t isFired = kFALSE;
-
-  if(trigger!=kTRDHCO && trigger!=kTRDHJT && trigger!=kTRDHSE && trigger!=kTRDHQU && trigger!=kTRDHEE) {
-    AliWarning("Beware you are erroneously trying to use this function (wrong trigger)");
-    return isFired;
-  }
-
-  if (!esd) {
-    AliErrorClass("ESD event pointer is null");
-    return isFired;
-  }
-  
-  Int_t nTrdTracks = esd->GetNumberOfTrdTracks();
-  
-  if (nTrdTracks > 0 && (trigger==kTRDHCO) ) { 
-    isFired = kTRUE;
-    return isFired;
-  }
-
-  if(trigger!=kTRDHJT) {
-    for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) {
-      
-      AliESDTrdTrack *trdTrack = esd->GetTrdTrack(iTrack);   
-      if (!trdTrack) continue;
-
-      // for the electron triggers we only consider matched tracks
-      if(trigger==kTRDHQU)
-       if ( (TMath::Abs(trdTrack->Pt()) > fTRDptHQU) && (trdTrack->GetPID() > fTRDpidHQU) ) { 
-         isFired = kTRUE;
-         return isFired;
-       }
-
-      if(trigger==kTRDHSE)
-       if ( (TMath::Abs(trdTrack->Pt()) > fTRDptHSE) && (trdTrack->GetPID() > fTRDpidHSE) ) { 
-         isFired = kTRUE;
-         return isFired;
-       }
-      
-      if(trigger==kTRDHEE)
-       if ( (trdTrack->GetSector() >= fTRDminSectorHEE) && (trdTrack->GetSector() <= fTRDmaxSectorHEE) &&
-            (TMath::Abs(trdTrack->Pt()) > fTRDptHSE) && (trdTrack->GetPID() > fTRDpidHSE) ) { 
-         isFired = kTRUE;
-         return isFired;
-       }
-
-    }
-  } else if(trigger==kTRDHJT) {
-
-    Int_t nTracks[90] = { 0 }; // stack-wise counted number of tracks above pt threshold
-
-    for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) {
-      
-      AliESDTrdTrack *trdTrack = esd->GetTrdTrack(iTrack);    
-      if (!trdTrack) continue;
-      
-      Int_t globalStack = 5*trdTrack->GetSector() + trdTrack->GetStack();
-      
-      // stack-wise counting of tracks above pt threshold for jet trigger
-      if (TMath::Abs(trdTrack->GetPt()) >= fTRDptHJT) {
-       ++nTracks[globalStack];
-      }
-    }
-
-    // check if HJT condition is fulfilled in any stack
-    for (Int_t iStack = 0; iStack < 90; iStack++) {
-      if (nTracks[iStack] >= fTRDnHJT) {
-       isFired = kTRUE;
-       break;
-      }
-    }
-
-  }
-
-  return isFired;
-}
index 85dc2d2534497e15269bc97e6a6dcab763e1529e..e68ffda760fcc3104a8506a57f6f56ce14422bb4 100644 (file)
@@ -15,6 +15,7 @@
 //   Origin: Jan Fiete Grosse-Oetringhaus, CERN
 //-------------------------------------------------------------------------
 
+class AliVEvent;
 class AliESDEvent;
 class AliESDtrackCuts;
 class TH1F;
@@ -22,184 +23,169 @@ class TH2F;
 class TCollection;
 class TMap;
 
-class AliTriggerAnalysis : public TObject
-{
-  public:
-    enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND, 
-                  kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kZNA, kZNC, kZNABG, kZNCBG, kFMDA, kFMDC, kFPANY, kNSD1, kMB1Prime, 
-                  kSPDGFOL0, kSPDGFOL1, kZDCTDCA, kZDCTDCC, kZDCTime, kCTPV0A, kCTPV0C, kTPCLaserWarmUp, kSPDClsVsTrkBG,
-                  kCentral,kSemiCentral, kT0, kT0BG, kT0Pileup, kEMCAL,kTPCHVdip,
-                  kTRDHCO, kTRDHJT, kTRDHSE, kTRDHQU, kTRDHEE,
-                  kIncompleteEvent,
-                  kStartOfFlags = 0x0100, kOfflineFlag = 0x8000, kOneParticle = 0x10000, kOneTrack = 0x20000}; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
-    enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
-    enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
-    enum T0Decision { kT0Invalid = -1, kT0Empty = 0, kT0BB, kT0DecBG, kT0DecPileup };
-    
-    AliTriggerAnalysis();
-    virtual ~AliTriggerAnalysis();
-    
-    void EnableHistograms(Bool_t isLowFlux = kFALSE);
-    void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
-    
-    Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
-    Int_t EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger);
-    
-    // using trigger bits in ESD
-    Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const;
-    Bool_t IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const;
-    Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const;
-    
-    // using ESD data from detectors
-    Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
-
-    // using trigger classes in ESD
-    Bool_t IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const;
-    
-    // some "raw" trigger functions
-    Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE, Int_t layer = 0);
-    Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin);
-    Bool_t IsSPDClusterVsTrackletBG(const AliESDEvent* esd, Bool_t fillHists = kFALSE);
-    V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists = kFALSE);
-    T0Decision T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists = kFALSE);
-    Bool_t ZDCTrigger   (const AliESDEvent* aEsd, AliceSide side) const;
-    Bool_t ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN=kTRUE, Bool_t useZP=kFALSE, Bool_t fillHists=kFALSE) const;
-    Bool_t ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists=kFALSE) const;
-    Bool_t ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const;
-    Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
-    Int_t SSDClusters(const AliESDEvent* aEsd);
-    Bool_t EMCALCellsTrigger(const AliESDEvent *aEsd);
-    static const char* GetTriggerName(Trigger trigger);
-    
-    Bool_t IsLaserWarmUpTPCEvent(const AliESDEvent* esd);
-    Bool_t IsHVdipTPCEvent(const AliESDEvent* esd);
-    Bool_t TRDTrigger(const AliESDEvent* esd, Trigger trigger);
-
-    Bool_t IsIncompleteEvent(const AliESDEvent* esd);
-    
-    void FillHistograms(const AliESDEvent* aEsd);
-    void FillTriggerClasses(const AliESDEvent* aEsd);
-    
-    void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
-    void SetSPDGFOEfficiency(TH1F* hist) { fSPDGFOEfficiency = hist; }
-    void SetSPDClustersVsTrackletsParameters(Float_t a, Float_t b) { fASPDCvsTCut = a; fBSPDCvsTCut =b;}
-    void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
-    void SetV0AdcThr(Float_t thr) { fV0AdcThr = thr; }
-    void SetV0HwPars(Float_t thr, Float_t winLow, Float_t winHigh) { fV0HwAdcThr = thr; fV0HwWinLow = winLow; fV0HwWinHigh = winHigh; }
-    void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
-    void SetDoFMD(Bool_t flag = kTRUE) {fDoFMD = flag;}
-    void SetZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSum = refSum; fZDCCutRefDelta = refDelta; fZDCCutSigmaSum = sigmaSum; fZDCCutSigmaDelta = sigmaDelta; }
-    void SetCorrZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSumCorr = refSum; fZDCCutRefDeltaCorr = refDelta; fZDCCutSigmaSumCorr = sigmaSum; fZDCCutSigmaDeltaCorr = sigmaDelta; }
-    void SetZNCorrCutParams(Float_t znaTimeCorrMin, Float_t znaTimeCorrMax, Float_t zncTimeCorrMin, Float_t zncTimeCorrMax)
-    { fZDCCutZNATimeCorrMin = znaTimeCorrMin; fZDCCutZNATimeCorrMax = znaTimeCorrMax; 
-      fZDCCutZNCTimeCorrMin = zncTimeCorrMin; fZDCCutZNCTimeCorrMax = zncTimeCorrMax; }
-
-    void SetTRDTriggerParameters(Float_t ptHSE, UChar_t pidHSE, Float_t ptHQU, UChar_t pidHQU, Float_t ptHEE, UChar_t pidHEE, UChar_t minSectorHEE, UChar_t maxSectorHEE, Float_t ptHJT, UChar_t nHJT) {
-      fTRDptHSE = ptHSE; fTRDpidHSE = pidHSE;
-      fTRDptHQU = ptHQU; fTRDpidHQU = pidHQU;
-      fTRDptHEE = ptHEE; fTRDpidHEE = pidHEE;
-      fTRDminSectorHEE = minSectorHEE; fTRDmaxSectorHEE = maxSectorHEE;
-      fTRDptHJT = ptHJT; fTRDnHJT = nHJT;
-    }
-
-    Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
-    Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
-    Float_t GetV0AdcThr()     const { return fV0AdcThr; }
-    Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
-    Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
-    TMap * GetTriggerClasses() const { return fTriggerClasses;}
-
-
-    virtual Long64_t Merge(TCollection* list);
-    void SaveHistograms() const;
-    
-    void PrintTriggerClasses() const;
-    void SetESDTrackCuts(AliESDtrackCuts* cuts) { fEsdTrackCuts = cuts;}
-    AliESDtrackCuts* GetESDTrackCuts() const  {return fEsdTrackCuts;}
-
-    void SetTPCOnly(Bool_t bTPCOnly) {fTPCOnly = bTPCOnly;}
-    Bool_t GetTPCOnly() const {return fTPCOnly;}
-
-  protected:
-    Bool_t IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const;
-    Bool_t IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const;
-    Bool_t IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const;
-    Bool_t IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const;
-    
-    Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const;
-    Float_t V0LeadingTimeWeight(Float_t adc) const;
-    
-    Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
-
-    Int_t fSPDGFOThreshold;         // number of chips to accept a SPD GF0 trigger
-    TH1F* fSPDGFOEfficiency;         // SPD FASTOR efficiency - is applied in SPDFiredChips. Histogram contains efficiency as function of chip number (bin 1..400: first layer; 401..1200: second layer)
-    
-    Float_t fV0TimeOffset;          // time offset applied to the times read from the V0 (in ns)
-    Float_t fV0AdcThr;              // thresholds applied on V0 ADC data
-    Float_t fV0HwAdcThr;            // online V0 trigger - thresholds applied on ADC data 
-    Float_t fV0HwWinLow;            // online V0 trigger - lower edge of time window
-    Float_t fV0HwWinHigh;           // online V0 trigger - upper edge of time window
-    
-    Float_t fZDCCutRefSum;          // ZDC time cut configuration
-    Float_t fZDCCutRefDelta;        // ZDC time cut configuration
-    Float_t fZDCCutSigmaSum;        // ZDC time cut configuration
-    Float_t fZDCCutSigmaDelta;      // ZDC time cut configuration
-
-    Float_t fZDCCutRefSumCorr;      // Corrected ZDC time cut configuration
-    Float_t fZDCCutRefDeltaCorr;    // Corrected ZDC time cut configuration
-    Float_t fZDCCutSigmaSumCorr;    // Corrected ZDC time cut configuration
-    Float_t fZDCCutSigmaDeltaCorr;  // Corrected ZDC time cut configuration
-
-    Float_t fZDCCutZNATimeCorrMin;  // Corrected ZNA time cut configuration
-    Float_t fZDCCutZNATimeCorrMax;  // Corrected ZNA time cut configuration
-    Float_t fZDCCutZNCTimeCorrMin;  // Corrected ZNA time cut configuration
-    Float_t fZDCCutZNCTimeCorrMax;  // Corrected ZNA time cut configuration
-
-    Float_t fASPDCvsTCut; // constant for the linear cut in SPD clusters vs tracklets
-    Float_t fBSPDCvsTCut; // slope for the linear cut in SPD  clusters vs tracklets
-
-    // Variables for the TRD triggers
-    Float_t fTRDptHSE;         // pt threshold for HSE trigger
-    UChar_t fTRDpidHSE;                // PID threshold for HSE trigger
-    Float_t fTRDptHQU;         // pt threshold for HQU trigger
-    UChar_t fTRDpidHQU;                // PID threshold for HQU trigger
-    Float_t fTRDptHEE;         // pt threshold for HEE trigger
-    UChar_t fTRDpidHEE;                // PID threshold for HEE trigger
-    UChar_t fTRDminSectorHEE;  // min sector for HEE trigger
-    UChar_t fTRDmaxSectorHEE;  // max sector for HEE trigger
-    Float_t fTRDptHJT;         // pt threshold for HJT trigger
-    UChar_t fTRDnHJT;          // no of track threshold for HJT trigger
-
-    Bool_t  fDoFMD;                 // If false, skips the FMD (physics selection runs much faster)
-    Float_t fFMDLowCut;                    // 
-    Float_t fFMDHitCut;                    // 
-    
-    TH2F* fHistBitsSPD;        // offline trigger bits (calculated from clusters) vs hardware trigger bits
-    TH1F* fHistFiredBitsSPD;   // fired hardware bits
-    TH2F* fHistSPDClsVsTrk;    // histogram of clusters vs tracklet BG cut
-    TH1F* fHistV0A;            // histograms that histogram the criterion the cut is applied on: bb triggers
-    TH1F* fHistV0C;            // histograms that histogram the criterion the cut is applied on: bb triggers
-    TH1F* fHistZDC;            //histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
-    TH1F* fHistTDCZDC;         // histograms that histogram the criterion the cut is applied on: TDC bits (32 bins)
-    TH2F* fHistTimeZDC;        // histograms that histogram the criterion the cut is applied on: ZDC TDC timing
-    TH2F* fHistTimeCorrZDC;    // histograms that histogram the criterion the cut is applied on: ZDC Corrected TDC timing
-    TH1F* fHistFMDA;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
-    TH1F* fHistFMDC;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
-    TH1F* fHistFMDSingle;      // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
-    TH1F* fHistFMDSum;         // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
-    TH1F* fHistT0;             // histograms that histogram the criterion the cut is applied on: bb triggers
-    TMap* fTriggerClasses;    // counts the active trigger classes (uses the full string)
-    
-    Bool_t fMC;              // flag if MC is analyzed
-    AliESDtrackCuts* fEsdTrackCuts;  //Track Cuts to select ESD tracks
-
-    Bool_t fTPCOnly;         // flag to set whether TPC only tracks have to be used for the offline trigger 
-
-    ClassDef(AliTriggerAnalysis, 22)
-    
-  private:
-    AliTriggerAnalysis(const AliTriggerAnalysis&);
-    AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
+class AliTriggerAnalysis : public TObject{
+public:
+  enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND, 
+    kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kZNA, kZNC, kZNABG, kZNCBG, kFMDA, kFMDC, kFPANY, kNSD1, kMB1Prime, 
+    kSPDGFOL0, kSPDGFOL1, kZDCTDCA, kZDCTDCC, kZDCTime, kCTPV0A, kCTPV0C, kTPCLaserWarmUp, kSPDClsVsTrkBG,
+    kCentral,kSemiCentral, kT0, kT0BG, kT0Pileup, kEMCAL, kTPCHVdip,
+    kTRDHCO, kTRDHJT, kTRDHSE, kTRDHQU, kTRDHEE,
+    kEmcalL0,kEmcalL1GammaHigh, kEmcalL1GammaLow, kEmcalL1JetHigh, kEmcalL1JetLow,
+    kIncompleteEvent,
+    kStartOfFlags = 0x0100, kOfflineFlag = 0x8000, kOneParticle = 0x10000, kOneTrack = 0x20000}; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
+  enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
+  enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
+  enum T0Decision { kT0Invalid = -1, kT0Empty = 0, kT0BB, kT0DecBG, kT0DecPileup };
+  static const char* GetTriggerName(Trigger trigger);
+
+  AliTriggerAnalysis();
+  virtual ~AliTriggerAnalysis();
+  void EnableHistograms(Bool_t isLowFlux = kFALSE);
+  void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
+  
+  Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
+  Int_t EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger);
+  Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const; // obsolete
+  Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const;
+  Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
+  
+  // some "raw" trigger functions
+  V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists = kFALSE);
+  T0Decision T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists = kFALSE);
+  Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin) { return SPDFiredChips(aEsd, origin) >= fSPDGFOThreshold; }
+  Bool_t ZDCTrigger   (const AliESDEvent* aEsd, AliceSide side) const;
+  Bool_t ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN=kTRUE, Bool_t useZP=kFALSE, Bool_t fillHists=kFALSE) const;
+  Bool_t ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists=kFALSE) const;
+  Bool_t ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const;
+  Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
+  Bool_t TRDTrigger(const AliESDEvent* esd, Trigger trigger);
+  Bool_t EMCALCellsTrigger(const AliESDEvent *aEsd);
+  Bool_t EMCALTrigger(const AliVEvent* event, Trigger trigger);
+
+  Int_t SSDClusters(const AliVEvent* event);
+  Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE, Int_t layer = 0);
+  Bool_t IsSPDClusterVsTrackletBG(const AliVEvent* event, Bool_t fillHists = kFALSE);
+  Bool_t IsLaserWarmUpTPCEvent(const AliESDEvent* esd);
+  Bool_t IsHVdipTPCEvent(const AliESDEvent* esd);
+  Bool_t IsIncompleteEvent(const AliESDEvent* esd);
+  
+  void FillHistograms(const AliESDEvent* aEsd);
+  void FillTriggerClasses(const AliESDEvent* aEsd);
+  
+  void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
+  void SetSPDGFOEfficiency(TH1F* hist) { fSPDGFOEfficiency = hist; }
+  void SetSPDClustersVsTrackletsParameters(Float_t a, Float_t b) { fASPDCvsTCut = a; fBSPDCvsTCut =b;}
+  void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
+  void SetV0AdcThr(Float_t thr) { fV0AdcThr = thr; }
+  void SetV0HwPars(Float_t thr, Float_t winLow, Float_t winHigh) { fV0HwAdcThr = thr; fV0HwWinLow = winLow; fV0HwWinHigh = winHigh; }
+  void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
+  void SetDoFMD(Bool_t flag = kTRUE) {fDoFMD = flag;}
+  void SetZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSum = refSum; fZDCCutRefDelta = refDelta; fZDCCutSigmaSum = sigmaSum; fZDCCutSigmaDelta = sigmaDelta; }
+  void SetCorrZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSumCorr = refSum; fZDCCutRefDeltaCorr = refDelta; fZDCCutSigmaSumCorr = sigmaSum; fZDCCutSigmaDeltaCorr = sigmaDelta; }
+  void SetZNCorrCutParams(Float_t znaTimeCorrMin, Float_t znaTimeCorrMax, Float_t zncTimeCorrMin, Float_t zncTimeCorrMax)
+  { fZDCCutZNATimeCorrMin = znaTimeCorrMin; fZDCCutZNATimeCorrMax = znaTimeCorrMax; 
+  fZDCCutZNCTimeCorrMin = zncTimeCorrMin; fZDCCutZNCTimeCorrMax = zncTimeCorrMax; }
+  
+  void SetTRDTriggerParameters(Float_t ptHSE, UChar_t pidHSE, Float_t ptHQU, UChar_t pidHQU, Float_t ptHEE, UChar_t pidHEE, UChar_t minSectorHEE, UChar_t maxSectorHEE, Float_t ptHJT, UChar_t nHJT) {
+    fTRDptHSE = ptHSE; fTRDpidHSE = pidHSE;
+    fTRDptHQU = ptHQU; fTRDpidHQU = pidHQU;
+    fTRDptHEE = ptHEE; fTRDpidHEE = pidHEE;
+    fTRDminSectorHEE = minSectorHEE; fTRDmaxSectorHEE = maxSectorHEE;
+    fTRDptHJT = ptHJT; fTRDnHJT = nHJT;
+  }
+  
+  Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
+  Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
+  Float_t GetV0AdcThr()     const { return fV0AdcThr; }
+  Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
+  Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
+  TMap * GetTriggerClasses() const { return fTriggerClasses;}
+  
+  
+  virtual Long64_t Merge(TCollection* list);
+  void SaveHistograms() const;
+  
+  void PrintTriggerClasses() const;
+  void SetESDTrackCuts(AliESDtrackCuts* cuts) { fEsdTrackCuts = cuts;}
+  AliESDtrackCuts* GetESDTrackCuts() const  {return fEsdTrackCuts;}
+  
+  void SetTPCOnly(Bool_t bTPCOnly) {fTPCOnly = bTPCOnly;}
+  Bool_t GetTPCOnly() const {return fTPCOnly;}
+  
+protected:
+  Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const;
+  Float_t V0LeadingTimeWeight(Float_t adc) const;
+  Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
+  
+  Int_t fSPDGFOThreshold;         // number of chips to accept a SPD GF0 trigger
+  TH1F* fSPDGFOEfficiency;         // SPD FASTOR efficiency - is applied in SPDFiredChips. Histogram contains efficiency as function of chip number (bin 1..400: first layer; 401..1200: second layer)
+  
+  Float_t fV0TimeOffset;          // time offset applied to the times read from the V0 (in ns)
+  Float_t fV0AdcThr;              // thresholds applied on V0 ADC data
+  Float_t fV0HwAdcThr;            // online V0 trigger - thresholds applied on ADC data 
+  Float_t fV0HwWinLow;            // online V0 trigger - lower edge of time window
+  Float_t fV0HwWinHigh;           // online V0 trigger - upper edge of time window
+  
+  Float_t fZDCCutRefSum;          // ZDC time cut configuration
+  Float_t fZDCCutRefDelta;        // ZDC time cut configuration
+  Float_t fZDCCutSigmaSum;        // ZDC time cut configuration
+  Float_t fZDCCutSigmaDelta;      // ZDC time cut configuration
+  
+  Float_t fZDCCutRefSumCorr;      // Corrected ZDC time cut configuration
+  Float_t fZDCCutRefDeltaCorr;    // Corrected ZDC time cut configuration
+  Float_t fZDCCutSigmaSumCorr;    // Corrected ZDC time cut configuration
+  Float_t fZDCCutSigmaDeltaCorr;  // Corrected ZDC time cut configuration
+  
+  Float_t fZDCCutZNATimeCorrMin;  // Corrected ZNA time cut configuration
+  Float_t fZDCCutZNATimeCorrMax;  // Corrected ZNA time cut configuration
+  Float_t fZDCCutZNCTimeCorrMin;  // Corrected ZNA time cut configuration
+  Float_t fZDCCutZNCTimeCorrMax;  // Corrected ZNA time cut configuration
+  
+  Float_t fASPDCvsTCut; // constant for the linear cut in SPD clusters vs tracklets
+  Float_t fBSPDCvsTCut; // slope for the linear cut in SPD  clusters vs tracklets
+  
+  // Variables for the TRD triggers
+  Float_t fTRDptHSE;            // pt threshold for HSE trigger
+  UChar_t fTRDpidHSE;           // PID threshold for HSE trigger
+  Float_t fTRDptHQU;            // pt threshold for HQU trigger
+  UChar_t fTRDpidHQU;           // PID threshold for HQU trigger
+  Float_t fTRDptHEE;            // pt threshold for HEE trigger
+  UChar_t fTRDpidHEE;           // PID threshold for HEE trigger
+  UChar_t fTRDminSectorHEE;     // min sector for HEE trigger
+  UChar_t fTRDmaxSectorHEE;     // max sector for HEE trigger
+  Float_t fTRDptHJT;            // pt threshold for HJT trigger
+  UChar_t fTRDnHJT;             // no of track threshold for HJT trigger
+  
+  Bool_t  fDoFMD;               // If false, skips the FMD (physics selection runs much faster)
+  Float_t fFMDLowCut;           // 
+  Float_t fFMDHitCut;           // 
+  
+  TH2F* fHistBitsSPD;        // offline trigger bits (calculated from clusters) vs hardware trigger bits
+  TH1F* fHistFiredBitsSPD;   // fired hardware bits
+  TH2F* fHistSPDClsVsTrk;    // histogram of clusters vs tracklet BG cut
+  TH1F* fHistV0A;            // histograms that histogram the criterion the cut is applied on: bb triggers
+  TH1F* fHistV0C;            // histograms that histogram the criterion the cut is applied on: bb triggers
+  TH1F* fHistZDC;            //histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
+  TH1F* fHistTDCZDC;         // histograms that histogram the criterion the cut is applied on: TDC bits (32 bins)
+  TH2F* fHistTimeZDC;        // histograms that histogram the criterion the cut is applied on: ZDC TDC timing
+  TH2F* fHistTimeCorrZDC;    // histograms that histogram the criterion the cut is applied on: ZDC Corrected TDC timing
+  TH1F* fHistFMDA;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
+  TH1F* fHistFMDC;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
+  TH1F* fHistFMDSingle;      // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
+  TH1F* fHistFMDSum;         // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
+  TH1F* fHistT0;             // histograms that histogram the criterion the cut is applied on: bb triggers
+  TMap* fTriggerClasses;    // counts the active trigger classes (uses the full string)
+  
+  Bool_t fMC;              // flag if MC is analyzed
+  AliESDtrackCuts* fEsdTrackCuts;  //Track Cuts to select ESD tracks
+  
+  Bool_t fTPCOnly;         // flag to set whether TPC only tracks have to be used for the offline trigger 
+  
+  ClassDef(AliTriggerAnalysis, 23)
+  
+private:
+  AliTriggerAnalysis(const AliTriggerAnalysis&);
+  AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
 };
 
 #endif
index 16bd3ce17e55d66424bc66e07802a9b8941c25c4..5db128d3a71ccdb474fd36dc056c5bef9a139597 100644 (file)
@@ -2,7 +2,7 @@ AliGenerator *AddMCGenAmpt()
 {
 // User defined generator
 
-  gSystem->Load("libampt.so ");       
+  gSystem->Load("libampt.so");       
   gSystem->Load("libTAmpt.so");
 
   AliGenAmpt *genAMPT = new AliGenAmpt(-1);
diff --git a/EMCAL/macros/DumpEMCalTriggerOCDB.C b/EMCAL/macros/DumpEMCalTriggerOCDB.C
new file mode 100644 (file)
index 0000000..fc9c4ed
--- /dev/null
@@ -0,0 +1,17 @@
+// Simple macro to access the information of the trigger
+// contained in the OCDB.
+// Input is the patch to an OCDB file in alien.
+
+void DumpEMCalTriggerOCDB(const char *ocdb_file = "")
+{
+  TGrid::Connect("alien://");
+  f = TFile::Open(Form("alien://%s",ocdb_file));
+  e = (AliCDBEntry*)f->Get("AliCDBEntry");
+  d = (AliEMCALTriggerDCSConfig*)e->GetObject();
+  c = (AliEMCALTriggerSTUDCSConfig*)d->GetSTUDCSConfig();
+
+  cout << "L1 fw version: " << c->GetFw() << endl;
+  cout << "L1-jet patch size: " << 2 + (c->GetFw() >> 16) << " sub-regions (4x4 FOR)" << endl;
+
+}
+
index 7d139214ed5d49fda226bdc27a55fb684fa67a62..1bf3569993dab08424cc9dd9403d76d34fb72b6f 100644 (file)
@@ -86,7 +86,7 @@ set ( DHDR  EveDet/EveDetLinkDef.h)
 
 set ( EINCLUDE  RAW EMCAL ITS ITS/UPGRADE TPC TRD TOF T0 MUON MUON/mapping PMD HLT/BASE HLT/BASE/HOMER VZERO EVE/EveDet ANALYSIS STEER/STEER STEER/ESD STEER/STEERBase)
 
-set ( ELIBS -L/usr/X11/lib -lGL -lGLU )
+#set ( ELIBS -L/usr/X11/lib -lGL -lGLU )
 
 set ( EXPORT 
   EveBase/AliEveCosmicRayFitter.h
index 0f6e7443b62e463cc7e68a8ed2bd2dc327d612c8..55491f577f11e675f736e1cbcb22fd97c944d291 100644 (file)
@@ -51,4 +51,4 @@ set ( DHDR  EveHLT/EveHLTLinkDef.h)
 
 set ( EINCLUDE  HLT/BASE HLT/EVE HLT/BASE/util HLT/BASE/HOMER EVE/EveHLT STEER/ESD STEER/STEERBase)
 
-set (ELIBS -L/usr/X11/lib -lGL -lGLU)
+#set (ELIBS -L/usr/X11/lib -lGL -lGLU)
index 314b29ec84863be5c87a9e10264ecf3d22741233..b9f74435bc115a0f391a1cb9a583341b1c2ce06c 100644 (file)
@@ -215,7 +215,7 @@ void alieve_online_on_new_event()
         gSystem->HostName(), delta);
 
   AliSysInfo::AddStamp("on_new_event_pic");
-  // if (pichost == gSystem->HostName() && delta >= 30)
+  if (pichost == gSystem->HostName() && delta >= 30)
   {
     TString id;      id.Form("online-viz-%03d", g_pic_id);
     TString pic(id); pic += ".png";
@@ -244,7 +244,7 @@ void alieve_online_on_new_event()
       g_pic_id = 0;
     g_pic_prev.Set();
   }
-       AliSysInfo::AddStamp("on_new_event_end");
+  AliSysInfo::AddStamp("on_new_event_end");
 }
 
 void alieve_init_import_macros()
index 2db7bfdd04ed041d11bd02fcf6cfca9b4a52705a..7e32ec36400519dd2f369f7715ef03c8ffe029cb 100644 (file)
@@ -52,344 +52,535 @@ ClassImp(AliGenEMCocktail)
 //________________________________________________________________________
 AliGenEMCocktail::AliGenEMCocktail()
 :AliGenCocktail(),
-   fDecayer(0),
-   fDecayMode(kAll),
-   fWeightingMode(kNonAnalog),
-   fNPart(1000),
-  fYieldArray(),
-  fPtSelect(AliGenEMlib::kPizero7TeVpp),
-  fCentrality(AliGenEMlib::kpp),
-  fV2Systematic(AliGenEMlib::kNoV2Sys),
-  fForceConv(kFALSE),
-  fSelectedParticles(kGenPizero)
+       fDecayer(0),
+       fDecayMode(kAll),
+       fWeightingMode(kNonAnalog),
+       fNPart(1000),
+       fYieldArray(),
+       fCollisionSystem(AliGenEMlib::kpp7TeV),
+       fPtSelectPi0(AliGenEMlib::kPizeroParam),
+       fPtSelectEta(AliGenEMlib::kEtaParampp),
+       fPtSelectOmega(AliGenEMlib::kOmegaParampp),
+       fPtSelectPhi(AliGenEMlib::kPhiParampp),
+       fCentrality(AliGenEMlib::kpp),
+       fV2Systematic(AliGenEMlib::kNoV2Sys),
+       fForceConv(kFALSE),
+       fSelectedParticles(kGenHadrons)
 {
-  // Constructor
-  SetHeaviestHadron(kGenPhi);
+       // Constructor
 }
 
 //_________________________________________________________________________
 AliGenEMCocktail::~AliGenEMCocktail()
 {
-  // Destructor
-
+       // Destructor
 }
 
 //_________________________________________________________________________
-void AliGenEMCocktail::SetHeaviestHadron(ParticeGenerator_t part)
+void AliGenEMCocktail::SetHeaviestHadron(ParticleGenerator_t part)
 {
-  Int_t val=kGenPizero;
-  while(val<part) val|=val<<1;
+       Int_t val=kGenPizero;
+       while(val<part) val|=val<<1;
 
-  fSelectedParticles=val;
+       fSelectedParticles=val;
+       return;
 }
 
 //_________________________________________________________________________
 void AliGenEMCocktail::CreateCocktail()
 {
-  // create and add sources to the cocktail
-
-  fDecayer->SetForceDecay(fDecayMode);
-  fDecayer->ForceDecay();
-
-  // Set kinematic limits
-  Double_t ptMin  = fPtMin;
-  Double_t ptMax  = fPtMax;
-  Double_t yMin   = fYMin;;
-  Double_t yMax   = fYMax;;
-  Double_t phiMin = fPhiMin*180./TMath::Pi();
-  Double_t phiMax = fPhiMax*180./TMath::Pi();
-  AliInfo(Form("Ranges pT:%4.1f : %4.1f GeV/c, y:%4.2f : %4.2f, Phi:%5.1f : %5.1f degres",ptMin,ptMax,yMin,yMax,phiMin,phiMax));
-  AliInfo(Form("the parametrised sources uses the decay mode %d",fDecayMode));
-
-  //Initialize user selection for Pt Parameterization and centrality:
-  AliGenEMlib::SelectParams(fPtSelect,fCentrality,fV2Systematic);
-
-  // Create and add electron sources to the generator
-  // pizero
-  if(fSelectedParticles&kGenPizero){
-  AliGenParam *genpizero=0;
-  Char_t namePizero[10];    
-  snprintf(namePizero,10,"Pizero");    
-    //fNPart/0.925: increase number of particles so that we have the chosen number of particles in the chosen eta range
-  genpizero = new AliGenParam(fNPart/0.925, new AliGenEMlib(), AliGenEMlib::kPizero, "DUMMY");
-    //fYMin/0.925: increase eta range, so that the electron yield is constant (<5% change) over the chosen eta range
-  genpizero->SetYRange(fYMin/0.925, fYMax/0.925);
-  AddSource2Generator(namePizero,genpizero);
-  TF1 *fPtPizero = genpizero->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // eta  
-  if(fSelectedParticles&kGenEta){
-  AliGenParam *geneta=0;
-  Char_t nameEta[10];    
-  snprintf(nameEta,10,"Eta");    
-  geneta = new AliGenParam(fNPart/0.825, new AliGenEMlib(), AliGenEMlib::kEta, "DUMMY");
-  geneta->SetYRange(fYMin/0.825, fYMax/0.825);
-  AddSource2Generator(nameEta,geneta);
-  TF1 *fPtEta = geneta->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // rho  
-  if(fSelectedParticles&kGenRho){
-  AliGenParam *genrho=0;
-  Char_t nameRho[10];    
-  snprintf(nameRho,10,"Rho");    
-  genrho = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kRho, "DUMMY");
-  genrho->SetYRange(fYMin/0.775, fYMax/0.775);
-  AddSource2Generator(nameRho,genrho);
-  TF1 *fPtRho = genrho->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kRho] = fPtRho->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kRho] = fPtRho->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-  
-  // omega
-  if(fSelectedParticles&kGenOmega){
-  AliGenParam *genomega=0;
-  Char_t nameOmega[10];    
-  snprintf(nameOmega,10,"Omega");    
-  genomega = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kOmega, "DUMMY");
-  genomega->SetYRange(fYMin/0.775, fYMax/0.775);
-  AddSource2Generator(nameOmega,genomega);
-  TF1 *fPtOmega = genomega->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // etaprime
-  if(fSelectedParticles&kGenEtaprime){
-  AliGenParam *genetaprime=0;
-  Char_t nameEtaprime[10];    
-  snprintf(nameEtaprime,10,"Etaprime");    
-  genetaprime = new AliGenParam(fNPart/0.725, new AliGenEMlib(), AliGenEMlib::kEtaprime, "DUMMY");
-  genetaprime->SetYRange(fYMin/0.725, fYMax/0.725);
-  AddSource2Generator(nameEtaprime,genetaprime);
-  TF1 *fPtEtaprime = genetaprime->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // phi  
-  if(fSelectedParticles&kGenPhi){
-  AliGenParam *genphi=0;
-  Char_t namePhi[10];    
-  snprintf(namePhi,10,"Phi");    
-  genphi = new AliGenParam(fNPart/0.725, new AliGenEMlib(), AliGenEMlib::kPhi, "DUMMY");
-  genphi->SetYRange(fYMin/0.725, fYMax/0.725);
-  AddSource2Generator(namePhi,genphi);
-  TF1 *fPtPhi = genphi->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // jpsi  
-  if(fSelectedParticles&kGenJpsi){
-  AliGenParam *genjpsi=0;
-  Char_t nameJpsi[10];    
-  snprintf(nameJpsi,10,"Jpsi");    
-  genjpsi = new AliGenParam(fNPart/0.525, new AliGenEMlib(), AliGenEMlib::kJpsi, "DUMMY");
-  genjpsi->SetYRange(fYMin/0.525, fYMax/0.525);
-  AddSource2Generator(nameJpsi,genjpsi);
-  TF1 *fPtJpsi = genjpsi->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  // direct gamma
-  if(fDecayMode!=kGammaEM) return;
-  if(fSelectedParticles&kGenDirectRealGamma){
-    AliGenParam *genDirectRealG=0;
-    Char_t nameDirectRealG[10];    
-    snprintf(nameDirectRealG,10,"DirectRealGamma");    
-    genDirectRealG = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDirectRealGamma, "DUMMY");
-    genDirectRealG->SetYRange(fYMin, fYMax);
-    AddSource2Generator(nameDirectRealG,genDirectRealG);
-    TF1 *fPtDirectRealG = genDirectRealG->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
-
-  if(fSelectedParticles&kGenDirectVirtGamma){
-    TDatabasePDG::Instance()->AddParticle("DirectVirtGamma","DirectVirtGamma",0,true,0,0,"GaugeBoson",220000);
-    AliGenParam *genDirectVirtG=0;
-    Char_t nameDirectVirtG[10];    
-    snprintf(nameDirectVirtG,10,"DirectVirtGamma");    
-    genDirectVirtG = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kDirectVirtGamma, "DUMMY");
-    genDirectVirtG->SetYRange(fYMin/0.775, fYMax/0.775);
-    AddSource2Generator(nameDirectVirtG,genDirectVirtG);
-    TF1 *fPtDirectVirtG = genDirectVirtG->GetPt();
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
-    fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,1.e-6);
-#else
-    fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
-#endif
-  }
+       // create and add sources to the cocktail
+
+       fDecayer->SetForceDecay(fDecayMode);
+       fDecayer->ForceDecay();
+
+       // Set kinematic limits
+       Double_t ptMin  = fPtMin;
+       Double_t ptMax  = fPtMax;
+       Double_t yMin   = fYMin;;
+       Double_t yMax   = fYMax;;
+       Double_t phiMin = fPhiMin*180./TMath::Pi();
+       Double_t phiMax = fPhiMax*180./TMath::Pi();
+       AliInfo(Form("Ranges pT:%4.1f : %4.1f GeV/c, y:%4.2f : %4.2f, Phi:%5.1f : %5.1f degres",ptMin,ptMax,yMin,yMax,phiMin,phiMax));
+       AliInfo(Form("the parametrised sources uses the decay mode %d",fDecayMode));
+       AliInfo(Form("Selected Params:collision system - %d , centrality - %d, pi0 param - %d, eta param - %d, omega param - %d, phi param - %d",fCollisionSystem, fCentrality, fPtSelectPi0, fPtSelectEta, fPtSelectOmega, fPtSelectPhi));
+       //Initialize user selection for Pt Parameterization and centrality:
+       AliGenEMlib::SelectParams(fCollisionSystem, fPtSelectPi0, fPtSelectEta, fPtSelectOmega, fPtSelectPhi, fCentrality,fV2Systematic);
+
+       // Create and add electron sources to the generator
+       // pizero
+       if(fSelectedParticles&kGenPizero){
+               AliGenParam *genpizero=0;
+               Char_t namePizero[10];    
+               snprintf(namePizero,10,"Pizero");    
+                       //fNPart/0.925: increase number of particles so that we have the chosen number of particles in the chosen eta range
+       //      genpizero = new AliGenParam(fNPart/0.925, new AliGenEMlib(), AliGenEMlib::kPizero, "DUMMY");
+                       //fYMin/0.925: increase eta range, so that the electron yield is constant (<5% change) over the chosen eta range
+               genpizero->SetYRange(fYMin/0.925, fYMax/0.925);
+               
+               // NOTE Theo: fNPart/0.925: increase number of particles so that we have the chosen number of particles in the chosen eta range
+               // NOTE Theo: fYMin/0.925: increase eta range, so that the electron yield is constant (<5% change) over the chosen eta range
+               // NOTE Friederike: the additional factors here cannot be fixed numbers, if you need them 
+               //                                      generate a setting which puts them for you but never do it hardcoded - electrons are not the only ones 
+               //                                      using the cocktail
+               genpizero = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kPizero, "DUMMY");
+               genpizero->SetYRange(fYMin, fYMax);
+
+               AddSource2Generator(namePizero,genpizero);
+               TF1 *fPtPizero = genpizero->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // eta  
+       if(fSelectedParticles&kGenEta){
+               AliGenParam *geneta=0;
+               Char_t nameEta[10];    
+               snprintf(nameEta,10,"Eta");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               geneta = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kEta, "DUMMY");
+               geneta->SetYRange(fYMin, fYMax);
+
+               AddSource2Generator(nameEta,geneta);
+               TF1 *fPtEta = geneta->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // rho  
+       if(fSelectedParticles&kGenRho0){
+               AliGenParam *genrho=0;
+               Char_t nameRho[10];    
+               snprintf(nameRho,10,"Rho");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genrho = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kRho0, "DUMMY");
+               genrho->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameRho,genrho);
+               TF1 *fPtRho = genrho->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kRho0] = fPtRho->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kRho0] = fPtRho->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+       
+       // omega
+       if(fSelectedParticles&kGenOmega){
+               AliGenParam *genomega=0;
+               Char_t nameOmega[10];    
+               snprintf(nameOmega,10,"Omega");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genomega = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kOmega, "DUMMY");
+               genomega->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameOmega,genomega);
+               TF1 *fPtOmega = genomega->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // etaprime
+       if(fSelectedParticles&kGenEtaprime){
+               AliGenParam *genetaprime=0;
+               Char_t nameEtaprime[10];    
+               snprintf(nameEtaprime,10,"Etaprime");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genetaprime = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kEtaprime, "DUMMY");
+               genetaprime->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameEtaprime,genetaprime);
+               TF1 *fPtEtaprime = genetaprime->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // phi  
+       if(fSelectedParticles&kGenPhi){
+               AliGenParam *genphi=0;
+               Char_t namePhi[10];    
+               snprintf(namePhi,10,"Phi");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genphi = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kPhi, "DUMMY");
+               genphi->SetYRange(fYMin, fYMax);
+               AddSource2Generator(namePhi,genphi);
+               TF1 *fPtPhi = genphi->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // jpsi  
+       if(fSelectedParticles&kGenJpsi){
+               AliGenParam *genjpsi=0;
+               Char_t nameJpsi[10];    
+               snprintf(nameJpsi,10,"Jpsi");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genjpsi = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kJpsi, "DUMMY");
+               genjpsi->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameJpsi,genjpsi);
+               TF1 *fPtJpsi = genjpsi->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       // sigma  
+       if(fSelectedParticles&kGenSigma0){
+               AliGenParam * gensigma=0;
+               Char_t nameSigma[10];    
+               snprintf(nameSigma,10, "Sigma0");    
+               gensigma = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kSigma0, "DUMMY");
+               gensigma->SetYRange(fYMin, fYMax);
+
+               AddSource2Generator(nameSigma,gensigma);
+               TF1 *fPtSigma = gensigma->GetPt();
+               #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
+                       fYieldArray[kSigma0] = fPtSigma->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #else
+                       fYieldArray[kSigma0] = fPtSigma->Integral(fPtMin,fPtMax,1.e-6);
+               #endif
+       }
+       
+       // k0short
+       if(fSelectedParticles&kGenK0s){
+               AliGenParam * genkzeroshort=0;
+               Char_t nameK0short[10];    
+               snprintf(nameK0short, 10, "K0short");    
+               genkzeroshort = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kK0s, "DUMMY");
+               genkzeroshort->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameK0short,genkzeroshort);
+               TF1 *fPtK0short = genkzeroshort->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kK0s] = fPtK0short->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kK0s] = fPtK0short->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }       
+       
+       // Delta++
+       if(fSelectedParticles&kGenDeltaPlPl){
+               AliGenParam * genkdeltaPlPl=0;
+               Char_t nameDeltaPlPl[10];    
+               snprintf(nameDeltaPlPl, 10, "DeltaPlPl");    
+               genkdeltaPlPl = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDeltaPlPl, "DUMMY");
+               genkdeltaPlPl->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameDeltaPlPl,genkdeltaPlPl);
+               TF1 *fPtDeltaPlPl = genkdeltaPlPl->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDeltaPlPl] = fPtDeltaPlPl->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDeltaPlPl] = fPtDeltaPlPl->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+       
+       // Delta+
+       if(fSelectedParticles&kGenDeltaPl){
+               AliGenParam * genkdeltaPl=0;
+               Char_t nameDeltaPl[10];    
+               snprintf(nameDeltaPl, 10, "DeltaPl");    
+               genkdeltaPl = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDeltaPl, "DUMMY");
+               genkdeltaPl->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameDeltaPl,genkdeltaPl);
+               TF1 *fPtDeltaPl = genkdeltaPl->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDeltaPl] = fPtDeltaPl->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDeltaPl] = fPtDeltaPl->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+       
+       // Delta-
+       if(fSelectedParticles&kGenDeltaMi){
+               AliGenParam * genkdeltaMi=0;
+               Char_t nameDeltaMi[10];    
+               snprintf(nameDeltaMi, 10, "DeltaMi");    
+               genkdeltaMi = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDeltaMi, "DUMMY");
+               genkdeltaMi->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameDeltaMi,genkdeltaMi);
+               TF1 *fPtDeltaMi = genkdeltaMi->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDeltaMi] = fPtDeltaMi->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDeltaMi] = fPtDeltaMi->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+       
+       // Delta0
+       if(fSelectedParticles&kGenDeltaZero){   
+               AliGenParam * genkdeltaZero=0;
+               Char_t nameDeltaZero[10];    
+               snprintf(nameDeltaZero, 10, "DeltaZero");    
+               genkdeltaZero = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDeltaZero, "DUMMY");
+               genkdeltaZero->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameDeltaZero,genkdeltaZero);
+               TF1 *fPtDeltaZero = genkdeltaZero->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDeltaZero] = fPtDeltaZero->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDeltaZero] = fPtDeltaZero->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+       
+       // rho+
+       if(fSelectedParticles&kGenRhoPl){       
+               AliGenParam * genkrhoPl=0;
+               Char_t nameRhoPl[10];    
+               snprintf(nameRhoPl, 10, "RhoPl");    
+               genkrhoPl = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kRhoPl, "DUMMY");
+               genkrhoPl->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameRhoPl,genkrhoPl);
+               TF1 *fPtRhoPl = genkrhoPl->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kRhoPl] = fPtRhoPl->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kRhoPl] = fPtRhoPl->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+
+       // rho-
+       if(fSelectedParticles&kGenRhoMi){       
+               AliGenParam * genkrhoMi=0;
+               Char_t nameRhoMi[10];    
+               snprintf(nameRhoMi, 10, "RhoMi");    
+               genkrhoMi = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kRhoMi, "DUMMY");
+               genkrhoMi->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameRhoMi,genkrhoMi);
+               TF1 *fPtRhoMi = genkrhoMi->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kRhoMi] = fPtRhoMi->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kRhoMi] = fPtRhoMi->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+
+       // K0*
+       if(fSelectedParticles&kGenK0star){      
+               AliGenParam * genkK0star=0;
+               Char_t nameK0star[10];    
+               snprintf(nameK0star, 10, "K0star");    
+               genkK0star = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kK0star, "DUMMY");
+               genkK0star->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameK0star,genkK0star);
+               TF1 *fPtK0star = genkK0star->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kK0star] = fPtK0star->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kK0star] = fPtK0star->Integral(fPtMin,fPtMax,(Double_t*)0,1.e-6);
+               #endif
+       }
+
+       // direct gamma
+       if(fDecayMode!=kGammaEM) return;
+
+       if(fSelectedParticles&kGenDirectRealGamma){
+               AliGenParam *genDirectRealG=0;
+               Char_t nameDirectRealG[10];    
+               snprintf(nameDirectRealG,10,"DirectRealGamma");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genDirectRealG = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDirectRealGamma, "DUMMY");
+               genDirectRealG->SetYRange(fYMin, fYMax);
+               AddSource2Generator(nameDirectRealG,genDirectRealG);
+               TF1 *fPtDirectRealG = genDirectRealG->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
+
+       if(fSelectedParticles&kGenDirectVirtGamma){
+               TDatabasePDG::Instance()->AddParticle("DirectVirtGamma","DirectVirtGamma",0,true,0,0,"GaugeBoson",220000);
+               AliGenParam *genDirectVirtG=0;
+               Char_t nameDirectVirtG[10];    
+               snprintf(nameDirectVirtG,10,"DirectVirtGamma");    
+               // NOTE: the additional factors are set back to one as they are not the same for photons and electrons
+               genDirectVirtG = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDirectVirtGamma, "DUMMY");
+               genDirectVirtG->SetYRange(fYMin, fYMax);        
+               AddSource2Generator(nameDirectVirtG,genDirectVirtG);
+               TF1 *fPtDirectVirtG = genDirectVirtG->GetPt();
+               #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+                       fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,1.e-6);
+               #else
+                       fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6);
+               #endif
+       }
 }
 
 //-------------------------------------------------------------------
 void AliGenEMCocktail::AddSource2Generator(Char_t* nameSource, 
                                         AliGenParam* const genSource)
 {
-// add sources to the cocktail
-  Double_t phiMin = fPhiMin*180./TMath::Pi();
-  Double_t phiMax = fPhiMax*180./TMath::Pi();
-
-  genSource->SetPtRange(fPtMin, fPtMax);  
-  genSource->SetPhiRange(phiMin, phiMax);
-  genSource->SetWeighting(fWeightingMode);
-  genSource->SetForceGammaConversion(fForceConv);
-  if (!TVirtualMC::GetMC()) genSource->SetDecayer(fDecayer);  
-  genSource->Init();
-    
-  AddGenerator(genSource,nameSource,1.); // Adding Generator    
+       // add sources to the cocktail
+       Double_t phiMin = fPhiMin*180./TMath::Pi();
+       Double_t phiMax = fPhiMax*180./TMath::Pi();
+
+       genSource->SetPtRange(fPtMin, fPtMax);  
+       genSource->SetPhiRange(phiMin, phiMax);
+       genSource->SetWeighting(fWeightingMode);
+       genSource->SetForceGammaConversion(fForceConv);
+       if (!TVirtualMC::GetMC()) genSource->SetDecayer(fDecayer);  
+       genSource->Init();
+               
+       AddGenerator(genSource,nameSource,1.); // Adding Generator    
 }
 
 //-------------------------------------------------------------------
 void AliGenEMCocktail::Init()
 {
-  // Initialisation
-  TIter next(fEntries);
-  AliGenCocktailEntry *entry;
-  if (fStack) {
-    while((entry = (AliGenCocktailEntry*)next())) {
-      entry->Generator()->SetStack(fStack);
-    }
-  }
+       // Initialisation
+       TIter next(fEntries);
+       AliGenCocktailEntry *entry;
+       if (fStack) {
+               while((entry = (AliGenCocktailEntry*)next())) {
+               entry->Generator()->SetStack(fStack);
+               }
+       }
 }
 
 //_________________________________________________________________________
 void AliGenEMCocktail::Generate()
 {
-  // Generate event 
-  TIter next(fEntries);
-  AliGenCocktailEntry *entry = 0;
-  AliGenCocktailEntry *preventry = 0;
-  AliGenerator* gen = 0;
-
-  if (fHeader) delete fHeader;
-  fHeader = new AliGenCocktailEventHeader("Electromagnetic Cocktail Header");
-
-  const TObjArray *partArray = gAlice->GetMCApp()->Particles();
-    
-  // Generate the vertex position used by all generators    
-  if(fVertexSmear == kPerEvent) Vertex();
-
-  //Reseting stack
-  AliRunLoader * runloader = AliRunLoader::Instance();
-  if (runloader)
-    if (runloader->Stack())
-      runloader->Stack()->Clean();
-  
-  // Loop over generators and generate events
-  Int_t igen = 0;
-  Float_t evPlane;
-  Rndm(&evPlane,1);
-  evPlane*=TMath::Pi()*2;
-  while((entry = (AliGenCocktailEntry*)next())) {
-    gen = entry->Generator();
-    gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2));
-    
-    if (fNPart > 0) {
-      igen++;  
-      if (igen == 1) entry->SetFirst(0);               
-      else  entry->SetFirst((partArray->GetEntriesFast())+1);
-      gen->SetEventPlane(evPlane);
-      gen->Generate();
-      entry->SetLast(partArray->GetEntriesFast());
-      preventry = entry;
-    }
-  }  
-  next.Reset();
-
-  // Setting weights for proper absolute normalization
-  Int_t iPart, iMother;
-  Int_t pdgMother = 0;
-  Double_t weight = 0.;
-  Double_t dNdy = 0.;
-  Int_t maxPart = partArray->GetEntriesFast();
-  for(iPart=0; iPart<maxPart; iPart++){      
-    TParticle *part = gAlice->GetMCApp()->Particle(iPart);
-    iMother = part->GetFirstMother();
-    TParticle *mother = 0;
-    if (iMother>=0){
-      mother = gAlice->GetMCApp()->Particle(iMother);
-      pdgMother = mother->GetPdgCode();
-    }
-    else
-      pdgMother = part->GetPdgCode();
-
-    switch (pdgMother){
-    case 111:
-      dNdy = fYieldArray[kPizero];
-      break;
-    case 221:
-      dNdy = fYieldArray[kEta];
-      break;
-    case 113:
-      dNdy = fYieldArray[kRho];
-      break;
-    case 223:
-      dNdy = fYieldArray[kOmega];
-      break;
-    case 331:
-      dNdy = fYieldArray[kEtaprime];
-      break;
-    case 333:
-      dNdy = fYieldArray[kPhi];
-      break;
-    case 443:
-      dNdy = fYieldArray[kJpsi];
-      break;
-    case 22:
-      dNdy = fYieldArray[kDirectRealGamma];
-      break;
-    case 220000:
-      dNdy = fYieldArray[kDirectVirtGamma];
-      break;
-      
-    default:
-      dNdy = 0.;
-    }
-
-    weight = dNdy*part->GetWeight();
-    part->SetWeight(weight);
-  }    
-  
-  fHeader->SetNProduced(maxPart);
-
-
-  TArrayF eventVertex;
-  eventVertex.Set(3);
-  for (Int_t j=0; j < 3; j++) eventVertex[j] = fVertex[j];
-  
-  fHeader->SetPrimaryVertex(eventVertex);
-
-  gAlice->SetGenEventHeader(fHeader);
+       // Generate event 
+       TIter next(fEntries);
+       AliGenCocktailEntry *entry = 0;
+       AliGenCocktailEntry *preventry = 0;
+       AliGenerator* gen = 0;
+
+       if (fHeader) delete fHeader;
+       fHeader = new AliGenCocktailEventHeader("Electromagnetic Cocktail Header");
+
+       const TObjArray *partArray = gAlice->GetMCApp()->Particles();
+               
+       // Generate the vertex position used by all generators    
+       if(fVertexSmear == kPerEvent) Vertex();
+
+       //Reseting stack
+       AliRunLoader * runloader = AliRunLoader::Instance();
+       if (runloader)
+               if (runloader->Stack())
+               runloader->Stack()->Clean();
+       
+       // Loop over generators and generate events
+       Int_t igen = 0;
+       Float_t evPlane;
+       Rndm(&evPlane,1);
+       evPlane*=TMath::Pi()*2;
+       while((entry = (AliGenCocktailEntry*)next())) {
+               gen = entry->Generator();
+               gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2));
+               
+               if (fNPart > 0) {
+               igen++; 
+               if (igen == 1) entry->SetFirst(0);              
+               else  entry->SetFirst((partArray->GetEntriesFast())+1);
+               gen->SetEventPlane(evPlane);
+               gen->Generate();
+               entry->SetLast(partArray->GetEntriesFast());
+               preventry = entry;
+               }
+       }  
+       next.Reset();
+
+       // Setting weights for proper absolute normalization
+       Int_t iPart, iMother;
+       Int_t pdgMother = 0;
+       Double_t weight = 0.;
+       Double_t dNdy = 0.;
+       Int_t maxPart = partArray->GetEntriesFast();
+       for(iPart=0; iPart<maxPart; iPart++){      
+               TParticle *part = gAlice->GetMCApp()->Particle(iPart);
+               iMother = part->GetFirstMother();
+               TParticle *mother = 0;
+               if (iMother>=0){
+                       mother = gAlice->GetMCApp()->Particle(iMother);
+                       pdgMother = mother->GetPdgCode();
+               } else pdgMother = part->GetPdgCode();
+
+               switch (pdgMother){
+                       case 111:
+                               dNdy = fYieldArray[kPizero];
+                               break;
+                       case 221:
+                               dNdy = fYieldArray[kEta];
+                               break;
+                       case 113:
+                               dNdy = fYieldArray[kRho0];
+                               break;
+                       case 223:
+                               dNdy = fYieldArray[kOmega];
+                               break;
+                       case 331:
+                               dNdy = fYieldArray[kEtaprime];
+                               break;
+                       case 333:
+                               dNdy = fYieldArray[kPhi];
+                               break;
+                       case 443:
+                               dNdy = fYieldArray[kJpsi];
+                               break;
+                       case 22:
+                               dNdy = fYieldArray[kDirectRealGamma];
+                               break;
+                       case 220000:
+                               dNdy = fYieldArray[kDirectVirtGamma];
+                               break;
+                       case 3212:
+                               dNdy = fYieldArray[kSigma0];
+                               break;                          
+                       case 310:
+                               dNdy = fYieldArray[kK0s];
+                               break;
+                       case 2224:
+                               dNdy = fYieldArray[kDeltaPlPl];
+                               break;
+                       case 2214:
+                               dNdy = fYieldArray[kDeltaPl];
+                               break;
+                       case 1114:
+                               dNdy = fYieldArray[kDeltaMi];
+                               break;
+                       case 2114:
+                               dNdy = fYieldArray[kDeltaZero];
+                               break;
+                       case 213:       
+                               dNdy = fYieldArray[kRhoPl];
+                               break;
+                       case -213:      
+                               dNdy = fYieldArray[kRhoMi];
+                               break;
+                       case 313:       
+                               dNdy = fYieldArray[kK0star];
+                               break;
+                       default:
+                               dNdy = 0.;
+               }
+
+               weight = dNdy*part->GetWeight();
+               part->SetWeight(weight);
+       }       
+       
+       fHeader->SetNProduced(maxPart);
+
+
+       TArrayF eventVertex;
+       eventVertex.Set(3);
+       for (Int_t j=0; j < 3; j++) eventVertex[j] = fVertex[j];
+       
+       fHeader->SetPrimaryVertex(eventVertex);
+
+       gAlice->SetGenEventHeader(fHeader);
 }
index 62f7476847191dc159d96bc4cac4a6aa9c89e40c..777e6f8d0b09e30bf924e2fdeaadb17a713354b1 100644 (file)
@@ -20,50 +20,83 @@ class AliGenCocktailEntry;
 
 class AliGenEMCocktail : public AliGenCocktail
 {
-public:
-
-    AliGenEMCocktail();
-  enum GeneratorIndex_t { kPizero=0, kEta, kRho, kOmega, kEtaprime, kPhi, kJpsi, kDirectRealGamma, kDirectVirtGamma, kGENs };
-  enum ParticeGenerator_t { kGenPizero=0x001, kGenEta=0x002, kGenRho=0x004, kGenOmega=0x008, kGenEtaprime=0x010, kGenPhi=0x020, kGenJpsi=0x040, kGenDirectRealGamma=0x100, kGenDirectVirtGamma=0x200, kGenHadrons=0x7f, kGenGammas=0x300 };
-
-    virtual ~AliGenEMCocktail();    
-    virtual void Init();
-    virtual void CreateCocktail();
-    virtual void Generate();    
-    Float_t GetDecayMode()         const {return fDecayMode;}
-    Float_t GetWeightingMode()     const {return fWeightingMode;}
-    void    SetDecayer(AliDecayer* const decayer){fDecayer = decayer;}
-    void    SetDecayMode(Decay_t decay){ fDecayMode = decay;}
-    void    SetWeightingMode(Weighting_t weight){ fWeightingMode = weight;}
-  void    SetNPart(Int_t npart){ fNPart = npart; }
-  void    SetPtParam(AliGenEMlib::PtParamSet_t PtSelect){ fPtSelect = PtSelect; }
-  void    SetCentrality(AliGenEMlib::Centrality_t cent){ fCentrality = cent; }
-  void    SetV2Systematic(Int_t v2sys){ fV2Systematic = v2sys; }
-  void    SetForceGammaConversion(Bool_t force=kTRUE){ fForceConv=force; }
-  void    SetHeaviestHadron(ParticeGenerator_t part);
-  void    SelectMotherParticles(ParticeGenerator_t part){ fSelectedParticles=part; }
-    
-private:
-    AliGenEMCocktail(const AliGenEMCocktail &cocktail); 
-    AliGenEMCocktail & operator=(const AliGenEMCocktail &cocktail); 
+       public:
 
-    void AddSource2Generator(Char_t *nameReso, AliGenParam* const genReso);
-    
-    AliDecayer* fDecayer;        // External decayer
-  Decay_t fDecayMode;   //decay mode in which resonances are forced to decay, default: kAll
-  Weighting_t fWeightingMode; //weighting mode: kAnalog or kNonAnalog
+               AliGenEMCocktail();
+               enum GeneratorIndex_t { kPizero=0, kEta, kRho0, kOmega, kEtaprime, kPhi, kJpsi, kSigma0, kK0s, kDeltaPlPl, kDeltaPl, kDeltaMi, kDeltaZero, kRhoPl, kRhoMi, kK0star, kDirectRealGamma, kDirectVirtGamma, kGENs };
+               enum ParticleGenerator_t {      kGenPizero = 0x00001,           kGenEta = 0x00002,                              kGenRho0 = 0x00004,     kGenOmega = 0x00008, 
+                                                               kGenEtaprime = 0x00010,                 kGenPhi = 0x000020,                     kGenJpsi = 0x000040, 
+                                                               kGenDirectRealGamma = 0x00100,  kGenDirectVirtGamma = 0x00200,  kGenSigma0 = 0x00400,   kGenK0s = 0x00800,
+                                                               kGenDeltaPlPl = 0x01000,                kGenDeltaPl = 0x02000,                  kGenDeltaMi = 0x04000,  kGenDeltaZero = 0x08000, 
+                                                               kGenRhoPl = 0x10000,                    kGenRhoMi = 0x20000,                    kGenK0star = 0x40000,   
+                                                               kGenHadrons = 0x100000,                 kGenGammas = 0x200000 };
+
+               virtual ~AliGenEMCocktail();    
+               virtual void Init();
+               virtual void CreateCocktail();
+               virtual void Generate();    
+               Float_t GetDecayMode()                                                                  const   { return fDecayMode                     ;}
+               Float_t GetWeightingMode()                                                              const   { return fWeightingMode         ;}
+               void    SetDecayer(AliDecayer* const decayer)                                           { fDecayer = decayer            ;}
+               void    SetDecayMode(Decay_t decay)                                                                     { fDecayMode = decay            ;}
+               void    SetWeightingMode(Weighting_t weight)                                            { fWeightingMode = weight       ;}
+               void    SetNPart(Int_t npart){ fNPart = npart; }
+               void    SetPtParamPi0(AliGenEMlib::PtParamSetPi0_t PtSelect)            { fPtSelectPi0 = PtSelect       ;}
+               void    SetPtParamEta(AliGenEMlib::PtParamSetEta_t PtSelect)            { fPtSelectEta = PtSelect       ;}
+               void    SetPtParamOmega(AliGenEMlib::PtParamSetOmega_t PtSelect)        { fPtSelectOmega = PtSelect     ;}
+               void    SetPtParamPhi(AliGenEMlib::PtParamSetPhi_t PtSelect)            { fPtSelectPhi = PtSelect       ;}
+               void    SetCollisionSystem(AliGenEMlib::CollisionSystem_t col)          { fCollisionSystem = col        ;}
+               void    SetCentrality(AliGenEMlib::Centrality_t cent)                           { fCentrality = cent            ;}
+               void    SetV2Systematic(AliGenEMlib::v2Sys_t v2sys)                                     { fV2Systematic = v2sys         ;}
+               void    SetForceGammaConversion(Bool_t force=kTRUE)                                     { fForceConv=force                      ;}
+               void    SetHeaviestHadron(ParticleGenerator_t part);
     
-    Int_t    fNPart;             // multiplicity of each source per event
-    Double_t fYieldArray[kGENs]; // array of dN/dy for each source
+               //***********************************************************************************************
+               // This function allows to select the particle which should be procude based on 1 Integer value
+               // this integer value is then bitwise compare to the values in SelectParticle
+               // Examples: 
+               // a) you would like to switch on: pi0, eta, rho0, omega, eta', phi, jpsi, sigma0 and all deltas
+               //    implies you want the binary number: 00 1111 0100 0111 1111 = 
+               //        which translates 62591_10 (in decimal) and F47F_16 (in hexadecimal)
+               // b) you would like to switch on: pi0, eta, rho0, omega, eta', phi, sigma0 and 
+               //    implies you want the binary number: 00 0000 0100 0011 1111 = 
+               //        which translates 1087_10 (in decimal) and 43F_16 (in hexadecimal)
+               // c) you would like to switch on: pi0, eta, rho0, omega, eta', phi, sigma0 and all deltas
+               //    implies you want the binary number: 00 1111 0100 0011 1111 = 
+               //        which translates 62527_10 (in decimal) and F43F_16 (in hexadecimal)
+               // d) you would like to switch on: pi0, eta, rho0, omega, eta', phi
+               //    implies you want the binary number: 00 0000 0000 0011 1111 = 
+               //        which translates 63_10 (in decimal) and 3F_16 (in hexadecimal)
+               //***********************************************************************************************
+               void    SelectMotherParticles(UInt_t part)                                                      { fSelectedParticles=part       ;}
+
+       private:
+               AliGenEMCocktail(const AliGenEMCocktail &cocktail); 
+               AliGenEMCocktail & operator=(const AliGenEMCocktail &cocktail); 
+
+               void AddSource2Generator(Char_t *nameReso, AliGenParam* const genReso);
+               
+               AliDecayer*                                     fDecayer;               // External decayer
+               Decay_t                                                 fDecayMode;             // decay mode in which resonances are forced to decay, default: kAll
+               Weighting_t                                     fWeightingMode;         // weighting mode: kAnalog or kNonAnalog
+               
+               Int_t                                                   fNPart;             // multiplicity of each source per event
+               Double_t                                                fYieldArray[kGENs]; // array of dN/dy for each source
+
+               AliGenEMlib::CollisionSystem_t  fCollisionSystem;   // selected collision system
+               AliGenEMlib::PtParamSetPi0_t    fPtSelectPi0;           // selected pT parameterization for pi0
+               AliGenEMlib::PtParamSetEta_t    fPtSelectEta;           // selected pT parameterization for eta
+               AliGenEMlib::PtParamSetOmega_t  fPtSelectOmega;         // selected pT parameterization for omega
+               AliGenEMlib::PtParamSetPhi_t    fPtSelectPhi;           // selected pT parameterization for phi
+               AliGenEMlib::Centrality_t               fCentrality;            // selected centrality
+               AliGenEMlib::v2Sys_t                    fV2Systematic;          // selected systematic error for v2 parameters
+
+               Bool_t                                                  fForceConv;             // select whether you want to force all gammas to convert imidediately
+               UInt_t                                                  fSelectedParticles; // which particles to simulate, allows to switch on and off 32 different particles
 
-  AliGenEMlib::PtParamSet_t fPtSelect; // selected pT parameterization
-  AliGenEMlib::Centrality_t fCentrality; // selected centrality
-  Int_t fV2Systematic; //selected systematic error for v2 parameters
 
-  Bool_t fForceConv; //select whether you want to force all gammas to convert imidediately
-  Int_t fSelectedParticles; //which particles to simulate
 
-    ClassDef(AliGenEMCocktail,1)  //  cocktail for EM physics
+               ClassDef(AliGenEMCocktail,2)                                            // cocktail for EM physics
 };
 
 #endif
index 46719f59ee5e3069b0470e25f18600503cae60a7..05d3d2aa3c06bf3041e3ea1f7d6c304285a6a069 100644 (file)
 ClassImp(AliGenEMlib)
 
 //Initializers for static members
-Int_t AliGenEMlib::fgSelectedPtParam=AliGenEMlib::kPizero7TeVpp;
-Int_t AliGenEMlib::fgSelectedCentrality=AliGenEMlib::kpp;
+Int_t AliGenEMlib::fgSelectedCollisionsSystem=AliGenEMlib::kpp7TeV; 
+Int_t AliGenEMlib::fgSelectedPtParamPi0=AliGenEMlib::kPizeroParam; 
+Int_t AliGenEMlib::fgSelectedPtParamEta=AliGenEMlib::kEtaParamRatiopp; 
+Int_t AliGenEMlib::fgSelectedPtParamOmega=AliGenEMlib::kOmegaParampp; 
+Int_t AliGenEMlib::fgSelectedPtParamPhi=AliGenEMlib::kPhiParampp;
+Int_t AliGenEMlib::fgSelectedCentrality=AliGenEMlib::kpp; 
 Int_t AliGenEMlib::fgSelectedV2Systematic=AliGenEMlib::kNoV2Sys;
 
 Double_t AliGenEMlib::CrossOverLc(double a, double b, double x){
-  if(x<b-a/2) return 1.0;
-  else if(x>b+a/2) return 0.0;
-  else return cos(((x-b)/a+0.5)*TMath::Pi())/2+0.5;
+       if(x<b-a/2) return 1.0;
+       else if(x>b+a/2) return 0.0;
+       else return cos(((x-b)/a+0.5)*TMath::Pi())/2+0.5;
 }
 Double_t AliGenEMlib::CrossOverRc(double a, double b, double x){
-  return 1-CrossOverLc(a,b,x);
+       return 1-CrossOverLc(a,b,x);
 }
 
 const Double_t AliGenEMlib::fgkV2param[kCentralities][16] = {
@@ -95,8 +99,8 @@ const Double_t AliGenEMlib::fgkPtParam[kCentralities][10] = {
   ,{ 1.823377e+02, 8.144309e-01, 4.291562e-01, 1.022767e+01, 3.585469e+00, 5.275078e+00, 3.144351e+00, 5.259097e+00, 2.675708e+01, 5.892506e+00 } // 10-20
   ,{ 4.851407e+02, 9.341151e-01, 4.716673e-01, 1.058090e+01, 4.681218e+00, 7.261284e+00, 3.883227e+00, 6.638627e+00, 1.562806e+01, 5.772127e+00 } // 20-30
   ,{ 3.157060e+01, 6.849451e-01, 4.868669e-01, 8.394558e+00, 3.539142e+00, 5.495280e+00, 4.102638e+00, 3.722991e+00, 1.638622e+01, 5.935963e+00 } // 30-40
-  ,{ 1.857919e+01, 6.185989e-01, 5.878869e-01, 7.035064e+00, 2.892415e+00, 4.339383e+00, 3.549679e+00, 2.821061e+00, 1.529318e+01, 6.091388e+00 } // 40-50
-  ,{ 1.069397e+01, 5.816587e-01, 6.542961e-01, 6.472858e+00, 2.643870e+00, 3.929020e+00, 3.339224e+00, 2.410371e+00, 9.606748e+00, 6.116685e+00 } // 50-60
+  ,{ 1.069397e+01, 5.816587e-01, 6.542961e-01, 6.472858e+00, 2.643870e+00, 3.929020e+00, 3.339224e+00, 2.410371e+00, 9.606748e+00, 6.116685e+00 } // 40-50
+  ,{ 1.857919e+01, 6.185989e-01, 5.878869e-01, 7.035064e+00, 2.892415e+00, 4.339383e+00, 3.549679e+00, 2.821061e+00, 1.529318e+01, 6.091388e+00} // 50-60
   ,{ 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000,-1.0000000000, 1.0000000000,-1.0000000000, 1.0000000000, 0.0000000000, 0.0000000000 } // 0-10 
   ,{ 1.271594e+02, 7.790165e-01, 5.793214e-01, 8.050008e+00, 3.211312e+00, 4.825258e+00, 3.840509e+00, 3.046231e+00, 2.172177e+01, 5.983496e+00 } // 20-40
   ,{ 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000,-1.0000000000, 1.0000000000,-1.0000000000, 1.0000000000, 0.0000000000, 0.0000000000 } // 40-60
@@ -126,22 +130,100 @@ const Double_t AliGenEMlib::fgkThermPtParam[kCentralities][2] = {
   ,{ 0.0000000000, 0.0000000000 } // 40-80
 };
 
-// MASS   0=>PIZERO, 1=>ETA, 2=>RHO, 3=>OMEGA, 4=>ETAPRIME, 5=>PHI, 6=>JPSI
-const Double_t AliGenEMlib::fgkHM[8] = {0.13498, 0.54751, 0.7755, 0.78265, 0.95778, 1.01946, 3.0969, 0.0};
-
-const Double_t AliGenEMlib::fgkMtFactor[2][8] = { 
-  // {1.0, 0.5, 1.0, 0.9, 0.4, 0.23, 0.054},  // factor for pp from arXiv:1110.3929
-  // {1.0, 0.55, 1.0, 0.9, 0.4, 0.25, 0.004}    // factor for PbPb from arXiv:1110.3929
-  //{1., 0.48, 1.0, 0.9, 0.25, 0.4}, (old values)
-  //{1., 0.48, 1.0, 0.9, 0.4, 0.25}, (nlo values)
-  //{1., 0.48, 1.0, 0.8, 0.4, 0.2, 0.06} (combination of nlo and LHC measurements)
-  //https://aliceinfo.cern.ch/Figure/node/2634
-  //https://aliceinfo.cern.ch/Figure/node/2788
-  //https://aliceinfo.cern.ch/Figure/node/4403
-  //https://aliceinfo.cern.ch/Notes/node/87
-  //best guess:
-  {1., 0.48, 1.0, 0.9, 0.4, 0.25, 0., 0.}, //pp
-  {1., 0.48, 1.0, 0.9, 0.4, 0.25, 0., 0.}  //PbPb
+const Double_t AliGenEMlib::fgkModTsallisParamPi0PbPb[kCentralities][7] = { 
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // pp
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 0-5
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 5-10
+       {2.09114,               2.7482,         6.911,          51.1383,        -10.6896,       1.30818,        -1.59137        }, // 10-20
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 20-30
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 30-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 40-50
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 50-60
+       {970.684,               0.46451,        5.52064,        21.7707,        -4.2495,        4.62292,        -3.47699        }, // 00-10
+       {3.22534,               2.83717,        7.50505,        38.8015,        -8.93242,       0.9842,         -0.821508       }, // 20-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 40-60
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 60-80
+       {44.3972,               1.0644,         5.92254,        40.9254,        -8.07759,       3.30333,        -2.25078        }, // 00-20
+       {38.187,                1.58985,        6.81705,        31.2526,        -8.35251,       3.39482,        -1.56172        }, // 00-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 20-80
+       {89.2412,               0.150509,       4.97424,        112.986,        643.257,        3.41969,        -2.46034        }, // 40-80 
+};
+
+const Double_t AliGenEMlib::fgkModTsallisParamPiChargedPbPb[kCentralities][7] = { 
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // pp
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 0-5
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 5-10
+       {117.693,               1.20567,        6.57362,        29.2275,        -7.71065,       4.50046,        -1.91093        }, // 10-20
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 20-30
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 30-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 40-50
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 50-60
+       {229.035,               1.11283,        6.53404,        28.9739,        -8.15381,       5.05703,        -2.32825        }, // 00-10
+       {45.5686,               1.39268,        6.72519,        29.4513,        -7.23335,       3.80987,        -1.18599        }, // 20-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 40-60
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 60-80
+       {171.812,               1.14849,        6.54742,        29.0473,        -7.96679,       4.82915,        -2.15967        }, // 00-20
+       {108.083,               1.21125,        6.59362,        28.9651,        -7.70072,       4.56583,        -1.89318        }, // 00-40
+       {0.,                    0.,                     0.,                     0.,                     0.,                     0.,                     0.                      }, // 20-80
+       {3.14057,               0.329224,       4.8235,         491.145,        186.041,        2.91138,        -2.20281        }, // 40-80 
+};
+
+const Double_t AliGenEMlib::fgkParamSetPi07TeV[kNPi0Param][7] = { 
+       {0.134977,              2.31335/(2*TMath::Pi()),        0.1433,                 7.003,                  0,                      0,                      0                       }, //kPizeroParam
+       {-0.0580977,    0.580804,                                       5.0964,                 -669.913,               -160.2,         4.45906,        -0.465125       }, //kPizeroParamlow
+       {-7.09454,              0.218554,                                       5.2278,                 77.9877,                -359.457,       4.67862,        -0.996938       }, //kPizeroParamhigh
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParam
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParamlow
+       {-0.000632204,  0.371249,                                       4.56778,                -111488,                -15573.4,       4.33064,        -1.5506         }, //kPichargedParamhigh
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamAlter
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamAlterlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamAlterhigh
+};
+
+const Double_t AliGenEMlib::fgkParamSetPi02760GeV[kNPi0Param][7] = { 
+       {0.134977,              1.7/(2*TMath::Pi()),            0.135,                  7.1,                    0,                      0,                      0                       }, //kPizeroParam
+       {-1.4583,               0.188108,                                       5.34499,                546.328,                -2142.93,       4.55572,        -1.82455        }, //kPizeroParamlow
+       {-0.0648943,    0.231029,                                       4.39238,                -3705.4,                -35.9761,       4.87127,        -2.00983        }, //kPizeroParamhigh
+       {0.755554,              0.20772,                                        5.24167,                11.8279,                1492.53,        3.93863,        -1.72404        }, //kPichargedParam
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParamlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParamhigh
+       {0.0610774,             5.86289,                                        -7.83516,               1.29301,                2.62416,        0.,                     0.                      }, //kPizeroParamAlter
+       {0.065338,              5.86705,                                        -9.05494,               1.38435,                3.58848,        0.,                     0.                      }, //kPizeroParamAlterlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamAlterhigh
+};
+
+const Double_t AliGenEMlib::fgkParamSetPi0900GeV[kNPi0Param][7] = { 
+       {0.134977,              1.5/(2*TMath::Pi()),            0.132,                  7.8,                    0,                      0,                      0                       }, //kPizeroParam
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamhigh
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParam
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParamlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPichargedParamhigh
+       {0.0467285,             59.6495,                                        -212.865,               0.0584012,              2.83816,        0.,                     0.                      }, //kPizeroParamAlter
+       {0.0468173,             66.9511,                                        -136.287,               0.0298099,              1.17147,        0.,                     0.                      }, //kPizeroParamAlterlow
+       {0.,                    0.,                                                     0.,                             0.,                             0.,                     0.,                     0.                      }, //kPizeroParamAlterhigh
+};
+
+
+// MASS   0=>PIZERO, 1=>ETA, 2=>RHO0, 3=>OMEGA, 4=>ETAPRIME, 5=>PHI, 6=>JPSI, 7=>SIGMA, 8=>K0s, 9=>DELTA++, 10=>DELTA+, 11=>DELTA-, 12=>DELTA0, 13=>Rho+, 14=>Rho-, 15=>K0*
+const Double_t AliGenEMlib::fgkHM[16] = {0.1349766, 0.547853, 0.77549, 0.78265, 0.95778, 1.019455, 3.096916, 1.192642, 0.497614, 1.2311, 1.2349, 1.2349, 1.23340, 0.77549, 0.77549, 0.896};
+
+const Double_t AliGenEMlib::fgkMtFactor[3][16] = { 
+       // {1.0, 0.5, 1.0, 0.9, 0.4, 0.23, 0.054},  // factor for pp from arXiv:1110.3929
+       // {1.0, 0.55, 1.0, 0.9, 0.4, 0.25, 0.004}    // factor for PbPb from arXiv:1110.3929
+       //{1., 0.48, 1.0, 0.9, 0.25, 0.4}, (old values)
+       //{1., 0.48, 1.0, 0.9, 0.4, 0.25}, (nlo values)
+       //{1., 0.48, 1.0, 0.8, 0.4, 0.2, 0.06} (combination of nlo and LHC measurements)
+       //https://aliceinfo.cern.ch/Figure/node/2634
+       //https://aliceinfo.cern.ch/Figure/node/2788
+       //https://aliceinfo.cern.ch/Figure/node/4403
+       //https://aliceinfo.cern.ch/Notes/node/87
+       /*best guess:
+               - pp values for eta/pi0 [arXiv:1205.5724], omega/pi0 [arXiv:1210.5749], phi/(pi+/-) [arXiv:1208.5717] from measured 7 Tev data
+       */
+       {1., 0.476, 1.0, 0.85, 0.4, 0.13, 1., 0.49, 0.575, 1, 1, 1, 1, 1.0, 1.0, 1.0}, //pp
+       {1., 0.476, 1.0, 0.85, 0.4, 0.25, 1., 0.49, 0.575, 1, 1, 1, 1, 1.0, 1.0, 1.0}, //pPb
+       {1., 0.476, 1.0, 0.85, 0.4, 0.25, 1., 0.49, 0.575, 1, 1, 1, 1, 1.0, 1.0, 1.0}  //PbPb
 };
 
 //==========================================================================
@@ -163,11 +245,11 @@ Double_t AliGenEMlib::PtModifiedHagedornThermal(Double_t pt,
                                                 Double_t cT,
                                                 Double_t T)
 {
-  // Modified Hagedorn Thermal fit to Picharged for PbPb:
-  Double_t invYield;
-  invYield = c/TMath::Power(p0+pt/p1,n) + cT*exp(-1.0*pt/T);
+       // Modified Hagedorn Thermal fit to Picharged for PbPb:
+       Double_t invYield;
+       invYield = c/TMath::Power(p0+pt/p1,n) + cT*exp(-1.0*pt/T);
 
-  return invYield*(2*TMath::Pi()*pt);
+       return invYield*(2*TMath::Pi()*pt);
 }
 
 
@@ -179,11 +261,11 @@ Double_t AliGenEMlib::PtModifiedHagedornExp(Double_t pt,
                                            Double_t p0,
                                            Double_t n)
 {
-  // Modified Hagedorn exponentiel fit to Pizero for PbPb:
-  Double_t invYield;
-  invYield = c*TMath::Power(exp(-1*(p1*pt-p2*pt*pt))+pt/p0,-n);
+       // Modified Hagedorn exponentiel fit to Pizero for PbPb:
+       Double_t invYield;
+       invYield = c*TMath::Power(exp(-1*(p1*pt-p2*pt*pt))+pt/p0,-n);
 
-  return invYield*(2*TMath::Pi()*pt);
+       return invYield*(2*TMath::Pi()*pt);
 }
 
 
@@ -196,11 +278,11 @@ Double_t AliGenEMlib::PtModifiedHagedornExp2(Double_t pt,
                                              Double_t d,
                                              Double_t n)
 {
-  // Modified Hagedorn exponential fit to charged pions for pPb:
-  Double_t invYield;
-  invYield = c*TMath::Power(exp(-a*pt-b*pt*pt)+pt/p0+TMath::Power(pt/p1,d),-n);
+       // Modified Hagedorn exponential fit to charged pions for pPb:
+       Double_t invYield;
+       invYield = c*TMath::Power(exp(-a*pt-b*pt*pt)+pt/p0+TMath::Power(pt/p1,d),-n);
 
-  return invYield*(2*TMath::Pi()*pt);
+       return invYield*(2*TMath::Pi()*pt);
 }
 
 Double_t AliGenEMlib::PtTsallis(Double_t pt,
@@ -209,45 +291,115 @@ Double_t AliGenEMlib::PtTsallis(Double_t pt,
                                 Double_t T,
                                 Double_t n)
 {
-  // Tsallis fit to Pizero for pp:
-  Double_t mt;
-  Double_t invYield;
-  mt = sqrt(m*m + pt*pt);
-  invYield = c*((n-1.)*(n-2.))/(n*T*(n*T+m*(n-2.)))*pow(1.+(mt-m)/(n*T),-n);
+       // Tsallis fit to Pizero for pp:
+       Double_t mt;
+       Double_t invYield;
+       
+       mt = sqrt(m*m + pt*pt);
+       invYield = c*((n-1.)*(n-2.))/(n*T*(n*T+m*(n-2.)))*pow(1.+(mt-m)/(n*T),-n);
+
+       return invYield*(2*TMath::Pi()*pt);
+}
+
 
-  return invYield*(2*TMath::Pi()*pt);
+Double_t AliGenEMlib::PtXQCD(  Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                           Double_t e,
+                                                               Double_t f)
+{
+       // QCD inspired function by Martin Wilde
+       // DISCLAIMER: Please be careful outside of the measured pT range
+       Double_t invYield = 0;
+       if(pt>0.05){
+               invYield = a*pow(pt,-1*(b+c/(pow(pt,d)+e*pow(pt,f))));
+       } else invYield = 100;
+       return invYield*(2*TMath::Pi()*pt);
 }
 
+Double_t AliGenEMlib::PtQCD(   Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                           Double_t e)
+{
+       // QCD inspired function by Martin Wilde
+       // DISCLAIMER: Please be careful outside of the measured pT range
+       Double_t invYield = 0;
+       if(pt>0.05){
+               invYield = a*pow(pt,-1*(b+c/(pow(pt,d)+e)));
+       } else invYield = 100;
+       return invYield*(2*TMath::Pi()*pt);
+}
+
+Double_t AliGenEMlib::PtModTsallis(    Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                           Double_t e,
+                                                               Double_t f,
+                                                               Double_t g,
+                                                               Double_t mass)
+{
+
+       Double_t invYield = 0;
+       Double_t mt = sqrt(mass*mass + pt*pt);
+       Double_t pt2 = pt*pt;
+       if(pt>0.05){
+               invYield = a*TMath::Power((1.+(mt-mass)/(b)),-c)*(d+e*pt+pt2)/(f+g*pt+pt2);
+       } else invYield = 100;
+       return invYield*(2*TMath::Pi()*pt);
+}
+
+Double_t AliGenEMlib::PtParticleRatiopp(Double_t pt,
+                                                                               Double_t m1,
+                                                                               Double_t m2,
+                                                                               Double_t c1,
+                                                                               Double_t c2,
+                                                                               Double_t T1,
+                                                                               Double_t T2,
+                                                                               Double_t n)
+{
+       
+       Double_t ratio = 0;
+       if (PtTsallis (pt, m2, c2, T2, n)>0) ratio = PtTsallis (pt, m1, c1, T1, n)/ PtTsallis (pt, m2, c2, T2, n);
+       return ratio;
+}                                                                              
+
+
 // Exponential
 Double_t AliGenEMlib::PtExponential(const Double_t *px, const Double_t *c){
-  const double &pt=px[0];
-  Double_t invYield = c[0]*exp(-pt*c[1]);
-  
-  return invYield*(2*TMath::Pi()*pt);
+       const double &pt=px[0];
+       Double_t invYield = c[0]*exp(-pt*c[1]);
+       
+       return invYield*(2*TMath::Pi()*pt);
 }
 
 // Hagedorn with additional Powerlaw
 Double_t AliGenEMlib::PtModifiedHagedornPowerlaw(const Double_t *px, const Double_t *c){
-  const double &pt=px[0];
-  Double_t invYield = c[0]*pow(c[1]+pt*c[2],-c[3])*CrossOverLc(c[5],c[4],pt)+CrossOverRc(c[7],c[6],pt)*c[8]*pow(pt+0.001,-c[9]); //pt+0.001: prevent powerlaw from exploding for pt->0
-  
-  return invYield*(2*TMath::Pi()*pt+0.001); //pt+0.001: be sure to be > 0
+       const double &pt=px[0];
+       Double_t invYield = c[0]*pow(c[1]+pt*c[2],-c[3])*CrossOverLc(c[5],c[4],pt)+CrossOverRc(c[7],c[6],pt)*c[8]*pow(pt+0.001,-c[9]); //pt+0.001: prevent powerlaw from exploding for pt->0
+       
+       return invYield*(2*TMath::Pi()*pt+0.001); //pt+0.001: be sure to be > 0
 }
 
 // double powerlaw for J/Psi yield
 Double_t AliGenEMlib::PtDoublePowerlaw(const Double_t *px, const Double_t *c){
-  const double &pt=px[0];
-  Double_t yield = c[0]*pt*pow(1+pow(pt*c[1],2),-c[2]);
-  
-  return yield;
+       const double &pt=px[0];
+       Double_t yield = c[0]*pt*pow(1+pow(pt*c[1],2),-c[2]);
+       
+       return yield;
 }
 
 // integral over krollwada with S=1^2*(1-mee^2/mh^2)^3 from mee=0 up to mee=mh
 // approximation is perfect for mh>20MeV
 Double_t AliGenEMlib::IntegratedKrollWada(const Double_t *mh, const Double_t *){
-  if(*mh<0.002941) return 0;
-  return 2*log(*mh/0.000511/exp(1.75))/411.11/TMath::Pi();
+       if(*mh<0.002941) return 0;
+       return 2*log(*mh/0.000511/exp(1.75))/411.11/TMath::Pi();
 }
 
 //--------------------------------------------------------------------------
@@ -257,48 +409,48 @@ Double_t AliGenEMlib::IntegratedKrollWada(const Double_t *mh, const Double_t *){
 //--------------------------------------------------------------------------
 Double_t AliGenEMlib::PtPromptRealGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  const static Double_t promptGammaPtParam[10] = { 8.715017e-02, 4.439243e-01, 1.011650e+00, 5.193789e+00, 2.194442e+01, 1.062124e+01, 2.469876e+01, 6.052479e-02, 5.611410e-02, 5.169743e+00 };
+       const static Double_t promptGammaPtParam[10] = { 8.715017e-02, 4.439243e-01, 1.011650e+00, 5.193789e+00, 2.194442e+01, 1.062124e+01, 2.469876e+01, 6.052479e-02, 5.611410e-02, 5.169743e+00 };
  
-  return PtModifiedHagedornPowerlaw(px,promptGammaPtParam)*GetTAA(fgSelectedCentrality);
+       return PtModifiedHagedornPowerlaw(px,promptGammaPtParam)*GetTAA(fgSelectedCentrality);
 }
 
 Double_t AliGenEMlib::PtThermalRealGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return PtExponential(px,fgkThermPtParam[fgSelectedCentrality]);
+       return PtExponential(px,fgkThermPtParam[fgSelectedCentrality]);
 }
 
 Double_t AliGenEMlib::PtDirectRealGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return PtPromptRealGamma(px,px)+PtThermalRealGamma(px,px);
+       return PtPromptRealGamma(px,px)+PtThermalRealGamma(px,px);
 }
 
 Int_t AliGenEMlib::IpDirectRealGamma(TRandom *)
 {
-  return 22;
+       return 22;
 }
 
 Double_t AliGenEMlib::YDirectRealGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return YFlat(*px);
+       return YFlat(*px);
 }
 
 Double_t AliGenEMlib::V2DirectRealGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  const static Double_t v2Param[3][16] = {
-    { 1.004245e-01, 1.057645e+00, 0.000000e+00, 2.836492e+00, 2.819767e+00, -6.231529e-02, 1.173054e+00, 2.836492e+00, 1.881590e-01, 1.183293e-02, 1.252249e+00, 0, 1, 4.876263e-03, 1.518526e+00, 4.5 } // 00-20, based on: https://aliceinfo.cern.ch/Notes/node/249
-    ,{ 1.619000e-01, 1.868201e+00, 6.983303e-15, 2.242170e+00, 4.484339e+00, -1.695734e-02, 2.301359e+00, 2.871469e+00, 1.619000e-01, 2.264320e-02, 1.028641e+00, 0, 1, 8.172203e-03, 1.271637e+00, 4.5 } // 20-40
-    ,{ 1.335000e-01, 1.076916e+00, 1.462605e-08, 2.785732e+00, 5.571464e+00, -2.356156e-02, 2.745437e+00, 2.785732e+00, 1.335000e-01, 1.571589e-02, 1.001131e+00, 0, 1, 5.179715e-03, 1.329344e+00, 4.5 } // 00-40
-  };
-  switch(fgSelectedCentrality){
-  case k0020: return V2Param(px,v2Param[0]); break;
-  case k2040: return V2Param(px,v2Param[1]); break;
-  case k0040: return V2Param(px,v2Param[2]); break;
-    // case k0010: return 0.43*V2Param(px,v2Param[1]); break;  //V2Pizero(0010)/V2Pizero(2040)=0.43 +-0.025
-    // case k1020: return 0.75*V2Param(px,v2Param[1]); break;  //V2Pizero(1020)/V2Pizero(2040)=0.75 +-0.04
-  case k0010: return 0.53*V2Param(px,v2Param[2]); break;  //V2Pizero(0010)/V2Pizero(0040)=0.53 +-0.03
-  case k1020: return 0.91*V2Param(px,v2Param[2]); break;  //V2Pizero(1020)/V2Pizero(0040)=0.91 +-0.04
-  }
-  return 0;
+       const static Double_t v2Param[3][16] = {
+               { 1.004245e-01, 1.057645e+00, 0.000000e+00, 2.836492e+00, 2.819767e+00, -6.231529e-02, 1.173054e+00, 2.836492e+00, 1.881590e-01, 1.183293e-02, 1.252249e+00, 0, 1, 4.876263e-03, 1.518526e+00, 4.5 } // 00-20, based on: https://aliceinfo.cern.ch/Notes/node/249
+               ,{ 1.619000e-01, 1.868201e+00, 6.983303e-15, 2.242170e+00, 4.484339e+00, -1.695734e-02, 2.301359e+00, 2.871469e+00, 1.619000e-01, 2.264320e-02, 1.028641e+00, 0, 1, 8.172203e-03, 1.271637e+00, 4.5 } // 20-40
+               ,{ 1.335000e-01, 1.076916e+00, 1.462605e-08, 2.785732e+00, 5.571464e+00, -2.356156e-02, 2.745437e+00, 2.785732e+00, 1.335000e-01, 1.571589e-02, 1.001131e+00, 0, 1, 5.179715e-03, 1.329344e+00, 4.5 } // 00-40
+       };
+       switch(fgSelectedCentrality){
+               case k0020: return V2Param(px,v2Param[0]); break;
+               case k2040: return V2Param(px,v2Param[1]); break;
+               case k0040: return V2Param(px,v2Param[2]); break;
+               // case k0010: return 0.43*V2Param(px,v2Param[1]); break;  //V2Pizero(0010)/V2Pizero(2040)=0.43 +-0.025
+               // case k1020: return 0.75*V2Param(px,v2Param[1]); break;  //V2Pizero(1020)/V2Pizero(2040)=0.75 +-0.04
+               case k0010: return 0.53*V2Param(px,v2Param[2]); break;  //V2Pizero(0010)/V2Pizero(0040)=0.53 +-0.03
+               case k1020: return 0.91*V2Param(px,v2Param[2]); break;  //V2Pizero(1020)/V2Pizero(0040)=0.91 +-0.04
+       }
+       return 0;
 }
 
 
@@ -314,27 +466,27 @@ Double_t AliGenEMlib::PtPromptVirtGamma( const Double_t *px, const Double_t */*d
 
 Double_t AliGenEMlib::PtThermalVirtGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return IntegratedKrollWada(px,px)*PtThermalRealGamma(px,px);
+       return IntegratedKrollWada(px,px)*PtThermalRealGamma(px,px);
 }
 
 Double_t AliGenEMlib::PtDirectVirtGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return IntegratedKrollWada(px,px)*PtDirectRealGamma(px,px);
+       return IntegratedKrollWada(px,px)*PtDirectRealGamma(px,px);
 }
 
 Int_t AliGenEMlib::IpDirectVirtGamma(TRandom *)
 {
-  return 220000;
+       return 220000;
 }
 
 Double_t AliGenEMlib::YDirectVirtGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return YFlat(*px);
+       return YFlat(*px);
 }
 
 Double_t AliGenEMlib::V2DirectVirtGamma( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return V2DirectRealGamma(px,px);
+       return V2DirectRealGamma(px,px);
 }
 
 //--------------------------------------------------------------------------
@@ -345,278 +497,361 @@ Double_t AliGenEMlib::V2DirectVirtGamma( const Double_t *px, const Double_t */*d
 Int_t AliGenEMlib::IpPizero(TRandom *)
 {
   // Return pizero pdg code
-  return 111;     
+       return 111;     
 }
 
 Double_t AliGenEMlib::PtPizero( const Double_t *px, const Double_t */*dummy*/ )
 {
-  // double pigammacorr=1; //misuse pion for direct gammas, tuned for 0040, iteration 0
-  // pigammacorr*=2.258900e-01*log(*px+0.001)+1.591291e+00;  //iteration 1
-  // pigammacorr*=6.601943e-03*log(*px+0.001)+9.593698e-01;  //iteration 2
-  // pigammacorr*=4.019933e-03*log(*px+0.001)+9.843412e-01;  //iteration 3
-  // pigammacorr*=-4.543991e-03*log(*px+0.001)+1.010886e+00; //iteration 4
-  // return pigammacorr*PtPromptRealGamma(px,px); //now the gammas from the pi->gg decay have the pt spectrum of prompt real gammas
-  
-  // fit functions and corresponding parameter of Pizero pT for pp @ 2.76 TeV and @ 7 TeV and for PbPb @ 2.76 TeV 
-
-  Double_t km=0.;
-  Double_t kc=0.;
-  Double_t kn=0.;
-  Double_t kcT=0.;
-  Double_t kT=0.;
-  Double_t kp0=0.;
-  Double_t kp1=0.;
-  Double_t kp2=0.;
-  Double_t ka=0.;
-  Double_t kb=0.;
-  Double_t kd=0.;
-
-  double n1,n2,n3,n4;
-  int oldCent;
-
-  switch(fgSelectedPtParam|fgSelectedCentrality) {
-    // fit to pi charged, same data like in kPiOldChargedPbPb,
-    // but tested and compared against newest (2014) neutral pi measurement
-  case kPichargedPbPb|k0005:
-  case kPichargedPbPb|k0510:
-  case kPichargedPbPb|k1020:
-  case kPichargedPbPb|k2030:
-  case kPichargedPbPb|k3040:
-  case kPichargedPbPb|k4050:
-  case kPichargedPbPb|k5060:
-  case kPichargedPbPb|k2040:
-    return PtModifiedHagedornPowerlaw(px,fgkPtParam[fgSelectedCentrality]);
-    break;
-  case kPichargedPbPb|k0010:
-    n1=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0510]);
-    return (n1+n2)/2;
-    break;
-  case kPichargedPbPb|k0020:
-    n1=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0510]);
-    n3=PtModifiedHagedornPowerlaw(px,fgkPtParam[k1020]);
-    return (n1+n2+2*n3)/4;
-    break;
-  case kPichargedPbPb|k0040:
-    n1=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkPtParam[k0510]);
-    n3=PtModifiedHagedornPowerlaw(px,fgkPtParam[k1020]);
-    n4=PtModifiedHagedornPowerlaw(px,fgkPtParam[k2040]);
-    return (n1+n2+2*n3+4*n4)/8;
-    break;
-  case kPichargedPbPb|k4060:
-    n1=PtModifiedHagedornPowerlaw(px,fgkPtParam[k4050]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkPtParam[k5060]);
-    return (n1+n2)/2;
-    break;
-
-
-    // fit to pi charged v1
-    // charged pion from ToF, unidentified hadrons scaled with pion from TPC
-    // for Pb-Pb @ 2.76 TeV
-  case kPiOldChargedPbPb|k0005:
-    kc=1347.5; kp0=0.9393; kp1=2.254; kn=11.294; kcT=0.002537; kT=2.414;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k0510:
-    kc=1256.1; kp0=0.9545; kp1=2.248; kn=11.291; kcT=0.002662; kT=2.326;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k2030:
-    kc=7421.6; kp0=1.2059; kp1=1.520; kn=10.220; kcT=0.002150; kT=2.196;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k3040:
-    kc=1183.2; kp0=1.0478; kp1=1.623; kn=9.8073; kcT=0.00198333; kT=2.073;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-    // the following is what went into the Pb-Pb preliminary approval (0-10%)
-  case kPiOldChargedPbPb|k0010:
-    kc=1296.0; kp0=0.968; kp1=2.567; kn=12.27; kcT=0.004219; kT=2.207;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k1020:
-    kc=986.0; kp0=0.9752; kp1=2.376; kn=11.62; kcT=0.003116; kT=2.213;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k2040:
-    kc=17337.0; kp0=1.337; kp1=1.507; kn=10.629; kcT=0.00184; kT=2.234;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k4050:
-    kc=6220.0; kp0=1.322; kp1=1.224; kn=9.378; kcT=0.000595; kT=2.383;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k5060:
-    kc=2319.0; kp0=1.267; kp1=1.188; kn=9.044; kcT=0.000437; kT=2.276;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k4060:
-    kc=4724.0; kp0=1.319; kp1=1.195; kn=9.255; kcT=0.000511; kT=2.344;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k6080:
-    kc=2842.0; kp0=1.465; kp1=0.8324; kn=8.167; kcT=0.0001049; kT=2.29;
-    return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
-    break;
-  case kPiOldChargedPbPb|k0020:
-    oldCent=fgSelectedCentrality;
-    fgSelectedCentrality=k0010;
-    n1=PtPizero(px,px);
-    fgSelectedCentrality=k1020;
-    n2=PtPizero(px,px);
-    fgSelectedCentrality=oldCent;
-    return (n1+n2)/2;
-    break;
-  case kPiOldChargedPbPb|k0040:
-    oldCent=fgSelectedCentrality;
-    fgSelectedCentrality=k0010;
-    n1=PtPizero(px,px);
-    fgSelectedCentrality=k1020;
-    n2=PtPizero(px,px);
-    fgSelectedCentrality=k2040;
-    n3=PtPizero(px,px);
-    fgSelectedCentrality=oldCent;
-    return (n1+n2+2*n3)/4;
-    break;
-
-    // fit to pizero from conversion analysis
-    // for PbPb @ 2.76 TeV
-    // Pi0 spectra --> not final results 
-  case kPizeroPbPb|k0005:
-       kc=1952.832; kp1=0.264; kp2=0.069; kp0=1.206; kn=9.732;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k0010:
-       kc=1810.029; kp1=0.291; kp2=0.059; kp0=1.170; kn=9.447;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k0020:
-       kc=856.241; kp1=-0.409; kp2=-0.127; kp0=1.219; kn=9.030;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;     
-  case kPizeroPbPb|k1020:
-       kc=509.781; kp1=-0.784; kp2=-0.120; kp0=0.931; kn=7.299;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k2040:
-       kc=541.049; kp1=0.542; kp2=-0.069; kp0=0.972; kn=7.866;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k2080:
-       kc=222.577; kp1=0.634; kp2=0.009; kp0=0.915; kn=7.431;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k4080:
-       kc=120.153; kp1=0.7; kp2=-0.14; kp0=0.835; kn=6.980;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;
-  case kPizeroPbPb|k0040:
-       kc=560.532; kp1=0.548; kp2=-0.048; kp0=1.055; kn=8.132;
-       return PtModifiedHagedornExp(*px,kc,kp1,kp2,kp0,kn);
-       break;  
-  
-  
-    // fit to charged pions for p-Pb @ 5.02TeV     
-  case kPichargedPPb:
-       kc=235.5; ka=0.6903; kb=0.06864; kp0=2.289; kp1=0.5872; kd=0.6474; kn=7.842; 
-       return PtModifiedHagedornExp2(*px,kc,ka,kb,kp0,kp1,kd,kn);
-       break;
-
-
-    // Tsallis fit to final pizero (PHOS+PCM) -> used for publication
-    // for pp @ 7 TeV
-  case kPizero7TeVpp:
-  case kPizeroEta7TeVpp:
-    km=0.13498; kc=28.01; kT=0.139; kn=6.875;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizero7TeVpplow:
-  case kPizeroEta7TeVpplow: 
-    km=0.13498; kc=23.84; kT=0.147; kn=7.025;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizero7TeVpphigh:
-  case kPizeroEta7TeVpphigh:
-    km=0.13498; kc=32.47; kT=0.132; kn=6.749;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-    // Tsallis fit to pizero: preliminary result from PCM and PHOS (QM'11)
-    // for pp @ 2.76 TeV
-  case kPizero2760GeVpp:
-  case kPizeroEta2760GeVpp:     
-    km = 0.13498; kc = 19.75; kT = 0.130; kn = 7.051;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizero2760GeVpplow:
-  case kPizeroEta2760GeVpplow:
-    km = 0.13498; kc = 16.12; kT = 0.142; kn = 7.327;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizero2760GeVpphigh:
-  case kPizeroEta2760GeVpphigh:
-    km = 0.13498; kc = 25.18; kT = 0.118; kn = 6.782;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-
-  default:
-    return NULL;
-  }
+       // double pigammacorr=1; //misuse pion for direct gammas, tuned for 0040, iteration 0
+       // pigammacorr*=2.258900e-01*log(*px+0.001)+1.591291e+00;  //iteration 1
+       // pigammacorr*=6.601943e-03*log(*px+0.001)+9.593698e-01;  //iteration 2
+       // pigammacorr*=4.019933e-03*log(*px+0.001)+9.843412e-01;  //iteration 3
+       // pigammacorr*=-4.543991e-03*log(*px+0.001)+1.010886e+00; //iteration 4
+       // return pigammacorr*PtPromptRealGamma(px,px); //now the gammas from the pi->gg decay have the pt spectrum of prompt real gammas
+       
+       // fit functions and corresponding parameter of Pizero pT for pp @ 2.76 TeV and @ 7 TeV and for PbPb @ 2.76 TeV 
+
+       Double_t km=0.;
+       Double_t kc=0.;
+       Double_t kn=0.;
+       Double_t kcT=0.;
+       Double_t kT=0.;
+       Double_t kp0=0.;
+       Double_t kp1=0.;
+       Double_t kp2=0.;
+       Double_t ka=0.;
+       Double_t kb=0.;
+       Double_t kd=0.;
+
+       switch(fgSelectedCollisionsSystem) {
+               case kPbPb:
+                       switch (fgSelectedPtParamPi0){
+                               case kPichargedParam:
+                                       // fit to pi charged v1
+                                       // charged pion from ToF, unidentified hadrons scaled with pion from TPC
+                                       // for Pb-Pb @ 2.76 TeV
+                                       switch (fgSelectedCentrality){
+                                               case k0005:
+                                                       kc=1347.5; kp0=0.9393; kp1=2.254; kn=11.294; kcT=0.002537; kT=2.414;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);     
+                                                       break;
+                                               case k0510:
+                                                       break;
+                                                       kc=1256.1; kp0=0.9545; kp1=2.248; kn=11.291; kcT=0.002662; kT=2.326;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k2030:
+                                                       kc=7421.6; kp0=1.2059; kp1=1.520; kn=10.220; kcT=0.002150; kT=2.196;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k3040:
+                                                       kc=1183.2; kp0=1.0478; kp1=1.623; kn=9.8073; kcT=0.00198333; kT=2.073;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                                       // the following is what went into the Pb-Pb preliminary approval (0-10%)
+                                               case k0010:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               case k1020:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               case k2040:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               case k4050:
+                                                       kc=6220.0; kp0=1.322; kp1=1.224; kn=9.378; kcT=0.000595; kT=2.383;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k5060:
+                                                       kc=2319.0; kp0=1.267; kp1=1.188; kn=9.044; kcT=0.000437; kT=2.276;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k4060:
+                                                       kc=4724.0; kp0=1.319; kp1=1.195; kn=9.255; kcT=0.000511; kT=2.344;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k6080:
+                                                       kc=2842.0; kp0=1.465; kp1=0.8324; kn=8.167; kcT=0.0001049; kT=2.29;
+                                                       return PtModifiedHagedornThermal(*px,kc,kp0,kp1,kn,kcT,kT);
+                                                       break;
+                                               case k0020:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               case k0040:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               case k4080:
+                                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPiChargedPbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                                                       break;
+                                               default:
+                                                       return 0;                                                       
+                                       }
+                               case kPizeroParam:      
+                                       return PtModTsallis(    *px,
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][0],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][1],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][2],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][3],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][4],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][5],
+                                                                       fgkModTsallisParamPi0PbPb[fgSelectedCentrality][6],
+                                                                       0.135);
+                               default:
+                                       return 0;
+                               
+                       }
+               case kpPb:
+                       // fit to charged pions for p-Pb @ 5.02TeV     
+                       switch (fgSelectedPtParamPi0){
+                               case kPichargedParam:
+                                       kc=235.5; ka=0.6903; kb=0.06864; kp0=2.289; kp1=0.5872; kd=0.6474; kn=7.842; 
+                                       return PtModifiedHagedornExp2(*px,kc,ka,kb,kp0,kp1,kd,kn);
+                                       break;
+                               default:
+                                       return 0;
+       
+                       }
+               case kpp7TeV:
+                       switch (fgSelectedPtParamPi0){
+                               // Tsallis fit to final pizero (PHOS+PCM) -> used for publication
+                               // for pp @ 7 TeV                               
+                               case kPizeroParam: // fit to combined spectrum with stat errors only
+                                       return PtTsallis(*px,fgkParamSetPi07TeV[kPizeroParam][0],fgkParamSetPi07TeV[kPizeroParam][1],fgkParamSetPi07TeV[kPizeroParam][2],fgkParamSetPi07TeV[kPizeroParam][3]);
+                                       break;    
+                               case kPizeroParamlow:
+                                       return PtModTsallis(      *px, 
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][0],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][1],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][2],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][3],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][4],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][5],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamlow][6],
+                                                                                         0.135);
+                                       break;
+                               case kPizeroParamhigh:
+                                       return PtModTsallis(      *px, 
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][0],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][1],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][2],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][3],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][4],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][5],
+                                                                                         fgkParamSetPi07TeV[kPizeroParamhigh][6],
+                                                                                         0.135);
+                                       break;
+                               case kPichargedParamhigh:       
+                                       return PtModTsallis(      *px, 
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][0],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][1],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][2],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][3],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][4],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][5],
+                                                                                         fgkParamSetPi07TeV[kPichargedParamhigh][6],
+                                                                                         0.135);
+                                       break;
+                                       
+                               default:
+                                       return 0;
+                       }
+
+                               
+               case kpp2760GeV:
+                       switch (fgSelectedPtParamPi0){
+                               // Tsallis fit to pizero: published pi0
+                               // for pp @ 2.76 TeV
+                               case kPizeroParam: //published fit parameters
+                                       return PtTsallis(*px,fgkParamSetPi02760GeV[kPizeroParam][0],fgkParamSetPi02760GeV[kPizeroParam][1],fgkParamSetPi02760GeV[kPizeroParam][2],fgkParamSetPi02760GeV[kPizeroParam][3]);
+                                       break;
+                               case kPizeroParamlow:
+                                       return PtModTsallis(    *px, 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][0], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][1], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][2], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][3], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][4], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][5], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamlow][6], 
+                                                                                       0.135);
+                                       break;
+                               case kPizeroParamhigh:
+                                       return PtModTsallis(    *px, 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][0], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][1], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][2], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][3], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][4], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][5], 
+                                                                                       fgkParamSetPi02760GeV[kPizeroParamhigh][6], 
+                                                                                       0.135);
+                                       break;
+                               case kPichargedParam:   
+                                       return PtModTsallis(      *px, 
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][0],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][1],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][2],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][3],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][4],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][5],
+                                                                                         fgkParamSetPi02760GeV[kPichargedParam][6],
+                                                                                         0.135);
+                                       break;
+                               case kPizeroParamAlter: 
+                                       return PtQCD(   *px, 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][0], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][1], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][2], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][3], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][4]);
+                                       break;
+                               case kPizeroParamAlterlow:
+                                       return PtQCD(   *px, 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][0], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][1], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][2], 
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][3],
+                                                                       fgkParamSetPi02760GeV[kPizeroParamAlter][4]);
+                                       break;
+                               default:
+                                       return 0;                       
+                       }               
+               case kpp900GeV:
+                       switch (fgSelectedPtParamPi0){
+                               // Tsallis fit to pizero: published pi0
+                               // for pp @ 0.9 TeV
+                               case kPizeroParam: //published fit parameters
+                                       return PtTsallis(       *px,
+                                                                               fgkParamSetPi0900GeV[kPizeroParam][0],
+                                                                               fgkParamSetPi0900GeV[kPizeroParam][1],
+                                                                               fgkParamSetPi0900GeV[kPizeroParam][2],
+                                                                               fgkParamSetPi0900GeV[kPizeroParam][3]);
+                                       break;
+                               case kPizeroParamAlter:
+                                       return PtQCD(   *px, 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlter][0], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlter][1], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlter][2], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlter][3], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlter][4]);
+                                       break;
+                               case kPizeroParamhigh:
+                                       return PtQCD(   *px, 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlterlow][0], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlterlow][1], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlterlow][2], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlterlow][3], 
+                                                                       fgkParamSetPi0900GeV[kPizeroParamAlterlow][4]);
+                                       break;
+                               default:
+                                       return 0;                       
+                       }               
+                       
+               default:
+                       return 0;
+       }
 
 }
 
 Double_t AliGenEMlib::YPizero( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 
 }
 
 Double_t AliGenEMlib::V2Pizero( const Double_t *px, const Double_t */*dummy*/ )
 {
-  double n1,n2,n3,n4,n5;
-  double v1,v2,v3,v4,v5;
-  switch(fgSelectedCentrality) {
-  case k0010:
-    n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
-    v1=V2Param(px,fgkV2param[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
-    v2=V2Param(px,fgkV2param[k0510]);
-    return (n1*v1+n2*v2)/(n1+n2);
-    break;
-  case k0020:
-    n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
-    v1=V2Param(px,fgkV2param[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
-    v2=V2Param(px,fgkV2param[k0510]);
-    n3=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k1020]);
-    v3=V2Param(px,fgkV2param[k1020]);
-    return (n1*v1+n2*v2+2*n3*v3)/(n1+n2+2*n3);
-    break;
-  case k2040:
-    n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k2030]);
-    v1=V2Param(px,fgkV2param[k2030]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k3040]);
-    v2=V2Param(px,fgkV2param[k3040]);
-    return (n1*v1+n2*v2)/(n1+n2);
-    break;
-  case k0040:
-    n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
-    v1=V2Param(px,fgkV2param[k0005]);
-    n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
-    v2=V2Param(px,fgkV2param[k0510]);
-    n3=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k1020]);
-    v3=V2Param(px,fgkV2param[k1020]);
-    n4=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k2030]);
-    v4=V2Param(px,fgkV2param[k2030]);
-    n5=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k3040]);
-    v5=V2Param(px,fgkV2param[k3040]);
-    return (n1*v1+n2*v2+2*n3*v3+2*n4*v4+2*n5*v5)/(n1+n2+2*n3+2*n4+2*n5);
-    break;
-
-  default:
-    return V2Param(px,fgkV2param[fgSelectedCentrality]);
-  }
+       double n1,n2,n3,n4,n5;
+       double v1,v2,v3,v4,v5;
+       switch(fgSelectedCentrality) {
+               case k0010:
+                       n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
+                       v1=V2Param(px,fgkV2param[k0005]);
+                       n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
+                       v2=V2Param(px,fgkV2param[k0510]);
+                       return (n1*v1+n2*v2)/(n1+n2);
+                       break;
+               case k0020:
+                       n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
+                       v1=V2Param(px,fgkV2param[k0005]);
+                       n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
+                       v2=V2Param(px,fgkV2param[k0510]);
+                       n3=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k1020]);
+                       v3=V2Param(px,fgkV2param[k1020]);
+                       return (n1*v1+n2*v2+2*n3*v3)/(n1+n2+2*n3);
+                       break;
+               case k2040:
+                       n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k2030]);
+                       v1=V2Param(px,fgkV2param[k2030]);
+                       n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k3040]);
+                       v2=V2Param(px,fgkV2param[k3040]);
+                       return (n1*v1+n2*v2)/(n1+n2);
+                       break;
+               case k0040:
+                       n1=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0005]);
+                       v1=V2Param(px,fgkV2param[k0005]);
+                       n2=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k0510]);
+                       v2=V2Param(px,fgkV2param[k0510]);
+                       n3=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k1020]);
+                       v3=V2Param(px,fgkV2param[k1020]);
+                       n4=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k2030]);
+                       v4=V2Param(px,fgkV2param[k2030]);
+                       n5=PtModifiedHagedornPowerlaw(px,fgkRawPtOfV2Param[k3040]);
+                       v5=V2Param(px,fgkV2param[k3040]);
+                       return (n1*v1+n2*v2+2*n3*v3+2*n4*v4+2*n5*v5)/(n1+n2+2*n3+2*n4+2*n5);
+                       break;
+
+               default:
+                       return V2Param(px,fgkV2param[fgSelectedCentrality]);
+       }
 }
 
 //--------------------------------------------------------------------------
@@ -627,7 +862,7 @@ Double_t AliGenEMlib::V2Pizero( const Double_t *px, const Double_t */*dummy*/ )
 Int_t AliGenEMlib::IpEta(TRandom *)
 {
   // Return eta pdg code
-  return 221;     
+       return 221;     
 }
 
 Double_t AliGenEMlib::PtEta( const Double_t *px, const Double_t */*dummy*/ )
@@ -636,56 +871,87 @@ Double_t AliGenEMlib::PtEta( const Double_t *px, const Double_t */*dummy*/ )
   // fit functions and corresponding parameter of Eta pT for pp @ 2.76 TeV and @ 7 TeV
   // and mtscaled pT 
 
-  Double_t km = 0.;
-  Double_t kc = 0.;
-  Double_t kT = 0.;
-  Double_t kn = 0.;
-
-  switch(fgSelectedPtParam){ 
-    // Tsallis fit to final eta (PHOS+PCM) -> used for final publication
-    // for pp @ 7 TeV
-  case kPizeroEta7TeVpp:
-    km = 0.547853; kc = 2.496; kT = 0.229; kn = 6.985;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizeroEta7TeVpplow:
-    km = 0.547853; kc = 1.970; kT = 0.253; kn = 7.591;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizeroEta7TeVpphigh:
-    km = 0.547853; kc = 3.060; kT = 0.212; kn = 6.578;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-    // Tsallis fit to preliminary eta (QM'11)
-    // for pp @ 2.76 TeV
-  case kPizeroEta2760GeVpp:
-    km = 0.547853; kc = 1.971; kT = 0.188; kn = 6.308;
-    return PtTsallis(*px,km,kc,kT,kn);
-  case kPizeroEta2760GeVpplow:
-    km = 0.547853; kc = 1.228; kT = 0.220; kn = 7.030;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-  case kPizeroEta2760GeVpphigh:
-    km = 0.547853; kc = 2.802; kT = 0.164; kn = 5.815;
-    return PtTsallis(*px,km,kc,kT,kn);
-    break;
-
-  default:
-  return MtScal(*px,1);
-    break;
-
-  }
-
+       // parameters for Tsallis fit to eta
+       Double_t km = 0.;
+       Double_t kc = 0.;
+       Double_t kT = 0.;
+       Double_t kn = 0.;
+
+       // parameters for Tsallis fit to pi0
+       Double_t kmPi0 = 0.;
+       Double_t kcPi0 = 0.;
+       Double_t kTPi0 = 0.;
+       Double_t knPi0 = 0.;
+
+       // parameters for fit to eta/pi0
+       Double_t krm1 = 0.;
+       Double_t krm2 = 0.;
+       Double_t krc1 = 0.;
+       Double_t krc2 = 0.;
+       Double_t krT1 = 0.;
+       Double_t krT2 = 0.;
+       Double_t krn = 0.;
+       
+       switch(fgSelectedCollisionsSystem){
+               case kpp7TeV:
+                       switch(fgSelectedPtParamEta){ 
+                               // Tsallis fit to final eta (PHOS+PCM) -> used stat errors only for final publication
+                               // for pp @ 7 TeV
+                               case kEtaParamRatiopp:
+                                       krm1 = 0.547853; krm2 = 0.134977; krc1 = 1.44198e+11; krc2 = 2.06751e+12 ; krT1 = 0.154567 ; krT2 = 0.139634 ; krn=32.0715; 
+                                       kmPi0=0.134977; kcPi0=2.31335/(2*TMath::Pi()); kTPi0=0.1433; knPi0=7.003;
+                                       return PtParticleRatiopp(*px, krm1, krm2, krc1, krc2, krT1, krT2, krn) * PtTsallis(*px,kmPi0,kcPi0,kTPi0,knPi0);
+                                       break;
+                               case kEtaParampp:
+                                       km = 0.547853; kc = 0.290164/(2*TMath::Pi()); kT = 0.212; kn = 7.352;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               // NOTE: None of these parametrisations look right - no idea where they come from       
+                               case kEtaParampplow:
+                                       km = 0.547853; kc = 1.970; kT = 0.253; kn = 7.591;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               case kEtaParampphigh:
+                                       km = 0.547853; kc = 3.060; kT = 0.212; kn = 6.578;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               default:
+                               return MtScal(*px,kEta);
+                       }
+               case kpp2760GeV:        
+                       switch(fgSelectedPtParamEta){ 
+                               // Tsallis fit to preliminary eta (QM'11)
+                               // for pp @ 2.76 TeV
+                               // NOTE: None of these parametrisations look right - no idea where they come from
+                               case kEtaParampp:
+                                       km = 0.547853; kc = 1.971; kT = 0.188; kn = 6.308;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                               case kEtaParampplow:
+                                       km = 0.547853; kc = 1.228; kT = 0.220; kn = 7.030;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               case kEtaParampphigh:
+                                       km = 0.547853; kc = 2.802; kT = 0.164; kn = 5.815;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               default:
+                                       return MtScal(*px,kEta);
+                                       break;
+                       }
+               default:
+                       return MtScal(*px,kEta);
+                       break;  
+       }
 }
 
 Double_t AliGenEMlib::YEta( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 }
 
 Double_t AliGenEMlib::V2Eta( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return KEtScal(*px,1); //V2Param(px,fgkV2param[1][fgSelectedV2Param]);
+       return KEtScal(*px,kEta); //V2Param(px,fgkV2param[1][fgSelectedV2Param]);
 }
 
 //--------------------------------------------------------------------------
@@ -693,28 +959,29 @@ Double_t AliGenEMlib::V2Eta( const Double_t *px, const Double_t */*dummy*/ )
 //                              Rho
 //
 //--------------------------------------------------------------------------
-Int_t AliGenEMlib::IpRho(TRandom *)
+Int_t AliGenEMlib::IpRho0(TRandom *)
 {
-  // Return rho pdg code
-  return 113;     
+       // Return rho pdg code
+       return 113;     
 }
 
-Double_t AliGenEMlib::PtRho( const Double_t *px, const Double_t */*dummy*/ )
+Double_t AliGenEMlib::PtRho0( const Double_t *px, const Double_t */*dummy*/ )
 {
-  // Rho pT
-  return MtScal(*px,2);
+       // Rho pT
+       return MtScal(*px,kRho0);
 }
 
-Double_t AliGenEMlib::YRho( const Double_t *py, const Double_t */*dummy*/ )
+Double_t AliGenEMlib::YRho0( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 }
 
-Double_t AliGenEMlib::V2Rho( const Double_t *px, const Double_t */*dummy*/ )
+Double_t AliGenEMlib::V2Rho0( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return KEtScal(*px,2);
+       return KEtScal(*px,kRho0);
 }
 
+
 //--------------------------------------------------------------------------
 //
 //                              Omega
@@ -722,24 +989,72 @@ Double_t AliGenEMlib::V2Rho( const Double_t *px, const Double_t */*dummy*/ )
 //--------------------------------------------------------------------------
 Int_t AliGenEMlib::IpOmega(TRandom *)
 {
-  // Return omega pdg code
-  return 223;     
+       // Return omega pdg code
+       return 223;     
 }
 
 Double_t AliGenEMlib::PtOmega( const Double_t *px, const Double_t */*dummy*/ )
 {
-  // Omega pT
-  return MtScal(*px,3);
+       // Omega pT
+       // fit functions and corresponding parameter of Omega pT for preliminary pp @ 7 TeV data
+       // and mtscaled pT 
+
+       // parameters for Tsallis fit to omega
+       Double_t km = 0.;
+       Double_t kc = 0.;
+       Double_t kT = 0.;
+       Double_t kn = 0.;
+
+       // parameters for Tsallis fit to pi0
+       Double_t kmPi0 = 0.;
+       Double_t kcPi0 = 0.;
+       Double_t kTPi0 = 0.;
+       Double_t knPi0 = 0.;
+
+       // parameters for fit to omega/pi0
+       Double_t krm1 = 0.;
+       Double_t krm2 = 0.;
+       Double_t krc1 = 0.;
+       Double_t krc2 = 0.;
+       Double_t krT1 = 0.;
+       Double_t krT2 = 0.;
+       Double_t krn = 0.;
+       
+       switch(fgSelectedCollisionsSystem){
+               case kpp7TeV:
+                       switch(fgSelectedPtParamOmega){ 
+                               // Tsallis fit to final omega (PHOS) -> stat errors only, preliminary QM12
+                               // for pp @ 7 TeV
+                               case kOmegaParamRatiopp:
+                                       krm1 = 0.78265; krm2 = 0.134977; krc1 = 21240028553.4600143433; krc2 = 168266377865.0805969238 ; krT1 = 0.21175 ; krT2 = 0.14328 ; krn=12.8831831756; 
+                                       kmPi0=0.134977; kcPi0=2.31335/(2*TMath::Pi()); kTPi0=0.1433; knPi0=7.003;
+                                       return PtParticleRatiopp(*px, krm1, krm2, krc1, krc2, krT1, krT2, krn) * PtTsallis(*px,kmPi0,kcPi0,kTPi0,knPi0);
+                                       break;
+                               case kOmegaParampp:
+                                       km = 0.78265; kc = 0.340051/(2*TMath::Pi()); kT = 0.206; kn = 6.31422;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               default:
+                               return MtScal(*px,kOmega);
+                       }
+               default:
+                       return MtScal(*px,kOmega);
+                       break;  
+       }
+       
+       return MtScal(*px,kOmega);
+
 }
 
 Double_t AliGenEMlib::YOmega( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 }
 
 Double_t AliGenEMlib::V2Omega( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return KEtScal(*px,3);
+       return KEtScal(*px,kOmega);
+
 }
 
 
@@ -750,25 +1065,25 @@ Double_t AliGenEMlib::V2Omega( const Double_t *px, const Double_t */*dummy*/ )
 //--------------------------------------------------------------------------
 Int_t AliGenEMlib::IpEtaprime(TRandom *)
 {
-  // Return etaprime pdg code
-  return 331;     
+       // Return etaprime pdg code
+       return 331;     
 }
 
 Double_t AliGenEMlib::PtEtaprime( const Double_t *px, const Double_t */*dummy*/ )
 {
-  // Eta pT
-  return MtScal(*px,4);
+       // Eta pT
+       return MtScal(*px,kEtaprime);
 }
 
 Double_t AliGenEMlib::YEtaprime( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 
 }
 
 Double_t AliGenEMlib::V2Etaprime( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return KEtScal(*px,4);
+       return KEtScal(*px,kEtaprime);
 }
 
 //--------------------------------------------------------------------------
@@ -778,24 +1093,67 @@ Double_t AliGenEMlib::V2Etaprime( const Double_t *px, const Double_t */*dummy*/
 //--------------------------------------------------------------------------
 Int_t AliGenEMlib::IpPhi(TRandom *)
 {
-  // Return phi pdg code
-  return 333;     
+       // Return phi pdg code
+       return 333;     
 }
 
 Double_t AliGenEMlib::PtPhi( const Double_t *px, const Double_t */*dummy*/ )
 {
   // Phi pT
-  return MtScal(*px,5);
+  // fit functions and corresponding parameter of Phi pT for preliminary pp @ 7 TeV data
+       // and PbPb collisions
+       // and mtscaled pT 
+
+       // parameters for Tsallis fit to phi
+       Double_t km = 0.;
+       Double_t kc = 0.;
+       Double_t kT = 0.;
+       Double_t kn = 0.;
+
+       
+       switch(fgSelectedCollisionsSystem){
+//             case kPbPb:
+//                     switch(fgSelectedCentrality){
+//                             // Tsallis fit to final phi->K+K- (TPC, ITS) -> stat+syst
+//                             case k0010:
+//                                     switch(fgSelectedPtParamPhi){ 
+//                                             case kPhiParamPbPb:
+//                                                     km = 0.78265; kc = 0.340051/(2*TMath::Pi()); kT = 0.206; kn = 6.31422;
+//                                                     return PtTsallis(*px,km,kc,kT,kn);
+//                                                     break;
+//                                             default:
+//                                                     return MtScal(*px,kPhi);
+//                                     }       
+//                             default:
+//                                     return MtScal(*px,kPhi);
+//                     }
+               case kpp7TeV:
+                       switch(fgSelectedPtParamPhi){ 
+                               // Tsallis fit to final phi->K+K- (TPC, ITS) -> stat+syst
+                               // for pp @ 7 TeV
+                               case kPhiParampp:
+                                       km = 1.01946; kc = 0.0269578/(2*TMath::Pi()); kT = 0.2718119311; kn = 6.6755739295;
+                                       return PtTsallis(*px,km,kc,kT,kn);
+                                       break;
+                               default:
+                               return MtScal(*px,kPhi);
+                       }
+               default:
+                       return MtScal(*px,kPhi);
+                       break;  
+       }
+       return MtScal(*px,kPhi);
+
 }
 
 Double_t AliGenEMlib::YPhi( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 }
 
 Double_t AliGenEMlib::V2Phi( const Double_t *px, const Double_t */*dummy*/ )
 {
-  return KEtScal(*px,5);
+       return KEtScal(*px,kPhi);
 }
 
 //--------------------------------------------------------------------------
@@ -805,59 +1163,363 @@ Double_t AliGenEMlib::V2Phi( const Double_t *px, const Double_t */*dummy*/ )
 //--------------------------------------------------------------------------
 Int_t AliGenEMlib::IpJpsi(TRandom *)
 {
-  // Return phi pdg code
-  return 443;
+       // Return phi pdg code
+       return 443;
 }
 
 Double_t AliGenEMlib::PtJpsi( const Double_t *px, const Double_t */*dummy*/ )
 {
-  // Jpsi pT
-  // based on: //https://aliceinfo.cern.ch/Notes/node/242, https://aliceinfo.cern.ch/Figure/node/3457, www.sciencedirect.com/science/article/pii/S0370269312011446
-  const static Double_t jpsiPtParam[2][3] = {
-    {  9.686337e-03, 2.629441e-01, 4.552044e+00 }
-    ,{ 3.403549e-03, 2.897061e-01, 3.644278e+00 }
-  };
-  const double pt=px[0]*2.28/2.613;
-  switch(fgSelectedCentrality) {
-  case k0020: return 2.405*PtDoublePowerlaw(&pt,jpsiPtParam[0]); break;
-  case k2040: return 2.405*PtDoublePowerlaw(&pt,jpsiPtParam[1]); break;
-  case k0040: return 0.5*2.405*(PtDoublePowerlaw(&pt,jpsiPtParam[0])+PtDoublePowerlaw(&pt,jpsiPtParam[1])); break;
-  }
-  return 0;
+       // Jpsi pT
+       // based on: //https://aliceinfo.cern.ch/Notes/node/242, https://aliceinfo.cern.ch/Figure/node/3457, www.sciencedirect.com/science/article/pii/S0370269312011446
+       const static Double_t jpsiPtParam[2][3] = {
+               {  9.686337e-03, 2.629441e-01, 4.552044e+00 }
+               ,{ 3.403549e-03, 2.897061e-01, 3.644278e+00 }
+       };
+       const double pt=px[0]*2.28/2.613;
+       switch(fgSelectedCentrality) {
+               case k0020: return 2.405*PtDoublePowerlaw(&pt,jpsiPtParam[0]); break;
+               case k2040: return 2.405*PtDoublePowerlaw(&pt,jpsiPtParam[1]); break;
+               case k0040: return 0.5*2.405*(PtDoublePowerlaw(&pt,jpsiPtParam[0])+PtDoublePowerlaw(&pt,jpsiPtParam[1])); break;
+               default:
+                       return MtScal(*px,kJpsi);
+
+       }
+       return 0;
 }
 
 Double_t AliGenEMlib::YJpsi( const Double_t *py, const Double_t */*dummy*/ )
 {
-  return YFlat(*py);
+       return YFlat(*py);
 }
 
 Double_t AliGenEMlib::V2Jpsi( const Double_t *px, const Double_t */*dummy*/ )
 {
-  const static Double_t v2Param[16] = { 1.156000e-01, 8.936854e-01, 0.000000e+00, 4.000000e+00, 6.222375e+00, -1.600314e-01, 8.766676e-01, 7.824143e+00, 1.156000e-01, 3.484503e-02, 4.413685e-01, 0, 1, 3.484503e-02, 4.413685e-01, 7.2 };
-  switch(fgSelectedCentrality){
-  case k2040: return V2Param(px,v2Param); break;
-  case k0010: return 0.43*V2Param(px,v2Param); break;  //V2Pizero(0010)/V2Pizero(2040)=0.43 +-0.025
-  case k1020: return 0.75*V2Param(px,v2Param); break;  //V2Pizero(1020)/V2Pizero(2040)=0.75 +-0.04
-  case k0020: return 0.66*V2Param(px,v2Param); break;  //V2Pizero(0020)/V2Pizero(2040)=0.66 +-0.035
-  case k0040: return 0.82*V2Param(px,v2Param); break;  //V2Pizero(0040)/V2Pizero(2040)=0.82 +-0.05
-  }
-  return 0;
+       const static Double_t v2Param[16] = { 1.156000e-01, 8.936854e-01, 0.000000e+00, 4.000000e+00, 6.222375e+00, -1.600314e-01, 8.766676e-01, 7.824143e+00, 1.156000e-01, 3.484503e-02, 4.413685e-01, 0, 1, 3.484503e-02, 4.413685e-01, 7.2 };
+       switch(fgSelectedCentrality){
+               case k2040: return V2Param(px,v2Param); break;
+               case k0010: return 0.43*V2Param(px,v2Param); break;  //V2Pizero(0010)/V2Pizero(2040)=0.43 +-0.025
+               case k1020: return 0.75*V2Param(px,v2Param); break;  //V2Pizero(1020)/V2Pizero(2040)=0.75 +-0.04
+               case k0020: return 0.66*V2Param(px,v2Param); break;  //V2Pizero(0020)/V2Pizero(2040)=0.66 +-0.035
+               case k0040: return 0.82*V2Param(px,v2Param); break;  //V2Pizero(0040)/V2Pizero(2040)=0.82 +-0.05
+       }
+       return 0;
+}
+
+//--------------------------------------------------------------------------
+//
+//                              Sigma
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpSigma(TRandom *)
+{
+       // Return Sigma pdg code
+       return 3212;     
+}
+
+Double_t AliGenEMlib::PtSigma( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // Sigma pT
+       return MtScal(*px,kSigma0);
+}
+
+Double_t AliGenEMlib::YSigma( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2Sigma0( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kSigma0);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              K0short
+//
+//--------------------------------------------------------------------------
+
+Int_t AliGenEMlib::IpK0short(TRandom *)
+{
+       // Return kzeroshort pdg code
+       return 310;
+}
+
+Double_t AliGenEMlib::PtK0short( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // K0short pT
+
+       Double_t ka = 0; 
+       Double_t kb = 0; 
+       Double_t kc = 0; 
+       Double_t kd = 0; 
+       Double_t ke = 0; 
+       Double_t kf = 0;
+               
+       switch (fgSelectedCentrality){
+               case k0010:
+                       ka =9.21859; kb=5.71299; kc=-3.34251; kd=0.48796; ke=0.0192272; kf=3.82224;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               case k1020:
+                       ka=6.2377; kb=5.6133; kc=-117.295; kd=3.51154; ke=36.3047; kf=0.456243;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               case k0020:
+                       ka=7.7278; kb=5.6686; kc=-3.29259; kd=0.475403; ke=0.0223951; kf=3.69326;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               case k2040:
+                       ka=3.38301; kb= 5.5323; kc=-96.078; kd=3.30782; ke=31.085; kf=0.466908;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               case k0040:
+                       ka=5.55478; kb=5.61919; kc=-125.635; kd=3.5637; ke=38.9668; kf=0.47068;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               case k4080:
+                       ka=0.731606; kb=5.49931; kc=-25.3106; kd=2.2439; ke=8.25063; kf= 0.289288;
+                       return PtXQCD(  *px, ka, kb, kc, kd, ke, kf);
+                       break;
+               default:
+                       return MtScal(*px,kK0s);
+                       break;
+                                       
+       }
+}
+Double_t AliGenEMlib::YK0short( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2K0sshort( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kK0s);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              Delta ++
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpDeltaPlPl(TRandom *)
+{
+       // Return Delta++ pdg code
+       return 2224;     
+}
+
+Double_t AliGenEMlib::PtDeltaPlPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // Delta++ pT
+       return MtScal(*px,kDeltaPlPl);
+}
+
+Double_t AliGenEMlib::YDeltaPlPl( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2DeltaPlPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kDeltaPlPl);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              Delta +
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpDeltaPl(TRandom *)
+{
+       // Return Delta+ pdg code
+       return 2214;     
+}
+
+Double_t AliGenEMlib::PtDeltaPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // Delta+ pT
+       return MtScal(*px,kDeltaPl);
+}
+
+Double_t AliGenEMlib::YDeltaPl( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2DeltaPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kDeltaPl);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              Delta -
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpDeltaMi(TRandom *)
+{
+       // Return Delta- pdg code
+       return 1114;     
+}
+
+Double_t AliGenEMlib::PtDeltaMi( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // Delta- pT
+       return MtScal(*px,kDeltaMi);
+}
+
+Double_t AliGenEMlib::YDeltaMi( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2DeltaMi( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kDeltaMi);
+}
+
+
+
+//--------------------------------------------------------------------------
+//
+//                              Delta 0
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpDeltaZero(TRandom *)
+{
+       // Return Delta0 pdg code
+       return 2114;     
+}
+
+Double_t AliGenEMlib::PtDeltaZero( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // Delta0 pT
+       return MtScal(*px,kDeltaZero);
+}
+
+Double_t AliGenEMlib::YDeltaZero( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2DeltaZero( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kDeltaZero);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              rho +
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpRhoPl(TRandom *)
+{
+       // Return rho+ pdg code
+       return 213;     
+}
+
+Double_t AliGenEMlib::PtRhoPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // rho + pT
+       return MtScal(*px,kRhoPl);
+}
+
+Double_t AliGenEMlib::YRhoPl( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2RhoPl( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kRhoPl);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                              rho -
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpRhoMi(TRandom *)
+{
+       // Return rho- pdg code
+       return -213;     
 }
 
+Double_t AliGenEMlib::PtRhoMi( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // rho- pT
+       return MtScal(*px,kRhoMi);
+}
+
+Double_t AliGenEMlib::YRhoMi( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2RhoMi( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kRhoMi);
+}
+
+
+//--------------------------------------------------------------------------
+//
+//                             K0 *
+//
+//--------------------------------------------------------------------------
+Int_t AliGenEMlib::IpK0star(TRandom *)
+{
+       // Return K0 * pdg code
+       return 313;     
+}
+
+Double_t AliGenEMlib::PtK0star( const Double_t *px, const Double_t */*dummy*/ )
+{
+       // K0 * pT
+       return MtScal(*px,kK0star);
+}
+
+Double_t AliGenEMlib::YK0star( const Double_t *py, const Double_t */*dummy*/ )
+{
+       return YFlat(*py);
+
+}
+
+Double_t AliGenEMlib::V2K0star( const Double_t *px, const Double_t */*dummy*/ )
+{
+       return KEtScal(*px,kK0star);
+}
+
+
+
 Double_t AliGenEMlib::YFlat(Double_t /*y*/)
 {
-  //--------------------------------------------------------------------------
-  //
-  //                    flat rapidity distribution 
-  //
-  //--------------------------------------------------------------------------
+       //--------------------------------------------------------------------------
+       //
+       //                    flat rapidity distribution 
+       //
+       //--------------------------------------------------------------------------
 
-  Double_t dNdy = 1.;   
+       Double_t dNdy = 1.;   
 
-  return dNdy;
+       return dNdy;
 
 }
 
+
 //============================================================= 
 //
 //                    Mt-scaling  
@@ -866,68 +1528,90 @@ Double_t AliGenEMlib::YFlat(Double_t /*y*/)
 //
 Double_t AliGenEMlib::MtScal(Double_t pt, Int_t np)
 {
-  // Function for the calculation of the Pt distribution for a 
-  // given particle np, from the pizero Pt distribution using  
-  // mt scaling. 
-
-  Double_t scaledPt = sqrt(pt*pt + fgkHM[np]*fgkHM[np] - fgkHM[0]*fgkHM[0]);
-  Double_t scaledYield = PtPizero(&scaledPt, (Double_t*) 0);
-
-  //     VALUE MESON/PI AT 5 GeV/c
-  Double_t NormPt = 5.;
-  Double_t scaledNormPt = sqrt(NormPt*NormPt + fgkHM[np]*fgkHM[np] - fgkHM[0]*fgkHM[0]);
-
-  Double_t norm = fgkMtFactor[int(bool(fgSelectedCentrality))][np] * (PtPizero(&NormPt, (Double_t*) 0) / PtPizero(&scaledNormPt, (Double_t*) 0));
-
-  return norm*(pt/scaledPt)*scaledYield;
+       // Function for the calculation of the Pt distribution for a 
+       // given particle np, from the pizero Pt distribution using  
+       // mt scaling. 
+
+       Double_t scaledPt = sqrt(pt*pt + fgkHM[np]*fgkHM[np] - fgkHM[0]*fgkHM[0]);
+       Double_t scaledYield = PtPizero(&scaledPt, (Double_t*) 0);
+
+       //     VALUE MESON/PI AT 5 GeV/c
+       Double_t NormPt = 5.;
+       Double_t scaledNormPt = sqrt(NormPt*NormPt + fgkHM[np]*fgkHM[np] - fgkHM[0]*fgkHM[0]);
+
+       Int_t selectedCol;
+       switch (fgSelectedCollisionsSystem){
+               case kpp900GeV:
+                       selectedCol=0;
+                       break;
+               case kpp2760GeV:
+                       selectedCol=0;
+                       break;
+               case kpp7TeV:
+                       selectedCol=0;
+                       break;
+               case kpPb:
+                       selectedCol=1;
+                       break;
+               case kPbPb:
+                       selectedCol=2;
+                       break;
+               default:
+                       selectedCol=0;
+                       printf("<AliGenEMlib::MtScal> no collision system has been given\n");
+       }
+       
+       Double_t norm = fgkMtFactor[selectedCol][np] * (PtPizero(&NormPt, (Double_t*) 0) / PtPizero(&scaledNormPt, (Double_t*) 0));
+
+       return norm*(pt/scaledPt)*scaledYield;
 }
 
 Double_t AliGenEMlib::KEtScal(Double_t pt, Int_t np)
 {
-  const int nq=2; //number of quarks for particle np, here always 2
-  Double_t scaledPt = sqrt(pow(2.0/nq*(sqrt(pt*pt+fgkHM[np]*fgkHM[np])-fgkHM[np])+fgkHM[0],2)-fgkHM[0]*fgkHM[0]);
-  return V2Pizero(&scaledPt, (Double_t*) 0);
+       const int nq=2; //number of quarks for particle np, here always 2
+       Double_t scaledPt = sqrt(pow(2.0/nq*(sqrt(pt*pt+fgkHM[np]*fgkHM[np])-fgkHM[np])+fgkHM[0],2)-fgkHM[0]*fgkHM[0]);
+       return V2Pizero(&scaledPt, (Double_t*) 0);
 }
 
 Double_t AliGenEMlib::V2Param(const Double_t *px, const Double_t *par)
 {
-  // Very general parametrization of the v2
-
-  const double &pt=px[0];
-  double val=CrossOverLc(par[4],par[3],pt)*(2*par[0]/(1+TMath::Exp(par[1]*(par[2]-pt)))-par[0])+CrossOverRc(par[4],par[3],pt)*((par[8]-par[5])/(1+TMath::Exp(par[6]*(pt-par[7])))+par[5]);
-  double sys=0;
-  if(fgSelectedV2Systematic){
-    double syspt=pt>par[15]?par[15]:pt;
-    sys=fgSelectedV2Systematic*par[11+fgSelectedV2Systematic*2]*pow(syspt,par[12+fgSelectedV2Systematic*2]);
-  }
-  return std::max(val+sys,0.0);
+       // Very general parametrization of the v2
+
+       const double &pt=px[0];
+       double val=CrossOverLc(par[4],par[3],pt)*(2*par[0]/(1+TMath::Exp(par[1]*(par[2]-pt)))-par[0])+CrossOverRc(par[4],par[3],pt)*((par[8]-par[5])/(1+TMath::Exp(par[6]*(pt-par[7])))+par[5]);
+       double sys=0;
+       if(fgSelectedV2Systematic){
+               double syspt=pt>par[15]?par[15]:pt;
+               sys=fgSelectedV2Systematic*par[11+fgSelectedV2Systematic*2]*pow(syspt,par[12+fgSelectedV2Systematic*2]);
+       }
+       return std::max(val+sys,0.0);
 }
 
 Double_t AliGenEMlib::V2Flat(const Double_t */*px*/, const Double_t */*param*/)
 {
-  // Flat v2
+       // Flat v2
 
-  return 0.0;
+       return 0.0;
 }
 
 Double_t AliGenEMlib::GetTAA(Int_t cent){
-  const static Double_t taa[16] = { 1.0,    // pp
-                                   26.32,  // 0-5
-                                   20.56,  // 5-10
-                                   14.39,  // 10-20
-                                   8.70,   // 20-30
-                                   5.001,  // 30-40
-                                   2.675,  // 40-50
-                                   1.317,  // 50-60
-                                   23.44,  // 0-10
-                                   6.85,   // 20-40
-                                   1.996,  // 40-60
-                                   0.4174, // 60-80
-                                   18.91,  // 0-20
-                                   12.88,  // 0-40
-                                   3.088,  // 20-80
-                                   1.207}; // 40-80
-  return taa[cent];  
+       const static Double_t taa[16] = { 1.0,    // pp
+                                               26.32,  // 0-5
+                                               20.56,  // 5-10
+                                               14.39,  // 10-20
+                                               8.70,   // 20-30
+                                               5.001,  // 30-40
+                                               2.675,  // 40-50
+                                               1.317,  // 50-60
+                                               23.44,  // 0-10
+                                               6.85,   // 20-40
+                                               1.996,  // 40-60
+                                               0.4174, // 60-80
+                                               18.91,  // 0-20
+                                               12.88,  // 0-40
+                                               3.088,  // 20-80
+                                               1.207}; // 40-80
+       return taa[cent];  
 }
 
 //==========================================================================
@@ -942,173 +1626,274 @@ typedef Int_t (*GenFuncIp) (TRandom *);
 
 GenFunc AliGenEMlib::GetPt(Int_t param, const char * tname) const
 {
-  // Return pointer to pT parameterisation
-   GenFunc func=0;
-   TString sname(tname);
-
-   switch (param) 
-    {
-     case kDirectRealGamma:
-       func=PtDirectRealGamma;
-      break;
-     case kDirectVirtGamma:
-       func=PtDirectVirtGamma;
-      break;
-    case kPizero:
-      func=PtPizero;
-      break;
-    case kEta:
-      func=PtEta;
-      break;
-    case kRho:
-      func=PtRho;
-      break;
-    case kOmega:
-      func=PtOmega;
-      break;
-    case kEtaprime:
-      func=PtEtaprime;
-      break;
-    case kPhi:
-      func=PtPhi;
-      break;
-    case kJpsi:
-      func=PtJpsi;
-      break;
-
-    default:
-      func=0;
-      printf("<AliGenEMlib::GetPt> unknown parametrisation\n");
+       // Return pointer to pT parameterisation
+       GenFunc func=0;
+       TString sname(tname);
+
+       switch (param) {
+               case kDirectRealGamma:
+                       func=PtDirectRealGamma;
+                       break;
+               case kDirectVirtGamma:
+                       func=PtDirectVirtGamma;
+                       break;
+               case kPizero:
+                       func=PtPizero;
+                       break;
+               case kEta:
+                       func=PtEta;
+                       break;
+               case kRho0:
+                       func=PtRho0;
+                       break;
+               case kOmega:
+                       func=PtOmega;
+                       break;
+               case kEtaprime:
+                       func=PtEtaprime;
+                       break;
+               case kPhi:
+                       func=PtPhi;
+                       break;
+               case kJpsi:
+                       func=PtJpsi;
+                       break;
+               case kSigma0:
+                       func= PtSigma;
+                       break;
+               case kK0s:
+                       func= PtK0short;
+                       break;
+               case kDeltaPlPl:
+                       func= PtDeltaPlPl;
+                       break;
+               case kDeltaPl:
+                       func= PtDeltaPlPl;
+                       break;
+               case kDeltaMi:
+                       func= PtDeltaMi;
+                       break;
+               case kDeltaZero:
+                       func= PtDeltaZero;
+                       break;
+               case kRhoPl:
+                       func= PtRhoPl;
+                       break;
+               case kRhoMi:
+                       func= PtRhoMi;
+                       break;
+               case kK0star:
+                       func= PtK0star;
+                       break;
+               default:
+                       func=0;
+                       printf("<AliGenEMlib::GetPt> unknown parametrisation\n");
     }
-   return func;
+       return func;
 }
 
 GenFunc AliGenEMlib::GetY(Int_t param, const char * tname) const
 {
-  // Return pointer to y- parameterisation
-   GenFunc func=0;
-   TString sname(tname);
-
-   switch (param) 
-    {
-    case kDirectRealGamma:
-      func=YDirectRealGamma;
-      break;
-    case kDirectVirtGamma:
-      func=YDirectVirtGamma;
-      break;
-    case kPizero:
-         func=YPizero;
-         break;
-    case kEta:
-         func=YEta;
-         break;
-    case kRho:
-         func=YRho;
-         break;
-    case kOmega:
-         func=YOmega;
-         break;
-    case kEtaprime:
-         func=YEtaprime;
-         break;
-    case kPhi:
-         func=YPhi;
-         break;
-    case kJpsi:
-      func=YJpsi;
-      break;
-
-    default:
-        func=0;
-        printf("<AliGenEMlib::GetY> unknown parametrisation\n");
-    }
-    return func;
+       // Return pointer to y- parameterisation
+       GenFunc func=0;
+       TString sname(tname);
+
+       switch (param) {
+               case kDirectRealGamma:
+                       func=YDirectRealGamma;
+                       break;
+               case kDirectVirtGamma:
+                       func=YDirectVirtGamma;
+                       break;
+               case kPizero:
+                       func=YPizero;
+                       break;
+               case kEta:
+                       func=YEta;
+                       break;
+               case kRho0:
+                       func=YRho0;
+                       break;
+               case kOmega:
+                       func=YOmega;
+                       break;
+               case kEtaprime:
+                       func=YEtaprime;
+                       break;
+               case kPhi:
+                       func=YPhi;
+                       break;
+               case kJpsi:
+                       func=YJpsi;
+                       break;
+               case kSigma0:
+                       func=YSigma;
+                       break;           
+               case kK0s:
+                       func=YK0short;
+                       break;
+               case kDeltaPlPl:
+                       func=YDeltaPlPl;
+                       break;
+               case kDeltaPl:
+                       func=YDeltaPl;
+                       break;
+               case kDeltaMi:
+                       func=YDeltaMi;
+                       break;
+               case kDeltaZero:
+                       func=YDeltaZero;
+                       break;
+               case kRhoPl:
+                       func=YRhoPl;
+                       break;
+               case kRhoMi:
+                       func=YRhoMi;
+                       break;
+               case kK0star:
+                       func=YK0star;
+                       break;
+               default:
+                       func=0;
+                       printf("<AliGenEMlib::GetY> unknown parametrisation\n");
+       }
+       return func;
 }
 
 GenFuncIp AliGenEMlib::GetIp(Int_t param, const char * tname) const
 {
-  // Return pointer to particle type parameterisation
-   GenFuncIp func=0;
-   TString sname(tname);
-
-   switch (param) 
-    {
-    case kDirectRealGamma:
-      func=IpDirectRealGamma;
-      break;
-    case kDirectVirtGamma:
-      func=IpDirectVirtGamma;
-      break;
-    case kPizero:
-         func=IpPizero;
-         break;
-    case kEta:
-         func=IpEta;
-         break;
-    case kRho:
-         func=IpRho;
-         break;
-    case kOmega:
-         func=IpOmega;
-         break;
-    case kEtaprime:
-         func=IpEtaprime;
-         break;
-    case kPhi:
-         func=IpPhi;
-         break;
-    case kJpsi:
-      func=IpJpsi;
-      break;
-
-    default:
-        func=0;
-        printf("<AliGenEMlib::GetIp> unknown parametrisation\n");
-    }
-    return func;
+       // Return pointer to particle type parameterisation
+       GenFuncIp func=0;
+       TString sname(tname);
+
+       switch (param) {
+               case kDirectRealGamma:
+                       func=IpDirectRealGamma;
+                       break;
+               case kDirectVirtGamma:
+                       func=IpDirectVirtGamma;
+                       break;
+               case kPizero:
+                       func=IpPizero;
+                       break;
+               case kEta:
+                       func=IpEta;
+                       break;
+               case kRho0:
+                       func=IpRho0;
+                       break;
+               case kOmega:
+                       func=IpOmega;
+                       break;
+               case kEtaprime:
+                       func=IpEtaprime;
+                       break;
+               case kPhi:
+                       func=IpPhi;
+                       break;
+               case kJpsi:
+                       func=IpJpsi;
+                       break;
+               case kSigma0:
+                       func=IpSigma;
+                       break; 
+               case kK0s:
+                       func=IpK0short;
+                       break;
+               case kDeltaPlPl:
+                       func=IpDeltaPlPl;
+                       break;
+               case kDeltaPl:
+                       func=IpDeltaPl;
+                       break;
+               case kDeltaMi:
+                       func=IpDeltaMi;
+                       break;
+               case kDeltaZero:
+                       func=IpDeltaZero;
+                       break;
+               case kRhoPl:
+                       func=IpRhoPl;
+                       break;
+               case kRhoMi:
+                       func=IpRhoMi;
+                       break;
+               case kK0star:
+                       func=IpK0star;
+                       break;
+               default:
+                       func=0;
+                       printf("<AliGenEMlib::GetIp> unknown parametrisation\n");
+       }
+       return func;
 }
 
 GenFunc AliGenEMlib::GetV2(Int_t param, const char * tname) const
 {
-  // Return pointer to v2-parameterisation
-  GenFunc func=0;
-  TString sname(tname);
-
-  switch (param) 
-    {
-    case kDirectRealGamma:
-      func=V2DirectRealGamma;
-      break;
-    case kDirectVirtGamma:
-      func=V2DirectVirtGamma;
-      break;
-    case kPizero:
-      func=V2Pizero;
-      break;
-    case kEta:
-      func=V2Eta;
-      break;
-    case kRho:
-      func=V2Pizero;
-      break;
-    case kOmega:
-      func=V2Pizero;
-      break;
-    case kEtaprime:
-      func=V2Pizero;
-      break;
-    case kPhi:
-      func=V2Pizero;
-      break;
-    case kJpsi:
-      func=V2Jpsi;
-      break;
-
-    default:
-      func=0;
-      printf("<AliGenEMlib::GetV2> unknown parametrisation\n");
-    }
-  return func;
+       // Return pointer to v2-parameterisation
+       GenFunc func=0;
+       TString sname(tname);
+
+       switch (param) {
+               case kDirectRealGamma:
+                       func=V2DirectRealGamma;
+                       break;
+               case kDirectVirtGamma:
+                       func=V2DirectVirtGamma;
+                       break;
+               case kPizero:
+                       func=V2Pizero;
+                       break;
+               case kEta:
+                       func=V2Eta;
+                       break;
+               case kRho0:
+                       func=V2Rho0;
+                       break;
+               case kOmega:
+                       func=V2Omega;
+                       break;
+               case kEtaprime:
+                       func=V2Etaprime;
+                       break;
+               case kPhi:
+                       func=V2Phi;
+                       break;
+               case kJpsi:
+                       func=V2Jpsi;
+                       break;
+               case kSigma0:
+                       func=V2Sigma0;
+                       break;    
+               case kK0s:
+                       func=V2K0sshort;
+                       break;
+               case kDeltaPlPl:
+                       func=V2DeltaPlPl;
+                       break;
+               case kDeltaPl:
+                       func=V2DeltaPl;
+                       break;
+               case kDeltaMi:
+                       func=V2DeltaMi;
+                       break;
+               case kDeltaZero:
+                       func=V2DeltaZero;
+                       break;
+               case kRhoPl:
+                       func=V2RhoPl;
+                       break;
+               case kRhoMi:
+                       func=V2RhoMi;
+                       break;
+               case kK0star:
+                       func=V2K0star;
+                       break;
+
+               default:
+                       func=0;
+                       printf("<AliGenEMlib::GetV2> unknown parametrisation\n");
+       }
+       return func;
 }
 
index 2e4742e02b7a88ddd63701089b4227693572cf47..a02e7e9f2eb10f4bd925b7a34ad3ccaa828255df 100644 (file)
 class TRandom;
 
 class AliGenEMlib :public AliGenLib {
-public:
-    
-  enum Particle_t{kPizero=0, kEta, kRho, kOmega, kEtaprime, kPhi, kJpsi, kDirectRealGamma, kDirectVirtGamma };
-  enum Centrality_t{kpp=0x0, k0005=0x1, k0510=0x2, k1020=0x3, k2030=0x4, k3040=0x5, k4050=0x6, k5060=0x7, k0010=0x8, k2040=0x9, k4060=0xA, k6080=0xB, k0020=0xC, k0040=0xD, k2080=0xE, k4080=0xF, kCentralities=0x10};
-  enum PtParamSet_t{kPizero7TeVpp=0x00, kPizeroEta7TeVpp=0x10, kPizero7TeVpplow=0x20, kPizeroEta7TeVpplow=0x30, kPizero7TeVpphigh=0x40, kPizeroEta7TeVpphigh=0x50, kPizero2760GeVpp=0x60, kPizeroEta2760GeVpp=0x70, kPizero2760GeVpplow=0x80, kPizeroEta2760GeVpplow=0x90, kPizero2760GeVpphigh=0xA0, kPizeroEta2760GeVpphigh=0xB0, kPiOldChargedPbPb=0xC0, kPichargedPbPb=0xD0, kPizeroPbPb=0xE0, kPichargedPPb=0xF0 };
-  enum v2Sys_t{kLoV2Sys=-1, kNoV2Sys=0, kUpV2Sys=+1};
-  
-  AliGenEMlib() { } ;
-
-  static void SelectParams(PtParamSet_t ptSelect, Centrality_t centSelect=kpp, Int_t v2sys=kNoV2Sys) 
-  { fgSelectedPtParam=ptSelect; fgSelectedCentrality=centSelect; fgSelectedV2Systematic=v2sys; }
-
-    GenFunc   GetPt(Int_t param, const char * tname=0) const;
-    GenFunc   GetY(Int_t param, const char * tname=0) const;
-    GenFuncIp GetIp(Int_t param, const char * tname=0) const;    
-  GenFunc   GetV2(Int_t param, const char * tname=0) const;
-
-  //private:
-
-  // General functions
-
-  static Int_t fgSelectedPtParam; // selected pT parameter
-  static Int_t fgSelectedCentrality; // selected Centrality
-  static Int_t fgSelectedV2Systematic; // selected v2 systematics, usefully values: -1,0,1
-
-
-  static Double_t PtModifiedHagedornThermal(Double_t pt, 
-                                           Double_t c, 
-                                           Double_t p0, 
-                                           Double_t p1, 
-                                           Double_t n,
-                                           Double_t cT,
-                                           Double_t T);
-
-
-  static Double_t PtModifiedHagedornExp(Double_t pt,
-                                       Double_t c,
-                                       Double_t p0,
-                                       Double_t p1,
-                                       Double_t p2,
-                                       Double_t n); 
-
-
-  static Double_t PtModifiedHagedornExp2(Double_t pt,
-                                           Double_t c,
-                                           Double_t a,
-                                           Double_t b,
-                                           Double_t p0,
-                                           Double_t p1,
-                                           Double_t d,
-                                           Double_t n);
-
-
-  static Double_t PtTsallis(Double_t pt,
-                           Double_t m,
-                           Double_t c,
-                           Double_t T,
-                           Double_t n);
-
-  static Double_t PtExponential(const Double_t *pt, const Double_t *param);
-  static Double_t PtModifiedHagedornPowerlaw(const Double_t *pt, const Double_t *param);
-  static Double_t PtDoublePowerlaw(const Double_t *pt, const Double_t *param);
-  static Double_t IntegratedKrollWada(const Double_t *mh, const Double_t *);
-
-  // direct gamma
-  static Double_t PtPromptRealGamma(const Double_t *px, const Double_t *dummy);
-  static Double_t PtPromptVirtGamma(const Double_t *px, const Double_t *dummy);
-  static Double_t PtThermalRealGamma(const Double_t *px, const Double_t *dummy);
-  static Double_t PtThermalVirtGamma(const Double_t *px, const Double_t *dummy);
-
-  static Int_t    IpDirectRealGamma(TRandom *ran);
-  static Double_t PtDirectRealGamma(const Double_t *px, const Double_t *dummy);
-  static Double_t YDirectRealGamma(const Double_t *py, const Double_t *dummy);
-  static Double_t V2DirectRealGamma(const Double_t *px, const Double_t *dummy);
-
-  static Int_t    IpDirectVirtGamma(TRandom *ran);
-  static Double_t PtDirectVirtGamma(const Double_t *px, const Double_t *dummy);
-  static Double_t YDirectVirtGamma(const Double_t *py, const Double_t *dummy);
-  static Double_t V2DirectVirtGamma(const Double_t *px, const Double_t *dummy);
-
-  // Pizero
-    static Int_t    IpPizero(TRandom *ran);
-  static Double_t PtPizero(const Double_t *px, const Double_t *dummy);
-    static Double_t YPizero(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Pizero(const Double_t *px, const Double_t *dummy);
-
-  // Eta
-    static Int_t    IpEta(TRandom *ran);
-  static Double_t PtEta(const Double_t *px, const Double_t *dummy);
-    static Double_t YEta(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Eta(const Double_t *px, const Double_t *dummy);
-
-  // Rho
-    static Int_t    IpRho(TRandom *ran);
-  static Double_t PtRho(const Double_t *px, const Double_t *dummy);
-    static Double_t YRho(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Rho(const Double_t *py, const Double_t *dummy);
-
-  // Omega
-    static Int_t    IpOmega(TRandom *ran);
-  static Double_t PtOmega(const Double_t *px, const Double_t *dummy);
-    static Double_t YOmega(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Omega(const Double_t *py, const Double_t *dummy);
-
-  // Etaprime
-    static Int_t    IpEtaprime(TRandom *ran);
-  static Double_t PtEtaprime(const Double_t *px, const Double_t *dummy);
-    static Double_t YEtaprime(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Etaprime(const Double_t *py, const Double_t *dummy);
-
-  // Phi
-    static Int_t    IpPhi(TRandom *ran);
-  static Double_t PtPhi(const Double_t *px, const Double_t *dummy);
-    static Double_t YPhi(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Phi(const Double_t *py, const Double_t *dummy);
-
-  // Jpsi
-  static Int_t    IpJpsi(TRandom *ran);
-  static Double_t PtJpsi(const Double_t *px, const Double_t *dummy);
-  static Double_t YJpsi(const Double_t *py, const Double_t *dummy);
-  static Double_t V2Jpsi(const Double_t *py, const Double_t *dummy);
-
-  // General
-  //static Double_t PtFlat(const Double_t *px, const Double_t *dummy);
-    static Double_t YFlat(Double_t y);
-  static Double_t MtScal(Double_t pt, Int_t np);
-  static Double_t V2Param(const Double_t *px, const Double_t *param);
-  static Double_t V2Flat(const Double_t *px, const Double_t *param);
-  static Double_t KEtScal(Double_t pt, Int_t np);
-  static Double_t GetTAA(Int_t cent);
-
-  static Double_t CrossOverLc(double a, double b, double x);
-  static Double_t CrossOverRc(double a, double b, double x);
-
-  static const Double_t fgkPtParam[kCentralities][10];          // parameters of pi pt spectrum
-  static const Double_t fgkV2param[kCentralities][16];          // parameters of pi v2 spectrum
-  static const Double_t fgkRawPtOfV2Param[kCentralities][10];   // parameters of the raw pt spectrum of v2 analysis
-  static const Double_t fgkThermPtParam[kCentralities][2];      // parameters of thermal gamma pt
-  static const Double_t fgkHM[8];                    // particle masses
-  static const Double_t fgkMtFactor[2][8];           // mt scaling factor
-
-  ClassDef(AliGenEMlib,0)
+       public:
+
+               enum Particle_t{kPizero=0x0, kEta=0x1, kRho0=0x2, kOmega=0x3, kEtaprime=0x4, kPhi=0x5, kJpsi=0x6, kSigma0=0x7, kK0s=0x8, kDeltaPlPl=0x9, kDeltaPl=0xA, kDeltaMi=0xB, kDeltaZero=0xC, kRhoPl = 0xD, kRhoMi = 0xE, kK0star = 0xF,  kDirectRealGamma=0x10, kDirectVirtGamma=0x11  };
+               enum Centrality_t{ kpp = 0x0, 
+                                                  k0005=0x1, k0510=0x2, k1020=0x3, k2030=0x4, k3040=0x5, k4050=0x6, k5060=0x7, k0010=0x8, k2040=0x9, k4060=0xA, k6080=0xB, k0020=0xC, k0040=0xD, k2080=0xE, k4080=0xF, kCentralities=0x10};
+               enum CollisionSystem_t {kpp900GeV=0x0, kpp2760GeV=0x1, kpp7TeV=0x2, kpPb=0x3, kPbPb=0x4};
+               enum PtParamSetPi0_t{kPizeroParam=0x0, kPizeroParamlow=0x1, kPizeroParamhigh=0x2, 
+                                                       kPichargedParam=0x3, kPichargedParamlow=0x4, kPichargedParamhigh=0x5, 
+                                                       kPizeroParamAlter=0x6, kPizeroParamAlterlow=0x7, kPizeroParamAlterhigh=0x8,
+                                                       kNPi0Param=0x9
+               };
+               enum PtParamSetEta_t{kEtaParampp=0x0, kEtaParampplow=0x1, kEtaParampphigh=0x2,
+                                                        kEtaParamRatiopp=0x3, kEtaParamRatiopplow=0x4, kEtaParamRatiopphigh=0x5,
+                                                        kEtaParamPbPb=0x6,
+                                                        kEtaParamPPb=0x7
+               };
+               enum PtParamSetOmega_t{kOmegaParampp=0x0, kOmegaParampplow=0x1, kOmegaParampphigh=0x2,
+                                                          kOmegaParamRatiopp=0x3, kOmegaParamRatiopplow=0x4, kOmegaParamRatiopphigh=0x5,
+                                                        kOmegaParamPbPb=0x6,
+                                                        kOmegaParamPPb=0x7
+               };
+               enum PtParamSetPhi_t{kPhiParampp=0x0, kPhiParampplow=0x1, kPhiParampphigh=0x2,
+                                                        kPhiParamPbPb=0x3,
+                                                        kPhiParamPPb=0x4
+               };
+               
+               
+               enum v2Sys_t{kLoV2Sys=-1, kNoV2Sys=0, kUpV2Sys=+1};
+       
+               AliGenEMlib() { } ;
+
+               static void SelectParams( Int_t collisionSystem,
+                                                                 Int_t ptSelectPi0, 
+                                                                 Int_t ptSelectEta, 
+                                                                 Int_t ptSelectOmega,
+                                                                 Int_t ptSelectPhi, 
+                                                             Int_t centSelect=kpp, 
+                                                             Int_t v2sys=kNoV2Sys) {   
+                       fgSelectedCollisionsSystem = collisionSystem;
+                       fgSelectedPtParamPi0=ptSelectPi0; 
+                       fgSelectedPtParamEta=ptSelectEta; 
+                       fgSelectedPtParamOmega=ptSelectOmega; 
+                       fgSelectedPtParamPhi=ptSelectPhi; 
+                       fgSelectedCentrality=centSelect; 
+                       fgSelectedV2Systematic=v2sys; 
+                                                                         
+               }
+
+               GenFunc   GetPt(Int_t param, const char * tname=0) const;
+               GenFunc   GetY(Int_t param, const char * tname=0) const;
+               GenFuncIp GetIp(Int_t param, const char * tname=0) const;    
+               GenFunc   GetV2(Int_t param, const char * tname=0) const;
+
+       //private:
+
+       // General functions
+
+               // General functions
+               static Int_t fgSelectedCollisionsSystem; // selected pT parameter
+               static Int_t fgSelectedPtParamPi0; // selected pT parameter
+               static Int_t fgSelectedPtParamEta; // selected pT parameter
+               static Int_t fgSelectedPtParamOmega; // selected pT parameter
+               static Int_t fgSelectedPtParamPhi; // selected pT parameter
+               static Int_t fgSelectedCentrality; // selected Centrality
+               static Int_t fgSelectedV2Systematic; // selected v2 systematics, usefully values: -1,0,1
+
+
+               static Double_t PtModifiedHagedornThermal(Double_t pt, 
+                                                               Double_t c, 
+                                                               Double_t p0, 
+                                                               Double_t p1, 
+                                                               Double_t n,
+                                                               Double_t cT,
+                                                               Double_t T);
+
+
+               
+               static Double_t PtModifiedHagedornExp(Double_t pt,
+                                                       Double_t c,
+                                                       Double_t p0,
+                                                       Double_t p1,
+                                                       Double_t p2,
+                                                       Double_t n); 
+
+
+               static Double_t PtModifiedHagedornExp2(Double_t pt,
+                                                                                               Double_t c,
+                                                                                               Double_t a,
+                                                                                               Double_t b,
+                                                                                               Double_t p0,
+                                                                                               Double_t p1,
+                                                                                               Double_t d,
+                                                                                               Double_t n);
+
+
+               static Double_t PtTsallis(Double_t pt,
+                                               Double_t m,
+                                               Double_t c,
+                                               Double_t T,
+                                               Double_t n);
+
+               static Double_t PtParticleRatiopp(Double_t pt,
+                                                                               Double_t m1,
+                                                                               Double_t m2,
+                                                                               Double_t c1,
+                                                                               Double_t c2,
+                                                                               Double_t T1,
+                                                                               Double_t T2,
+                                                                               Double_t n);
+               
+               static Double_t PtXQCD( Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                               Double_t e,
+                                                               Double_t f);
+               
+               static Double_t PtModTsallis(   Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                           Double_t e,
+                                                               Double_t f,
+                                                               Double_t g,
+                                                               Double_t mass);
+               
+               static Double_t PtQCD(  Double_t pt,
+                                Double_t a,
+                                Double_t b,
+                                Double_t c,
+                                Double_t d,
+                                                           Double_t e);
+
+               static Double_t PtExponential(const Double_t *pt, const Double_t *param);
+               static Double_t PtModifiedHagedornPowerlaw(const Double_t *pt, const Double_t *param);
+               static Double_t PtDoublePowerlaw(const Double_t *pt, const Double_t *param);
+               static Double_t IntegratedKrollWada(const Double_t *mh, const Double_t *);
+
+               // direct gamma
+               static Double_t PtPromptRealGamma(const Double_t *px, const Double_t *dummy);
+               static Double_t PtPromptVirtGamma(const Double_t *px, const Double_t *dummy);
+               static Double_t PtThermalRealGamma(const Double_t *px, const Double_t *dummy);
+               static Double_t PtThermalVirtGamma(const Double_t *px, const Double_t *dummy);
+
+               static Int_t    IpDirectRealGamma(TRandom *ran);
+               static Double_t PtDirectRealGamma(const Double_t *px, const Double_t *dummy);
+               static Double_t YDirectRealGamma(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DirectRealGamma(const Double_t *px, const Double_t *dummy);
+
+               static Int_t    IpDirectVirtGamma(TRandom *ran);
+               static Double_t PtDirectVirtGamma(const Double_t *px, const Double_t *dummy);
+               static Double_t YDirectVirtGamma(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DirectVirtGamma(const Double_t *px, const Double_t *dummy);
+
+               // Pizero
+               static Int_t    IpPizero(TRandom *ran);
+               static Double_t PtPizero(const Double_t *px, const Double_t *dummy);
+               static Double_t YPizero(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Pizero(const Double_t *px, const Double_t *dummy);
+
+               // Eta
+               static Int_t    IpEta(TRandom *ran);
+               static Double_t PtEta(const Double_t *px, const Double_t *dummy);
+               static Double_t YEta(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Eta(const Double_t *px, const Double_t *dummy);
+
+               // Rho
+               static Int_t    IpRho0(TRandom *ran);
+               static Double_t PtRho0(const Double_t *px, const Double_t *dummy);
+               static Double_t YRho0(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Rho0(const Double_t *py, const Double_t *dummy);
+
+
+               // Omega
+               static Int_t    IpOmega(TRandom *ran);
+               static Double_t PtOmega(const Double_t *px, const Double_t *dummy);
+               static Double_t YOmega(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Omega(const Double_t *py, const Double_t *dummy);
+
+               // Etaprime
+               static Int_t    IpEtaprime(TRandom *ran);
+               static Double_t PtEtaprime(const Double_t *px, const Double_t *dummy);
+               static Double_t YEtaprime(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Etaprime(const Double_t *py, const Double_t *dummy);
+
+               // Phi
+               static Int_t    IpPhi(TRandom *ran);
+               static Double_t PtPhi(const Double_t *px, const Double_t *dummy);
+               static Double_t YPhi(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Phi(const Double_t *py, const Double_t *dummy);
+
+               // Jpsi
+               static Int_t    IpJpsi(TRandom *ran);
+               static Double_t PtJpsi(const Double_t *px, const Double_t *dummy);
+               static Double_t YJpsi(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Jpsi(const Double_t *py, const Double_t *dummy);
+
+               // Sigma
+               static Int_t    IpSigma(TRandom *ran);
+               static Double_t PtSigma( const Double_t *px, const Double_t *dummy );
+               static Double_t YSigma(const Double_t *py, const Double_t *dummy);
+               static Double_t V2Sigma0( const Double_t *px, const Double_t *dummy );
+               
+               // K0short
+               static Int_t    IpK0short(TRandom *ran);
+               static Double_t PtK0short( const Double_t *px, const Double_t *dummy );
+               static Double_t YK0short(const Double_t *py, const Double_t *dummy);
+               static Double_t V2K0sshort( const Double_t *px, const Double_t *dummy );
+
+               // Delta++
+               static Int_t    IpDeltaPlPl(TRandom *ran);
+               static Double_t PtDeltaPlPl( const Double_t *px, const Double_t *dummy );
+               static Double_t YDeltaPlPl(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DeltaPlPl( const Double_t *px, const Double_t *dummy );
+               
+               // Delta+
+               static Int_t    IpDeltaPl(TRandom *ran);
+               static Double_t PtDeltaPl( const Double_t *px, const Double_t *dummy );
+               static Double_t YDeltaPl(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DeltaPl( const Double_t *px, const Double_t *dummy );
+               
+               // Delta-
+               static Int_t    IpDeltaMi(TRandom *ran);
+               static Double_t PtDeltaMi( const Double_t *px, const Double_t *dummy );
+               static Double_t YDeltaMi(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DeltaMi( const Double_t *px, const Double_t *dummy );
+               
+               // Delta0
+               static Int_t    IpDeltaZero(TRandom *ran);
+               static Double_t PtDeltaZero( const Double_t *px, const Double_t *dummy );
+               static Double_t YDeltaZero(const Double_t *py, const Double_t *dummy);
+               static Double_t V2DeltaZero( const Double_t *px, const Double_t *dummy );
+
+               // Rho+
+               static Int_t    IpRhoPl(TRandom *ran);
+               static Double_t PtRhoPl( const Double_t *px, const Double_t *dummy );
+               static Double_t YRhoPl(const Double_t *py, const Double_t *dummy);
+               static Double_t V2RhoPl( const Double_t *px, const Double_t *dummy );
+
+               // Rho-
+               static Int_t    IpRhoMi(TRandom *ran);
+               static Double_t PtRhoMi( const Double_t *px, const Double_t *dummy );
+               static Double_t YRhoMi(const Double_t *py, const Double_t *dummy);
+               static Double_t V2RhoMi( const Double_t *px, const Double_t *dummy );
+
+               // K0*
+               static Int_t    IpK0star(TRandom *ran);
+               static Double_t PtK0star( const Double_t *px, const Double_t *dummy );
+               static Double_t YK0star(const Double_t *py, const Double_t *dummy);
+               static Double_t V2K0star( const Double_t *px, const Double_t *dummy );
+               
+
+               // General
+               //static Double_t PtFlat(const Double_t *px, const Double_t *dummy);
+                       static Double_t YFlat(Double_t y);
+               static Double_t MtScal(Double_t pt, Int_t np);
+               static Double_t V2Param(const Double_t *px, const Double_t *param);
+               static Double_t V2Flat(const Double_t *px, const Double_t *param);
+               static Double_t KEtScal(Double_t pt, Int_t np);
+               static Double_t GetTAA(Int_t cent);
+
+               static Double_t CrossOverLc(double a, double b, double x);
+               static Double_t CrossOverRc(double a, double b, double x);
+
+               static const Double_t fgkPtParam[kCentralities][10];                                    // parameters of pi pt spectrum
+               static const Double_t fgkModTsallisParamPi0PbPb[kCentralities][7];                      // parameters for ModTsallis function for pi0 in PbPb 
+               static const Double_t fgkModTsallisParamPiChargedPbPb[kCentralities][7];        // parameters for ModTsallis function for pi+- in PbPb 
+               static const Double_t fgkV2param[kCentralities][16];                                    // parameters of pi v2
+               static const Double_t fgkRawPtOfV2Param[kCentralities][10];                             // parameters of the raw pt spectrum of v2 analysys
+               static const Double_t fgkThermPtParam[kCentralities][2];                                        // parameters of thermal gamma pt
+               static const Double_t fgkHM[16];                                                                                        // particle masses
+               static const Double_t fgkMtFactor[3][16];                                                                       // mt scaling factor
+               static const Double_t fgkParamSetPi07TeV[kNPi0Param][7];                                        // parameters for pi0 in 7 TeV
+               static const Double_t fgkParamSetPi02760GeV[kNPi0Param][7];                                     // parameters for pi0 in 2.76 TeV
+               static const Double_t fgkParamSetPi0900GeV[kNPi0Param][7];                                      // parameters for pi0 in 0.9 TeV
+
+               ClassDef(AliGenEMlib,1)
+
 };
 
 
index b6e822ad2a3ea2745c4d22fb0f8a83852adb6f09..55fc8dda2751b5e8b49cf3d04513c7d39b132e52 100644 (file)
@@ -2,105 +2,113 @@ void fastGenEMCocktail(Int_t nev = 1, char* filename = "galice.root")
 {
 // load libraries
 
-  gSystem->Load("liblhapdf.so");      // Parton density functions
-  gSystem->Load("libpythia6.so");     // Pythia
-  gSystem->Load("libEG");
-  gSystem->Load("libEGPythia6");
-  gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
-
-// Runloader
-    
-  AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
-    
-  rl->SetCompressionLevel(2);
-  rl->SetNumberOfEventsPerFile(nev);
-  rl->LoadKinematics("RECREATE");
-  rl->MakeTree("E");
-  gAlice->SetRunLoader(rl);
-
-// Create stack
-  rl->MakeStack();
-  AliStack* stack      = rl->Stack();
-// Header
-  AliHeader* header = rl->GetHeader();
-
-// Create and Initialize Generator
-
-  AliGenEMCocktail *gener = new AliGenEMCocktail();
-
-//=======================================================================
-// Set External decayer
-  TVirtualMCDecayer *decayer = new AliDecayerPythia();
-
-  gener->SetNPart(1000);               // source multiplicity per event
-  gener->SetPtRange(0.,20.);
-  gener->SetYRange(-1.,1.);
-  gener->SetPhiRange(0., 360.);
-  gener->SetOrigin(0.,0.,0.); 
-  gener->SetSigma(0.,0.,0.);
-  gener->SetVertexSmear(kPerEvent);
-  gener->SetTrackingFlag(0);
-  gener->SetDecayMode(kElectronEM);    // select cocktail:
-                                       // kElectronEM   => single electron
-                                       // kDiElectronEM => electron-positron
-                                       // kGammaEM      => single photon
-  gener->SetDecayer(decayer);
-  gener->SetWeightingMode(kNonAnalog); // select weighting:
-                                       // kNonAnalog => weight ~ dN/dp_T
-                                       // kAnalog    => weight ~ 1
-  gener->CreateCocktail();
-  gener->Init();
-  gener->SetStack(stack);
-
-//
-//                        Event Loop
-//
-  Int_t iev;
-     
-  for (iev = 0; iev < nev; iev++) {
-
-    printf("\n \n Event number %d \n \n", iev);
+       gSystem->Load("liblhapdf.so");      // Parton density functions
+       gSystem->Load("libpythia6.so");     // Pythia
+       gSystem->Load("libEG");
+       gSystem->Load("libEGPythia6");
+       gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
+
+       // Runloader
+               
+       AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
+               
+       rl->SetCompressionLevel(2);
+       rl->SetNumberOfEventsPerFile(nev);
+       rl->LoadKinematics("RECREATE");
+       rl->MakeTree("E");
+       gAlice->SetRunLoader(rl);
+
+       // Create stack
+       rl->MakeStack();
+       AliStack* stack      = rl->Stack();
        
-// Initialize event
-    header->Reset(0,iev);
-    rl->SetEventNumber(iev);
-    stack->Reset();
-    rl->MakeTree("K");
-//  stack->ConnectTree();
-    
-// Generate event
-    gener->Generate();
-// Analysis
-    Int_t npart = stack->GetNprimary();
-    printf("Analyse %d Particles\n", npart);
-    for (Int_t part=0; part<npart; part++) {
-      TParticle *MPart = stack->Particle(part);
-      Int_t mpart  = MPart->GetPdgCode();
-//      printf("Particle %d\n", mpart);
-    }
-       
-// Finish event
-    header->SetNprimary(stack->GetNprimary());
-    header->SetNtrack(stack->GetNtrack());  
-
-// I/O
-//     
-    stack->FinishEvent();
-    header->SetStack(stack);
-    rl->TreeE()->Fill();
-    rl->WriteKinematics("OVERWRITE");
-
-  } // event loop
-
-//
-//                         Termination
-// Generator
-  gener->FinishRun();
-// Write file
-  rl->WriteHeader("OVERWRITE");
-  gener->Write();
-  rl->Write();
+       // Header
+       AliHeader* header = rl->GetHeader();
+
+       // Create and Initialize Generator
+
+       AliGenEMCocktail *gener = new AliGenEMCocktail();
+
+       //=======================================================================
+       // Set External decayer
+       TVirtualMCDecayer *decayer = new AliDecayerPythia();
+
+       gener->SetNPart(1000);               // source multiplicity per event
+       gener->SetPtRange(0.,20.);
+       gener->SetYRange(-1.,1.);
+       gener->SetPhiRange(0., 360.);
+       gener->SetOrigin(0.,0.,0.); 
+       gener->SetSigma(0.,0.,0.);
+       gener->SetVertexSmear(kPerEvent);
+       gener->SetTrackingFlag(0);
+       gener->SelectMotherParticles(62591);
+       gener->SetPtParamPi0(0);
+       gener->SetPtParamEta(3);
+       gener->SetPtParamOmega(3);
+       gener->SetPtParamPhi(0);
+       gener->SetCollisionSystem(2);                   //pp 7 TeV
+       gener->SetCentrality(0);                                // kpp
+
+       gener->SetDecayMode(kGammaEM);                  // select cocktail:
+                                                                                       // kElectronEM   => single electron
+                                                                                       // kDiElectronEM => electron-positron
+                                                                                       // kGammaEM      => single photon
+       gener->SetDecayer(decayer);
+       gener->SetWeightingMode(kNonAnalog);    // select weighting:
+                                                                                       // kNonAnalog => weight ~ dN/dp_T
+                                                                                       // kAnalog    => weight ~ 1
+       gener->CreateCocktail();
+       gener->Init();
+       gener->SetStack(stack);
+
+       //
+       //                        Event Loop
+       //
+       Int_t iev;
+               
+       for (iev = 0; iev < nev; iev++) {
+
+               printf("\n \n Event number %d \n \n", iev);
+               
+               // Initialize event
+               header->Reset(0,iev);
+               rl->SetEventNumber(iev);
+               stack->Reset();
+               rl->MakeTree("K");
+               //  stack->ConnectTree();
+               
+               // Generate event
+               gener->Generate();
+               // Analysis
+               Int_t npart = stack->GetNprimary();
+               printf("Analyse %d Particles\n", npart);
+               for (Int_t part=0; part<npart; part++) {
+               TParticle *MPart = stack->Particle(part);
+               Int_t mpart  = MPart->GetPdgCode();
+               //      printf("Particle %d\n", mpart);
+               }
+               
+               // Finish event
+               header->SetNprimary(stack->GetNprimary());
+               header->SetNtrack(stack->GetNtrack());  
+
+               // I/O
+               //      
+               stack->FinishEvent();
+               header->SetStack(stack);
+               rl->TreeE()->Fill();
+               rl->WriteKinematics("OVERWRITE");
+
+       } // event loop
+
+       //
+       //                         Termination
+       // Generator
+       gener->FinishRun();
+       // Write file
+       rl->WriteHeader("OVERWRITE");
+       gener->Write();
+       rl->Write();
 }
 
 
index 1b525b344139020436cb88771b7627404db23f34..b2eceef297eaa08646ca026c5d158534277bc8f8 100644 (file)
@@ -183,7 +183,7 @@ class AliHLTTPCHWClusterMerger : public AliHLTLogging
     }
     ~iterator() {}
 
-    AliClusterRecord operator*() {return *fIter;}
+    AliClusterRecord& operator*() {return *fIter;}
 
     // prefix operators
     iterator& operator++() {
index d0dbb21b5943910c990bf5d25451657cf0c6021c..7fb7b96f3e8fba105f5b51fb862b0a9dba16073f 100644 (file)
@@ -16,6 +16,19 @@ ClassImp(AliITSURecoDet)
 
 const Char_t* AliITSURecoDet::fgkBeamPipeVolName = "IP_PIPE";
 
+//______________________________________________________
+AliITSURecoDet::AliITSURecoDet()
+:  fNLayers(0)
+  ,fNLayersActive(0)
+  ,fRMax(-1)
+  ,fRMin(-1)
+  ,fRITSTPCRef(-1)
+  ,fLayers(0)
+  ,fLayersActive(0)
+  ,fGeom(0)
+{
+  // def. c-tor
+}
 
 //______________________________________________________
 AliITSURecoDet::AliITSURecoDet(AliITSUGeomTGeo* geom, const char* name)
index 4a1b980d874408311ff995f4c8dcd3c96f132469..0d2808e31c87d01f418b573bada7d8f5382deb42 100644 (file)
@@ -19,6 +19,7 @@ class AliITSURecoDet : public TNamed
 {
  public:
   //
+  AliITSURecoDet();
   AliITSURecoDet(AliITSUGeomTGeo* geom, const char* name="");
   virtual ~AliITSURecoDet();
   //
index 3a8bc7e3ff67012b3fdade2751e29f6450b177bb..992f3e9c4f97e1a42b3e3f6e1bd150233dad666b 100644 (file)
@@ -28,7 +28,7 @@ class AliITSURecoLayer : public TNamed
   enum {kPassive=BIT(14)                 // layer is passive
        ,kOwnsClusterArray=BIT(15)       // owner of cluster array, delete in destructor
   };
-  AliITSURecoLayer(const char* name);
+  AliITSURecoLayer(const char* name=0);
   AliITSURecoLayer(const char* name, Int_t activeID,AliITSUGeomTGeo* gm);
   virtual ~AliITSURecoLayer();
   //
index 1065cc5c399f9f2a7c296a3b122e59e8b5b9f474..036b359a6414280fea4ba8c2a5eba8689c3f454d 100644 (file)
@@ -17,7 +17,7 @@ class AliITSURecoSens : public TObject
   //
   enum {kLeft=BIT(1),kRight=BIT(2),kUp=BIT(3),kDown=BIT(4)};
   //
-  AliITSURecoSens(Int_t id);
+  AliITSURecoSens(Int_t id=0);
   AliITSURecoSens(const AliITSURecoSens &source); 
   virtual ~AliITSURecoSens() {}
   AliITSURecoSens& operator=(const AliITSURecoSens &source); 
index 2745f0eb49a0a9c46c22cdbdb8ec6a10e6612893..d0dc393f75930bd7ec16d880983d16cd0cc933ea 100644 (file)
@@ -214,8 +214,8 @@ AliVertexer* AliITSUReconstructor::CreateVertexer() const
   // create a ITS vertexer
   // 
   AliInfo("Creating vertexer using tracklets with the first 3 ITS layers");
-  //  AliDebug(1,"ITSU vertexer should be initiated here\n");
-  if (GetRecoParam()->GetEventSpecie() == AliRecoParam::kHighMult) {
+
+  if (GetRecoParam()->GetEventSpecie() & AliRecoParam::kHighMult) {
     return new AliITSUVertexer();
   } else {
     return new AliITSUVertexer(0.05,0.003,0.04,0.8,3);
index ca710f2216bb4fa9da9a888c12efccbe09189561..b9516247be01ebc6de782acb74cb6d8905f85561 100644 (file)
@@ -33,6 +33,7 @@ set ( HDRS  AliStructFuncType.h)
 
 set ( DHDR lhapdfLinkDef.h)
 
+set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
 set ( EINCLUDE  LHAPDF/lhapdf5.5.1 LHAPDF/lhapdf5.5.1/include LHAPDF/lhapdf5.5.1/src)
 
 set ( CSRCS  lhapdf5.5.1/src/binreloc.c )
index 21624f2f741e2d9aec842f21e662cf2c66856ee8..b4e753763b81a3b77728852ee93f0231acb2f926 100644 (file)
@@ -33,6 +33,8 @@ set ( HDRS  AliStructFuncType.h)
 
 set ( DHDR lhapdfLinkDef.h)
 
+
+set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
 set ( EINCLUDE  LHAPDF/lhapdf-5.9.1 LHAPDF/lhapdf-5.9.1/include  LHAPDF/lhapdf-5.9.1/src)
 
 set ( CSRCS  lhapdf-5.9.1/src/binreloc.c )
index f6b10791016ebac983caeaad35a83ee8cb7eaf9a..0a6c54f03c5eb8e8c3279cec87c9640f1d64a344 100755 (executable)
@@ -197,30 +197,38 @@ void AliAnalysisTaskMFTExample::UserExec(Option_t *) {
       recMuon2 = aodEv->GetTrack(jTrack);
       
       AliAODDimuon *dimuon = new AliAODDimuon(recMuon1, recMuon2);
-      if (dimuon->Charge()) continue;
+      if (dimuon->Charge()) {
+       delete dimuon;
+       continue;
+      }
 
       // pt and mass all OS dimuons
       fHistPtDimuonsOS   -> Fill(dimuon->Pt());
       fHistMassDimuonsOS -> Fill(dimuon->Mass());
 
+      delete dimuon;
+
       // pt and mass J/psi dimuons
       if (!isMuon1FromJpsi) continue;
       if (recMuon2->GetLabel() >= 0) {
        mcMuon2 = (AliAODMCParticle*) stackMC->At(recMuon2->GetLabel());
        if (mcMuon2) {
          if (mcMuon2->GetMother() == mcMuon1->GetMother()) {
-           AliAODDimuon *dimuon = new AliAODDimuon;
-           dimuon->SetMuons(recMuon1,recMuon2);
+           AliAODDimuon *dimuonJpsi = new AliAODDimuon;
+           dimuonJpsi->SetMuons(recMuon1,recMuon2);
            Double_t pca[3]={0};
            Double_t pcaQuality=0;
            TLorentzVector kinem(0,0,0,0);
-           if (!AliMFTAnalysisTools::CalculatePCA(dimuon, pca, pcaQuality, kinem)) continue;
+           if (!AliMFTAnalysisTools::CalculatePCA(dimuonJpsi, pca, pcaQuality, kinem)) {
+             delete dimuonJpsi;
+             continue;
+           }
            fHistPtDimuonsJpsi    -> Fill(kinem.Pt());
            fHistMassDimuonsJpsi  -> Fill(kinem.M());
            fHistResidualXVtxJpsi -> Fill(1.e4*(pca[0] - fPrimaryVertex[0]));
            fHistResidualYVtxJpsi -> Fill(1.e4*(pca[1] - fPrimaryVertex[1]));
            fHistResidualZVtxJpsi -> Fill(1.e4*(pca[2] - fPrimaryVertex[2]));
-           delete dimuon;
+           delete dimuonJpsi;
          }
        }
       }
index 815d929646b824352038d6e662c6e07c4b17eed3..d65930879fbd6c4891ae717ab87adfde716e9cb2 100644 (file)
@@ -137,8 +137,6 @@ Bool_t AliMFTAnalysisTools::ExtrapAODMuonToXY(AliAODTrack *muon, Double_t xy[2],
 
   // We look for the above-defined PCA
 
-  Double_t xPCA=0, yPCA=0, zPCA=0;
-
   AliMUONTrackParam *param = new AliMUONTrackParam();
   param -> SetNonBendingCoor(muon->XAtDCA());
   param -> SetBendingCoor(muon->YAtDCA());
@@ -675,3 +673,80 @@ const TMatrixD AliMFTAnalysisTools::ConvertCovMatrixAOD2MUON(AliAODTrack *muon)
 
 //====================================================================================================================================================
 
+Bool_t AliMFTAnalysisTools::IsCorrectMatch(AliAODTrack *muon) {
+
+  for (Int_t iPlane=0; iPlane<AliMFTConstants::fNMaxPlanes; iPlane++) if (IsWrongCluster(muon, iPlane)) return kFALSE;
+  return kTRUE;
+
+}
+
+//====================================================================================================================================================
+
+TString AliMFTAnalysisTools::GetGenerator(Int_t label, AliAODMCHeader* header) {
+
+  // get the name of the generator that produced a given particle
+
+  Int_t partCounter = 0;
+  TList *genHeaders = header->GetCocktailHeaders();
+  Int_t nGenHeaders = genHeaders->GetEntries();
+
+  for (Int_t i=0; i<nGenHeaders; i++){
+    AliGenEventHeader *gh = (AliGenEventHeader*) genHeaders->At(i);
+    TString genName = gh->GetName();
+    Int_t nPart = gh->NProduced();
+    if (label>=partCounter && label<(partCounter+nPart)) return genName;
+    partCounter += nPart;
+  }
+
+  TString empty="";
+  return empty;
+
+}
+
+//====================================================================================================================================================
+
+void AliMFTAnalysisTools::GetTrackPrimaryGenerator(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC, TString &nameGen) {
+
+  // method to check if a track comes from a given generator
+
+  Int_t label = TMath::Abs(track->GetLabel());
+  nameGen = GetGenerator(label,header);
+  
+  // In case the particle is not primary nameGen will contain blank spaces. In this case, we search backward for the primary which originated the chain
+  
+  while (nameGen.IsWhitespace()) {
+    AliAODMCParticle *mcPart = (AliAODMCParticle*) arrayMC->At(label);
+    if (!mcPart) {
+      printf("AliMFTAnalysisTools::GetTrackPrimaryGenerator - BREAK: No valid AliAODMCParticle at label %i\n",label);
+      break;
+    }
+    Int_t motherLabel = mcPart->GetMother();
+    if (motherLabel < 0) {
+      printf("AliMFTAnalysisTools::GetTrackPrimaryGenerator - BREAK: Reached primary particle without valid mother\n");
+      break;
+    }
+    label = motherLabel;
+    nameGen = GetGenerator(label,header);
+  }
+  
+  return;
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMFTAnalysisTools::IsTrackInjected(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC){
+
+  // method to check if a track comes from the signal event or from the underlying Hijing event
+
+  TString nameGen;
+
+  GetTrackPrimaryGenerator(track,header,arrayMC,nameGen);
+  
+  if (nameGen.IsWhitespace() || nameGen.Contains("ijing")) return kFALSE;
+  
+  return kTRUE;
+}
+
+//====================================================================================================================================================
+
index b51a633956e3566cf97f920567f9d9bc521915db..e6e0a7f7c2ef0f7737088b905152f1d6ebc2a47f 100644 (file)
@@ -22,6 +22,9 @@
 #include "AliLog.h"
 #include "TMatrixD.h"
 #include "TClonesArray.h"
+#include "AliAODMCHeader.h"
+#include "AliGenEventHeader.h"
+#include "AliAODMCParticle.h"
 
 //====================================================================================================================================================
 
@@ -58,6 +61,12 @@ public:
     else return !(muon->GetMFTClusterPattern() & (1<<(iPlane+AliMFTConstants::fNMaxPlanes)));
   }
 
+  static Bool_t IsCorrectMatch(AliAODTrack *muon);
+
+  static TString GetGenerator(Int_t label, AliAODMCHeader* header);
+  static void GetTrackPrimaryGenerator(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC, TString &nameGen);
+  static Bool_t IsTrackInjected(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC);
+
   static void ConvertCovMatrixMUON2AOD(const TMatrixD& covMUON, Double_t covAOD[21]);
   static const TMatrixD ConvertCovMatrixAOD2MUON(AliAODTrack *muon);
   
index bad7caa944dbab6b194bbd0cdd9e5d3afd250bd9..9a5dbd94f93548b5920428a8340bb08832f8032a 100644 (file)
@@ -683,7 +683,7 @@ void AliMFTPlane::DrawPlane(Option_t *opt) {
     cnv->Draw();
 
     TH2D *h = new TH2D("tmp", GetName(), 
-                      1, fZCenter-0.5, fZCenter+0.5, 
+                      1, fZCenter-1.1*(0.5*fThicknessSupport+fThicknessActive), fZCenter+1.1*(0.5*fThicknessSupport+fThicknessActive),
                       1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     h->SetXTitle("z [cm]");
     h->SetYTitle("y [cm]");
index 004470e1366c89f15dc429a630c9d4029413ad28..aacf388279f099e09a0c59078e27858a8604e5e0 100644 (file)
@@ -24,7 +24,7 @@ if(DIMDIR)
   set ( ELIBS  dim)
   set ( ELIBSDIR  ${DIMDIR}/${ODIR})
   if(ELIBSDIR STREQUAL "${DIMDIR}/")
-    Aset (ELIBSDIR ${DIMDIR}/linux)
+    set (ELIBSDIR ${DIMDIR}/linux)
   endif(ELIBSDIR STREQUAL "${DIMDIR}/")
 
   set ( CXXFLAGS  "-DALI_DIM ${CXXFLAGS}")
index 723079a0d18037466dd3e94adf10de032c3151da..00beb175bb7d790361fe05c09490106e6ea136b8 100644 (file)
@@ -25,6 +25,8 @@
 #include "AliEventServer.h"
 #include "AliEventServerReconstruction.h"
 
+#include <dic.hxx>
+
 ClassImp(AliEventServer)
 
 using namespace std;
@@ -40,6 +42,23 @@ AliEventServer::AliEventServer() :
        }
        FillRunsFromDatabase();
        InitDIMListeners();
+
+       DimCurrentInfo SORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_1",-1); 
+       DimCurrentInfo EORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_1",-1);
+
+       int currentSOR=-1,currentEOR=-1;
+
+       if(SORrunNumber.getData() && EORrunNumber.getData())
+         {
+           currentSOR = SORrunNumber.getInt();
+           currentEOR = EORrunNumber.getInt();
+
+           cout<<"RECO Server -- current SOR signal:"<<currentSOR<<endl;
+           cout<<"RECO Server -- current EOR signal:"<<currentEOR<<endl;
+         }
+       else{cout<<"RECO Server -- no data received from dim server"<<endl;}
+
+       if(currentSOR != currentEOR){StartOfRun(currentSOR);}
 }
 
 AliEventServer::~AliEventServer()
@@ -134,7 +153,7 @@ void AliEventServer::FillRunsFromDatabase()
        TSQLServer* server = TSQLServer::Connect(connStr.Data(), user.Data(), password.Data());
        if (!server)
        {
-         cout<<"ERROR: Could not connect to DAQ Logbook"<<endl;
+         cout<<"AliEventServer -- ERROR: Could not connect to DAQ Logbook"<<endl;
                return;
        }
        TString sqlQuery;
index 8bc8d7bcd57db6e07a9eaf84afc7050f8ef857e5..e2d09ec94b36a0311d3566f9bb6db19a0d56327a 100644 (file)
@@ -52,7 +52,7 @@ AliEventServerReconstruction::AliEventServerReconstruction()
 AliEventServerReconstruction::~AliEventServerReconstruction()
 {
        Close();
-       if(fSettings){delete fSettings;fSettings=0;}
+       //if(fSettings!=0){/*delete fSettings;*/fSettings=0;}
        if(fAliReco){delete fAliReco;fAliReco=0;}
 }
 
@@ -72,10 +72,12 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        fCurrentRunId = run;
 
        // re-read settings
-       if(fSettings){delete fSettings;fSettings=0;}
-       fSettings = new TEnv(AliEventServerUtil::GetPathToServerConf());
-       
-       TString recoBaseDir = fSettings->GetValue("server.saveRecoDir",DEFAULT_SERVER_SAVE_RECO_DIR);
+       //      if(fSettings){delete fSettings;fSettings=0;}
+       //fSettings = new TEnv(AliEventServerUtil::GetPathToServerConf());
+       fSettings.ReadFile(AliEventServerUtil::GetPathToServerConf(),kEnvUser);
+
+
+       TString recoBaseDir = fSettings.GetValue("server.saveRecoDir",DEFAULT_SERVER_SAVE_RECO_DIR);
        
        // Create directories and logfile
        TString logFile = Form("%s/log/run%d.log",recoBaseDir.Data(),run);
@@ -98,7 +100,7 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        cout<<"Setup reco will be called"<<endl;
        SetupReco(input);
        
-       fHost = (const char*)Form("%s:%d", fSettings->GetValue("server.host", DEFAULT_SERVER_HOST), fSettings->GetValue("server.port", DEFAULT_SERVER_PORT));
+       fHost = (const char*)Form("%s:%d", fSettings.GetValue("server.host", DEFAULT_SERVER_HOST), fSettings.GetValue("server.port", DEFAULT_SERVER_PORT));
        
        cout<<"Creating new thread"<<endl;
        fRecoThread = new TThread("AliEventServerReconstruction",Dispatch, (void*)this);
@@ -171,8 +173,11 @@ void AliEventServerReconstruction::ReconstructionHandle()
        while (fAliReco->HasNextEventAfter(iEvent))
        {
                // check if process has enough resources 
+         cout<<"Event server -- checking resources"<<endl;
                if (!fAliReco->HasEnoughResources(iEvent)) break;
+               cout<<"Event server -- resources checked"<<endl;
                Bool_t status = fAliReco->ProcessEvent(iEvent);
+               cout<<"Event server -- event processed"<<endl;
       
                if (status)
                {
@@ -181,13 +186,16 @@ void AliEventServerReconstruction::ReconstructionHandle()
                        eventManager->Send(event,EVENTS_SERVER_PUB);
                        cout<<"Event server -- sending event as xml"<<endl;
                        eventManager->SendAsXml(event,XML_PUB);
+                       cout<<"Event server -- xml sent"<<endl;
                }
                else
                {
+                 cout<<"Event server -- aborting"<<endl;
                        fAliReco->Abort("ProcessEvent",TSelector::kAbortFile);
                }
-               
+               cout<<"Event server -- cleaning event"<<endl;
                fAliReco->CleanProcessedEvent();
+               cout<<"Event server -- event cleaned"<<endl;
                iEvent++;
        }
        StopReconstruction();
@@ -195,14 +203,14 @@ void AliEventServerReconstruction::ReconstructionHandle()
 
 Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
 {
-       if(!fSettings) return (-1);
+  //if(fSettings==0) return (-1);
 
        // Retrieve GRP entry for given run from aldaqdb.
-       TString dbHost = fSettings->GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
-       Int_t dbPort =  fSettings->GetValue("logbook.port", DEFAULT_LOGBOOK_PORT);
-       TString dbName =  fSettings->GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
-       TString user =  fSettings->GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
-       TString password = fSettings->GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
+       TString dbHost = fSettings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
+       Int_t dbPort =  fSettings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT);
+       TString dbName =  fSettings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
+       TString user =  fSettings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
+       TString password = fSettings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
        
        Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, dbHost.Data(),
                                                                  dbPort, dbName.Data(),
@@ -218,7 +226,7 @@ Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
 
 void AliEventServerReconstruction::SetupReco(const char* input)
 {
-       if(!fSettings) return;
+  //if(fSettings==0) return;
 
        //AliTPCRecoParam::SetUseTimeCalibration(kFALSE); //-- !probably should be set from conf file!
 
@@ -227,15 +235,15 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        /* Settings CDB */
        fCDBmanager = AliCDBManager::Instance();
   
-       fCDBmanager->SetDefaultStorage(fSettings->GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
-       fCDBmanager->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1),  
-                                   fSettings->GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1));
+       fCDBmanager->SetDefaultStorage(fSettings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1),  
+                                   fSettings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1));
 
-       fCDBmanager->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),  
-                                   fSettings->GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),  
+                                   fSettings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
   
-       fCDBmanager->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
-                                   fSettings->GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
+                                   fSettings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
   
        /* Reconstruction settings */  
        if(!fAliReco)fAliReco = new AliReconstruction();
@@ -243,7 +251,7 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        // QA options
        //rec->SetRunQA(fSettings->GetValue( "qa.runDetectors", DEFAULT_QA_RUN));
        //rec->SetRunGlobalQA(fSettings->GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL));
-       fAliReco->SetQARefDefaultStorage(fSettings->GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
+       fAliReco->SetQARefDefaultStorage(fSettings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
        //rec->SetRunPlaneEff(fSettings->GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF));
 
        fAliReco->SetRunQA(":");
@@ -251,14 +259,14 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        fAliReco->SetRunPlaneEff(false);
 
        // AliReconstruction settings
-       fAliReco->SetWriteESDfriend(fSettings->GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF));
-       fAliReco->SetWriteAlignmentData(fSettings->GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN));
+       fAliReco->SetWriteESDfriend(fSettings.GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF));
+       fAliReco->SetWriteAlignmentData(fSettings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN));
        fAliReco->SetInput(input); // reconstruct data from this input
-       fAliReco->SetRunReconstruction(fSettings->GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS));
+       fAliReco->SetRunReconstruction(fSettings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS));
        fAliReco->SetUseTrackingErrorsForAlignment("ITS"); //-- !should be set from conf file!
 
        // switch off cleanESD
-       fAliReco->SetCleanESD(fSettings->GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
+       fAliReco->SetCleanESD(fSettings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
 
        // init reco for given run
        fAliReco->InitRun(input);
index e8bc44f35cdf40afb26cab720543097706375e2a..a9fea2685d674f24af1a59279c7b882281a24980 100644 (file)
@@ -13,7 +13,7 @@
 #include <TQObject.h>
 #include <RQ_OBJECT.h>
 #include <TThread.h>
-
+#include <TEnv.h>
 class TEnv;
 class AliCDBManager;
 class AliReconstruction;
@@ -45,7 +45,7 @@ private:
        AliCDBManager *fCDBmanager;
        Int_t fCurrentRunId;
        Bool_t fIsListenning;
-       TEnv *fSettings;
+       TEnv fSettings;
        TString fHost;
        TThread *fRecoThread;
        bool fRecoIsRunning;
index 753e5f7fc3b4e3e6f9a6a522526e3f3623e12032..c66ebd68e960c1756a496817e578349df7982dfa 100644 (file)
@@ -1,7 +1,7 @@
 server.host:                             tcp://*
 server.port:                             5024
 server.saveRecoDir:                      /local/reco
-cdb.defaultStorage:                      local:///local/OCDB/2013
+cdb.defaultStorage:                      local:///local/cdb
 cdb.specificStoragePath1:                local:///local/reco/GRP/GRP/Data
 cdb.specificStorageValue1:               
 cdb.specificStoragePath2:                local:///local/reco/GRP/CTP/Config
diff --git a/MONITOR/alistoragemanager/setupStorageDatabase.sh b/MONITOR/alistoragemanager/setupStorageDatabase.sh
deleted file mode 100755 (executable)
index 29f110e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-HOST="localhost"   # IP of machine on which mysql database is located
-PORT="5055"
-DATABASE="storage"
-USER="storage"
-PASS="storage123"
-TABLE="events"
-STORAGE_PATH="/Users/Jerus/storedFiles"
-MAX_SIZE="30000000"
-MAX_OCCUPATION="80"
-REMOVE_PERCENT="60"
-EVENTS_IN_FILE="5"
-EVENT_SERVER="pcald39fix"   # IP of machine running alieventserver
-EVENT_SERVER_PORT="5024"
-STORAGE_SERVER="localhost"      # IP of machine running alistorage
-STORAGE_SERVER_PORT="5066"      # server thread communication port
-STORAGE_CLIENT_PORT="5088"      # client thread communication port
-XML_SERVER_PORT="5099"          # server of xml files
-mysql -u root -pdaq -e "create database if not exists $DATABASE;"
-mysql -u root -pdaq -e "grant ALL PRIVILEGES on $DATABASE.* to '$USER'@'$HOST' identified by '$PASS';"
-mysql -u root -pdaq -e "use $DATABASE;"
-mysql -u root -pdaq -e "CREATE TABLE IF NOT EXISTS $DATABASE.$TABLE(\
-run_number int(6) NOT NULL,\
-event_number int(6) NOT NULL,\
-system text(7) DEFAULT NULL,\
-multiplicity int(5) DEFAULT NULL,\
-permanent tinyint(1) DEFAULT NULL,\
-file_path text(100) DEFAULT NULL,\
-PRIMARY KEY(run_number,event_number));"
-
-echo "-----------------------------"
-echo "Databases successfuly created"
-echo "-----------------------------"
\ No newline at end of file
index a682e920e3856488d2e8cd30f547a297686803ab..84d4e6343244e8aea8bbc335c14357fc95d139f0 100644 (file)
@@ -18,6 +18,6 @@ set ( EXPORT ${HDRS})
 set ( EINCLUDE ANALYSIS  STEER/STEERBase)
 
 # Install data to destination 
-install (DIRECTORY COMMON PWGPP PWGLF PWGJE PWGLF
+install (DIRECTORY COMMON EMCAL PHOS PWG PWGPP PWGLF PWGJE PWGLF
          DESTINATION OADB 
         PATTERN ".svn" EXCLUDE)
index 6b9642d65241479bad42152ed3986f52a73bb165..166367782f4ca47b735c9804c698e169f8c4bb7f 100644 (file)
Binary files a/OADB/COMMON/CENTRALITY/data/centrality.root and b/OADB/COMMON/CENTRALITY/data/centrality.root differ
index f4e41567e8252121af481793993fefdb2769d74d..d13b601f8f626b7ce7e7e9a13410363c7c80dd05 100755 (executable)
@@ -37,7 +37,6 @@
 #include "AliVCaloCells.h" 
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
-#include "AliAnalysisManager.h"
 #include "AliAODPWG4Particle.h"
 
 ClassImp(AliAnaCaloTrackCorrBaseClass)
@@ -47,7 +46,7 @@ ClassImp(AliAnaCaloTrackCorrBaseClass)
 AliAnaCaloTrackCorrBaseClass::AliAnaCaloTrackCorrBaseClass() : 
 TObject(), 
 fDataMC(0),                   fDebug(0),
-fCalorimeter(""),
+fCalorimeter(-1),             fCalorimeterString(""),
 fCheckFidCut(0),              fCheckRealCaloAcc(0),
 fCheckCaloPID(0),             fRecalculateCaloPID(0), 
 fMinPt(0),                    fMaxPt(0),
@@ -93,26 +92,28 @@ void AliAnaCaloTrackCorrBaseClass::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 {
-      printf("AliAnaCaloTrackCorrBaseClass::AddAODParticle() - Cannot add an object of type < %s >, to the AOD TClonesArray \n",  
-             fOutputAODBranch->GetClass()->GetName());
-      abort();    
-    }
+  if(!fOutputAODBranch)
+  {
+    AliFatal("No AOD branch available!!!\n");
+    return; // coverity
   }
-  else {
-    printf(" AliAnaCaloTrackCorrBaseClass::AddAODParticle() - No AOD branch available!!!\n");
-    abort();
+  
+  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()));
   }
   
-}      
+}
 
 //__________________________________________________________________________________________
 Int_t AliAnaCaloTrackCorrBaseClass::CheckMixedEventVertex(Int_t caloLabel, Int_t trackLabel)
@@ -149,7 +150,7 @@ void AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches()
   //Recover ouput and input AOD pointers for each event in the maker
        
   //Delta AODs
-  if(fDebug > 3) printf("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data());
+  AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data()));
   
   //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
   AliAODHandler* aodHandler = 0x0;
@@ -163,46 +164,54 @@ void AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches()
     fOutputAODBranch =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fOutputAODName);
     fInputAODBranch  =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fInputAODName);     
   }
-  else if (aodHandler->GetExtensions()) { 
-    
+  else if (aodHandler->GetExtensions())
+  {
     AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName()); 
-    if(ext){
+    if(ext)
+    {
       AliAODEvent *aodEvent = ext->GetAOD(); 
       if(fNewAOD)fOutputAODBranch = (TClonesArray*) aodEvent->FindListObject(fOutputAODName);
       fInputAODBranch = (TClonesArray*) aodEvent->FindListObject(fInputAODName);         
       if(!fOutputAODBranch && fNewAOD) fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
       if(!fInputAODBranch)  fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
     }
-    else{//If no Delta AODs, kept in standard branch, to revise. 
-      if(fNewAOD && fReader->GetOutputEvent()) {
+    else
+    { // If no Delta AODs, kept in standard branch, to revise.
+      if(fNewAOD && fReader->GetOutputEvent())
+      {
         fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
         fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName); 
       }
-      else {
+      else
+      {
         fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);  
         if(!fInputAODBranch && fReader->GetOutputEvent() ) 
           fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
       }
     }
   }
-  else{ //If no Delta AODs, kept in standard branch
-    if(fNewAOD && fReader->GetOutputEvent()) {
+  else
+  { // If no Delta AODs, kept in standard branch
+    if(fNewAOD && fReader->GetOutputEvent())
+    {
       fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
       fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);   
     }
-    else{ 
+    else
+    {
       fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
       if(!fInputAODBranch && fReader->GetOutputEvent())  
         fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
     }
   }
   
-  if(GetDebug() > 1){
-    if(fNewAOD && !fOutputAODBranch) 
-      printf(" AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Output Branch <%s>, not found!\n",fOutputAODName.Data());
-    if(!fNewAOD && !fInputAODBranch) 
-      printf(" AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Input Branch  <%s>, not found!\n",fInputAODName.Data());
-  }
+//  if(GetDebug() > 1)
+//  {
+//    if(fNewAOD && !fOutputAODBranch) 
+//      AliInfo(Form("Output Branch <%s>, not found!\n",fOutputAODName.Data()));
+//    if(!fNewAOD && !fInputAODBranch) 
+//      AliInfo(Form("Input Branch  <%s>, not found!\n",fInputAODName.Data()));
+//  }
 }
 
 //_____________________________________________________________________________________
@@ -235,7 +244,8 @@ TClonesArray * AliAnaCaloTrackCorrBaseClass::GetAODBranch(const TString & aodNam
        //Recover ouput and input AOD pointers for each event in the maker
        
        //Delta AODs
-       if(fDebug > 3) printf("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data());
+  
+       AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data()));
        
   //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
   AliAODHandler* aodHandler = 0x0;
@@ -345,7 +355,8 @@ TString  AliAnaCaloTrackCorrBaseClass::GetBaseParametersList()
   parList+=onePar ;
   snprintf(onePar,buffersize,"fInputAODName  =%s Input AOD name \n",fInputAODName.Data()) ;
   parList+=onePar ;    
-  if(fNewAOD){
+  if(fNewAOD)
+  {
     snprintf(onePar,buffersize,"fOutputAODName  =%s Output AOD name \n",fOutputAODName.Data()) ;
     parList+=onePar ;  
     snprintf(onePar,buffersize,"fOutputAODClassName  =%s Output AOD class name \n",fOutputAODClassName.Data()) ;
@@ -365,8 +376,8 @@ TClonesArray * AliAnaCaloTrackCorrBaseClass::GetCreateOutputAODBranch()
 {
   //Create AOD branch filled in the analysis
   
-  printf("Create AOD branch of %s objects and with name < %s >\n",
-         fOutputAODClassName.Data(),fOutputAODName.Data()) ;
+  AliInfo(Form("Create AOD branch of %s objects and with name < %s >\n",
+          fOutputAODClassName.Data(),fOutputAODName.Data())) ;
   
   TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
   aodBranch->SetName(fOutputAODName);
@@ -425,7 +436,7 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetTrackMultiplicityBin() const
     if(trackMult >= fTrackMultBins[ibin] && trackMult < fTrackMultBins[ibin+1]) return ibin;
   }
   
-  printf("AliAnaCaloTrackCorrBaseClass::GetTrackMultiplicityBin() - Bin not found for track multiplicity %d\n",trackMult);
+  AliWarning(Form("Bin not found for track multiplicity %d",trackMult));
   
   return -1;
 }
@@ -453,7 +464,7 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetEventCentralityBin() const
       if(curCentrBin==GetNCentrBin())
       {
         curCentrBin = GetNCentrBin()-1;
-        printf("AliAnaCaloTrackCorrBaseClass::GetEventCentralityBin() - Centrality = %d, put it in last bin \n",GetEventCentrality());
+        AliDebug(1,Form("Centrality = %d, put it in last bin \n",GetEventCentrality()));
       }
     }
     else
@@ -462,9 +473,8 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetEventCentralityBin() const
       if(curCentrBin==GetNCentrBin()) curCentrBin = GetNCentrBin()-1;
     }
     
-    if(GetDebug() > 0 )
-      printf("AliAnaCaloTrackCorrBaseClass::GetEventCentralityBin() - %d, centrality %d, n bins %d, max bin from centrality %d\n",
-             curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt());
+    AliDebug(1,Form("Current CentrBin %d, centrality %d, n bins %d, max bin from centrality %d",
+                    curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt()));
   }
   
   return curCentrBin;
@@ -484,16 +494,15 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetEventRPBin() const
     
     if(epAngle < 0 || epAngle >TMath::Pi())
     { 
-      printf("AliAnaCaloTrackCorrBaseClass::GetEventRPBin() - Wrong event plane angle : %f \n",epAngle);
+      AliWarning(Form("Wrong event plane angle : %f \n",epAngle));
       return -1;
     }
     
     curRPBin = TMath::Nint(epAngle*(GetNRPBin()-1)/TMath::Pi());
-    if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d\n",curRPBin,GetNRPBin());
+    if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d",curRPBin,GetNRPBin());
     
-    if(GetDebug() > 0 )
-      printf("AliAnaCaloTrackCorrBaseClass::GetEventRPBin() - %d, bin float %f, angle %f, n bins %d\n", 
-             curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin());
+    AliDebug(1,Form("Current RP bin %d, bin float %f, angle %f, n bins %d",
+                    curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin()));
   }  
   
   return curRPBin ;
@@ -511,9 +520,8 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetEventVzBin() const
   
   Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut());
   
-  if(GetDebug() > 0 )
-    printf("AliAnaCaloTrackCorrBaseClass::GetEventVzBin() - %d, vz %2.2f, n bins %d \n",
-           curZvertBin, v[2], GetNZvertBin()); 
+  AliDebug(1,Form("AliAnaCaloTrackCorrBaseClass::GetEventVzBin() - %d, vz %2.2f, n bins %d",
+                  curZvertBin, v[2], GetNZvertBin()));
   
   return curZvertBin;
 }
@@ -545,20 +553,39 @@ Int_t AliAnaCaloTrackCorrBaseClass::GetEventMixBin() const
   
   Int_t eventBin = GetEventMixBin(iCen, iVz, iRP);
   
-  if(GetDebug() > 0)
-    printf("AliAnaCaloTrackCorrBaseClass::GetEventMixBin() - Bins : cent %d, vz %d, RP %d, event %d/%d\n",
-           iCen,iVz, iRP, eventBin, GetNZvertBin()*GetNRPBin()*GetNCentrBin());
+  AliDebug(1,Form("Bins : cent %d, vz %d, RP %d, event %d/%d",
+                  iCen,iVz, iRP, eventBin, GetNZvertBin()*GetNRPBin()*GetNCentrBin()));
   
   return eventBin;
   
 }
 
+//____________________________________________
+void AliAnaCaloTrackCorrBaseClass::InitDebug()
+{
+  // Init once the debugging level, if requested
+  
+  // Activate debug level in analysis
+
+  if( fDebug >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
+  
+  if( GetMCAnalysisUtils()->GetDebug() >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetMCAnalysisUtils()->ClassName(),GetMCAnalysisUtils()->GetDebug());
+  
+  if( GetIsolationCut()->GetDebug() >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetIsolationCut()   ->ClassName(),GetIsolationCut()->GetDebug());
+  
+  //printf("Debug levels: Ana %d, MC %d, Iso %d\n",fDebug,GetMCAnalysisUtils()->GetDebug(),GetIsolationCut()->GetDebug());
+
+}
+
 //_________________________________________________
 void AliAnaCaloTrackCorrBaseClass::InitParameters()
 { 
   //Initialize the parameters of the analysis.
   fDataMC              = kFALSE;
-  fDebug               = -1;
+  fDebug               = 0;
   fCheckCaloPID        = kTRUE ;
   fCheckFidCut         = kFALSE ;
   fCheckRealCaloAcc    = kFALSE ;
@@ -568,7 +595,8 @@ void AliAnaCaloTrackCorrBaseClass::InitParameters()
   fNZvertBin           = 1;
   fNrpBin              = 1;
   
-  fCalorimeter         = "EMCAL";
+  fCalorimeterString   = "EMCAL";
+  fCalorimeter         = kEMCAL ;
   
   fTrackMultBins[0] =  0;  fTrackMultBins[1] =  5;  fTrackMultBins[2] = 10;
   fTrackMultBins[3] = 15;  fTrackMultBins[4] = 20;  fTrackMultBins[5] = 30;
@@ -616,5 +644,36 @@ void AliAnaCaloTrackCorrBaseClass::Print(const Option_t * opt) const
   
 } 
 
+//_______________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(TString & calo)
+{
+  // Set the calorimeter for the analysis
+  
+  fCalorimeterString = calo;
+  
+  if     (calo=="EMCAL") fCalorimeter = kEMCAL;
+  else if(calo=="PHOS" ) fCalorimeter = kPHOS;
+  else if(calo=="CTS")   fCalorimeter = kCTS;
+  else if(calo=="DCAL")  fCalorimeter = kDCAL;
+  else if(calo.Contains("DCAL") && calo.Contains("PHOS")) fCalorimeter = kDCALPHOS;
+  else AliFatal(Form("Detector < %s > not known!", calo.Data()));
+
+}
+
+//___________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(Int_t calo)
+{
+  // Set the calorimeter for the analysis
+  
+  fCalorimeter = calo;
+  
+  if     (calo==kEMCAL)    fCalorimeterString = "EMCAL";
+  else if(calo==kPHOS )    fCalorimeterString = "PHOS";
+  else if(calo==kCTS)      fCalorimeterString = "CTS";
+  else if(calo==kDCAL)     fCalorimeterString = "DCAL";
+  else if(calo==kDCALPHOS) fCalorimeterString = "DCAL_PHOS";
+  else AliFatal(Form("Detector < %d > not known!", calo));
+
+}
 
 
index 7fb8adbad20994c53f5f2479251b6d409fedc08a..1880127d3dbc2c64e01fb433a497888db27980c5 100755 (executable)
@@ -39,6 +39,8 @@ class AliEMCALGeometry;
 class AliPHOSGeoUtils;
 class AliCentrality;
 class AliEventplane;
+#include "AliAnalysisManager.h"
+#include "AliLog.h"
 
 //jets
 class AliAODJetEventBackground;
@@ -53,7 +55,8 @@ public:
   
   virtual TList *        GetCreateOutputObjects()               { return (new TList)          ; }
   
-  virtual void           Init() {;}
+  virtual void           Init()                                 { ; }
+  virtual void           InitDebug()      ;
   virtual void           InitParameters() ;
   
   virtual void           FillEventMixPool()                     { ; }
@@ -135,8 +138,14 @@ public:
 
   // Common analysis switchs 
   
-  virtual TString        GetCalorimeter()                 const  { return fCalorimeter           ; }
-  virtual void           SetCalorimeter(TString & calo)          { fCalorimeter = calo           ; }
+  enum detector { kEMCAL = AliFiducialCut::kEMCAL, kPHOS = AliFiducialCut::kPHOS,
+                  kCTS   = AliFiducialCut::kCTS  , kDCAL = AliFiducialCut::kDCAL,
+                  kDCALPHOS = AliFiducialCut::kDCALPHOS } ;
+
+  virtual Int_t          GetCalorimeter()                 const  { return fCalorimeter          ; }
+  virtual TString        GetCalorimeterString()           const  { return fCalorimeterString    ; }
+  virtual void           SetCalorimeter(TString & calo);
+  virtual void           SetCalorimeter(Int_t calo) ;
 
   virtual Bool_t         IsDataMC()                        const { return fDataMC                ; }
   virtual void           SwitchOnDataMC()                        { fDataMC = kTRUE ;
@@ -289,7 +298,7 @@ public:
   virtual Bool_t         IsTrackMatched(AliVCluster * cluster, AliVEvent* event) {
    return GetCaloPID()->IsTrackMatched(cluster, fCaloUtils, event) ; } 
   
-  virtual Int_t          GetModuleNumberCellIndexes(Int_t absId, const TString & calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const {
+  virtual Int_t          GetModuleNumberCellIndexes(Int_t absId, Int_t calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const {
          return fCaloUtils->GetModuleNumberCellIndexes(absId, calo, icol, irow,iRCU) ; }
   
   virtual Int_t          GetModuleNumber(AliAODPWG4Particle * part) const {
@@ -304,7 +313,8 @@ private:
   
   Bool_t                     fDataMC ;             // Flag to access MC data when using ESD or AOD     
   Int_t                      fDebug ;              // Debug level
-  TString                    fCalorimeter ;        // Calorimeter selection
+  Int_t                      fCalorimeter ;        // Calorimeter selection
+  TString                    fCalorimeterString ;  // Calorimeter selection
   Bool_t                     fCheckFidCut ;        // Do analysis for clusters in defined region
   Bool_t                     fCheckRealCaloAcc ;   // When analysis of MC particle kinematics, check their hit in Calorimeter in Real Geometry or use FidCut
   Bool_t                     fCheckCaloPID ;       // Do analysis for calorimeters
index 3c0d894a92c39cfc7e79207ba24a2ade85ba8def..fbb5498a0bc78baa083009b8af2950def766c75e 100755 (executable)
@@ -38,6 +38,7 @@
 #include "AliAODEvent.h"
 #include "AliAnaCaloTrackCorrBaseClass.h"
 #include "AliAnaCaloTrackCorrMaker.h"
+#include "AliLog.h"
 
 ClassImp(AliAnaCaloTrackCorrMaker)
 
@@ -76,7 +77,7 @@ fhClusterTriggerBCEventBC(0),           fhClusterTriggerBCEventBCUnMatch(0),
 fhClusterTriggerBCExoticEventBC(0),     fhClusterTriggerBCExoticEventBCUnMatch(0)
 {
   //Default Ctor
-  if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
+  AliDebug(1,"*** Analysis Maker Constructor ***");
   
   for(Int_t i = 0; i < 3; i++)
   {
@@ -190,8 +191,7 @@ void    AliAnaCaloTrackCorrMaker::AddAnalysis(TObject* ana, Int_t n)
   }
   else
   {
-    printf("AliAnaCaloTrackCorrMaker::AddAnalysis() - AnalysisContainer not initialized\n");
-    abort();
+    AliFatal("AnalysisContainer not initialized");
   }
 }
 
@@ -369,7 +369,7 @@ void AliAnaCaloTrackCorrMaker::FillTriggerControlHistograms()
   
   Int_t eventBC = fReader->GetInputEvent()->GetBunchCrossNumber();
   if(eventBC%4 < 0 || eventBC%4 > 3 )
-    printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - STRANGE: Trigger BC %d - Event BC %d, modulo4 %d \n",triggerBC,eventBC,eventBC%4);
+    AliWarning(Form("STRANGE: Trigger BC %d - Event BC %d, modulo4 %d",triggerBC,eventBC,eventBC%4));
   
   if(triggerMatch)
   {
@@ -778,7 +778,7 @@ TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
   
   if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
   {
-    printf("AliAnaCaloTrackCorrMaker::GetOutputContainer() - Analysis job list not initialized!!!\n");
+    AliWarning("Analysis job list not initialized!!!");
     return fOutputContainer;
   }
   
@@ -828,27 +828,42 @@ void AliAnaCaloTrackCorrMaker::Init()
   //Init container histograms and other common variables
   // Fill the output list of histograms during the CreateOutputObjects stage.
   
+  // Activate debug level in maker
+  if( fAnaDebug >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fAnaDebug);
+  
   //Initialize reader
   GetReader()->Init();
   GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
-       
+
+  // Activate debug level in reader
+  if( fReader->GetDebug() >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fReader->ClassName(), fReader->GetDebug());
+  
+  // Activate debug level in calo utils
+  if( fCaloUtils->GetDebug() >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fCaloUtils->ClassName(), fCaloUtils->GetDebug());
   
   if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
   {
-    printf("AliAnaCaloTrackCorrMaker::GetOutputInit() - Analysis job list not initialized!!!\n");
+    AliWarning("Analysis job list not initialized");
     return;
   }
   
   for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++)
   {
-    
     AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
     
     ana->SetReader(fReader);       // Set Reader for each analysis
     ana->SetCaloUtils(fCaloUtils); // Set CaloUtils for each analysis
     
     ana->Init();
+    ana->InitDebug();
     
+//    // Activate debug level in analysis
+//    if( ana->GetDebug() >= 0 )
+//      (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(ana->ClassName(),ana->GetDebug());
+
   }//Loop on analysis defined
   
 }
@@ -901,20 +916,11 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
   //Process analysis for this event
   
   if(fMakeHisto && !fOutputContainer)
-  {
-    printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Histograms not initialized\n");
-    abort();
-  }
+    AliFatal("Histograms not initialized");
   
-  if(fAnaDebug >= 0 )
-  {
-    printf("***  AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d   ***  \n",iEntry);
-    if(fAnaDebug > 1 )
-    {
-      printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Current File Name : %s\n", currentFileName);
-      //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
-    }
-  }
+  AliDebug(1,Form("***  AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d   ***",iEntry));
+  AliDebug(2,Form("Current File Name : %s", currentFileName));
+  //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
   
   //Each event needs an empty branch
   TList * aodList = fReader->GetAODBranchList();
@@ -956,7 +962,7 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
   
   if(!ok)
   {
-    if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
+    AliDebug(1,Form("*** Skip event *** %d",iEntry));
     fReader->ResetLists();
     return ;
   }
@@ -968,19 +974,19 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
   //gObjectTable->Print();
   
   // Init mag field for tracks in case of ESDs, not really necessary
-  if (!TGeoGlobalMagField::Instance()->GetField() && ((AliESDEvent*) fReader->GetInputEvent()))
-    ((AliESDEvent*)fReader->GetInputEvent())->InitMagneticField();
+  if ( !TGeoGlobalMagField::Instance()->GetField() && fReader->GetInputEvent() )
+      (fReader->GetInputEvent())->InitMagneticField();
   
   //Loop on analysis algorithms
   
-  if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
+  AliDebug(1,"*** Begin analysis ***");
   
   Int_t nana = fAnalysisContainer->GetEntries() ;
   for(Int_t iana = 0; iana <  nana; iana++)
   {
-    AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+    AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
     
-    ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
+    ana->ConnectInputOutputAODBranches(); // Sets branches for each analysis
     
     //Fill pool for mixed event for the analysis that need it
     if(!fReader->IsEventTriggerAtSEOn() && isMBTrigger)
@@ -1003,7 +1009,7 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
   // do not fill control histograms for a non requested triggered event
   if(!fReader->IsEventTriggerAtSEOn() && !isTrigger)
   {
-    if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis, MB for mixing *** \n");
+    AliDebug(1,"*** End analysis, MB for mixing ***");
     return;
   }
   
@@ -1012,7 +1018,7 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
   //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
   //gObjectTable->Print();
        
-  if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis *** \n");
+  AliDebug(1,"*** End analysis ***");
   
 }
 
@@ -1024,7 +1030,7 @@ void AliAnaCaloTrackCorrMaker::Terminate(TList * outputList)
   
   if (!outputList)
   {
-    Error("Terminate", "No output list");
+    AliError("No output list");
     return;
   }
   
index c00a9d371621a5c98c16006204ab29e0c306afc4..2a7de8c49bd44b3b5d964fb84e33e700fbff7ca4 100755 (executable)
@@ -39,6 +39,7 @@
 #include "AliPDG.h"
 #include "AliAnalysisManager.h"
 #include "AliInputEventHandler.h"
+#include "AliLog.h"
 
 ClassImp(AliAnalysisTaskCaloTrackCorrelation)
 
@@ -88,12 +89,12 @@ AliAnalysisTaskCaloTrackCorrelation::~AliAnalysisTaskCaloTrackCorrelation()
 void AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects()
 {
   // Create the output container
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - Begin\n");
+  AliDebug(1,"Begin");
   
   //Get list of aod arrays, add each aod array to analysis frame
   TList * list = fAna->FillAndGetAODBranchList(); //Loop the analysis and create the list of branches
   
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
+  AliDebug(1,Form("n AOD branches %d",list->GetEntries()));
   
   //Put the delta AODs in output file, std or delta
   if((fAna->GetReader())->WriteDeltaAODToFile())
@@ -111,11 +112,11 @@ void AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects()
   OpenFile(1);
   fOutputContainer = fAna->GetOutputContainer();
   
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
+  AliDebug(1,Form("n histograms %d",fOutputContainer->GetEntries()));
   
   fOutputContainer->SetOwner(kTRUE);
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - End\n");
+  AliDebug(1,"End");
   
   PostData(1,fOutputContainer);
   
@@ -136,21 +137,24 @@ void AliAnalysisTaskCaloTrackCorrelation::Init()
 {
   // Initialization
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::Init() - Begin\n");
+  AliDebug(1,"Begin");
+  
+  if( fDebug >= 0 )
+    (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
   
   // Call configuration file if specified
   
   if (fConfigName.Length())
   {
-    printf("AliAnalysisTaskCaloTrackCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
+    AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data()));
     gROOT->LoadMacro(fConfigName+".C");
     fAna = (AliAnaCaloTrackCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
   }
   
   if(!fAna)
   {
-    printf("AliAnalysisTaskCaloTrackCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
-    abort();
+    AliFatal("Analysis maker pointer not initialized, no analysis specified, STOP!");
+    return; // coverity
   }
   
   // Add different generator particles to PDG Data Base
@@ -170,7 +174,7 @@ void AliAnalysisTaskCaloTrackCorrelation::Init()
   // Selected Trigger
   if(fAna->GetReader()->IsEventTriggerAtSEOn()) fAna->GetReader()->SetEventTriggerMask(GetCollisionCandidates());
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::Init() - End\n");
+  AliDebug(1,"End");
   
 }
 
@@ -180,14 +184,14 @@ void AliAnalysisTaskCaloTrackCorrelation::UserExec(Option_t */*option*/)
 {
   // Execute analysis for current event
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - Begin\n");
+  AliDebug(1,"Begin");
   
   //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)
   {
-    printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - Wrong type of data\n");
+    AliError("Wrong type of data");
     return ;
   }
   
@@ -196,11 +200,10 @@ void AliAnalysisTaskCaloTrackCorrelation::UserExec(Option_t */*option*/)
   //Process event
   fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
   
-  //printf("AliAnalysisTaskCaloTrackCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - End\n");
-  
   PostData(1, fOutputContainer);
   
+  AliDebug(1,"End");
+  
   //gObjectTable->Print();
   
 }
@@ -237,8 +240,7 @@ void AliAnalysisTaskCaloTrackCorrelation::FinishTaskOutput()
   TH2F *histBin0 = dynamic_cast<TH2F*>(inputH->GetStatistics("BIN0"));
   
   if(histStat)fOutputContainer->Add(histStat);
-  else if(DebugLevel()>0)
-    printf("AliAnalysisTaskCaloTrackCorrelation::FinishTaskOutput() - Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists \n");
+  else AliDebug(0,"Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists");
   
   if(histBin0)fOutputContainer->Add(histBin0);
   
index 9b3f0c735f901783fa391af5f1086ea7e03645ef..a22af87fe97099e805122076e84bea49c3edcafb 100755 (executable)
@@ -43,6 +43,7 @@
 #include "AliAODEvent.h"
 #include "AliESDEvent.h"
 #include "AliAnalysisDataSlot.h"
+#include "AliLog.h"
 
 ClassImp(AliAnalysisTaskCaloTrackCorrelationM)
 
@@ -93,12 +94,13 @@ AliAnalysisTaskCaloTrackCorrelationM::~AliAnalysisTaskCaloTrackCorrelationM()
 void AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects()
 {
   // Create the output container
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - Begin\n");
+  AliDebug(1,"Begin");
   
   //Get list of aod arrays, add each aod array to analysis frame 
   TClonesArray *array = 0;
   TList * list = fAna->FillAndGetAODBranchList();
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
+
+  AliDebug(1,Form("n AOD branches %d",list->GetEntries()));
   
   //Put the delta AODs in output file, std or delta
   if((fAna->GetReader())->WriteDeltaAODToFile())
@@ -116,11 +118,11 @@ void AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects()
   OpenFile(1);
   fOutputContainer = fAna->GetOutputContainer();
   
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
+  AliDebug(1,Form("n histograms %d",fOutputContainer->GetEntries()));
   
   fOutputContainer->SetOwner(kTRUE);
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - End\n");
+  AliDebug(1,"End");
   
   PostData(1,fOutputContainer);
        
@@ -141,7 +143,7 @@ void AliAnalysisTaskCaloTrackCorrelationM::Init()
 {
   // Initialization
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - Begin\n");
+  AliDebug(1,"Begin");
   
   fInputEvent = new AliMixedEvent() ; 
   
@@ -149,15 +151,15 @@ void AliAnalysisTaskCaloTrackCorrelationM::Init()
   
   if (fConfigName.Length())
   {
-    printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
+    AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data()));
     gROOT->LoadMacro(fConfigName+".C");
     fAna = (AliAnaCaloTrackCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
   }
   
   if(!fAna)
   {
-    printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
-    abort();
+    AliFatal("Analysis maker pointer not initialized, no analysis specified, STOP!");
+    return; // coverity
   }
   
   // Add different generator particles to PDG Data Base 
@@ -174,7 +176,7 @@ void AliAnalysisTaskCaloTrackCorrelationM::Init()
   if((fAna->GetReader())->GetDeltaAODFileName()!="")
          AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName());
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - End\n");
+  AliDebug(1,"End");
   
 }
 
@@ -184,13 +186,14 @@ void AliAnalysisTaskCaloTrackCorrelationM::UserExec(Option_t */*option*/)
 {
   // Execute analysis for current event
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - Begin\n");
+  AliDebug(1,"Begin");
   
   //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){
-    printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - Wrong type of data\n");
+     datatype != AliCaloTrackReader::kMC)
+  {
+    AliError("Wrong type of data");
     return ;
   }
   
@@ -220,14 +223,13 @@ void AliAnalysisTaskCaloTrackCorrelationM::UserExec(Option_t */*option*/)
   //Process event
   fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
   
-  //printf("AliAnalysisTaskCaloTrackCorrelationM::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
-  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - End\n");
-  
   PostData(1, fOutputContainer);
        
   AliAnalysisDataSlot *out0 = GetOutputSlot(0);
   if (out0 && out0->IsConnected()) PostData(0, fTreeA);  
   
+  AliDebug(1,"End");
+
   //gObjectTable->Print();
   
 }
index 44069fef574d5a665fda310eee39b7395495da8a..10a72fab085736f14e0844ac5518515a88f4d930 100644 (file)
@@ -482,8 +482,7 @@ void AliAnalysisTaskCounter::FinishTaskOutput()
   
   if(histStat)
     fOutputContainer->Add(histStat);
-  else if(DebugLevel() > 1)
-    printf("AliAnalysisTaskCounter::FinishTaskOutput() - Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists \n");
+  else AliInfo("Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists");
 
   if(histBin0)
     fOutputContainer->Add(histBin0); 
@@ -521,7 +520,7 @@ Bool_t AliAnalysisTaskCounter::Notify()
   
   if(!fh1Xsec||!fh1Trials)
   {
-    Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
+    AliInfo(Form("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__));
     return kFALSE;
   }
   
@@ -538,9 +537,9 @@ Bool_t AliAnalysisTaskCounter::Notify()
   
   fh1Trials->Fill("#sum{ntrials}",trials);
   
-  printf("AliAnalysisTaskCounter::Notify() - xs %f, trial %f, avg trials %f\n",xsection,trials, fAvgTrials);
+  AliInfo(Form("xs %f, trial %f, avg trials %f\n",xsection,trials, fAvgTrials));
   
-  if(fDebug) Printf("Reading File %s",fInputHandler->GetTree()->GetCurrentFile()->GetName());
+  AliDebug(1,Form("Reading File %s",fInputHandler->GetTree()->GetCurrentFile()->GetName()));
   
   return kTRUE;
 }
index 5e93f3909b9f54175726157a5a5fa406250f8890..d6b44b98de49b3d8792913ab1fb7bc85bd3d5374 100755 (executable)
@@ -53,6 +53,7 @@
 #include "AliAODPWG4Particle.h"
 #include "AliCalorimeterUtils.h"
 #include "AliVEvent.h"
+#include "AliLog.h"
 
 // ---- Detector ----
 #include "AliEMCALPIDUtils.h"
@@ -202,13 +203,16 @@ void AliCaloPID::InitParameters()
   fPHOSPhotonWeightFormulaExpression = "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))";
   fPHOSPi0WeightFormulaExpression    = "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))"   ;
   
-  if(fRecalculateBayesian){
-    if(fParticleFlux == kLow){
-      printf("AliCaloPID::Init() - SetLOWFluxParam\n");
+  if(fRecalculateBayesian)
+  {
+    if(fParticleFlux == kLow)
+    {
+      AliInfo("SetLOWFluxParam");
       fEMCALPIDUtils->SetLowFluxParam() ;
     }
-    else if (fParticleFlux == kHigh){
-      printf("AliCaloPID::Init() - SetHIGHFluxParam\n");
+    else if (fParticleFlux == kHigh)
+    {
+      AliInfo("SetHighFluxParam");
       fEMCALPIDUtils->SetHighFluxParam() ;
     }
   }
@@ -586,13 +590,13 @@ Int_t AliCaloPID::GetIdentifiedParticleType(AliVCluster * cluster)
   // Calculate PID SS from data, do not use bayesian weights
   // -------------------------------------------------------
   
-  if(fDebug > 0) printf("AliCaloPID::GetIdentifiedParticleType: EMCAL %d?, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %1.11f, distCPV %3.2f, distToBC %1.1f, NMax %d\n",
-                        cluster->IsEMCAL(),energy,lambda0,cluster->GetM20(),cluster->GetDispersion(),cluster->GetTOF(), 
-                        cluster->GetEmcCpvDistance(), cluster->GetDistanceToBadChannel(),cluster->GetNExMax());
+  AliDebug(1,Form("EMCAL %d?, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %1.11f, distCPV %3.2f, distToBC %1.1f, NMax %d",
+                  cluster->IsEMCAL(),energy,lambda0,cluster->GetM20(),cluster->GetDispersion(),cluster->GetTOF(),
+                  cluster->GetEmcCpvDistance(), cluster->GetDistanceToBadChannel(),cluster->GetNExMax()));
   
   if(cluster->IsEMCAL())
   {
-    if(fDebug > 0) printf("AliCaloPID::GetIdentifiedParticleType() - EMCAL SS %f <%f < %f?\n",fEMCALL0CutMin, lambda0, fEMCALL0CutMax);
+    AliDebug(1,Form("EMCAL SS %f <%f < %f?",fEMCALL0CutMin, lambda0, fEMCALL0CutMax));
     
     if(lambda0 < fEMCALL0CutMax && lambda0 > fEMCALL0CutMin) return kPhoton ;
     else                                                     return kNeutralUnknown ; 
@@ -669,7 +673,7 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromBayesWeights(Bool_t isEMCAL, Doub
     else                                                     pdg = kNeutralUnknown ;
   }
   
-  if(fDebug > 0)printf("AliCaloPID::GetIdentifiedParticleType:Final Pdg: %d, cluster energy %2.2f \n", pdg,energy);
+  AliDebug(1,Form("Final Pdg: %d, cluster energy %2.2f", pdg,energy));
 
   return pdg ;
   
@@ -702,20 +706,19 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
   //If too low number of cells, skip it
   if ( nc < fSplitMinNCells)  return kNeutralUnknown ; 
   
-  if(fDebug > 0) printf("\t pass nCells cut\n");
+  AliDebug(2,"\t pass nCells cut");
   
   // Get Number of local maxima
   nMax  = caloutils->GetNumberOfLocalMaxima(cluster, cells, absIdList, maxEList) ; 
   
-  if(fDebug > 0) printf("AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting() - Cluster : E %1.1f, M02 %1.2f, NLM %d, N Cells %d\n",
-                        eClus,m02,nMax,nc);
+  AliDebug(1,Form("Cluster : E %1.1f, M02 %1.2f, NLM %d, N Cells %d",eClus,m02,nMax,nc));
 
   //---------------------------------------------------------------------
   // Get the 2 max indeces and do inv mass
   //---------------------------------------------------------------------
   
-  TString  calorimeter = "EMCAL";
-  if(cluster->IsPHOS()) calorimeter = "PHOS";
+  Int_t  calorimeter = AliCalorimeterUtils::kEMCAL;
+  if(cluster->IsPHOS()) calorimeter = AliCalorimeterUtils::kPHOS;
 
   if     ( nMax == 2 )
   {
@@ -787,9 +790,9 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
   
   if(absId2<0 || absId1<0) 
   {
-    if(fDebug > 0) printf("AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting() - Bad index for local maxima : N max %d, i1 %d, i2 %d, cluster E %2.2f, ncells %d, m02 %2.2f\n",
-                          nMax,absId1,absId2,eClus,nc,m02);
-    return kNeutralUnknown ; 
+    AliDebug(1,Form("Bad index for local maxima : N max %d, i1 %d, i2 %d, cluster E %2.2f, ncells %d, m02 %2.2f",
+                    nMax,absId1,absId2,eClus,nc,m02));
+    return kNeutralUnknown ;
   }
   
   //---------------------------------------------------------------------
@@ -828,7 +831,7 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
   else          splitFracCut = fSplitEFracMin[2];
   if((e1+e2)/eClus < splitFracCut) return kNeutralUnknown ;
 
-  if(fDebug > 0) printf("\t pass Split E frac cut\n");
+  AliDebug(2,"\t pass Split E frac cut");
   
   // Consider sub-clusters with minimum energy
   Float_t minECut = fSubClusterEMin[2];
@@ -840,7 +843,7 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
     return kNeutralUnknown ;
   }
 
-  if(fDebug > 0) printf("\t pass min sub-cluster E cut\n");
+  AliDebug(2,"\t pass min sub-cluster E cut");
   
   // Asymmetry of cluster
   Float_t asy =-10;
@@ -849,7 +852,7 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
   if( !IsInPi0SplitAsymmetryRange(eClus,asy,nMax) ) return kNeutralUnknown ;
   
   
-  if (fDebug>0) printf("\t pass asymmetry cut\n");
+  AliDebug(2,"\t pass asymmetry cut");
   
   Bool_t pi0OK = kFALSE;
   Bool_t etaOK = kFALSE;
@@ -864,10 +867,10 @@ Int_t AliCaloPID::GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster* clu
   if(nMax > 2) energy = e1+e2; // In case of NLM>2 use mass cut for NLM=2 but for the split sum not the cluster energy that is not the pi0 E.
   
   // Check the mass, and set an ID to the splitted cluster
-  if     ( conOK && mass < fMassPhoMax && mass > fMassPhoMin ) { if(fDebug > 0) printf("\t Split Conv \n"); return kPhoton ; }
-  else if( etaOK && mass < fMassEtaMax && mass > fMassEtaMin ) { if(fDebug > 0) printf("\t Split Eta \n");  return kEta    ; }
-  else if( pi0OK && IsInPi0SplitMassRange(energy,mass,nMax)  ) { if(fDebug > 0) printf("\t Split Pi0 \n");  return kPi0    ; }
-  else                                                                                                      return kNeutralUnknown ;
+  if     ( conOK && mass < fMassPhoMax && mass > fMassPhoMin ) { AliDebug(2,"\t Split Conv"); return kPhoton ; }
+  else if( etaOK && mass < fMassEtaMax && mass > fMassEtaMin ) { AliDebug(2,"\t Split Eta" ); return kEta    ; }
+  else if( pi0OK && IsInPi0SplitMassRange(energy,mass,nMax)  ) { AliDebug(2,"\t Split Pi0" ); return kPi0    ; }
+  else                                                                                        return kNeutralUnknown ;
   
 }
 
@@ -879,67 +882,67 @@ TString  AliCaloPID::GetPIDParametersList()
   TString parList ; //this will be list of parameters used for this analysis.
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
-  snprintf(onePar,buffersize,"--- AliCaloPID ---\n") ;
+  snprintf(onePar,buffersize,"--- AliCaloPID ---") ;
   parList+=onePar ;    
   if(fUseBayesianWeights)
   {
-    snprintf(onePar,buffersize,"fEMCALPhotonWeight =%2.2f (EMCAL bayesian weight for photons)\n",fEMCALPhotonWeight) ;
+    snprintf(onePar,buffersize,"fEMCALPhotonWeight =%2.2f (EMCAL bayesian weight for photons)",fEMCALPhotonWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fEMCALPi0Weight =%2.2f (EMCAL bayesian weight for pi0)\n",fEMCALPi0Weight) ;
+    snprintf(onePar,buffersize,"fEMCALPi0Weight =%2.2f (EMCAL bayesian weight for pi0)",fEMCALPi0Weight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fEMCALElectronWeight =%2.2f(EMCAL bayesian weight for electrons)\n",fEMCALElectronWeight) ;
+    snprintf(onePar,buffersize,"fEMCALElectronWeight =%2.2f(EMCAL bayesian weight for electrons)",fEMCALElectronWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fEMCALChargeWeight =%2.2f (EMCAL bayesian weight for charged hadrons)\n",fEMCALChargeWeight) ;
+    snprintf(onePar,buffersize,"fEMCALChargeWeight =%2.2f (EMCAL bayesian weight for charged hadrons)",fEMCALChargeWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fEMCALNeutralWeight =%2.2f (EMCAL bayesian weight for neutral hadrons)\n",fEMCALNeutralWeight) ;
+    snprintf(onePar,buffersize,"fEMCALNeutralWeight =%2.2f (EMCAL bayesian weight for neutral hadrons)",fEMCALNeutralWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fPHOSPhotonWeight =%2.2f (PHOS bayesian weight for photons)\n",fPHOSPhotonWeight) ;
+    snprintf(onePar,buffersize,"fPHOSPhotonWeight =%2.2f (PHOS bayesian weight for photons)",fPHOSPhotonWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fPHOSPi0Weight =%2.2f (PHOS bayesian weight for pi0)\n",fPHOSPi0Weight) ;
+    snprintf(onePar,buffersize,"fPHOSPi0Weight =%2.2f (PHOS bayesian weight for pi0)",fPHOSPi0Weight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fPHOSElectronWeight =%2.2f(PHOS bayesian weight for electrons)\n",fPHOSElectronWeight) ;
+    snprintf(onePar,buffersize,"fPHOSElectronWeight =%2.2f(PHOS bayesian weight for electrons)",fPHOSElectronWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fPHOSChargeWeight =%2.2f (PHOS bayesian weight for charged hadrons)\n",fPHOSChargeWeight) ;
+    snprintf(onePar,buffersize,"fPHOSChargeWeight =%2.2f (PHOS bayesian weight for charged hadrons)",fPHOSChargeWeight) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fPHOSNeutralWeight =%2.2f (PHOS bayesian weight for neutral hadrons)\n",fPHOSNeutralWeight) ;
+    snprintf(onePar,buffersize,"fPHOSNeutralWeight =%2.2f (PHOS bayesian weight for neutral hadrons)",fPHOSNeutralWeight) ;
     parList+=onePar ;
     
     if(fPHOSWeightFormula)
     {
-      snprintf(onePar,buffersize,"PHOS Photon Weight Formula: %s\n",fPHOSPhotonWeightFormulaExpression.Data() ) ;
+      snprintf(onePar,buffersize,"PHOS Photon Weight Formula: %s",fPHOSPhotonWeightFormulaExpression.Data() ) ;
       parList+=onePar;
-      snprintf(onePar,buffersize,"PHOS Pi0    Weight Formula: %s\n",fPHOSPi0WeightFormulaExpression.Data()    ) ;
+      snprintf(onePar,buffersize,"PHOS Pi0    Weight Formula: %s",fPHOSPi0WeightFormulaExpression.Data()    ) ;
       parList+=onePar;   
     }
   }
   else
   {
-    snprintf(onePar,buffersize,"EMCAL: fEMCALL0CutMin =%2.2f, fEMCALL0CutMax =%2.2f  (Cut on Shower Shape) \n",fEMCALL0CutMin, fEMCALL0CutMax) ;
+    snprintf(onePar,buffersize,"EMCAL: fEMCALL0CutMin =%2.2f, fEMCALL0CutMax =%2.2f  (Cut on Shower Shape)",fEMCALL0CutMin, fEMCALL0CutMax) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"EMCAL: fEMCALDEtaCut =%2.2f, fEMCALDPhiCut =%2.2f  (Cut on track matching) \n",fEMCALDEtaCut, fEMCALDPhiCut) ;
+    snprintf(onePar,buffersize,"EMCAL: fEMCALDEtaCut =%2.2f, fEMCALDPhiCut =%2.2f  (Cut on track matching)",fEMCALDEtaCut, fEMCALDPhiCut) ;
     parList+=onePar ;
-    snprintf(onePar,buffersize,"fTOFCut  =%e (Cut on TOF, used in PID evaluation) \n",fTOFCut) ;
+    snprintf(onePar,buffersize,"fTOFCut  =%e (Cut on TOF, used in PID evaluation)",fTOFCut) ;
     parList+=onePar ;  
-    snprintf(onePar,buffersize,"fPHOSRCut =%2.2f, fPHOSDispersionCut =%2.2f  (Cut on Shower Shape and CPV) \n",fPHOSRCut,fPHOSDispersionCut) ;
+    snprintf(onePar,buffersize,"fPHOSRCut =%2.2f, fPHOSDispersionCut =%2.2f  (Cut on Shower Shape and CPV)",fPHOSRCut,fPHOSDispersionCut) ;
     parList+=onePar ;
     
   }
   
   if(fUseSimpleM02Cut)
   {
-    snprintf(onePar,buffersize,"%2.2f< M02 < %2.2f \n",    fSplitM02MinCut, fSplitM02MaxCut) ;
+    snprintf(onePar,buffersize,"%2.2f< M02 < %2.2f",    fSplitM02MinCut, fSplitM02MaxCut) ;
     parList+=onePar ;
   }
-  snprintf(onePar,buffersize,"fMinNCells =%d \n",        fSplitMinNCells) ;
+  snprintf(onePar,buffersize,"fMinNCells =%d",        fSplitMinNCells) ;
   parList+=onePar ;
   if(fUseSimpleMassCut)
   {
-    snprintf(onePar,buffersize,"pi0 : %2.1f < m <%2.1f\n", fMassPi0Min,fMassPi0Max);
+    snprintf(onePar,buffersize,"pi0 : %2.1f < m <%2.1f", fMassPi0Min,fMassPi0Max);
     parList+=onePar ;
   }
-  snprintf(onePar,buffersize,"eta : %2.1f < m <%2.1f\n", fMassEtaMin,fMassEtaMax);
+  snprintf(onePar,buffersize,"eta : %2.1f < m <%2.1f", fMassEtaMin,fMassEtaMax);
   parList+=onePar ;
-  snprintf(onePar,buffersize,"conv: %2.1f < m <%2.1f\n", fMassPhoMin,fMassPhoMax);
+  snprintf(onePar,buffersize,"conv: %2.1f < m <%2.1f", fMassPhoMin,fMassPhoMax);
   parList+=onePar ;
   
   
@@ -1043,46 +1046,43 @@ void AliCaloPID::SetPIDBits(AliVCluster * cluster,
   
   //Set PID pdg
   ph->SetIdentifiedParticleType(GetIdentifiedParticleType(cluster));
-  
-  if(fDebug > 0)
-  { 
-    printf("AliCaloPID::SetPIDBits: TOF %e, Lambda0 %2.2f, Lambda1 %2.2f\n",tof , l0, l1);     
-    printf("AliCaloPID::SetPIDBits: pdg %d, bits: TOF %d, Dispersion %d, Charge %d\n",
-           ph->GetIdentifiedParticleType(), ph->GetTOFBit() , ph->GetDispBit() , ph->GetChargedBit()); 
-  }
+  AliDebug(1,Form("TOF %e, Lambda0 %2.2f, Lambda1 %2.2f",tof , l0, l1));
+  AliDebug(1,Form("pdg %d, bits: TOF %d, Dispersion %d, Charge %d",
+           ph->GetIdentifiedParticleType(), ph->GetTOFBit() , ph->GetDispBit() , ph->GetChargedBit()));
 }
 
 //_________________________________________________________
 Bool_t AliCaloPID::IsTrackMatched(AliVCluster* cluster,
-                                  AliCalorimeterUtils * cu, 
-                                  AliVEvent* event) const 
+                                  AliCalorimeterUtils * cu,
+                                  AliVEvent* event) const
 {
   //Check if there is any track attached to this cluster
   
   Int_t nMatches = cluster->GetNTracksMatched();
   AliVTrack * track = 0;
-  Double_t p[3];
-
+  
   if(nMatches > 0)
   {
     //In case of ESDs, by default without match one entry with negative index, no match, reject.
     if(!strcmp("AliESDCaloCluster",Form("%s",cluster->ClassName())))
-    {    
+    {
       Int_t iESDtrack = cluster->GetTrackMatchedIndex();
       if(iESDtrack >= 0) track = dynamic_cast<AliVTrack*> (event->GetTrack(iESDtrack));
       else return kFALSE;
       
       if (!track)
       {
-        if(fDebug > 0) printf("AliCaloPID::IsTrackMatched() - Null matched track in ESD when index is OK!\n");
+        AliWarning("Null matched track in ESD when index is OK!");
         return kFALSE;
       }
-    }      
-    else { // AOD
+    }
+    else
+    { // AOD
       track = dynamic_cast<AliVTrack*> (cluster->GetTrackMatched(0));
       if (!track)
       {
-        if(fDebug > 0) printf("AliCaloPID::IsTrackMatched() - Null matched track in AOD!\n");
+        AliWarning("Null matched track in AOD!");
         return kFALSE;
       }
     }
@@ -1096,38 +1096,36 @@ Bool_t AliCaloPID::IsTrackMatched(AliVCluster* cluster,
       dR = 2000., dZ = 2000.;
       cu->GetEMCALRecoUtils()->GetMatchedResiduals(cluster->GetID(),dZ,dR);
     }
-        
-    if(cluster->IsPHOS()) 
+    
+    if(cluster->IsPHOS())
     {
-      track->GetPxPyPz(p) ;
-      TLorentzVector trackmom(p[0],p[1],p[2],0);
       Int_t charge = track->Charge();
       Double_t mf  = event->GetMagneticField();
-      if(TestPHOSChargedVeto(dR, dZ, trackmom.Pt(), charge, mf ) < fPHOSRCut) return kTRUE;
-      else                                                                    return kFALSE;
+      if(TestPHOSChargedVeto(dR, dZ, track->Pt(), charge, mf ) < fPHOSRCut) return kTRUE;
+      else                                                                  return kFALSE;
       
     }//PHOS
     else //EMCAL
     {
-    if(fDebug > 1) 
-        printf("AliCaloPID::IsTrackMatched - EMCAL dR %f < %f, dZ %f < %f \n",dR, fEMCALDPhiCut, dZ, fEMCALDEtaCut);
       
-      if(TMath::Abs(dR) < fEMCALDPhiCut && 
+      AliDebug(1,Form("EMCAL dR %f < %f, dZ %f < %f ",dR, fEMCALDPhiCut, dZ, fEMCALDEtaCut));
+      
+      if(TMath::Abs(dR) < fEMCALDPhiCut &&
          TMath::Abs(dZ) < fEMCALDEtaCut)   return kTRUE;
       else                                 return kFALSE;
       
-    }//EMCAL cluster 
+    }//EMCAL cluster
     
     
   } // more than 1 match, at least one track in array
   else return kFALSE;
-    
+  
 }
 
 //___________________________________________________________________________________________________
-Float_t AliCaloPID::TestPHOSDispersion(const Double_t pt, const Double_t l1, const Double_t l2) const 
+Float_t AliCaloPID::TestPHOSDispersion(const Double_t pt, const Double_t l1, const Double_t l2) const
 {
-  //Check if cluster photon-like. Uses photon cluster parameterization in real pp data 
+  //Check if cluster photon-like. Uses photon cluster parameterization in real pp data
   //Returns distance in sigmas. Recommended cut 2.5
   
   Double_t l2Mean  = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
@@ -1135,13 +1133,13 @@ Float_t AliCaloPID::TestPHOSDispersion(const Double_t pt, const Double_t l1, con
   Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
   Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
   Double_t c       =-0.35-0.550*TMath::Exp(-0.390730*pt) ;
-  Double_t r2      = 0.5*  (l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma + 
-                     0.5*  (l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
-                     0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
+  Double_t r2      = 0.5*  (l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma +
+  0.5*  (l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
+  0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
   
-  if(fDebug > 0) printf("AliCaloPID::TestPHOSDispersion() - PHOS SS R %f < %f?\n", TMath::Sqrt(r2), fPHOSDispersionCut);
+  AliDebug(1,Form("PHOS SS R %f < %f?", TMath::Sqrt(r2), fPHOSDispersionCut));
   
-  return TMath::Sqrt(r2) ; 
+  return TMath::Sqrt(r2) ;
   
 }
 
@@ -1189,9 +1187,9 @@ Float_t AliCaloPID::TestPHOSChargedVeto(const Double_t dx,  const Double_t dz, c
   Double_t rz = (dz-meanZ)/sz ;
   Double_t rx = (dx-meanX)/sx ;
   
-  if(fDebug > 0) 
-    printf("AliCaloPID::TestPHOSDispersion() - PHOS Matching R %f < %f\n",TMath::Sqrt(rx*rx+rz*rz), fPHOSRCut);
+  AliDebug(1,Form("PHOS Matching R %f < %f",TMath::Sqrt(rx*rx+rz*rz), fPHOSRCut));
   
   return TMath::Sqrt(rx*rx+rz*rz) ;
   
 }
+
index eea178e854629026718714b8ec86dfe6fdfba9f8..e97583f638bd07df3b7cd1f55f92726507737400 100755 (executable)
@@ -31,6 +31,7 @@
 #include "AliAnalysisManager.h"
 #include "AliMixedEvent.h"
 #include "AliAODEvent.h"
+#include "AliLog.h"
 
 ClassImp(AliCaloTrackAODReader)
 
@@ -127,10 +128,9 @@ Bool_t AliCaloTrackAODReader::SelectTrack(AliVTrack* track, Double_t pTrack[3])
   
   if(!aodtrack) return kFALSE;
   
-  
-  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
-                         aodtrack->GetType(),AliAODTrack::kPrimary,
-                         aodtrack->IsHybridGlobalConstrainedGlobal());
+  AliDebug(2,Form("AOD track type: %d (primary %d), hybrid? %d",
+                  aodtrack->GetType(),AliAODTrack::kPrimary,
+                  aodtrack->IsHybridGlobalConstrainedGlobal()));
   
   // Hybrid?
   if (fSelectHybridTracks && fTrackFilterMaskComplementary == 0)
@@ -162,7 +162,7 @@ Bool_t AliCaloTrackAODReader::SelectTrack(AliVTrack* track, Double_t pTrack[3])
     Double_t frac = Double_t(aodtrack->GetTPCnclsS()) / Double_t(aodtrack->GetTPCncls());
     if (frac > fCutTPCSharedClustersFraction)
     {
-      if (fDebug > 2 )printf("\t Reject track, shared cluster fraction %f > %f\n",frac, fCutTPCSharedClustersFraction);
+      AliDebug(2,Form("\t Reject track, shared cluster fraction %f > %f",frac, fCutTPCSharedClustersFraction));
       return kFALSE ;
     }
   }
@@ -172,12 +172,12 @@ Bool_t AliCaloTrackAODReader::SelectTrack(AliVTrack* track, Double_t pTrack[3])
   {
     if ( aodtrack->GetType()!= AliAODTrack::kPrimary )
     {
-      if (fDebug > 2 ) printf("\t Remove not primary track\n");
+      AliDebug(2,"\t Remove not primary track");
       return kFALSE ;
     }
   }
   
-  if (fDebug > 2 ) printf("\t accepted track! \n");
+  AliDebug(2,"\t accepted track!");
   
   track->GetPxPyPz(pTrack) ;
   
@@ -212,8 +212,8 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input,
     }
     else
     {
-      printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - MultiEventHandler is NULL");
-      abort();
+      AliFatal("MultiEventHandler is NULL");
+      return;
     }
   }
   if        (strcmp(input->GetName(),"AliESDEvent") == 0) 
@@ -250,7 +250,7 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input,
   }
   else
   { 
-    AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()));
+    AliFatal(Form("STOP : Wrong data format: %s",input->GetName()));
   }
   
   SetMC(mc);
index e9a02f98772a67680422077ed5bd09006da6597a..bc251d5fdcca04c121c14b938d072a3e92723cf4 100755 (executable)
@@ -33,6 +33,7 @@
 #include "AliMixedEvent.h"
 #include "AliESDEvent.h"
 #include "AliESDtrackCuts.h"
+#include "AliLog.h"
 
 ClassImp(AliCaloTrackESDReader)
 
@@ -192,8 +193,8 @@ void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd,
     }
     else
     {
-      printf("AliCaloTrackESDReader::SetInputOutputMCEvent() - MultiEventHandler is NULL");
-      abort();
+      AliFatal("MultiEventHandler is NULL");
+      return;
     }
   }
   if (strcmp(esd->GetName(),"AliESDEvent") == 0)
@@ -203,7 +204,7 @@ void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd,
   
   if(!tesd)
   {
-    AliFatal(Form("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName()));
+    AliFatal(Form("STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent",esd->GetName()));
   }
   
   SetInputEvent(esd);
index d6586e562adaada6358f60893277f224faa5b77e..f662353ff3d04e88b11984ca3b8692b5d0788a4e 100755 (executable)
@@ -42,6 +42,7 @@
 #include "AliAODEvent.h"
 #include "AliFiducialCut.h"
 #include "AliMCAnalysisUtils.h"
+#include "AliLog.h"
 
 ClassImp(AliCaloTrackMCReader)
 
@@ -51,7 +52,9 @@ AliCaloTrackReader(),        fDecayPi0(0),
 fNeutralParticlesArray(0x0), fChargedParticlesArray(0x0), 
 fStatusArray(0x0),           fKeepAllStatus(0), 
 fCheckOverlap(0),            fEMCALOverlapAngle(0),fPHOSOverlapAngle(0), 
-fIndex2ndPhoton(0),          fOnlyGeneratorParticles(kTRUE)
+fIndex2ndPhoton(0),          fOnlyGeneratorParticles(kTRUE),
+fMomentum(),                 fPi0Momentum(),
+fGamDecayMom1(),             fGamDecayMom2()
 {
   //Ctor
   
@@ -118,10 +121,9 @@ void AliCaloTrackMCReader::InitParameters()
   
 }
 
-//__________________________________________________________________________
+//____________________________________________________________________________________
 void  AliCaloTrackMCReader::CheckOverlap(Float_t anglethres, Int_t imom,
-                                         Int_t & iPrimary, Int_t & index,
-                                         TLorentzVector & mom, Int_t & pdg)
+                                         Int_t & iPrimary, Int_t & index, Int_t & pdg)
 {
   //Check overlap of decay photons
   if( fIndex2ndPhoton==iPrimary )
@@ -134,26 +136,25 @@ void  AliCaloTrackMCReader::CheckOverlap(Float_t anglethres, Int_t imom,
   
   if(pdg!=22) return;
   
-  TLorentzVector ph1, ph2;
   TParticle *meson = GetStack()->Particle(imom);
-  Int_t mepdg = meson->GetPdgCode();
+  Int_t mepdg  = meson->GetPdgCode();
   Int_t idaug1 = meson->GetFirstDaughter();
   if((mepdg == 111 || mepdg == 221 ) && meson->GetNDaughters() == 2)
   { //Check only decay in 2 photons
     TParticle * d1 = GetStack()->Particle(idaug1);
-    TParticle  *d2 = GetStack()->Particle(idaug1+1);
+    TParticle d2 = GetStack()->Particle(idaug1+1);
     if(d1->GetPdgCode() == 22 && d2->GetPdgCode() == 22 )
     {
-      d1->Momentum(ph1);
-      d2->Momentum(ph2);
+      d1->Momentum(fGamDecayMom1);
+      d2->Momentum(fGamDecayMom2);
       //printf("angle %2.2f\n",ph1.Angle(ph2.Vect()));
       
-      if(anglethres >  ph1.Angle(ph2.Vect()))
+      if(anglethres >  fGamDecayMom1.Angle(fGamDecayMom2.Vect()))
       {          
         //Keep the meson
         pdg=mepdg;
         index=imom;
-        meson->Momentum(mom);
+        meson->Momentum(fMomentum);
         //printf("Overlap:: pt %2.2f, phi %2.2f, eta %2.2f\n",mom.Pt(),mom.Phi(),mom.Eta());
         if(iPrimary == idaug1) iPrimary++; //skip next photon in list
       }
@@ -170,60 +171,50 @@ void  AliCaloTrackMCReader::CheckOverlap(Float_t anglethres, Int_t imom,
   }//Meson Decay with 2 photon daughters
 }
 
-//____________________________________________________________________
-void  AliCaloTrackMCReader::FillCalorimeters(Int_t & iParticle, 
-                                             TParticle* particle, 
-                                             TLorentzVector &momentum)
+//__________________________________________________________________________________
+void  AliCaloTrackMCReader::FillCalorimeters(Int_t & iParticle, TParticle* particle)
 {
   //Fill AODCaloClusters or TParticles lists of PHOS or EMCAL
-  //In PHOS
+  Char_t  ttype          = 0;
+  Float_t overAngleLimit = 100;
   
-  if(fFillPHOS && momentum.Pt() > fPHOSPtMin)
+  if     (fFillPHOS)
   {
-    if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) return;
-         
-    Int_t index = iParticle ;
-    Int_t pdg = TMath::Abs(particle->GetPdgCode());
-    if(fCheckOverlap) 
-      CheckOverlap(fPHOSOverlapAngle,particle->GetFirstMother(),index, iParticle, momentum, pdg);
-    
-    Char_t ttype= AliVCluster::kPHOSNeutral;   
-    Int_t labels[] = {index};
-    Double_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
-    //Create object and write it to file
-    AliAODCaloCluster *calo = new AliAODCaloCluster(index,1,labels,momentum.E(), x, NULL, ttype, 0);
-    
-    SetCaloClusterPID(pdg,calo) ;
-    if(fDebug > 3 && momentum.Pt() > 0.2)
-      printf("AliCaloTrackMCReader::FillCalorimeters() - PHOS : Selected cluster %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());                  
-    fPHOSClusters->Add(calo);//reference the selected object to the list
+    if( particle->Pt() < fPHOSPtMin ) return;
+    if( fCheckFidCut && !fFiducialCut->IsInFiducialCut(particle->Eta(),particle->Phi(),kPHOS )) return;
+    ttype = AliVCluster::kPHOSNeutral;
+    overAngleLimit = fPHOSOverlapAngle;
   }
-  
-  //In EMCAL
-  if(fFillEMCAL  && momentum.Pt() > fEMCALPtMin)
+  else if(fFillEMCAL)
   {
-         
-    if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return;
-         
-    Int_t index = iParticle ;
-    Int_t pdg = TMath::Abs(particle->GetPdgCode());
-    //Int_t pdgorg=pdg;
-    if(fCheckOverlap) 
-      CheckOverlap(fEMCALOverlapAngle,particle->GetFirstMother(),iParticle, index, momentum, pdg);
-    
-    Char_t ttype= AliVCluster::kEMCALClusterv1;
-    Int_t labels[] = {index};
-    Double_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
-    //Create object and write it to file
-    AliAODCaloCluster *calo = new AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0);
-    
-    SetCaloClusterPID(pdg,calo) ;
-    if(fDebug > 3 && momentum.Pt() > 0.2)
-      printf("AliCaloTrackMCReader::FillCalorimeters() - EMCAL : Selected cluster %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());  
-    fEMCALClusters->Add(calo);//reference the selected object to the list
+    if( particle->Pt() < fEMCALPtMin ) return;
+    if( fCheckFidCut && !fFiducialCut->IsInFiducialCut(particle->Eta(),particle->Phi(),kEMCAL)) return;
+    ttype= AliVCluster::kEMCALClusterv1;
+    overAngleLimit = fEMCALOverlapAngle;
   }
+  
+  particle->Momentum(fMomentum);
+  
+  Int_t index = iParticle ;
+  Int_t pdg = TMath::Abs(particle->GetPdgCode());
+  if(fCheckOverlap)
+    CheckOverlap(overAngleLimit,particle->GetFirstMother(),index, iParticle, pdg);
+  
+  Int_t labels[] = {index};
+  Double_t x[] = {fMomentum.X(), fMomentum.Y(), fMomentum.Z()};
+  
+  //Create object and write it to file
+  AliAODCaloCluster *calo = new AliAODCaloCluster(index,1,labels,fMomentum.E(), x, NULL, ttype, 0);
+  
+  SetCaloClusterPID(pdg,calo) ;
+  AliDebug(3,Form("PHOS %d?, EMCAL %d? : Selected cluster pdg %d, E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                  fFillPHOS, fFillEMCAL, pdg,fMomentum.E(), fMomentum.Pt(), fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
+  
+  //reference the selected object to the list
+  if(fFillPHOS)fPHOSClusters ->Add(calo);
+  else         fEMCALClusters->Add(calo);
+  
 }
 
 //___________________________________________________________________________
@@ -254,7 +245,6 @@ Bool_t AliCaloTrackMCReader::FillInputEvent(Int_t iEntry,
   for (iParticle = 0 ; iParticle <  nparticles ; iParticle++) 
   {
     TParticle * particle = GetStack()->Particle(iParticle);
-    TLorentzVector momentum;
     Float_t p[3];
     Float_t x[3];
     Int_t pdg = particle->GetPdgCode();                                                
@@ -266,22 +256,26 @@ Bool_t AliCaloTrackMCReader::FillInputEvent(Int_t iEntry,
       //       if(TMath::Abs(pdg) == 3124 || TMath::Abs(pdg) > 10000000) continue ;
       
       charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
-      particle->Momentum(momentum);
+      
+      Float_t en  = particle->Energy();
+      Float_t pt  = particle->Pt();
+      Float_t eta = particle->Eta();
+      Float_t phi = particle->Phi();
       //---------- Charged particles ----------------------
       if(charge != 0)
       {
-        if(TMath::Abs(momentum.Eta())< fTrackMultEtaCut) fTrackMult++;
+        if(TMath::Abs(eta)< fTrackMultEtaCut) fTrackMult++;
         
-        if(fFillCTS && (momentum.Pt() > fCTSPtMin)){
+        if(fFillCTS && (pt > fCTSPtMin))
+        {
           //Particles in CTS acceptance
           
-          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
+          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(eta,phi,kCTS)) continue;
           
           if(TMath::Abs(pdg) == 11 && GetStack()->Particle(particle->GetFirstMother())->GetPdgCode()==22) continue ;
           
-          if(fDebug > 3 && momentum.Pt() > 0.2)
-            printf("AliCaloTrackMCReader::FillInputEvent() - 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());
+          AliDebug(2,Form("CTS : Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                          en,pt,phi*TMath::RadToDeg(),eta));
           
           x[0] = particle->Vx(); x[1] = particle->Vy(); x[2] = particle->Vz();
           p[0] = particle->Px(); p[1] = particle->Py(); p[2] = particle->Pz();
@@ -297,7 +291,7 @@ Bool_t AliCaloTrackMCReader::FillInputEvent(Int_t iEntry,
           fCTSTracks->Add(aodTrack);//reference the selected object to the list
         }
         //Keep some charged particles in calorimeters lists
-        if((fFillPHOS || fFillEMCAL) && KeepChargedParticles(pdg)) FillCalorimeters(iParticle, particle, momentum);
+        if((fFillPHOS || fFillEMCAL) && KeepChargedParticles(pdg)) FillCalorimeters(iParticle, particle);
         
       }//Charged
       
@@ -310,32 +304,39 @@ Bool_t AliCaloTrackMCReader::FillInputEvent(Int_t iEntry,
         //Fill particle/calocluster arrays
         if(!fDecayPi0) 
         {
-          FillCalorimeters(iParticle, particle, momentum);
+          AliDebug(2,Form("Calo : Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                          en,pt,phi*TMath::RadToDeg(),eta));
+          FillCalorimeters(iParticle, particle);
         }
         else 
         {
           //Sometimes pi0 are stable for the generator, if needed decay it by hand
           if(pdg == 111 )
           {
-            if(momentum.Pt() >  fPHOSPtMin || momentum.Pt() >  fEMCALPtMin)
+            if(pt >  fPHOSPtMin || pt >  fEMCALPtMin)
             {
-              TLorentzVector lvGamma1, lvGamma2 ;
-              //Double_t angle = 0;
-              
               //Decay
-              MakePi0Decay(momentum,lvGamma1,lvGamma2);//,angle);
+              //Double_t angle = 0;
+              particle->Momentum(fPi0Momentum);
+
+              MakePi0Decay();//,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);
+              TParticle * pPhoton1 = new TParticle(22,1,iParticle,0,0,0,fGamDecayMom1.Px(),fGamDecayMom1.Py(),
+                                                   fGamDecayMom1.Pz(),fGamDecayMom1.E(),0,0,0,0);
+              TParticle * pPhoton2 = new TParticle(22,1,iParticle,0,0,0,fGamDecayMom2.Px(),fGamDecayMom2.Py(),
+                                                   fGamDecayMom2.Pz(),fGamDecayMom2.E(),0,0,0,0);
               //Fill particle/calocluster arrays
-              FillCalorimeters(iParticle,pPhoton1,lvGamma1);
-              FillCalorimeters(iParticle,pPhoton2,lvGamma2);
+              FillCalorimeters(iParticle,pPhoton1);
+              FillCalorimeters(iParticle,pPhoton2);
             }//pt cut
           }//pi0
-          else FillCalorimeters(iParticle,particle, momentum); //Add the rest
+          else
+          {
+            AliDebug(2,Form("Calo : Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                            en,pt,phi*TMath::RadToDeg(),eta));
+            FillCalorimeters(iParticle,particle); //Add the rest
+          }
         }
       }//neutral particles
     } //particle with correct status
@@ -408,21 +409,19 @@ void AliCaloTrackMCReader::Print(const Option_t * opt) const
   
 }
 
-//________________________________________________________________
-void AliCaloTrackMCReader::MakePi0Decay(TLorentzVector p0,
-                                        TLorentzVector &p1, 
-                                        TLorentzVector &p2) const 
+//_______________________________________
+void AliCaloTrackMCReader::MakePi0Decay()
 //, Double_t &angle)
 { 
   // Perform isotropic decay pi0 -> 2 photons
-  // p0 is pi0 4-momentum (inut)
-  // p1 and p2 are photon 4-momenta (output)
+  // fPi0Momentum is pi0 4-momentum (ipnut)
+  // fGamDecayMom1 and fGamDecayMom2 are photon 4-momenta (output)
   
   //  cout<<"Boost vector"<<endl;
   Double_t mPi0 = TDatabasePDG::Instance()->GetParticle(111)->Mass();
-  TVector3 b = p0.BoostVector();
+  TVector3 b = fPi0Momentum.BoostVector();
   //cout<<"Parameters"<<endl;
-  //Double_t mPi0   = p0.M();
+  //Double_t mPi0   = fPi0Momentum.M();
   Double_t phi    = TMath::TwoPi() * gRandom->Rndm();
   Double_t cosThe = 2 * gRandom->Rndm() - 1;
   Double_t cosPhi = TMath::Cos(phi);
@@ -431,25 +430,25 @@ void AliCaloTrackMCReader::MakePi0Decay(TLorentzVector p0,
   Double_t ePi0   = mPi0/2.;
   //cout<<"ePi0 "<<ePi0<<endl;
   //cout<<"Components"<<endl;
-  p1.SetPx(+ePi0*cosPhi*sinThe);
-  p1.SetPy(+ePi0*sinPhi*sinThe);
-  p1.SetPz(+ePi0*cosThe);
-  p1.SetE(ePi0);
-  //cout<<"p1: "<<p1.Px()<<" "<<p1.Py()<<" "<<p1.Pz()<<" "<<p1.E()<<endl;
-  //cout<<"p1 Mass: "<<p1.Px()*p1.Px()+p1.Py()*p1.Py()+p1.Pz()*p1.Pz()-p1.E()*p1.E()<<endl;
-  p2.SetPx(-ePi0*cosPhi*sinThe);
-  p2.SetPy(-ePi0*sinPhi*sinThe);
-  p2.SetPz(-ePi0*cosThe);
-  p2.SetE(ePi0);
-  //cout<<"p2: "<<p2.Px()<<" "<<p2.Py()<<" "<<p2.Pz()<<" "<<p2.E()<<endl;
-  //cout<<"p2 Mass: "<<p2.Px()*p2.Px()+p2.Py()*p2.Py()+p2.Pz()*p2.Pz()-p2.E()*p2.E()<<endl;
+  fGamDecayMom1.SetPx(+ePi0*cosPhi*sinThe);
+  fGamDecayMom1.SetPy(+ePi0*sinPhi*sinThe);
+  fGamDecayMom1.SetPz(+ePi0*cosThe);
+  fGamDecayMom1.SetE(ePi0);
+  //cout<<"fGamDecayMom1: "<<fGamDecayMom1.Px()<<" "<<fGamDecayMom1.Py()<<" "<<fGamDecayMom1.Pz()<<" "<<fGamDecayMom1.E()<<endl;
+  //cout<<"fGamDecayMom1 Mass: "<<fGamDecayMom1.Px()*fGamDecayMom1.Px()+fGamDecayMom1.Py()*fGamDecayMom1.Py()+fGamDecayMom1.Pz()*fGamDecayMom1.Pz()-fGamDecayMom1.E()*fGamDecayMom1.E()<<endl;
+  fGamDecayMom2.SetPx(-ePi0*cosPhi*sinThe);
+  fGamDecayMom2.SetPy(-ePi0*sinPhi*sinThe);
+  fGamDecayMom2.SetPz(-ePi0*cosThe);
+  fGamDecayMom2.SetE(ePi0);
+  //cout<<"fGamDecayMom2: "<<fGamDecayMom2.Px()<<" "<<fGamDecayMom2.Py()<<" "<<fGamDecayMom2.Pz()<<" "<<fGamDecayMom2.E()<<endl;
+  //cout<<"fGamDecayMom2 Mass: "<<fGamDecayMom2.Px()*fGamDecayMom2.Px()+fGamDecayMom2.Py()*fGamDecayMom2.Py()+fGamDecayMom2.Pz()*fGamDecayMom2.Pz()-fGamDecayMom2.E()*fGamDecayMom2.E()<<endl;
   //cout<<"Boost "<<b.X()<<" "<<b.Y()<<" "<<b.Z()<<endl;
-  p1.Boost(b);
-  //cout<<"p1: "<<p1.Px()<<" "<<p1.Py()<<" "<<p1.Pz()<<" "<<p1.E()<<endl;
-  p2.Boost(b);
-  //cout<<"p2: "<<p2.Px()<<" "<<p2.Py()<<" "<<p2.Pz()<<" "<<p2.E()<<endl;
+  fGamDecayMom1.Boost(b);
+  //cout<<"fGamDecayMom1: "<<fGamDecayMom1.Px()<<" "<<fGamDecayMom1.Py()<<" "<<fGamDecayMom1.Pz()<<" "<<fGamDecayMom1.E()<<endl;
+  fGamDecayMom2.Boost(b);
+  //cout<<"fGamDecayMom2: "<<fGamDecayMom2.Px()<<" "<<fGamDecayMom2.Py()<<" "<<fGamDecayMom2.Pz()<<" "<<fGamDecayMom2.E()<<endl;
   //cout<<"angle"<<endl;
-  //angle = p1.Angle(p2.Vect());
+  //angle = fGamDecayMom1.Angle(fGamDecayMom2.Vect());
   //cout<<angle<<endl;
 }
 
index 661b8c542a0d6f6ee98af26ed4626642d39f13cc..7224840274166b6219fc97cc4a1e5cf67d1d78f2 100755 (executable)
@@ -38,15 +38,15 @@ class AliCaloTrackMCReader : public AliCaloTrackReader {
 
   // Main methos in source file
   
-  void   CheckOverlap(Float_t anglethres, Int_t imom, Int_t & iPrimary, Int_t & index, TLorentzVector & mom, Int_t & pdg);
+  void   CheckOverlap(Float_t anglethres, Int_t imom, Int_t & iPrimary, Int_t & index, Int_t & pdg);
 
-  void   FillCalorimeters(Int_t & iParticle, TParticle* particle, TLorentzVector & momentum) ;
+  void   FillCalorimeters(Int_t & iParticle, TParticle* particle) ;
 
   Bool_t FillInputEvent(Int_t iEntry, const char * currentFileName) ;
   
   void   InitParameters();
   
-  void   MakePi0Decay(TLorentzVector p0, TLorentzVector &p1, TLorentzVector &p2) const ;//, Double_t &angle);
+  void   MakePi0Decay() ;//, Double_t &angle);
 
   void   Print(const Option_t * opt) const; 
   
@@ -116,10 +116,15 @@ private:
   Int_t     fIndex2ndPhoton;         // Check overlap of first decay photon already done, internal use.
   Bool_t    fOnlyGeneratorParticles; // Use particles only generated by PYTHIA/HERWIG/... and not by the MC tranport G3/G4/FLUKA ...
   
+  TLorentzVector fMomentum;          //! momentum
+  TLorentzVector fPi0Momentum;       //! Pi0 momentum
+  TLorentzVector fGamDecayMom1;      //! Gamma decay 1 momentum
+  TLorentzVector fGamDecayMom2;      //! Gamma decay 2 momentum
+  
   AliCaloTrackMCReader(              const AliCaloTrackMCReader & r) ; // cpy ctor     
   AliCaloTrackMCReader & operator = (const AliCaloTrackMCReader & r) ; // cpy assignment
   
-  ClassDef(AliCaloTrackMCReader,4)
+  ClassDef(AliCaloTrackMCReader,5)
 } ;
 
 
index f301a6683739be57cab1699598998a0e27f094d8..d98fe3b38096e6e5c07d4560599e5e29d672c2b9 100755 (executable)
@@ -47,6 +47,7 @@
 #include "AliInputEventHandler.h"
 #include "AliAODMCParticle.h"
 #include "AliStack.h"
+#include "AliLog.h"
 
 // ---- Detectors ----
 #include "AliPHOSGeoUtils.h"
@@ -79,10 +80,12 @@ fEMCALParamTimeCutMin(),     fEMCALParamTimeCutMax(),
 fTrackTimeCutMin(-10000),    fTrackTimeCutMax(10000),
 fUseTrackDCACut(0),
 fAODBranchList(0x0),
-fCTSTracks(0x0),             fEMCALClusters(0x0),             fPHOSClusters(0x0),
+fCTSTracks(0x0),             fEMCALClusters(0x0),
+fDCALClusters(0x0),          fPHOSClusters(0x0),
 fEMCALCells(0x0),            fPHOSCells(0x0),
 fInputEvent(0x0),            fOutputEvent(0x0),fMC(0x0),
-fFillCTS(0),                 fFillEMCAL(0),                   fFillPHOS(0),
+fFillCTS(0),                 fFillEMCAL(0),
+fFillDCAL(0),                fFillPHOS(0),
 fFillEMCALCells(0),          fFillPHOSCells(0),
 fRecalculateClusters(kFALSE),fCorrectELinearity(kTRUE),
 fSelectEmbeddedClusters(kFALSE),
@@ -131,7 +134,8 @@ fFillInputNonStandardJetBranch(kFALSE),
 fNonStandardJets(new TClonesArray("AliAODJet",100)),fInputNonStandardJetBranchName("jets"),
 fFillInputBackgroundJetBranch(kFALSE), 
 fBackgroundJets(0x0),fInputBackgroundJetBranchName("jets"),
-fAcceptEventsWithBit(0),     fRejectEventsWithBit(0), fRejectEMCalTriggerEventsWith2Tresholds(0)
+fAcceptEventsWithBit(0),     fRejectEventsWithBit(0), fRejectEMCalTriggerEventsWith2Tresholds(0),
+fMomentum()
 {
   //Ctor
   
@@ -172,6 +176,13 @@ void AliCaloTrackReader::DeletePointers()
     delete fEMCALClusters ;
   }
   
+  if(fDCALClusters)
+  {
+    if(fDataType!=kMC)fDCALClusters->Clear("C") ;
+    else              fDCALClusters->Delete() ;
+    delete fDCALClusters ;
+  }
+  
   if(fPHOSClusters)
   {
     if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
@@ -299,12 +310,12 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
     if(eventType!=7)
     return kFALSE; //Only physics event, do not use for simulated events!!!
     
-    if(fDebug > 0)
-      printf("AliCaloTrackReader::CheckEventTriggers() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
-             GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
+   AliDebug(1,Form("FiredTriggerClass <%s>, selected class <%s>, compare name %d",
+                   GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(),
+                   GetFiredTriggerClasses().Contains(fFiredTriggerClassName)));
     
     if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
-    else if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Accepted triggered event\n");
+    else AliDebug(1,"Accepted triggered event");
   }
   else if(fAnaLED)
   {
@@ -322,11 +333,11 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
     //   kSystemSoftwareTriggerEvent   = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
     //   kDetectorSoftwareTriggerEvent = 13  // DETECTOR_SOFTWARE_TRIGGER_EVENT
     
-         if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::CheckEventTriggers() - DO LED, Event Type <%d>, 8 Calibration \n",  eventType);
-         if(eventType!=8)return kFALSE;
+         //if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::CheckEventTriggers() - DO LED, Event Type <%d>, 8 Calibration \n",  eventType);
+         if(eventType!=8) return kFALSE;
   }
   
-  if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass Trigger name rejection \n");
+  AliDebug(1,"Pass Trigger name rejection");
 
   //-----------------------------------------------------------------
   // In case of mixing analysis, select here the trigger of the event
@@ -350,7 +361,7 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
     if(!isTrigger && !isMB) return kFALSE;
     
     //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
-    if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass uninteresting triggered events rejection in case of mixing analysis \n");
+    AliDebug(0,"Pass uninteresting triggered events rejection in case of mixing analysis");
   }
 
   //-------------------------------------------------------------------------------------
@@ -364,7 +375,7 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
   
   if(!okA || !okR) return kFALSE;
   
-  if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass event bit rejection \n");
+  AliDebug(1,"Pass event bit rejection");
   
   //----------------------------------------------------------------------
   // Do not count events that were likely triggered by an exotic cluster
@@ -397,17 +408,16 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
     // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
     if(fRemoveBadTriggerEvents)
     {
-     if(fDebug > 0)
-      printf("AliCaloTrackReader::CheckEventTriggers() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d  - Matched %d\n",
-             fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
+     AliDebug(1,Form("ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d  - Matched %d\n",
+                     fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch));
       if     (fIsExoticEvent)         return kFALSE;
       else if(fIsBadCellEvent)        return kFALSE;
       else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
       else if(fTriggerClusterBC != 0) return kFALSE;
-      if(fDebug > 0) printf("\t *** YES for %s\n",GetFiredTriggerClasses().Data());
+      AliDebug(1,Form("\t *** YES for %s",GetFiredTriggerClasses().Data()));
     }
     
-    if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass EMCal triggered event rejection \n");
+   AliDebug(1,"Pass EMCal triggered event rejection \n");
   }
   
   //-------------------------------------------------------------------------------------
@@ -415,7 +425,7 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
   //-------------------------------------------------------------------------------------
   if (GetFiredTriggerClasses().Contains("FAST")  && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
   {
-    if(fDebug > 0)  printf("AliCaloTrackReader::CheckEventTriggers() - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
+    AliDebug(1,Form("Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data()));
     return kFALSE;
   }
   
@@ -431,7 +441,7 @@ Bool_t AliCaloTrackReader::CheckEventTriggers()
 
     if(reject) return kFALSE;
     
-    if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass LED event rejection \n");
+    AliDebug(1,"Pass LED event rejection");
 
   }// Remove LED events
   
@@ -453,8 +463,7 @@ Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
     Int_t nTriggerJets =  pygeh->NTriggerJets();
     Float_t ptHard = pygeh->GetPtHard();
     
-    if(fDebug > 1)
-      printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
+    AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, ptHard));
     
     Float_t tmpjet[]={0,0,0,0};
     for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
@@ -462,14 +471,13 @@ Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
       pygeh->TriggerJet(ijet, tmpjet);
       jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
       
-      if(fDebug > 1)
-        printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt());
+      AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet->Pt()));
       
       //Compare jet pT and pt Hard
       if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
       {
-        printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
-               ptHard, jet->Pt(), fPtHardAndJetPtFactor);
+        AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
+                     ptHard, jet->Pt(), fPtHardAndJetPtFactor));
         return kFALSE;
       }
     }
@@ -500,7 +508,7 @@ Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt()
       
       if(ecluster > fPtHardAndClusterPtFactor*ptHard)
       {
-        printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard);
+        AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard));
         
         return kFALSE;
       }
@@ -520,7 +528,7 @@ AliStack* AliCaloTrackReader::GetStack() const
     return fMC->Stack();
   else
   {
-    if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
+    AliDebug(1,"Stack is not available");
     return 0x0 ;
   }
 }
@@ -535,7 +543,7 @@ AliHeader* AliCaloTrackReader::GetHeader() const
   }
   else
   {
-    printf("AliCaloTrackReader::Header is not available\n");
+    AliInfo("Header is not available");
     return 0x0 ;
   }
 }
@@ -677,7 +685,7 @@ TClonesArray* AliCaloTrackReader::GetAODMCParticles() const
 {
   //Return list of particles in AOD, implemented in AliCaloTrackAODReader.
   
-  printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n");
+  AliInfo("Input are not AODs");
   
   return NULL ;
 }
@@ -687,7 +695,7 @@ AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
 {
   //Return MC header in AOD, implemented in AliCaloTrackAODReader.
   
-  printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
+  AliInfo("Input are not AODs");
   
   return NULL ;
 }
@@ -744,13 +752,14 @@ Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
 void AliCaloTrackReader::Init()
 {
   //Init reader. Method to be called in AliAnaCaloTrackCorrMaker
-    
+  
   if(fReadStack && fReadAODMCParticles)
   {
-    printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
+    AliInfo("Cannot access stack and mcparticles at the same time, change them");
     fReadStack          = kFALSE;
     fReadAODMCParticles = kFALSE;
   }
+  
 }
 
 //_______________________________________
@@ -773,6 +782,7 @@ void AliCaloTrackReader::InitParameters()
   
   //Do not filter the detectors input by default.
   fFillEMCAL      = kFALSE;
+  fFillDCAL       = kFALSE;
   fFillPHOS       = kFALSE;
   fFillCTS        = kFALSE;
   fFillEMCALCells = kFALSE;
@@ -814,6 +824,7 @@ void AliCaloTrackReader::InitParameters()
   // Allocate memory (not sure this is the right place)
   fCTSTracks       = new TObjArray();
   fEMCALClusters   = new TObjArray();
+  fDCALClusters    = new TObjArray();
   fPHOSClusters    = new TObjArray();
   //fTriggerAnalysis = new AliTriggerAnalysis;
   fAODBranchList   = new TList ;
@@ -1055,7 +1066,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   //fCurrentFileName = TString(currentFileName);
   if(!fInputEvent)
   {
-    if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
+    AliInfo("Input event not available, skip event analysis");
     return kFALSE;
   }
   
@@ -1068,7 +1079,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   Bool_t accept = CheckEventTriggers();
   if(!accept) return kFALSE;
   
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Event trigger selection \n");
+  AliDebug(1,"Pass Event trigger selection");
   
   //---------------------------------------------------------------------------
   // In case of analysis of events with jets, skip those with jet pt > 5 pt hard
@@ -1078,13 +1089,13 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   if(fComparePtHardAndJetPt)
   {
     if(!ComparePtHardAndJetPt()) return kFALSE ;
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Jet rejection \n");
+    AliDebug(1,"Pass Pt Hard - Jet rejection");
   }
   
   if(fComparePtHardAndClusterPt)
   {
     if(!ComparePtHardAndClusterPt()) return kFALSE ;
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Cluster rejection \n");
+    AliDebug(1,"Pass Pt Hard - Cluster rejection");
   }
   
   //------------------------------------------------------
@@ -1103,7 +1114,8 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
       
       if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
     }
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Time Stamp rejection \n");
+    
+    AliDebug(1,"Pass Time Stamp rejection");
   }
   
   //------------------------------------------------------
@@ -1123,7 +1135,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
         TMath::Abs(fVertex[0][2] ) < 1.e-6    ) return kFALSE;
   }
   
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass primary vertex rejection \n");
+  AliDebug(1,"Pass primary vertex rejection");
   
   //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
   
@@ -1135,7 +1147,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
     //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
     if(bPileup) return kFALSE;
     
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pile-Up event rejection \n");
+    AliDebug(1,"Pass Pile-Up event rejection");
   }
   
   if(fDoV0ANDEventSelection)
@@ -1148,10 +1160,11 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
 
     if(!bV0AND)
     {
-      printf("AliCaloTrackReader::FillInputEvent() - Reject event by V0AND\n");
+      AliDebug(1,"Reject event by V0AND");
       return kFALSE;
     }
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass V0AND event rejection \n");
+    
+    AliDebug(1,"Pass V0AND event rejection");
   }
 
   //------------------------------------------------------
@@ -1165,7 +1178,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
     Int_t cen = GetEventCentrality();
     if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
     
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass centrality rejection \n");
+    AliDebug(1,"Pass centrality rejection");
   }
   
   //---------------------------------------------------------------------------
@@ -1192,14 +1205,14 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
     //Accept events with at least one track
     if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
     
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass rejection of null track events \n");
+    AliDebug(1,"Pass rejection of null track events");
   }
   
   if(fDoVertexBCEventSelection)
   {
     if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ;
     
-    if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass rejection of events with vertex at BC!=0 \n");
+    AliDebug(1,"Pass rejection of events with vertex at BC!=0");
   }
   
   if(fFillEMCALCells)
@@ -1208,7 +1221,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   if(fFillPHOSCells)
     FillInputPHOSCells();
   
-  if(fFillEMCAL)
+  if(fFillEMCAL || fFillDCAL)
     FillInputEMCAL();
   
   if(fFillPHOS)
@@ -1222,7 +1235,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileNa
   if(fFillInputBackgroundJetBranch)
     FillInputBackgroundJets();
 
-  if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Event accepted for analysis \n");
+  AliDebug(1,"Event accepted for analysis");
 
   return kTRUE ;
 }
@@ -1239,7 +1252,7 @@ Int_t AliCaloTrackReader::GetEventCentrality() const
     else if(fCentralityOpt==20)  return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
     else
     {
-      printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
+      AliInfo(Form("Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt));
       return -1;
     }
   }
@@ -1258,14 +1271,14 @@ Double_t AliCaloTrackReader::GetEventPlaneAngle() const
     
     if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
     {
-      if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() -  Bad EP for <Q> method : %f\n",ep);
+      AliDebug(1,Form("Bad EP for <Q> method : %f\n",ep));
       return -1000;
     }
     else if(GetEventPlaneMethod().Contains("V0")  )
     {
       if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
       {
-        if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() -  Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
+        AliDebug(1,Form("Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep));
         return -1000;
       }
       
@@ -1273,18 +1286,18 @@ Double_t AliCaloTrackReader::GetEventPlaneAngle() const
       
     }
     
-    //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
-    if(fDebug > 0 )
-    {
-      if     (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
-      else if(ep < 0          ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
-    }
+    AliDebug(3,Form("Event plane angle %f",ep));
+    
+//    if(fDebug > 0 )
+//    {
+//      if     (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
+//      else if(ep < 0          ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
+//    }
     
     return ep;
   }
   else
   {
-    if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() -  No EP pointer\n");
     return -1000;
   }
   
@@ -1311,7 +1324,6 @@ void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const
 //________________________________________
 void AliCaloTrackReader::FillVertexArray()
 {
-  
   //Fill data member with vertex
   //In case of Mixed event, multiple vertices
   
@@ -1345,7 +1357,7 @@ void AliCaloTrackReader::FillVertexArray()
       }
       else
       {
-        printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
+        AliWarning("NULL primary vertex");
         fVertex[0][0]=0.;   fVertex[0][1]=0.;   fVertex[0][2]=0.;
       }//Primary vertex pointer do not exist
       
@@ -1354,8 +1366,7 @@ void AliCaloTrackReader::FillVertexArray()
       fVertex[0][0]=0.;   fVertex[0][1]=0.;   fVertex[0][2]=0.;
     }
     
-    if(fDebug > 1)
-      printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
+    AliDebug(1,Form("Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]));
     
   } else
   { // MultiEvent analysis
@@ -1366,9 +1377,7 @@ void AliCaloTrackReader::FillVertexArray()
       else
          AliWarning("No vertex found");
       
-      if(fDebug > 1)
-        printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",
-               iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
+      AliDebug(1,Form("Multi Event %d Vertex : %f,%f,%f",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]));
     }
   }
   
@@ -1379,7 +1388,7 @@ void AliCaloTrackReader::FillInputCTS()
 {
   //Return array with Central Tracking System (CTS) tracks
   
-  if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
+  AliDebug(1,"Begin");
   
   Double_t pTrack[3] = {0,0,0};
   
@@ -1445,7 +1454,7 @@ void AliCaloTrackReader::FillInputCTS()
       }
     }
     
-    TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
+    fMomentum.SetPxPyPzE(pTrack[0],pTrack[1],pTrack[2],0);
     
     // DCA cuts
     
@@ -1461,10 +1470,10 @@ void AliCaloTrackReader::FillInputCTS()
         Double_t dca[2]   = {1e6,1e6};
         Double_t covar[3] = {1e6,1e6,1e6};
         Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
-        if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
+        if( okDCA) okDCA = AcceptDCA(fMomentum.Pt(),dca[0]);
         if(!okDCA)
         {
-          //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",momentum.Pt(),dca[0]);
+          //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",fMomentum.Pt(),dca[0]);
           continue ;
         }
       }
@@ -1473,16 +1482,15 @@ void AliCaloTrackReader::FillInputCTS()
     //Count the tracks in eta < 0.9
     if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
     
-    if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
+    if(fCTSPtMin > fMomentum.Pt() || fCTSPtMax < fMomentum.Pt()) continue ;
     
     // Check effect of cuts on track BC
     if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9);
     
-    if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
+    if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS)) continue;
     
-    if(fDebug > 2 && momentum.Pt() > 0.1)
-      printf("AliCaloTrackReader::FillInputCTS() - Selected tracks pt %3.2f, phi %3.2f, eta %3.2f\n",
-             momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+    AliDebug(2,Form("Selected tracks pt %3.2f, phi %3.2f, eta %3.2f",
+                    fMomentum.Pt(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
     
     if (fMixedEvent)  track->SetID(itrack);
     
@@ -1497,8 +1505,7 @@ void AliCaloTrackReader::FillInputCTS()
     else      fVertexBC = AliVTrack::kTOFBCNA ;
   }
   
-  if(fDebug > 1)
-    printf("AliCaloTrackReader::FillInputCTS()   - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
+  AliDebug(1,Form("AOD entries %d, input tracks %d, pass status %d, multipliticy %d", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult));//fCTSTracksNormalInputEntries);
   
 }
 
@@ -1514,13 +1521,12 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
   if (fMixedEvent)
     vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
   
-  TLorentzVector momentum ;
   
-  clus->GetMomentum(momentum, fVertex[vindex]);
+  clus->GetMomentum(fMomentum, fVertex[vindex]);
   
-  if( (fDebug > 2 && momentum.E() > 0.1) || fDebug > 10 )
-    printf("AliCaloTrackReader::FillInputEMCALAlgorithm() - Input cluster E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-           momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
+  AliDebug(2,Form("Input cluster E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                  fMomentum.E(),fMomentum.Pt(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
 
   if(fRecalculateClusters)
   {
@@ -1574,9 +1580,9 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
   
   if(!goodCluster)
   {
-    if( (fDebug > 2 && momentum.E() > 0.1) || fDebug > 10 )
-      printf("AliCaloTrackReader::FillInputEMCALAlgorithm() - Bad cluster E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-             momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+    //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
+    AliDebug(2,Form("Bad cluster E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                    fMomentum.E(),fMomentum.Pt(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
 
     return;
   }
@@ -1608,9 +1614,9 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
   {
     GetCaloUtils()->CorrectClusterEnergy(clus) ;
     
-    if( (fDebug > 5 && momentum.E() > 0.1) || fDebug > 10 )
-      printf("AliCaloTrackReader::FillInputEMCALAlgorithm() - Correct Non Lin: Old E %3.2f, New E %3.2f\n",
-             momentum.E(),clus->E());
+    //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
+    AliDebug(5,Form("Correct Non Lin: Old E %3.2f, New E %3.2f",
+                    fMomentum.E(),clus->E()));
 
     // In case of MC analysis, to match resolution/calibration in real data
     // Not needed anymore, just leave for MC studies on systematics
@@ -1618,9 +1624,8 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
     {
       Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
       
-      if( (fDebug > 5 && momentum.E() > 0.1) || fDebug > 10 )
-        printf("AliCaloTrackReader::FillInputEMCALAlgorithm() - Smear energy: Old E %3.2f, New E %3.2f\n",
-               clus->E(),rdmEnergy);
+      //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
+      AliDebug(5,Form("Smear energy: Old E %3.2f, New E %3.2f",clus->E(),rdmEnergy));
     
       clus->SetE(rdmEnergy);
     }
@@ -1635,9 +1640,7 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
   
   if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
   
-  clus->GetMomentum(momentum, fVertex[vindex]);
-  
-  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
+  clus->GetMomentum(fMomentum, fVertex[vindex]);
   
   SetEMCalEventBCcut(bc);
   
@@ -1649,14 +1652,30 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus
   else
     fNNonPileUpClusters++;
   
-  if((fDebug > 2 && momentum.E() > 0.1) || fDebug > 10)
-    printf("AliCaloTrackReader::FillInputEMCALAlgorithm() - 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());
+  //if((fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10)
+  AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                  fMomentum.E(),fMomentum.Pt(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
   
   if (fMixedEvent)
     clus->SetID(iclus) ;
   
-  fEMCALClusters->Add(clus);
+  // Select cluster fiducial region
+  Bool_t bEMCAL = kFALSE;
+  Bool_t bDCAL  = kFALSE;
+  if(fCheckFidCut)
+  {
+    if(fFillEMCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) bEMCAL = kTRUE ;
+    if(fFillDCAL  && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kDCAL )) bDCAL  = kTRUE ;
+  }
+  else
+  {
+    bEMCAL = kTRUE;
+  }
+
+  
+  // Fill the corresponding array. Usually just filling EMCal array with upper or lower clusters is enough, but maybe we want to do EMCal-DCal correlations.
+  if     (bEMCAL) fEMCALClusters->Add(clus);
+  else if(bDCAL ) fDCALClusters ->Add(clus);
   
 }
 
@@ -1665,7 +1684,7 @@ void AliCaloTrackReader::FillInputEMCAL()
 {
   //Return array with EMCAL clusters in aod format
   
-  if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
+  AliDebug(1,"Begin");
   
   // First recalibrate cells, time or energy
   //  if(GetCaloUtils()->IsRecalibrationOn())
@@ -1716,7 +1735,7 @@ void AliCaloTrackReader::FillInputEMCAL()
     
     if(!clusterList)
     {
-      printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters?  <%s>\n",fEMCALClustersListName.Data());
+      AliWarning(Form("Wrong name of list with clusters?  <%s>",fEMCALClustersListName.Data()));
       return;
     }
     
@@ -1726,7 +1745,7 @@ void AliCaloTrackReader::FillInputEMCAL()
       AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
       //printf("E %f\n",clus->E());
       if (clus) FillInputEMCALAlgorithm(clus, iclus);
-      else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
+      else      AliWarning("Null cluster in list!");
     }// cluster loop
     
     // Recalculate the pile-up time, in case long time clusters removed during clusterization
@@ -1765,11 +1784,9 @@ void AliCaloTrackReader::FillInputEMCAL()
           
           if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
           
-          TLorentzVector momentum ;
-          
-          clus->GetMomentum(momentum, fVertex[0]);
+          clus->GetMomentum(fMomentum, fVertex[0]);
           
-          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
+          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) return ;
           
           SetEMCalEventBCcut(bc);
           
@@ -1790,7 +1807,7 @@ void AliCaloTrackReader::FillInputEMCAL()
     
   }
   
-  if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n",  fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
+  AliDebug(1,Form("AOD entries %d, n pile-up clusters %d, n non pile-up %d", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters));
   
 }
 
@@ -1799,7 +1816,7 @@ void AliCaloTrackReader::FillInputPHOS()
 {
   //Return array with PHOS clusters in aod format
   
-  if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
+  AliDebug(1,"Begin");
   
   //Loop to select clusters in fiducial cut and fill container with aodClusters
   Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
@@ -1816,7 +1833,7 @@ void AliCaloTrackReader::FillInputPHOS()
         Int_t vindex = 0 ;
         if (fMixedEvent)
           vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
-        if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
+        if( GetCaloUtils()->ClusterContainsBadChannel(kPHOS,clus->GetCellsAbsId(), clus->GetNCells()))
           continue;
         if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells()))
           continue;
@@ -1831,18 +1848,15 @@ void AliCaloTrackReader::FillInputPHOS()
           }
         }
         
-        TLorentzVector momentum ;
-        
-        clus->GetMomentum(momentum, fVertex[vindex]);
+        clus->GetMomentum(fMomentum, fVertex[vindex]);
         
-        if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
+        if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kPHOS)) continue;
         
-        if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E())          continue;
-        
-        if(fDebug > 2 && momentum.E() > 0.1)
-          printf("AliCaloTrackReader::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());
+        if(fPHOSPtMin > fMomentum.E() || fPHOSPtMax < fMomentum.E())         continue;
         
+        //if(fDebug > 2 && fMomentum.E() > 0.1)
+        AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f",
+                        fMomentum.E(),fMomentum.Pt(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
         
         if (fMixedEvent)
         {
@@ -1855,7 +1869,7 @@ void AliCaloTrackReader::FillInputPHOS()
     }//cluster exists
   }//esd cluster loop
   
 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS()  - aod entries %d\n",  fPHOSClusters->GetEntriesFast());
AliDebug(1,Form("AOD entries %d",fPHOSClusters->GetEntriesFast()));
   
 }
 
@@ -1898,13 +1912,12 @@ void AliCaloTrackReader::FillInputVZERO()
       fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
       fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
     }
-    if(fDebug > 0)
-      printf("AliCaloTrackReader::FillInputVZERO() - ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
+    
+    AliDebug(1,Form("ADC (%d,%d), Multiplicity (%d,%d)",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]));
   }
   else
   {
-    if(fDebug > 0)
-      printf("AliCaloTrackReader::FillInputVZERO() - Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
+    AliDebug(1,"Cannot retrieve V0 ESD! Run w/ null V0 charges");
   }
 }
 
@@ -1916,14 +1929,14 @@ void AliCaloTrackReader::FillInputNonStandardJets()
   //
   // Adam T. Matyja
   
-  if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputNonStandardJets()\n");
+  AliDebug(2,"Begin");
+  
   //
   //check if branch name is given
   if(!fInputNonStandardJetBranchName.Length())
   {
-    Printf("No non-standard jet branch name specified. Specify among existing ones.");
     fInputEvent->Print();
-    abort();
+    AliFatal("No non-standard jet branch name specified. Specify among existing ones.");
   }
   
   fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
@@ -1931,14 +1944,13 @@ void AliCaloTrackReader::FillInputNonStandardJets()
   if(!fNonStandardJets)
   {
     //check if jet branch exist; exit if not
-    Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data());
     fInputEvent->Print();
-    abort();
+
+    AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()));
   }
   else
   {
-    if(fDebug > 1)
-      printf("AliCaloTrackReader::FillInputNonStandardJets() - aod input jets %d\n", fNonStandardJets->GetEntriesFast() );
+    AliDebug(1,Form("AOD input jets %d", fNonStandardJets->GetEntriesFast()));
   }
   
 }
@@ -1951,14 +1963,14 @@ void AliCaloTrackReader::FillInputBackgroundJets()
   //
   // Adam T. Matyja
   
-  if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputBackgroundJets()\n");
+  AliDebug(1,"Begin");
   //
   //check if branch name is given
   if(!fInputBackgroundJetBranchName.Length())
   {
-    Printf("No background jet branch name specified. Specify among existing ones.");
     fInputEvent->Print();
-    abort();
+    
+    AliFatal("No background jet branch name specified. Specify among existing ones.");
   }
   
   fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
@@ -1966,16 +1978,14 @@ void AliCaloTrackReader::FillInputBackgroundJets()
   if(!fBackgroundJets)
   {
     //check if jet branch exist; exit if not
-    Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data());
     fInputEvent->Print();
-    abort();
+
+    AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()));
   }
   else
   {
-    if(fDebug > 1){
-      printf("AliCaloTrackReader::FillInputBackgroundJets()\n");
-      fBackgroundJets->Print("");
-    }
+    AliDebug(1,"FillInputBackgroundJets");
+    fBackgroundJets->Print("");
   }
   
 }
@@ -2115,8 +2125,8 @@ TArrayI AliCaloTrackReader::GetTriggerPatches(Int_t tmin, Int_t tmax )
     } // trigger iterator
   } // go through triggers
   
-  if(patches.GetSize()<=0) printf("AliCaloTrackReader::GetTriggerPatches() - No patch found! for triggers: %s and selected <%s>\n",
-                                  GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data());
+  if(patches.GetSize()<=0) AliInfo(Form("No patch found! for triggers: %s and selected <%s>",
+                                        GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data()));
   //else                     printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
                  
   return patches;
@@ -2456,6 +2466,7 @@ void AliCaloTrackReader::Print(const Option_t * opt) const
   printf("EMCAL Time Cut: %3.1f < TOF  < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
   printf("Use CTS         =     %d\n",     fFillCTS) ;
   printf("Use EMCAL       =     %d\n",     fFillEMCAL) ;
+  printf("Use DCAL        =     %d\n",     fFillDCAL)  ;
   printf("Use PHOS        =     %d\n",     fFillPHOS) ;
   printf("Use EMCAL Cells =     %d\n",     fFillEMCALCells) ;
   printf("Use PHOS  Cells =     %d\n",     fFillPHOSCells) ;
@@ -2503,9 +2514,8 @@ Bool_t  AliCaloTrackReader::RejectLEDEvents()
   
   if(ncellsSM3 >= ncellcut)
   {
-    if(fDebug > 0)
-      printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n",
-             ncellsSM3,ncellcut,GetFiredTriggerClasses().Data());
+    AliDebug(1,Form("Reject event with ncells in SM3 %d, cut %d, trig %s",
+                    ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()));
     return kTRUE;
   }
   
@@ -2588,9 +2598,8 @@ void AliCaloTrackReader::SetEventTriggerBit()
   fEventTrigEMCALL1Jet1   = kFALSE;
   fEventTrigEMCALL1Jet2   = kFALSE;
   
-  if(fDebug > 0)
-    printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s - Select <%s>\n",
-           fEventTriggerMask,GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data());
+  AliDebug(1,Form("Select trigger mask bit %d - Trigger Event %s - Select <%s>",
+                  fEventTriggerMask,GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data()));
   
   if(fEventTriggerMask <=0 )// in case no mask set
   {
@@ -2707,11 +2716,10 @@ void AliCaloTrackReader::SetEventTriggerBit()
     }
        }
   
-  if(fDebug > 0 )
-    printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB   %d, Cen  %d, Sem  %d, L0   %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n",
-           fEventTrigMinBias,      fEventTrigCentral,       fEventTrigSemiCentral,
-           fEventTrigEMCALL0 ,     fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
-           fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2);
+  AliDebug(1,Form("Event bits: \n \t MB   %d, Cen  %d, Sem  %d, L0   %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d",
+                  fEventTrigMinBias,      fEventTrigCentral,       fEventTrigSemiCentral,
+                  fEventTrigEMCALL0 ,     fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
+                  fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2));
   
   if(fBitEGA == 0 && fBitEJE ==0)
   {
@@ -2744,8 +2752,8 @@ void AliCaloTrackReader::SetEventTriggerBit()
           fBitEGA = 6;
           fBitEJE = 8;
         }
-           }  else printf("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed\n");
-    } else printf("AliCaloTrackReader::SetEventTriggerBit() -  Streamer list not available!, bit not changed\n");
+           }  else AliInfo("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed");
+    } else AliInfo("AliCaloTrackReader::SetEventTriggerBit() -  Streamer list not available!, bit not changed");
     
   } // set once the EJE, EGA trigger bit
   
index cd89f3928ebd7d6600325e2ddc2f235f8078e298..6cc7e90f3e39961a788dccaeb2fadd44de24569e 100755 (executable)
@@ -98,6 +98,11 @@ public:
   // Clusters/Tracks arrays filtering/filling methods and switchs 
   //------------------------------------------------------------
   
+  // detector identificator enum, used here and in AliAnaCaloTrackBaseClass and derived classes
+  enum detector { kEMCAL = AliFiducialCut::kEMCAL, kPHOS = AliFiducialCut::kPHOS,
+                  kCTS   = AliFiducialCut::kCTS  , kDCAL = AliFiducialCut::kDCAL,
+                  kDCALPHOS = AliFiducialCut::kDCALPHOS } ;
+
   // Minimum pt setters and getters
   
   Float_t          GetEMCALPtMin()                   const { return fEMCALPtMin            ; }
@@ -192,6 +197,10 @@ public:
   void             SwitchOnEMCAL()                         { fFillEMCAL = kTRUE            ; }
   void             SwitchOffEMCAL()                        { fFillEMCAL = kFALSE           ; }
 
+  Bool_t           IsDCALSwitchedOn()                const { return fFillDCAL              ; }
+  void             SwitchOnDCAL()                          { fFillDCAL = kTRUE             ; }
+  void             SwitchOffDCAL()                         { fFillDCAL = kFALSE            ; }
+  
   Bool_t           IsPHOSSwitchedOn()                const { return fFillPHOS              ; }
   void             SwitchOnPHOS()                          { fFillPHOS = kTRUE             ; }
   void             SwitchOffPHOS()                         { fFillPHOS = kFALSE            ; }
@@ -236,6 +245,7 @@ public:
   
   virtual TObjArray*     GetCTSTracks()              const { return fCTSTracks              ; }
   virtual TObjArray*     GetEMCALClusters()          const { return fEMCALClusters          ; }
+  virtual TObjArray*     GetDCALClusters()           const { return fDCALClusters           ; }
   virtual TObjArray*     GetPHOSClusters()           const { return fPHOSClusters           ; }
   virtual AliVCaloCells* GetEMCALCells()             const { return fEMCALCells             ; }
   virtual AliVCaloCells* GetPHOSCells()              const { return fPHOSCells              ; }
@@ -658,6 +668,7 @@ public:
   TList          * fAODBranchList ;            //-> List with AOD branches created and needed in analysis
   TObjArray      * fCTSTracks ;                //-> temporal array with tracks
   TObjArray      * fEMCALClusters ;            //-> temporal array with EMCAL CaloClusters
+  TObjArray      * fDCALClusters ;             //-> temporal array with DCAL CaloClusters, not needed in the normal case, use just EMCal array with DCal limits
   TObjArray      * fPHOSClusters ;             //-> temporal array with PHOS  CaloClusters
   AliVCaloCells  * fEMCALCells ;               //! temporal array with EMCAL CaloCells
   AliVCaloCells  * fPHOSCells ;                //! temporal array with PHOS  CaloCells
@@ -668,6 +679,7 @@ public:
 
   Bool_t           fFillCTS;                   // use data from CTS
   Bool_t           fFillEMCAL;                 // use data from EMCAL
+  Bool_t           fFillDCAL;                  // use data from DCAL, not needed in the normal case, use just EMCal array with DCal limits
   Bool_t           fFillPHOS;                  // use data from PHOS
   Bool_t           fFillEMCALCells;            // use data from EMCAL
   Bool_t           fFillPHOSCells;             // use data from PHOS
@@ -803,6 +815,8 @@ public:
 
   Bool_t           fRejectEMCalTriggerEventsWith2Tresholds; // Reject events EG2 also triggered by EG1 or EJ2 also triggered by EJ1
   
+  TLorentzVector   fMomentum;                    //! Temporal TLorentzVector container, avoid declaration of  TLorentzVectors per event
+  
   AliCaloTrackReader(              const AliCaloTrackReader & r) ; // cpy ctor
   AliCaloTrackReader & operator = (const AliCaloTrackReader & r) ; // cpy assignment
   
index 4d096a518ad99a672f266765bd3014abb205a567..49b9898b605a48eb0aef8c3ccdd1ac6e8165bba7 100755 (executable)
@@ -43,6 +43,7 @@
 #include "AliOADBContainer.h"
 #include "AliAnalysisManager.h"
 #include "AliAODMCParticle.h"
+#include "AliLog.h"
 
 // --- Detector ---
 #include "AliEMCALGeometry.h"
@@ -123,7 +124,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
   // EMCAL
   if(fOADBForEMCAL)
   {
-    printf("AliCalorimeterUtils::SetOADBParameters() - Get AODB parameters from EMCAL in %s for run %d, and <%s> \n",fOADBFilePathEMCAL.Data(),runnumber,pass.Data());
+    AliInfo(Form("Get AODB parameters from EMCAL in %s for run %d, and <%s>",fOADBFilePathEMCAL.Data(),runnumber,pass.Data()));
     
     Int_t nSM = fEMCALGeo->GetNumberOfSuperModules();
     
@@ -138,7 +139,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
       if(arrayBC)
       {
         SwitchOnDistToBadChannelRecalculation();
-        printf("AliCalorimeterUtils::SetOADBParameters() - Remove EMCAL bad cells \n");
+        AliInfo("Remove EMCAL bad cells");
         
         for (Int_t i=0; i<nSM; ++i) 
         {
@@ -159,7 +160,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
           SetEMCALChannelStatusMap(i,hbm);
           
         } // loop
-      } else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT remove EMCAL bad channels\n"); // run array
+      } else AliInfo("Do NOT remove EMCAL bad channels\n"); // run array
     }  // Remove bad
     
     // Energy Recalibration
@@ -181,8 +182,8 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
           
           if(recalib)
           {
-            printf("AliCalorimeterUtils::SetOADBParameters() - Recalibrate EMCAL \n");
-            for (Int_t i=0; i<nSM; ++i) 
+            AliInfo("Recalibrate EMCAL");
+            for (Int_t i=0; i < nSM; ++i)
             {
               TH2F *h = GetEMCALChannelRecalibrationFactors(i);
               
@@ -201,9 +202,9 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
               
               SetEMCALChannelRecalibrationFactors(i,h);
             } // SM loop
-          }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL, no params object array\n"); // array ok
-        }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for pass\n"); // array pass ok
-      }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n");  // run number array ok
+          } else AliInfo("Do NOT recalibrate EMCAL, no params object array"); // array ok
+        } else AliInfo("Do NOT recalibrate EMCAL, no params for pass"); // array pass ok
+      } else AliInfo("Do NOT recalibrate EMCAL, no params for run");  // run number array ok
       
       // once set, apply run dependent corrections if requested
       //fEMCALRecoUtils->SetRunDependentCorrections(runnumber);
@@ -245,7 +246,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
       
       if(htd)
       {
-        printf("AliCalorimeterUtils::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+        AliInfo("Recalibrate (Temperature) EMCAL");
         
         for (Int_t ism=0; ism<nSM; ++ism) 
         {        
@@ -263,7 +264,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
             } // columns
           } // rows 
         } // SM loop
-      }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n"); 
+      }else AliInfo("Do NOT recalibrate EMCAL with T variations, no params TH1");
     } // Run by Run T calibration    
     
     // Time Recalibration
@@ -283,7 +284,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
         
         if(trecalpass)
         {
-          printf("AliCalorimeterUtils::SetOADBParameters() - Time Recalibrate EMCAL \n");
+          AliInfo("Time Recalibrate EMCAL");
           for (Int_t ibc = 0; ibc < 4; ++ibc) 
           {
             TH1F *h = GetEMCALChannelTimeRecalibrationFactors(ibc);
@@ -303,8 +304,8 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
             
             SetEMCALChannelTimeRecalibrationFactors(ibc,h);
           } // bunch crossing loop
-        }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate time EMCAL, no params for pass\n"); // array pass ok
-      }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate time EMCAL, no params for run\n");  // run number array ok
+        } else AliInfo("Do NOT recalibrate time EMCAL, no params for pass"); // array pass ok
+      } else AliInfo("Do NOT recalibrate time EMCAL, no params for run");  // run number array ok
       
     } // Recalibration on    
     
@@ -313,7 +314,7 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
   // PHOS
   if(fOADBForPHOS)
   {
-    printf("AliCalorimeterUtils::SetOADBParameters() - Get AODB parameters from PHOS in %s for run %d, and <%s> \n",fOADBFilePathPHOS.Data(),runnumber,pass.Data());
+    AliInfo(Form("Get AODB parameters from PHOS in %s for run %d, and <%s>",fOADBFilePathPHOS.Data(),runnumber,pass.Data()));
     
     // Bad map
     if(fRemoveBadChannels)
@@ -326,11 +327,11 @@ void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
       TObjArray *maps = (TObjArray*)badmapContainer.GetObject(139000,"phosBadMap");
       if(!maps)
       {
-        printf("AliCalorimeterUtils::SetOADBParameters() - Can not read PHOS bad map for run %d.\n",runnumber) ;    
+        AliInfo(Form("Can not read PHOS bad map for run %d",runnumber)) ;
       }
       else
       {
-        printf("AliCalorimeterUtils::SetOADBParameters() - Setting PHOS bad map with name %s \n",maps->GetName()) ;
+        AliInfo(Form("Setting PHOS bad map with name %s",maps->GetName())) ;
         for(Int_t mod=1; mod<5;mod++)
         {
           TH2I *hbmPH = GetPHOSChannelStatusMap(mod);
@@ -369,7 +370,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
   {
     if(fLoadEMCALMatrices)
     {
-      printf("AliCalorimeterUtils::AccessGeometry() - Load user defined EMCAL geometry matrices\n");
+      AliInfo("Load user defined EMCAL geometry matrices");
       
       // OADB if available
       AliOADBContainer emcGeoMat("AliEMCALgeo");
@@ -380,9 +381,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
       {
         if (!fEMCALMatrix[mod]) // Get it from OADB
         {
-          if(fDebug > 1 ) 
-            printf("AliCalorimeterUtils::AccessGeometry() - EMCAL matrices SM %d, %p\n",
-                   mod,((TGeoHMatrix*) matEMCAL->At(mod)));
+          AliDebug(1,Form("EMCAL matrices SM %d, %p", mod,((TGeoHMatrix*) matEMCAL->At(mod))));
           //((TGeoHMatrix*) matEMCAL->At(mod))->Print();
           
           fEMCALMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod) ;
@@ -402,8 +401,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
     }//Load matrices
     else if (!gGeoManager) 
     { 
-      if(fDebug > 1) 
-        printf(" AliCalorimeterUtils::AccessGeometry() - Load EMCAL misalignment matrices. \n");
+      AliDebug(1,"Load EMCAL misalignment matrices");
       if(!strcmp(inputEvent->GetName(),"AliESDEvent"))  
       {
         for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
@@ -420,8 +418,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
       }//ESD as input
       else 
       {
-        if(fDebug > 1)
-          printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n");
+        AliDebug(1,"Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file");
       }//AOD as input
     }//Get matrix from data
     else if(gGeoManager)
@@ -435,7 +432,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
   {
     if(fLoadPHOSMatrices)
     {
-      printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load user defined PHOS geometry matrices\n");
+      AliInfo("Load user defined PHOS geometry matrices");
       
       // OADB if available
       AliOADBContainer geomContainer("phosGeo");
@@ -446,9 +443,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
       {
         if (!fPHOSMatrix[mod]) // Get it from OADB
         {
-          if(fDebug > 1 ) 
-            printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - PHOS matrices module %d, %p\n",
-                   mod,((TGeoHMatrix*) matPHOS->At(mod)));
+          AliDebug(1,Form("PHOS matrices module %d, %p",mod,((TGeoHMatrix*) matPHOS->At(mod))));
           //((TGeoHMatrix*) matPHOS->At(mod))->Print();
           
           fPHOSMatrix[mod] = (TGeoHMatrix*) matPHOS->At(mod) ;
@@ -469,8 +464,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
     }//Load matrices
     else if (!gGeoManager) 
     { 
-      if(fDebug > 1) 
-        printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load PHOS misalignment matrices. \n");
+      AliDebug(1,"Load PHOS misalignment matrices.");
                        if(!strcmp(inputEvent->GetName(),"AliESDEvent"))  
       {
                                for(Int_t mod = 0; mod < 5; mod++)
@@ -485,8 +479,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
                        }//ESD as input
                        else 
       {
-                               if(fDebug > 1) 
-                                       printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n");
+                               AliDebug(1,"Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file");
       }//AOD as input
     }// get matrix from data
     else if(gGeoManager)
@@ -498,7 +491,7 @@ void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
 }
 
 //________________________________________________________________________________________
-Bool_t AliCalorimeterUtils::AreNeighbours(TString calo, Int_t absId1, Int_t absId2 ) const
+Bool_t AliCalorimeterUtils::AreNeighbours(Int_t calo, Int_t absId1, Int_t absId2 ) const
 {
   // Tells if (true) or not (false) two cells are neighbours
   // A neighbour is defined as being two cells which share a side or corner
@@ -513,7 +506,7 @@ Bool_t AliCalorimeterUtils::AreNeighbours(TString calo, Int_t absId1, Int_t absI
   Int_t nSupMod1 = GetModuleNumberCellIndexes(absId1, calo, icol1, irow1, iRCU1); 
   Int_t nSupMod2 = GetModuleNumberCellIndexes(absId2, calo, icol2, irow2, iRCU2); 
   
-  if(calo=="EMCAL" && nSupMod1!=nSupMod2)
+  if(calo==kEMCAL && nSupMod1!=nSupMod2)
   {
     // In case of a shared cluster, index of SM in C side, columns start at 48 and ends at 48*2-1
     // C Side impair SM, nSupMod%2=1; A side pair SM nSupMod%2=0
@@ -586,9 +579,8 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
     }
   }
        
-       if(fDebug > 1)
-               printf("AliCalorimeterUtils::CheckCellFiducialRegion() - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", 
-           absIdMax, ampMax, cluster->E());
+       AliDebug(1,Form("Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f",
+                  absIdMax, ampMax, cluster->E()));
        
        if(absIdMax==-1) return kFALSE;
        
@@ -601,8 +593,9 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
                Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; 
                fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); 
                fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
-               if(iSM < 0 || iphi < 0 || ieta < 0 ) {
-      Fatal("CheckCellFidutialRegion","Negative value for super module: %d, or cell ieta: %d, or cell iphi: %d, check EMCAL geometry name\n",iSM,ieta,iphi);
+               if(iSM < 0 || iphi < 0 || ieta < 0 )
+    {
+      AliFatal(Form("Negative value for super module: %d, or cell ieta: %d, or cell iphi: %d, check EMCAL geometry name",iSM,ieta,iphi));
     }
     
                //Check rows/phi
@@ -640,13 +633,9 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
                        }
                }//eta 0 not checked
     
-               if(fDebug > 1)
-               {
-                       printf("AliCalorimeterUtils::CheckCellFiducialRegion() - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?",
-             nborder, ieta, iphi, iSM);
-                       if (okcol && okrow ) printf(" YES \n");
-                       else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
-               }
+    AliDebug(1,Form("EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ? ok row %d, ok column %d",
+                    nborder, ieta, iphi, iSM,okrow,okcol));
+
        }//EMCAL
        else if ( cells->GetType() == AliVCaloCells::kPHOSCell )
   {
@@ -656,15 +645,12 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
                irow = relId[2];
                icol = relId[3];
                //imod = relId[0]-1;
-               if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE; 
+       
+    if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE;
                if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE; 
-               if(fDebug > 1)
-               {
-                       printf("AliCalorimeterUtils::CheckCellFiducialRegion() - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d?",
-             fNCellsFromPHOSBorder, icol, irow, relId[0]-1);
-                       if (okcol && okrow ) printf(" YES \n");
-                       else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
-               }
+
+    AliDebug(1,Form("PHOS Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ? ok row %d, ok column %d",
+                    fNCellsFromPHOSBorder, icol, irow, relId[0]-1,okrow,okcol));
        }//PHOS
        
        if (okcol && okrow) return kTRUE; 
@@ -673,15 +659,15 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
 }      
 
 //__________________________________________________________________________________________________________
-Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(TString calorimeter, UShort_t* cellList, Int_t nCells)
+Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(Int_t calorimeter, UShort_t* cellList, Int_t nCells)
 {
        // Check that in the cluster cells, there is no bad channel of those stored 
        // in fEMCALBadChannelMap or fPHOSBadChannelMap
        
        if (!fRemoveBadChannels) return kFALSE;
        //printf("fEMCALBadChannelMap %p, fPHOSBadChannelMap %p \n",fEMCALBadChannelMap,fPHOSBadChannelMap);
-       if(calorimeter == "EMCAL" && !fEMCALRecoUtils->GetEMCALChannelStatusMap(0)) return kFALSE;
-       if(calorimeter == "PHOS"  && !fPHOSBadChannelMap)  return kFALSE;
+       if(calorimeter == kEMCAL && !fEMCALRecoUtils->GetEMCALChannelStatusMap(0)) return kFALSE;
+       if(calorimeter == kPHOS  && !fPHOSBadChannelMap)  return kFALSE;
   
        Int_t icol = -1;
        Int_t irow = -1;
@@ -689,10 +675,10 @@ Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(TString calorimeter, UShor
        for(Int_t iCell = 0; iCell<nCells; iCell++){
     
                //Get the column and row
-               if(calorimeter == "EMCAL"){
+               if(calorimeter == kEMCAL){
       return fEMCALRecoUtils->ClusterContainsBadChannel((AliEMCALGeometry*)fEMCALGeo,cellList,nCells);
                }
-               else if(calorimeter=="PHOS"){
+               else if(calorimeter==kPHOS){
                        Int_t    relId[4];
                        fPHOSGeo->AbsToRelNumbering(cellList[iCell],relId);
                        irow = relId[2];
@@ -740,8 +726,8 @@ Int_t  AliCalorimeterUtils::GetMaxEnergyCell(AliVCaloCells* cells, const AliVClu
   Int_t    cellAbsId   =-1 , absId =-1 ;
   Int_t    iSupMod     =-1 , ieta  =-1 , iphi = -1, iRCU = -1;
   
-  TString           calo = "EMCAL";
-  if(clu->IsPHOS()) calo = "PHOS";
+  Int_t             calo = kEMCAL;
+  if(clu->IsPHOS()) calo = kPHOS ;
   
   for (Int_t iDig=0; iDig< clu->GetNCells(); iDig++) {
     
@@ -753,8 +739,8 @@ Int_t  AliCalorimeterUtils::GetMaxEnergyCell(AliVCaloCells* cells, const AliVClu
     iSupMod = GetModuleNumberCellIndexes(cellAbsId, calo, ieta, iphi, iRCU);
     
     if(IsRecalibrationOn()) {
-      if(calo=="EMCAL") recalFactor = GetEMCALChannelRecalibrationFactor(iSupMod,ieta,iphi);
-      else              recalFactor = GetPHOSChannelRecalibrationFactor (iSupMod,iphi,ieta);
+      if(calo==kEMCAL) recalFactor = GetEMCALChannelRecalibrationFactor(iSupMod,ieta,iphi);
+      else             recalFactor = GetPHOSChannelRecalibrationFactor (iSupMod,iphi,ieta);
     }
     
     eCell  = cells->GetCellAmplitude(cellAbsId)*fraction*recalFactor;
@@ -794,7 +780,7 @@ AliVTrack * AliCalorimeterUtils::GetMatchedTrack(AliVCluster* cluster,
     
     if(trackIndex < 0 )
     { 
-      printf("AliCalorimeterUtils::GetMatchedTrack() - Wrong track index %d, from recalculation\n", trackIndex);
+      AliInfo(Form("Wrong track index %d, from recalculation", trackIndex));
     }
     else 
     {
@@ -813,7 +799,7 @@ AliVTrack * AliCalorimeterUtils::GetMatchedTrack(AliVCluster* cluster,
     
     if(iESDtrack < 0 )
     { 
-      printf("AliCalorimeterUtils::GetMatchedTrack() - Wrong track index %d\n", index);
+      AliWarning(Form("Wrong track index %d", index));
       return 0x0;
     }
     
@@ -835,7 +821,7 @@ Float_t AliCalorimeterUtils::GetMCECellClusFracCorrection(Float_t eCell, Float_t
   // Correction factor for cell energy in cluster to temptatively match Data and MC
   if( eCluster <= 0 || eCluster < eCell )
   {
-    printf("AliCalorimeterUtils::GetMCECellClusFracCorrection() - Bad values eCell=%f, eCluster %f\n",eCell,eCluster);
+    AliWarning(Form("Bad values eCell=%f, eCluster %f",eCell,eCluster));
     return 1;
   }
   
@@ -858,17 +844,16 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEv
        //Get the EMCAL/PHOS module number that corresponds to this particle
        
        Int_t absId = -1;
-       if(particle->GetDetector()=="EMCAL")
+       if(particle->GetDetectorTag()==kEMCAL)
   {
                fEMCALGeo->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(), absId);
     
-               if(fDebug > 2)
-                 printf("AliCalorimeterUtils::GetModuleNumber(PWG4AOD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
-             particle->Eta(), particle->Phi()*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId));
+    AliDebug(2,Form("EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d",
+                    particle->Eta(), particle->Phi()*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId)));
     
                return fEMCALGeo->GetSuperModuleNumber(absId) ;
        }//EMCAL
-       else if(particle->GetDetector()=="PHOS")
+       else if(particle->GetDetectorTag()==kPHOS)
   {
     // In case we use the MC reader, the input are TParticles,
     // in this case use the corresponing method in PHOS Geometry to get the particle.
@@ -884,7 +869,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEv
       }
       else
       {
-        Fatal("GetModuleNumber(PWG4AOD)", "Stack not available, stop!");
+        AliFatal("Stack not available, stop!");
       }
       
       if(primary)
@@ -893,7 +878,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEv
       }
       else
       {
-        Fatal("GetModuleNumber(PWG4AOD)", "Primary not available, stop!");
+        AliFatal("Primary not available, stop!");
       }
       return mod;
     }
@@ -918,7 +903,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
   
   if(!cluster)
   {
-    if(fDebug > 1) printf("AliCalorimeterUtils::GetModuleNumber() - NUL Cluster, please check!!!");
+    AliDebug(1,"AliCalorimeterUtils::GetModuleNumber() - NUL Cluster, please check!!!");
     
     return -1;
   }
@@ -931,7 +916,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
   
        if( cluster->IsEMCAL() )
   {
-               if(fDebug > 2) printf("AliCalorimeterUtils::GetModuleNumber() - EMCAL absid %d, SuperModule %d\n",absId, fEMCALGeo->GetSuperModuleNumber(absId));
+               AliDebug(2,Form("EMCAL absid %d, SuperModule %d",absId, fEMCALGeo->GetSuperModuleNumber(absId)));
     
                return fEMCALGeo->GetSuperModuleNumber(absId) ;
        }//EMCAL
@@ -940,7 +925,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
                Int_t    relId[4];
     fPHOSGeo->AbsToRelNumbering(absId,relId);
     
-    if(fDebug > 2) printf("AliCalorimeterUtils::GetModuleNumber() - PHOS absid %d Module %d\n",absId, relId[0]-1);
+    AliDebug(2,Form("PHOS absid %d Module %d",absId, relId[0]-1));
     
     return relId[0]-1;
   }//PHOS
@@ -949,7 +934,7 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
 }
 
 //___________________________________________________________________________________________________
-Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, TString calo,
+Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, Int_t calo,
                                                       Int_t & icol, Int_t & irow, Int_t & iRCU) const
 {
        //Get the EMCAL/PHOS module, columns, row and RCU number that corresponds to this absId
@@ -958,7 +943,7 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, TString calo,
   
        if ( absId < 0) return -1 ;
   
-  if ( calo == "EMCAL" )
+  if ( calo == kEMCAL )
   {
     Int_t iTower = -1, iIphi = -1, iIeta = -1;
     fEMCALGeo->GetCellIndex(absId,imod,iTower,iIphi,iIeta);
@@ -966,7 +951,7 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, TString calo,
     
     if(imod < 0 || irow < 0 || icol < 0 )
     {
-      Fatal("GetModuleNumberCellIndexes()","Negative value for super module: %d, or cell icol: %d, or cell irow: %d, check EMCAL geometry name\n",imod,icol,irow);
+      AliFatal(Form("Negative value for super module: %d, or cell icol: %d, or cell irow: %d, check EMCAL geometry name",imod,icol,irow));
     }
     
     //RCU0
@@ -988,9 +973,9 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, TString calo,
       iRCU = 0 ;
     }
     
-    if (iRCU<0)
+    if (iRCU < 0)
     {
-      Fatal("GetModuleNumberCellIndexes()","Wrong EMCAL RCU number = %d\n", iRCU);
+      AliFatal(Form("Wrong EMCAL RCU number = %d", iRCU));
     }
     
     return imod ;
@@ -1007,7 +992,7 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(Int_t absId, TString calo,
     //Int_t iBranch= (Int_t)(relid[3]-1)/28 ; //0 to 1
     if (iRCU >= 4)
     {
-      Fatal("GetModuleNumberCellIndexes()","Wrong PHOS RCU number = %d\n", iRCU);
+      AliFatal(Form("Wrong PHOS RCU number = %d", iRCU));
     }
     return imod;
   }//PHOS
@@ -1051,8 +1036,8 @@ Int_t AliCalorimeterUtils::GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCalo
     simuTotWeight/= eCluster;
   }
   
-  TString calorimeter = "EMCAL";
-  if(!cluster->IsEMCAL()) calorimeter = "PHOS";
+  Int_t calorimeter = kEMCAL;
+  if(!cluster->IsEMCAL()) calorimeter = kPHOS;
   
   //printf("cluster : ncells %d \n",nCells);
   
@@ -1161,24 +1146,21 @@ Int_t AliCalorimeterUtils::GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCalo
   
   if(iDigitN == 0)
   {
-    if(fDebug > 0) 
-      printf("AliCalorimeterUtils::GetNumberOfLocalMaxima() - No local maxima found, assign highest energy cell as maxima, id %d, en cell %2.2f, en cluster %2.2f\n",
-             idmax,emax,cluster->E());
+    AliDebug(1,Form("No local maxima found, assign highest energy cell as maxima, id %d, en cell %2.2f, en cluster %2.2f",
+                    idmax,emax,cluster->E()));
     iDigitN      = 1     ;
     maxEList[0]  = emax  ;
     absIdList[0] = idmax ; 
   }
   
-  if(fDebug > 0) 
-  {    
-    printf("AliCalorimeterUtils::GetNumberOfLocalMaxima() - In cluster E %2.2f (wth non lin. %2.2f), M02 %2.2f, M20 %2.2f, N maxima %d \n",
-           cluster->E(),eCluster, cluster->GetM02(),cluster->GetM20(), iDigitN);
   
-    if(fDebug > 1) for(Int_t imax = 0; imax < iDigitN; imax++) 
-    {
-      printf(" \t i %d, absId %d, Ecell %f\n",imax,absIdList[imax],maxEList[imax]);
-    }
-  }
+  AliDebug(1,Form("In cluster E %2.2f (wth non lin. %2.2f), M02 %2.2f, M20 %2.2f, N maxima %d",
+                  cluster->E(),eCluster, cluster->GetM02(),cluster->GetM20(), iDigitN));
+  
+//  if(fDebug > 1) for(Int_t imax = 0; imax < iDigitN; imax++)
+//  {
+//    printf(" \t i %d, absId %d, Ecell %f\n",imax,absIdList[imax],maxEList[imax]);
+//  }
   
   return iDigitN ;
   
@@ -1191,13 +1173,13 @@ TString AliCalorimeterUtils::GetPass()
     
   if (!AliAnalysisManager::GetAnalysisManager()->GetTree()) 
   {
-    AliError("AliCalorimeterUtils::GetPass() - Pointer to tree = 0, returning null\n");
+    AliError("AliCalorimeterUtils::GetPass() - Pointer to tree = 0, returning null");
     return TString("");
   }
   
   if (!AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()) 
   {
-    AliError("AliCalorimeterUtils::GetPass() - Null pointer input file, returning null\n");
+    AliError("AliCalorimeterUtils::GetPass() - Null pointer input file, returning null");
     return TString("");
   }
   
@@ -1210,12 +1192,12 @@ TString AliCalorimeterUtils::GetPass()
   else if (pass.Contains("LHC11c") && pass.Contains("spc_calo") ) return TString("spc_calo");
   else if (pass.Contains("calo") || pass.Contains("high_lumi"))
   {
-    printf("AliCalorimeterUtils::GetPass() - Path contains <calo> or <high-lumi>, set as <pass1>\n");
+    AliInfo("Path contains <calo> or <high-lumi>, set as <pass1>");
     return TString("pass1");
   }
 
   // No condition fullfilled, give a default value
-  printf("AliCalorimeterUtils::GetPass() - Pass number string not found \n");
+  AliInfo("Pass number string not found");
   return TString("");            
   
 }
@@ -1269,7 +1251,8 @@ void AliCalorimeterUtils::InitParameters()
 void AliCalorimeterUtils::InitPHOSBadChannelStatusMap()
 {
   //Init PHOS bad channels map
-  if(fDebug > 0 )printf("AliCalorimeterUtils::InitPHOSBadChannelStatusMap()\n");
+  AliDebug(1,"Init bad channel map");
+  
   //In order to avoid rewriting the same histograms
   Bool_t oldStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
@@ -1288,8 +1271,9 @@ void AliCalorimeterUtils::InitPHOSBadChannelStatusMap()
 void AliCalorimeterUtils::InitPHOSRecalibrationFactors()
 {
        //Init EMCAL recalibration factors
-       if(fDebug > 0 )printf("AliCalorimeterUtils::InitPHOSRecalibrationFactors()\n");
-       //In order to avoid rewriting the same histograms
+  AliDebug(1,"Init recalibration map");
+
+  //In order to avoid rewriting the same histograms
        Bool_t oldStatus = TH1::AddDirectoryStatus();
        TH1::AddDirectory(kFALSE);
   
@@ -1314,47 +1298,44 @@ void AliCalorimeterUtils::InitPHOSRecalibrationFactors()
 //__________________________________________________________
 void AliCalorimeterUtils::InitEMCALGeometry(Int_t runnumber)
 {
-       //Initialize EMCAL geometry if it did not exist previously
+  //Initialize EMCAL geometry if it did not exist previously
+  
+  if (fEMCALGeo) return;
   
-       if (!fEMCALGeo)
+  AliDebug(1,Form(" for run=%d",runnumber));
+  
+  if(fEMCALGeoName=="")
   {
-    if(fEMCALGeoName=="")
-    {
-      if     (runnumber <  140000 && 
-              runnumber >= 100000)   fEMCALGeoName = "EMCAL_FIRSTYEARV1";
-      else if(runnumber >= 140000 &&
-              runnumber <  171000)   fEMCALGeoName = "EMCAL_COMPLETEV1";
-      else                           fEMCALGeoName = "EMCAL_COMPLETE12SMV1";  
-      printf("AliCalorimeterUtils::InitEMCALGeometry() - Set EMCAL geometry name to <%s> for run %d\n",fEMCALGeoName.Data(),runnumber);
-    }
-    
-               fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName);
-    
-    // Init geometry, I do not like much to do it like this ...
-    if(fImportGeometryFromFile && !gGeoManager)
+    if     (runnumber <  140000 &&
+            runnumber >= 100000)   fEMCALGeoName = "EMCAL_FIRSTYEARV1";
+    else if(runnumber >= 140000 &&
+            runnumber <  171000)   fEMCALGeoName = "EMCAL_COMPLETEV1";
+    else                           fEMCALGeoName = "EMCAL_COMPLETE12SMV1";
+    AliInfo(Form("Set EMCAL geometry name to <%s> for run %d",fEMCALGeoName.Data(),runnumber));
+  }
+  
+  fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName);
+  
+  // Init geometry, I do not like much to do it like this ...
+  if(fImportGeometryFromFile && !gGeoManager)
+  {
+    if(fImportGeometryFilePath=="") // If not specified, set location depending on run number
     {
-      if(fImportGeometryFilePath=="") // If not specified, set location depending on run number
-      {
-        // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
-        if     (runnumber <  140000 &&
-                runnumber >= 100000) fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2010.root";
-        if     (runnumber >= 140000 &&
-                runnumber <  171000) fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root";
-        else                         fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2012.root"; // 2012-2013
-
-      }
-      printf("AliCalorimeterUtils::InitEMCALGeometry() - Import %s\n",fImportGeometryFilePath.Data());
-      TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
+      // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
+      if     (runnumber <  140000 &&
+              runnumber >= 100000) fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2010.root";
+      if     (runnumber >= 140000 &&
+              runnumber <  171000) fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root";
+      else                         fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2012.root"; // 2012-2013
+      
     }
-
     
-               if(fDebug > 0)
-    {
-                       printf("AliCalorimeterUtils::InitEMCALGeometry(run=%d)",runnumber);
-                       if (!gGeoManager) printf(" - Careful!, gGeoManager not loaded, load misalign matrices");
-                       printf("\n");
-               }
-       }
+    AliInfo(Form("Import %s",fImportGeometryFilePath.Data()));
+    TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
+  }
+  else if (!gGeoManager) AliInfo("Careful!, gGeoManager not loaded, load misalign matrices");
+               
+  
 }
 
 //_________________________________________________________
@@ -1362,42 +1343,39 @@ void AliCalorimeterUtils::InitPHOSGeometry(Int_t runnumber)
 {
        //Initialize PHOS geometry if it did not exist previously
   
-       if (!fPHOSGeo)
-  {
-    if(fPHOSGeoName=="") fPHOSGeoName = "PHOSgeo";
-      
-               fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName); 
-    
-               if(fDebug > 0)
-    {
-                       printf("AliCalorimeterUtils::InitPHOSGeometry(run=%d)",runnumber);
-                       if (!gGeoManager) printf(" - Careful!, gGeoManager not loaded, load misalign matrices");
-                       printf("\n");
-               }       
-       }       
+  if (fPHOSGeo) return;
+  
+  AliDebug(1,Form(" for run=%d",runnumber));
+  
+  if(fPHOSGeoName=="") fPHOSGeoName = "PHOSgeo";
+  
+  fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName);
+  
+  //if (!gGeoManager) AliInfo("Careful!, gGeoManager not loaded, load misalign matrices");
+       
 }
 
 //_______________________________________________________________________________________________
-Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TParticle* particle)
+Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, TParticle* particle)
 {
   // Check that a MC ESD is in the calorimeter acceptance
   
-  if(!particle || (calo!="EMCAL" && calo!="PHOS")) return kFALSE ;
+  if(!particle || (calo!=kEMCAL && calo!=kPHOS)) return kFALSE ;
     
-  if( (!IsPHOSGeoMatrixSet () && calo == "PHOS" ) ||
-      (!IsEMCALGeoMatrixSet() && calo == "EMCAL")   )
+  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
+      (!IsEMCALGeoMatrixSet() && calo == kEMCAL)   )
   {
-    AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data()));
+    AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
     return kFALSE ;
   }
 
-  if(calo == "PHOS" )
+  if(calo == kPHOS )
   {
     Int_t mod = 0 ;
     Double_t x = 0, z = 0 ;
     return GetPHOSGeometry()->ImpactOnEmc( particle, mod, z, x);
   }
-  else if(calo == "EMCAL")
+  else if(calo == kEMCAL)
   {
     Int_t absID = 0 ;
     Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(),absID);
@@ -1415,30 +1393,30 @@ Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TP
 }
 
 //______________________________________________________________________________________________________
-Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, AliAODMCParticle* particle)
+Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, AliAODMCParticle* particle)
 {
   // Check that a MC AOD is in the calorimeter acceptance
   
-  if(!particle || (calo!="EMCAL" && calo!="PHOS")) return kFALSE ;
+  if(!particle || (calo!=kEMCAL && calo!=kPHOS)) return kFALSE ;
   
-  if( (!IsPHOSGeoMatrixSet () && calo == "PHOS" ) ||
-      (!IsEMCALGeoMatrixSet() && calo == "EMCAL")   )
+  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
+      (!IsEMCALGeoMatrixSet() && calo == kEMCAL)   )
   {
-    AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data()));
+    AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
     return kFALSE ;
   }
 
   Float_t phi = particle->Phi();
   if(phi < 0) phi+=TMath::TwoPi();
   
-  if(calo == "PHOS" )
+  if(calo == kPHOS )
   {
     Int_t mod = 0 ;
     Double_t x = 0, z = 0 ;
     Double_t vtx[]={ particle->Xv(), particle->Yv(), particle->Zv() } ;
     return GetPHOSGeometry()->ImpactOnEmc(vtx, particle->Theta(), phi, mod, z, x) ;
   }
-  else if(calo == "EMCAL")
+  else if(calo == kEMCAL)
   {
     Int_t absID = 0 ;
     Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),phi,absID);
@@ -1455,33 +1433,34 @@ Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, Al
   return kFALSE ;
 }
 
-//_____________________________________________________________________________________________________________________
-Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TLorentzVector particle, Int_t & absID)
+//_____________________________________________________________________________________________________
+Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, Float_t eta, Float_t theta,
+                                                                Float_t phiOrg, Int_t & absID)
 {
   // Check that a TLorentzVector is in the calorimeter acceptance, give the cell number where it hit
   
-  if(calo!="EMCAL" && calo!="PHOS") return kFALSE ;
+  if(calo!=kEMCAL && calo!=kPHOS) return kFALSE ;
   
-  if( (!IsPHOSGeoMatrixSet () && calo == "PHOS" ) ||
-      (!IsEMCALGeoMatrixSet() && calo == "EMCAL")   )
+  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
+      (!IsEMCALGeoMatrixSet() && calo == kEMCAL)   )
   {
-    AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data()));
+    AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
     return kFALSE ;
   }
 
-  Float_t phi = particle.Phi();
+  Float_t phi = phiOrg;
   if(phi < 0) phi+=TMath::TwoPi();
 
-  if(calo == "PHOS" )
+  if(calo == kPHOS )
   {
     Int_t mod = 0 ;
     Double_t x = 0, z = 0 ;
     Double_t vtx[]={0,0,0} ;
-    return GetPHOSGeometry()->ImpactOnEmc(vtx, particle.Theta(), phi, mod, z, x) ;
+    return GetPHOSGeometry()->ImpactOnEmc(vtx, theta, phi, mod, z, x) ;
   }
-  else if(calo == "EMCAL")
+  else if(calo == kEMCAL)
   {
-    Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle.Eta(),phi,absID);
+    Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(eta,phi,absID);
     if(ok)
     {
       Int_t icol = -1, irow = -1, iRCU = -1;
@@ -1541,7 +1520,7 @@ void AliCalorimeterUtils::Print(const Option_t * opt) const
 } 
 
 //_____________________________________________________________________________________________
-void AliCalorimeterUtils::RecalibrateCellAmplitude(Float_t & amp, TString calo, Int_t id) const
+void AliCalorimeterUtils::RecalibrateCellAmplitude(Float_t & amp, Int_t calo, Int_t id) const
 {
   //Recaculate cell energy if recalibration factor
   
@@ -1550,7 +1529,7 @@ void AliCalorimeterUtils::RecalibrateCellAmplitude(Float_t & amp, TString calo,
   
   if (IsRecalibrationOn()) 
   {
-    if(calo == "PHOS") 
+    if(calo == kPHOS)
     {
       amp *= GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
     }
@@ -1562,12 +1541,12 @@ void AliCalorimeterUtils::RecalibrateCellAmplitude(Float_t & amp, TString calo,
 }
 
 //____________________________________________________________________________________________________
-void AliCalorimeterUtils::RecalibrateCellTime(Double_t & time, TString calo, Int_t id, Int_t bc) const
+void AliCalorimeterUtils::RecalibrateCellTime(Double_t & time, Int_t calo, Int_t id, Int_t bc) const
 {
   // Recalculate time if time recalibration available for EMCAL
   // not ready for PHOS
   
-  if(calo == "EMCAL" && GetEMCALRecoUtils()->IsTimeRecalibrationOn()) 
+  if(calo == kEMCAL && GetEMCALRecoUtils()->IsTimeRecalibrationOn()) 
   {
     GetEMCALRecoUtils()->RecalibrateCellTime(id,bc,time);
   }
@@ -1592,9 +1571,8 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster,
     
     Int_t ncells     = cluster->GetNCells();   
     
-    TString calo     = "EMCAL";
-    if(cluster->IsPHOS()) 
-      calo = "PHOS";
+    Int_t calo = kEMCAL;
+    if(cluster->IsPHOS()) calo = kPHOS ;
     
     //Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
     for(Int_t icell = 0; icell < ncells; icell++){
@@ -1607,26 +1585,24 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster,
       Float_t amp = cells->GetCellAmplitude(absId);
       RecalibrateCellAmplitude(amp,calo, absId);
       
-      if(fDebug>2)
-        printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - recalibrate cell: %s, cell fraction %f, cell energy %f\n", 
-               calo.Data(),frac,cells->GetCellAmplitude(absId));
+      AliDebug(2,Form("Recalibrate cell: calo <%d>, cell fraction %f, cell energy %f",
+                      calo,frac,cells->GetCellAmplitude(absId)));
       
       energy += amp*frac;
     }
     
-    if(fDebug>1)
-      printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - Energy before %f, after %f\n",cluster->E(),energy);
+    AliDebug(1,Form("Energy before %f, after %f",cluster->E(),energy));
     
        }// cells available
   else
   {
-    Fatal("RecalibrateClusterEnergy()","Cells pointer does not exist!");
+    AliFatal("Cells pointer does not exist!");
   }
   
        return energy;
 }
 
-//__________________________________________________________________________
+//_______________________________________________________________________________________________________
 Float_t AliCalorimeterUtils::RecalibrateClusterEnergyWeightCell(AliVCluster * cluster,
                                                                 AliVCaloCells * cells, Float_t energyOrg)
 {
@@ -1645,13 +1621,12 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergyWeightCell(AliVCluster * cl
     
     Int_t ncells     = cluster->GetNCells();
     
-    TString calo     = "EMCAL";
-    if(cluster->IsPHOS())
-      calo = "PHOS";
+    Int_t calo = kEMCAL;
+    if(cluster->IsPHOS()) calo = kPHOS ;
     
     //Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
-    for(Int_t icell = 0; icell < ncells; icell++){
-      
+    for(Int_t icell = 0; icell < ncells; icell++)
+    {
       Int_t absId = index[icell];
       
       frac =  fraction[icell];
@@ -1662,20 +1637,18 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergyWeightCell(AliVCluster * cl
       
       amp*=GetMCECellClusFracCorrection(amp,energyOrg);
       
-      if(fDebug>2)
-        printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - recalibrate cell: %s, cell fraction %f, cell energy %f\n",
-               calo.Data(),frac,cells->GetCellAmplitude(absId));
+      AliDebug(2,Form("Recalibrate cell: calo <%d>, cell fraction %f, cell energy %f",
+                      calo,frac,cells->GetCellAmplitude(absId)));
       
       energy += amp*frac;
     }
     
-    if(fDebug>1)
-      printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - Energy before %f, after %f\n",cluster->E(),energy);
+    AliDebug(1,Form("Energy before %f, after %f",cluster->E(),energy));
     
        }// cells available
   else
   {
-    Fatal("RecalibrateClusterEnergy()","Cells pointer does not exist!");
+    AliFatal("Cells pointer does not exist!");
   }
   
        return energy;
@@ -1743,11 +1716,11 @@ void AliCalorimeterUtils::SplitEnergy(Int_t absId1, Int_t absId2,
     hCluster2      ->SetYTitle("row");
   }
   
-  TString calorimeter = "EMCAL";
+  Int_t calorimeter = kEMCAL;
   if(cluster->IsPHOS())
   {
-    calorimeter="PHOS";
-    printf("AliCalorimeterUtils::SplitEnerg() Not supported for PHOS yet \n");
+    calorimeter=kPHOS;
+    AliWarning("Not supported for PHOS yet");
     return;
   }
   
@@ -1866,9 +1839,9 @@ void AliCalorimeterUtils::SplitEnergy(Int_t absId1, Int_t absId2,
     
   }
   
-  if(GetDebug() > 1) printf("AliCalorimeterUtils::SplitEnergy() - n Local Max %d, Cluster energy  = %f, Ecell1 = %f, Ecell2 = %f, Enew1 = %f, Enew2 = %f, Remain %f, \n ncells %d, ncells1 %d, ncells2 %d, f1 %f, f2  %f, sum f12 = %f \n",
-                            nMax, eCluster,ecell1,ecell2,e1,e2,eCluster-e1-e2,ncells,ncells1,ncells2,shareFraction1,shareFraction2,shareFraction1+shareFraction2);
-  
+  AliDebug(1,Form("N Local Max %d, Cluster energy  = %f, Ecell1 = %f, Ecell2 = %f, Enew1 = %f, Enew2 = %f, Remain %f, \n ncells %d, ncells1 %d, ncells2 %d, f1 %f, f2  %f, sum f12 = %f",
+                  nMax, eCluster,ecell1,ecell2,e1,e2,eCluster-e1-e2,ncells,ncells1,ncells2,shareFraction1,shareFraction2,shareFraction1+shareFraction2));
+           
   cluster1->SetE(e1);
   cluster2->SetE(e2);  
   
@@ -1885,7 +1858,7 @@ void AliCalorimeterUtils::SplitEnergy(Int_t absId1, Int_t absId2,
   CorrectClusterEnergy(cluster1) ;
   CorrectClusterEnergy(cluster2) ;
   
-  if(calorimeter=="EMCAL")
+  if(calorimeter==kEMCAL)
   {
     GetEMCALRecoUtils()->RecalculateClusterPosition(GetEMCALGeometry(), cells, cluster1);
     GetEMCALRecoUtils()->RecalculateClusterPosition(GetEMCALGeometry(), cells, cluster2);
index bc0e613ba2c6f141fff6663a202e839efaec688f..3372ff9661936641095bdd8e5dad3bd783fb7170 100755 (executable)
@@ -48,7 +48,7 @@ class AliCalorimeterUtils : public TObject {
        
   // Cluster contents
   
-  Bool_t        AreNeighbours(TString calo, Int_t absId1, Int_t absId2) const ;
+  Bool_t        AreNeighbours(Int_t calo, Int_t absId1, Int_t absId2) const ;
 
   Bool_t        IsClusterSharedByTwoSuperModules(const AliEMCALGeometry * geom,
                                                  AliVCluster* cluster);
@@ -102,9 +102,9 @@ class AliCalorimeterUtils : public TObject {
                                                              fImportGeometryFromFile = import    ;
                                                              fImportGeometryFilePath = path      ; } // EMCAL
   
-  Bool_t        IsMCParticleInCalorimeterAcceptance(TString calo, TParticle* particle);
-  Bool_t        IsMCParticleInCalorimeterAcceptance(TString calo, AliAODMCParticle* particle);
-  Bool_t        IsMCParticleInCalorimeterAcceptance(TString calo, TLorentzVector particle, Int_t & absID);
+  Bool_t        IsMCParticleInCalorimeterAcceptance(Int_t calo, TParticle* particle);
+  Bool_t        IsMCParticleInCalorimeterAcceptance(Int_t calo, AliAODMCParticle* particle);
+  Bool_t        IsMCParticleInCalorimeterAcceptance(Int_t calo, Float_t eta, Float_t theta, Float_t phi, Int_t & absID);
   
   void          SwitchOnLoadOwnEMCALGeometryMatrices()     { fLoadEMCALMatrices = kTRUE   ; }
   void          SwitchOffLoadOwnEMCALGeometryMatrices()    { fLoadEMCALMatrices = kFALSE  ; }
@@ -151,7 +151,8 @@ class AliCalorimeterUtils : public TObject {
   void          SetEMCALChannelStatusMap(TObjArray *map)   { fEMCALRecoUtils->SetEMCALChannelStatusMap(map)           ; }
   void          SetPHOSChannelStatusMap (TObjArray *map)   { fPHOSBadChannelMap  = map                                ; }
        
-  Bool_t        ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
+  Bool_t        ClusterContainsBadChannel(Int_t calo,UShort_t* cellList, Int_t nCells);
+  Bool_t        ClusterContainsBadChannel(TString /*calo*/,UShort_t* /*cellList*/, Int_t /*nCells*/); // Stupid thing to do but just to avoid compilation break in AliTrackComparisonESD while I find the authors
        
   // Mask clusters in front of frame, EMCAL only
   Int_t         GetNMaskCellColumns()                const { return fNMaskCellColumns;}
@@ -167,7 +168,7 @@ class AliCalorimeterUtils : public TObject {
   //Calorimeter indexes information
   Int_t         GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
   Int_t         GetModuleNumber(AliVCluster * cluster) const;
-  Int_t         GetModuleNumberCellIndexes(Int_t absId, TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
+  Int_t         GetModuleNumberCellIndexes(Int_t absId, Int_t calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
        
   //Modules fiducial region
   Bool_t        CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells) const ;
@@ -214,8 +215,8 @@ class AliCalorimeterUtils : public TObject {
   void          SetEMCALChannelRecalibrationFactors(TObjArray *map)      { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(map)        ; }
   void          SetPHOSChannelRecalibrationFactors (TObjArray *map)      { fPHOSRecalibrationFactors  = map;}
 
-  void          RecalibrateCellTime     (Double_t & time, TString calo, Int_t absId, Int_t bunchCrossNumber) const ;
-  void          RecalibrateCellAmplitude(Float_t  & amp,  TString calo, Int_t absId) const ;
+  void          RecalibrateCellTime     (Double_t & time, Int_t calo, Int_t absId, Int_t bunchCrossNumber) const ;
+  void          RecalibrateCellAmplitude(Float_t  & amp,  Int_t calo, Int_t absId) const ;
   Float_t       RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells);
   Float_t       RecalibrateClusterEnergyWeightCell(AliVCluster* cluster, AliVCaloCells * cells, Float_t energyOrg);
 
@@ -309,6 +310,8 @@ class AliCalorimeterUtils : public TObject {
   void          SetNumberOfSuperModulesUsed(Int_t nSM)          { fNSuperModulesUsed  = nSM     ; }
   Int_t         GetNumberOfSuperModulesUsed()             const { return fNSuperModulesUsed     ; }
   
+  enum detector { kEMCAL = 0, kPHOS = 1, kCTS = 2, kDCAL = 3, kDCALPHOS = 4 };
+  
  private:
 
   Int_t              fDebug;                 //  Debugging level
index b5cdad77fc67adb991be7aaac7643fea42fd0c56..ca821944040aeb48edfe67696cfe9337c5df4fd2 100755 (executable)
 
 // --- ROOT system ---
 #include <TMath.h>
-#include <TLorentzVector.h>
+//#include <TLorentzVector.h>
 #include <TString.h>
 
 //---- ANALYSIS system ----
 #include "AliFiducialCut.h"
+#include <AliLog.h>
 
 ClassImp(AliFiducialCut)
 
@@ -38,11 +39,11 @@ ClassImp(AliFiducialCut)
 //________________________________
 AliFiducialCut::AliFiducialCut() : 
 TObject(),
-fEMCALFiducialCut(0),   fPHOSFiducialCut(0),    fCTSFiducialCut(0),
+fEMCALFiducialCut(0),   fDCALFiducialCut(0),    fPHOSFiducialCut(0),     fCTSFiducialCut(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)
-
+fPHOSFidCutMinEta(0x0), fPHOSFidCutMinPhi(0x0), fPHOSFidCutMaxEta(0x0),  fPHOSFidCutMaxPhi(0x0),
+fDCALFidCutMinEta(0x0), fDCALFidCutMinPhi(0x0), fDCALFidCutMaxEta(0x0),  fDCALFidCutMaxPhi(0x0)
 {
   //Ctor
   
@@ -71,53 +72,83 @@ AliFiducialCut::~AliFiducialCut()
   if(fPHOSFidCutMaxEta)  delete fPHOSFidCutMaxEta ;
   if(fPHOSFidCutMaxPhi)  delete fPHOSFidCutMaxPhi ;
   
+  if(fDCALFidCutMinEta)  delete fDCALFidCutMinEta ;
+  if(fDCALFidCutMinPhi)  delete fDCALFidCutMinPhi ;
+  if(fDCALFidCutMaxEta)  delete fDCALFidCutMaxEta ;
+  if(fDCALFidCutMaxPhi)  delete fDCALFidCutMaxPhi ;
 }
 
 
+////________________________________________________________________________________
+//Bool_t AliFiducialCut::IsInFiducialCut(TLorentzVector momentum, TString det) const
+//{
+//  // Selects EMCAL or PHOS cluster or CTS track if it is inside eta-phi defined regions
+//  Int_t idet = -1;
+//  if     (det=="EMCAL") idet = kEMCAL;
+//  else if(det=="PHOS" ) idet = kPHOS;
+//  else if(det=="CTS")   idet = kCTS;
+//  else if(det=="DCAL")  idet = kDCAL;
+//  else if(det.Contains("DCAL") && det.Contains("PHOS")) idet = kDCALPHOS;
+//  else
+//  {
+//    AliFatal(Form("Detector < %s > not known!", det.Data()));
+//    return kFALSE;
+//  }
+//  
+//  return IsInFiducialCut(momentum.Eta(), momentum.Phi(), idet);
+//}
+
 //________________________________________________________________________________
-Bool_t AliFiducialCut::IsInFiducialCut(TLorentzVector momentum, TString det) const
+Bool_t AliFiducialCut::IsInFiducialCut(Float_t eta, Float_t phi, Int_t det) const
 {
-  //Selects EMCAL or PHOS cluster or CTS track if it is inside eta-phi defined regions
+  // Selects EMCAL or PHOS cluster or CTS track if it is inside eta-phi defined regions
   
-  if(det == "CTS")
+  if(det == kCTS)
   {
          if(!fCTSFiducialCut)  
       return kTRUE; //Fiducial cut not requested, accept all tracks  
          else 
-      return CheckFiducialRegion(momentum, fCTSFidCutMinPhi  , fCTSFidCutMaxPhi , fCTSFidCutMinEta  , fCTSFidCutMaxEta  );
+      return CheckFiducialRegion(eta,phi, fCTSFidCutMinPhi  , fCTSFidCutMaxPhi , fCTSFidCutMinEta  , fCTSFidCutMaxEta  );
   }
-  else   if(det == "EMCAL") 
+  else   if(det == kEMCAL)
   {
          if(!fEMCALFiducialCut) 
       return kTRUE; //Fiducial cut not requested, accept all clusters  
          else                   
-      return CheckFiducialRegion(momentum, fEMCALFidCutMinPhi, fEMCALFidCutMaxPhi, fEMCALFidCutMinEta, fEMCALFidCutMaxEta);
+      return CheckFiducialRegion(eta,phi, fEMCALFidCutMinPhi, fEMCALFidCutMaxPhi, fEMCALFidCutMinEta, fEMCALFidCutMaxEta);
   }
-  else   if(det == "PHOS")  
+  else   if(det == kPHOS)
   {
-         if(!fPHOSFiducialCut) 
-      return kTRUE; //Fiducial cut not requested, accept all clusters 
-         else 
-      return CheckFiducialRegion(momentum, fPHOSFidCutMinPhi , fPHOSFidCutMaxPhi , fPHOSFidCutMinEta , fPHOSFidCutMaxEta );
+    if(!fPHOSFiducialCut)
+      return kTRUE; //Fiducial cut not requested, accept all clusters
+    else
+      return CheckFiducialRegion(eta,phi, fPHOSFidCutMinPhi , fPHOSFidCutMaxPhi , fPHOSFidCutMinEta , fPHOSFidCutMaxEta );
+  }
+  else   if(det == kDCAL || det == kDCALPHOS)
+  {
+    if(!fDCALFiducialCut)
+      return kTRUE; //Fiducial cut not requested, accept all clusters
+    else
+      return CheckFiducialRegion(eta,phi, fDCALFidCutMinPhi , fDCALFidCutMaxPhi , fDCALFidCutMinEta , fDCALFidCutMaxEta );
   }
   else
   {
-         printf("AliFiducialCut::IsInFiducialCut() - Wrong detector name = %s\n", det.Data());
-         return kFALSE;
+    return kFALSE;
+    AliFatal(Form("Detector < %d > not known!", det));
   }
   
 }
 
 //___________________________________________________________________________________________
-Bool_t AliFiducialCut::CheckFiducialRegion(TLorentzVector momentum,
+Bool_t AliFiducialCut::CheckFiducialRegion(Float_t eta, Float_t phiOrg,
                                            const TArrayF* minphi, const TArrayF* maxphi, 
                                            const TArrayF* mineta, const TArrayF* maxeta) const 
 {
   //Given the selection regions in Eta and Phi, check if particle is in this region.
   
-  Double_t phi = momentum.Phi();
+  Float_t phi = phiOrg;
        if(phi < 0) phi+=TMath::TwoPi() ;
-       Double_t eta =  momentum.Eta();
+  
        //printf("IsInFiducialCut::Det: %s, phi = %f, eta = %f\n", det.Data(),phi*TMath::RadToDeg(), eta);
   
   Int_t netaregions = maxeta->GetSize();
@@ -159,6 +190,7 @@ void AliFiducialCut::InitParameters()
   fEMCALFiducialCut = kTRUE ;  
   fPHOSFiducialCut  = kTRUE ;
   fCTSFiducialCut   = kTRUE ;
+  fDCALFiducialCut  = kTRUE ;
   
   fCTSFidCutMinEta = new TArrayF(1);
   fCTSFidCutMinEta->SetAt(-0.9,0); 
@@ -190,6 +222,39 @@ void AliFiducialCut::InitParameters()
   fPHOSFidCutMaxPhi = new TArrayF(1);
   fPHOSFidCutMaxPhi->SetAt(320.,0); 
   
+//  fDCALFidCutMinEta = new TArrayF(1);
+//  fDCALFidCutMinEta->SetAt(-0.7,0);
+//  fDCALFidCutMaxEta = new TArrayF(1);
+//  fDCALFidCutMaxEta->SetAt( 0.7,0);
+//  
+//  fDCALFidCutMinPhi = new TArrayF(1);
+//  fDCALFidCutMinPhi->SetAt(260.,0);
+//  fDCALFidCutMaxPhi = new TArrayF(1);
+//  fDCALFidCutMaxPhi->SetAt(327.,0);
+  
+  // Divide DCal in 3 regions:
+  // A (C?) side : -0.70<eta<-0.15, 260<phi<320
+  // C (A?) side :  0.15<eta< 0.70, 260<phi<320
+  // 1/3 SM      : -0.70<eta< 0.70, 320<phi<327
+  
+  fDCALFidCutMinEta = new TArrayF(3);
+  fDCALFidCutMinEta->SetAt(-0.7 ,0);
+  fDCALFidCutMinEta->SetAt( 0.20,1);
+  fDCALFidCutMinEta->SetAt(-0.7 ,2);
+  fDCALFidCutMaxEta = new TArrayF(3);
+  fDCALFidCutMaxEta->SetAt(-0.20,0);
+  fDCALFidCutMaxEta->SetAt( 0.7 ,1);
+  fDCALFidCutMaxEta->SetAt( 0.7 ,2);
+  
+  fDCALFidCutMinPhi = new TArrayF(3);
+  fDCALFidCutMinPhi->SetAt(260.,0);
+  fDCALFidCutMinPhi->SetAt(260.,1);
+  fDCALFidCutMinPhi->SetAt(320.,2);
+  fDCALFidCutMaxPhi = new TArrayF(3);
+  fDCALFidCutMaxPhi->SetAt(320.,0);
+  fDCALFidCutMaxPhi->SetAt(320.,0);
+  fDCALFidCutMaxPhi->SetAt(327.,0);
+
 }
 
 
@@ -238,6 +303,19 @@ void AliFiducialCut::Print(const Option_t * opt) const
       printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fPHOSFidCutMinPhi->GetAt(iphi), fPHOSFidCutMaxPhi->GetAt(iphi)) ; 
   }
   else printf(">>No fiducial cuts in PHOS\n");
+  
+  if(fDCALFiducialCut)
+  {
+    Int_t netaregions =  fDCALFidCutMaxEta->GetSize();
+    Int_t nphiregions =  fDCALFidCutMaxPhi->GetSize();
+    printf(">>DCAL Fiducial 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, fDCALFidCutMinEta->GetAt(ieta), fDCALFidCutMaxEta->GetAt(ieta)) ;
+    for(Int_t iphi = 0; iphi < nphiregions; iphi++)
+      printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fDCALFidCutMinPhi->GetAt(iphi), fDCALFidCutMaxPhi->GetAt(iphi)) ;
+  }
+  else printf(">>No fiducial cuts in DCAL\n");
+  
   printf("    \n") ;
   
 } 
@@ -293,3 +371,20 @@ void AliFiducialCut::SetSimplePHOSFiducialCut(Float_t eta, Float_t minphi, Float
   fPHOSFidCutMaxPhi->SetAt(maxphi,0);
   
 }
+
+//_________________________________________________________________________________________
+void AliFiducialCut::SetSimpleDCALFiducialCut(Float_t eta, Float_t minphi, Float_t maxphi)
+{
+  //Method to set simple acceptance cut to DCAL
+  
+  fDCALFidCutMinEta->Set(1);
+  fDCALFidCutMaxEta->Set(1);
+  fDCALFidCutMinPhi->Set(1);
+  fDCALFidCutMaxPhi->Set(1);
+  
+  fDCALFidCutMinEta->SetAt(-eta,0);
+  fDCALFidCutMaxEta->SetAt( eta,0);
+  fDCALFidCutMinPhi->SetAt(minphi,0);
+  fDCALFidCutMaxPhi->SetAt(maxphi,0);
+  
+}
\ No newline at end of file
index 2cb98b3dca6ea95e0dea8201c753b50662413734..964378b1da35cdaa435b14ef521974f2bd6bbbd5 100755 (executable)
@@ -5,7 +5,7 @@
 
 //_________________________________________________________________________
 // Class for track/cluster acceptance selection
-// Selection in Central barrel, EMCAL and PHOS
+// Selection in Central barrel, DCAL and PHOS
 //  
 // Several selection regions possible for the different
 // detectors
@@ -17,7 +17,7 @@
 #include <TArrayF.h> 
 
 class TString ;
-class TLorentzVector ;
+//class TLorentzVector ;
 
 
 class AliFiducialCut : public TObject {
@@ -27,24 +27,28 @@ public:
   virtual  ~AliFiducialCut() ;//virtual dtor
   
   void      InitParameters();
-    
-  Bool_t    CheckFiducialRegion(TLorentzVector lv,
-                                const TArrayF* minphi, const TArrayF* maxphi, 
+
+  Bool_t    CheckFiducialRegion(Float_t eta, Float_t phi,
+                                const TArrayF* minphi, const TArrayF* maxphi,
                                 const TArrayF* mineta, const TArrayF* maxeta) const ;
-  
-  Bool_t    IsInFiducialCut    (TLorentzVector lv, TString det) const ;
+
+  //Bool_t    IsInFiducialCut    (TLorentzVector lv, TString det) const ;
+  Bool_t    IsInFiducialCut    (Float_t eta, Float_t phi, Int_t det) const ;
   
   void      DoCTSFiducialCut  (Bool_t b)     { fCTSFiducialCut   = b    ; }
   void      DoEMCALFiducialCut(Bool_t b)     { fEMCALFiducialCut = b    ; }
   void      DoPHOSFiducialCut (Bool_t b)     { fPHOSFiducialCut  = b    ; }
+  void      DoDCALFiducialCut (Bool_t b)     { fDCALFiducialCut  = b    ; }
   
   Bool_t    GetCTSFiducialCutStatus()  const { return fCTSFiducialCut   ; }
   Bool_t    GetEMCALFiducialCut()      const { return fEMCALFiducialCut ; }
   Bool_t    GetPHOSFiducialCutStatus() const { return fPHOSFiducialCut  ; }
-  
+  Bool_t    GetDCALFiducialCut()       const { return fDCALFiducialCut  ; }
+
   void      SetSimpleCTSFiducialCut  (Float_t abseta, Float_t phimin, Float_t phimax) ;
   void      SetSimpleEMCALFiducialCut(Float_t abseta, Float_t phimin, Float_t phimax) ;
   void      SetSimplePHOSFiducialCut (Float_t abseta, Float_t phimin, Float_t phimax) ;
+  void      SetSimpleDCALFiducialCut (Float_t abseta, Float_t phimin, Float_t phimax) ;
   
   void      Print(const Option_t * opt)const;
   
@@ -96,10 +100,29 @@ public:
                                               { fPHOSFidCutMinPhi->Set(size,array)  ; }
   TArrayF * GetPHOSFidCutMinPhiArray() const  { return fPHOSFidCutMinPhi            ; }
   
+  void      AddDCALFidCutMaxEtaArray(Int_t size, Float_t* array)
+  { fDCALFidCutMaxEta->Set(size,array) ; }
+  TArrayF * GetDCALFidCutMaxEtaArray() const { return fDCALFidCutMaxEta           ; }
+  
+  void      AddDCALFidCutMaxPhiArray(Int_t size, Float_t* array)
+  { fDCALFidCutMaxPhi->Set(size,array) ; }
+  TArrayF * GetDCALFidCutMaxPhiArray() const { return fDCALFidCutMaxPhi           ; }
+  
+  void      AddDCALFidCutMinEtaArray(Int_t size, Float_t* array)
+  { fDCALFidCutMinEta->Set(size,array) ; }
+  TArrayF * GetDCALFidCutMinEtaArray() const { return fDCALFidCutMinEta           ; }
+  
+  void      AddDCALFidCutMinPhiArray(Int_t size, Float_t* array)
+  { fDCALFidCutMinPhi->Set(size,array) ; }
+  TArrayF * GetDCALFidCutMinPhiArray() const { return fDCALFidCutMinPhi           ; }
+
+  enum detector {kEMCAL = 0, kPHOS = 1, kCTS = 2, kDCAL = 3, kDCALPHOS = 4 };
+  
 private:
   
   //Detector acceptance cuts
   Bool_t    fEMCALFiducialCut ;  // Apply fiducial cuts to EMCAL clusters
+  Bool_t    fDCALFiducialCut  ;  // Apply fiducial cuts to DCAL clusters
   Bool_t    fPHOSFiducialCut  ;  // Apply fiducial cuts to PHOS clusters
   Bool_t    fCTSFiducialCut   ;  // Apply fiducial cuts to  CTS tracks
   
@@ -118,10 +141,15 @@ private:
   TArrayF * fPHOSFidCutMaxEta ;  // Take particles in PHOS with eta < fPHOSFidCutMaxEta
   TArrayF * fPHOSFidCutMaxPhi ;  // Take particles in PHOS with phi > fPHOSFidCutMaxPhi
   
+  TArrayF * fDCALFidCutMinEta ; // Take particles in DCAL with eta > fDCALFidCutMinEta
+  TArrayF * fDCALFidCutMinPhi ; // Take particles in DCAL with phi > fDCALFidCutMinPhi
+  TArrayF * fDCALFidCutMaxEta ; // Take particles in DCAL with eta < fDCALFidCutMaxEta
+  TArrayF * fDCALFidCutMaxPhi ; // Take particles in DCAL with phi > fDCALFidCutMaxPhi
+  
   AliFiducialCut(              const AliFiducialCut & g) ; // cpy ctor
   AliFiducialCut & operator = (const AliFiducialCut & g) ; // cpy assignment
   
-  ClassDef(AliFiducialCut,1)
+  ClassDef(AliFiducialCut,2)
   
 } ;
 
index c4dc8182cdf1f67811107be9a1e11177cfd798f4..f7293794905da86ef13bbd3a4615a13c02894ba9 100755 (executable)
@@ -29,7 +29,6 @@
   
   
 // --- ROOT system --- 
-#include <TLorentzVector.h>
 #include <TObjArray.h>
 
 // --- AliRoot system --- 
@@ -43,6 +42,7 @@
 #include "AliCaloTrackReader.h"
 #include "AliMixedEvent.h"
 #include "AliCaloPID.h"
+#include "AliLog.h"
 
 ClassImp(AliIsolationCut)
   
@@ -57,8 +57,10 @@ fSumPtThresholdMax(10000.),
 fPtFraction(0.),
 fICMethod(0),
 fPartInCone(0),
-fDebug(-1),
-fFracIsThresh(1)
+fDebug(0),
+fFracIsThresh(1),
+fMomentum(),
+fTrackVector()
 {
   //default ctor
   
@@ -167,8 +169,8 @@ Float_t AliIsolationCut::CalculateExcessAreaFraction(Float_t excess) const
   if(coneA > excessA) return coneA / (coneA-excessA);
   else
   {
-    printf("AliIsolationCut::CalculateExcessAreaFraction() - Please Check : Excess Track %2.3f, coneA %2.2f,  excessA %2.2f, angle %2.2f,factor %2.2f\n",
-           excess,coneA, excessA, angle*TMath::RadToDeg(), coneA / (coneA-excessA));
+    AliWarning(Form("Please Check : Excess Track %2.3f, coneA %2.2f,  excessA %2.2f, angle %2.2f,factor %2.2f",
+                    excess,coneA, excessA, angle*TMath::RadToDeg(), coneA / (coneA-excessA)));
     return  1;
   }
 }
@@ -187,7 +189,7 @@ Float_t AliIsolationCut::GetCellDensity(AliAODPWG4ParticleCorrelation * pCandida
   if(phiC<0) phiC+=TMath::TwoPi();
   Float_t etaC  = pCandidate->Eta() ;
   
-  if(pCandidate->GetDetector()=="EMCAL")
+  if(pCandidate->GetDetectorTag() == AliCaloTrackReader::kEMCAL)
   {
     AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
     AliCalorimeterUtils *cu = reader->GetCaloUtils();
@@ -197,7 +199,7 @@ Float_t AliIsolationCut::GetCellDensity(AliAODPWG4ParticleCorrelation * pCandida
     {
       //Get absolute (col,row) of candidate
       Int_t iEta=-1, iPhi=-1, iRCU = -1;      
-      Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetector(), iEta, iPhi, iRCU);
+      Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetectorTag(), iEta, iPhi, iRCU);
       
       Int_t colC = iEta;
       if (nSupMod % 2) colC =  AliEMCALGeoParams::fgkEMCALCols + iEta ;
@@ -244,8 +246,7 @@ Float_t AliIsolationCut::GetCellDensity(AliAODPWG4ParticleCorrelation * pCandida
         }
       }//end of cells loop
     }
-    
-    else if(fDebug>0) printf("cluster with bad (eta,phi) in EMCal for energy density calculation\n");
+    else AliWarning("Cluster with bad (eta,phi) in EMCal for energy density calculation");
     
     if (coneCells > 0.) 
     {
@@ -275,7 +276,7 @@ void AliIsolationCut::GetCoeffNormBadCell(AliAODPWG4ParticleCorrelation * pCandi
   if(phiC<0) phiC+=TMath::TwoPi();
   Float_t etaC  = pCandidate->Eta() ;
   
-  if(pCandidate->GetDetector()=="EMCAL")
+  if(pCandidate->GetDetectorTag() == AliCaloTrackReader::kEMCAL)
   {
     AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
     AliCalorimeterUtils *cu = reader->GetCaloUtils();
@@ -285,7 +286,7 @@ void AliIsolationCut::GetCoeffNormBadCell(AliAODPWG4ParticleCorrelation * pCandi
     {
       //Get absolute (col,row) of candidate
       Int_t iEta=-1, iPhi=-1, iRCU = -1;
-      Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetector(),
+      Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetectorTag(),
                                                      iEta, iPhi, iRCU);
       
       Int_t colC = iEta;
@@ -329,8 +330,7 @@ void AliIsolationCut::GetCoeffNormBadCell(AliAODPWG4ParticleCorrelation * pCandi
         }
       }//end of cells loop
     }
-    
-    else if(fDebug > 0) printf("cluster with bad (eta,phi) in EMCal for energy density coeff calculation\n");
+    else AliWarning("Cluster with bad (eta,phi) in EMCal for energy density coeff calculation");
     
     if (coneCells > 0.)
     {
@@ -411,7 +411,7 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
                                         Int_t   & n, 
                                         Int_t   & nfrac, 
                                         Float_t & coneptsum, Float_t & ptLead,
-                                        Bool_t  & isolated) const
+                                        Bool_t  & isolated) 
 {
   //Search in cone around a candidate particle if it is isolated 
   Float_t ptC   = pCandidate->Pt() ;
@@ -436,16 +436,9 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
   nfrac     = 0 ;
   isolated  = kFALSE;
   
-  if(fDebug>0) 
-  {
-    printf("AliIsolationCut::MakeIsolationCut() - Cadidate pT %2.2f, eta %2.2f, phi %2.2f, cone %1.2f, thres %2.2f, Fill AOD? %d",
-           pCandidate->Pt(), pCandidate->Eta(), pCandidate->Phi()*TMath::RadToDeg(), fConeSize,fPtThreshold,bFillAOD);
-    if(plCTS) printf(", nTracks %d"  ,plCTS->GetEntriesFast());
-    if(plNe)  printf(", nClusters %d",plNe ->GetEntriesFast());
-    
-    printf("\n");
-  }
-  
+  AliDebug(1,Form("Candidate pT %2.2f, eta %2.2f, phi %2.2f, cone %1.2f, thres %2.2f, Fill AOD? %d",
+                  pCandidate->Pt(), pCandidate->Eta(), pCandidate->Phi()*TMath::RadToDeg(), fConeSize,fPtThreshold,bFillAOD));
+
   //Initialize the array with refrences
   TObjArray * refclusters  = 0x0;
   TObjArray * reftracks    = 0x0;
@@ -456,7 +449,6 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
   if(plCTS && 
      (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged))
   {
-    TVector3 p3;
     for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ )
     {
       AliVTrack* track = dynamic_cast<AliVTrack*>(plCTS->At(ipr)) ; 
@@ -467,17 +459,17 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
         if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1) || 
            track->GetID() == pCandidate->GetTrackLabel(2) || track->GetID() == pCandidate->GetTrackLabel(3)   ) continue ;
         
-        p3.SetXYZ(track->Px(),track->Py(),track->Pz());
-        pt  = p3.Pt();
-        eta = p3.Eta();
-        phi = p3.Phi() ;
+        fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+        pt  = fTrackVector.Pt();
+        eta = fTrackVector.Eta();
+        phi = fTrackVector.Phi() ;
       }
       else
       {// Mixed event stored in AliAODPWG4Particles
         AliAODPWG4Particle * trackmix = dynamic_cast<AliAODPWG4Particle*>(plCTS->At(ipr)) ; 
         if(!trackmix)
         {
-          printf("AliIsolationCut::MakeIsolationCut() - Wrong track data type, continue\n");
+          AliWarning("Wrong track data type, continue");
           continue;
         }
         
@@ -526,12 +518,11 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
       // // Check if there is any particle inside cone with pt larger than  fPtThreshold
       // Check if the leading particule inside the cone has a ptLead larger than fPtThreshold
       
-      if( fDebug > 0 )
-        printf("\t track %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad);
+      AliDebug(2,Form("\t Track %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
       
       if(rad < fConeSize)
       {
-        if(fDebug > 0)  printf(" -  inside candidate cone");
+        AliDebug(2,"Inside candidate cone");
         
         if(bFillAOD)
         {
@@ -574,8 +565,6 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
 
       } // Inside cone
       
-      if( fDebug > 0 )  printf("\n");
-      
     }// charged particle loop
     
   }//Tracks
@@ -585,7 +574,6 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
   if(plNe &&
      (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged))
   {
-    TLorentzVector mom ;
     
     for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ )
     {
@@ -608,18 +596,18 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
            pid->IsTrackMatched(calo,reader->GetCaloUtils(),reader->GetInputEvent()) ) continue ;
         
         //Assume that come from vertex in straight line
-        calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ;
+        calo->GetMomentum(fMomentum,reader->GetVertex(evtIndex)) ;
         
-        pt  = mom.Pt()  ;
-        eta = mom.Eta() ;
-        phi = mom.Phi() ;
+        pt  = fMomentum.Pt()  ;
+        eta = fMomentum.Eta() ;
+        phi = fMomentum.Phi() ;
       }
       else 
       {// Mixed event stored in AliAODPWG4Particles
         AliAODPWG4Particle * calomix = dynamic_cast<AliAODPWG4Particle*>(plNe->At(ipr)) ; 
         if(!calomix)
         {
-          printf("AliIsolationCut::MakeIsolationCut() - Wrong calo data type, continue\n");
+          AliWarning("Wrong calo data type, continue");
           continue;
         }
         
@@ -675,12 +663,11 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
       
       //Check if there is any particle inside cone with pt larger than  fPtThreshold
       
-      if(fDebug > 0 ) 
-        printf("\t cluster %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad);
+      AliDebug(2,Form("\t Cluster %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
       
       if(rad < fConeSize)
       {
-        if(fDebug > 0 )  printf(" - inside candidate cone");
+        AliDebug(2,"Inside candidate cone");
         
         if(bFillAOD) 
         {
@@ -723,8 +710,6 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
         
       }//in cone
       
-      if(fDebug > 0 )  printf("\n");
-    
     }// neutral particle loop
     
   }//neutrals
@@ -765,9 +750,8 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
   {
     if( n == 0 ) isolated = kTRUE ;
     
-    if(fDebug > 0 )
-      printf("pT Cand %2.2f, pT Lead %2.2f, %2.2f<pT Lead< %2.2f, isolated %d\n",
-             ptC,ptLead,fPtThreshold,fPtThresholdMax,isolated);
+    AliDebug(1,Form("pT Cand %2.2f, pT Lead %2.2f, %2.2f<pT Lead< %2.2f, isolated %d",
+                    ptC,ptLead,fPtThreshold,fPtThresholdMax,isolated));
   }
   else if( fICMethod == kSumPtIC )
   {
@@ -777,9 +761,8 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
     else
       isolated  =  kTRUE  ;
     
-    if(fDebug > 0 )
-      printf("pT Cand %2.2f, SumPt %2.2f, %2.2f<Sum pT< %2.2f, isolated %d\n",
-             ptC,ptLead,fSumPtThreshold,fSumPtThresholdMax,isolated);
+     AliDebug(1,Form("pT Cand %2.2f, SumPt %2.2f, %2.2f<Sum pT< %2.2f, isolated %d",
+                     ptC,ptLead,fSumPtThreshold,fSumPtThresholdMax,isolated));
   }
   else if( fICMethod == kPtFracIC )
   {
index f57a08eec1a619530498213d7ae55d5d5463d3a9..c583857c733ede1e373e7eefff9bee9658dd8a1b 100755 (executable)
@@ -16,6 +16,7 @@
 // --- ROOT system --- 
 #include <TObject.h>
 class TObjArray ;
+#include <TLorentzVector.h>
 
 // --- ANALYSIS system ---
 class AliAODPWG4ParticleCorrelation ;
@@ -49,7 +50,7 @@ class AliIsolationCut : public TObject {
                               AliCaloPID * pid, 
                               Bool_t bFillAOD,
                               AliAODPWG4ParticleCorrelation  * pCandidate, TString aodObjArrayName,
-                              Int_t &n, Int_t & nfrac, Float_t &ptSum, Float_t &ptLead, Bool_t & isolated) const ;
+                              Int_t &n, Int_t & nfrac, Float_t &ptSum, Float_t &ptLead, Bool_t & isolated) ;
   
   void       Print(const Option_t * opt) const ;
   
@@ -85,6 +86,7 @@ class AliIsolationCut : public TObject {
   Float_t    GetPtFraction()          const { return fPtFraction     ; }
   Int_t      GetICMethod()            const { return fICMethod       ; }
   Int_t      GetParticleTypeInCone()  const { return fPartInCone     ; }
+  Int_t      GetDebug()               const { return fDebug          ; }
   Bool_t     GetFracIsThresh()        const { return fFracIsThresh   ; }
        
   void       SetConeSize(Float_t r)         { fConeSize       = r    ; }
@@ -116,10 +118,13 @@ class AliIsolationCut : public TObject {
   Int_t      fDebug;             // Debug level
   Bool_t     fFracIsThresh;      // Use threshold instead of fraction when pt leading is small
   
+  TLorentzVector fMomentum;      //! momentum of cluster
+  TVector3       fTrackVector;   //! track moment
+  
   AliIsolationCut(              const AliIsolationCut & g) ; // cpy ctor
   AliIsolationCut & operator = (const AliIsolationCut & g) ; // cpy assignment
   
-  ClassDef(AliIsolationCut,7)
+  ClassDef(AliIsolationCut,9)
 } ;
 
 
index ffaefb73a9fa0cc9696191272bd46349489feac5..61b37022be18daba3a3c3448149e1a7b9a47214f 100755 (executable)
@@ -37,6 +37,7 @@
 #include "AliStack.h"
 #include "AliGenPythiaEventHeader.h"
 #include "AliAODMCParticle.h"
+#include "AliLog.h"
 
 ClassImp(AliMCAnalysisUtils)
 
@@ -44,9 +45,12 @@ ClassImp(AliMCAnalysisUtils)
 AliMCAnalysisUtils::AliMCAnalysisUtils() : 
 TObject(), 
 fCurrentEvent(-1), 
-fDebug(-1), 
+fDebug(0),
 fJetsList(new TList), 
-fMCGenerator("PYTHIA")
+fMCGenerator(kPythia),
+fMCGeneratorString("PYTHIA"),
+fDaughMom(),  fDaughMom2(),
+fMotherMom(), fGMotherMom()
 {
   //Ctor
 }
@@ -56,7 +60,8 @@ AliMCAnalysisUtils::~AliMCAnalysisUtils()
 {
   // Remove all pointers.
   
-  if (fJetsList) {
+  if (fJetsList)
+  {
     fJetsList->Clear();
     delete fJetsList ;
   }     
@@ -68,7 +73,8 @@ Int_t AliMCAnalysisUtils::CheckCommonAncestor(Int_t index1, Int_t index2,
                                               Int_t & ancPDG, Int_t & ancStatus, 
                                               TLorentzVector & momentum, TVector3 & prodVertex) 
 {
-  //Check the first common ancestor of 2 clusters, given the most likely labels of the primaries generating such clusters.
+  // Check the first common ancestor of 2 clusters, given the most likely labels of the primaries generating such clusters.
+  
   Int_t label1[100];
   Int_t label2[100];
   label1[0]= index1;
@@ -153,8 +159,8 @@ Int_t AliMCAnalysisUtils::CheckCommonAncestor(Int_t index1, Int_t index2,
     }// Kine stack from ESDs
   }//First labels not the same
   
-  if((counter1==99 || counter2==99) && fDebug >=0)
-    printf("AliMCAnalysisUtils::CheckCommonAncestor() - Genealogy too large c1: %d, c2= %d\n", counter1, counter2);
+//  if((counter1==99 || counter2==99) && fDebug >=0)
+//    printf("AliMCAnalysisUtils::CheckCommonAncestor() - Genealogy too large c1: %d, c2= %d\n", counter1, counter2);
   //printf("CheckAncestor:\n");
   
   Int_t commonparents = 0;
@@ -214,19 +220,21 @@ Int_t AliMCAnalysisUtils::CheckCommonAncestor(Int_t index1, Int_t index2,
 
 //________________________________________________________________________________________
 Int_t AliMCAnalysisUtils::CheckOrigin(const Int_t * label, Int_t nlabels,
-                                      const AliCaloTrackReader* reader, TString calorimeter)
+                                      const AliCaloTrackReader* reader, Int_t calorimeter)
 {
-  //Play with the montecarlo particles if available
+  // Play with the montecarlo particles if available.
+  
   Int_t tag = 0;
   
-  if(nlabels<=0) {
-    printf("AliMCAnalysisUtils::CheckOrigin(nlabel<=0) - No MC labels available, please check!!!\n");
+  if( nlabels <= 0 )
+  {
+    AliWarning("No MC labels available, please check!!!");
     return kMCBadLabel;
   }
   
   TObjArray* arrayCluster = 0;
-  if      ( calorimeter == "EMCAL" ) arrayCluster = reader->GetEMCALClusters();
-  else if ( calorimeter ==  "PHOS" ) arrayCluster= reader->GetPHOSClusters();
+  if      ( calorimeter == AliCaloTrackReader::kEMCAL ) arrayCluster = reader->GetEMCALClusters();
+  else if ( calorimeter == AliCaloTrackReader::kPHOS  ) arrayCluster = reader->GetPHOSClusters ();
   
   //Select where the information is, ESD-galice stack or AOD mcparticles branch
   if(reader->ReadStack()){
@@ -240,19 +248,21 @@ Int_t AliMCAnalysisUtils::CheckOrigin(const Int_t * label, Int_t nlabels,
 }
 
 //____________________________________________________________________________________________________
-Int_t AliMCAnalysisUtils::CheckOrigin(Int_t label, const AliCaloTrackReader* reader, TString calorimeter)
+Int_t AliMCAnalysisUtils::CheckOrigin(Int_t label, const AliCaloTrackReader* reader, Int_t calorimeter)
 {
-  //Play with the montecarlo particles if available
+  // Play with the montecarlo particles if available.
+  
   Int_t tag = 0;
   
-  if(label<0) {
-    printf("AliMCAnalysisUtils::CheckOrigin(label<0) - No MC labels available, please check!!!\n");
+  if( label < 0 )
+  {
+    AliWarning("No MC labels available, please check!!!");
     return kMCBadLabel;
   }
   
   TObjArray* arrayCluster = 0;
-  if      ( calorimeter == "EMCAL" ) arrayCluster = reader->GetEMCALClusters();
-  else if ( calorimeter ==  "PHOS" ) arrayCluster= reader->GetPHOSClusters();
+  if      ( calorimeter == AliCaloTrackReader::kEMCAL ) arrayCluster = reader->GetEMCALClusters();
+  else if ( calorimeter == AliCaloTrackReader::kPHOS  ) arrayCluster = reader->GetPHOSClusters();
   
   Int_t labels[]={label};
   
@@ -281,8 +291,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
   
   if(!stack)
   {
-    if (fDebug >=0) 
-      printf("AliMCAnalysisUtils::CheckOriginInStack() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+    AliDebug(1,"Stack is not available, check analysis settings in configuration file, STOP!!");
     return -1;
   }
   
@@ -299,7 +308,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
     Int_t mStatus  = mom->GetStatusCode() ;
     Int_t iParent  = mom->GetFirstMother() ;
     
-    if(fDebug > 0 && label < 8 && fMCGenerator!="") printf("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent);
+    //if( label < 8 && fMCGenerator != kBoxLike ) AliDebug(1,Form("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d",iParent));
     
     //GrandParent of the entity
     TParticle * parent = NULL;
@@ -315,15 +324,12 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
         pStatus = parent->GetStatusCode();  
       }
     }
-    else if(fDebug > 0 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - Parent with label %d\n",iParent);
+    else AliDebug(1,Form("Parent with label %d",iParent));
+    
+    AliDebug(2,"Cluster most contributing mother and its parent:");
+    AliDebug(2,Form("\t Mother label %d, pdg %d, status %d",iMom, mPdg, mStatus));
+    AliDebug(2,Form("\t Parent label %d, pdg %d, status %d",iParent, pPdg, pStatus));
     
-    if(fDebug > 2 )
-    {
-      printf("AliMCAnalysisUtils::CheckOriginInStack() - Cluster most contributing mother and its parent: \n");
-      printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
-      printf("\t Parent label %d, pdg %d, status %d\n",iParent, pPdg, pStatus);
-    }
-         
     //Check if "mother" of entity is converted, if not, get the first non converted mother
     if((mPdg == 22 || mPdg == 11) && (pPdg == 22 || pPdg == 11) && mStatus == 0)
     {
@@ -340,7 +346,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
         mStatus  = mom->GetStatusCode() ;
         iParent  = mom->GetFirstMother() ;
        
-        if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent);
+        //if(label < 8 ) AliDebug(1,Form("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent));
         
         //GrandParent
         if(iParent >= 0)
@@ -359,12 +365,9 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
         }
       }//while
       
-      if(fDebug > 2 )
-      {
-        printf("AliMCAnalysisUtils::CheckOriginInStack() - Converted photon/electron: \n");
-        printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
-        printf("\t Parent label %d, pdg %d, status %d\n",iParent, pPdg, pStatus);
-      }
+      AliDebug(2,"Converted photon/electron:");
+      AliDebug(2,Form("\t Mother label %d, pdg %d, status %d",iMom, mPdg, mStatus));
+      AliDebug(2,Form("\t Parent label %d, pdg %d, status %d",iParent, pPdg, pStatus));
       
     }//mother and parent are electron or photon and have status 0
     else if((mPdg == 22 || mPdg == 11) && mStatus == 0)
@@ -379,11 +382,9 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
         mPdgSign = mom->GetPdgCode();
         mPdg     = TMath::Abs(mPdgSign);
         
-        if(fDebug > 2 )
-        {
-          printf("AliMCAnalysisUtils::CheckOriginInStack() - Converted hadron: \n");
-          printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
-        }
+        AliDebug(2,"Converted hadron:");
+        AliDebug(2,Form("\t Mother label %d, pdg %d, status %d",iMom, mPdg, mStatus));
+        
       }//hadron converted
       
       //Comment for the next lines, we do not check the parent of the hadron for the moment.
@@ -413,8 +414,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
       
       SetTagBit(tag,kMCPi0Decay);
       
-      if(fDebug > 2 )
-        printf("AliMCAnalysisUtils::CheckOriginInStack() - First mother is directly pi0, not decayed by generator \n");
+      AliDebug(2,"First mother is directly pi0, not decayed by generator");
       
       CheckOverlapped2GammaDecay(labels,nlabels, iMom, stack, tag); //set to kMCPi0 if 2 gammas in same cluster
       
@@ -423,8 +423,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
     {
       SetTagBit(tag,kMCEtaDecay);
       
-      if(fDebug > 2 )
-        printf("AliMCAnalysisUtils::CheckOriginInStack() - First mother is directly eta, not decayed by generator \n");
+      AliDebug(2,"First mother is directly eta, not decayed by generator");
       
       CheckOverlapped2GammaDecay(labels,nlabels, iMom, stack, tag); //set to kMCEta if 2 gammas in same cluster
     }
@@ -437,7 +436,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
       {
         SetTagBit(tag,kMCPi0Decay);
         
-        if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - PYTHIA pi0 decay photon,  parent pi0 with status 11 \n");
+        AliDebug(2,"PYTHIA pi0 decay photon,  parent pi0 with status 11");
         
         CheckOverlapped2GammaDecay(labels,nlabels, iParent, stack, tag); //set to kMCPi0 if 2 gammas in same cluster
         // In case it did not merge, check if the decay companion is lost
@@ -450,7 +449,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
       {
         SetTagBit(tag, kMCEtaDecay);
         
-        if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - PYTHIA eta decay photon,  parent pi0 with status 11 \n");
+        AliDebug(2,"PYTHIA eta decay photon,  parent pi0 with status 11");
         
         CheckOverlapped2GammaDecay(labels,nlabels, iParent, stack, tag);//set to kMCEta if 2 gammas in same cluster
         // In case it did not merge, check if the decay companion is lost
@@ -459,7 +458,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
       }
       else if(mStatus == 1)
       { //undecayed particle
-        if(fMCGenerator == "PYTHIA")
+        if(fMCGenerator == kPythia)
         {
           if(iParent < 8 && iParent > 5)
           {//outgoing partons
@@ -473,7 +472,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
           else  SetTagBit(tag,kMCUnknown);
          }//PYTHIA
       
-        else if(fMCGenerator == "HERWIG")
+        else if(fMCGenerator == kHerwig)
         {
           if(pStatus < 197)
           {//Not decay
@@ -520,12 +519,13 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
       
       SetTagBit(tag,kMCElectron);
       
-      if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInStack() - Checking ancestors of electrons\n");
+      AliDebug(1,"Checking ancestors of electrons");
      
       if      (pPdg == 111) { SetTagBit(tag,kMCPi0Decay); SetTagBit(tag, kMCDecayDalitz) ; } //Pi0 Dalitz decay
       else if (pPdg == 221) { SetTagBit(tag,kMCEtaDecay); SetTagBit(tag, kMCDecayDalitz) ; } //Eta Dalitz decay
       else if((499 < pPdg && pPdg < 600)||(4999 < pPdg && pPdg < 6000)) { SetTagBit(tag,kMCEFromB); } //b-->e decay
-      else if((399 < pPdg && pPdg < 500)||(3999 < pPdg && pPdg < 5000)) { //check charm decay
+      else if((399 < pPdg && pPdg < 500)||(3999 < pPdg && pPdg < 5000))
+      { //check charm decay
         if(parent)
         {
           Int_t iGrandma = parent->GetFirstMother();
@@ -534,7 +534,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
             TParticle* gma = (TParticle*)stack->Particle(iGrandma); //get mother of charm
             Int_t gPdg = TMath::Abs(gma->GetPdgCode());
             if((499 < gPdg && gPdg < 600)||(4999 < gPdg && gPdg < 6000)) SetTagBit(tag,kMCEFromCFromB); //b-->c-->e
-            else SetTagBit(tag,kMCEFromC); //c-->e 
+            else SetTagBit(tag,kMCEFromC); //c-->e
           }
           else SetTagBit(tag,kMCEFromC); //c-->e
         }//parent
@@ -545,27 +545,26 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
         if(pPdg > 10000) SetTagBit(tag,kMCUnknown);
         
         else SetTagBit(tag,kMCOtherDecay);
-       
-        if(fDebug > 0 && parent) printf("AliMCAnalysisUtils::CheckOriginInStack() - Status %d Electron from other origin: %s (pPdg = %d) %s (mpdg = %d)\n",mStatus,parent->GetName(),pPdg,mom->GetName(),mPdg);
+        
+        //if(parent) AliDebug(1,Form("Status %d Electron from other origin: %s (pPdg = %d) %s (mpdg = %d)",mStatus,parent->GetName(),pPdg,mom->GetName(),mPdg));
       }
     }//electron check
     //Cluster was made by something else
     else
     {
-      if(fDebug > 0)
-        printf("AliMCAnalysisUtils::CheckOriginInStack() - \tSetting kMCUnknown for cluster from %s (pdg = %d, Parent pdg = %d)\n",
-               mom->GetName(),mPdg,pPdg);
+      AliDebug(2,Form("\t Setting kMCUnknown for cluster from %s (pdg = %d, Parent pdg = %d)",
+                      mom->GetName(),mPdg,pPdg));
       
       SetTagBit(tag,kMCUnknown);
     }
   }//Good label value
   else
   {// Bad label
-    if(label < 0 && (fDebug >= 0)) 
-      printf("AliMCAnalysisUtils::CheckOriginInStack() *** bad label or no stack ***:  label %d \n", label);
+    if(label < 0)
+      AliWarning(Form("*** bad label or no stack ***:  label %d ", label));
     
-    if(label >=  stack->GetNtrack() &&  (fDebug >= 0))
-      printf("AliMCAnalysisUtils::CheckOriginInStack() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
+    if(label >=  stack->GetNtrack())
+      AliWarning(Form("*** large label ***:  label %d, n tracks %d", label, stack->GetNtrack()));
     
     SetTagBit(tag,kMCUnknown);
   }//Bad label
@@ -581,10 +580,10 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
 {
   // Play with the MCParticles in AOD if available. Tag particles depending on their origin.
   // Do same things as in CheckOriginInStack but different input.
+  
   if(!mcparticles)
   {
-    if(fDebug >= 0)
-      printf("AliMCAnalysisUtils::CheckOriginInAOD() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+    AliDebug(1,"AODMCParticles is not available, check analysis settings in configuration file!!");
     return -1;
   }
        
@@ -601,7 +600,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
     Int_t mPdg     = TMath::Abs(mPdgSign);
     Int_t iParent  = mom->GetMother() ;
     
-    if(fDebug > 0 && label < 8 && fMCGenerator!="") printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);
+    //if(label < 8 && fMCGenerator != kBoxLike) AliDebug(1,Form("Mother is parton %d\n",iParent));
     
     //GrandParent
     AliAODMCParticle * parent = NULL ;
@@ -611,20 +610,12 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
       parent = (AliAODMCParticle *) mcparticles->At(iParent);
       pPdg = TMath::Abs(parent->GetPdgCode());
     }
-    else if(fDebug > 0 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Parent with label %d\n",iParent);
+    else AliDebug(1,Form("Parent with label %d",iParent));
+    
+    AliDebug(2,"Cluster most contributing mother and its parent:");
+    AliDebug(2,Form("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary()));
+    AliDebug(2,Form("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d",iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary()));
     
-    if(fDebug > 2 )
-    {
-      printf("AliMCAnalysisUtils::CheckOriginInAOD() - Cluster most contributing mother and its parent: \n");
-      
-      printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
-             iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
-      
-      if(parent)
-        printf("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
-               iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary());
-    }
-         
     //Check if mother is converted, if not, get the first non converted mother
     if((mPdg == 22 || mPdg == 11) && (pPdg == 22 || pPdg == 11) && !mom->IsPrimary())
     {
@@ -639,7 +630,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
         mPdgSign = mom->GetPdgCode();
         mPdg     = TMath::Abs(mPdgSign);
         iParent  = mom->GetMother() ;
-        if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);
+        //if(label < 8 ) AliDebug(1, Form("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent));
         
         //GrandParent
         if(iParent >= 0 && parent)
@@ -652,17 +643,9 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
         
       }//while 
       
-      if(fDebug > 2 )
-      {
-        printf("AliMCAnalysisUtils::CheckOriginInAOD() - Converted photon/electron : \n");
-        
-        printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
-               iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
-       
-        if(parent)
-          printf("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
-                 iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary());
-      }
+      AliDebug(2,"AliMCAnalysisUtils::CheckOriginInAOD() - Converted photon/electron:");
+      AliDebug(2,Form("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary()));
+      AliDebug(2,Form("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d",iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary()));
       
     }//mother and parent are electron or photon and have status 0 and parent is photon or electron
     else if((mPdg == 22 || mPdg == 11) && !mom->IsPrimary())
@@ -677,11 +660,9 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
         mPdgSign = mom->GetPdgCode();
         mPdg     = TMath::Abs(mPdgSign);
         
-        if(fDebug > 2 )
-        {
-          printf("AliMCAnalysisUtils::CheckOriginInAOD() - Converted hadron : \n");
-          printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
-        }
+       AliDebug(2,"AliMCAnalysisUtils::CheckOriginInAOD() - Converted hadron:");
+       AliDebug(2,Form("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary()));
+      
       }//hadron converted
       
       //Comment for next lines, we do not check the parent of the hadron for the moment.
@@ -713,7 +694,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
     {
       SetTagBit(tag,kMCPi0Decay);
       
-      if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - First mother is directly pi0, not decayed by generator \n");
+      AliDebug(2,"First mother is directly pi0, not decayed by generator");
       
       CheckOverlapped2GammaDecay(labels,nlabels, iMom, mcparticles, tag); //set to kMCPi0 if 2 gammas in same cluster
     }
@@ -721,7 +702,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
     {
       SetTagBit(tag,kMCEtaDecay);   
       
-      if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - First mother is directly eta, not decayed by generator \n");
+      AliDebug(2,"First mother is directly eta, not decayed by generator");
       
       CheckOverlapped2GammaDecay(labels,nlabels, iMom, mcparticles, tag); //set to kMCEta if 2 gammas in same cluster
     }
@@ -734,34 +715,36 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
       {
         SetTagBit(tag,kMCPi0Decay);
         
-        if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Generator pi0 decay photon \n");
+        AliDebug(2,"Generator pi0 decay photon");
         
         CheckOverlapped2GammaDecay(labels,nlabels, iParent, mcparticles, tag); //set to kMCPi0 if 2 gammas in same cluster
         // In case it did not merge, check if the decay companion is lost
         if(!CheckTagBit(tag, kMCPi0) && !CheckTagBit(tag,kMCDecayPairInCalo) && !CheckTagBit(tag,kMCDecayPairLost))
+        {
           CheckLostDecayPair(arrayCluster,iMom, iParent, mcparticles, tag);
-
+        }
+        
         //printf("Bit set is Merged %d, Pair in calo %d, Lost %d\n",CheckTagBit(tag, kMCPi0),CheckTagBit(tag,kMCDecayPairInCalo),CheckTagBit(tag,kMCDecayPairLost));
       }
       else if (pPdg == 221)
       {
         SetTagBit(tag, kMCEtaDecay);
         
-        if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Generator eta decay photon \n");
+        AliDebug(2,"Generator eta decay photon");
         
         CheckOverlapped2GammaDecay(labels,nlabels, iParent, mcparticles, tag); //set to kMCEta if 2 gammas in same cluster
         // In case it did not merge, check if the decay companion is lost
         if(!CheckTagBit(tag, kMCEta) && !CheckTagBit(tag,kMCDecayPairInCalo))
           CheckLostDecayPair(arrayCluster,iMom, iParent, mcparticles, tag);
       }
-      else if(mom->IsPhysicalPrimary() && (fMCGenerator=="PYTHIA" || fMCGenerator=="HERWIG")) //undecayed particle
+      else if( mom->IsPhysicalPrimary() && ( fMCGenerator == kPythia || fMCGenerator == kHerwig ) ) //undecayed particle
       {
         if(iParent < 8 && iParent > 5 )
         {//outgoing partons
           if(pPdg == 22) SetTagBit(tag,kMCPrompt);
           else SetTagBit(tag,kMCFragmentation);
         }//Outgoing partons
-        else if(iParent <= 5 && (fMCGenerator=="PYTHIA" || fMCGenerator=="HERWIG"))
+        else if( iParent <= 5 && ( fMCGenerator == kPythia || fMCGenerator == kHerwig ) )
         {
           SetTagBit(tag, kMCISR); //Initial state radiation
         }
@@ -789,7 +772,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
       
       SetTagBit(tag,kMCElectron);
       
-      if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Checking ancestors of electrons");
+      AliDebug(1,"Checking ancestors of electrons");
       
       if      (pPdg == 111) { SetTagBit(tag,kMCPi0Decay); SetTagBit(tag,kMCDecayDalitz);} //Pi0 Dalitz decay
       else if (pPdg == 221) { SetTagBit(tag,kMCEtaDecay); SetTagBit(tag,kMCDecayDalitz);} //Eta Dalitz decay
@@ -813,8 +796,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
         TParticlePDG* foo = TDatabasePDG::Instance()->GetParticle(pPdg);
         TParticlePDG* foo1 = TDatabasePDG::Instance()->GetParticle(mPdg);
         
-        if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Electron from other origin: %s (pPdg = %d) %s (mPdg = %d)\n",
-                              foo->GetName(), pPdg,foo1->GetName(),mPdg);
+        AliDebug(1,Form("Electron from other origin: %s (pPdg = %d) %s (mPdg = %d)",foo->GetName(), pPdg,foo1->GetName(),mPdg));
         
         if(pPdg > 10000) SetTagBit(tag,kMCUnknown);
         else             SetTagBit(tag,kMCOtherDecay);
@@ -823,18 +805,17 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
     //cluster was made by something else
     else
     {
-      if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - \tSetting kMCUnknown for cluster with pdg = %d, Parent pdg = %d\n",
-                            mPdg,pPdg);
+      AliDebug(1,Form("\t Setting kMCUnknown for cluster with pdg = %d, Parent pdg = %d",mPdg,pPdg));
       SetTagBit(tag,kMCUnknown);
     }
   }//Good label value
   else
   {//Bad label
-    if(label < 0 && (fDebug >= 0) ) 
-      printf("AliMCAnalysisUtils::CheckOriginInAOD() *** bad label or no mcparticles ***:  label %d \n", label);
+    if(label < 0)
+      AliWarning(Form("*** bad label or no mcparticles ***:  label %d", label));
     
-    if(label >=  mcparticles->GetEntriesFast() &&  (fDebug >= 0) )
-      printf("AliMCAnalysisUtils::CheckOriginInAOD() *** large label ***:  label %d, n tracks %d \n", label, mcparticles->GetEntriesFast());
+    if(label >=  mcparticles->GetEntriesFast())
+      AliWarning(Form("*** large label ***:  label %d, n tracks %d", label, mcparticles->GetEntriesFast()));
   
     SetTagBit(tag,kMCUnknown);
     
@@ -849,11 +830,11 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
                                                     Int_t mesonIndex, AliStack *stack,
                                                     Int_t &tag)
 {
-  //Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in stack
+  // Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in stack.
   
-  if(labels[0] < 0 || labels[0] > stack->GetNtrack() || nlabels <= 1) {
-    if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Exit : label[0] %d, n primaries %d, nlabels %d \n",
-                          labels[0],stack->GetNtrack(), nlabels);
+  if(labels[0] < 0 || labels[0] > stack->GetNtrack() || nlabels <= 1)
+  {
+    AliDebug(2,Form("Exit : label[0] %d, n primaries %d, nlabels %d",labels[0],stack->GetNtrack(), nlabels));
     return;
   }
   
@@ -861,17 +842,16 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
   Int_t mesonPdg    = meson->GetPdgCode();
   if(mesonPdg!=111 && mesonPdg!=221)
   {
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Wrong pi0/eta PDG : %d \n",mesonPdg);
+    AliWarning(Form("Wrong pi0/eta PDG : %d",mesonPdg));
     return;
   }
   
-  if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - %s, label %d\n",meson->GetName(), mesonIndex);
+  AliDebug(2,Form("%s, label %d",meson->GetName(), mesonIndex));
   
   //Check if meson decayed into 2 daughters or if both were kept.
   if(meson->GetNDaughters() != 2)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. Number of daughters is %d, not 2 \n",meson->GetNDaughters());
+    AliDebug(2,Form("Not overalapped. Number of daughters is %d, not 2",meson->GetNDaughters()));
     return;
   }
   
@@ -884,25 +864,23 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
   //Check if both daughters are photons
   if(photon0->GetPdgCode() != 22 || photon1->GetPdgCode()!=22)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. PDG:  daughter 1 = %d, of daughter 2 = %d \n",photon0->GetPdgCode(),photon1->GetPdgCode());
+    AliDebug(2,Form("Not overalapped. PDG:  daughter 1 = %d, of daughter 2 = %d",photon0->GetPdgCode(),photon1->GetPdgCode()));
     return;
   }
   
-  if(fDebug > 2) 
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Daughter labels : photon0 = %d, photon1 = %d \n",iPhoton0,iPhoton1);
+  AliDebug(2,Form("Daughter labels : photon0 = %d, photon1 = %d",iPhoton0,iPhoton1));
   
   //Check if both photons contribute to the cluster
   Bool_t okPhoton0 = kFALSE;
   Bool_t okPhoton1 = kFALSE;
   
-  if(fDebug > 3) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Labels loop:\n");
+  AliDebug(3,"Labels loop:");
   
   Bool_t conversion = kFALSE;
   
   for(Int_t i = 0; i < nlabels; i++)
   {
-    if(fDebug > 3) printf("\t  at begin:label %d/%d: %d, ok? photon1 %d, photon2 %d\n", i+1, nlabels, labels[i], okPhoton0, okPhoton1);
+    AliDebug(3,Form("\t  at begin:label %d/%d: %d, ok? photon1 %d, photon2 %d", i+1, nlabels, labels[i], okPhoton0, okPhoton1));
     
     //If we already found both, break the loop
     if(okPhoton0 && okPhoton1) break;
@@ -923,18 +901,19 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
     
     if(index >= stack->GetNtrack())
     {
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) Particle index %d larger than size of list %d !!\n",
-             index,stack->GetNtrack());
+      AliWarning(Form("Particle index %d larger than size of list %d!!",index,stack->GetNtrack()));
       continue;
     }
     
     TParticle * daught = stack->Particle(index);
     Int_t tmpindex = daught->GetFirstMother();         
-    if(fDebug > 3) printf("\t Conversion? : mother %d\n",tmpindex);
+    
+    AliDebug(3,Form("\t Conversion? : mother %d",tmpindex));
+    
     while(tmpindex>=0)
     {
       //MC particle of interest is the mother
-      if(fDebug > 3) printf("\t \t parent index %d\n",tmpindex);
+      AliDebug(3,Form("\t \t parent index %d",tmpindex));
       daught   = stack->Particle(tmpindex);
       if      (iPhoton0 == tmpindex)
       {
@@ -953,16 +932,15 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
       
     }//While to check if pi0/eta daughter was one of these contributors to the cluster
     
-    if(i == 0 && (!okPhoton0 && !okPhoton1) && fDebug>=0) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Something happens, first label should be from a photon decay!\n");
+    //if(i == 0 && (!okPhoton0 && !okPhoton1))
+    //  AliDebug(1,Form("Something happens, first label should be from a photon decay!"));
     
   }//loop on list of labels
   
   //If both photons contribute tag as the corresponding meson.
   if(okPhoton0 && okPhoton1)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - %s OVERLAPPED DECAY \n", meson->GetName());
+    AliDebug(2,Form("%s OVERLAPPED DECAY", meson->GetName()));
     
     if(!CheckTagBit(tag,kMCConversion) && conversion) SetTagBit(tag,kMCConversion) ;
     
@@ -976,13 +954,11 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels,    Int_
 void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels, Int_t mesonIndex,
                                                     const TClonesArray *mcparticles, Int_t & tag   )
 {
-  //Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in AODMCParticles
+  // Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in AODMCParticles.
   
   if(labels[0] < 0 || labels[0] > mcparticles->GetEntriesFast() || nlabels <= 1)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Exit : label[0] %d, n primaries %d, nlabels %d \n",
-             labels[0],mcparticles->GetEntriesFast(), nlabels);
+    AliDebug(2,Form("Exit : label[0] %d, n primaries %d, nlabels %d",labels[0],mcparticles->GetEntriesFast(), nlabels));
     return;
   }
   
@@ -990,18 +966,16 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t n
   Int_t mesonPdg = meson->GetPdgCode();
   if(mesonPdg != 111 && mesonPdg != 221)
   {
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Wrong pi0/eta PDG : %d \n",mesonPdg);
+    AliWarning(Form("Wrong pi0/eta PDG : %d",mesonPdg));
     return;
   }
   
-  if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - pdg %d, label %d, ndaughters %d\n", mesonPdg, mesonIndex, meson->GetNDaughters());
-  
+  AliDebug(2,Form("pdg %d, label %d, ndaughters %d", mesonPdg, mesonIndex, meson->GetNDaughters()));
   
   //Get the daughters
   if(meson->GetNDaughters() != 2)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. Number of daughters is %d, not 2 \n",meson->GetNDaughters());
+    AliDebug(2,Form("Not overalapped. Number of daughters is %d, not 2",meson->GetNDaughters()));
     return;
   }
   
@@ -1018,26 +992,23 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t n
   //Check if both daughters are photons
   if(photon0->GetPdgCode() != 22 && photon1->GetPdgCode()!=22)
   {
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Not overlapped. PDG:  daughter 1 = %d, of daughter 2 = %d \n",photon0->GetPdgCode(),photon1->GetPdgCode());
+    AliWarning(Form("Not overlapped. PDG:  daughter 1 = %d, of daughter 2 = %d",photon0->GetPdgCode(),photon1->GetPdgCode()));
     return;
   }
   
-  if(fDebug > 2) 
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Daughter labels : photon0 = %d, photon1 = %d \n",iPhoton0,iPhoton1);
+  AliDebug(2,Form("Daughter labels : photon0 = %d, photon1 = %d",iPhoton0,iPhoton1));
   
   //Check if both photons contribute to the cluster
   Bool_t okPhoton0 = kFALSE;
   Bool_t okPhoton1 = kFALSE;
   
-  if(fDebug > 3) 
-    printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Labels loop:\n");
+  AliDebug(3,"Labels loop:");
   
   Bool_t conversion = kFALSE;
   
   for(Int_t i = 0; i < nlabels; i++)
   {
-    if(fDebug > 3)
-      printf("\t label %d/%d: %d, ok? %d, %d\n", i, nlabels, labels[i], okPhoton0, okPhoton1);
+    AliDebug(3, Form("\t label %d/%d: %d, ok? %d, %d", i, nlabels, labels[i], okPhoton0, okPhoton1));
     
     if(labels[i]<0) continue;
     
@@ -1060,20 +1031,18 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t n
     
     if(index >= mcparticles->GetEntriesFast())
     {
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) Particle index %d larger than size of list %d !!\n",index,mcparticles->GetEntriesFast());
+      AliWarning(Form("Particle index %d larger than size of list %d!!",index,mcparticles->GetEntriesFast()));
       continue;
     }
     
     AliAODMCParticle * daught = (AliAODMCParticle*) mcparticles->At(index);
     Int_t tmpindex = daught->GetMother();
-    if(fDebug > 3) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Conversion? : mother %d\n",tmpindex);
+    AliDebug(3,Form("Conversion? : mother %d",tmpindex));
     
     while(tmpindex>=0){
       
       //MC particle of interest is the mother
-      if(fDebug > 3) 
-        printf("\t parent index %d\n",tmpindex);
+      AliDebug(3,Form("\t parent index %d",tmpindex));
       daught   = (AliAODMCParticle*) mcparticles->At(tmpindex);
       //printf("tmpindex %d\n",tmpindex);
       if      (iPhoton0 == tmpindex)
@@ -1093,22 +1062,18 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t n
       
     }//While to check if pi0/eta daughter was one of these contributors to the cluster
     
-    if(i == 0 && (!okPhoton0 && !okPhoton1) && fDebug>=0 )
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Something happens, first label should be from a photon decay!\n");
+    //if(i == 0 && (!okPhoton0 && !okPhoton1)) AliDebug(1,"Something happens, first label should be from a photon decay!");
     
   }//loop on list of labels
   
   //If both photons contribute tag as the corresponding meson.
   if(okPhoton0 && okPhoton1)
   {
-    if(fDebug > 2) 
-      printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - %s OVERLAPPED DECAY \n",
-             (TDatabasePDG::Instance()->GetParticle(mesonPdg))->GetName());
+    AliDebug(2,Form("%s OVERLAPPED DECAY",(TDatabasePDG::Instance()->GetParticle(mesonPdg))->GetName()));
     
     if(!CheckTagBit(tag,kMCConversion) && conversion)
     {
-      if(fDebug > 2)
-        printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) Second decay photon produced a conversion \n");
+      AliDebug(2,"Second decay photon produced a conversion");
       SetTagBit(tag,kMCConversion) ;
     }
     
@@ -1122,7 +1087,7 @@ void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t n
 void    AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray* arrayCluster,   Int_t iMom, Int_t iParent,
                                                AliStack * stack,                Int_t & tag)
 {
-  // Check on ESDs if the current decay photon has the second photon companion lost
+  // Check on ESDs if the current decay photon has the second photon companion lost.
   
   if(!arrayCluster || iMom < 0 || iParent < 0|| !stack) return;
   
@@ -1216,8 +1181,8 @@ void    AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray* arrayCluster,
 void    AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray   * arrayCluster,Int_t iMom, Int_t iParent,
                                                const TClonesArray* mcparticles, Int_t & tag)
 {
-  // Check on AODs if the current decay photon has the second photon companion lost
-  
+  // Check on AODs if the current decay photon has the second photon companion lost.
+
   if(!arrayCluster || iMom < 0 || iParent < 0|| !mcparticles) return;
 
   AliAODMCParticle * parent = (AliAODMCParticle*) mcparticles->At(iParent);
@@ -1328,14 +1293,14 @@ void    AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray   * arrayCluster,
 
   
   SetTagBit(tag, kMCDecayPairLost);
-
-
+  
 }
 
 //_____________________________________________________________________
 TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
 {
-  //Return list of jets (TParticles) and index of most likely parton that originated it.
+  // Return list of jets (TParticles) and index of most likely parton that originated it.
+  
   AliStack * stack = reader->GetStack();
   Int_t iEvent = reader->GetEventNumber();     
   AliGenEventHeader * geh = reader->GetGenEventHeader();
@@ -1350,12 +1315,12 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
     if(stack->GetNtrack() < 8) return fJetsList;
     TParticle * parton1 =  stack->Particle(6);
     TParticle * parton2 =  stack->Particle(7);
-    if(fDebug > 2){
-      printf("AliMCAnalysisUtils::GetJets() - parton 6 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
-             parton1->GetName(),parton1->Pt(),parton1->Energy(),parton1->Phi()*TMath::RadToDeg(),parton1->Eta());
-      printf("AliMCAnalysisUtils::GetJets() - parton 7 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
-             parton2->GetName(),parton2->Pt(),parton2->Energy(),parton2->Phi()*TMath::RadToDeg(),parton2->Eta());
-               }
+    
+    AliDebug(2,Form("Parton 6 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f",
+                    parton1->GetName(),parton1->Pt(),parton1->Energy(),parton1->Phi()*TMath::RadToDeg(),parton1->Eta()));
+    AliDebug(2,Form("Parton 7 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f",
+                    parton2->GetName(),parton2->Pt(),parton2->Energy(),parton2->Phi()*TMath::RadToDeg(),parton2->Eta()));
+    
     //                 //Trace the jet from the mother parton
     //                 Float_t pt  = 0;
     //                 Float_t pt1 = 0;
@@ -1395,13 +1360,12 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
                
                //Get the jet, different way for different generator
                //PYTHIA
-    if(fMCGenerator == "PYTHIA")
+    if(fMCGenerator == kPythia)
     {
       TParticle * jet =  0x0;
       AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) geh;
       nTriggerJets =  pygeh->NTriggerJets();
-      if(fDebug > 1)
-        printf("AliMCAnalysisUtils::GetJets() - PythiaEventHeader: Njets: %d\n",nTriggerJets);
+      AliDebug(2,Form("PythiaEventHeader: Njets: %d",nTriggerJets));
       
       for(Int_t i = 0; i< nTriggerJets; i++)
       {
@@ -1413,14 +1377,13 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
         if(phidiff1 > phidiff2) jet->SetFirstMother(7);
         else  jet->SetFirstMother(6);
         //jet->Print();
-        if(fDebug > 1)
-          printf("AliMCAnalysisUtils::GetJets() - PYTHIA Jet %d: mother %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
-                 i, jet->GetFirstMother(),jet->Pt(),jet->Energy(),jet->Phi()*TMath::RadToDeg(),jet->Eta());
+        AliDebug(1,Form("PYTHIA Jet %d: mother %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f",
+                        i, jet->GetFirstMother(),jet->Pt(),jet->Energy(),jet->Phi()*TMath::RadToDeg(),jet->Eta()));
         fJetsList->Add(jet);                   
       }
     }//Pythia triggered jets
     //HERWIG
-    else if (fMCGenerator=="HERWIG")
+    else if (fMCGenerator == kHerwig)
     {
       Int_t pdg = -1;          
       //Check parton 1
@@ -1441,9 +1404,8 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
         //tmp = stack->Particle(tmp->GetFirstDaughter());
         //tmp->Print();
         //jet1->Print();
-        if(fDebug > 1)                 
-          printf("AliMCAnalysisUtils::GetJets() - HERWIG Jet 1: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
-                 jet1->GetFirstMother(),jet1->GetStatusCode(),jet1->Pt(),jet1->Energy(),jet1->Phi()*TMath::RadToDeg(),jet1->Eta());
+        AliDebug(1,Form("HERWIG Jet 1: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f",
+                        jet1->GetFirstMother(),jet1->GetStatusCode(),jet1->Pt(),jet1->Energy(),jet1->Phi()*TMath::RadToDeg(),jet1->Eta()));
       }//not photon
       
       //Check parton 2
@@ -1463,9 +1425,8 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
         jet2->SetFirstMother(7);
         fJetsList->Add(jet2);
         //jet2->Print();
-        if(fDebug > 1)
-          printf("AliMCAnalysisUtils::GetJets() - HERWIG Jet 2: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
-                 jet2->GetFirstMother(),jet2->GetStatusCode(),jet2->Pt(),jet2->Energy(),jet2->Phi()*TMath::RadToDeg(),jet2->Eta());
+        AliDebug(2,Form("HERWIG Jet 2: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f",
+                        jet2->GetFirstMother(),jet2->GetStatusCode(),jet2->Pt(),jet2->Energy(),jet2->Phi()*TMath::RadToDeg(),jet2->Eta()));
         //Int_t first =  tmp->GetFirstDaughter();
         //Int_t last  =  tmp->GetLastDaughter();
         //printf("jet 2:  first daughter %d, last daughter %d, pdg %d\n",first, last, tmp->GetPdgCode());
@@ -1489,19 +1450,17 @@ TLorentzVector AliMCAnalysisUtils::GetDaughter(Int_t idaugh, Int_t label,
                                                const AliCaloTrackReader* reader,
                                                Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & daughlabel)
 {
-  //Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother
-  
-  TLorentzVector daughter(0,0,0,0);
+  // Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother.
+  fDaughMom.SetPxPyPzE(0,0,0,0);
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack())
     {
-      if (fDebug >=0)
-        printf("AliMCAnalysisUtils::GetDaughter() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+      AliWarning("Stack is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
-      return daughter;
+      return fDaughMom;
     }
     
     Int_t nprimaries = reader->GetStack()->GetNtrack();
@@ -1513,18 +1472,18 @@ TLorentzVector AliMCAnalysisUtils::GetDaughter(Int_t idaugh, Int_t label,
       if(daughlabel < 0 || daughlabel >= nprimaries)
       {
         ok = kFALSE;
-        return daughter;
+        return fDaughMom;
       }
       
       TParticle * daughP = reader->GetStack()->Particle(daughlabel);
-      daughP->Momentum(daughter);
+      daughP->Momentum(fDaughMom);
       pdg    = daughP->GetPdgCode();
       status = daughP->GetStatusCode();
     }
     else
     {
       ok = kFALSE;
-      return daughter;
+      return fDaughMom;
     }
   }
   else if(reader->ReadAODMCParticles())
@@ -1532,11 +1491,10 @@ TLorentzVector AliMCAnalysisUtils::GetDaughter(Int_t idaugh, Int_t label,
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles)
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetDaughter() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
-      return daughter;
+      return fDaughMom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
@@ -1548,30 +1506,30 @@ TLorentzVector AliMCAnalysisUtils::GetDaughter(Int_t idaugh, Int_t label,
       if(daughlabel < 0 || daughlabel >= nprimaries)
       {
         ok = kFALSE;
-        return daughter;
+        return fDaughMom;
       }
       
       AliAODMCParticle * daughP = (AliAODMCParticle *) mcparticles->At(daughlabel);
-      daughter.SetPxPyPzE(daughP->Px(),daughP->Py(),daughP->Pz(),daughP->E());
+      fDaughMom.SetPxPyPzE(daughP->Px(),daughP->Py(),daughP->Pz(),daughP->E());
       pdg    = daughP->GetPdgCode();
       status = daughP->GetStatus();
     }
     else
     {
       ok = kFALSE;
-      return daughter;
+      return fDaughMom;
     }
   }
   
   ok = kTRUE;
   
-  return daughter;
+  return fDaughMom;
 }
 
 //______________________________________________________________________________________________________
 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader, Bool_t & ok)
 {
-  //Return the kinematics of the particle that generated the signal
+  // Return the kinematics of the particle that generated the signal.
   
   Int_t pdg = -1; Int_t status = -1; Int_t momlabel = -1;
   return GetMother(label,reader,pdg,status, ok,momlabel);
@@ -1581,7 +1539,7 @@ TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackRead
 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader,
                                              Int_t & pdg, Int_t & status, Bool_t & ok)
 {
-  //Return the kinematics of the particle that generated the signal
+  // Return the kinematics of the particle that generated the signal.
   
   Int_t momlabel = -1;
   return GetMother(label,reader,pdg,status, ok,momlabel);
@@ -1591,32 +1549,31 @@ TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackRead
 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader, 
                                              Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & momlabel)
 {
-  //Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother
+  // Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother.
   
-  TLorentzVector mom(0,0,0,0);
+  fMotherMom.SetPxPyPzE(0,0,0,0);
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack()) 
     {
-      if (fDebug >=0) 
-        printf("AliMCAnalysisUtils::GetMother() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+      AliWarning("Stack is not available, check analysis settings in configuration file, STOP!!");
      
       ok=kFALSE;
-      return mom;
+      return fMotherMom;
     }
     if(label >= 0 && label < reader->GetStack()->GetNtrack())
     {
       TParticle * momP = reader->GetStack()->Particle(label);
-      momP->Momentum(mom);
-      pdg    = momP->GetPdgCode();
-      status = momP->GetStatusCode();
+      momP->Momentum(fMotherMom);
+      pdg      = momP->GetPdgCode();
+      status   = momP->GetStatusCode();
       momlabel = momP->GetFirstMother();
     } 
     else 
     {
       ok = kFALSE;
-      return mom;
+      return fMotherMom;
     }
   }
   else if(reader->ReadAODMCParticles())
@@ -1624,32 +1581,31 @@ TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackRead
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles) 
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetMother() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
-      return mom;
+      return fMotherMom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
     if(label >= 0 && label < nprimaries)
     {
       AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
-      mom.SetPxPyPzE(momP->Px(),momP->Py(),momP->Pz(),momP->E());
-      pdg    = momP->GetPdgCode();
-      status = momP->GetStatus();
+      fMotherMom.SetPxPyPzE(momP->Px(),momP->Py(),momP->Pz(),momP->E());
+      pdg      = momP->GetPdgCode();
+      status   = momP->GetStatus();
       momlabel = momP->GetMother();
     }
     else 
     {
       ok = kFALSE;
-      return mom;
+      return fMotherMom;
     }
   }
   
   ok = kTRUE;
   
-  return mom;
+  return fMotherMom;
 }
 
 //___________________________________________________________________________________
@@ -1657,20 +1613,18 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
                                                     const AliCaloTrackReader* reader,
                                                     Bool_t & ok, Int_t & momlabel)
 {
-  //Return the kinematics of the particle that generated the signal
-  
-  TLorentzVector grandmom(0,0,0,0);
+  // Return the kinematics of the particle that generated the signal.
   
+  fGMotherMom.SetPxPyPzE(0,0,0,0);
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack())
     {
-      if (fDebug >=0) 
-        printf("AliMCAnalysisUtils::GetMotherWithPDG() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+     AliWarning("Stack is not available, check analysis settings in configuration file!!");
       
       ok = kFALSE;
-      return grandmom;
+      return fGMotherMom;
     }
     
     if(label >= 0 && label < reader->GetStack()->GetNtrack())
@@ -1687,7 +1641,7 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
         if(grandmomPDG==pdg)
         {
           momlabel = grandmomLabel;
-          grandmom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
+          fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
           break;
         }
         
@@ -1695,7 +1649,7 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
         
       }
       
-      if(grandmomPDG!=pdg) printf("AliMCAnalysisUtils::GetMotherWithPDG(ESD) - mother with PDG %d, not found! \n",pdg);
+      if(grandmomPDG!=pdg) AliInfo(Form("Mother with PDG %d, not found! \n",pdg));
     }
   }
   else if(reader->ReadAODMCParticles())
@@ -1703,11 +1657,10 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles) 
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetMotherWithPDG() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
-      return grandmom;
+      return fGMotherMom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
@@ -1726,7 +1679,7 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
         {
           //printf("AliMCAnalysisUtils::GetMotherWithPDG(AOD) - mother with PDG %d FOUND! \n",pdg);
           momlabel = grandmomLabel;
-          grandmom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
+          fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
           break;
         }
         
@@ -1734,14 +1687,14 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
         
       }
       
-      if(grandmomPDG!=pdg) printf("AliMCAnalysisUtils::GetMotherWithPDG(AOD) - mother with PDG %d, NOT found! \n",pdg);
+      if(grandmomPDG!=pdg) AliInfo(Form("Mother with PDG %d, NOT found!",pdg));
             
     }
   }
   
   ok = kTRUE;
   
-  return grandmom;
+  return fGMotherMom;
 }
 
 //______________________________________________________________________________________________
@@ -1749,19 +1702,18 @@ TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrac
                                                   Int_t & pdg, Int_t & status, Bool_t & ok,
                                                   Int_t & grandMomLabel, Int_t & greatMomLabel)
 {
-  //Return the kinematics of the particle that generated the signal
+  // Return the kinematics of the particle that generated the signal.
   
-  TLorentzVector grandmom(0,0,0,0);
+  fGMotherMom.SetPxPyPzE(0,0,0,0);
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack())
     {
-      if (fDebug >=0)
-        printf("AliMCAnalysisUtils::GetGrandMother() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+      AliWarning("Stack is not available, check analysis settings in configuration file, STOP!!");
       
       ok = kFALSE;
-      return grandmom;
+      return fGMotherMom;
     }
     
     if(label >= 0 && label < reader->GetStack()->GetNtrack())
@@ -1778,7 +1730,7 @@ TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrac
         pdg    = grandmomP->GetPdgCode();
         status = grandmomP->GetStatusCode();
        
-        grandmom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
+        fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
         greatMomLabel =  grandmomP->GetFirstMother();
 
       }
@@ -1789,11 +1741,10 @@ TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrac
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles)
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetGrandMother() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
-      return grandmom;
+      return fGMotherMom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
@@ -1811,7 +1762,7 @@ TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrac
         pdg    = grandmomP->GetPdgCode();
         status = grandmomP->GetStatus();
       
-        grandmom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
+        fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
         greatMomLabel =  grandmomP->GetMother();
         
       }
@@ -1820,22 +1771,20 @@ TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrac
   
   ok = kTRUE;
   
-  return grandmom;
+  return fGMotherMom;
 }
 
 //_______________________________________________________________________________________________________________
 void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg, const AliCaloTrackReader* reader,
                                                         Float_t & asym, Float_t & angle, Bool_t & ok)
 {
-  //In case of an eta or pi0 decay into 2 photons, get the asymmetry  in the energy of the photons
-  
+  // In case of an eta or pi0 decay into 2 photons, get the asymmetry  in the energy of the photons.
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack())
     {
-      if (fDebug >=0) 
-        printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+      AliWarning("Stack is not available, check analysis settings in configuration file, STOP!!");
       
       ok = kFALSE;
     }
@@ -1864,16 +1813,15 @@ void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg,
         if(d1->GetPdgCode() == 22 && d1->GetPdgCode() == 22)
         {
           asym = (d1->Energy()-d2->Energy())/grandmomP->Energy();
-          TLorentzVector lvd1, lvd2;
-          d1->Momentum(lvd1);
-          d2->Momentum(lvd2);
-          angle = lvd1.Angle(lvd2.Vect());
+          d1->Momentum(fDaughMom );
+          d2->Momentum(fDaughMom2);
+          angle = fDaughMom.Angle(fDaughMom2.Vect());
         }
       }
       else 
       {
         ok=kFALSE;
-        printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG(ESD) - mother with PDG %d, not found! \n",pdg);
+        AliInfo(Form("Mother with PDG %d, not found!",pdg));
       }
       
       } // good label
@@ -1883,8 +1831,7 @@ void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg,
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles) 
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
       return;
@@ -1916,16 +1863,15 @@ void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg,
         if(d1->GetPdgCode() == 22 && d1->GetPdgCode() == 22)
         {
           asym = (d1->E()-d2->E())/grandmomP->E();
-          TLorentzVector lvd1, lvd2;
-          lvd1.SetPxPyPzE(d1->Px(),d1->Py(),d1->Pz(),d1->E());
-          lvd2.SetPxPyPzE(d2->Px(),d2->Py(),d2->Pz(),d2->E());
-          angle = lvd1.Angle(lvd2.Vect());
+          fDaughMom .SetPxPyPzE(d1->Px(),d1->Py(),d1->Pz(),d1->E());
+          fDaughMom2.SetPxPyPzE(d2->Px(),d2->Py(),d2->Pz(),d2->E());
+          angle = fDaughMom.Angle(fDaughMom2.Vect());
         }
       }
       else 
       {
         ok=kFALSE;
-        printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG(AOD) - mother with PDG %d, not found! \n",pdg);
+        AliInfo(Form("Mother with PDG %d, not found! \n",pdg));
       }
       
     } // good label
@@ -1935,19 +1881,16 @@ void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg,
   
 }
 
-
 //_________________________________________________________________________________________________
 Int_t AliMCAnalysisUtils::GetNDaughters(Int_t label, const AliCaloTrackReader* reader, Bool_t & ok)
 {
-  // Return the the number of daughters of a given MC particle
-  
+  // Return the the number of daughters of a given MC particle.
   
   if(reader->ReadStack())
   {
     if(!reader->GetStack())
     {
-      if (fDebug >=0)
-        printf("AliMCAnalysisUtils::GetNDaughters() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
+      AliWarning("Stack is not available, check analysis settings in configuration file, STOP!!");
       
       ok=kFALSE;
       return -1;
@@ -1969,8 +1912,7 @@ Int_t AliMCAnalysisUtils::GetNDaughters(Int_t label, const AliCaloTrackReader* r
     TClonesArray* mcparticles = reader->GetAODMCParticles();
     if(!mcparticles)
     {
-      if(fDebug >= 0)
-        printf("AliMCAnalysisUtils::GetNDaughters() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
+      AliWarning("AODMCParticles is not available, check analysis settings in configuration file!!");
       
       ok=kFALSE;
       return -1;
@@ -2001,19 +1943,19 @@ Int_t AliMCAnalysisUtils::GetNOverlaps(const Int_t * label, UInt_t nlabels,
                                        AliCaloTrackReader * reader, Int_t *overpdg)
 {
   // Compare the primary depositing more energy with the rest,
-  // if no photon/electron (conversion) or neutral meson as comon ancestor, consider it as other particle contributing
-  // Give as input the meson label in case it was a pi0 or eta merged cluster
-  // Init overpdg with nlabels
+  // if no photon/electron (conversion) or neutral meson as comon ancestor, consider it as other particle contributing.
+  // Give as input the meson label in case it was a pi0 or eta merged cluster.
+  // Init overpdg with nlabels.
   
   Int_t ancPDG = 0, ancStatus = -1;
-  TLorentzVector momentum; TVector3 prodVertex;
+  TVector3 prodVertex;
   Int_t ancLabel = 0;
   Int_t noverlaps = 0;
   Bool_t ok = kFALSE;
   
   for (UInt_t ilab = 1; ilab < nlabels; ilab++ )
   {
-    ancLabel = CheckCommonAncestor(label[0],label[ilab],reader,ancPDG,ancStatus,momentum,prodVertex);
+    ancLabel = CheckCommonAncestor(label[0],label[ilab],reader,ancPDG,ancStatus,fMotherMom,prodVertex);
     
     //printf("Overlaps, i %d: Main Label %d, second label %d, ancestor: Label %d, pdg %d - tag %d \n",
     //       ilab,label[0],label[ilab],ancLabel,ancPDG, mctag);
@@ -2049,8 +1991,10 @@ Int_t AliMCAnalysisUtils::GetNOverlaps(const Int_t * label, UInt_t nlabels,
     Int_t   mpdg = -999999,  gpdg = -1;
     Int_t   mstatus = -1, gstatus = -1;
     Int_t   gLabel = -1, ggLabel = -1;
-    TLorentzVector mother      = GetMother     (label[ilab],reader,mpdg,mstatus,mOK);
-    TLorentzVector grandmother = GetGrandMother(label[ilab],reader,gpdg,gstatus,gOK, gLabel,ggLabel);
+    
+    GetMother     (label[ilab],reader,mpdg,mstatus,mOK);
+    fGMotherMom =
+    GetGrandMother(label[ilab],reader,gpdg,gstatus,gOK, gLabel,ggLabel);
     
     //printf("\t Overlap!, mother pdg %d; grand mother pdg %d",mpdg,gpdg);
     
@@ -2062,7 +2006,7 @@ Int_t AliMCAnalysisUtils::GetNOverlaps(const Int_t * label, UInt_t nlabels,
       while( ( gpdg == 22 || TMath::Abs(gpdg==11) ) && gLabel >=0 )
       {
         mpdg=gpdg;
-        grandmother = GetGrandMother(labeltmp,reader,gpdg,gstatus,ok, gLabel,ggLabel);
+        fGMotherMom = GetGrandMother(labeltmp,reader,gpdg,gstatus,ok, gLabel,ggLabel);
         labeltmp=gLabel;
       }
     }
@@ -2076,7 +2020,7 @@ Int_t AliMCAnalysisUtils::GetNOverlaps(const Int_t * label, UInt_t nlabels,
 //________________________________________________________
 void AliMCAnalysisUtils::Print(const Option_t * opt) const
 {
-  //Print some relevant parameters set for the analysis
+  // Print some relevant parameters set for the analysis.
   
   if(! opt)
     return;
@@ -2084,7 +2028,7 @@ void AliMCAnalysisUtils::Print(const Option_t * opt) const
   printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
   
   printf("Debug level    = %d\n",fDebug);
-  printf("MC Generator   = %s\n",fMCGenerator.Data());
+  printf("MC Generator   = %s\n",fMCGeneratorString.Data());
   printf(" \n");
   
 } 
@@ -2092,7 +2036,7 @@ void AliMCAnalysisUtils::Print(const Option_t * opt) const
 //__________________________________________________
 void AliMCAnalysisUtils::PrintMCTag(Int_t tag) const
 {
-  // print the assigned origins to this particle
+  // Print the assigned origins to this particle.
   
   printf("AliMCAnalysisUtils::PrintMCTag() - tag %d \n    photon %d, conv %d, prompt %d, frag %d, isr %d, \n    pi0 decay %d, eta decay %d, other decay %d  pi0 %d,  eta %d \n    electron %d, muon %d,pion %d, proton %d, neutron %d, \n    kaon %d, a-proton %d, a-neutron %d, unk %d, bad %d\n",
          tag,
@@ -2119,4 +2063,39 @@ void AliMCAnalysisUtils::PrintMCTag(Int_t tag) const
          );
 } 
 
+//__________________________________________________
+void AliMCAnalysisUtils::SetMCGenerator(Int_t mcgen)
+{
+  // Set the generator type.
+  
+  fMCGenerator = mcgen ;
+  if     (mcgen == kPythia) fMCGeneratorString = "PYTHIA";
+  else if(mcgen == kHerwig) fMCGeneratorString = "HERWIG";
+  else if(mcgen == kHijing) fMCGeneratorString = "HIJING";
+  else
+  {
+    fMCGeneratorString = "";
+    fMCGenerator       = kBoxLike ;
+  }
+  
+}
+
+//__________________________________________________
+void AliMCAnalysisUtils::SetMCGenerator(TString mcgen)
+{
+  // Set the generator type.
+  
+  fMCGeneratorString = mcgen ;
+  
+  if     (mcgen == "PYTHIA") fMCGenerator = kPythia;
+  else if(mcgen == "HERWIG") fMCGenerator = kHerwig;
+  else if(mcgen == "HIJING") fMCGenerator = kHijing;
+  else
+  {
+    fMCGenerator       = kBoxLike;
+    fMCGeneratorString = "" ;
+  }
+}
+
+
 
index 8e51bac76c49ab09202f6c62918cf1029d502f1a..6b5a7d6482b3dd00ea6e20f393e41549d01d71cb 100755 (executable)
@@ -14,7 +14,8 @@
 
 // --- ROOT system ---
 #include <TObject.h>
-#include <TString.h> 
+#include <TString.h>
+#include <TLorentzVector.h>
 class TList ;
 class TVector3;
 
@@ -54,10 +55,10 @@ class AliMCAnalysisUtils : public TObject {
   Int_t   CheckCommonAncestor(Int_t index1, Int_t index2, const AliCaloTrackReader* reader, 
                              Int_t & ancPDG, Int_t & ancStatus, TLorentzVector & momentum, TVector3 & v) ;
   
-  Int_t   CheckOrigin(Int_t label, const AliCaloTrackReader * reader, TString calorimeter) ;
+  Int_t   CheckOrigin(Int_t label, const AliCaloTrackReader * reader, Int_t calorimeter) ;
   
   //Check the label of the most significant particle but do checks on the rest of the contributing labels
-  Int_t   CheckOrigin       (const Int_t *label,  Int_t nlabels, const AliCaloTrackReader * reader, TString calorimeter) ;
+  Int_t   CheckOrigin       (const Int_t *label,  Int_t nlabels, const AliCaloTrackReader * reader, Int_t calorimeter) ;
   Int_t   CheckOriginInStack(const Int_t *labels, Int_t nlabels, AliStack * stack               , const TObjArray *arrayCluster) ; // ESD
   Int_t   CheckOriginInAOD  (const Int_t *labels, Int_t nlabels, const TClonesArray* mcparticles, const TObjArray *arrayCluster) ; // AOD
   
@@ -108,8 +109,11 @@ class AliMCAnalysisUtils : public TObject {
   void    SetDebug(Int_t deb)           { fDebug=deb           ; }
   Int_t   GetDebug()              const { return fDebug        ; }     
   
-  void    SetMCGenerator(TString mcgen) { fMCGenerator = mcgen ; }
-  TString GetMCGenerator()        const { return fMCGenerator  ; }     
+  enum generator {kPythia = 0, kHerwig = 1, kHijing = 2, kBoxLike = 3 } ;
+  void    SetMCGenerator(Int_t   mcgen) ;
+  void    SetMCGenerator(TString mcgen) ;
+  Int_t   GetMCGenerator()        const { return fMCGenerator  ; }
+  TString GetMCGeneratorString()  const { return fMCGeneratorString ; }
   
   void    Print(const Option_t * opt) const;
   void    PrintMCTag(Int_t tag) const;
@@ -118,12 +122,18 @@ class AliMCAnalysisUtils : public TObject {
   Int_t   fCurrentEvent;        // Current Event
   Int_t   fDebug;               // Debug level
   TList * fJetsList;            // List of jets
-  TString fMCGenerator;         // MC geneator used to generate data in simulation
+  Int_t   fMCGenerator;         // MC generator used to generate data in simulation
+  TString fMCGeneratorString;   // MC generator used to generate data in simulation
+  
+  TLorentzVector fDaughMom;     //! particle momentum
+  TLorentzVector fDaughMom2;    //! particle momentum
+  TLorentzVector fMotherMom;    //! particle momentum
+  TLorentzVector fGMotherMom;   //! particle momentum
   
   AliMCAnalysisUtils & operator = (const AliMCAnalysisUtils & mcu) ; // cpy assignment
   AliMCAnalysisUtils(              const AliMCAnalysisUtils & mcu) ; // cpy ctor
   
-  ClassDef(AliMCAnalysisUtils,5)
+  ClassDef(AliMCAnalysisUtils,6)
 
 } ;
 
index b97642f7795eee3f6d53c7207b47bde748b4575a..ad4f448e6dc9c2306b0d2012bbf641d09d85b16b 100755 (executable)
@@ -23,7 +23,6 @@
 #include <TLorentzVector.h>
 #include <TH2.h>
 #include <TList.h>
-#include <TString.h>
 
 //---- AliRoot system ----
 #include "AliNeutralMesonSelection.h" 
@@ -216,7 +215,7 @@ Bool_t AliNeutralMesonSelection::IsAngleInWindow(Float_t angle, Float_t e) const
 //_________________________________________________________________
 Bool_t  AliNeutralMesonSelection::SelectPair(TLorentzVector gammai, 
                                              TLorentzVector gammaj, 
-                                             TString calo)  
+                                             Int_t calo)
 {  
   
   //Search for the neutral pion within selection cuts
@@ -274,7 +273,8 @@ Bool_t  AliNeutralMesonSelection::SelectPair(TLorentzVector gammai,
   Float_t invmassRightBandMinCut = fRightBandMinCut;
   Float_t invmassRightBandMixCut = fRightBandMaxCut;
 
-  if(calo=="EMCAL" && e > 6.)
+  // kEMCAL=0, kPHOS=1
+  if(calo==0 && e > 6.)
   { // for EMCAL, pi0s, mass depends strongly with energy for e > 6, loose max cut
   
     invmassmaxcut = (fInvMassMaxCutParam[0]+fInvMassMaxCut)+fInvMassMaxCutParam[1]*e+fInvMassMaxCutParam[2]*e*e;
index c5db9988eabb6d8808abf004012aa389411c4ca4..e70e364d964f44ee0fede57e4f2cd98b92066970 100755 (executable)
@@ -18,7 +18,6 @@
 class TLorentzVector ;
 class TList   ;
 class TH2F    ;
-class TString ;
 
 class AliNeutralMesonSelection : public TObject {
   
@@ -37,7 +36,7 @@ class AliNeutralMesonSelection : public TObject {
   Bool_t   AreNeutralMesonSelectionHistosKept()   const { return fKeepNeutralMesonHistos ; }
   void     KeepNeutralMesonSelectionHistos(Bool_t keep) { fKeepNeutralMesonHistos = keep ; }
   
-  Bool_t   SelectPair(TLorentzVector particlei,  TLorentzVector particlej, TString calo)  ;
+  Bool_t   SelectPair(TLorentzVector particlei,  TLorentzVector particlej, Int_t calo)  ;
   
   void     SetParticle(TString particleName) ;  // Do some default settings for "Pi0" or "Eta"
   TString  GetParticle()                          const { return fParticle               ; }
index 1374af024299aac874ff28231b20c9596013e818..06ed828d5ae5c20caf1498ec1ab80e4fc2f2c712 100644 (file)
@@ -1,8 +1,8 @@
-// $Id$
 //
 // Emcal base analysis task.
 //
 // Author: S.Aiola, M. Verweij
+
 #include "AliAnalysisTaskEmcal.h"
 
 #include <TClonesArray.h>
@@ -100,6 +100,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal() :
   fMainTriggerPatch(0x0),
   fTriggers(0),
   fOutput(0),
+  fHistEventCount(0),
   fHistTrialsAfterSel(0),
   fHistEventsAfterSel(0),
   fHistXsectionAfterSel(0),
@@ -182,6 +183,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal(const char *name, Bool_t histo) :
   fMainTriggerPatch(0x0),
   fTriggers(0),
   fOutput(0),
+  fHistEventCount(0),
   fHistTrialsAfterSel(0),
   fHistEventsAfterSel(0),
   fHistXsectionAfterSel(0),
@@ -357,22 +359,28 @@ void AliAnalysisTaskEmcal::UserCreateOutputObjects()
   fHistEventPlane->GetYaxis()->SetTitle("counts");
   fOutput->Add(fHistEventPlane);
 
-  fHistEventRejection = new TH1I("fHistEventRejection","Reasons to reject event",20,0,20);
-  fHistEventRejection->Fill("PhysSel",0);
-  fHistEventRejection->Fill("trigger",0);
-  fHistEventRejection->Fill("trigTypeSel",0);
-  fHistEventRejection->Fill("Cent",0);
-  fHistEventRejection->Fill("vertex contr.",0);
-  fHistEventRejection->Fill("Vz",0);
-  fHistEventRejection->Fill("trackInEmcal",0);
-  fHistEventRejection->Fill("minNTrack",0);
-  fHistEventRejection->Fill("VtxSel2013pA",0);
-  fHistEventRejection->Fill("PileUp",0);
-  fHistEventRejection->Fill("EvtPlane",0);
-  fHistEventRejection->Fill("SelPtHardBin",0);
+  fHistEventRejection = new TH1F("fHistEventRejection","Reasons to reject event",20,0,20);
+  fHistEventRejection->GetXaxis()->SetBinLabel(1,"PhysSel");
+  fHistEventRejection->GetXaxis()->SetBinLabel(2,"trigger");
+  fHistEventRejection->GetXaxis()->SetBinLabel(3,"trigTypeSel");
+  fHistEventRejection->GetXaxis()->SetBinLabel(4,"Cent");
+  fHistEventRejection->GetXaxis()->SetBinLabel(5,"vertex contr.");
+  fHistEventRejection->GetXaxis()->SetBinLabel(6,"Vz");
+  fHistEventRejection->GetXaxis()->SetBinLabel(7,"trackInEmcal");
+  fHistEventRejection->GetXaxis()->SetBinLabel(8,"minNTrack");
+  fHistEventRejection->GetXaxis()->SetBinLabel(9,"VtxSel2013pA");
+  fHistEventRejection->GetXaxis()->SetBinLabel(10,"PileUp");
+  fHistEventRejection->GetXaxis()->SetBinLabel(11,"EvtPlane");
+  fHistEventRejection->GetXaxis()->SetBinLabel(12,"SelPtHardBin");
   fHistEventRejection->GetYaxis()->SetTitle("counts");
   fOutput->Add(fHistEventRejection);
 
+  fHistEventCount = new TH1F("fHistEventCount","fHistEventCount",2,0,2);
+  fHistEventCount->GetXaxis()->SetBinLabel(1,"Accepted");
+  fHistEventCount->GetXaxis()->SetBinLabel(2,"Rejected");
+  fHistEventCount->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistEventCount);
+
   PostData(1, fOutput);
 }
 
@@ -409,8 +417,13 @@ void AliAnalysisTaskEmcal::UserExec(Option_t *)
   if (!RetrieveEventObjects())
     return;
 
-  if (!IsEventSelected()) 
+  if (IsEventSelected()) {
+    if (fGeneralHistograms) fHistEventCount->Fill("Accepted",1);
+  }
+  else {
+    if (fGeneralHistograms) fHistEventCount->Fill("Rejected",1);
     return;
+  }
 
   if (fGeneralHistograms && fCreateHisto) {
     if (!FillGeneralHistograms())
@@ -707,51 +720,53 @@ AliAnalysisTaskEmcal::BeamType AliAnalysisTaskEmcal::GetBeamType()
 }
 
 //________________________________________________________________________
-ULong_t AliAnalysisTaskEmcal::GetTriggerList(){
-         if (!fTriggerPatchInfo)
-           return 0;
-
-         //number of patches in event
-         Int_t nPatch = fTriggerPatchInfo->GetEntries();
-
-         //loop over patches to define trigger type of event
-         Int_t nG1 = 0;
-         Int_t nG2 = 0;
-         Int_t nJ1 = 0;
-         Int_t nJ2 = 0;
-         AliEmcalTriggerPatchInfo *patch;
-         for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
-           patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
-           if (patch->IsGammaHigh()) nG1++;
-           if (patch->IsGammaLow())  nG2++;
-           if (patch->IsJetHigh()) nJ1++;
-           if (patch->IsJetLow())  nJ2++;
-         }
+ULong_t AliAnalysisTaskEmcal::GetTriggerList()
+{
+  if (!fTriggerPatchInfo)
+    return 0;
+
+  //number of patches in event
+  Int_t nPatch = fTriggerPatchInfo->GetEntries();
 
-         AliDebug(2, "Patch summary: ");
-         AliDebug(2, Form("Number of patches: %d", nPatch));
-         AliDebug(2, Form("Jet:   low[%d], high[%d]" ,nJ2, nJ1));
-         AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
-
-         ULong_t triggers(0);
-         if (nG1>0)
-               SETBIT(triggers, kG1);
-         if (nG2>0)
-               SETBIT(triggers, kG2);
-         if (nJ1>0)
-               SETBIT(triggers, kJ1);
-         if (nJ2>0)
-               SETBIT(triggers, kJ2);
-         return triggers;
+  //loop over patches to define trigger type of event
+  Int_t nG1 = 0;
+  Int_t nG2 = 0;
+  Int_t nJ1 = 0;
+  Int_t nJ2 = 0;
+  AliEmcalTriggerPatchInfo *patch;
+  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
+    patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
+    if (patch->IsGammaHigh()) nG1++;
+    if (patch->IsGammaLow())  nG2++;
+    if (patch->IsJetHigh()) nJ1++;
+    if (patch->IsJetLow())  nJ2++;
+  }
+
+  AliDebug(2, "Patch summary: ");
+  AliDebug(2, Form("Number of patches: %d", nPatch));
+  AliDebug(2, Form("Jet:   low[%d], high[%d]" ,nJ2, nJ1));
+  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
+
+  ULong_t triggers(0);
+  if (nG1>0)
+    SETBIT(triggers, kG1);
+  if (nG2>0)
+    SETBIT(triggers, kG2);
+  if (nJ1>0)
+    SETBIT(triggers, kJ1);
+  if (nJ2>0)
+    SETBIT(triggers, kJ2);
+  return triggers;
 }
 
 //________________________________________________________________________
-Bool_t AliAnalysisTaskEmcal::HasTriggerType(TriggerType t){
-       // Check if event has a given trigger type
-       if(t == kND){
-               return fTriggers == 0;
-       }
-       return TESTBIT(fTriggers, int(t));
+Bool_t AliAnalysisTaskEmcal::HasTriggerType(TriggerType t)
+{
+  // Check if event has a given trigger type
+  if(t == kND){
+    return fTriggers == 0;
+  }
+  return TESTBIT(fTriggers, int(t));
 }
 
 //________________________________________________________________________
@@ -771,8 +786,7 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       }
     }
     if ((res & fOffTrigger) == 0) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("PhysSel",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("PhysSel",1);
       return kFALSE;
     }
   }
@@ -789,14 +803,12 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       }
     }
     if (!fired.Contains("-B-")) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("trigger",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
       return kFALSE;
     }
     TObjArray *arr = fTrigClass.Tokenize("|");
     if (!arr) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("trigger",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
       return kFALSE;
     }
     Bool_t match = 0;
@@ -811,24 +823,21 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
     }
     delete arr;
     if (!match) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("trigger",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
       return kFALSE;
     }
   }
 
   if (fTriggerTypeSel != kND) {
     if (!HasTriggerType(fTriggerTypeSel)) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("trigTypeSel",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("trigTypeSel",1);
       return kFALSE;
     }
   }
 
   if ((fMinCent != -999) && (fMaxCent != -999)) {
     if (fCent<fMinCent || fCent>fMaxCent) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("Cent",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("Cent",1);
       return kFALSE;
     }
   }
@@ -842,27 +851,24 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
     if(fMinVz>10.)  fMaxVz = 10.;
 
     if (!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("VtxSel2013pA",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("VtxSel2013pA",1);
       return kFALSE;
     }
 
     if (fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
-      fHistEventRejection->Fill("PileUp",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
       return kFALSE;
     }
   }
 
   if ((fMinVz != -999) && (fMaxVz != -999)) {
     if (fNVertCont == 0 ) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("vertex contr.",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("vertex contr.",1);
       return kFALSE;
     }
     Double_t vz = fVertex[2];
     if (vz<fMinVz || vz>fMaxVz) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("Vz",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("Vz",1);
       return kFALSE;
     }
   }
@@ -891,8 +897,7 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       }
     }
     if (!trackInEmcalOk) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("trackInEmcal",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("trackInEmcal",1);
       return kFALSE;
     }
   }
@@ -911,8 +916,7 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       }
     }
     if (nTracksAcc<fMinNTrack) {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("minNTrack",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("minNTrack",1);
       return kFALSE;
     }
   }
@@ -921,17 +925,15 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       !(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
       !(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane)) 
     {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("EvtPlane",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("EvtPlane",1);
       return kFALSE;
     }
 
   if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin)  {
-      if (fGeneralHistograms) 
-       fHistEventRejection->Fill("SelPtHardBin",1);
+      if (fGeneralHistograms) fHistEventRejection->Fill("SelPtHardBin",1);
       return kFALSE;
     }
-
+  
   return kTRUE;
 }
 
@@ -1282,3 +1284,40 @@ Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Dou
 
   return array;
 }
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcal::SetRejectionReasonLabels(TAxis* axis)
+{
+  axis->SetBinLabel(1,  "NullObject");
+  axis->SetBinLabel(2,  "Pt");
+  axis->SetBinLabel(3,  "Acceptance");
+  axis->SetBinLabel(4,  "BitMap");
+  axis->SetBinLabel(5,  "Bit4");
+  axis->SetBinLabel(6,  "Bit5");
+  axis->SetBinLabel(7,  "Bit6");
+  axis->SetBinLabel(8,  "Bit7");
+  axis->SetBinLabel(9,  "MCFlag");
+  axis->SetBinLabel(10, "MCGenerator");
+  axis->SetBinLabel(11, "ChargeCut");
+  axis->SetBinLabel(12, "Bit11");
+  axis->SetBinLabel(13, "Bit12");
+  axis->SetBinLabel(14, "IsEMCal");
+  axis->SetBinLabel(15, "Time");
+  axis->SetBinLabel(16, "Energy");
+  axis->SetBinLabel(17, "Bit16");
+  axis->SetBinLabel(18, "Bit17");
+  axis->SetBinLabel(19, "Area");
+  axis->SetBinLabel(20, "AreaEmc");
+  axis->SetBinLabel(21, "ZLeadingCh");
+  axis->SetBinLabel(22, "ZLeadingEmc");
+  axis->SetBinLabel(23, "NEF");
+  axis->SetBinLabel(24, "MinLeadPt");
+  axis->SetBinLabel(25, "MaxTrackPt");
+  axis->SetBinLabel(26, "MaxClusterPt");
+  axis->SetBinLabel(27, "Flavour");
+  axis->SetBinLabel(28, "TagStatus");
+  axis->SetBinLabel(29, "Bit28");
+  axis->SetBinLabel(30, "Bit29");
+  axis->SetBinLabel(31, "Bit30");
+  axis->SetBinLabel(32, "Bit31");
+}
index 44a5492e947b26bdca2cea7f46ae32c70736dd69..14c4319920e19a2d3d7f7e0722106373e99c4d9d 100644 (file)
@@ -87,6 +87,7 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   void                        SetVzRange(Double_t min, Double_t max)                { fMinVz             = min  ; fMaxVz   = max          ; }
 
  protected:
+  void                        SetRejectionReasonLabels(TAxis* axis);
   Double_t*                   GenerateFixedBinArray(Int_t n, Double_t min, Double_t max) const;
   void                        GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array) const;
   void                        SetMakeGeneralHistograms(Bool_t g)                    { fGeneralHistograms = g                              ; }
@@ -173,9 +174,10 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   TObjArray                   fParticleCollArray;          // particle/track collection array
   TObjArray                   fClusterCollArray;           // cluster collection array
   AliEmcalTriggerPatchInfo   *fMainTriggerPatch;           // main trigger patch, will be cached after calling GetMainTriggerPatch() first time
-  ULong_t                        fTriggers;                // list of fired triggers
+  ULong_t                     fTriggers;                   // list of fired triggers
 
   TList                      *fOutput;                     //!output list
+  TH1                        *fHistEventCount;             //!incoming and selected events
   TH1                        *fHistTrialsAfterSel;         //!total number of trials per pt hard bin after selection
   TH1                        *fHistEventsAfterSel;         //!total number of events per pt hard bin after selection
   TProfile                   *fHistXsectionAfterSel;       //!x section from pythia header
index f536eabc1c6de848604d0035d99615143069aac1..1b2342826a0c5b0b3dd3dd8eadd3eaa56e24687e 100644 (file)
@@ -94,14 +94,14 @@ AliVCluster* AliClusterContainer::GetCluster(Int_t i) const
 }
 
 //________________________________________________________________________
-AliVCluster* AliClusterContainer::GetAcceptCluster(Int_t i) const 
+AliVCluster* AliClusterContainer::GetAcceptCluster(Int_t i) 
 {
   //Return pointer to cluster if cluster is accepted
 
   AliVCluster *vc = GetCluster(i);
-  if(!vc) return 0;
+  if (!vc) return 0;
 
-  if(AcceptCluster(vc))
+  if (AcceptCluster(vc))
     return vc;
   else {
     AliDebug(2,"Cluster not accepted.");
@@ -119,7 +119,7 @@ AliVCluster* AliClusterContainer::GetClusterWithLabel(Int_t lab) const
 }
 
 //________________________________________________________________________
-AliVCluster* AliClusterContainer::GetAcceptClusterWithLabel(Int_t lab) const 
+AliVCluster* AliClusterContainer::GetAcceptClusterWithLabel(Int_t lab)  
 {
   //Get particle with label lab in array
   
@@ -171,40 +171,54 @@ void AliClusterContainer::GetMomentum(TLorentzVector &mom, Int_t i) const
 }
 
 //________________________________________________________________________
-Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus) const
+Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus)
 {
   // Return true if cluster is accepted.
 
-  if (!clus)
+  fRejectionReason = 0;
+
+  if (!clus) {
+    fRejectionReason |= kNullObject;
     return kFALSE;
+  }
       
-  if (!clus->IsEMCAL())
+  if (!clus->IsEMCAL()) {
+    fRejectionReason |= kIsEMCalCut;
     return kFALSE;
+  }
 
   if (clus->GetLabel() > fMinMCLabel) {
     if (clus->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap) {
       AliDebug(2,"MC Cluster not accepted because of MC bit map.");
+      fRejectionReason |= kBitMapCut;
       return kFALSE;
     }
   }
   else {
     if (clus->TestBits(fClusterBitMap) != (Int_t)fClusterBitMap) {
       AliDebug(2,"Cluster not accepted because of bit map.");
+      fRejectionReason |= kBitMapCut;
       return kFALSE;
     }
   }
 
-  if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow)
+  if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow) {
+    fRejectionReason |= kTimeCut;
     return kFALSE;
+  }
 
-  if (clus->E()<fClusECut)
+  if (clus->E()<fClusECut) {
+    fRejectionReason |= kEnergyCut;
     return kFALSE;
+  }
 
   TLorentzVector nPart;
   clus->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
 
-  if (nPart.Et() < fClusPtCut)
+  if (nPart.Et() < fClusPtCut) {
+    fRejectionReason |= kPtCut;
     return kFALSE;
+  }
   
   return kTRUE;
 }
index 3790e78dbacedff6a99f056f9937020759175da2..b1f4423018900bc64fbea0162e1ab7e5e62ff06d 100644 (file)
@@ -16,9 +16,9 @@ class AliClusterContainer : public AliEmcalContainer {
   AliClusterContainer(const char *name); 
   virtual ~AliClusterContainer(){;}
 
-  Bool_t                      AcceptCluster(AliVCluster         *vp) const;
-  AliVCluster                *GetAcceptCluster(Int_t i)              const;
-  AliVCluster                *GetAcceptClusterWithLabel(Int_t lab)   const;
+  Bool_t                      AcceptCluster(AliVCluster         *vp)      ;
+  AliVCluster                *GetAcceptCluster(Int_t i)                   ;
+  AliVCluster                *GetAcceptClusterWithLabel(Int_t lab)        ;
   AliVCluster                *GetCluster(Int_t i)                    const;
   AliVCluster                *GetClusterWithLabel(Int_t lab)         const;
   AliVCluster                *GetLeadingCluster(const char* opt="")       ;
index 3577b656b39977a8498d2e8195e163f2dccd15dc..6a9ce44150964cff8a6cccc46eba8f068e238bf6 100644 (file)
@@ -21,7 +21,8 @@ AliEmcalContainer::AliEmcalContainer():
   fIsParticleLevel(kFALSE),
   fClArray(0),
   fCurrentID(0),
-  fLabelMap(0)
+  fLabelMap(0),
+  fRejectionReason(0)
 {
   // Default constructor.
 
@@ -38,7 +39,8 @@ AliEmcalContainer::AliEmcalContainer(const char *name):
   fIsParticleLevel(kFALSE),
   fClArray(0),
   fCurrentID(0),
-  fLabelMap(0)
+  fLabelMap(0),
+  fRejectionReason(0)
 {
   // Standard constructor.
 
@@ -95,3 +97,14 @@ Int_t AliEmcalContainer::GetIndexFromLabel(Int_t lab) const
     return lab; 
   }
 }
+
+//________________________________________________________________________
+UShort_t AliEmcalContainer::GetRejectionReasonBitPosition() const
+{ 
+  // Returns the highest bit in the rejection map.
+
+  UInt_t rs = fRejectionReason;
+  UShort_t p = 0;
+  while (rs >>= 1) { p++; }
+  return p;
+}
index f745fc516441f20f359007f3842a83d759ab00bd..28cc61ab603213e909a87c53c690e5689ad43369 100644 (file)
@@ -14,22 +14,58 @@ class AliNamedArrayI;
 
 class AliEmcalContainer : public TNamed {
  public:
+  enum RejectionReason {
+    // General
+    kNullObject = 1<<0,
+    kPtCut = 1<<1,
+    kAcceptanceCut = 1<<2,
+    kBitMapCut = 1<<3,
+    // leave bits 4-7 free for future implementations
+    
+    // AliParticleContainer
+    kMCFlag = 1<<8,
+    kMCGeneratorCut = 1<<9,
+    kChargeCut = 1<<10,
+    // leave bits 11-12 free for future implementations
+
+    // AliClusterContainer
+    kIsEMCalCut = 1<<13,
+    kTimeCut = 1<<14,
+    kEnergyCut = 1<<15,
+    // leave bits 16-17 free for future implementations
+
+    // AliJetContainer
+    kAreaCut = 1<<18,
+    kAreaEmcCut = 1<<19,
+    kZLeadingChCut = 1<<20,
+    kZLeadingEmcCut = 1<<21,
+    kNEFCut = 1<<22,
+    kMinLeadPtCut = 1<<23,
+    kMaxTrackPtCut = 1<<24,
+    kMaxClusterPtCut = 1<<25,
+    kFlavourCut = 1<<26,
+    kTagStatus = 1<<27
+  };
+
   AliEmcalContainer();
   AliEmcalContainer(const char *name); 
   virtual ~AliEmcalContainer(){;}
 
   TClonesArray               *GetArray()                          { return fClArray                   ; }
-  const TString&              GetArrayName()                const { return fClArrayName               ; }
-  Int_t                       GetCurrentID()                const { return fCurrentID-1               ; }
-  Bool_t                      GetIsParticleLevel()          const { return fIsParticleLevel           ; }
-  Int_t                       GetIndexFromLabel(Int_t lab)  const;
-  Int_t                       GetNEntries()                 const { return fClArray->GetEntriesFast() ; }
+  const TString&              GetArrayName()                  const { return fClArrayName               ; }
+  Int_t                       GetCurrentID()                  const { return fCurrentID-1               ; }
+  Bool_t                      GetIsParticleLevel()            const { return fIsParticleLevel           ; }
+  Int_t                       GetIndexFromLabel(Int_t lab)    const;
+  Int_t                       GetNEntries()                   const { return fClArray->GetEntriesFast() ; }
   virtual void                GetMomentum(TLorentzVector &mom, Int_t i) const = 0;
-  void                        ResetCurrentID(Int_t i=0)           { fCurrentID = i                    ; }
+  void                        ResetCurrentID(Int_t i=0)             { fCurrentID = i                    ; }
   virtual void                SetArray(AliVEvent *event);
-  void                        SetArrayName(const char *n)         { fClArrayName = n                  ; }
-  void                        SetIsParticleLevel(Bool_t b)        { fIsParticleLevel = b              ; }
-  void                        SortArray()                         { fClArray->Sort()                  ; }
+  void                        SetArrayName(const char *n)           { fClArrayName = n                  ; }
+  void                        SetIsParticleLevel(Bool_t b)          { fIsParticleLevel = b              ; }
+  void                        SortArray()                           { fClArray->Sort()                  ; }
+  UInt_t                      GetRejectionReason()            const { return fRejectionReason           ; }
+  UInt_t                      TestRejectionReason(UInt_t rs)  const { return fRejectionReason & rs      ; }
+  UShort_t                    GetRejectionReasonBitPosition() const;
 
  protected:
   TString                     fClArrayName;             // name of branch
@@ -39,6 +75,7 @@ class AliEmcalContainer : public TNamed {
   Int_t                       fCurrentID;               //!current ID for automatic loops
   AliNamedArrayI             *fLabelMap;                //!Label-Index map
   Double_t                    fVertex[3];               //!event vertex array
+  UInt_t                      fRejectionReason;         //!reject reason bit map for the last call to an accept object function
 
  private:
   AliEmcalContainer(const AliEmcalContainer& obj); // copy constructor
index b9b0ef0716fb5846250658f5c345df2a4215ac5f..6244820c8087556bbc7772f1cc43d8beb412e44b 100644 (file)
@@ -94,7 +94,7 @@ AliVParticle* AliParticleContainer::GetParticle(Int_t i) const
 }
 
 //________________________________________________________________________
-AliVParticle* AliParticleContainer::GetAcceptParticle(Int_t i) const {
+AliVParticle* AliParticleContainer::GetAcceptParticle(Int_t i) {
   //return pointer to particle if particle is accepted
 
   AliVParticle *vp = GetParticle(i);
@@ -118,7 +118,7 @@ AliVParticle* AliParticleContainer::GetParticleWithLabel(Int_t lab) const
 }
 
 //________________________________________________________________________
-AliVParticle* AliParticleContainer::GetAcceptParticleWithLabel(Int_t lab) const 
+AliVParticle* AliParticleContainer::GetAcceptParticleWithLabel(Int_t lab)  
 {
   //Get particle with label lab in array
   
@@ -171,41 +171,57 @@ void AliParticleContainer::GetMomentum(TLorentzVector &mom, Int_t i) const
 }
 
 //________________________________________________________________________
-Bool_t AliParticleContainer::AcceptParticle(AliVParticle *vp) const
+Bool_t AliParticleContainer::AcceptParticle(AliVParticle *vp)
 {
   // Return true if vp is accepted.
 
-  if (!vp)
+  fRejectionReason = 0;
+
+  if (!vp) {
+    fRejectionReason |= kNullObject;
     return kFALSE;
+  }
+
+  if (vp->Pt() < fParticlePtCut) {
+    fRejectionReason |= kPtCut;
+    return kFALSE;
+  }
+
+  if (vp->Eta() < fParticleMinEta || vp->Eta() > fParticleMaxEta || 
+      vp->Phi() < fParticleMinPhi || vp->Phi() > fParticleMaxPhi) {
+    fRejectionReason |= kAcceptanceCut;
+    return kFALSE;
+  }
 
   if (TMath::Abs(vp->GetLabel()) > fMinMCLabel) {
     if(vp->TestBits(fMCTrackBitMap) != (Int_t)fMCTrackBitMap) {
       AliDebug(2,"MC particle not accepted because of MC bit map.");
+      fRejectionReason |= kBitMapCut;
       return kFALSE;
     }
   }
   else {
     if(vp->TestBits(fTrackBitMap) != (Int_t)fTrackBitMap) {
       AliDebug(2,"Track not accepted because of bit map.");
+      fRejectionReason |= kBitMapCut;
       return kFALSE;
     }
   }
 
-  if (vp->Pt() < fParticlePtCut)
-    return kFALSE;
-
-  if (vp->Eta() < fParticleMinEta || vp->Eta() > fParticleMaxEta || 
-      vp->Phi() < fParticleMinPhi || vp->Phi() > fParticleMaxPhi)
-    return kFALSE;
-
-  if ((vp->GetFlag() & fMCFlag) != fMCFlag) 
+  if ((vp->GetFlag() & fMCFlag) != fMCFlag) {
+    fRejectionReason |= kMCFlag;
     return kFALSE;
+  }
 
-  if (fGeneratorIndex >= 0 && fGeneratorIndex != vp->GetGeneratorIndex())
+  if (fGeneratorIndex >= 0 && fGeneratorIndex != vp->GetGeneratorIndex()) {
+    fRejectionReason |= kMCGeneratorCut;
     return kFALSE;
+  }
 
-  if (fCharge>=0 && fCharge != vp->Charge() )
+  if (fCharge>=0 && fCharge != vp->Charge()) {
+    fRejectionReason |= kChargeCut;
     return kFALSE;
+  }
   
   return kTRUE;
 }
index cb2ec28c98a4b0896418bbd61b889083d206aeef..b3f904cb3c9a825a9875d15ae863682d1ca51459 100644 (file)
@@ -16,7 +16,7 @@ class AliParticleContainer : public AliEmcalContainer {
   AliParticleContainer(const char *name); 
   virtual ~AliParticleContainer(){;}
 
-  Bool_t                      AcceptParticle(AliVParticle         *vp)  const;
+  Bool_t                      AcceptParticle(AliVParticle         *vp)       ;
   Double_t                    GetParticlePtCut()                        const   { return fParticlePtCut; }
   Double_t                    GetParticleEtaMin()                       const   { return fParticleMinEta; }
   Double_t                    GetParticleEtaMax()                       const   { return fParticleMaxEta; }
@@ -24,9 +24,9 @@ class AliParticleContainer : public AliEmcalContainer {
   Double_t                    GetParticlePhiMax()                       const   { return fParticleMaxPhi; }
   AliVParticle               *GetLeadingParticle(const char* opt="")         ;
   AliVParticle               *GetParticle(Int_t i)                      const;
-  AliVParticle               *GetAcceptParticle(Int_t i)                const;
+  AliVParticle               *GetAcceptParticle(Int_t i)                     ;
   AliVParticle               *GetParticleWithLabel(Int_t lab)           const;
-  AliVParticle               *GetAcceptParticleWithLabel(Int_t lab)     const;
+  AliVParticle               *GetAcceptParticleWithLabel(Int_t lab)          ;
   AliVParticle               *GetNextAcceptParticle(Int_t i=-1)              ;
   AliVParticle               *GetNextParticle(Int_t i=-1)                    ;
   void                        GetMomentum(TLorentzVector &mom, Int_t i) const;
index 5c62e2051eed85efc0f513aca960c140f5f3dfc5..8349629b4fc459a6f177e635ca76aa9026039dfa 100644 (file)
@@ -56,6 +56,7 @@ set ( SRCS
     Correlations/DPhi/AliAnalysisTaskContMC.cxx
     Correlations/DPhi/TriggerPID/AliAnalysisTaskPIDCORR.cxx
     Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorr.cxx
+    Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.cxx
     Correlations/DPhi/PidPid/AliAnalysisTaskPidPidCorrelations.cxx
     Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.cxx
     )
index a77a09cb84174e510b8181f94b6c55ee2faddf0d..b98dd7cedb0532596b64c4cefb82f77b2cc7308d 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityKTPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityTPCEntranceSepPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoESDTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoKKTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoTPCInnerCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoChi2CorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnSource.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDEtaDPhi.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelGausRinvFreezeOutGenerator.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnTrueQ.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnNonIdDR.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctn3DSpherical.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctn3DLCMSSpherical.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleMomRes.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelAllHiddenInfo.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorTrackTPCchiNdof.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQATrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQAEventCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorTrackTPCncls.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityTPCEntranceSepQAPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityQAPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDirectYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDirectYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticlePtPDG.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnTPCNcls.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhi.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhiCorrections.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnGammaMonitor.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQinvCorrFctnEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctn3DSphericalEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoBPLCMS3DCorrFctnEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutAntiGamma.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleEtCorr.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutPt.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoAvgSepCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticlePtPDGV0.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoAnalysisAzimuthalPbPb.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistanceLM.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPicoEventRP.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistanceKK.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutResonances.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnMinvMonitor.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnPairFractions.cxx FEMTOSCOPY/AliFemtoUser/AliAnalysisTaskParticleEfficiency.cxx)
+set ( SRCS  FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityKTPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityTPCEntranceSepPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoESDTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoKKTrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoTPCInnerCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoChi2CorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnSource.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDEtaDPhi.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelGausRinvFreezeOutGenerator.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnTrueQ.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnNonIdDR.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctn3DSpherical.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctn3DLCMSSpherical.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleMomRes.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelAllHiddenInfo.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorTrackTPCchiNdof.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQATrackCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQAEventCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorTrackTPCncls.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityTPCEntranceSepQAPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityQAPairCut.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDirectYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDirectYlm.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticlePtPDG.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnTPCNcls.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhi.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhiCorrections.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnGammaMonitor.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoQinvCorrFctnEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctn3DSphericalEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoBPLCMS3DCorrFctnEMCIC.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutAntiGamma.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticleEtCorr.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutPt.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoAvgSepCorrFctn.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCutMonitorParticlePtPDGV0.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoAnalysisAzimuthalPbPb.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistanceLM.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPicoEventRP.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistanceKK.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutResonances.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnMinvMonitor.cxx FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnPairFractions.cxx FEMTOSCOPY/AliFemtoUser/AliAnalysisTaskParticleEfficiency.cxx)
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
@@ -35,7 +35,7 @@ set ( EXPORT )
 
 set ( EINCLUDE  PWGCF/FEMTOSCOPYAOD PWGCF/FEMTOSCOPY/AliFemto PWGCF/FEMTOSCOPY/AliFemtoUser ANALYSIS STEER/AOD STEER/STEERBase)
 if( ALICE_TARGET STREQUAL "win32gcc")
-       
+
                set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lPWGCFAOD -lPWGCFfemtoscopy)
 
 endif( ALICE_TARGET STREQUAL "win32gcc")
index 1af476803a81f8e07e20c828682dbe672ac02718..877f679dbfc06fba4c39c2620ace3c42e7b5d61a 100644 (file)
@@ -26,7 +26,7 @@
 #include "TList.h"
 #include "TFile.h"
 #include "TGrid.h"
-
+#include "TExMap.h"
 #include "AliCentrality.h"
 #include "Riostream.h"
 
@@ -34,7 +34,7 @@
 #include "AliCFContainer.h"
 #include "THn.h"
 #include "THnSparse.h"
-
+#include "TBits.h"
 #include <TSpline.h>
 #include <AliPID.h>
 #include "AliESDpid.h"
@@ -91,6 +91,7 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be ini
    fOutputList(0),
   fList(0),
   fCentralityMethod("V0A"),
+  fPPVsMultUtils(kFALSE),
   fSampleType("pPb"),
  fRequestEventPlane(kFALSE),
   fnTracksVertex(1),  // QA tracks pointing to principal vertex (= 3 default)
@@ -100,6 +101,7 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be ini
   fTrackStatus(0),
   fSharedClusterCut(-1),
  fSharedTPCmapCut(-1),
+ fSharedfraction_Pair_cut(-1),
   fVertextype(1),
  skipParticlesAbove(0),
   fzvtxcut(10.0),
@@ -259,6 +261,8 @@ fPhiRPv0Cv3(NULL),
   fAnalysisType("AOD"), 
   fefffilename(""),
  ftwoTrackEfficiencyCutDataReco(kTRUE),
+fTwoTrackCutMinRadius(0.8),
+fTwoTrackCutMaxRadius(2.5),
   twoTrackEfficiencyCutValue(0.02),
   fPID(NULL),
  fPIDCombined(NULL),
@@ -337,6 +341,7 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data membe
    fOutputList(0),
    fList(0),
  fCentralityMethod("V0A"),
+  fPPVsMultUtils(kFALSE),
   fSampleType("pPb"),
  fRequestEventPlane(kFALSE),
   fnTracksVertex(1),  // QA tracks pointing to principal vertex (= 3 default)
@@ -346,6 +351,7 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data membe
   fTrackStatus(0),
   fSharedClusterCut(-1),
   fSharedTPCmapCut(-1),
+ fSharedfraction_Pair_cut(-1),
   fVertextype(1),
    skipParticlesAbove(0),
   fzvtxcut(10.0),
@@ -505,6 +511,8 @@ fPhiRPv0Cv3(NULL),
   fAnalysisType("AOD"),
   fefffilename(""),
   ftwoTrackEfficiencyCutDataReco(kTRUE),
+fTwoTrackCutMinRadius(0.8),
+fTwoTrackCutMaxRadius(2.5),
   twoTrackEfficiencyCutValue(0.02),
   fPID(NULL),
   fPIDCombined(NULL),
@@ -682,7 +690,7 @@ fOutput->Add(fEtaSpectrasso);
 fphiSpectraasso=new TH2F("fphiSpectraasso","fphiSpectraasso",72,0,2*TMath::Pi(),100,0.,20.);
 fOutput->Add(fphiSpectraasso);
 
- if(fSampleType=="pPb" || fSampleType=="PbPb"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);
+ if(fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);
       fOutput->Add(fCentralityCorrelation);
  }
 
@@ -699,7 +707,7 @@ if(fCentralityMethod=="V0M" || fCentralityMethod=="V0A" || fCentralityMethod=="V
   fOutput->Add(fHistCentStats);
   }
 
-if(fCentralityMethod.EndsWith("_MANUAL"))
+if(fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE))
   {
 fhistcentrality=new TH1F("fhistcentrality","referencemultiplicity",30001,-0.5,30000.5);
 fOutput->Add(fhistcentrality);
@@ -709,7 +717,7 @@ fhistcentrality=new TH1F("fhistcentrality","centrality",220,-5,105);
 fOutput->Add(fhistcentrality);
  }
 
-if(fCentralityMethod.EndsWith("_MANUAL"))
+if(fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE))
   {
 TString gmultName[4] = {"V0A_MANUAL","V0C_MANUAL","V0M_MANUAL","TRACKS_MANUAL"};
   fHistRefmult = new TH2F("fHistRefmult",
@@ -1019,7 +1027,7 @@ Double_t ZvrtxBins[NofVrtxBins+1]={ -10,   -8,  -6,  -4,  -2,   0,   2,   4,   6
                                       90,  92,  94,  96,  98, 100, 102, 104, 106, 108, 110, 
                                    190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210}; 
 
-if(fCentralityMethod.EndsWith("_MANUAL"))
+if(fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE))
    {
  const Int_t NofCentBins=10;
  Double_t CentralityBins[NofCentBins+1]={0.,9.,14.,19.,26.,34.,44.,58.,80.,500.,1000.};//Is This binning is fine for pp, or we don't require them....
@@ -1707,7 +1715,7 @@ skipParticlesAbove = eventHeader->NProduced();
     AliInfo(Form("Injected signals in this event (%d headers). Keeping events of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove));
   }
 
- if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL"))
+ if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE))
    {
  //make the event selection with reco vertex cut and centrality cut and return the value of the centrality
      Double_t refmultTruth = GetAcceptedEventMultiplicity(aod,kTRUE);  //incase of ref multiplicity it will return the truth MC ref mullt value; need to determine the ref mult value separately for reco Mc case; in case of centrality this is final and fine
@@ -1716,10 +1724,10 @@ skipParticlesAbove = eventHeader->NProduced();
      cent_v0=refmultTruth;
    }
  else {
- cent_v0=GetAcceptedEventMultiplicity(aod,kTRUE); //centrality value; 2nd argument has no meaning
- if(cent_v0<0.) return;
+ cent_v0=GetAcceptedEventMultiplicity(aod,kFALSE); //centrality value; 2nd argument has no meaning
  }
 
+ if(cent_v0<0.) return;
  effcent=cent_v0;// This will be required for efficiency THn filling(specially in case of pp)
 
   //get the event plane in case of PbPb
@@ -1840,7 +1848,7 @@ if(ffillhistQATruth)
     }
 
  // -- Fill THnSparse for efficiency and contamination calculation
if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
   if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE)) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
 
  Double_t primmctruth[4] = {effcent, zVtxmc,partMC->Pt(), partMC->Eta()};
  if(ffillefficiency)
@@ -1860,7 +1868,9 @@ if((partMC->Pt()>=fminPtAsso && partMC->Pt()<=fmaxPtAsso) || (partMC->Pt()>=fmin
     if(partMC->Charge()>0)   chargeval=1;
     if(partMC->Charge()<0)   chargeval=-1;
     if(chargeval==0) continue;
-LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,chargeval,partMC->Pt(),partMC->Eta(), partMC->Phi(),effmatrixtruth);
+    const TBits *clustermap=0;
+    const TBits *sharemap=0;
+    LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,chargeval,partMC->Pt(),partMC->Eta(), partMC->Phi(),effmatrixtruth,clustermap,sharemap);
 //copy6->SetUniqueID(eventno * 100000 + TMath::Abs(partMC->GetLabel()));
  copy6->SetUniqueID(eventno * 100000 + (Int_t)nooftrackstruth);
  tracksMCtruth->Add(copy6);//************** TObjArray used for truth correlation function calculation
@@ -1869,7 +1879,6 @@ LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,chargeval,partMC->P
 
 //*********************still in event loop
 
- if (fSampleType=="PbPb"){
    if (fRandomizeReactionPlane)//only for TRuth MC??
   {
     Double_t centralityDigits = cent_v0*1000. - (Int_t)(cent_v0*1000.);
@@ -1877,7 +1886,7 @@ LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,chargeval,partMC->P
     AliInfo(Form("Shifting phi of all tracks by %f (digits %f)", angle, centralityDigits));
     ShiftTracks(tracksMCtruth, angle);  
   }
- }
 
  Float_t weghtval=1.0;
 
@@ -1917,14 +1926,39 @@ if(tracksMCtruth) delete tracksMCtruth;
 
 //now deal with reco tracks
 
+
+   Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//used for reconstructed track dca cut
+
 //detrmine the ref mult in case of Reco(not required if we get centrality info from AliCentrality)
- if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) cent_v0=refmultReco;
+ if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE)) cent_v0=refmultReco;
  effcent=cent_v0;// This will be required for efficiency THn filling(specially in case of pp)
 
  if(fRequestEventPlane){
    gReactionPlane = GetEventPlane(aod,kFALSE,cent_v0);//get the reconstructed event plane
     if(gReactionPlane==999.) return;
  }
+
+
+  TExMap *trackMap = new TExMap();
+
+// --- track loop for mapping matrix
+ if(fFilterBit==128)
+   {
+ for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++) 
+{ //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation 
+  AliAODTrack* track = dynamic_cast<AliAODTrack*>(event->GetTrack(itrk));
+  if (!track) continue;
+  Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1,kFALSE);//don't fill the histos here
+  if(tracktype!=1) continue; 
+
+  if(!track) continue;//for safety
+
+   Int_t gid = track->GetID();
+   trackMap->Add(gid,itrk);
+ }//track looop ends
+   }
+
+
   
    //TObjArray* tracksUNID=0;
    TObjArray* tracksUNID = new TObjArray;
@@ -1935,7 +1969,6 @@ if(tracksMCtruth) delete tracksMCtruth;
    tracksID->SetOwner(kTRUE);
 
 
-   Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//used for reconstructed track dca cut
 
 
    Double_t trackscount=0.0;
@@ -2002,6 +2035,16 @@ isduplicate2=kTRUE;
 {
   if(!track) continue;//for safety
  //accepted all(primaries+secondary) reconstructed tracks(pt 0.2 to 10.0,,eta -0.8 to 0.8)
+
+  AliAODTrack *PIDtrack=track;//for PID purpose, mainly important for TPC only tracks
+
+  if(fFilterBit==128){
+Int_t gid1 = track->GetID();
+//if(gid1>=0) PIDtrack = track;
+ PIDtrack = aod->GetTrack(trackMap->GetValue(-1-gid1));
+if(!PIDtrack) continue;//for safety; so that each of the TPC only tracks have corresponding global track along with it
+  }
+
   trackscount++;
 
 //check for eta , phi holes
@@ -2016,7 +2059,7 @@ isduplicate2=kTRUE;
  Float_t effmatrix=1.;
 
 // -- Fill THnSparse for efficiency calculation
- if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
+ if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE)) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
  //NOTE:: this will be used for fillinfg THnSparse of efficiency & also to get the the track by track eff. factor on the fly(only in case of pp)
 
  //Clone & Reduce track list(TObjArray) for unidentified particles
@@ -2028,7 +2071,7 @@ if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtT
     if(chargeval==0) continue;
  if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
    effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletypeMC);
  LRCParticlePID* copy = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
LRCParticlePID* copy = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix,track->GetTPCClusterMapPtr(),track->GetTPCSharedMapPtr());
    copy->SetUniqueID(eventno * 100000 +(Int_t)trackscount);
    tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
   }
@@ -2057,23 +2100,22 @@ fTrackHistEfficiency[5]->Fill(allrecomatchedpid,2);//for allreco matched
 
  //now start the particle identification process:)
 
-Float_t dEdx = track->GetTPCsignal();
+Float_t dEdx = PIDtrack->GetTPCsignal();
  fHistoTPCdEdx->Fill(track->Pt(), dEdx);
 
- if(HasTOFPID(track))
+ if(HasTOFPID(PIDtrack))
 {
-Double_t beta = GetBeta(track);
+Double_t beta = GetBeta(PIDtrack);
 fHistoTOFbeta->Fill(track->Pt(), beta);
  }
 
 //do track identification(nsigma method)
-  particletypeMC=GetParticle(track,fFIllPIDQAHistos);//******************************problem is here
-  cout<<particletypeMC<<endl;
+  particletypeMC=GetParticle(PIDtrack,fFIllPIDQAHistos);//******************************problem is here
 switch(TMath::Abs(pdgCode)){
   case 2212:
     if(fFIllPIDQAHistos){
       for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
-       if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
+       if((ipid!=NSigmaTPC) && (!HasTOFPID(PIDtrack)))continue;//not filling TOF and combined if no TOF PID
        TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpProton,ipid));
        h->Fill(track->Pt(),fnsigmas[SpProton][ipid]);
       }
@@ -2082,7 +2124,7 @@ switch(TMath::Abs(pdgCode)){
   case 321:
     if(fFIllPIDQAHistos){
       for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
-       if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
+       if((ipid!=NSigmaTPC) && (!HasTOFPID(PIDtrack)))continue;//not filling TOF and combined if no TOF PID
        TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpKaon,ipid));
        h->Fill(track->Pt(),fnsigmas[SpKaon][ipid]);
       }
@@ -2091,7 +2133,7 @@ switch(TMath::Abs(pdgCode)){
   case 211:
     if(fFIllPIDQAHistos){
       for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
-       if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
+       if((ipid!=NSigmaTPC) && (!HasTOFPID(PIDtrack)))continue;//not filling TOF and combined if no TOF PID
        TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpPion,ipid));
        h->Fill(track->Pt(),fnsigmas[SpPion][ipid]);
       }
@@ -2101,7 +2143,7 @@ switch(TMath::Abs(pdgCode)){
 
 
 //2-d TPCTOF map(for each Pt interval)
-  if(HasTOFPID(track)){
+  if(HasTOFPID(PIDtrack)){
  fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
  fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
  fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]); 
@@ -2205,7 +2247,7 @@ if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtT
     if(chargeval==0) continue;
 if (fapplyTrigefficiency || fapplyAssoefficiency)
     effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletypeMC);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles 
   LRCParticlePID* copy1 = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
LRCParticlePID* copy1 = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix,track->GetTPCClusterMapPtr(),track->GetTPCSharedMapPtr());
     copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
     tracksID->Add(copy1);
   }
@@ -2221,7 +2263,7 @@ if(trackscount>0.0)
 //fill the centrality/multiplicity distribution of the selected events
  fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
 
- if (fSampleType=="pPb" || fSampleType=="PbPb") fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
+ if (fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE) fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
 
 //count selected events having centrality betn 0-100%
  fEventCounter->Fill(13);
@@ -2358,13 +2400,32 @@ if (!fPID) return;//this should be available with each event even if we don't do
  if((cent_v0 = GetAcceptedEventMultiplicity(aod,kFALSE)) < 0){ 
     return;
   }
-  
+ effcent=cent_v0;//required for efficiency correction case********Extremely Important
   //get the event plane in case of PbPb
     if(fRequestEventPlane){
       gReactionPlane = GetEventPlane(aod,kFALSE,cent_v0);
     if(gReactionPlane==999.) return;
     }    
-  
+    
+
+TExMap *trackMap = new TExMap();
+// --- track loop for mapping matrix
+ if(fFilterBit==128)
+   {
+ for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++) 
+{ //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation 
+  AliAODTrack* track = dynamic_cast<AliAODTrack*>(event->GetTrack(itrk));
+  if (!track) continue;
+  Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1,kFALSE);//don't fill the histos here
+  if(tracktype!=1) continue; 
+
+  if(!track) continue;//for safety
+
+   Int_t gid = track->GetID();
+   trackMap->Add(gid,itrk);
+ }//track looop ends
+   }
+
    TObjArray*  tracksUNID= new TObjArray;//track info before doing PID
    tracksUNID->SetOwner(kTRUE);  // IMPORTANT!
 
@@ -2389,6 +2450,15 @@ if (!fPID) return;//this should be available with each event even if we don't do
 
   if(!track) continue;//for safety
 
+AliAODTrack *PIDtrack=track;//for PID purpose, mainly important for TPC only tracks
+
+  if(fFilterBit==128){
+Int_t gid1 = track->GetID();
+//if(gid1>=0) PIDtrack = track;
+ PIDtrack = aod->GetTrack(trackMap->GetValue(-1-gid1));
+if(!PIDtrack) continue;//for safety; so that each of the TPC only tracks have corresponding global track along with it
+  }
+
 //check for eta , phi holes
  fEtaSpectrasso->Fill(track->Eta(),track->Pt());
  fphiSpectraasso->Fill(track->Phi(),track->Pt());
@@ -2407,7 +2477,7 @@ if (!fPID) return;//this should be available with each event even if we don't do
  if(track->Pt()>=fmaxPtTrig) fTrigPtJet=kTRUE;
 
 
- if (fSampleType=="pp") effcent=15.0;//integrated over multiplicity [i.e each track has multiplicity 15.0](so put any fixed value for each track so that practically means there is only one bin in multiplicityi.e multiplicity intregated out )**************Important for efficiency related issues
+if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE)) effcent=15.0;//integrated over multiplicity [i.e each track has multiplicity 15.0](so put any fixed value for each track so that practically means there is only one bin in multiplicityi.e multiplicity intregated out )**************Important for efficiency related issues
 
 
  //to reduce memory consumption in pool
@@ -2420,7 +2490,7 @@ if (!fPID) return;//this should be available with each event even if we don't do
     if(chargeval==0) continue;
  if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
    effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletype);
- LRCParticlePID* copy = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ LRCParticlePID* copy = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix,track->GetTPCClusterMapPtr(),track->GetTPCSharedMapPtr());
   copy->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
   tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
   }
@@ -2429,23 +2499,22 @@ if (!fPID) return;//this should be available with each event even if we don't do
 
 //track passing filterbit 768 have proper TPC response,or need to be checked explicitly before doing PID????
 
-  Float_t dEdx = track->GetTPCsignal();
+  Float_t dEdx = PIDtrack->GetTPCsignal();
   fHistoTPCdEdx->Fill(track->Pt(), dEdx);
 
   //fill beta vs Pt plots only for tracks having proper TOF response(much less tracks compared to the no. that pass the filterbit & kinematic cuts)
- if(HasTOFPID(track))
+ if(HasTOFPID(PIDtrack))
 {
-  Double_t beta = GetBeta(track);
+  Double_t beta = GetBeta(PIDtrack);
   fHistoTOFbeta->Fill(track->Pt(), beta);
  }
   
 
 //track identification(using nsigma method)
-     particletype=GetParticle(track,fFIllPIDQAHistos);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)
-
+     particletype=GetParticle(PIDtrack,fFIllPIDQAHistos);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)
 
 //2-d TPCTOF map(for each Pt interval)
-  if(HasTOFPID(track)){
+  if(HasTOFPID(PIDtrack)){
  fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
  fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
  fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]); 
@@ -2490,7 +2559,7 @@ if (particletype==SpProton)
     if(chargeval==0) continue;
 if (fapplyTrigefficiency || fapplyAssoefficiency)
   effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletype);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles; Bool_t mesoneffrequired=kFALSE
- LRCParticlePID* copy1 = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ LRCParticlePID* copy1 = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix,track->GetTPCClusterMapPtr(),track->GetTPCSharedMapPtr());
     copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
     tracksID->Add(copy1);
   }
@@ -2513,7 +2582,7 @@ if(trackscount<1.0){
 //fill the centrality/multiplicity distribution of the selected events
  fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
 
-if(fSampleType=="pPb" || fSampleType=="PbPb") fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
+if(fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE) fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
 
 //count selected events having centrality betn 0-100%
  fEventCounter->Fill(13);
@@ -2627,7 +2696,7 @@ TObjArray* AliTwoParticlePIDCorr::CloneAndReduceTrackList(TObjArray* tracks)
   for (Int_t i=0; i<tracks->GetEntriesFast(); i++)
   {
     LRCParticlePID* particle = (LRCParticlePID*) tracks->UncheckedAt(i);
-    LRCParticlePID* copy100 = new LRCParticlePID(particle->getparticle(),particle->Charge(), particle->Pt(),particle->Eta(), particle->Phi(), particle->geteffcorrectionval());
+    LRCParticlePID* copy100 = new LRCParticlePID(particle->getparticle(),particle->Charge(), particle->Pt(),particle->Eta(), particle->Phi(), particle->geteffcorrectionval(),particle->GetTPCPadMap(),particle->GetTPCSharedMap());
     copy100->SetUniqueID(particle->GetUniqueID());
     tracksClone->Add(copy100);
   }
@@ -3063,8 +3132,8 @@ if (fRejectResonanceDaughters > 0)
          {
 
   // check first boundaries to see if is worth to loop and find the minimum
-           Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
-           Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
+           Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, fTwoTrackCutMinRadius, bSign);
+           Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, fTwoTrackCutMaxRadius, bSign);
 
  const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
 
@@ -3100,6 +3169,14 @@ if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEf
          }
        }
 
+       //pair sharedfraction cut(only between the trig and asso track)
+   if(fillup!="trigIDassoIDMCTRUTH")//******************************************NOT for TRUTH MC particles
+  {
+    if(fSharedfraction_Pair_cut>=0){
+       Bool_t passsharedfractionpaircut=CalculateSharedFraction(trig->GetTPCPadMap(),asso->GetTPCPadMap(),trig->GetTPCSharedMap(),asso->GetTPCSharedMap());
+       if(!passsharedfractionpaircut) continue;
+    }
+  }
        Float_t weightperevent=weight;
         Float_t trackeffasso=1.0;
         if(fapplyAssoefficiency) trackeffasso=asso->geteffcorrectionval();
@@ -3201,7 +3278,67 @@ delete[] trigval;
     }
 }
 
-//--------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------
+Bool_t AliTwoParticlePIDCorr:: CalculateSharedFraction(const TBits *triggerPadMap,const TBits *assocPadMap,const TBits *triggerShareMap,const TBits *assocShareMap)
+{//source code-AliFemtoShareQualityPairCut.cxx
+Double_t nofhits=0;
+Double_t nofsharedhits=0;
+
+for(UInt_t imap=0;imap< (triggerPadMap->GetNbits() );imap++)
+{
+//if they are in same pad
+//cout<<triggerPadMap->TestBitNumber(imap)<<"    "<< assocPadMap->TestBitNumber(imap)<<endl;
+if (triggerPadMap->TestBitNumber(imap) &&
+      assocPadMap->TestBitNumber(imap))
+{
+//if they share
+//cout<<triggerShareMap->TestBitNumber(imap)<<"   "<<assocShareMap->TestBitNumber(imap)<<endl;
+if (triggerShareMap->TestBitNumber(imap) &&
+      assocShareMap->TestBitNumber(imap))
+{
+  //cout<<triggerShareMap->TestBitNumber(imap)<<"   "<<assocShareMap->TestBitNumber(imap)<<endl;
+nofhits+=2;
+nofsharedhits+=2;
+}
+
+
+
+//not shared
+    else {
+     
+      nofhits+=2;
+    }
+
+
+}
+//different pad
+
+//cout<< (triggerPadMap->TestBitNumber(imap) || assocPadMap->TestBitNumber(imap))<<endl;
+else if (triggerPadMap->TestBitNumber(imap) ||
+      assocPadMap->TestBitNumber(imap)) {
+    // One track has a hit, the other does not
+   
+    nofhits++;
+    //cout<<"No hits :"<<nofhits<<endl;
+   
+      }
+
+
+
+}
+
+Double_t SharedFraction=0.0;
+if(nofhits>0) SharedFraction=(nofsharedhits/nofhits);
+
+//cout<<"Fraction shared hits :"<<SharedFraction<<endl;
+
+if(SharedFraction>fSharedfraction_Pair_cut) return kFALSE;
+
+return kTRUE;
+
+}
+
+//________________________________________________________________________________________________
 Float_t AliTwoParticlePIDCorr::GetTrackbyTrackeffvalue(AliAODTrack* track,Double_t cent,Float_t evzvtx, Int_t parpid)
 {
   //This function is called only when applyefficiency=kTRUE; also ensure that "track" is present before calling that function
@@ -4228,8 +4365,9 @@ Double_t AliTwoParticlePIDCorr::GetReferenceMultiplicityVZEROFromAOD(AliAODEvent
     gRefMultiplicity = gRefMultiplicityVZEROC;
     fHistRefmult->Fill(1.,gRefMultiplicityVZEROC);
  }
-
-  
+ else {
+gRefMultiplicity = gRefMultiplicityTPC;
+ } 
   return gRefMultiplicity;
 }
 
@@ -4240,39 +4378,56 @@ Double_t AliTwoParticlePIDCorr::GetRefMultiOrCentrality(AliAODEvent *event, Bool
   // get centrality object and check quality
   Double_t cent_v0=-1;
   Double_t nooftrackstruth=0;
+  Bool_t shift_to_TRACKS_MANUAL=kFALSE;//in case of wrong setting automatic shift to Tracks_Manual method
 
 if(fCentralityMethod=="V0M" || fCentralityMethod=="V0A" || fCentralityMethod=="V0C" || fCentralityMethod=="CL1" || fCentralityMethod=="ZNA" || fCentralityMethod=="V0AEq" || fCentralityMethod=="V0CEq" || fCentralityMethod=="V0MEq")//for PbPb, pPb, pp7TeV(still to be introduced)//data or RecoMC and also for TRUTH
     {
+      /*
+if(fSampleType=="pp_7" && fPPVsMultUtils)
+{//for pp 7 TeV case only using Alianalysisutils class
+       if(fAnalysisUtils) cent_v0 = fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,fCentralityMethod);
+       else cent_v0 = -1;
+  fHistCentStats->Fill(0.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0A"));
+  fHistCentStats->Fill(1.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0C"));
+  fHistCentStats->Fill(2.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0M"));   
+  fHistCentStats->Fill(3.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0AEq"));//only available for LHC10d at present (Quantile info)
+  fHistCentStats->Fill(4.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0CEq"));//only available for LHC10d at present (Quantile info)
+  fHistCentStats->Fill(5.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0MEq"));//only available for LHC10d at present (Quantile info)
+      }
+      */
+  if(fSampleType=="pPb" || fSampleType=="PbPb")
+  {
   AliCentrality *centralityObj=0;
   AliAODHeader *header = (AliAODHeader*) event->GetHeader();
   if(!header) return -1;
   centralityObj = header->GetCentralityP();
   // if (centrality->GetQuality() != 0) return ;
-
-  if(centralityObj)
-  {
+  if(centralityObj){
   fHistCentStats->Fill(0.,centralityObj->GetCentralityPercentile("V0A"));
   fHistCentStats->Fill(1.,centralityObj->GetCentralityPercentile("V0C"));
   fHistCentStats->Fill(2.,centralityObj->GetCentralityPercentile("V0M"));
-if(fSampleType=="pp")   fHistCentStats->Fill(3.,centralityObj->GetCentralityPercentile("V0AEq"));//only available for LHC10d at present (Quantile info)
-if(fSampleType=="pp")   fHistCentStats->Fill(4.,centralityObj->GetCentralityPercentile("V0CEq"));//only available for LHC10d at present (Quantile info)
-if(fSampleType=="pp")   fHistCentStats->Fill(5.,centralityObj->GetCentralityPercentile("V0MEq"));//only available for LHC10d at present (Quantile info)
+  fHistCentStats->Fill(3.,centralityObj->GetCentralityPercentile("V0AEq"));//only available for LHC10d at present (Quantile info)
+  fHistCentStats->Fill(4.,centralityObj->GetCentralityPercentile("V0CEq"));//only available for LHC10d at present (Quantile info)
+  fHistCentStats->Fill(5.,centralityObj->GetCentralityPercentile("V0MEq"));//only available for LHC10d at present (Quantile info)
 
-if(fSampleType=="pPb" || fSampleType=="PbPb")      fHistCentStats->Fill(6.,centralityObj->GetCentralityPercentile("CL1"));
-if(fSampleType=="pPb" || fSampleType=="PbPb")      fHistCentStats->Fill(7.,centralityObj->GetCentralityPercentile("ZNA")); 
+  fHistCentStats->Fill(6.,centralityObj->GetCentralityPercentile("CL1"));
+  fHistCentStats->Fill(7.,centralityObj->GetCentralityPercentile("ZNA")); 
 
-      cent_v0 = centralityObj->GetCentralityPercentile(fCentralityMethod);
-  }
+   cent_v0 = centralityObj->GetCentralityPercentile(fCentralityMethod);
+    }
   else cent_v0= -1;    
+  }
+ else shift_to_TRACKS_MANUAL=kTRUE;    
+
     }//centralitymethod condition
 
- else if(fCentralityMethod=="V0M_MANUAL" || fCentralityMethod=="V0A_MANUAL" || fCentralityMethod=="V0C_MANUAL" || fCentralityMethod=="TRACKS_MANUAL")//data or RecoMc and also for TRUTH
+ else if(fCentralityMethod=="V0M_MANUAL" || fCentralityMethod=="V0A_MANUAL" || fCentralityMethod=="V0C_MANUAL" || fCentralityMethod=="TRACKS_MANUAL" || shift_to_TRACKS_MANUAL)//data or RecoMc and also for TRUTH
    {
      if(!truth){//for data or RecoMC
     cent_v0 = GetReferenceMultiplicityVZEROFromAOD(event);
    }//for data or RecoMC
 
-    if(truth){//condition for TRUTH case
+    if(truth && (fAnalysisType == "MCAOD")){//condition for TRUTH case
 //check for TClonesArray(truth track MC information)
 fArrayMC = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
   if (!fArrayMC) {
index 0b2f9f3043dffcd5e3c166ce1ac0a54d3f12a40f..baf60df5a18e00ef4e9dee6f9501e7f8fb7550a2 100644 (file)
@@ -41,7 +41,7 @@ class TProfile;
 #include "TParticle.h"
 #include "AliLog.h"
 #include "AliTHn.h"
-
+#include "TBits.h"
 
 
 #ifndef ALIANALYSISTASKSE_H
@@ -103,18 +103,22 @@ class AliTwoParticlePIDCorr : public AliAnalysisTaskSE {
     virtual void     Terminate(Option_t *);
   void    SetSharedClusterCut(Double_t value) { fSharedClusterCut = value; }
   void    SetSharedTPCmapCut(Double_t value1) { fSharedTPCmapCut = value1; }
+  void    SetSharedfraction_Pair_cut(Double_t value2) { fSharedfraction_Pair_cut = value2; }
 
 
-  void SettwoTrackEfficiencyCutDataReco(Bool_t twoTrackEfficiencyCutDataReco,Float_t twoTrackEfficiencyCutValue1)
+  void SettwoTrackEfficiencyCutDataReco(Bool_t twoTrackEfficiencyCutDataReco,Float_t twoTrackEfficiencyCutValue1,Float_t TwoTrackCutMinRadius,Float_t TwoTrackCutMaxRadius)
   {
     ftwoTrackEfficiencyCutDataReco=twoTrackEfficiencyCutDataReco;
     twoTrackEfficiencyCutValue=twoTrackEfficiencyCutValue1;
+    fTwoTrackCutMinRadius=TwoTrackCutMinRadius;
+    fTwoTrackCutMaxRadius=TwoTrackCutMaxRadius;
   }
   void SetVertextype(Int_t Vertextype){fVertextype=Vertextype;}                                                 //Check it every time
     void SetZvtxcut(Double_t zvtxcut) {fzvtxcut=zvtxcut;}
     void SetCustomBinning(TString receivedCustomBinning) { fCustomBinning = receivedCustomBinning; }
     void SetMaxNofMixingTracks(Int_t MaxNofMixingTracks) {fMaxNofMixingTracks=MaxNofMixingTracks;}               //Check it every time
   void SetCentralityEstimator(TString CentralityMethod) { fCentralityMethod = CentralityMethod;}
+  void SetPPVsMultUtils(Bool_t val)  {fPPVsMultUtils = val;}
   void SetSampleType(TString SampleType) {fSampleType=SampleType;}
   void SetRequestEventPlane(Bool_t RequestEventPlane,Bool_t V2,Bool_t V3,TString EPdetector,Bool_t IsAfter2011){
 fRequestEventPlane=RequestEventPlane;
@@ -256,6 +260,7 @@ fPtTOFPIDmax=PtTOFPIDmax;
 
 
     TString    fCentralityMethod;     // Method to determine centrality
+    Bool_t fPPVsMultUtils;//switch to ON quantile information for pp 7 TeV case
     TString    fSampleType;     // pp,p-Pb,Pb-Pb
     Bool_t fRequestEventPlane; //only for PbPb
     Int_t    fnTracksVertex;        // QA tracks pointing to principal vertex
@@ -264,7 +269,8 @@ fPtTOFPIDmax=PtTOFPIDmax;
     Int_t    fFilterBit;         // track selection cuts
      UInt_t         fTrackStatus;       // if non-0, the bits set in this variable are required for each track
     Double_t       fSharedClusterCut;  // cut on shared clusters (only for AOD, give the actual cut value)
-    Double_t fSharedTPCmapCut;//cut on TPC shared map(set any non negative value to implement this cut automatically, no meaning of te value itself)
+    Double_t fSharedTPCmapCut;//cut on TPC shared map(set any non negative value to implement this cut automatically, no meaning of the value itself)
+    Double_t fSharedfraction_Pair_cut;//cut on pairs at the correlation level to check whether the correlating pair has large shared clusters(set fraction percentage to be set as cut off)
     Int_t fVertextype;
     Int_t skipParticlesAbove;
     Double_t fzvtxcut;
@@ -455,6 +461,7 @@ fPtTOFPIDmax=PtTOFPIDmax;
 
 
   void Fillcorrelation(Float_t ReactionPlane,TObjArray *trackstrig,TObjArray *tracksasso,Double_t cent,Float_t vtx,Float_t weight,Bool_t firstTime,Float_t bSign,Bool_t fPtOrder,Bool_t twoTrackEfficiencyCut,Bool_t mixcase,TString fillup);//mixcase=kTRUE in case of mixing; 
+ Bool_t CalculateSharedFraction(const TBits *triggerPadMap,const TBits *assocPadMap,const TBits *triggerShareMap,const TBits *assocShareMap);
  Float_t GetTrackbyTrackeffvalue(AliAODTrack* track,Double_t cent,Float_t evzvtx, Int_t parpid);
 
  //Fill PID and Event planes
@@ -479,7 +486,9 @@ fPtTOFPIDmax=PtTOFPIDmax;
  
      TH2F* GetHistogram2D(const char * name);//return histogram "name" from fOutputList
 
-     Bool_t ftwoTrackEfficiencyCutDataReco;       
+     Bool_t ftwoTrackEfficiencyCutDataReco; 
+    Float_t fTwoTrackCutMinRadius;
+    Float_t fTwoTrackCutMaxRadius;        
    Float_t twoTrackEfficiencyCutValue;
   //Pid objects
   AliPIDResponse *fPID; //! PID
@@ -575,8 +584,8 @@ Float_t GetInvMassSquaredCheap(Float_t pt1, Float_t eta1, Float_t phi1, Float_t
 };
 class LRCParticlePID : public TObject {
 public:
- LRCParticlePID(Int_t par,Short_t icharge,Float_t pt,Float_t eta, Float_t phi,Float_t effcorrectionval)
-   :fparticle(par),fcharge(icharge),fPt(pt), fEta(eta), fPhi(phi),feffcorrectionval(effcorrectionval)  {}
+ LRCParticlePID(Int_t par,Short_t icharge,Float_t pt,Float_t eta, Float_t phi,Float_t effcorrectionval,const TBits *clustermap,const TBits *sharemap)
+   :fparticle(par),fcharge(icharge),fPt(pt), fEta(eta), fPhi(phi),feffcorrectionval(effcorrectionval),fTPCClusterMap(clustermap),fTPCHitShareMap(sharemap) {}
   virtual ~LRCParticlePID() {}
 
   
@@ -588,7 +597,8 @@ public:
     Float_t geteffcorrectionval() const {return feffcorrectionval;}
     virtual Bool_t IsEqual(const TObject* obj) const { return (obj->GetUniqueID() == GetUniqueID()); }
     virtual void SetPhi(Double_t phiv) { fPhi = phiv; }
-
+    virtual const TBits * GetTPCPadMap() {return fTPCClusterMap; }
+    virtual const TBits * GetTPCSharedMap() {return fTPCHitShareMap; }
 
 private:
   LRCParticlePID(const LRCParticlePID&);  // not implemented
@@ -600,8 +610,13 @@ private:
   Float_t fEta;
   Float_t fPhi;
   Float_t feffcorrectionval;
+   const TBits   *fTPCClusterMap;
+   const TBits   *fTPCHitShareMap;
   ClassDef(LRCParticlePID, 1);
 } ;
 
 #endif
 
+//(fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL"))
+//(fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleType=="pp_7" && fPPVsMultUtils==kFALSE))
+//(fCentralityMethod.EndsWith("_MANUAL"))
diff --git a/PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.cxx b/PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.cxx
new file mode 100644 (file)
index 0000000..3aa6284
--- /dev/null
@@ -0,0 +1,193 @@
+#include "TChain.h"
+
+#include "AliAnalysisDataSlot.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliAnalysisManager.h"
+#include "AliMCEvent.h"
+#include "AliVEvent.h"
+#include "AliTwoParticlePIDCorrKine.h"
+#include "AliGenEventHeader.h"
+#include "AliCollisionGeometry.h"
+#include "AliVEvent.h"
+#include "AliVParticle.h"
+
+
+ClassImp(AliTwoParticlePIDCorrKine)
+
+//____________________________________________| Constructor
+AliTwoParticlePIDCorrKine::AliTwoParticlePIDCorrKine():
+fEvent(0x0),
+fMcHandler(0x0),
+  fHistEventsProcessed(0x0),
+  fOutputList(0),
+  fHistZvtx(0),
+  fHistPt(0),
+  fHistImpact(0x0),
+fZvtxLim(10),
+fCentralityFrom("Impact"),
+fCentralityEstimator("V0M")
+
+{
+  //Default constructor 
+}
+
+//____________________________________________| Specific Constructor
+AliTwoParticlePIDCorrKine::AliTwoParticlePIDCorrKine(const Char_t* name) :
+  AliAnalysisTaskSE(name),
+fEvent(0x0),
+fMcHandler(0x0),
+  fHistEventsProcessed(0x0),
+  fOutputList(0),
+  fHistZvtx(0),
+  fHistPt(0),
+  fHistImpact(0x0),
+fZvtxLim(10),
+fCentralityFrom("Impact"),
+fCentralityEstimator("V0M")
+{
+  // Constructor. Initialization of Inputs and Outputs
+  Info("AliTwoParticlePIDCorrKine","Calling Constructor");
+  // Output slot #1 writes into a TList container (nevents histogram)
+    DefineInput(0, TChain::Class());
+    DefineOutput(1,TList::Class()); // Basic output slot (more needed)
+}
+
+//____________________________________________| Destructor
+AliTwoParticlePIDCorrKine::~AliTwoParticlePIDCorrKine()
+{
+  // Destructor
+  Info("~AliTwoParticlePIDCorrKine","Calling Destructor");
+  if (fHistEventsProcessed) delete fHistEventsProcessed;
+  if (fOutputList) delete fOutputList;
+  if (fHistZvtx) delete fHistZvtx;
+  if (fHistPt) delete fHistPt;
+
+}
+
+//___________________________________________________________________________
+void AliTwoParticlePIDCorrKine::UserCreateOutputObjects()
+{
+
+  //   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  //      AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+    
+    Info("CreateOutputObjects","CreateOutputObjects of task %s", GetName());
+    fOutputList = new TList();
+    fOutputList->SetOwner(kTRUE);
+    //    fOutputList->SetName("KineTest");
+
+
+    fHistEventsProcessed = new TH1F("fHistNEvents","fHistEventsProcessed",3,-0.5,2.5) ;
+    fHistEventsProcessed->GetXaxis()->SetBinLabel(1,"All events");
+    fHistEventsProcessed->GetXaxis()->SetBinLabel(2,"Event within |Ztx| 10cm");
+    fHistEventsProcessed->GetXaxis()->SetBinLabel(3,"Good Reconstructed events");
+    
+    
+    fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
+    fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+    fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+    fHistPt->SetMarkerStyle(kFullCircle);
+    
+    fHistZvtx = new TH1F("fHistZvtx", "Zvtx distribution", 40, -20, 20);
+    fHistZvtx->GetXaxis()->SetTitle("ZVtx (cm)");
+    fHistZvtx->GetYaxis()->SetTitle("Nch");
+    fHistZvtx->SetMarkerStyle(kFullCircle);
+
+    fHistImpact = new TH1F ("fHistImpact","ImpactParameter_Dist", 100,0.0,20.0);
+    
+    fOutputList->Add(fHistEventsProcessed);
+    fOutputList->Add(fHistZvtx);
+    fOutputList->Add(fHistPt);
+    fOutputList->Add(fHistImpact);
+
+    PostData(1, fOutputList);
+
+    
+    return;
+}
+
+
+
+//____________________________________________| User Exec
+void AliTwoParticlePIDCorrKine::UserExec(Option_t *)
+{
+  
+ // fMcHandler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); //get handler
+//if(!fMCHandler) return;
+
+ fEvent = dynamic_cast<AliVEvent*>(MCEvent());
+  if(!fEvent)
+    {
+      //AliError("event not available");
+      return;
+    }
+
+
+    fHistEventsProcessed->Fill(0.0); // # of Event after passing MC cuts
+    
+    
+
+
+       
+    
+    const AliVVertex *vtxMC = fEvent->GetPrimaryVertex();
+    Float_t zVtx = vtxMC->GetZ();
+    if(TMath::Abs(zVtx) < fZvtxLim)fHistZvtx->Fill(zVtx);
+    else return;
+
+fHistEventsProcessed->Fill(1.0);
+
+  Double_t gImpactParameter = 0.;
+  //Double_t  gMultiplicity = 0.;
+  Double_t gReactionPlane=0.0;
+  //Double_t gCentrality=0.0;
+
+ AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(fEvent);
+  if(gMCEvent){
+AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader());
+    if(headerH){
+      gImpactParameter = headerH->ImpactParameter();
+      //gMultiplicity =    GenMultiplicity(event); //calculate the multiplicity depending on the choice of centrality estimator                                           
+      gReactionPlane=     headerH->ReactionPlaneAngle();
+     // gCentrality = (CentralityFrom =="Multiplicity") ? gImpactParameter :gMultiplicity;
+    }
+}
+  
+       fHistImpact->Fill(gImpactParameter);
+  
+     // # of Event after passing MC cuts
+
+    //Printf("MC particles: %d", fEvent->GetNumberOfTracks());
+    
+    for (Int_t iTracks = 0; iTracks < fEvent->GetNumberOfTracks(); iTracks++) {
+        AliVParticle* track = fEvent->GetTrack(iTracks);
+       if (!track) {
+      //AliError(Form("Could not receive particle %d", iTracks));
+      continue;
+    }
+
+        fHistPt->Fill(track->Pt());
+    }
+    
+    
+    fHistEventsProcessed->Fill(2.0); // # of Event after passing MC cuts
+
+  PostData(1, fOutputList);
+  return;
+}
+
+
+//___________________________________________________________________________
+void AliTwoParticlePIDCorrKine::Terminate(Option_t*)
+{
+  
+  Info("Terminate","Start and end of Method");
+  AliAnalysisTaskSE::Terminate();
+    
+  fOutputList = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutputList) {
+        Printf("ERROR: Output list not available");
+        return;
+  }
+
+}
diff --git a/PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.h b/PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorrKine.h
new file mode 100644 (file)
index 0000000..bcb2884
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef AliTwoParticlePIDCorrKine_H
+#define AliTwoParticlePIDCorrKine_H
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisDataSlot.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliInputEventHandler.h"
+#include "AliMCEvent.h"
+
+
+
+
+class TH1F;
+class TList;
+class TParticle;
+class AliStack;
+class AliVEvent;
+class AliVVertex;
+class AliVParticle;
+
+#ifndef ALIANALYSISTASKSE_H
+#include "AliAnalysisTaskSE.h"
+#endif
+
+
+class AliTwoParticlePIDCorrKine : public AliAnalysisTaskSE {
+
+ public:
+
+
+  AliTwoParticlePIDCorrKine();
+  AliTwoParticlePIDCorrKine(const Char_t* name);
+  
+  virtual ~AliTwoParticlePIDCorrKine();
+
+  // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
+  virtual void UserCreateOutputObjects();
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *);
+
+  protected:
+    AliVEvent*              fEvent;    //! MC event                       
+    AliInputEventHandler*    fMcHandler;  //! MCEventHandler                 
+    
+
+  TH1F  *fHistEventsProcessed;   //! histo for monitoring the number of events processed slot 1
+  TList       *fOutputList; //! Output list
+  TH1F       *fHistZvtx;
+  TH1F        *fHistPt; //!Pt spectrum
+  TH1F        *fHistImpact;
+Double_t fZvtxLim;
+TString fCentralityFrom;
+TString fCentralityEstimator;
+       
+  ClassDef(AliTwoParticlePIDCorrKine,1)
+    
+};
+
+#endif
diff --git a/PWGCF/Correlations/macros/TriggerPID/AddTaskTwoParticlePIDCorrKine.C b/PWGCF/Correlations/macros/TriggerPID/AddTaskTwoParticlePIDCorrKine.C
new file mode 100644 (file)
index 0000000..8a266e9
--- /dev/null
@@ -0,0 +1,39 @@
+
+AliTwoParticlePIDCorrKine *AddTaskTwoParticlePIDCorrKine(){
+    
+ AliTwoParticlePIDCorrKine* kine = new  AliTwoParticlePIDCorrKine("");
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+        cout<<"AliAnalysisKine", "No analysis manager to connect to."<<endl;
+        return NULL;
+  }
+
+// Check the analysis type using the event handlers connected to the analysis manager.
+  //===========================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddKineBF", "This Kine requires an input event handler");
+    return NULL;
+  }
+
+TString type = mgr->GetInputEventHandler()->GetDataType();
+    
+  mgr->AddTask(kine);
+    
+    
+AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+AliAnalysisDataContainer *coutput = mgr->CreateContainer("coutput", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
+
+    // connect input/output                                                                                                                                             
+mgr->ConnectInput(kine, 0, cinput);
+mgr->ConnectOutput(kine, 1, coutput);
+
+return kine;
+
+
+}
+
+
+
+
index 4e352bf6cc77fb60b0a481feca47b8b76ce6fbeb..5ed504e3a9139b4f1e2e66304849f17b8bb61540 100644 (file)
@@ -9,7 +9,7 @@
 AliAnalysisTaskDptDptCorrelations *AddTaskDptDptCorr_dca1
 (int    system                  = 0,
  int    singlesOnly             = 0,
- int    useWeights              = 0
+ int    useWeights              = 1
  int    centralityMethod        = 4,
  int    chargeSet               = 1,
  double zMin                   = -10.,
@@ -45,12 +45,15 @@ AliAnalysisTaskDptDptCorrelations *AddTaskDptDptCorr_dca1
     {
     if (centralityMethod == 4)
       {
-
        minCentrality[0] = 0.0; maxCentrality[0] = 5.0;
-       minCentrality[1] = 5.0; maxCentrality[1] = 10.;
-       minCentrality[2] = 30.; maxCentrality[2] = 40.; 
-       minCentrality[3] = 60.; maxCentrality[3] = 70.; 
-       
+        minCentrality[1] = 5.0; maxCentrality[1] = 10.;
+        minCentrality[2] = 10.; maxCentrality[2] = 20.;
+        minCentrality[3] = 20.; maxCentrality[3] = 30.;
+        minCentrality[4] = 30.; maxCentrality[4] = 40.;
+        minCentrality[5] = 40.; maxCentrality[5] = 50.;
+        minCentrality[6] = 50.; maxCentrality[6] = 60.;
+        minCentrality[7] = 60.; maxCentrality[7] = 70.;
+       minCentrality[8] = 70.; maxCentrality[8] = 80.;
       }
     else
       {
index 126932dd705bda72be79e292007242089327cb6c..88de7f9b745af560155d524f75d9e32474ffa566 100644 (file)
@@ -284,8 +284,6 @@ AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
   // and transfers the neccessary information into
   // the internal AliFemtoEvent
 
-  Int_t numberOfLastHijingLabel=0;
-
   AliFemtoEvent *tEvent = new AliFemtoEvent();
 
   // setting global event characteristics
@@ -308,17 +306,6 @@ AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
     if (!mcH) {
       cout << "AOD MC information requested, but no header found!" << endl;
     }
-    else {
-      TIter next(mcH->GetCocktailHeaders());
-      // Loop over the cocktail headers
-      while (const TObject *obj=next()){
-       // Check whether it's a Hijing header
-       // const AliGenHijingEventHeader* hijingHeader = dynamic_cast<const AliGenHijingEventHeader*>(obj);
-       // if(hijingHeader) {
-       //   numberOfLastHijingLabel=hijingHeader->NProduced()-1;
-       // } // End of found the hijing header
-      }
-    }
 
     mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
     if (!mcP) {
@@ -351,7 +338,7 @@ AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
       if(fMinVtxContr)
        anaUtil->SetMinVtxContr(fMinVtxContr);
       if(fpA2013)
-       if(anaUtil->IsVertexSelected2013pA(fEvent)==kFALSE) 
+       if(anaUtil->IsVertexSelected2013pA(fEvent)==kFALSE)
          {
            delete tEvent;
            return NULL; //Vertex rejection for pA analysis.
@@ -856,7 +843,7 @@ AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
 
       AliAODTrack* daughterTrackPos = (AliAODTrack*)aodv0->GetDaughter(0); //getting positive daughter track
       AliAODTrack* daughterTrackNeg = (AliAODTrack*)aodv0->GetDaughter(1); //getting negative daughter track
-      if(!daughterTrackPos) continue; //Daughter tracks must exist
+      if(!daughterTrackPos) continue; //daughter tracks must exist
       if(!daughterTrackNeg) continue;
       if(daughterTrackNeg->Charge() == daughterTrackPos->Charge() ) continue; //and have different charge
 
@@ -868,18 +855,16 @@ AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
          AliAODMCParticle* mcParticlePos = (AliAODMCParticle*)mcP->At(daughterTrackPos->GetLabel());
          AliAODMCParticle* mcParticleNeg = (AliAODMCParticle*)mcP->At(daughterTrackNeg->GetLabel() );
          if((mcParticlePos!=NULL) && (mcParticleNeg!=NULL)){
-           //mcparticle->GetMother() will return a "-1" if the particle doesn't have a true mother (i.e. it's a fake track or primary)
            int motherOfPosID = mcParticlePos->GetMother();
            int motherOfNegID = mcParticleNeg->GetMother();
            if ((motherOfPosID > -1) && (motherOfPosID == motherOfNegID)){
              AliFemtoModelHiddenInfo *tInfo = new AliFemtoModelHiddenInfo();
-             // Both daughter tracks refer to the same mother.  Return the MCParticle index of that mother.
+             // Both daughter tracks refer to the same mother, we can continue
              AliAODMCParticle *v0 = (AliAODMCParticle*)mcP->At(motherOfPosID); //our V0 particle
-             // if(v0->GetLabel() > numberOfLastHijingLabel )  //if true - the particle is injected
-                  //continue;
+
              tInfo->SetPDGPid(v0->GetPdgCode());
              int v0MotherId = v0->GetMother();
-             if(v0MotherId>-1) { //particle has a mother
+             if(v0MotherId>-1) { //V0 particle has a mother
                AliAODMCParticle* motherOfV0 = (AliAODMCParticle*)mcP->At(v0MotherId);
                tInfo->SetMotherPdgCode(motherOfV0->GetPdgCode());
              }
diff --git a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.cxx b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.cxx
new file mode 100644 (file)
index 0000000..956caaa
--- /dev/null
@@ -0,0 +1,429 @@
+////////////////////////////////////////////////////////////////////////////////
+///                                                                          ///
+/// AliFemtoModelBPLCMSCorrFctnKK - the class for correlation function which   ///
+/// uses the model framework and weight generation and calculated the 3D     ///
+/// correlation function in the Bertsh-Pratt LCMS system                     ///
+/// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu                          ///
+///                                                                          ///
+////////////////////////////////////////////////////////////////////////////////
+#include "AliFemtoModelBPLCMSCorrFctnKK.h"
+#include "AliFemtoPair.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoAnalysisReactionPlane.h"
+#include <cstdio>
+
+#ifdef __ROOT__ 
+ClassImp(AliFemtoModelBPLCMSCorrFctnKK)
+#endif
+
+//____________________________
+AliFemtoModelBPLCMSCorrFctnKK::AliFemtoModelBPLCMSCorrFctnKK(char* title, const int& nbins, const float& QLo, const float& QHi)
+  :
+  AliFemtoModelCorrFctn(title, nbins, QLo, QHi),
+  fNumerator3DTrue(0),
+  fNumerator3DFake(0),
+  fDenominator3D(0),
+  fQinvHisto(0),
+  fPairCut(0),
+  fUseRPSelection(0),
+  fNumerator3DTrueIdeal(0),
+  fNumerator3DFakeIdeal(0),
+  fDenominator3DIdeal(0)
+{
+  // set up true numerator
+  char tTitNumT[101] = "Num3DTrue";
+  strncat(tTitNumT,title, 100);
+  fNumerator3DTrue = new TH3D(tTitNumT,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up fake numerator
+  char tTitNumF[101] = "Num3DFake";
+  strncat(tTitNumF,title, 100);
+  fNumerator3DFake = new TH3D(tTitNumF,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up denominator
+  char tTitDen[101] = "Den3D";
+  strncat(tTitDen,title, 100);
+  fDenominator3D = new TH3D(tTitDen,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+  // set up ave qInv
+  char tTitQinv[101] = "Qinv";
+  strncat(tTitQinv,title, 100);
+  fQinvHisto = new TH3D(tTitQinv,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+ // set up true Ideal numerator
+  char tTitNumTI[101] = "Num3DTrueIdeal";
+  strncat(tTitNumTI,title, 100);
+  fNumerator3DTrueIdeal = new TH3D(tTitNumTI,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+ // set up fake Ideal numerator
+  char tTitNumFI[101] = "Num3DFakeIdeal";
+  strncat(tTitNumFI,title, 100);
+  fNumerator3DFakeIdeal = new TH3D(tTitNumFI,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+// set up denominator
+  char tTitDenI[101] = "Den3DIdeal";
+  strncat(tTitDenI,title, 100);
+  fDenominator3DIdeal = new TH3D(tTitDenI,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
+
+
+  // to enable error bar calculation...
+  fNumerator3DTrue->Sumw2();
+  fNumerator3DFake->Sumw2();
+  fDenominator3D->Sumw2();
+  fNumerator3DTrueIdeal->Sumw2();
+  fNumerator3DFakeIdeal->Sumw2();
+  fDenominator3DIdeal->Sumw2();
+}
+
+AliFemtoModelBPLCMSCorrFctnKK::AliFemtoModelBPLCMSCorrFctnKK(const AliFemtoModelBPLCMSCorrFctnKK& aCorrFctn) :
+  AliFemtoModelCorrFctn(aCorrFctn),
+  fNumerator3DTrue(0),
+  fNumerator3DFake(0),
+  fDenominator3D(0),
+  fQinvHisto(0),
+  fPairCut(0),
+  fUseRPSelection(0),
+  fNumerator3DTrueIdeal(0),
+  fNumerator3DFakeIdeal(0),
+  fDenominator3DIdeal(0)
+{
+  // Copy constructor
+  fNumerator3DTrue = new TH3D(*aCorrFctn.fNumerator3DTrue);
+  fNumerator3DFake = new TH3D(*aCorrFctn.fNumerator3DFake);
+  fDenominator3D   = new TH3D(*aCorrFctn.fDenominator3D);
+  fNumerator3DTrueIdeal = new TH3D(*aCorrFctn.fNumerator3DTrueIdeal);
+  fNumerator3DFakeIdeal = new TH3D(*aCorrFctn.fNumerator3DFakeIdeal);
+  fDenominator3DIdeal   = new TH3D(*aCorrFctn.fDenominator3DIdeal);
+  fQinvHisto       = new TH3D(*aCorrFctn.fQinvHisto);
+  fPairCut         = aCorrFctn.fPairCut->Clone();
+}
+//____________________________
+AliFemtoModelBPLCMSCorrFctnKK::~AliFemtoModelBPLCMSCorrFctnKK()
+{
+  // destructor
+  if (fNumeratorTrue) delete fNumeratorTrue;
+  if (fNumeratorFake) delete fNumeratorFake;
+  if (fDenominator) delete fDenominator;
+  delete fNumerator3DTrue;
+  delete fNumerator3DFake;
+  delete fDenominator3D;
+  delete fNumerator3DTrueIdeal;
+  delete fNumerator3DFakeIdeal;
+  delete fDenominator3DIdeal;
+  delete fQinvHisto;
+  if (fPairCut) delete fPairCut;
+}
+//_________________________
+AliFemtoModelBPLCMSCorrFctnKK& AliFemtoModelBPLCMSCorrFctnKK::operator=(const AliFemtoModelBPLCMSCorrFctnKK& aCorrFctn)
+{
+  // Assignment operator
+  if (this == &aCorrFctn)
+    return *this;
+  if (fNumerator3DTrue) delete fNumerator3DTrue;
+  fNumerator3DTrue = new TH3D(*aCorrFctn.fNumerator3DTrue);
+  if (fNumerator3DFake) delete fNumerator3DFake;
+  fNumerator3DFake = new TH3D(*aCorrFctn.fNumerator3DFake);
+  if (fDenominator3D) delete fDenominator3D;
+  fDenominator3D = new TH3D(*aCorrFctn.fDenominator3D);
+
+ if (fNumerator3DTrueIdeal) delete fNumerator3DTrueIdeal;
+  fNumerator3DTrueIdeal = new TH3D(*aCorrFctn.fNumerator3DTrueIdeal);
+ if (fNumerator3DFakeIdeal) delete fNumerator3DFakeIdeal;
+  fNumerator3DFakeIdeal = new TH3D(*aCorrFctn.fNumerator3DFakeIdeal);
+if (fDenominator3DIdeal) delete fDenominator3DIdeal;
+  fDenominator3DIdeal = new TH3D(*aCorrFctn.fDenominator3DIdeal);
+  if (fQinvHisto) delete fQinvHisto;
+  fQinvHisto = new TH3D(*aCorrFctn.fQinvHisto);
+  fPairCut = aCorrFctn.fPairCut->Clone();
+
+  return *this;
+}
+
+//_________________________
+void AliFemtoModelBPLCMSCorrFctnKK::Write(){
+  // Write out data histograms
+  AliFemtoModelCorrFctn::Write();
+  fNumerator3DTrue->Write();
+  fNumerator3DFake->Write();
+  fDenominator3D->Write();
+  fNumerator3DTrueIdeal->Write();
+  fNumerator3DFakeIdeal->Write();
+  fDenominator3DIdeal->Write();
+  fQinvHisto->Write();
+}
+//________________________
+TList* AliFemtoModelBPLCMSCorrFctnKK::GetOutputList()
+{
+  // Prepare the list of objects to be written to the output
+  TList *tOutputList = AliFemtoModelCorrFctn::GetOutputList();
+
+  tOutputList->Add(fNumerator3DTrue); 
+  tOutputList->Add(fNumerator3DFake);  
+  tOutputList->Add(fDenominator3D);  
+  tOutputList->Add(fNumerator3DTrueIdeal); 
+  tOutputList->Add(fNumerator3DFakeIdeal);  
+  tOutputList->Add(fDenominator3DIdeal);  
+  tOutputList->Add(fQinvHisto);  
+
+  return tOutputList;
+}
+
+//_________________________
+void AliFemtoModelBPLCMSCorrFctnKK::Finish(){
+  fQinvHisto->Divide(fDenominator);
+}
+
+//____________________________
+AliFemtoString AliFemtoModelBPLCMSCorrFctnKK::Report(){
+  // Prepare a report from the execution
+  string stemp = "LCMS Frame Bertsch-Pratt 3D Model Correlation Function Report:\n";
+  char ctemp[100];
+  snprintf(ctemp , 100, "Number of entries in numerator:\t%E\n",fNumeratorTrue->GetEntries());
+  stemp += ctemp;
+  snprintf(ctemp , 100, "Number of entries in denominator:\t%E\n",fDenominator->GetEntries());
+  stemp += ctemp;
+
+  /*  if (fCorrection)
+      {
+      float radius = fCorrection->GetRadius();
+      snprintf(ctemp , 100, "Coulomb correction used radius of\t%E\n",radius);
+      }
+      else
+      {
+      snprintf(ctemp , 100, "No Coulomb Correction applied to this CorrFctn\n");
+      }
+      stemp += ctemp;
+  */
+
+  //  
+  AliFemtoString returnThis = stemp;
+  return returnThis;
+}
+//____________________________
+void AliFemtoModelBPLCMSCorrFctnKK::AddRealPair( AliFemtoPair* pair)
+{
+  // Store a real pair in numerator
+  if (fPairCut){
+    if (fUseRPSelection) {
+      AliFemtoKTPairCut *ktc = dynamic_cast<AliFemtoKTPairCut *>(fPairCut);
+      if (!ktc) { 
+       cout << "RP aware cut requested, but not connected to the CF" << endl;
+       if (!(fPairCut->Pass(pair))) return;
+      }
+      else {
+       AliFemtoAnalysisReactionPlane *arp = dynamic_cast<AliFemtoAnalysisReactionPlane *> (HbtAnalysis());
+       if (!arp) {
+         cout << "RP aware cut requested, but not connected to the CF" << endl;
+         if (!(fPairCut->Pass(pair))) return;
+       }
+       else if (!(ktc->Pass(pair, arp->GetCurrentReactionPlane()))) return;
+      }
+    }
+    else
+      if (!(fPairCut->Pass(pair))) return;
+  }
+//   if (fPairCut){
+//     if (!(fPairCut->Pass(pair))) return;
+//   }
+  
+  Double_t weight = fManager->GetWeight(pair);
+
+  double qOut = (pair->QOutCMS());
+  double qSide = (pair->QSideCMS());
+  double qLong = (pair->QLongCMS());
+  
+  double qOutTrue = GetQoutTrue(pair);
+  double qSideTrue = GetQsideTrue(pair);
+  double qLongTrue =  GetQlongTrue(pair);
+
+
+  fNumerator3DTrue->Fill(qOut, qSide, qLong, weight);
+  fNumeratorTrue->Fill(pair->QInv(), weight);
+
+  fNumerator3DTrueIdeal->Fill(qOutTrue, qSideTrue, qLongTrue, weight);
+
+}
+//____________________________
+void AliFemtoModelBPLCMSCorrFctnKK::AddMixedPair( AliFemtoPair* pair){
+  // store mixed pair in denominator
+  if (fPairCut){
+    if (fUseRPSelection) {
+      AliFemtoKTPairCut *ktc = dynamic_cast<AliFemtoKTPairCut *>(fPairCut);
+      if (!ktc) { 
+       cout << "RP aware cut requested, but not connected to the CF" << endl;
+       if (!(fPairCut->Pass(pair))) return;
+      }
+      else {
+       AliFemtoAnalysisReactionPlane *arp = dynamic_cast<AliFemtoAnalysisReactionPlane *> (HbtAnalysis());
+       if (!arp) {
+         cout << "RP aware cut requested, but not connected to the CF" << endl;
+         if (!(fPairCut->Pass(pair))) return;
+       }
+       else if (!(ktc->Pass(pair, arp->GetCurrentReactionPlane()))) return;
+      }
+    }
+    else
+      if (!(fPairCut->Pass(pair))) return;
+  }
+//   if (fPairCut){
+//     if (!(fPairCut->Pass(pair))) return;
+//   }
+
+  Double_t weight = fManager->GetWeight(pair);
+
+  double qOut = (pair->QOutCMS());
+  double qSide = (pair->QSideCMS());
+  double qLong = (pair->QLongCMS());
+
+  double qOutTrue = GetQoutTrue(pair);
+  double qSideTrue = GetQsideTrue(pair);
+  double qLongTrue =  GetQlongTrue(pair);
+
+  fNumerator3DFake->Fill(qOut, qSide, qLong, weight);
+  fDenominator3D->Fill(qOut, qSide, qLong, 1.0);
+  fNumeratorFake->Fill(pair->QInv(), weight);
+  fDenominator->Fill(pair->QInv(), 1.0);
+
+  fNumerator3DFakeIdeal->Fill(qOutTrue, qSideTrue, qLongTrue, weight);
+  fDenominator3DIdeal->Fill(qOutTrue, qSideTrue, qLongTrue, 1.0);
+
+}
+//_______________________
+AliFemtoModelCorrFctn* AliFemtoModelBPLCMSCorrFctnKK::Clone()
+{
+  // Clone the correlation function
+  AliFemtoModelBPLCMSCorrFctnKK *tCopy = new AliFemtoModelBPLCMSCorrFctnKK(*this);
+  
+  return tCopy;
+}
+
+void AliFemtoModelBPLCMSCorrFctnKK::SetSpecificPairCut(AliFemtoPairCut* aCut)
+{
+  fPairCut = aCut;
+}
+
+void AliFemtoModelBPLCMSCorrFctnKK::SetUseRPSelection(unsigned short aRPSel)
+{
+  fUseRPSelection = aRPSel;
+}
+
+
+//_______________________
+Double_t AliFemtoModelBPLCMSCorrFctnKK::GetQinvTrue(AliFemtoPair* aPair)
+{
+  AliFemtoTrack *inf1 = (AliFemtoTrack *) aPair->Track1()->Track();
+  AliFemtoTrack *inf2 = (AliFemtoTrack *) aPair->Track2()->Track();
+
+  AliFemtoLorentzVector fm1;
+  AliFemtoThreeVector* temp = inf1->GetTrueMomentum();
+  fm1.SetVect(*temp);
+  double ener = TMath::Sqrt(temp->Mag2()+(aPair->Track1()->Track()->GetMass())*(aPair->Track1()->Track()->GetMass()));
+  fm1.SetE(ener);
+
+  AliFemtoLorentzVector fm2;
+  AliFemtoThreeVector* temp2 = inf2->GetTrueMomentum();
+  fm2.SetVect(*temp2);
+  ener = TMath::Sqrt(temp2->Mag2()+(aPair->Track2()->Track()->GetMass())*(aPair->Track2()->Track()->GetMass()));
+  fm2.SetE(ener);
+
+  AliFemtoLorentzVector tQinvTrueVec = (fm1-fm2);
+  Double_t tQinvTrue = -1.* tQinvTrueVec.m();
+
+  return tQinvTrue;
+}
+
+//_______________________
+Double_t AliFemtoModelBPLCMSCorrFctnKK::GetQoutTrue(AliFemtoPair* aPair)
+{
+
+ // relative momentum out component in lab frame
+  AliFemtoTrack *inf1 = (AliFemtoTrack *) aPair->Track1()->Track();
+  AliFemtoTrack *inf2 = (AliFemtoTrack *) aPair->Track2()->Track();
+
+  // AliFemtoLorentzVector fm1;
+  AliFemtoThreeVector* tmp1 = inf1->GetTrueMomentum();
+  /* 
+ fm1.SetVect(*tmp1);
+  double ener = TMath::Sqrt(tmp1->Mag2()+(aPair->Track1()->Track()->GetMass())*(aPair->Track1()->Track()->GetMass()));
+  fm1.SetE(ener);
+  */
+  //  AliFemtoLorentzVector fm2;
+  AliFemtoThreeVector* tmp2 = inf2->GetTrueMomentum();
+  /*
+  fm2.SetVect(*tmp2);
+  ener = TMath::Sqrt(tmp2->Mag2()+(aPair->Track2()->Track()->GetMass())*(aPair->Track2()->Track()->GetMass()));
+  fm2.SetE(ener);
+  */
+    double dx = tmp1->x() - tmp2->x();
+    double xt = tmp1->x() + tmp2->x();
+    
+    double dy = tmp1->y() - tmp2->y();
+    double yt = tmp1->y() + tmp2->y();
+
+    double k1 = (::sqrt(xt*xt+yt*yt));
+    double k2 = (dx*xt+dy*yt);
+    double tmp;
+
+    if(k1!=0) tmp= k2/k1;
+    else tmp=0;
+
+    return (tmp);
+
+}
+
+
+
+//_________________
+Double_t AliFemtoModelBPLCMSCorrFctnKK::GetQsideTrue(AliFemtoPair* aPair)
+{
+
+  AliFemtoTrack *inf1 = (AliFemtoTrack *) aPair->Track1()->Track();
+  AliFemtoTrack *inf2 = (AliFemtoTrack *) aPair->Track2()->Track();
+  AliFemtoThreeVector* tmp1 = inf1->GetTrueMomentum();
+  AliFemtoThreeVector* tmp2 = inf2->GetTrueMomentum();
+
+  // relative momentum side component in lab frame
+   
+    double x1 = tmp1->x();  double y1 = tmp1->y();
+    double x2 = tmp2->x();  double y2 = tmp2->y();
+
+    double xt = x1+x2;  double yt = y1+y2;
+    double k1 = ::sqrt(xt*xt+yt*yt);
+    
+    double tmp;
+    if(k1!=0) tmp= 2.0*(x2*y1-x1*y2)/k1;
+    else tmp=0;
+
+    return (tmp);
+}
+
+//_________________________
+double AliFemtoModelBPLCMSCorrFctnKK::GetQlongTrue(AliFemtoPair* aPair)
+{
+  // relative momentum component in lab frame
+
+  AliFemtoTrack *inf1 = (AliFemtoTrack *) aPair->Track1()->Track();
+  AliFemtoTrack *inf2 = (AliFemtoTrack *) aPair->Track2()->Track();
+  AliFemtoThreeVector* temp1 = inf1->GetTrueMomentum();
+  AliFemtoThreeVector* temp2 = inf2->GetTrueMomentum();
+
+  AliFemtoLorentzVector tmp1;
+  tmp1.SetVect(*temp1);
+ double ener = TMath::Sqrt(temp1->Mag2()+(aPair->Track1()->Track()->GetMass())*(aPair->Track1()->Track()->GetMass()));
+  tmp1.SetE(ener);
+
+AliFemtoLorentzVector tmp2;
+  tmp2.SetVect(*temp2);
+ double ener2 = TMath::Sqrt(temp2->Mag2()+(aPair->Track2()->Track()->GetMass())*(aPair->Track2()->Track()->GetMass()));
+  tmp2.SetE(ener2);
+
+    double dz = tmp1.z() - tmp2.z();
+    double zz = tmp1.z() + tmp2.z();
+
+    double dt = tmp1.t() - tmp2.t();
+    double tt = tmp1.t() + tmp2.t();
+
+    double beta = zz/tt;
+    double gamma = 1.0/TMath::Sqrt((1.-beta)*(1.+beta));
+
+    double temp = gamma*(dz - beta*dt);
+    return (temp);
+}
diff --git a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.h b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelBPLCMSCorrFctnKK.h
new file mode 100644 (file)
index 0000000..1015a49
--- /dev/null
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+///                                                                          ///
+/// AliFemtoModelBPLCMSCorrFctn - the class for correlation function which   ///
+/// uses the model framework and weight generation and calculated the 3D     ///
+/// correlation function in the Bertsh-Pratt LCMS system                     ///
+/// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu                          ///
+///                                                                          ///
+////////////////////////////////////////////////////////////////////////////////
+#ifndef ALIFEMTOMODELBPLCMSCORRFCTNKK_H
+#define ALIFEMTOMODELBPLCMSCORRFCTNKK_H
+
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoModelCorrFctn.h"
+#include "AliFemtoPairCut.h"
+#include "TH3D.h"
+
+class AliFemtoModelBPLCMSCorrFctnKK : public AliFemtoModelCorrFctn {
+ public:
+  AliFemtoModelBPLCMSCorrFctnKK()  :
+    AliFemtoModelCorrFctn(),
+    fNumerator3DTrue(0),
+    fNumerator3DFake(0),
+    fDenominator3D(0),
+    fQinvHisto(0),
+    fPairCut(0),
+    fUseRPSelection(0),
+    fNumerator3DTrueIdeal(0),
+    fNumerator3DFakeIdeal(0),
+    fDenominator3DIdeal(0){}
+  AliFemtoModelBPLCMSCorrFctnKK(char* title, const int& nbins, const float& QLo, const float& QHi);
+  AliFemtoModelBPLCMSCorrFctnKK(const AliFemtoModelBPLCMSCorrFctnKK& aCorrFctn);
+  virtual ~AliFemtoModelBPLCMSCorrFctnKK();
+
+  AliFemtoModelBPLCMSCorrFctnKK& operator=(const AliFemtoModelBPLCMSCorrFctnKK& aCorrFctn);
+
+  virtual AliFemtoString Report();
+  virtual void AddRealPair(AliFemtoPair* pair);
+  virtual void AddMixedPair(AliFemtoPair* pair);
+
+  virtual void Finish();
+
+  virtual void Write();
+  virtual TList* GetOutputList();
+
+  void SetSpecificPairCut(AliFemtoPairCut* aCut);
+  void SetUseRPSelection(unsigned short aRPSel);
+
+  //ml
+  Double_t GetQinvTrue(AliFemtoPair*);
+  Double_t GetQoutTrue(AliFemtoPair*);
+  Double_t GetQsideTrue(AliFemtoPair*);
+  Double_t GetQlongTrue(AliFemtoPair*);
+
+
+  virtual AliFemtoModelCorrFctn* Clone();
+
+protected:
+  TH3D* fNumerator3DTrue;            // 3D Numerator with pairs from same event only
+  TH3D* fNumerator3DFake;            // 3D Numerator with pairs from mixed events
+  TH3D* fDenominator3D;              // 3D Denominator with the weight of 1.0
+
+  TH3D* fQinvHisto;                  // Averag qinv histogram
+
+
+  //ml
+
+  TH3D *fNumerator3DTrueIdeal; // Numerator made with pairs (true qosl) from the same event
+  TH3D *fNumerator3DFakeIdeal; // Numerator made with pairs (true qosl) from different events (mixed pairs)
+  TH3D *fDenominator3DIdeal;   // Denominator made with mixed pairs (true qosl)
+
+
+
+  AliFemtoPairCut* fPairCut;    //! this is a PairCut specific to THIS CorrFctn, not the Analysis
+
+  unsigned short fUseRPSelection;  // The pair cut uses RP selection
+#ifdef __ROOT__
+  ClassDef(AliFemtoModelBPLCMSCorrFctnKK, 1)
+#endif
+};
+
+#endif
+
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..bdb56d5
--- /dev/null
@@ -0,0 +1,285 @@
+/*********************************************************************
+ *                                                                                                                                                                                      *
+ * Configfemtoanalysis.C - configuration macro for the femtoscopic      *
+ * analysis, meant as a QA process for two-particle effects                             *
+ *                                                                                                                                                                                      *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                                                                    *
+ *                                                                                                                                                                                      *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoCorrFctnNonIdDR.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoPairCutPt.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+       double PionMass = 0.13956995;
+       double KaonMass = 0.493677;
+       double ProtonMass = 0.938272013;
+
+       const int numOfMultBins = 4;
+       const int numOfChTypes = 3;
+       const int numOfkTbins = 4;
+
+       int runmults[numOfMultBins] = {1,0,0,0};
+       int multbins[numOfMultBins+1] = {0.001, 100, 200, 400, 600};
+
+       int runch[numOfChTypes] = {0, 1, 0};
+       const char *chrgs[numOfChTypes] = { "pip", "pim", "pippim" };
+
+       int runktdep[numOfkTbins] = {1,0,0,1};
+       double ktrng[numOfkTbins+1] = {0.2, 0.3, 0.4, 0.6, 0.7};
+
+       int gammacut = 0;       // cut na ee for gamma
+
+       double shqmax = 0.5;
+       int nbinssh = 200;
+
+       //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+       //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kGlobalCount);
+
+       AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+       Reader->SetFilterBit(7);
+  Reader->SetCentralityPreSelection(0.00001, 710);
+  Reader->SetEPVZERO(kTRUE);
+  Reader->SetCentralityFlattening(kTRUE);
+
+       AliFemtoManager* Manager = new AliFemtoManager();
+       Manager->SetEventReader(Reader);
+
+       AliFemtoVertexMultAnalysis              *anetaphitpc[320];
+       AliFemtoBasicEventCut                    *mecetaphitpc[320];
+       AliFemtoCutMonitorEventMult      *cutPassEvMetaphitpc[320];
+       AliFemtoCutMonitorEventMult      *cutFailEvMetaphitpc[320];
+       AliFemtoCutMonitorEventVertex  *cutPassEvVetaphitpc[320];
+       AliFemtoCutMonitorEventVertex  *cutFailEvVetaphitpc[320];
+
+       AliFemtoESDTrackCut             *dtc5etaphitpc[320];
+       AliFemtoESDTrackCut             *dtc6etaphitpc[320];
+
+       AliFemtoTPCInnerCorrFctn      *PhiStarEtaetaphitpc[320];
+
+       AliFemtoCutMonitorParticleYPt *cutPass6YPtetaphitpc[320];
+       AliFemtoCutMonitorParticleYPt *cutFail6YPtetaphitpc[320];
+       AliFemtoCutMonitorParticlePID *cutPass6PIDetaphitpc[320];
+       AliFemtoCutMonitorParticlePID *cutFail6PIDetaphitpc[320];
+       //       AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpcsame[320];
+       AliFemtoPairCutAntiGamma                        *sqpcetaphitpc[320];
+       //      AliFemtoPairCutRadialDistance                   *sqpcetaphitpc[320];
+       //      AliFemtoChi2CorrFctn                            *cchiqinvetaphitpc[320];
+       AliFemtoKTPairCut                                *ktpcuts[320];
+       AliFemtoQinvCorrFctn                            *cqinvkttpc[320];
+       AliFemtoQinvCorrFctn                            *cqinvtpc[320];
+       AliFemtoCorrFctnDEtaDPhi                        *cdedpetaphi[320];
+
+
+
+       // *** Third QA task - HBT analysis ***
+       // *** Begin pion-pion analysis ***
+       int aniter = 0;
+
+       for (int imult = 0; imult < numOfMultBins; imult++)
+       {
+               if (runmults[imult])
+               {
+                       for (int ichg = 0; ichg < numOfChTypes; ichg++)
+                       {
+                               if (runch[ichg])
+                               {
+
+                                       aniter = ichg * numOfMultBins + imult;
+                                       anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(8, -8.0, 8.0, 6, multbins[imult], multbins[imult+1]);
+                                       anetaphitpc[aniter]->SetNumEventsToMix(10);
+                                       anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+                                       mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+                                       mecetaphitpc[aniter]->SetEventMult(0.001,100000);
+                                       mecetaphitpc[aniter]->SetVertZPos(-8,8);//cm
+
+                                       // //*** Event monitors ***
+
+                                       // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+                                       // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+                                       //*** Cuts ***
+
+                                       dtc5etaphitpc[aniter] = new AliFemtoESDTrackCut();
+                                       dtc6etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+                                       dtc5etaphitpc[aniter]->SetCharge(1.0);
+                                       dtc6etaphitpc[aniter]->SetCharge(-1.0);
+
+
+                                       dtc5etaphitpc[aniter]->SetEta(-1.0,1.0);
+                                       dtc5etaphitpc[aniter]->SetPt(0.2,20);
+                                       dtc5etaphitpc[aniter]->SetMass(PionMass);
+                                       dtc5etaphitpc[aniter]->SetMostProbablePion();
+
+                                       dtc6etaphitpc[aniter]->SetEta(-1.0,1.0);
+                                       dtc6etaphitpc[aniter]->SetPt(0.2,20);
+                                       dtc6etaphitpc[aniter]->SetMass(PionMass);
+                                       dtc6etaphitpc[aniter]->SetMostProbablePion();
+
+                                       // Track quality cuts
+
+                                       dtc5etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCin);
+                                       dtc5etaphitpc[aniter]->SetminTPCncls(80);
+                                       dtc5etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                       dtc5etaphitpc[aniter]->SetLabel(kFALSE);
+                                       //      dtc5etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                       dtc5etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                       dtc5etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01) ;
+                                       //      dtc5etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                       dtc5etaphitpc[aniter]->SetMaxImpactZ(2);
+                                       //      dtc5etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+
+                                       dtc6etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCin);
+                                       dtc6etaphitpc[aniter]->SetminTPCncls(80);
+                                       dtc6etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                       dtc6etaphitpc[aniter]->SetLabel(kFALSE);
+                                       //      dtc6etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                       dtc6etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                       dtc6etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01) ;
+                                       //      dtc6etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                       dtc6etaphitpc[aniter]->SetMaxImpactZ(2);
+                                       //      dtc6etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+                                       // //*** Single track monitors ***
+
+                                       // cutPass6YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass%stpcM%i", chrgs[ichg], imult),PionMass);
+                                       // cutFail6YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail%stpcM%i", chrgs[ichg], imult),PionMass);
+                                       // dtc5etaphitpc[aniter]->AddCutMonitor(cutPass6YPtetaphitpc[aniter], cutFail6YPtetaphitpc[aniter]);
+
+                                       // cutPass6PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),0);//0-pion,1-kaon,2-proton
+                                       // cutFail6PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),0);
+                                       // dtc5etaphitpc[aniter]->AddCutMonitor(cutPass6PIDetaphitpc[aniter], cutFail6PIDetaphitpc[aniter]);
+
+
+                                       //*** Two-track cuts monitors ***
+                                       sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+
+                                       sqpcetaphitpc[aniter]->SetShareQualityMax(1.0); // two track cuts on splitting and merging
+                                       sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+                                       sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+
+                                       if (gammacut == 0)
+          {
+            sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+            sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          }
+                                       else if (gammacut == 1)
+          {
+            sqpcetaphitpc[aniter]->SetMaxEEMinv(0.002);
+            sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.008);
+          }
+
+                                       anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+
+                                       if(ichg==0)//pip
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc5etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc5etaphitpc[aniter]);
+                                       }
+                                       if(ichg==1)//pim
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc6etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc6etaphitpc[aniter]);
+
+                                       }
+                                       if(ichg==2)//pip pim
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc5etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc6etaphitpc[aniter]);
+                                       }
+
+                                       anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+                                       // *** Correlation functions ***
+
+                                       // //Deta-Dphi correlation function
+                                       // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),35, 35);
+
+                                       // //qinv correlation function
+                                       // cqinvtpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,2.0);
+                                       // anetaphitpc[aniter]->AddCorrFctn(cqinvtpc[aniter]);
+
+                                       // //Phi*-Eta monitor
+                                       // PhiStarEtaetaphitpc[aniter] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,2.0);
+                                       // anetaphitpc[aniter]->AddCorrFctn(PhiStarEtaetaphitpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++)
+          {
+            if (runktdep[ikt])
+            {
+
+                                                       ktm = aniter * numOfkTbins + ikt;
+                                                       ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+                                                       cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,2.0);
+                                                       cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+                                                       anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+                                                       PhiStarEtaetaphitpc[aniter] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+                                                       anetaphitpc[aniter]->AddCorrFctn(PhiStarEtaetaphitpc[aniter]);
+
+                                               }
+                                       }
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+
+                               }
+
+                       }
+               }
+       }
+       // *** End pion-pion (positive) analysis
+
+       return Manager;
+}
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb_MC/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/PbPb_MC/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..ea6bb10
--- /dev/null
@@ -0,0 +1,286 @@
+/*********************************************************************
+ *                                                                                                                                                                                      *
+ * Configfemtoanalysis.C - configuration macro for the femtoscopic      *
+ * analysis, meant as a QA process for two-particle effects                             *
+ *                                                                                                                                                                                      *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                                                                    *
+ *                                                                                                                                                                                      *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoCorrFctnNonIdDR.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoPairCutPt.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+       double PionMass = 0.13956995;
+       double KaonMass = 0.493677;
+       double ProtonMass = 0.938272013;
+
+       const int numOfMultBins = 4;
+       const int numOfChTypes = 3;
+       const int numOfkTbins = 4;
+
+       int runmults[numOfMultBins] = {1,0,0,0};
+       int multbins[numOfMultBins+1] = {0.001, 100, 200, 400, 600};
+
+       int runch[numOfChTypes] = {0, 1, 0};
+       const char *chrgs[numOfChTypes] = { "pip", "pim", "pippim" };
+
+       int runktdep[numOfkTbins] = {1,0,0,1};
+       double ktrng[numOfkTbins+1] = {0.2, 0.3, 0.4, 0.6, 0.7};
+
+       int gammacut = 0;       // cut na ee for gamma
+
+       double shqmax = 0.5;
+       int nbinssh = 200;
+
+       //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+       //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kGlobalCount);
+
+       AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+       Reader->SetFilterBit(7);
+  Reader->SetCentralityPreSelection(0.00001, 710);
+  Reader->SetEPVZERO(kTRUE);
+  Reader->SetCentralityFlattening(kTRUE);
+  Reader->SetReadMC(kTRUE);
+
+       AliFemtoManager* Manager = new AliFemtoManager();
+       Manager->SetEventReader(Reader);
+
+       AliFemtoVertexMultAnalysis              *anetaphitpc[320];
+       AliFemtoBasicEventCut                    *mecetaphitpc[320];
+       AliFemtoCutMonitorEventMult      *cutPassEvMetaphitpc[320];
+       AliFemtoCutMonitorEventMult      *cutFailEvMetaphitpc[320];
+       AliFemtoCutMonitorEventVertex  *cutPassEvVetaphitpc[320];
+       AliFemtoCutMonitorEventVertex  *cutFailEvVetaphitpc[320];
+
+       AliFemtoESDTrackCut             *dtc5etaphitpc[320];
+       AliFemtoESDTrackCut             *dtc6etaphitpc[320];
+
+       AliFemtoTPCInnerCorrFctn      *PhiStarEtaetaphitpc[320];
+
+       AliFemtoCutMonitorParticleYPt *cutPass6YPtetaphitpc[320];
+       AliFemtoCutMonitorParticleYPt *cutFail6YPtetaphitpc[320];
+       AliFemtoCutMonitorParticlePID *cutPass6PIDetaphitpc[320];
+       AliFemtoCutMonitorParticlePID *cutFail6PIDetaphitpc[320];
+       //       AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpcsame[320];
+       AliFemtoPairCutAntiGamma                        *sqpcetaphitpc[320];
+       //      AliFemtoPairCutRadialDistance                   *sqpcetaphitpc[320];
+       //      AliFemtoChi2CorrFctn                            *cchiqinvetaphitpc[320];
+       AliFemtoKTPairCut                                *ktpcuts[320];
+       AliFemtoQinvCorrFctn                            *cqinvkttpc[320];
+       AliFemtoQinvCorrFctn                            *cqinvtpc[320];
+       AliFemtoCorrFctnDEtaDPhi                        *cdedpetaphi[320];
+
+
+
+       // *** Third QA task - HBT analysis ***
+       // *** Begin pion-pion analysis ***
+       int aniter = 0;
+
+       for (int imult = 0; imult < numOfMultBins; imult++)
+       {
+               if (runmults[imult])
+               {
+                       for (int ichg = 0; ichg < numOfChTypes; ichg++)
+                       {
+                               if (runch[ichg])
+                               {
+
+                                       aniter = ichg * numOfMultBins + imult;
+                                       anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(8, -8.0, 8.0, 6, multbins[imult], multbins[imult+1]);
+                                       anetaphitpc[aniter]->SetNumEventsToMix(10);
+                                       anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+                                       mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+                                       mecetaphitpc[aniter]->SetEventMult(0.001,100000);
+                                       mecetaphitpc[aniter]->SetVertZPos(-8,8);//cm
+
+                                       // //*** Event monitors ***
+
+                                       // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+                                       // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+                                       //*** Cuts ***
+
+                                       dtc5etaphitpc[aniter] = new AliFemtoESDTrackCut();
+                                       dtc6etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+                                       dtc5etaphitpc[aniter]->SetCharge(1.0);
+                                       dtc6etaphitpc[aniter]->SetCharge(-1.0);
+
+
+                                       dtc5etaphitpc[aniter]->SetEta(-1.0,1.0);
+                                       dtc5etaphitpc[aniter]->SetPt(0.2,20);
+                                       dtc5etaphitpc[aniter]->SetMass(PionMass);
+                                       dtc5etaphitpc[aniter]->SetMostProbablePion();
+
+                                       dtc6etaphitpc[aniter]->SetEta(-1.0,1.0);
+                                       dtc6etaphitpc[aniter]->SetPt(0.2,20);
+                                       dtc6etaphitpc[aniter]->SetMass(PionMass);
+                                       dtc6etaphitpc[aniter]->SetMostProbablePion();
+
+                                       // Track quality cuts
+
+                                       dtc5etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCin);
+                                       dtc5etaphitpc[aniter]->SetminTPCncls(80);
+                                       dtc5etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                       dtc5etaphitpc[aniter]->SetLabel(kFALSE);
+                                       //      dtc5etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                       dtc5etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                       dtc5etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01) ;
+                                       //      dtc5etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                       dtc5etaphitpc[aniter]->SetMaxImpactZ(2);
+                                       //      dtc5etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+
+                                       dtc6etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCin);
+                                       dtc6etaphitpc[aniter]->SetminTPCncls(80);
+                                       dtc6etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                       dtc6etaphitpc[aniter]->SetLabel(kFALSE);
+                                       //      dtc6etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                       dtc6etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                       dtc6etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01) ;
+                                       //      dtc6etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                       dtc6etaphitpc[aniter]->SetMaxImpactZ(2);
+                                       //      dtc6etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+                                       // //*** Single track monitors ***
+
+                                       // cutPass6YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass%stpcM%i", chrgs[ichg], imult),PionMass);
+                                       // cutFail6YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail%stpcM%i", chrgs[ichg], imult),PionMass);
+                                       // dtc5etaphitpc[aniter]->AddCutMonitor(cutPass6YPtetaphitpc[aniter], cutFail6YPtetaphitpc[aniter]);
+
+                                       // cutPass6PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),0);//0-pion,1-kaon,2-proton
+                                       // cutFail6PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),0);
+                                       // dtc5etaphitpc[aniter]->AddCutMonitor(cutPass6PIDetaphitpc[aniter], cutFail6PIDetaphitpc[aniter]);
+
+
+                                       //*** Two-track cuts monitors ***
+                                       sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+
+                                       sqpcetaphitpc[aniter]->SetShareQualityMax(1.0); // two track cuts on splitting and merging
+                                       sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+                                       sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+
+                                       if (gammacut == 0)
+          {
+            sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+            sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          }
+                                       else if (gammacut == 1)
+          {
+            sqpcetaphitpc[aniter]->SetMaxEEMinv(0.002);
+            sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.008);
+          }
+
+                                       anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+
+                                       if(ichg==0)//pip
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc5etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc5etaphitpc[aniter]);
+                                       }
+                                       if(ichg==1)//pim
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc6etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc6etaphitpc[aniter]);
+
+                                       }
+                                       if(ichg==2)//pip pim
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc5etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc6etaphitpc[aniter]);
+                                       }
+
+                                       anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+                                       // *** Correlation functions ***
+
+                                       // //Deta-Dphi correlation function
+                                       // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),35, 35);
+
+                                       // //qinv correlation function
+                                       // cqinvtpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,2.0);
+                                       // anetaphitpc[aniter]->AddCorrFctn(cqinvtpc[aniter]);
+
+                                       // //Phi*-Eta monitor
+                                       // PhiStarEtaetaphitpc[aniter] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,2.0);
+                                       // anetaphitpc[aniter]->AddCorrFctn(PhiStarEtaetaphitpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++)
+          {
+            if (runktdep[ikt])
+            {
+
+                                                       ktm = aniter * numOfkTbins + ikt;
+                                                       ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+                                                       cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,2.0);
+                                                       cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+                                                       anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+                                                       PhiStarEtaetaphitpc[aniter] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+                                                       anetaphitpc[aniter]->AddCorrFctn(PhiStarEtaetaphitpc[aniter]);
+
+                                               }
+                                       }
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+
+                               }
+
+                       }
+               }
+       }
+       // *** End pion-pion (positive) analysis
+
+       return Manager;
+}
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..fcdde45
--- /dev/null
@@ -0,0 +1,309 @@
+
+/*********************************************************************
+ *                                                                   *
+ * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic   *
+ * analysis, meant as a QA process for two-particle effects          *
+ *                                                                   *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                         *
+ *                                                                   *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoCutMonitorCollections.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+  double PionMass = 0.13956995;
+  double KaonMass = 0.493677;
+
+  //multiplicity bins
+       const int numOfMultBins = 10;
+  int runmults[numOfMultBins] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  int multbins[numOfMultBins+1] = {0.01, 200, 400, 600, 900, 950, 500, 600, 700, 800, 900};
+
+  int runch[2] = {0, 1};
+  const char *chrgs[2] = { "pip", "pim" };
+
+       const int numOfkTbins = 4;
+       int runktdep[numOfkTbins] = {1,0,0,1};
+  double ktrng[numOfkTbins+1] = {0.2, 0.3, 0.4, 0.6, 0.7};
+
+  int run3d = 0; // Do 3D cartesian analysis?
+  int runshlcms = 1;
+
+  //PhysicsSelection set only in runBatch with trigger + Physics Selection Task
+
+  double shqmax;
+  int nbinssh = 200;
+
+  if (runshlcms) shqmax = 2.0;
+  else shqmax = 0.9;
+
+  AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+  Reader->SetUseMultiplicity(AliFemtoEventReaderAODChain::kCentralityCL1);
+  Reader->SetFilterBit(0);
+  Reader->SetpA2013(kTRUE);
+  Reader->SetDCAglobalTrack(kTRUE);
+
+  //Reader->SetCentralityPreSelection(500, 950);
+
+  //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
+  //Reader->SetConstrained(true);
+  // Reader->SetUseTPCOnly(false);
+
+  //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+  //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);
+  //Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);
+
+
+  AliFemtoManager* Manager=new AliFemtoManager();
+  Manager->SetEventReader(Reader);
+
+  AliFemtoVertexMultAnalysis    *anetaphitpc[20];
+  AliFemtoBasicEventCut         *mecetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutPassEvMetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutFailEvMetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutPassColletaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutFailColletaphitpc[20];
+  AliFemtoESDTrackCut           *dtc1etaphitpc[20];
+  AliFemtoESDTrackCut           *dtc2etaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
+  //  AliFemtoPairCutAntiGamma      *sqpcetaphitpc[20];
+  AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpc[20];
+  //AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];
+  AliFemtoCorrFctnDirectYlm     *cylmetaphitpc[20];
+  AliFemtoCorrFctnDEtaDPhi      *cdedpetaphi[20];
+  AliFemtoChi2CorrFctn          *cchiqinvetaphitpc[20];
+  AliFemtoKTPairCut             *ktpcuts[20*7];
+  AliFemtoCorrFctnDirectYlm     *cylmkttpc[20*7];
+  AliFemtoQinvCorrFctn          *cqinvkttpc[20*7];
+  AliFemtoCorrFctn3DLCMSSym     *cq3dlcmskttpc[20*7];
+  AliFemtoCorrFctnTPCNcls       *cqinvnclstpc[20];
+  AliFemtoShareQualityCorrFctn  *cqinvsqtpc[20*10];
+  AliFemtoChi2CorrFctn          *cqinvchi2tpc[20];
+  AliFemtoTPCInnerCorrFctn      *cqinvinnertpc[20*10];
+
+  // *** Begin pion-pion analysis ***
+  int aniter = 0;
+
+  for (int imult=0; imult<numOfMultBins; imult++) {
+    if (runmults[imult]) {
+      for (int ichg=0; ichg<2; ichg++) {
+        if (runch[ichg]) {
+          aniter = ichg*numOfMultBins+imult;
+
+          anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);
+          anetaphitpc[aniter]->SetNumEventsToMix(5);
+          anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+          mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+          mecetaphitpc[aniter]->SetEventMult(0,10000);
+          mecetaphitpc[aniter]->SetVertZPos(-10,10);
+
+          // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);
+          // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+          // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+          // cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);
+
+          dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+          if (ichg == 0)
+            dtc1etaphitpc[aniter]->SetCharge(1.0);
+          else if (ichg == 1)
+            dtc1etaphitpc[aniter]->SetCharge(-1.0);
+
+          dtc1etaphitpc[aniter]->SetPt(0.12,4.0);
+          dtc1etaphitpc[aniter]->SetEta(-1.2,1.2);
+
+          //PID method
+          dtc1etaphitpc[aniter]->SetMass(PionMass);
+          dtc1etaphitpc[aniter]->SetMostProbablePion();
+          //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);
+
+          //Track quality cuts
+          dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+          dtc1etaphitpc[aniter]->SetminTPCncls(50);
+          dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+
+
+          dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+          dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36);
+          dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+
+          //primary particles: hits in ITS + DCA cut
+          dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                                          AliESDtrackCuts::kAny);
+          dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);
+          dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+          //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+          // cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);
+
+          // cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);
+          // cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);
+
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+          sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+          sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
+          sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+          sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+          //runtype==0
+          // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+          // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+          // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==1
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==2
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+
+          anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+          anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+          //Correlation functions
+
+          // //Spherical harmonics (without kT bins)
+          // cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);
+          // anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);
+
+          // //Qinv (without kT bins)
+          // cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);
+
+          // //3D cartesian (without kT bins)
+          // if(run3d){
+          //   cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);
+          //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);
+          // }
+
+          // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);
+
+          // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++) {
+            if (runktdep[ikt]) {
+
+              ktm = aniter*numOfkTbins + ikt;
+              ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+              // cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,
+              //                                                nbinssh, 0.0, shqmax, runshlcms);
+              // cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);
+
+              cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);
+              cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+              // cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              // cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);
+
+              cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+
+(Form("cqinvinner%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              cqinvinnertpc[ktm]->SetRadius(1.2);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);
+
+              // if (run3d) {
+              //   //          cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);
+              //   cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);
+              //   cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);
+              // }
+
+            }
+          }
+
+          // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);
+          // anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+        }
+      }
+    }
+  }
+  // *** End pion-pion analysis
+
+  return Manager;
+}
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb_MC/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pPb_MC/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..11b2372
--- /dev/null
@@ -0,0 +1,307 @@
+
+/*********************************************************************
+ *                                                                   *
+ * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic   *
+ * analysis, meant as a QA process for two-particle effects          *
+ *                                                                   *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                         *
+ *                                                                   *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoCutMonitorCollections.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+  double PionMass = 0.13956995;
+  double KaonMass = 0.493677;
+
+  //multiplicity bins
+       const int numOfMultBins = 10;
+  int runmults[numOfMultBins] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  int multbins[numOfMultBins+1] = {0.01, 200, 400, 600, 900, 950, 500, 600, 700, 800, 900};
+
+  int runch[2] = {0, 1};
+  const char *chrgs[2] = { "pip", "pim" };
+
+       const int numOfkTbins = 7;
+       int runktdep[numOfkTbins] = {1,0,0,1};
+       double ktrng[numOfkTbins+1] = {0.2, 0.3, 0.4, 0.6, 0.7};
+
+  int run3d = 0; // Do 3D cartesian analysis?
+  int runshlcms = 1;
+
+  //PhysicsSelection set only in runBatch with trigger + Physics Selection Task
+
+  double shqmax;
+  int nbinssh = 200;
+
+  if (runshlcms) shqmax = 2.0;
+  else shqmax = 0.9;
+
+  AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+  Reader->SetUseMultiplicity(AliFemtoEventReaderAODChain::kCentralityCL1);
+  Reader->SetFilterBit(0);
+  Reader->SetpA2013(kTRUE);
+  Reader->SetDCAglobalTrack(kTRUE);
+
+  //Reader->SetCentralityPreSelection(500, 950);
+
+  //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
+  //Reader->SetConstrained(true);
+  // Reader->SetUseTPCOnly(false);
+
+  //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+  //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);
+  //Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);
+
+
+  AliFemtoManager* Manager=new AliFemtoManager();
+  Manager->SetEventReader(Reader);
+
+  AliFemtoVertexMultAnalysis    *anetaphitpc[20];
+  AliFemtoBasicEventCut         *mecetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutPassEvMetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutFailEvMetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutPassColletaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutFailColletaphitpc[20];
+  AliFemtoESDTrackCut           *dtc1etaphitpc[20];
+  AliFemtoESDTrackCut           *dtc2etaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
+  //  AliFemtoPairCutAntiGamma      *sqpcetaphitpc[20];
+  AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpc[20];
+  //AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];
+  AliFemtoCorrFctnDirectYlm     *cylmetaphitpc[20];
+  AliFemtoCorrFctnDEtaDPhi      *cdedpetaphi[20];
+  AliFemtoChi2CorrFctn          *cchiqinvetaphitpc[20];
+  AliFemtoKTPairCut             *ktpcuts[20*7];
+  AliFemtoCorrFctnDirectYlm     *cylmkttpc[20*7];
+  AliFemtoQinvCorrFctn          *cqinvkttpc[20*7];
+  AliFemtoCorrFctn3DLCMSSym     *cq3dlcmskttpc[20*7];
+  AliFemtoCorrFctnTPCNcls       *cqinvnclstpc[20];
+  AliFemtoShareQualityCorrFctn  *cqinvsqtpc[20*10];
+  AliFemtoChi2CorrFctn          *cqinvchi2tpc[20];
+  AliFemtoTPCInnerCorrFctn      *cqinvinnertpc[20*10];
+
+  // *** Begin pion-pion analysis ***
+  int aniter = 0;
+
+  for (int imult=0; imult<numOfMultBins; imult++) {
+    if (runmults[imult]) {
+      for (int ichg=0; ichg<2; ichg++) {
+        if (runch[ichg]) {
+          aniter = ichg*numOfMultBins+imult;
+
+          anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);
+          anetaphitpc[aniter]->SetNumEventsToMix(5);
+          anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+          mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+          mecetaphitpc[aniter]->SetEventMult(0,10000);
+          mecetaphitpc[aniter]->SetVertZPos(-10,10);
+
+          // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);
+          // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+          // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+          // cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);
+
+          dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+          if (ichg == 0)
+            dtc1etaphitpc[aniter]->SetCharge(1.0);
+          else if (ichg == 1)
+            dtc1etaphitpc[aniter]->SetCharge(-1.0);
+
+          dtc1etaphitpc[aniter]->SetPt(0.12,4.0);
+          dtc1etaphitpc[aniter]->SetEta(-1.2,1.2);
+
+          //PID method
+          dtc1etaphitpc[aniter]->SetMass(PionMass);
+          dtc1etaphitpc[aniter]->SetMostProbablePion();
+          //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);
+
+          //Track quality cuts
+          dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+          dtc1etaphitpc[aniter]->SetminTPCncls(50);
+          dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+
+
+          dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+          dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36);
+          dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+
+          //primary particles: hits in ITS + DCA cut
+          dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                                          AliESDtrackCuts::kAny);
+          dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);
+          dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+          //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+          // cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);
+
+          // cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);
+          // cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);
+
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+          sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+          sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
+          sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+          sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+          //runtype==0
+          // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+          // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+          // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==1
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==2
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+
+          anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+          anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+          //Correlation functions
+
+          // //Spherical harmonics (without kT bins)
+          // cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);
+          // anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);
+
+          // //Qinv (without kT bins)
+          // cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);
+
+          // //3D cartesian (without kT bins)
+          // if(run3d){
+          //   cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);
+          //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);
+          // }
+
+          // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);
+
+          // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++) {
+            if (runktdep[ikt]) {
+
+              ktm = aniter*numOfkTbins + ikt;
+              ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+              // cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,
+              //                                                nbinssh, 0.0, shqmax, runshlcms);
+              // cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);
+
+              cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);
+              cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+              // cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              // cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);
+
+              cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              cqinvinnertpc[ktm]->SetRadius(1.2);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);
+
+              // if (run3d) {
+              //   //          cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);
+              //   cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);
+              //   cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);
+              // }
+
+            }
+          }
+
+          // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);
+          // anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+        }
+      }
+    }
+  }
+  // *** End pion-pion analysis
+
+  return Manager;
+}
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..8394361
--- /dev/null
@@ -0,0 +1,308 @@
+
+/*********************************************************************
+ *                                                                   *
+ * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic   *
+ * analysis, meant as a QA process for two-particle effects          *
+ *                                                                   *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                         *
+ *                                                                   *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoCutMonitorCollections.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+  double PionMass = 0.13956995;
+  double KaonMass = 0.493677;
+
+  //multiplicity bins
+  const int numOfMultBins = 5;
+       int runmults[numOfMultBins] = {1, 0, 0, 0, 0};
+       int multbins[numOfMultBins+1] = {50, 150, 50,150,2,150};
+
+  int runch[2] = {0, 1};
+  const char *chrgs[2] = { "pip", "pim" };
+
+       const int numOfkTbins = 4;
+       int runktdep[numOfkTbins] = {1,0,0,1};
+  double ktrng[numOfkTbins+1] = {0.2, 0.3,0.5, 0.6, 0.7};
+
+  int run3d = 0; // Do 3D cartesian analysis?
+  int runshlcms = 1;
+
+  //PhysicsSelection set only in runBatch with trigger + Physics Selection Task
+
+  double shqmax;
+  int nbinssh = 200;
+
+  if (runshlcms) shqmax = 2.0;
+  else shqmax = 0.9;
+
+  AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+  Reader->SetFilterBit(96);
+  Reader->SetDCAglobalTrack(kTRUE);
+       Reader->SetUseMultiplicity(AliFemtoEventReaderAOD::kReference);
+       Reader->SetMinPlpContribSPD(3);
+       Reader->SetIsPileUpEvent(kTRUE);
+
+  //Reader->SetCentralityPreSelection(500, 950);
+
+  //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
+  //Reader->SetConstrained(true);
+  // Reader->SetUseTPCOnly(false);
+
+  //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+  //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);
+  //Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);
+
+
+  AliFemtoManager* Manager=new AliFemtoManager();
+  Manager->SetEventReader(Reader);
+
+  AliFemtoVertexMultAnalysis    *anetaphitpc[20];
+  AliFemtoBasicEventCut         *mecetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutPassEvMetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutFailEvMetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutPassColletaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutFailColletaphitpc[20];
+  AliFemtoESDTrackCut           *dtc1etaphitpc[20];
+  AliFemtoESDTrackCut           *dtc2etaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
+  //  AliFemtoPairCutAntiGamma      *sqpcetaphitpc[20];
+  AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpc[20];
+  //AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];
+  AliFemtoCorrFctnDirectYlm     *cylmetaphitpc[20];
+  AliFemtoCorrFctnDEtaDPhi      *cdedpetaphi[20];
+  AliFemtoChi2CorrFctn          *cchiqinvetaphitpc[20];
+  AliFemtoKTPairCut             *ktpcuts[20*7];
+  AliFemtoCorrFctnDirectYlm     *cylmkttpc[20*7];
+  AliFemtoQinvCorrFctn          *cqinvkttpc[20*7];
+  AliFemtoCorrFctn3DLCMSSym     *cq3dlcmskttpc[20*7];
+  AliFemtoCorrFctnTPCNcls       *cqinvnclstpc[20];
+  AliFemtoShareQualityCorrFctn  *cqinvsqtpc[20*10];
+  AliFemtoChi2CorrFctn          *cqinvchi2tpc[20];
+  AliFemtoTPCInnerCorrFctn      *cqinvinnertpc[20*10];
+
+  // *** Begin pion-pion analysis ***
+  int aniter = 0;
+
+  for (int imult=0; imult<numOfMultBins; imult++) {
+    if (runmults[imult]) {
+      for (int ichg=0; ichg<2; ichg++) {
+        if (runch[ichg]) {
+          aniter = ichg*numOfMultBins+imult;
+
+          anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);
+          anetaphitpc[aniter]->SetNumEventsToMix(5);
+          anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+          mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+          mecetaphitpc[aniter]->SetEventMult(0,10000);
+          mecetaphitpc[aniter]->SetVertZPos(-10,10);
+
+          // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);
+          // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+          // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+          // cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);
+
+          dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+          if (ichg == 0)
+            dtc1etaphitpc[aniter]->SetCharge(1.0);
+          else if (ichg == 1)
+            dtc1etaphitpc[aniter]->SetCharge(-1.0);
+
+          dtc1etaphitpc[aniter]->SetPt(0.12,4.0);
+          dtc1etaphitpc[aniter]->SetEta(-1.2,1.2);
+
+          //PID method
+          dtc1etaphitpc[aniter]->SetMass(PionMass);
+          dtc1etaphitpc[aniter]->SetMostProbablePion();
+          //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);
+
+          //Track quality cuts
+          dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+          dtc1etaphitpc[aniter]->SetminTPCncls(50);
+          dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+
+
+          dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+          dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36);
+          dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+
+          //primary particles: hits in ITS + DCA cut
+          dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                                          AliESDtrackCuts::kAny);
+          dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);
+          dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+          //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+          // cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);
+
+          // cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);
+          // cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);
+
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+          sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+          sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
+          sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+          sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+          //runtype==0
+          // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+          // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+          // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==1
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==2
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+
+          anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+          anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+          //Correlation functions
+
+          // //Spherical harmonics (without kT bins)
+          // cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);
+          // anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);
+
+          // //Qinv (without kT bins)
+          // cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);
+
+          // //3D cartesian (without kT bins)
+          // if(run3d){
+          //   cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);
+          //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);
+          // }
+
+          // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);
+
+          // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++) {
+            if (runktdep[ikt]) {
+
+              ktm = aniter*numOfkTbins + ikt;
+              ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+              // cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,
+              //                                                nbinssh, 0.0, shqmax, runshlcms);
+              // cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);
+
+              cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);
+              cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+              // cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              // cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);
+
+              cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,2.0);
+              cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              cqinvinnertpc[ktm]->SetRadius(1.2);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);
+
+              // if (run3d) {
+              //   //          cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);
+              //   cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);
+              //   cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);
+              // }
+
+            }
+          }
+
+          // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);
+          // anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+        }
+      }
+    }
+  }
+  // *** End pion-pion analysis
+
+  return Manager;
+}
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp_MC/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/FemtoQA/pp_MC/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..43b4860
--- /dev/null
@@ -0,0 +1,308 @@
+
+/*********************************************************************
+ *                                                                   *
+ * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic   *
+ * analysis, meant as a QA process for two-particle effects          *
+ *                                                                   *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                         *
+ *                                                                   *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoCutMonitorCollections.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+  double PionMass = 0.13956995;
+  double KaonMass = 0.493677;
+
+  //multiplicity bins
+  const int numOfMultBins = 5;
+       int runmults[numOfMultBins] = {1, 0, 0, 0, 0};
+       int multbins[numOfMultBins+1] = {50, 150, 50,150,2,150};
+
+  int runch[2] = {0, 1};
+  const char *chrgs[2] = { "pip", "pim" };
+
+       const int numOfkTbins = 4;
+       int runktdep[numOfkTbins] = {1,0,0,1};
+  double ktrng[numOfkTbins+1] = {0.2, 0.3,0.5, 0.6, 0.7};
+
+  int run3d = 0; // Do 3D cartesian analysis?
+  int runshlcms = 1;
+
+  //PhysicsSelection set only in runBatch with trigger + Physics Selection Task
+
+  double shqmax;
+  int nbinssh = 200;
+
+  if (runshlcms) shqmax = 2.0;
+  else shqmax = 0.9;
+
+  AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+  Reader->SetFilterBit(96);
+  Reader->SetDCAglobalTrack(kTRUE);
+       Reader->SetUseMultiplicity(AliFemtoEventReaderAOD::kReference);
+       Reader->SetMinPlpContribSPD(3);
+       Reader->SetIsPileUpEvent(kTRUE);
+
+  //Reader->SetCentralityPreSelection(500, 950);
+
+  //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
+  //Reader->SetConstrained(true);
+  // Reader->SetUseTPCOnly(false);
+
+  //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+  //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);
+  //Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);
+
+
+  AliFemtoManager* Manager=new AliFemtoManager();
+  Manager->SetEventReader(Reader);
+
+  AliFemtoVertexMultAnalysis    *anetaphitpc[20];
+  AliFemtoBasicEventCut         *mecetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutPassEvMetaphitpc[20];
+  AliFemtoCutMonitorEventMult   *cutFailEvMetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];
+  AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutPassColletaphitpc[20];
+  AliFemtoCutMonitorCollections   *cutFailColletaphitpc[20];
+  AliFemtoESDTrackCut           *dtc1etaphitpc[20];
+  AliFemtoESDTrackCut           *dtc2etaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];
+  AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
+  //  AliFemtoPairCutAntiGamma      *sqpcetaphitpc[20];
+  AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpc[20];
+  //AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];
+  AliFemtoCorrFctnDirectYlm     *cylmetaphitpc[20];
+  AliFemtoCorrFctnDEtaDPhi      *cdedpetaphi[20];
+  AliFemtoChi2CorrFctn          *cchiqinvetaphitpc[20];
+  AliFemtoKTPairCut             *ktpcuts[20*7];
+  AliFemtoCorrFctnDirectYlm     *cylmkttpc[20*7];
+  AliFemtoQinvCorrFctn          *cqinvkttpc[20*7];
+  AliFemtoCorrFctn3DLCMSSym     *cq3dlcmskttpc[20*7];
+  AliFemtoCorrFctnTPCNcls       *cqinvnclstpc[20];
+  AliFemtoShareQualityCorrFctn  *cqinvsqtpc[20*10];
+  AliFemtoChi2CorrFctn          *cqinvchi2tpc[20];
+  AliFemtoTPCInnerCorrFctn      *cqinvinnertpc[20*10];
+
+  // *** Begin pion-pion analysis ***
+  int aniter = 0;
+
+  for (int imult=0; imult<numOfMultBins; imult++) {
+    if (runmults[imult]) {
+      for (int ichg=0; ichg<2; ichg++) {
+        if (runch[ichg]) {
+          aniter = ichg*numOfMultBins+imult;
+
+          anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);
+          anetaphitpc[aniter]->SetNumEventsToMix(5);
+          anetaphitpc[aniter]->SetMinSizePartCollection(1);
+          anetaphitpc[aniter]->SetVerboseMode(kFALSE);
+
+          mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+          mecetaphitpc[aniter]->SetEventMult(0,10000);
+          mecetaphitpc[aniter]->SetVertZPos(-10,10);
+
+          // cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);
+          // cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+          // cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+          // cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+          // cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+          // mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);
+
+          dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
+
+          if (ichg == 0)
+            dtc1etaphitpc[aniter]->SetCharge(1.0);
+          else if (ichg == 1)
+            dtc1etaphitpc[aniter]->SetCharge(-1.0);
+
+          dtc1etaphitpc[aniter]->SetPt(0.12,4.0);
+          dtc1etaphitpc[aniter]->SetEta(-1.2,1.2);
+
+          //PID method
+          dtc1etaphitpc[aniter]->SetMass(PionMass);
+          dtc1etaphitpc[aniter]->SetMostProbablePion();
+          //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);
+
+          //Track quality cuts
+          dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+          dtc1etaphitpc[aniter]->SetminTPCncls(50);
+          dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+
+
+          dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+          dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36);
+          dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+
+          //primary particles: hits in ITS + DCA cut
+          dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                                          AliESDtrackCuts::kAny);
+          dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);
+          dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);
+          //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+          //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+          // cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);
+
+          // cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);
+          // cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);
+          // dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);
+
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+          sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
+          //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+          sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
+          sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+          sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+          //runtype==0
+          // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+          // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+          // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+          // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==1
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+          //runtype==2
+          //       sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);
+          //       sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+          //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
+          //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+          //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+
+          anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+          anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+          anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+          //Correlation functions
+
+          // //Spherical harmonics (without kT bins)
+          // cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);
+          // anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);
+
+          // //Qinv (without kT bins)
+          // cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);
+
+          // //3D cartesian (without kT bins)
+          // if(run3d){
+          //   cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);
+          //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);
+          // }
+
+          // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);
+
+          // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+          // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);
+
+          int ktm;
+          for (int ikt=0; ikt<numOfkTbins; ikt++) {
+            if (runktdep[ikt]) {
+
+              ktm = aniter*numOfkTbins + ikt;
+              ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+              // cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,
+              //                                                nbinssh, 0.0, shqmax, runshlcms);
+              // cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);
+
+              cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);
+              cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+              // cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              // cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              // anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);
+
+              cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("PhistarEta%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+              cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              cqinvinnertpc[ktm]->SetRadius(1.2);
+              anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);
+
+              // if (run3d) {
+              //   //          cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);
+              //   cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);
+              //   cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+              //   anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);
+              // }
+
+            }
+          }
+
+          // cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);
+          // anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+          Manager->AddAnalysis(anetaphitpc[aniter]);
+        }
+      }
+    }
+  }
+  // *** End pion-pion analysis
+
+  return Manager;
+}
index 25b492ada7f66e075a2210f091522372114b953d..139217a0be6c10bd53a27bc1cc2f98571defa34e 100644 (file)
@@ -39,6 +39,7 @@
 #pragma link C++ class AliAnalysisTaskPIDCORR+;
 #pragma link C++ class AliPIDCorrParticle+;
 #pragma link C++ class AliTwoParticlePIDCorr+;
+#pragma link C++ class AliTwoParticlePIDCorrKine+;
 #pragma link C++ class LRCParticlePID+;
 #pragma link C++ class AliAnalysisTaskPidPidCorrelations+;
 #pragma link C++ class AliPidPidCorrelationReducedTrack+;
index 5c603cb7e03a9463c4cb73abba2b4ddfddec9907..fed33afcdc7cde7c9641664fd01b7b1939f40e96 100644 (file)
@@ -16,6 +16,7 @@
 #pragma link C++ class AliFemtoModelCorrFctnSource;
 #pragma link C++ class AliFemtoModelCorrFctnDEtaDPhi;
 #pragma link C++ class AliFemtoModelBPLCMSCorrFctn;
+#pragma link C++ class AliFemtoModelBPLCMSCorrFctnKK;
 #pragma link C++ class AliFemtoModelGausRinvFreezeOutGenerator;
 #pragma link C++ class AliFemtoModelCorrFctnTrueQ;
 #pragma link C++ class AliFemtoModelCorrFctnNonIdDR;
index 92f6df84e1f53b8b44e70fb6d43c7bab69d4c8c9..91bb5242151e02e5ec1f91520e2494641990a331 100644 (file)
@@ -53,3 +53,6 @@ set ( DHDR  PWGGAEMCALTasksLinkDef.h)
 string ( REPLACE ".cxx" ".h" EXPORT "${SRCS}" )
 
 set ( EINCLUDE PWGGA/PWGGAUtils PWGGA/EMCALTasks PWGGA/PHOSTasks/PHOS_PbPb PWG/EMCAL EMCAL OADB STEER/STEER STEER/AOD STEER/ESD STEER/STEERBase ANALYSIS ANALYSIS/ESDfilter)
+
+install (FILES EMCALTasks/macros/AddTaskEMCALTriggerQA.C
+        DESTINATION PWGGA/EMCALTasks/macros/ )
index 6a04d985cb6f99513a62576acb74d21b17d30111..d1a7310fb084f002e4eed2c5d4a824c6678a9cd1 100644 (file)
@@ -63,3 +63,9 @@ set ( EINCLUDE  PWGGA/PWGGAUtils PWGGA/PHOSTasks/PHOS_pp_pi0 PWGGA/PHOSTasks/Cal
 install (FILES PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C 
               PHOSTasks/CaloCellQA/macros/AddTaskPHOSQA.C 
         DESTINATION PWGGA/PHOSTasks/CaloCellQA/macros)
+
+install (FILES PHOSTasks/PHOS_TriggerQA/macros/AddTaskPHOSTriggerQA.C
+        DESTINATION PWGGA/PHOSTasks/PHOS_TriggerQA/macros/ )
+
+install (FILES PHOSTasks/PHOS_PbPbQA/macros/AddTaskPHOSPbPb.C
+        DESTINATION PWGGA/PHOSTasks/PHOS_PbPbQA/macros/ )
index 5ef4c396113202fc5c8922b40b8cdb277ad161c3..497b36c7285e2104ada3eb6a71d69bb6d14319a8 100755 (executable)
@@ -71,6 +71,8 @@ fPHOSCellAmpMin(0),                    fMinInvMassECut(0),
 fExoNECrossCuts(0),                    fExoECrossCuts(),
 fExoNDTimeCuts(0),                     fExoDTimeCuts(),    
 
+fClusterMomentum(),                    fClusterMomentum2(),
+fPrimaryMomentum(),
 //Histograms
 fhE(0),                                fhPt(0),                                
 fhPhi(0),                              fhEta(0),                               fhEtaPhiE(0),
@@ -248,7 +250,7 @@ void AliAnaCalorimeterQA::BadClusterHistograms(AliVCluster* clus, const TObjArra
   //Bad cluster histograms
   
   //  printf("AliAnaCalorimeterQA::BadClusterHistograms() - Event %d - Calorimeter %s \n \t  E %f, n cells %d, max cell absId %d, maxCellFrac %f\n",
-  //         GetReader()->GetEventNumber(), GetCalorimeter().Data(), 
+  //         GetReader()->GetEventNumber(), GetCalorimeterString().Data(), 
   //         clus->E(),clus->GetNCells(),absIdMax,maxCellFraction);
     
   fhBadClusterEnergy     ->Fill(clus->E());
@@ -388,8 +390,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
   Int_t   ncellsCut = 0;
   Float_t ecellsCut = 0;
   
-  if( GetDebug() > 0 )
-    printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - %s cell entries %d\n", GetCalorimeter().Data(), ncells );    
+  AliDebug(1,Form("%s cell entries %d", GetCalorimeterString().Data(), ncells));
   
   //Init arrays and used variables
   Int_t   *nCellsInModule = new Int_t  [fNModules];
@@ -413,19 +414,18 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
   
   for (Int_t iCell = 0; iCell < cells->GetNumberOfCells(); iCell++)
   {
-    if(GetDebug() > 2)  
-      printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell));
+    AliDebug(2,Form("Cell : amp %f, absId %d", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell)));
    
     Int_t nModule = GetModuleNumberCellIndexes(cells->GetCellNumber(iCell),GetCalorimeter(), icol, irow, iRCU);
-    if(GetDebug() > 2) 
-      printf("\t module %d, column %d, row %d \n", nModule,icol,irow);
+    
+    AliDebug(2,Form("\t module %d, column %d, row %d", nModule,icol,irow));
     
     if(nModule < fNModules) 
     {  
       //Check if the cell is a bad channel
       if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn())
       {
-        if(GetCalorimeter()=="EMCAL")
+        if(GetCalorimeter()==kEMCAL)
         {
           if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue;
         }
@@ -451,13 +451,12 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
  
       if(time < fTimeCutMin || time > fTimeCutMax)
       {
-          if(GetDebug() > 0 )
-            printf("AliAnaCalorimeterQA - Remove cell with Time %f\n",time);
+          AliDebug(1,Form("Remove cell with Time %f",time));
           continue;
       }
       
       // Remove exotic cells, defined only for EMCAL
-      if(GetCalorimeter()=="EMCAL" && 
+      if(GetCalorimeter()==kEMCAL && 
          GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCell(id, cells, bc)) continue;
       
       fhAmplitude->Fill(amp);
@@ -480,7 +479,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
         Int_t icols = icol;
         Int_t irows = irow;
         
-        if(GetCalorimeter()=="EMCAL")
+        if(GetCalorimeter()==kEMCAL)
         {
           icols = (nModule % 2) ? icol + fNMaxCols : icol;                             
           if(nModule < 10 ) 
@@ -504,7 +503,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
         
         if(fFillAllCellTimeHisto)
         {
-          //printf("%s: time %g\n",GetCalorimeter().Data(), time);
+          //printf("%s: time %g\n",GetCalorimeterString().Data(), time);
           
           Double_t v[3] = {0,0,0}; //vertex ;
           GetReader()->GetVertex(v);          
@@ -530,7 +529,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
       //Get Eta-Phi position of Cell
       if(fFillAllPosHisto)
       {
-        if(GetCalorimeter()=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
+        if(GetCalorimeter()==kEMCAL && GetCaloUtils()->IsEMCALGeoMatrixSet()){
           Float_t celleta = 0.;
           Float_t cellphi = 0.;
           GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi); 
@@ -545,7 +544,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
           fhRCellE->Fill(rcell,amp)  ;
           fhXYZCell->Fill(cellpos[0],cellpos[1],cellpos[2])  ;
         }//EMCAL Cells
-        else if(GetCalorimeter()=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){
+        else if(GetCalorimeter()==kPHOS && GetCaloUtils()->IsPHOSGeoMatrixSet()){
           TVector3 xyz;
           Int_t relId[4], module;
           Float_t xCell, zCell;
@@ -571,8 +570,7 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
   //Number of cells per module
   for(Int_t imod = 0; imod < fNModules; imod++ )
   {
-    if(GetDebug() > 1) 
-      printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - module %d calo %s cells %d\n", imod, GetCalorimeter().Data(), nCellsInModule[imod]); 
+    AliDebug(1,Form("Module %d calo %s cells %d", imod, GetCalorimeterString().Data(), nCellsInModule[imod]));
     
     fhNCellsMod->Fill(nCellsInModule[imod],imod) ;
   }
@@ -582,19 +580,18 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
   {
     for (Int_t iCell = 0; iCell < cells->GetNumberOfCells(); iCell++)
     {
-      if(GetDebug() > 2)
-        printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell));
+      AliDebug(2,Form("Cell : amp %f, absId %d", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell)));
       
       Int_t nModule = GetModuleNumberCellIndexes(cells->GetCellNumber(iCell),GetCalorimeter(), icol, irow, iRCU);
-      if(GetDebug() > 2)
-        printf("\t module %d, column %d, row %d \n", nModule,icol,irow);
+      
+      AliDebug(2,Form("\t module %d, column %d, row %d", nModule,icol,irow));
       
       if(nModule < fNModules)
       {
         //Check if the cell is a bad channel
         if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn())
         {
-          if(GetCalorimeter()=="EMCAL")
+          if(GetCalorimeter()==kEMCAL)
           {
             if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue;
           }
@@ -619,13 +616,12 @@ void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
         
         if(time < fTimeCutMin || time > fTimeCutMax)
         {
-          if(GetDebug() > 0 )
-            printf("AliAnaCalorimeterQA - Remove cell with Time %f\n",time);
+          AliDebug(1,Form("Remove cell with Time %f",time));
           continue;
         }
         
         // Remove exotic cells, defined only for EMCAL
-        if(GetCalorimeter()=="EMCAL" &&
+        if(GetCalorimeter()==kEMCAL &&
            GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCell(id, cells, bc)) continue;
         
         //E cross for exotic cells
@@ -673,7 +669,7 @@ void AliAnaCalorimeterQA::CellInClusterPositionHistograms(AliVCluster* clus)
     
     //Get position of cell compare to cluster
     
-    if(GetCalorimeter()=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
+    if(GetCalorimeter()==kEMCAL && GetCaloUtils()->IsEMCALGeoMatrixSet()){
       
       Double_t cellpos[] = {0, 0, 0};
       GetEMCALGeometry()->GetGlobal(absId, cellpos);
@@ -693,7 +689,7 @@ void AliAnaCalorimeterQA::CellInClusterPositionHistograms(AliVCluster* clus)
       fhDeltaCellClusterRE     ->Fill(r-rcell, clEnergy)  ;                    
       
     }//EMCAL and its matrices are available
-    else if(GetCalorimeter()=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet())
+    else if(GetCalorimeter()==kPHOS && GetCaloUtils()->IsPHOSGeoMatrixSet())
     {
       TVector3 xyz;
       Int_t relId[4], module;
@@ -891,23 +887,14 @@ void AliAnaCalorimeterQA::ClusterHistograms(AliVCluster* clus, const TObjArray *
     }// fill cell-cluster histogram loop
     
   }//check time and energy of cells respect to max energy cell if cluster of more than 1 cell
-  
-  // Get vertex for photon momentum calculation and event selection
-  Double_t v[3] = {0,0,0}; //vertex ;
-  //GetReader()->GetVertex(v); // 
-  
-  TLorentzVector mom  ;
-  clus->GetMomentum(mom,v); 
-  
-  Float_t e   = mom.E();
-  Float_t pt  = mom.Pt();
-  Float_t eta = mom.Eta();
-  Float_t phi = mom.Phi();
+    
+  Float_t e   = fClusterMomentum.E();
+  Float_t pt  = fClusterMomentum.Pt();
+  Float_t eta = fClusterMomentum.Eta();
+  Float_t phi = fClusterMomentum.Phi();
   if(phi < 0) phi +=TMath::TwoPi();
   
-  if(GetDebug() > 0) {
-    printf("AliAnaCalorimeterQA::ClusterHistograms() - cluster: E %2.3f, pT %2.3f, eta %2.3f, phi %2.3f \n",e,pt,eta,phi*TMath::RadToDeg());
-  }
+  AliDebug(1,Form("cluster: E %2.3f, pT %2.3f, eta %2.3f, phi %2.3f",e,pt,eta,phi*TMath::RadToDeg()));
   
   fhE     ->Fill(e);   
   if(nModule >=0 && nModule < fNModules) fhEMod->Fill(e,nModule);
@@ -951,7 +938,6 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
                                                 AliVCaloCells* cells)
 {
   // Fill clusters related histograms
-  TLorentzVector mom  ;
   Int_t  nLabel                = 0  ;
   Int_t *labels                = 0x0;
   Int_t  nCaloClusters         = caloClusters->GetEntriesFast() ;
@@ -967,15 +953,12 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
   Int_t *nClustersInModule     = new Int_t[fNModules];
   for(Int_t imod = 0; imod < fNModules; imod++ ) nClustersInModule[imod] = 0;
   
-  if(GetDebug() > 0)
-    printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In %s there are %d clusters \n", GetCalorimeter().Data(), nCaloClusters);
+  AliDebug(1,Form("In %s there are %d clusters", GetCalorimeterString().Data(), nCaloClusters));
   
   // Loop over CaloClusters
   for(Int_t iclus = 0; iclus < nCaloClusters; iclus++)
   {
-    if(GetDebug() > 0) 
-      printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - cluster: %d/%d, data %d \n",
-             iclus+1,nCaloClusters,GetReader()->GetDataType());
+    AliDebug(1,Form("Cluster: %d/%d, data %d",iclus+1,nCaloClusters,GetReader()->GetDataType()));
     
     AliVCluster* clus =  (AliVCluster*) caloClusters->At(iclus);
     
@@ -987,16 +970,16 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
     Double_t tof = clus->GetTOF()*1.e9;
     if( tof < fTimeCutMin || tof > fTimeCutMax )
     { 
-      if(GetDebug() > 0 )printf("AliAnaCalorimeterQA - Remove cluster with TOF %f\n",tof);
+      AliDebug(1,Form("Remove cluster with TOF %f",tof));
       continue;
     }    
     
     // Get cluster kinematics
-    clus->GetMomentum(mom,v); 
+    clus->GetMomentum(fClusterMomentum,v);
     
     // Check only certain regions
     Bool_t in = kTRUE;
-    if(IsFiducialCutOn()) in =  GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ;
+    if(IsFiducialCutOn()) in =  GetFiducialCut()->IsInFiducialCut(fClusterMomentum.Eta(),fClusterMomentum.Phi(),GetCalorimeter()) ;
     if(!in) continue;
     
     // MC labels
@@ -1048,7 +1031,7 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
     
     nCaloClustersAccepted++;
     nModule = GetModuleNumber(clus);
-    if(nModule >=0 && nModule < fNModules && mom.E() > 2*fCellAmpMin)
+    if(nModule >=0 && nModule < fNModules && fClusterMomentum.E() > 2*fCellAmpMin)
      nClustersInModule[nModule]++;
         
     // Cluster weights
@@ -1061,11 +1044,11 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
     Int_t  mcOK = kFALSE;
     Int_t  pdg  = -1;
     if(IsDataMC() && nLabel > 0 && labels) 
-      mcOK = ClusterMCHistograms(mom, matched, labels, nLabel, pdg);
+      mcOK = ClusterMCHistograms(matched, labels, nLabel, pdg);
 
     // Matched clusters with tracks, also do some MC comparison, needs input from ClusterMCHistograms
     if( matched &&  fFillAllTMHisto)
-      ClusterMatchedWithTrackHistograms(clus,mom,mcOK,pdg);            
+      ClusterMatchedWithTrackHistograms(clus,mcOK,pdg);
     
     // Invariant mass
     // Try to reduce background with a mild shower shape cut and no more than 1 maxima 
@@ -1073,7 +1056,7 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
     if(fFillAllPi0Histo && nCaloClusters > 1 && nCaloCellsPerCluster > 1 && 
        GetCaloUtils()->GetNumberOfLocalMaxima(clus,cells) == 1 && 
        clus->GetM02() < 0.5 && clus->E() > fMinInvMassECut)
-      InvariantMassHistograms(iclus, mom, nModule, caloClusters,cells);
+      InvariantMassHistograms(iclus, nModule, caloClusters,cells);
     
   }//cluster loop
   
@@ -1083,8 +1066,7 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
   // Number of clusters per module
   for(Int_t imod = 0; imod < fNModules; imod++ )
   { 
-    if(GetDebug() > 1) 
-      printf("AliAnaCalorimeterQA::ClusterLoopHistograms() - module %d calo %s clusters %d\n", imod, GetCalorimeter().Data(), nClustersInModule[imod]); 
+    AliDebug(1,Form("Module %d calo %s clusters %d", imod, GetCalorimeterString().Data(), nClustersInModule[imod]));
     fhNClustersMod->Fill(nClustersInModule[imod],imod);
   }
   
@@ -1092,27 +1074,24 @@ void AliAnaCalorimeterQA::ClusterLoopHistograms(const TObjArray *caloClusters,
   
 }
 
-//__________________________________________________________________________________________
-Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t matched,
-                                                const Int_t * labels, Int_t nLabels, Int_t & pdg )
+//__________________________________________________________________________________
+Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(Bool_t matched,const Int_t * labels,
+                                                Int_t nLabels, Int_t & pdg )
 {
   
   //Fill histograms only possible when simulation
   
   if(!labels || nLabels<=0)
   {
-    if(GetDebug() > 1) printf("AliAnaCalorimeterQA::ClusterMCHistograms() - Strange, labels array %p, n labels %d \n", labels,nLabels);
+    AliWarning(Form("Strange, labels array %p, n labels %d", labels,nLabels));
     return kFALSE;
   }
   
-  if(GetDebug() > 1)
-  {
-    printf("AliAnaCalorimeterQA::ClusterMCHistograms() - Primaries: nlabels %d\n",nLabels);
-  }  
+  AliDebug(1,Form("Primaries: nlabels %d",nLabels));
   
-  Float_t e   = mom.E();
-  Float_t eta = mom.Eta();
-  Float_t phi = mom.Phi();
+  Float_t e   = fClusterMomentum.E();
+  Float_t eta = fClusterMomentum.Eta();
+  Float_t phi = fClusterMomentum.Phi();
   if(phi < 0) phi +=TMath::TwoPi();
   
   AliAODMCParticle * aodprimary  = 0x0;
@@ -1123,7 +1102,7 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
   
   if(label < 0) 
   {
-    if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterMCHistograms() *** bad label ***:  label %d \n", label);
+    AliDebug(1,Form(" *** bad label ***:  label %d", label));
     return kFALSE;
   }
   
@@ -1142,7 +1121,7 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
     
     if( label >= GetMCStack()->GetNtrack()) 
     {
-      if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterMCHistograms() *** large label ***:  label %d, n tracks %d \n", label, GetMCStack()->GetNtrack());
+      AliDebug(1,Form("*** large label ***:  label %d, n tracks %d", label, GetMCStack()->GetNtrack()));
       return kFALSE;
     }
     
@@ -1155,11 +1134,9 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
     vyMC    = primary->Vy();
     iParent = primary->GetFirstMother();
     
-    if(GetDebug() > 1 ) 
-    {
-      printf("AliAnaCalorimeterQA::ClusterMCHistograms() - Cluster most contributing mother: \n");
-      printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg0, primary->GetName(),status, iParent);
-    }
+    AliDebug(1,"Cluster most contributing mother:");
+    AliDebug(1,Form("\t Mother label %d, pdg %d, %s, status %d, parent %d",iMother, pdg0, primary->GetName(),status, iParent));
+    
     
     //Get final particle, no conversion products
     if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion))
@@ -1168,7 +1145,7 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
       primary = GetMCStack()->Particle(iParent);
       pdg = TMath::Abs(primary->GetPdgCode());
       
-      if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterMCHistograms() - Converted cluster!. Find before conversion: \n");
+      AliDebug(2,"Converted cluster!. Find before conversion:");
 
       while((pdg == 22 || pdg == 11) && status != 1)
       {
@@ -1193,14 +1170,11 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
           break;
         }
         
-        if(GetDebug() > 1 )printf("\t pdg %d, index %d, %s, status %d \n",pdg, iMother,  primary->GetName(),status);   
+        AliDebug(2,Form("\t pdg %d, index %d, %s, status %d",pdg, iMother,  primary->GetName(),status));
       }        
 
-      if(GetDebug() > 1 ) 
-      {
-        printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
-        printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg, primary->GetName(), status, iParent);
-      }
+      AliDebug(1,"Converted Cluster mother before conversion:");
+      AliDebug(1,Form("\t Mother label %d, pdg %d, %s, status %d, parent %d",iMother, pdg, primary->GetName(), status, iParent));
       
     }
     
@@ -1208,7 +1182,7 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
     if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || 
        GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta))
     {
-      if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: \n");
+      AliDebug(2,"Overlapped Meson decay!, Find it:");
 
       while(pdg != 111 && pdg != 221)
       {     
@@ -1219,19 +1193,18 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
         pdg     = TMath::Abs(primary->GetPdgCode());
         iParent = primary->GetFirstMother();
 
-        if( iParent < 0 )break;
+        if( iParent < 0 ) break;
         
-        if(GetDebug() > 1 ) printf("\t pdg %d, %s, index %d\n",pdg,  primary->GetName(),iMother);
+        AliDebug(2,Form("\t pdg %d, %s, index %d",pdg,  primary->GetName(),iMother));
         
         if(iMother==-1) 
         {
-          printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
+          AliWarning("Tagged as Overlapped photon but meson not found, why?");
           //break;
         }
       }
 
-      if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
-                                 primary->GetName(),iMother);
+      AliDebug(2,Form("Overlapped %s decay, label %d",primary->GetName(),iMother));
     }
     
     eMC    = primary->Energy();
@@ -1258,18 +1231,14 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
     vyMC    = aodprimary->Yv();
     iParent = aodprimary->GetMother();
     
-    if( GetDebug() > 1 )
-    {
-      printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
-      printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d \n",
-             iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent);
-    }
+    AliDebug(1,"Cluster most contributing mother:");
+    AliDebug(1,Form("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d",
+                    iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent));
     
     //Get final particle, no conversion products
     if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion) )
     {
-      if( GetDebug() > 1 )
-        printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
+      AliDebug(2,"Converted cluster!. Find before conversion:");
       //Get the parent
       aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles())->At(iParent);
       pdg = TMath::Abs(aodprimary->GetPdgCode());
@@ -1296,24 +1265,21 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
           break;
         }
         
-        if( GetDebug() > 1 )
-          printf("\t pdg %d, index %d, Primary? %d, Physical Primary? %d \n",
-                 pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());      
+        AliDebug(2,Form("\t pdg %d, index %d, Primary? %d, Physical Primary? %d",
+                        pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()));
       }        
       
-      if( GetDebug() > 1 )
-      {
-        printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
-        printf("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d \n",
-               iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());
-      }
+      AliDebug(1,"Converted Cluster mother before conversion:");
+      AliDebug(1,Form("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d",
+                      iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()));
+    
     }
     
     //Overlapped pi0 (or eta, there will be very few), get the meson
     if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || 
        GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta))
     {
-      if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: PDG %d, mom %d \n",pdg, iMother);
+      AliDebug(2,Form("Overlapped Meson decay!, Find it: PDG %d, mom %d",pdg, iMother));
   
       while(pdg != 111 && pdg != 221)
       {
@@ -1325,17 +1291,16 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
 
         if( iParent < 0 ) break;
         
-        if( GetDebug() > 1 ) printf("\t pdg %d, index %d\n",pdg, iMother);
+        AliDebug(2,Form("\t pdg %d, index %d",pdg, iMother));
         
         if(iMother==-1) 
         {
-          printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
+          AliWarning("Tagged as Overlapped photon but meson not found, why?");
           //break;
         }
       }        
       
-      if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
-                                 aodprimary->GetName(),iMother);
+      AliDebug(2,Form("Overlapped %s decay, label %d",aodprimary->GetName(),iMother));
     }  
     
     status = aodprimary->IsPrimary();
@@ -1414,16 +1379,15 @@ Bool_t AliAnaCalorimeterQA::ClusterMCHistograms(TLorentzVector mom, Bool_t match
   
 }
 
-//________________________________________________________________________________________________
-void AliAnaCalorimeterQA::ClusterMatchedWithTrackHistograms(AliVCluster *clus, TLorentzVector mom, 
-                                                            Bool_t okPrimary, Int_t pdg)
+//_________________________________________________________________________________________________________
+void AliAnaCalorimeterQA::ClusterMatchedWithTrackHistograms(AliVCluster *clus, Bool_t okPrimary, Int_t pdg)
 {
   //Histograms for clusters matched with tracks
   
-  Float_t e   = mom.E();
-  Float_t pt  = mom.Pt();
-  Float_t eta = mom.Eta();
-  Float_t phi = mom.Phi();
+  Float_t e   = fClusterMomentum.E();
+  Float_t pt  = fClusterMomentum.Pt();
+  Float_t eta = fClusterMomentum.Eta();
+  Float_t phi = fClusterMomentum.Phi();
   if(phi < 0) phi +=TMath::TwoPi();
 
   fhECharged   ->Fill(e);
@@ -1533,8 +1497,7 @@ void AliAnaCalorimeterQA::Correlate()
   
   if(!caloClustersEMCAL || !caloClustersPHOS)
   {
-    if( GetDebug() > 0 ) printf("AliAnaCalorimeterQA::Correlate() - PHOS (%p) or EMCAL (%p) clusters array not available, do not correlate\n",
-                                caloClustersPHOS,caloClustersEMCAL);
+    AliDebug(1,Form("PHOS (%p) or EMCAL (%p) clusters array not available, do not correlate",caloClustersPHOS,caloClustersEMCAL));
     return ;
   }
   
@@ -1544,8 +1507,7 @@ void AliAnaCalorimeterQA::Correlate()
   
   if(!cellsEMCAL || !cellsPHOS)
   {
-    if( GetDebug() > 0 ) printf("AliAnaCalorimeterQA::Correlate() - PHOS (%p) or EMCAL (%p) cells array ot available, do not correlate\n",
-                                cellsPHOS,cellsEMCAL);
+    AliDebug(1,Form("PHOS (%p) or EMCAL (%p) cells array ot available, do not correlate",cellsPHOS,cellsEMCAL));
     return ;
   }
 
@@ -1586,7 +1548,7 @@ void AliAnaCalorimeterQA::Correlate()
   Int_t v0S = GetV0Signal(0)+GetV0Signal(1);
   Int_t v0M = GetV0Multiplicity(0)+GetV0Multiplicity(1);
   Int_t trM = GetTrackMultiplicity();
-  if(GetCalorimeter()=="PHOS")
+  if(GetCalorimeter()==kPHOS)
   {
     fhCaloV0MCorrNClusters   ->Fill(v0M,nclPHOS);
     fhCaloV0MCorrEClusters   ->Fill(v0M,sumClusterEnergyPHOS);
@@ -1641,17 +1603,14 @@ void AliAnaCalorimeterQA::Correlate()
     fhCaloEvPECells          ->Fill(ep ,sumCellEnergyEMCAL);
   }
   
-  if(GetDebug() > 0 )
-  {
-    printf("AliAnaCalorimeterQA::Correlate(): \n");
-    printf("\t EMCAL: N cells %d, N clusters  %d, summed E cells %f, summed E clusters %f \n",
-           ncellsEMCAL,nclEMCAL, sumCellEnergyEMCAL,sumClusterEnergyEMCAL);
-    printf("\t PHOS : N cells %d, N clusters  %d, summed E cells %f, summed E clusters %f \n",
-           ncellsPHOS,nclPHOS,sumCellEnergyPHOS,sumClusterEnergyPHOS);
-    printf("\t V0 : Signal %d, Multiplicity  %d, Track Multiplicity %d \n", v0S,v0M,trM);
-    printf("\t centrality : %f, Event plane angle %f \n", cen,ep);
-  }
-  
+  AliDebug(1,"Correlate():");
+  AliDebug(1,Form("\t EMCAL: N cells %d, N clusters  %d, summed E cells %f, summed E clusters %f",
+                  ncellsEMCAL,nclEMCAL, sumCellEnergyEMCAL,sumClusterEnergyEMCAL));
+  AliDebug(1,Form("\t PHOS : N cells %d, N clusters  %d, summed E cells %f, summed E clusters %f",
+                  ncellsPHOS,nclPHOS,sumCellEnergyPHOS,sumClusterEnergyPHOS));
+  AliDebug(1,Form("\t V0 : Signal %d, Multiplicity  %d, Track Multiplicity %d", v0S,v0M,trM));
+  AliDebug(1,Form("\t centrality : %f, Event plane angle %f", cen,ep));
+
 }
 
 //__________________________________________________
@@ -1662,15 +1621,15 @@ TObjString * AliAnaCalorimeterQA::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaCalorimeterQA ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaCalorimeterQA ---:") ;
   parList+=onePar ;    
-  snprintf(onePar,buffersize,"Calorimeter: %s\n",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Time Cut : %2.2f < T < %2.2f ns  \n",fTimeCutMin, fTimeCutMax) ;
+  snprintf(onePar,buffersize,"Time Cut : %2.2f < T < %2.2f ns;",fTimeCutMin, fTimeCutMax) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"PHOS Cell Amplitude > %2.2f GeV, EMCAL Cell Amplitude > %2.2f GeV  \n",fPHOSCellAmpMin, fEMCALCellAmpMin) ;
+  snprintf(onePar,buffersize,"PHOS Cell Amplitude > %2.2f GeV, EMCAL Cell Amplitude > %2.2f GeV;",fPHOSCellAmpMin, fEMCALCellAmpMin) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Inv. Mass E1, E2 > %2.2f GeV \n",fMinInvMassECut) ;
+  snprintf(onePar,buffersize,"Inv. Mass E1, E2 > %2.2f GeV;",fMinInvMassECut) ;
   parList+=onePar ;
 
   //Get parameters set in base class.
@@ -1690,7 +1649,7 @@ void AliAnaCalorimeterQA::ExoticHistograms(Int_t absIdMax, Float_t ampMax,
   
   if(ampMax < 0.01) 
   {
-    printf("AliAnaCalorimeterQA::ExoticHistograms()- Low amplitude energy %f\n",ampMax);
+    AliDebug(1,Form("Low amplitude energy %f",ampMax));
     return;
   }
     
@@ -1761,7 +1720,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects()
   
   // Init the number of modules, set in the class AliCalorimeterUtils
   fNModules = GetCaloUtils()->GetNumberOfSuperModulesUsed();
-  if(GetCalorimeter()=="PHOS" && fNModules > 4) fNModules = 4;
+  if(GetCalorimeter()==kPHOS && fNModules > 4) fNModules = 4;
   
   //Histograms
   Int_t nptbins     = GetHistogramRanges()->GetHistoPtBins();          Float_t ptmax     = GetHistogramRanges()->GetHistoPtMax();           Float_t ptmin     = GetHistogramRanges()->GetHistoPtMin();
@@ -1794,7 +1753,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects()
   fNMaxRows = 24;
   fNRCU     = 2 ;
   //PHOS
-  if(GetCalorimeter()=="PHOS")
+  if(GetCalorimeter()==kPHOS)
   {
     fNMaxCols = 56;
     fNMaxRows = 64;
@@ -2629,66 +2588,66 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects()
     outputContainer->Add(fhCaloCorrECells);
     
     //Calorimeter VS V0 signal
-    fhCaloV0SCorrNClusters  = new TH2F ("hCaloV0SNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeter().Data()), nv0sbins,nv0smin,nv0smax,nclbins,nclmin,nclmax); 
+    fhCaloV0SCorrNClusters  = new TH2F ("hCaloV0SNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nclbins,nclmin,nclmax); 
     fhCaloV0SCorrNClusters->SetXTitle("V0 signal");
-    fhCaloV0SCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeter().Data()));
+    fhCaloV0SCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0SCorrNClusters);
     
-    fhCaloV0SCorrEClusters  = new TH2F ("hCaloV0SEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeter().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
+    fhCaloV0SCorrEClusters  = new TH2F ("hCaloV0SEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
     fhCaloV0SCorrEClusters->SetXTitle("V0 signal");
-    fhCaloV0SCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloV0SCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0SCorrEClusters);
     
-    fhCaloV0SCorrNCells  = new TH2F ("hCaloV0SNCells",Form("# Cells in %s vs V0 signal",GetCalorimeter().Data()), nv0sbins,nv0smin,nv0smax, ncebins,ncemin,ncemax); 
+    fhCaloV0SCorrNCells  = new TH2F ("hCaloV0SNCells",Form("# Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax, ncebins,ncemin,ncemax); 
     fhCaloV0SCorrNCells->SetXTitle("V0 signal");
-    fhCaloV0SCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeter().Data()));
+    fhCaloV0SCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0SCorrNCells);
     
-    fhCaloV0SCorrECells  = new TH2F ("hCaloV0SECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeter().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
+    fhCaloV0SCorrECells  = new TH2F ("hCaloV0SECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
     fhCaloV0SCorrECells->SetXTitle("V0 signal");
-    fhCaloV0SCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloV0SCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0SCorrECells);    
     
     //Calorimeter VS V0 multiplicity
-    fhCaloV0MCorrNClusters  = new TH2F ("hCaloV0MNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeter().Data()), nv0mbins,nv0mmin,nv0mmax,nclbins,nclmin,nclmax); 
+    fhCaloV0MCorrNClusters  = new TH2F ("hCaloV0MNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nclbins,nclmin,nclmax); 
     fhCaloV0MCorrNClusters->SetXTitle("V0 signal");
-    fhCaloV0MCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeter().Data()));
+    fhCaloV0MCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0MCorrNClusters);
     
-    fhCaloV0MCorrEClusters  = new TH2F ("hCaloV0MEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeter().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
+    fhCaloV0MCorrEClusters  = new TH2F ("hCaloV0MEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
     fhCaloV0MCorrEClusters->SetXTitle("V0 signal");
-    fhCaloV0MCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloV0MCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0MCorrEClusters);
     
-    fhCaloV0MCorrNCells  = new TH2F ("hCaloV0MNCells",Form("# Cells in %s vs V0 signal",GetCalorimeter().Data()), nv0mbins,nv0mmin,nv0mmax, ncebins,ncemin,ncemax); 
+    fhCaloV0MCorrNCells  = new TH2F ("hCaloV0MNCells",Form("# Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax, ncebins,ncemin,ncemax); 
     fhCaloV0MCorrNCells->SetXTitle("V0 signal");
-    fhCaloV0MCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeter().Data()));
+    fhCaloV0MCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0MCorrNCells);
     
-    fhCaloV0MCorrECells  = new TH2F ("hCaloV0MECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeter().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
+    fhCaloV0MCorrECells  = new TH2F ("hCaloV0MECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
     fhCaloV0MCorrECells->SetXTitle("V0 signal");
-    fhCaloV0MCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloV0MCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloV0MCorrECells);    
     
     //Calorimeter VS Track multiplicity
-    fhCaloTrackMCorrNClusters  = new TH2F ("hCaloTrackMNClusters",Form("# clusters in %s vs # tracks",GetCalorimeter().Data()), ntrmbins,ntrmmin,ntrmmax,nclbins,nclmin,nclmax); 
+    fhCaloTrackMCorrNClusters  = new TH2F ("hCaloTrackMNClusters",Form("# clusters in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nclbins,nclmin,nclmax); 
     fhCaloTrackMCorrNClusters->SetXTitle("# tracks");
-    fhCaloTrackMCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeter().Data()));
+    fhCaloTrackMCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloTrackMCorrNClusters);
     
-    fhCaloTrackMCorrEClusters  = new TH2F ("hCaloTrackMEClusters",Form("summed energy of clusters in %s vs # tracks",GetCalorimeter().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
+    fhCaloTrackMCorrEClusters  = new TH2F ("hCaloTrackMEClusters",Form("summed energy of clusters in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
     fhCaloTrackMCorrEClusters->SetXTitle("# tracks");
-    fhCaloTrackMCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloTrackMCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloTrackMCorrEClusters);
     
-    fhCaloTrackMCorrNCells  = new TH2F ("hCaloTrackMNCells",Form("# Cells in %s vs # tracks",GetCalorimeter().Data()), ntrmbins,ntrmmin,ntrmmax, ncebins,ncemin,ncemax); 
+    fhCaloTrackMCorrNCells  = new TH2F ("hCaloTrackMNCells",Form("# Cells in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax, ncebins,ncemin,ncemax); 
     fhCaloTrackMCorrNCells->SetXTitle("# tracks");
-    fhCaloTrackMCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeter().Data()));
+    fhCaloTrackMCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloTrackMCorrNCells);
     
-    fhCaloTrackMCorrECells  = new TH2F ("hCaloTrackMECells",Form("summed energy of Cells in %s vs # tracks",GetCalorimeter().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
+    fhCaloTrackMCorrECells  = new TH2F ("hCaloTrackMECells",Form("summed energy of Cells in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
     fhCaloTrackMCorrECells->SetXTitle("# tracks");
-    fhCaloTrackMCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeter().Data()));
+    fhCaloTrackMCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
     outputContainer->Add(fhCaloTrackMCorrECells);    
     
     fhCaloCenNClusters  = new TH2F ("hCaloCenNClusters","# clusters in calorimeter vs centrality",100,0,100,nclbins,nclmin,nclmax);
@@ -2766,7 +2725,7 @@ TList * AliAnaCalorimeterQA::GetCreateOutputObjects()
   
   Int_t colmaxs = fNMaxCols;
   Int_t rowmaxs = fNMaxRows;
-  if(GetCalorimeter()=="EMCAL")
+  if(GetCalorimeter()==kEMCAL)
   {
     colmaxs=2*fNMaxCols;
     rowmaxs=Int_t(fNModules/2)*fNMaxRows;
@@ -3086,7 +3045,7 @@ Float_t AliAnaCalorimeterQA::GetECross(Int_t absID, AliVCaloCells* cells, Float_
   Int_t icol =-1, irow=-1,iRCU = -1;   
   Int_t imod = GetModuleNumberCellIndexes(absID, GetCalorimeter(), icol, irow, iRCU);
     
-  if(GetCalorimeter()=="EMCAL")
+  if(GetCalorimeter()==kEMCAL)
   {
     //Get close cells index, energy and time, not in corners
     
@@ -3191,21 +3150,19 @@ Float_t AliAnaCalorimeterQA::GetECross(Int_t absID, AliVCaloCells* cells, Float_
   
 }
 
-//__________________________________________________________________________________________________
-void AliAnaCalorimeterQA::InvariantMassHistograms(Int_t iclus,   TLorentzVector mom,
-                                                  Int_t nModule, const TObjArray* caloClusters,
+//___________________________________________________________________________________________________________
+void AliAnaCalorimeterQA::InvariantMassHistograms(Int_t iclus,  Int_t nModule, const TObjArray* caloClusters,
                                                   AliVCaloCells * cells) 
 {
   // Fill Invariant mass histograms
   
-  if(GetDebug()>1) printf("AliAnaCalorimeterQA::InvariantMassHistograms() - Start \n");
+  AliDebug(1,"Start");
   
   //Get vertex for photon momentum calculation and event selection
   Double_t v[3] = {0,0,0}; //vertex ;
   //GetReader()->GetVertex(v);
   
   Int_t nModule2      = -1;
-  TLorentzVector mom2 ;
   Int_t nCaloClusters = caloClusters->GetEntriesFast();
   
   for(Int_t jclus = iclus + 1 ; jclus < nCaloClusters ; jclus++) 
@@ -3222,11 +3179,11 @@ void AliAnaCalorimeterQA::InvariantMassHistograms(Int_t iclus,   TLorentzVector
        clus2->GetM02() > 0.5 || clus2->E() < fMinInvMassECut ) continue;
     
     //Get cluster kinematics
-    clus2->GetMomentum(mom2,v);
+    clus2->GetMomentum(fClusterMomentum2,v);
     
     //Check only certain regions
     Bool_t in2 = kTRUE;
-    if(IsFiducialCutOn()) in2 =  GetFiducialCut()->IsInFiducialCut(mom2,GetCalorimeter()) ;
+    if(IsFiducialCutOn()) in2 =  GetFiducialCut()->IsInFiducialCut(fClusterMomentum2.Eta(),fClusterMomentum2.Phi(),GetCalorimeter()) ;
     if(!in2) continue; 
     
     //Get module of cluster
@@ -3235,15 +3192,16 @@ void AliAnaCalorimeterQA::InvariantMassHistograms(Int_t iclus,   TLorentzVector
     //Fill histograms
     
     //All modules
-    fhIM  ->Fill((mom+mom2).Pt(),(mom+mom2).M());
+    fhIM  ->Fill((fClusterMomentum+fClusterMomentum2).Pt(),(fClusterMomentum+fClusterMomentum2).M());
 
     //Single module
     if(nModule == nModule2 && nModule >= 0 && nModule < fNModules)
-      fhIMMod[nModule]->Fill((mom+mom2).Pt(),(mom+mom2).M());
+      fhIMMod[nModule]->Fill((fClusterMomentum+fClusterMomentum2).Pt(),(fClusterMomentum+fClusterMomentum2).M());
     
     
     //Asymetry histograms
-    fhAsym->Fill((mom+mom2).Pt(),TMath::Abs((mom.E()-mom2.E())/(mom.E()+mom2.E())));
+    fhAsym->Fill((fClusterMomentum+fClusterMomentum2).Pt(),
+                 TMath::Abs((fClusterMomentum.E()-fClusterMomentum2.E())/(fClusterMomentum.E()+fClusterMomentum2.E())));
     
   }// 2nd cluster loop
   
@@ -3254,8 +3212,8 @@ void AliAnaCalorimeterQA::Init()
 { 
   //Check if the data or settings are ok
   
-  if(GetCalorimeter() != "PHOS" && GetCalorimeter() !="EMCAL")
-    AliFatal(Form("Wrong calorimeter name <%s>", GetCalorimeter().Data()));
+  if(GetCalorimeter() != kPHOS && GetCalorimeter() !=kEMCAL)
+    AliFatal(Form("Wrong calorimeter name <%s>", GetCalorimeterString().Data()));
   
   //if(GetReader()->GetDataType()== AliCaloTrackReader::kMC)
   //  AliFatal("Analysis of reconstructed data, MC reader not aplicable");
@@ -3296,7 +3254,7 @@ Bool_t AliAnaCalorimeterQA::IsGoodCluster(Int_t absIdMax, AliVCaloCells* cells)
   
   if(!fStudyBadClusters) return kTRUE;
     
-  if(GetCalorimeter()=="EMCAL"
+  if(GetCalorimeter()==kEMCAL
   {
     if(!GetCaloUtils()->GetEMCALRecoUtils()->IsRejectExoticCluster())
     {
@@ -3330,7 +3288,7 @@ void AliAnaCalorimeterQA::Print(const Option_t * opt) const
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print(" ");
   
-  printf("Select Calorimeter %s \n",GetCalorimeter().Data());
+  printf("Select Calorimeter %s \n",GetCalorimeterString().Data());
   printf("Time Cut: %3.1f < TOF  < %3.1f\n", fTimeCutMin, fTimeCutMax);
   printf("EMCAL Min Amplitude   : %2.1f GeV/c\n", fEMCALCellAmpMin) ;
   printf("PHOS Min Amplitude    : %2.1f GeV/c\n", fPHOSCellAmpMin) ;
@@ -3352,24 +3310,24 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
   //Get List with CaloClusters , calo Cells, init min amplitude
   TObjArray     * caloClusters = NULL;
   AliVCaloCells * cells        = 0x0;
-  if      (GetCalorimeter() == "PHOS")
+  if      (GetCalorimeter() == kPHOS)
   {
     fCellAmpMin  = fPHOSCellAmpMin;
     caloClusters = GetPHOSClusters();
     cells        = GetPHOSCells();
   }
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
   {
     fCellAmpMin  = fEMCALCellAmpMin;
     caloClusters = GetEMCALClusters();
     cells        = GetEMCALCells();
   }
   else
-    AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", GetCalorimeter().Data()));
+    AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END", GetCalorimeterString().Data()));
   
   if( !caloClusters || !cells )
   {
-    AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters or CaloCells available\n"));
+    AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters or CaloCells available"));
     return; // trick coverity
   }
   
@@ -3383,8 +3341,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
   // Cells  
   CellHistograms(cells);
   
-  if(GetDebug() > 0)
-    printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - End \n");
+  AliDebug(1,"End");
   
 }
 
@@ -3399,7 +3356,6 @@ void AliAnaCalorimeterQA::MCHistograms()
   
   TParticle        * primStack = 0;
   AliAODMCParticle * primAOD   = 0;
-  TLorentzVector mom  ;
   
   // Get the ESD MC particles container
   AliStack * stack = 0;
@@ -3431,7 +3387,7 @@ void AliAnaCalorimeterQA::MCHistograms()
       primStack = stack->Particle(i) ;
       if(!primStack)
       {
-        printf("AliAnaCalorimeterQA::MCHistograms() - ESD primaries pointer not available!!\n");
+        AliWarning("ESD primaries pointer not available!!");
         continue;
       }
       
@@ -3447,14 +3403,14 @@ void AliAnaCalorimeterQA::MCHistograms()
       //printf("Take : i %d, %s, pdg %d, status %d \n",i, primStack->GetName(), pdg, status);
       
       //Photon kinematics
-      primStack->Momentum(mom);
+      primStack->Momentum(fPrimaryMomentum);
     }
     else
     {
       primAOD = (AliAODMCParticle *) mcparticles->At(i);
       if(!primAOD)
       {
-        printf("AliAnaCalorimeterQA::MCHistograms() - AOD primaries pointer not available!!\n");
+        AliWarning("AOD primaries pointer not available!!");
         continue;
       }
       
@@ -3472,18 +3428,18 @@ void AliAnaCalorimeterQA::MCHistograms()
       //printf("Take : i %d, %s, pdg %d, status %d \n",i, primAOD->GetName(), pdg, status);
       
       //kinematics
-      mom.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
+      fPrimaryMomentum.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
     }
 
-    Float_t eMC    = mom.E();
+    Float_t eMC    = fPrimaryMomentum.E();
     if(eMC < 0.2) continue;
-    Float_t ptMC   = mom.E();
+    Float_t ptMC   = fPrimaryMomentum.E();
     
-    Float_t etaMC  = mom.Eta();
+    Float_t etaMC  = fPrimaryMomentum.Eta();
     // Only particles in |eta| < 1
     if (TMath::Abs(etaMC) > 1) continue;
     
-    Float_t phiMC  = mom.Phi();
+    Float_t phiMC  = fPrimaryMomentum.Phi();
     if(phiMC < 0)
       phiMC  += TMath::TwoPi();
     
@@ -3501,7 +3457,8 @@ void AliAnaCalorimeterQA::MCHistograms()
       
       Bool_t inacceptance = kTRUE;
       // Check same fidutial borders as in data analysis on top of real acceptance if real was requested.
-      if( IsFiducialCutOn() && !GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ) inacceptance = kFALSE ;
+      if( IsFiducialCutOn() && !GetFiducialCut()->IsInFiducialCut(fPrimaryMomentum.Eta(),fPrimaryMomentum.Phi(),GetCalorimeter()) )
+        inacceptance = kFALSE ;
       
       if(IsRealCaloAcceptanceOn()) // defined on base class
       {
@@ -3545,14 +3502,14 @@ void AliAnaCalorimeterQA::WeightHistograms(AliVCluster *clus, AliVCaloCells* cel
     
     energy    += amp;
     
-    if(amp> ampMax) 
+    if ( amp > ampMax )
       ampMax = amp;
     
   } // energy loop       
   
-  if(energy <=0 ) 
+  if ( energy <=0 )
   {
-    printf("AliAnaCalorimeterQA::WeightHistograms()- Wrong calculated energy %f\n",energy);
+    AliWarning(Form("Wrong calculated energy %f",energy));
     return;
   }
   
@@ -3576,7 +3533,7 @@ void AliAnaCalorimeterQA::WeightHistograms(AliVCluster *clus, AliVCaloCells* cel
   }        
   
   //Recalculate shower shape for different W0
-  if(GetCalorimeter()=="EMCAL")
+  if(GetCalorimeter()==kEMCAL)
   {
     Float_t l0org = clus->GetM02();
     Float_t l1org = clus->GetM20();
index 7559b632e591056750f5a58915b01098c73611c3..92874997ddac774886952150d4e1ad681d29242d 100755 (executable)
@@ -61,11 +61,9 @@ public:
   
   void         ClusterLoopHistograms(const TObjArray * clusters, AliVCaloCells * cells);
   
-  Bool_t       ClusterMCHistograms(TLorentzVector mom, Bool_t matched,
-                                   const Int_t * labels, Int_t nLabels, Int_t & pdg );
+  Bool_t       ClusterMCHistograms(Bool_t matched, const Int_t * labels, Int_t nLabels, Int_t & pdg );
 
-  void         ClusterMatchedWithTrackHistograms(AliVCluster* clus, TLorentzVector mom, 
-                                                 Bool_t mcOK, Int_t pdg);
+  void         ClusterMatchedWithTrackHistograms(AliVCluster* clus, Bool_t mcOK, Int_t pdg);
 
   void         Correlate();
   
@@ -74,8 +72,7 @@ public:
   
   Float_t      GetECross(Int_t absId, AliVCaloCells* cells,Float_t dtcut = 10000);
   
-  void         InvariantMassHistograms(Int_t iclus, TLorentzVector mom, Int_t nModule,
-                                       const TObjArray* caloClusters, AliVCaloCells * cells);
+  void         InvariantMassHistograms(Int_t iclus, Int_t nModule, const TObjArray* caloClusters, AliVCaloCells * cells);
 
   Bool_t       IsGoodCluster(Int_t absIdMax, AliVCaloCells *cells);
   
@@ -177,6 +174,10 @@ public:
   Float_t  fExoNDTimeCuts    ;                // Number of time cuts
   Float_t  fExoDTimeCuts[5]  ;                // List of time cuts
   
+  TLorentzVector fClusterMomentum;            //! Cluster momentum
+  TLorentzVector fClusterMomentum2;           //! Cluster momentum
+  TLorentzVector fPrimaryMomentum;            //! Primary MC momentum
+  
   //CaloClusters 
   TH1F *   fhE  ;                             //! E distribution, Reco
   TH1F *   fhPt ;                             //! pT distribution, Reco
index 83d01e85c55a68f21c022fe07b1126933b1fe8c7..4e6e6f56de6572cd08d9acfc5a23afe5846fcc3d 100755 (executable)
@@ -46,6 +46,7 @@ ClassImp(AliAnaChargedParticles)
   AliAnaChargedParticles::AliAnaChargedParticles() :
     AliAnaCaloTrackCorrBaseClass(),
     fFillTrackBCHistograms(0), fFillVertexBC0Histograms(0),
+    fMomentum(),
     //Histograms
     fhNtracks(0),      fhPt(0),            fhPtNoCut(0),
     fhPtCutDCA(0),     fhPtCutDCABCOK(0),
@@ -134,7 +135,6 @@ void AliAnaChargedParticles::FillPrimaryHistograms()
   
   TParticle        * primStack = 0;
   AliAODMCParticle * primAOD   = 0;
-  TLorentzVector lv;
   
   // Get the ESD MC particles container
   AliStack * stack = 0;
@@ -163,7 +163,7 @@ void AliAnaChargedParticles::FillPrimaryHistograms()
       primStack = stack->Particle(i) ;
       if(!primStack)
       {
-        printf("AliAnaChargedParticles::FillPrimaryMCHistograms() - ESD primaries pointer not available!!\n");
+        AliWarning("ESD primaries pointer not available!!");
         continue;
       }
       
@@ -180,14 +180,14 @@ void AliAnaChargedParticles::FillPrimaryHistograms()
       //       prim->GetName(), prim->GetPdgCode());
       
       //Charged kinematics
-      primStack->Momentum(lv);
+      primStack->Momentum(fMomentum);
     }
     else
     {
       primAOD = (AliAODMCParticle *) mcparticles->At(i);
       if(!primAOD)
       {
-        printf("AliAnaChargedParticles::FillPrimaryHistograms() - AOD primaries pointer not available!!\n");
+        AliWarning("AOD primaries pointer not available!!");
         continue;
       }
 
@@ -200,7 +200,7 @@ void AliAnaChargedParticles::FillPrimaryHistograms()
       if(primAOD->E() == TMath::Abs(primAOD->Pz()))  continue ; //Protection against floating point exception
       
       //Charged kinematics
-      lv.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
+      fMomentum.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
     }
     
     Int_t mcType = kmcUnknown;
@@ -212,13 +212,13 @@ void AliAnaChargedParticles::FillPrimaryHistograms()
     
     //printf("pdg %d, charge %f, mctype %d\n",pdg, charge, mcType);
     
-    Bool_t in = GetFiducialCut()->IsInFiducialCut(lv,"CTS") ;
-    
-    Float_t  ptPrim = lv.Pt();
-    Float_t etaPrim = lv.Eta();
-    Float_t phiPrim = lv.Phi();
+    Float_t  ptPrim = fMomentum.Pt();
+    Float_t etaPrim = fMomentum.Eta();
+    Float_t phiPrim = fMomentum.Phi();
     if(phiPrim < 0) phiPrim+=TMath::TwoPi();
     
+    Bool_t in = GetFiducialCut()->IsInFiducialCut(etaPrim,phiPrim,kCTS) ;
+    
     if(in)
       fhPtMCPrimPart[mcType]->Fill(ptPrim);
     fhEtaMCPrimPart[mcType]->Fill(ptPrim,etaPrim);
@@ -790,8 +790,7 @@ void AliAnaChargedParticles::Init()
   //Do some checks
   
   if(!GetReader()->IsCTSSwitchedOn())
-    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
-  
+    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!");
   
 }
 
@@ -805,8 +804,7 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
   Double_t vert[3] = {0,0,0}; //vertex ;
   
   //Some prints
-  if(GetDebug() > 0)
-    printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - In CTS aod entries %d\n", ntracks);
+  AliDebug(1,Form("In CTS aod entries %d", ntracks));
   
   AliVEvent  * event = GetReader()->GetInputEvent();
   AliESDEvent* esdEv = dynamic_cast<AliESDEvent*> (event);
@@ -1153,12 +1151,10 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
     }
     
     //Fill AODParticle after some selection
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
+    fMomentum.SetPxPyPzE(track->Px(),track->Py(),track->Pz(),0);
+    Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS) ;
     
-    Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ;
-    
-    if(GetDebug() > 1) 
-      printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Track pt %2.2f, eta %2.2f, phi %2.2f in fiducial cut %d\n",pt,eta,phi,in);
+    AliDebug(1,Form("Track pt %2.2f, eta %2.2f, phi %2.2f in fiducial cut %d",pt,eta,phi,in));
     
     //Acceptance selection
     if(IsFiducialCutOn() && ! in ) continue ;
@@ -1235,8 +1231,8 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
     GetVertex(vert,evtIndex); 
     if(TMath::Abs(vert[2])> GetZvertexCut()) return; 
         
-    AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
-    tr.SetDetector("CTS");
+    AliAODPWG4Particle tr = AliAODPWG4Particle(track->Px(),track->Py(),track->Pz(),0);
+    tr.SetDetectorTag(kCTS);
     tr.SetLabel(track->GetLabel());
     tr.SetTrackLabel(track->GetID(),-1);
     tr.SetChargedBit(track->Charge()>0);
@@ -1245,8 +1241,8 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
     
   }//loop
   
-  if(GetDebug() > 0)   
-    printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast());   
+  AliDebug(1,Form("Final aod branch entries %d", GetOutputAODBranch()->GetEntriesFast()));
+  
 } 
 
 //__________________________________________________________________
@@ -1261,8 +1257,7 @@ void  AliAnaChargedParticles::MakeAnalysisFillHistograms()
   
   fhNtracks->Fill(GetReader()->GetTrackMultiplicity()) ;
   
-  if(GetDebug() > 0)
-    printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
   Float_t pt  = 0;
   Float_t phi = 0;
index ccbd62c7a14a4633ac3a921e69f4fe5d5beeb291..d4cd6d64346119b26c82d09d0d42fe82f61967dc 100755 (executable)
@@ -47,6 +47,7 @@ class AliAnaChargedParticles : public AliAnaCaloTrackCorrBaseClass {
   
   Bool_t  fFillTrackBCHistograms;           // Fill histograms for tracks with TOF BC=0 or not related histograms
   Bool_t  fFillVertexBC0Histograms;         // Fill histograms for tracks with vertex BC=0 or not related histograms
+  TLorentzVector fMomentum;                 //! Temporary momentum container
   
   //Histograms
   TH1F * fhNtracks;                         //! track multiplicity distribution
index f791d2e44f4b9a129e9a66e5951dfd754622909b..12aa895509e820e012e44a208e59824f3370710e 100755 (executable)
@@ -41,6 +41,7 @@ ClassImp(AliAnaClusterPileUp)
 AliAnaClusterPileUp::AliAnaClusterPileUp() :
 AliAnaCaloTrackCorrBaseClass(),
 fNCellsCut(0),
+fMomentum(),
 // Histograms
 fhTimePtNoCut(0),                     fhTimePtSPD(0),
 fhTimeNPileUpVertSPD(0),              fhTimeNPileUpVertTrack(0),
@@ -83,7 +84,7 @@ fhPtNPileUpSPDVtxTimeCut2(0),         fhPtNPileUpTrkVtxTimeCut2(0)
   
 }
 
-//___________________________________________
+//__________________________________________________
 TObjString *  AliAnaClusterPileUp::GetAnalysisCuts()
 {
   //Save parameters used for analysis
@@ -91,9 +92,9 @@ TObjString *  AliAnaClusterPileUp::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaClusterPileUp ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaClusterPileUp---:") ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Calorimeter: %s\n",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s",GetCalorimeterString().Data()) ;
   parList+=onePar ;
   
   //Get parameters set in base class.
@@ -238,7 +239,7 @@ TList *  AliAnaClusterPileUp::GetCreateOutputObjects()
   outputContainer->Add(fhPtNPileUpTrkVtxTimeCut2);
   
   
-  TString pileUpName[] = {"SPD","EMCAL","SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
+  TString pileUpName[] = {"SPD",kEMCAL,"SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
   
   for(Int_t i = 0 ; i < 7 ; i++)
   {
@@ -305,10 +306,10 @@ void AliAnaClusterPileUp::Init()
   //Init
   
   //Do some checks
-  if(GetCalorimeter() == "PHOS" && !GetReader()->IsPHOSSwitchedOn())
+  if(GetCalorimeter() == kPHOS && !GetReader()->IsPHOSSwitchedOn())
     AliFatal("You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!");
   
-  if(GetCalorimeter() == "EMCAL" && !GetReader()->IsEMCALSwitchedOn())
+  if(GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn())
     AliFatal("You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!");
   
   if(GetReader()->GetDataType() == AliCaloTrackReader::kMC)
@@ -335,12 +336,12 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
   //Select the calorimeter
   TObjArray * pl = 0x0;
   AliVCaloCells* cells    = 0;
-  if      (GetCalorimeter() == "PHOS" )
+  if      (GetCalorimeter() == kPHOS )
   {
     pl    = GetPHOSClusters();
     cells = GetPHOSCells();
   }
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
   {
     pl    = GetEMCALClusters();
     cells = GetEMCALCells();
@@ -348,7 +349,7 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
   
   if(!pl)
   {
-    Info("MakeAnalysisFillAOD","TObjArray with %s clusters is NULL!\n",GetCalorimeter().Data());
+    AliInfo(Form("TObjArray with %s clusters is NULL!",GetCalorimeterString().Data()));
     return;
   }
   
@@ -376,9 +377,9 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
   // Loop on clusters
   Int_t nCaloClusters = pl->GetEntriesFast();
 
-  if(GetDebug() > 0) printf("AliAnaClusterPileUp::MakeAnalysisFillAOD() - input %s cluster entries %d\n", GetCalorimeter().Data(), nCaloClusters);
+  AliDebug(1,Form("Input %s cluster entries %d", GetCalorimeterString().Data(), nCaloClusters));
+  
   //Init variables
-  TLorentzVector mom;
   Int_t   idMax = 0;
   Float_t ptMax = 0;
   Float_t  tMax = 0;
@@ -390,13 +391,13 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
     
     if(!calo)  continue; // it should not happen, but just in case
     
-    calo->GetMomentum(mom,GetVertex(0)) ;
+    calo->GetMomentum(fMomentum,GetVertex(0)) ;
   
-    Float_t  ecluster  = mom.E();
-    Float_t ptcluster  = mom.Pt();
+    Float_t  ecluster  = fMomentum.E();
+    Float_t ptcluster  = fMomentum.Pt();
     Float_t l0cluster  = calo->GetM02();
-    Float_t etacluster = mom.Eta();
-    Float_t phicluster = mom.Phi();
+    Float_t etacluster = fMomentum.Eta();
+    Float_t phicluster = fMomentum.Phi();
     if(phicluster < 0) phicluster+=TMath::TwoPi();
     Float_t tofcluster   = calo->GetTOF()*1.e9;
     
@@ -413,7 +414,7 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
     //Check acceptance selection
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter()) ;
       if(! in ) continue;
     }
 
@@ -664,8 +665,7 @@ void  AliAnaClusterPileUp::MakeAnalysisFillHistograms()
     fhClusterMultNoPileUp[3]->Fill(ptMax,n40);
   }
 
-  
-  if(GetDebug() > 1) printf("AliAnaClusterPileUp::MakeAnalysisFillHistograms()  End fill histograms\n");
+  AliDebug(1,"End fill histograms");
   
 }
 
@@ -682,7 +682,7 @@ void AliAnaClusterPileUp::Print(const Option_t * opt) const
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print(" ");
   
-  printf("Calorimeter            =     %s\n", GetCalorimeter().Data()) ;
+  printf("Calorimeter            =     %s\n", GetCalorimeterString().Data()) ;
   printf("    \n") ;
        
 }
index 72b01f3a3ccd8468731ffd9ef9c1515000b1e922..a6bb185d86cc997fbacf44ca00f2309be2d5d316 100755 (executable)
@@ -14,7 +14,6 @@
 // --- ROOT system ---
 class TH2F ;
 class TH1F;
-class TString ;
 class TObjString;
 class TList ;
 
@@ -52,6 +51,8 @@ private:
  
   Int_t   fNCellsCut ;                              // Accept for the analysis clusters with more than fNCellsCut cells
 
+  TLorentzVector fMomentum;                         //! Cluster momentum
+  
   //Histograms
   
   TH1F * fhPtPileUp[7];                             //! pT distribution of clusters before any selection
@@ -88,7 +89,7 @@ private:
   AliAnaClusterPileUp(              const AliAnaClusterPileUp & pu) ; // cpy ctor
   AliAnaClusterPileUp & operator = (const AliAnaClusterPileUp & pu) ; // cpy assignment
   
-  ClassDef(AliAnaClusterPileUp,1)
+  ClassDef(AliAnaClusterPileUp,2)
 
 } ;
  
index 9c25dfe6b20578d60a7e0a57501f8ce18f8def1b..60c6bac151daee5f4e2b5d2e4e4b201d1428ce72 100755 (executable)
@@ -15,7 +15,7 @@
 
 //_________________________________________________________________________
 //
-// Class for study of EMCAL trigger behaviour
+// Class for study of EMCAL trigger behavior
 //
 // -- Author: Gustavo Conesa (CNRS-LPSC-Grenoble)
 //////////////////////////////////////////////////////////////////////////////
 
 ClassImp(AliAnaEMCALTriggerClusters)
 
-//____________________________
+//______________________________________________________
 AliAnaEMCALTriggerClusters::AliAnaEMCALTriggerClusters() :
 AliAnaCaloTrackCorrBaseClass(),
 fRejectTrackMatch(0),         fNCellsCut(0),
 fMinM02(0),                   fMaxM02(0),
+fMomentum(),
 // Histograms
 fhE(0),                       fhESelected(0),
 fhEtaPhi(0),                  fhEtaPhiSelected(0),
@@ -142,16 +143,14 @@ void AliAnaEMCALTriggerClusters::FillBadTriggerEventHistogram()
   
   if(!badClusTrig)
   {
-    printf("AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms() - No cluster (bad-exotic trigger) found with requested index %d \n",idTrig);
+    AliWarning(Form("No cluster (bad-exotic trigger) found with requested index %d \n",idTrig));
     return;
   }
   
-  TLorentzVector momBadClus;
+  badClusTrig->GetMomentum(fMomentum,GetVertex(0));
   
-  badClusTrig->GetMomentum(momBadClus,GetVertex(0));
-  
-  Float_t etaclusterBad = momBadClus.Eta();
-  Float_t phiclusterBad = momBadClus.Phi();
+  Float_t etaclusterBad = fMomentum.Eta();
+  Float_t phiclusterBad = fMomentum.Phi();
   if( phiclusterBad < 0 ) phiclusterBad+=TMath::TwoPi();
   Float_t tofclusterBad = badClusTrig->GetTOF()*1.e9;
   Float_t eclusterBad   = badClusTrig->E();
@@ -349,8 +348,7 @@ void  AliAnaEMCALTriggerClusters::FillRawClusterTriggerBCHistograms(Int_t idcalo
       }
     }
   }
-  else if(TMath::Abs(bc) >= 6)
-    printf("AliAnaEMCALTriggerClusters::ClusterSelected() - Trigger BC not expected = %d\n",bc);
+  else if(TMath::Abs(bc) >= 6) AliWarning(Form("Trigger BC not expected = %d\n",bc));
   
 }
 
@@ -363,13 +361,13 @@ TObjString *  AliAnaEMCALTriggerClusters::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaEMCALTriggerClusters ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaEMCALTriggerClusters ---:") ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fRejectTrackMatch: %d\n",fRejectTrackMatch) ;
+  snprintf(onePar,buffersize,"fRejectTrackMatch: %d;",fRejectTrackMatch) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinM02: %2.2f, fMaxM02: %2.2f\n",fMinM02,fMaxM02) ;
+  snprintf(onePar,buffersize,"fMinM02: %2.2f, fMaxM02: %2.2f;",fMinM02,fMaxM02) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fNCellsCut: %d\n",fNCellsCut) ;
+  snprintf(onePar,buffersize,"fNCellsCut: %d;",fNCellsCut) ;
   parList+=onePar ;
   
   //Get parameters set in base class.
@@ -378,7 +376,7 @@ TObjString *  AliAnaEMCALTriggerClusters::GetAnalysisCuts()
   return new TObjString(parList) ;
 }
 
-//________________________________________________________________________
+//___________________________________________________________
 TList *  AliAnaEMCALTriggerClusters::GetCreateOutputObjects()
 {
   // Create histograms to be saved in output file and
@@ -957,7 +955,7 @@ TList *  AliAnaEMCALTriggerClusters::GetCreateOutputObjects()
   
 }
 
-//_______________________
+//_____________________________________
 void AliAnaEMCALTriggerClusters::Init()
 {
   
@@ -970,7 +968,7 @@ void AliAnaEMCALTriggerClusters::Init()
   
 }
 
-//____________________________________________________________________________
+//_______________________________________________
 void AliAnaEMCALTriggerClusters::InitParameters()
 {
   
@@ -984,7 +982,7 @@ void AliAnaEMCALTriggerClusters::InitParameters()
   
 }
 
-//__________________________________________________________________
+//____________________________________________________________
 void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
 {
   //Do photon analysis and fill aods
@@ -993,7 +991,7 @@ void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
   
   if(!pl)
   {
-    Info("MakeAnalysisFillHistograms","TObjArray with clusters is NULL!\n");
+    AliWarning("TObjArray with clusters is NULL!");
     return;
   }
   
@@ -1003,9 +1001,8 @@ void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
   
   Int_t nCaloClusters = pl->GetEntriesFast();
   Int_t idTrig        = GetReader()->GetTriggerClusterIndex();
-  TLorentzVector mom;
 
-  if(GetDebug() > 0) printf("AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms() - Input cluster entries %d\n", nCaloClusters);
+  AliDebug(1,Form("Input cluster entries %d", nCaloClusters));
   
   // Loop on clusters
   for(Int_t icalo = 0; icalo < nCaloClusters; icalo++)
@@ -1013,12 +1010,12 @@ void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
          AliVCluster * calo =  (AliVCluster*) (pl->At(icalo));
     //printf("calo %d, %f\n",icalo,calo->E());
     
-    calo->GetMomentum(mom,GetVertex(0)) ;
+    calo->GetMomentum(fMomentum,GetVertex(0)) ;
     
     Float_t tofcluster = calo->GetTOF()*1.e9;
-    Float_t ecluster   = mom.E();
-    Float_t etacluster = mom.Eta();
-    Float_t phicluster = mom.Phi();
+    Float_t ecluster   = fMomentum.E();
+    Float_t etacluster = fMomentum.Eta();
+    Float_t phicluster = fMomentum.Phi();
     if(phicluster < 0) phicluster+=TMath::TwoPi();
     
     FillRawClusterTriggerBCHistograms(calo->GetID(),ecluster,tofcluster,etacluster,phicluster);
@@ -1041,7 +1038,7 @@ void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
     //Check acceptance selection
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"EMCAL") ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL) ;
       if(! in ) continue ;
     }
     
@@ -1091,11 +1088,11 @@ void  AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()
       }
     }
     else if(TMath::Abs(bc) >= 6)
-      printf("AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms() - Trigger BC not expected = %d\n",bc);
+      AliWarning(Form("Trigger BC not expected = %d",bc));
     
   }// cluster loop
   
-  if(GetDebug() > 1) printf("AliAnaEMCALTriggerClusters::MakeAnalysisFillHistograms()  End fill histograms\n");
+  AliDebug(1,"End fill histograms");
   
 }
 
index a7e5e00c0c5662952a2562ca7aec344747b05f63..9eb0fc5d2e1953eec6b4933c9f1ee05c30883156 100755 (executable)
@@ -67,6 +67,8 @@ class AliAnaEMCALTriggerClusters : public AliAnaCaloTrackCorrBaseClass {
   Float_t fMinM02  ;                                  // Remove clusters with large M02
   Float_t fMaxM02  ;                                  // Remove clusters with small M02
   
+  TLorentzVector fMomentum ;                          //! Cluster momentum
+  
   // Histograms
   
   TH1F * fhE               ;                          //! Raw clusters E
@@ -161,7 +163,7 @@ class AliAnaEMCALTriggerClusters : public AliAnaCaloTrackCorrBaseClass {
   AliAnaEMCALTriggerClusters(              const AliAnaEMCALTriggerClusters & g) ; // cpy ctor
   AliAnaEMCALTriggerClusters & operator = (const AliAnaEMCALTriggerClusters & g) ; // cpy assignment
   
-  ClassDef(AliAnaEMCALTriggerClusters,1)
+  ClassDef(AliAnaEMCALTriggerClusters,2)
 
 } ;
  
index 806ba1efc4c84234ba0b8923b5becc6f27cf2d07..4bdc166575b8871a6547e2fc20985bfad53cfa58 100755 (executable)
@@ -59,6 +59,7 @@ AliAnaElectron::AliAnaElectron() :
     fdEdxMin(0.),                         fdEdxMax (200.), 
     fEOverPMin(0),                        fEOverPMax (2),
     fAODParticle(0),
+    fMomentum(),                          fMomentumMC(),                         fProdVertex(),
     // Histograms
     fhdEdxvsE(0),                         fhdEdxvsP(0),                 
     fhEOverPvsE(0),                       fhEOverPvsP(0),
@@ -158,49 +159,50 @@ AliAnaElectron::AliAnaElectron() :
 }
 
 //____________________________________________________________________________
-Bool_t  AliAnaElectron::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int_t nMaxima)
+Bool_t  AliAnaElectron::ClusterSelected(AliVCluster* calo, Int_t nMaxima)
 {
-  //Select clusters if they pass different cuts
-  if(GetDebug() > 2) 
-    printf("AliAnaElectron::ClusterSelected() Current Event %d; Before selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f\n",
-           GetReader()->GetEventNumber(),
-           mom.E(), mom.Pt(),calo->E(),mom.Phi()*TMath::RadToDeg(),mom.Eta());
+  // Select clusters if they pass different cuts
+  
+  AliDebug(1,Form("Current Event %d; Before selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f",
+           GetReader()->GetEventNumber(),fMomentum.E(),fMomentum.Pt(),calo->E(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
   
   //.......................................
   //If too small or big energy, skip it
-  if(mom.E() < GetMinEnergy() || mom.E() > GetMaxEnergy() ) return kFALSE ; 
-  if(GetDebug() > 2) printf("\t Cluster %d Pass E Cut \n",calo->GetID());
+  if(fMomentum.E() < GetMinEnergy() || fMomentum.E() > GetMaxEnergy() ) return kFALSE ; 
+  AliDebug(2,Form("\t Cluster %d Pass E Cut",calo->GetID()));
   
   //.......................................
   // TOF cut, BE CAREFUL WITH THIS CUT
   Double_t tof = calo->GetTOF()*1e9;
   if(tof < fTimeCutMin || tof > fTimeCutMax) return kFALSE;
-  if(GetDebug() > 2)  printf("\t Cluster %d Pass Time Cut \n",calo->GetID());
+  AliDebug(2,Form("\t Cluster %d Pass Time Cut",calo->GetID()));
   
   //.......................................
   if(calo->GetNCells() <= fNCellsCut && GetReader()->GetDataType() != AliCaloTrackReader::kMC) return kFALSE;
-  if(GetDebug() > 2) printf("\t Cluster %d Pass NCell Cut \n",calo->GetID());
+  AliDebug(2,Form("\t Cluster %d Pass NCell Cut",calo->GetID()));
   
   //.......................................
   //Check acceptance selection
-  if(IsFiducialCutOn()){
-    Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ;
+  if(IsFiducialCutOn())
+  {
+    Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter()) ;
     if(! in ) return kFALSE ;
   }
-  if(GetDebug() > 2) printf("Fiducial cut passed \n");
+  AliDebug(2,"\t Fiducial cut passed");
   
   //.......................................
   //Skip not matched clusters with tracks
-  if(!IsTrackMatched(calo, GetReader()->GetInputEvent())) {
-      if(GetDebug() > 2) printf("\t Reject non track-matched clusters\n");
+  if(!IsTrackMatched(calo, GetReader()->GetInputEvent()))
+  {
+      AliDebug(1,"\t Reject non track-matched clusters");
       return kFALSE ;
   }
-  else if(GetDebug() > 2)  printf(" Track-matching cut passed \n");
+  else AliDebug(2,"\t Track-matching cut passed");
   
   //...........................................
   // skip clusters with too many maxima
   if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) return kFALSE ;
-  if(GetDebug() > 2) printf(" \t Cluster %d pass NLM %d of out of range \n",calo->GetID(), nMaxima);
+  AliDebug(2,Form("\t Cluster %d pass NLM %d of out of range",calo->GetID(), nMaxima));
   
   //.......................................
   //Check Distance to Bad channel, set bit.
@@ -209,13 +211,12 @@ Bool_t  AliAnaElectron::ClusterSelected(AliVCluster* calo, TLorentzVector mom, I
   if(distBad < fMinDist) {//In bad channel (PHOS cristal size 2.2x2.2 cm), EMCAL ( cell units )
     return kFALSE ;
   }
-  else if(GetDebug() > 2) printf("\t Bad channel cut passed %4.2f > %2.2f \n",distBad, fMinDist);
+  else AliDebug(2,Form("\t Bad channel cut passed %4.2f > %2.2f",distBad, fMinDist));
   //printf("Cluster %d Pass Bad Dist Cut \n",icalo);
 
-  if(GetDebug() > 0) 
-    printf("AliAnaElectron::ClusterSelected() Current Event %d; After  selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f\n",
+ AliDebug(1,Form("Current Event %d; After  selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f",
            GetReader()->GetEventNumber(), 
-           mom.E(), mom.Pt(),calo->E(),mom.Phi()*TMath::RadToDeg(),mom.Eta());
+           fMomentum.E(), fMomentum.Pt(),calo->E(),fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
   
   //All checks passed, cluster selected
   return kTRUE;
@@ -225,8 +226,7 @@ Bool_t  AliAnaElectron::ClusterSelected(AliVCluster* calo, TLorentzVector mom, I
 //______________________________________________________________________________________________
 void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag, Int_t pidTag)
 {
-  
-  //Fill cluster Shower Shape histograms
+  // Fill cluster Shower Shape histograms
   
   if(!fFillSSHistograms || GetMixedEvent()) return;
   
@@ -243,26 +243,17 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
   
   Float_t l0   = 0., l1   = 0.;
   Float_t dispp= 0., dEta = 0., dPhi    = 0.; 
-  Float_t sEta = 0., sPhi = 0., sEtaPhi = 0.;    
+  Float_t sEta = 0., sPhi = 0., sEtaPhi = 0.;
   
-  TLorentzVector mom;
-  if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
-  {
-    cluster->GetMomentum(mom,GetVertex(0)) ;}//Assume that come from vertex in straight line
-  else{
-    Double_t vertex[]={0,0,0};
-    cluster->GetMomentum(mom,vertex) ;
-  }
-  
-  Float_t eta = mom.Eta();
-  Float_t phi = mom.Phi();
+  Float_t eta = fMomentum.Eta();
+  Float_t phi = fMomentum.Phi();
   if(phi < 0) phi+=TMath::TwoPi();
   
   fhLam0E[pidIndex] ->Fill(energy,lambda0);
   fhLam1E[pidIndex] ->Fill(energy,lambda1);
   fhDispE[pidIndex] ->Fill(energy,disp);
   
-  if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
+  if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
      GetModuleNumber(cluster) >= GetFirstSMCoveredByTRD() )
   {
     fhLam0ETRD[pidIndex]->Fill(energy,lambda0);
@@ -285,7 +276,7 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
       fhPhiLam0HighE[pidIndex]   ->Fill(phi,   lambda0);
     }
     
-    if(GetCalorimeter() == "EMCAL")
+    if(GetCalorimeter() == kEMCAL)
     {
       GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), GetReader()->GetInputEvent()->GetEMCALCells(), cluster,
                                                                                    l0, l1, dispp, dEta, dPhi, sEta, sPhi, sEtaPhi);
@@ -309,8 +300,8 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
   if(IsDataMC())
   {
     AliVCaloCells* cells = 0;
-    if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
-    else                        cells = GetPHOSCells();
+    if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
+    else                           cells = GetPHOSCells();
     
     //Fill histograms to check shape of embedded clusters
     Float_t fraction = 0;
@@ -327,7 +318,7 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
       //Fraction of total energy due to the embedded signal
       fraction/=clusterE;
       
-      if(GetDebug() > 1 ) printf("AliAnaElectron::FillShowerShapeHistogram() - Energy fraction of embedded signal %2.3f, Energy %2.3f\n",fraction, clusterE);
+      AliDebug(1,Form("Energy fraction of embedded signal %2.3f, Energy %2.3f",fraction, clusterE));
       
       fhEmbeddedSignalFractionEnergy->Fill(clusterE,fraction);
       
@@ -355,11 +346,12 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
         
         //Compare the primary depositing more energy with the rest, if no photon/electron as comon ancestor (conversions), count as other particle
         Int_t ancPDG = 0, ancStatus = -1;
-        TLorentzVector momentum; TVector3 prodVertex;
         Int_t ancLabel = 0;
         Int_t noverlaps = 1;      
-        for (UInt_t ilab = 0; ilab < cluster->GetNLabels(); ilab++ ) {
-          ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(cluster->GetLabels()[0],cluster->GetLabels()[ilab], GetReader(),ancPDG,ancStatus,momentum,prodVertex);
+        for (UInt_t ilab = 0; ilab < cluster->GetNLabels(); ilab++ )
+        {
+          ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(cluster->GetLabels()[0],cluster->GetLabels()[ilab], GetReader(),
+                                                               ancPDG,ancStatus,fMomentumMC,fProdVertex);
           if(ancPDG!=22 && TMath::Abs(ancPDG)!=11) noverlaps++;
         }
         
@@ -372,8 +364,9 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
         else if(noverlaps > 2){          
           fhMCElectronELambda0NOverlap   ->Fill(energy, lambda0);
         }
-        else {
-          printf("AliAnaElectron::FillShowerShapeHistogram() - n overlaps = %d for ancestor %d!!", noverlaps, ancLabel);
+        else
+        {
+          AliWarning(Form("N overlaps = %d for ancestor %d!!", noverlaps, ancLabel));
         }
       }//No embedding
       
@@ -418,13 +411,13 @@ void  AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTa
     
     fhMCELambda0[pidIndex][index]    ->Fill(energy, lambda0);
     
-    if(GetCalorimeter() == "EMCAL" && !fFillOnlySimpleSSHisto)
+    if(GetCalorimeter() == kEMCAL && !fFillOnlySimpleSSHisto)
     {
       fhMCEDispEta        [pidIndex][index]-> Fill(energy,dEta);
       fhMCEDispPhi        [pidIndex][index]-> Fill(energy,dPhi);
       fhMCESumEtaPhi      [pidIndex][index]-> Fill(energy,sEtaPhi);
       fhMCEDispEtaPhiDiff [pidIndex][index]-> Fill(energy,dPhi-dEta);
-      if(dEta+dPhi>0)fhMCESphericity     [pidIndex][index]-> Fill(energy,(dPhi-dEta)/(dEta+dPhi));
+      if(dEta+dPhi>0) fhMCESphericity[pidIndex][index]-> Fill(energy,(dPhi-dEta)/(dEta+dPhi));
     }
     
   }//MC data
@@ -439,19 +432,19 @@ TObjString *  AliAnaElectron::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaElectron ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaElectron ---") ;
   parList+=onePar ;    
-  snprintf(onePar,buffersize,"Calorimeter: %s\n",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize," %2.2f < dEdx < %2.2f  \n",fdEdxMin,fdEdxMax) ;
+  snprintf(onePar,buffersize," %2.2f < dEdx < %2.2f;",fdEdxMin,fdEdxMax) ;
   parList+=onePar ;  
-  snprintf(onePar,buffersize," %2.2f <  E/P < %2.2f  \n",fEOverPMin, fEOverPMax) ;
+  snprintf(onePar,buffersize," %2.2f <  E/P < %2.2f;",fEOverPMin, fEOverPMax) ;
   parList+=onePar ;  
-  snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
+  snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster);",fMinDist) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
+  snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation);",fMinDist2) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
+  snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study);",fMinDist3) ;
   parList+=onePar ;  
   
   //Get parameters set in base class.
@@ -664,7 +657,7 @@ TList *  AliAnaElectron::GetCreateOutputObjects()
       fhDispE[pidIndex]->SetXTitle("E (GeV) ");
       outputContainer->Add(fhDispE[pidIndex]);
       
-      if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD() >=0 )
+      if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD() >=0 )
       {
         fhLam0ETRD[pidIndex]  = new TH2F (Form("h%sLam0ETRD",pidParticle[pidIndex].Data()),
                                           Form("%s: #lambda_{0}^{2} vs E, EMCAL SM covered by TRD",pidParticle[pidIndex].Data()), 
@@ -734,7 +727,7 @@ TList *  AliAnaElectron::GetCreateOutputObjects()
         fhPhiLam0HighE[pidIndex]->SetXTitle("#phi");
         outputContainer->Add(fhPhiLam0HighE[pidIndex]);  
         
-        if(GetCalorimeter() == "EMCAL")
+        if(GetCalorimeter() == kEMCAL)
         {
           fhDispEtaE[pidIndex]  = new TH2F (Form("h%sDispEtaE",pidParticle[pidIndex].Data()),
                                             Form("%s: #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",pidParticle[pidIndex].Data()),  
@@ -812,7 +805,7 @@ TList *  AliAnaElectron::GetCreateOutputObjects()
           fhMCELambda0[pidIndex][i]->SetXTitle("E (GeV)");
           outputContainer->Add(fhMCELambda0[pidIndex][i]) ; 
           
-          if(GetCalorimeter()=="EMCAL" && !fFillOnlySimpleSSHisto)
+          if(GetCalorimeter()==kEMCAL && !fFillOnlySimpleSSHisto)
           {
             fhMCEDispEta[pidIndex][i]  = new TH2F (Form("h%sEDispEtaE_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
                                                    Form("cluster from %s : %s like, #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
@@ -1061,17 +1054,14 @@ TList *  AliAnaElectron::GetCreateOutputObjects()
 //_________________________
 void AliAnaElectron::Init()
 {
+  // Init
   
-  //Init
-  //Do some checks
-  if(GetCalorimeter() == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD()){
-    printf("AliAnaElectron::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
-  else  if(GetCalorimeter() == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD()){
-    printf("AliAnaElectron::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
+  // Do some checks
+  if       ( GetCalorimeter() == kPHOS  && !GetReader()->IsPHOSSwitchedOn()  && NewOutputAOD() )
+    AliFatal("STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!");
+  else  if ( GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD() )
+    AliFatal("STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!");
   
 }
 
@@ -1109,23 +1099,20 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
   
   //Select the Calorimeter of the photon
   TObjArray * pl = 0x0; 
-  if(GetCalorimeter() == "PHOS")
-    pl = GetPHOSClusters();
-  else if (GetCalorimeter() == "EMCAL")
-    pl = GetEMCALClusters();
+  if      (GetCalorimeter() == kPHOS ) pl = GetPHOSClusters ();
+  else if (GetCalorimeter() == kEMCAL) pl = GetEMCALClusters();
   
   if(!pl)
   {
-    Info("MakeAnalysisFillAOD","TObjArray with %s clusters is NULL!\n",GetCalorimeter().Data());
+    AliWarning(Form("TObjArray with %s clusters is NULL!",GetCalorimeterString().Data()));
     return;
   }
   
   //Init arrays, variables, get number of clusters
-  TLorentzVector mom, mom2 ;
   Int_t nCaloClusters = pl->GetEntriesFast();
   //List to be used in conversion analysis, to tag the cluster as candidate for conversion
   
-  if(GetDebug() > 0) printf("AliAnaElectron::MakeAnalysisFillAOD() - input %s cluster entries %d\n", GetCalorimeter().Data(), nCaloClusters);
+  AliDebug(1,Form("Input %s cluster entries %d", GetCalorimeterString().Data(), nCaloClusters));
   
   //----------------------------------------------------
   // Fill AOD with PHOS/EMCAL AliAODPWG4Particle objects
@@ -1148,21 +1135,23 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
     //Cluster selection, not charged, with photon id and in fiducial cut         
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
-      calo->GetMomentum(mom,GetVertex(evtIndex)) ;}//Assume that come from vertex in straight line
-    else{
+      calo->GetMomentum(fMomentum,GetVertex(evtIndex)) ;
+    }//Assume that come from vertex in straight line
+    else
+    {
       Double_t vertex[]={0,0,0};
-      calo->GetMomentum(mom,vertex) ;
+      calo->GetMomentum(fMomentum,vertex) ;
     }
     
     //--------------------------------------
     // Cluster selection
     //--------------------------------------
     AliVCaloCells* cells    = 0;
-    if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
-    else                        cells = GetPHOSCells();
+    if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
+    else                           cells = GetPHOSCells();
     
     Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(calo, cells); // NLM
-    if(!ClusterSelected(calo,mom,nMaxima)) continue;
+    if(!ClusterSelected(calo,nMaxima)) continue;
     
     //-------------------------------------
     // PID selection via dE/dx
@@ -1172,7 +1161,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
 
     if(!track)
     {
-      printf("AliAnaElectron::MakeAnalysisFillAOD() - Null track");
+      AliWarning("Null track");
       continue;
     }
     
@@ -1189,7 +1178,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
       fhdEdxvsPCutEOverP  ->Fill(track->P(),dEdx);
     }
     
-    //Apply a mild cut on the cluster SS and check the value of dEdX and EOverP
+    // Apply a mild cut on the cluster SS and check the value of dEdX and EOverP
     Float_t m02 = calo->GetM02();
     if(m02 > 0.1 && m02 < 0.4)
     {
@@ -1223,7 +1212,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
     if(pid == AliCaloPID::kChargedHadron) pidIndex = 1;
   
     //--------------------------------------------------------------------------------------
-    //Play with the MC stack if available
+    // Play with the MC stack if available
     //--------------------------------------------------------------------------------------
     
     //Check origin of the candidates
@@ -1232,8 +1221,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
     {
       tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader(),GetCalorimeter());
       
-      if(GetDebug() > 0)
-        printf("AliAnaElectron::MakeAnalysisFillAOD() - Origin of candidate, bit map %d\n",tag);
+      AliDebug(1,Form("Origin of candidate, bit map %d",tag));
          
       if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) && fhMCE[pidIndex][kmcPhoton])
       {
@@ -1320,7 +1308,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
       WeightHistograms(calo);
     
     //-----------------------------------------
-    //PID Shower Shape selection or bit setting
+    // PID Shower Shape selection or bit setting
     //-----------------------------------------
     
     // Data, PID check on
@@ -1337,29 +1325,28 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
         if(fAODParticle == 0 )
           pid = AliCaloPID::kChargedHadron ;
       }
-      if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillAOD() - PDG of identified particle %d\n",pid);
+      
+      AliDebug(1,Form("PDG of identified particle %d",pid));
     }
         
-    if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",
-                              mom.Pt(), pid);
+    AliDebug(1,Form("Photon selection cuts passed: pT %3.2f, pdg %d",fMomentum.Pt(),pid));
     
     Float_t maxCellFraction = 0;
     Int_t absID = GetCaloUtils()->GetMaxEnergyCell(cells, calo,maxCellFraction);
-    if ( absID >= 0 )fhMaxCellDiffClusterE[pidIndex]->Fill(mom.E(),maxCellFraction);
+    if ( absID >= 0 )fhMaxCellDiffClusterE[pidIndex]->Fill(fMomentum.E(),maxCellFraction);
     
-    fhNCellsE[pidIndex] ->Fill(mom.E(),calo->GetNCells());
-    fhNLME   [pidIndex] ->Fill(mom.E(),nMaxima);
-    fhTimeE  [pidIndex] ->Fill(mom.E(),calo->GetTOF()*1.e9);
-
+    fhNCellsE[pidIndex] ->Fill(fMomentum.E(),calo->GetNCells());
+    fhNLME   [pidIndex] ->Fill(fMomentum.E(),nMaxima);
+    fhTimeE  [pidIndex] ->Fill(fMomentum.E(),calo->GetTOF()*1.e9);
     
     //----------------------------
-    //Create AOD for analysis
+    // Create AOD for analysis
     //----------------------------
 
     //Add AOD with electron/hadron object to aod branch
     if ( pid == fAODParticle || fAODParticle == 0 ) 
     {
-      AliAODPWG4Particle aodpart = AliAODPWG4Particle(mom);
+      AliAODPWG4Particle aodpart = AliAODPWG4Particle(fMomentum);
       
       //...............................................
       //Set the indeces of the original caloclusters (MC, ID), and calorimeter
@@ -1368,9 +1355,12 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
       aodpart.SetCaloLabel (calo ->GetID(),-1);
       aodpart.SetTrackLabel(track->GetID(),-1);
 
-      aodpart.SetDetector(GetCalorimeter());
+      aodpart.SetDetectorTag(GetCalorimeter());
       //printf("Index %d, Id %d, iaod %d\n",icalo, calo->GetID(),GetOutputAODBranch()->GetEntriesFast());
       
+      aodpart.SetM02(calo->GetM02());
+      aodpart.SetNLM(nMaxima);
+      
       //...............................................
       //Set bad channel distance bit
       Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
@@ -1390,7 +1380,7 @@ void  AliAnaElectron::MakeAnalysisFillAOD()
 
   }//loop
   
-  if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillAOD()  End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());  
+  AliDebug(1,Form("End fill AODs, with %d entries",GetOutputAODBranch()->GetEntriesFast()));
   
 }
 
@@ -1411,21 +1401,13 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
     if(GetReader()->ReadStack())
     {
       stack =  GetMCStack() ;
-      if(!stack)
-      {
-        printf("AliAnaElectron::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
-        abort();
-      }
+      if ( !stack )       AliFatal("Stack not available, is the MC handler called? STOP");
     }
     else if(GetReader()->ReadAODMCParticles())
     {
       //Get the list of MC particles
       mcparticles = GetReader()->GetAODMCParticles();
-      if(!mcparticles)
-      {
-        printf("AliAnaElectron::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
-        abort();
-      }
+      if ( !mcparticles ) AliFatal("Standard MCParticles not available! STOP");
     }
   }// is data and MC
   
@@ -1439,7 +1421,7 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
   //----------------------------------
   //Loop on stored AOD photons
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaElectron::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
   for(Int_t iaod = 0; iaod < naod ; iaod++)
   {
@@ -1451,10 +1433,9 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
     else if(pdg == AliCaloPID::kChargedHadron) pidIndex = 1;
     else                                       continue    ;
           
-    if(ph->GetDetector() != GetCalorimeter()) continue;
+    if(((Int_t) ph->GetDetectorTag()) != GetCalorimeter()) continue;
     
-    if(GetDebug() > 2) 
-      printf("AliAnaElectron::MakeAnalysisFillHistograms() - ID Electron: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
+    AliDebug(1,Form("ID Electron: pt %f, phi %f, eta %f", ph->Pt(),ph->Phi(),ph->Eta())) ;
     
     //................................
     //Fill photon histograms 
@@ -1467,18 +1448,19 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
     fhPt[pidIndex]  ->Fill(ptcluster);
     fhPhi[pidIndex] ->Fill(ptcluster,phicluster);
     fhEta[pidIndex] ->Fill(ptcluster,etacluster);    
-    if     (ecluster > 0.5)   fhEtaPhi[pidIndex]  ->Fill(etacluster, phicluster);
+    if     (ecluster   > 0.5) fhEtaPhi[pidIndex]  ->Fill(etacluster, phicluster);
     else if(GetMinPt() < 0.5) fhEtaPhi05[pidIndex]->Fill(etacluster, phicluster);
   
     //.......................................
     //Play with the MC data if available
-    if(IsDataMC()){
-      
+    if(IsDataMC())
+    {
       //....................................................................
       // Access MC information in stack if requested, check that it exists.
       Int_t label =ph->GetLabel();
-      if(label < 0) {
-        if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
+      if(label < 0)
+      {
+        AliDebug(1,Form("*** bad label ***:  label %d", label));
         continue;
       }
       
@@ -1488,15 +1470,15 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
       {
         if(label >=  stack->GetNtrack())
         {
-          if(GetDebug() > 2)  printf("AliAnaElectron::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
+          AliDebug(1,Form("*** large label ***:  label %d, n tracks %d", label, stack->GetNtrack()));
           continue ;
         }
         
         primary = stack->Particle(label);
         if(!primary)
         {
-          printf("AliAnaElectron::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
-          continue;
+          AliWarning(Form("*** no primary ***:  label %d", label));
+          continue ;
         }
         
         eprim   = primary->Energy();
@@ -1512,8 +1494,7 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
           
           if(label >=  mcparticles->GetEntriesFast())
           {
-            if(GetDebug() > 2)  printf("AliAnaElectron::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", 
-                                       label, mcparticles->GetEntriesFast());
+            AliDebug(1,Form("*** large label ***:  label %d, n tracks %d",label, mcparticles->GetEntriesFast()));
             continue ;
           }
           //Get the particle
@@ -1523,7 +1504,7 @@ void  AliAnaElectron::MakeAnalysisFillHistograms()
         
         if(!aodprimary)
         {
-          printf("AliAnaElectron::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+          AliWarning(Form("*** no primary ***:  label %d", label));
           continue;
         }
         
@@ -1661,7 +1642,7 @@ void AliAnaElectron::Print(const Option_t * opt) const
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print(" ");
 
-  printf("Calorimeter            =     %s\n", GetCalorimeter().Data()) ;
+  printf("Calorimeter            =     %s\n", GetCalorimeterString().Data()) ;
   printf(" %2.2f < dEdx < %2.2f  \n",fdEdxMin,fdEdxMax) ;
   printf(" %2.2f <  E/P < %2.2f  \n",fEOverPMin,fEOverPMax) ;
   printf("Min Distance to Bad Channel   = %2.1f\n",fMinDist);
@@ -1681,8 +1662,8 @@ void AliAnaElectron::WeightHistograms(AliVCluster *clus)
   if(!fFillWeightHistograms || GetMixedEvent()) return;
   
   AliVCaloCells* cells = 0;
-  if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
-  else                        cells = GetPHOSCells();
+  if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
+  else                           cells = GetPHOSCells();
   
   // First recalculate energy in case non linearity was applied
   Float_t  energy = 0;
@@ -1702,8 +1683,9 @@ void AliAnaElectron::WeightHistograms(AliVCluster *clus)
     
   } // energy loop       
   
-  if(energy <=0 ) {
-    printf("AliAnaCalorimeterQA::WeightHistograms()- Wrong calculated energy %f\n",energy);
+  if ( energy <= 0 )
+  {
+    AliWarning(Form("Wrong calculated energy %f",energy));
     return;
   }
   
@@ -1725,8 +1707,8 @@ void AliAnaElectron::WeightHistograms(AliVCluster *clus)
   }        
   
   //Recalculate shower shape for different W0
-  if(GetCalorimeter()=="EMCAL"){
-    
+  if(GetCalorimeter()==kEMCAL)
+  {
     Float_t l0org = clus->GetM02();
     Float_t l1org = clus->GetM20();
     Float_t dorg  = clus->GetDispersion();
index 03ba5dba775c41f48829c4ee209a3fccf26d36df..5c33ae0211c4d0332a50495d20e747f8c802444f 100755 (executable)
@@ -17,7 +17,6 @@
 class TH2F ;
 class TH1F;
 class TH3D;
-class TString ;
 class TObjString;
 
 // --- ANALYSIS system ---
@@ -56,7 +55,7 @@ class AliAnaElectron : public AliAnaCaloTrackCorrBaseClass {
   
   // Analysis methods
   
-  Bool_t       ClusterSelected(AliVCluster* cl, TLorentzVector mom, Int_t nMaxima) ;
+  Bool_t       ClusterSelected(AliVCluster* cl, Int_t nMaxima) ;
   
   void         FillShowerShapeHistograms( AliVCluster* cluster, Int_t mcTag , Int_t pidTag) ;
   
@@ -139,6 +138,10 @@ class AliAnaElectron : public AliAnaCaloTrackCorrBaseClass {
 
   Int_t    fAODParticle;                       // Select the type of particle to put in AODs for other analysis
   
+  TLorentzVector fMomentum;                    //! cluster momentum
+  TLorentzVector fMomentumMC;                  //! mc particle momentum
+  TVector3       fProdVertex;                  //! mc particle production vertex
+
   //Histograms
   TH2F * fhdEdxvsE;                            //! matched track dEdx vs cluster E 
   TH2F * fhdEdxvsP;                            //! matched track dEdx vs track P
index ed3d2e6d4ff12d423c7ca415178ead7a25c6d615..e42e6ad275f7bb4e6ede1368ac03134fd36ca3b8 100755 (executable)
@@ -37,13 +37,14 @@ ClassImp(AliAnaGeneratorKine)
 //__________________________________________
 AliAnaGeneratorKine::AliAnaGeneratorKine() : 
 AliAnaCaloTrackCorrBaseClass(), 
-fTriggerDetector(""),
+fTriggerDetector(),  fTriggerDetectorString(),
 fFidCutTrigger(0),
 fMinChargedPt(0),    fMinNeutralPt(0),
 fStack(0),
 fParton2(0),         fParton3(0), 
-fParton6(0),         fParton7(0),   
+fParton6(0),         fParton7(0),
 fJet6(),             fJet7(),
+fTrigger(),          fLVTmp(),
 fPtHard(0),
 fhPtHard(0),         fhPtParton(0),    fhPtJet(0),
 fhPtPartonPtHard(0), fhPtJetPtHard(0), fhPtJetPtParton(0),
@@ -83,8 +84,7 @@ fhPtPhoton(0),       fhPtPi0(0)
 }
 
 //___________________________________________________________________________
-Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(TLorentzVector trigger,
-                                                      Int_t   indexTrig,
+Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(Int_t   indexTrig,
                                                       Int_t   pdgTrig,
                                                       Bool_t  leading[4],
                                                       Bool_t  isolated[4],
@@ -92,7 +92,7 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(TLorentzVector trigger,
 {
   //Correlate trigger with partons or jets, get z
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::CorrelateWithPartonOrJet() - Start \n");
+  AliDebug(1,"Start");
   
   //Get the index of the mother
   iparton =  (fStack->Particle(indexTrig))->GetFirstMother();
@@ -100,7 +100,11 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(TLorentzVector trigger,
   while (iparton > 7) 
   {
     iparton   = mother->GetFirstMother();
-    if(iparton < 0) { printf("AliAnaGeneratorKine::CorrelateWithPartonOrJet() - Negative index, skip event\n"); return kFALSE; }
+    if(iparton < 0)
+    {
+      AliWarning("Negative index, skip event");
+      return kFALSE;
+    }
     mother = fStack->Particle(iparton);
   }
   
@@ -112,7 +116,7 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(TLorentzVector trigger,
     return kFALSE; 
   }
   
-  Float_t ptTrig   = trigger.Pt(); 
+  Float_t ptTrig   = fTrigger.Pt(); 
   Float_t partonPt = fParton6->Pt();
   Float_t jetPt    = fJet6.Pt();
   if(iparton==7)
@@ -220,7 +224,7 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(TLorentzVector trigger,
     } // photon
   } // conditions loop
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::CorrelateWithPartonOrJet() - End TRUE \n");
+  AliDebug(1,"End TRUE");
   
   return kTRUE;
 }
@@ -578,15 +582,12 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
 {
   // Fill data members with partons,jets and generated pt hard 
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::GetPartonsAndJets() - Start \n");
+  AliDebug(1,"Start");
 
   fStack =  GetMCStack() ;
   
   if(!fStack) 
-  {
-    printf("AliAnaGeneratorKine::MakeAnalysisFillHistograms() - No Stack available, STOP\n");
-    abort();
-  }
+    AliFatal("No Stack available, STOP");
   
   fParton2 = fStack->Particle(2) ;
   fParton3 = fStack->Particle(3) ;
@@ -622,25 +623,25 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
     {
       pygeh->TriggerJet(ijet, tmpjet);
       
-      TLorentzVector jet(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
-      Float_t jphi = jet.Phi();
+      fLVTmp.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
+      Float_t jphi = fLVTmp.Phi();
       if(jphi < 0) jphi +=TMath::TwoPi();
       
-      Double_t radius6 = GetIsolationCut()->Radius(fParton6->Eta(), p6phi, jet.Eta() , jphi) ;
-      Double_t radius7 = GetIsolationCut()->Radius(fParton7->Eta(), p7phi, jet.Eta() , jphi) ;
+      Double_t radius6 = GetIsolationCut()->Radius(fParton6->Eta(), p6phi, fLVTmp.Eta() , jphi) ;
+      Double_t radius7 = GetIsolationCut()->Radius(fParton7->Eta(), p7phi, fLVTmp.Eta() , jphi) ;
       
       //printf("jet %d: pt %2.2f, eta %2.2f, phi %2.2f, r6 %2.2f, r7 %2.2f\n",ijet,jet.Pt(),jet.Eta(),jphi,radius6, radius7);
       
       if (radius6 < jet6R)
       {
         jet6R = radius6;
-        fJet6 = jet;
+        fJet6 = fLVTmp;
         
       }
       if (radius7 < jet7R) 
       {
         jet7R = radius7;
-        fJet7 = jet;
+        fJet7 = fLVTmp;
       }
             
     } // jet loop
@@ -663,13 +664,12 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
   fhPtJetPtParton ->Fill(fPtHard, fJet6.Pt()/fParton6->Pt());
   fhPtJetPtParton ->Fill(fPtHard, fJet7.Pt()/fParton7->Pt());
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::GetPartonsAndJets() - End \n");
+  AliDebug(1,"End");
 
 }
 
 //_____________________________________________________
-void AliAnaGeneratorKine::GetXE(TLorentzVector trigger,
-                                Int_t   indexTrig,
+void AliAnaGeneratorKine::GetXE(Int_t   indexTrig,
                                 Int_t   pdgTrig,
                                 Bool_t  leading[4],
                                 Bool_t  isolated[4],
@@ -678,14 +678,12 @@ void AliAnaGeneratorKine::GetXE(TLorentzVector trigger,
 
   // Calculate the real XE and the UE XE
 
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::GetXE() - Start \n");
+  AliDebug(1,"Start");
   
-  Float_t ptTrig  = trigger.Pt();
-  Float_t phiTrig = trigger.Phi();
+  Float_t ptTrig  = fTrigger.Pt();
+  Float_t phiTrig = fTrigger.Phi();
   if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
   
-  TLorentzVector chPartLV;
-  
   //Loop on primaries, start from position 8, no partons
   for(Int_t ipr = 8; ipr < fStack->GetNprimary(); ipr ++ )
   {
@@ -709,8 +707,8 @@ void AliAnaGeneratorKine::GetXE(TLorentzVector trigger,
     
     if( pt < fMinChargedPt)    continue ;
     
-    particle->Momentum(chPartLV);
-    Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(chPartLV,"CTS") ;
+    particle->Momentum(fLVTmp);
+    Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(fLVTmp.Eta(),fLVTmp.Phi(),kCTS) ;
     
     if(!inTPC) continue;
     
@@ -790,7 +788,7 @@ void AliAnaGeneratorKine::GetXE(TLorentzVector trigger,
     
   } // primary loop
 
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::GetPartonsAndJets() - End \n");
+  AliDebug(1,"End");
 
 }
 
@@ -801,7 +799,7 @@ void AliAnaGeneratorKine::InitParameters()
   //Initialize the parameters of the analysis.
   AddToHistogramsName("AnaGenKine_");
   
-  fTriggerDetector = "EMCAL";
+  fTriggerDetector = kEMCAL;
   
   fMinChargedPt    = 0.2;
   fMinNeutralPt    = 0.3;
@@ -809,8 +807,7 @@ void AliAnaGeneratorKine::InitParameters()
 }
 
 //_____________________________________________________________________
-void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
-                                                Int_t indexTrig,
+void  AliAnaGeneratorKine::IsLeadingAndIsolated(Int_t indexTrig,
                                                 Int_t pdgTrig,
                                                 Bool_t leading[4],
                                                 Bool_t isolated[4]) 
@@ -818,7 +815,7 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
   // Check if the trigger is the leading particle and if it is isolated
   // In case of neutral particles check all neutral or neutral in EMCAL acceptance
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::GetIsLeadingAndIsolated() - Start \n");
+  AliDebug(1,"Start");
 
   Float_t ptMaxCharged       = 0; // all charged
   Float_t ptMaxNeutral       = 0; // all neutral
@@ -836,9 +833,9 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
   isolated[2] = 0;
   isolated[3] = 0;
   
-  Float_t ptTrig  = trigger.Pt();
-  Float_t etaTrig = trigger.Eta();
-  Float_t phiTrig = trigger.Phi();
+  Float_t ptTrig  = fTrigger.Pt();
+  Float_t etaTrig = fTrigger.Eta();
+  Float_t phiTrig = fTrigger.Phi();
   if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
 
   // Minimum track or cluster energy
@@ -881,7 +878,7 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
     if( status != 1) continue ;
 
     // Select all particles in at least the TPC acceptance
-    Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(trigger,"CTS") ;
+    Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(fTrigger.Eta(),fTrigger.Phi(),kCTS) ;
     if(!inTPC) continue;
     
     Float_t pt     = particle->Pt();
@@ -922,7 +919,7 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
       }
       
       //Calorimeter acceptance
-      Bool_t inCalo = GetFiducialCut()->IsInFiducialCut(trigger,GetCalorimeter()) ;
+      Bool_t inCalo = GetFiducialCut()->IsInFiducialCut(fTrigger.Eta(),fTrigger.Phi(),GetCalorimeter()) ;
       if(!inCalo) continue;
       
       if( ptMaxNeutEMCAL < pt ) ptMaxNeutEMCAL = pt;
@@ -1028,7 +1025,7 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(TLorentzVector trigger,
     } // photon
   } // conditions loop
  
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::IsLeadingAndIsolated() - End \n");
+  AliDebug(1,"End");
   
 }
   
@@ -1037,9 +1034,7 @@ void  AliAnaGeneratorKine::MakeAnalysisFillHistograms()
 {
   //Particle-Parton Correlation Analysis, fill histograms
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::MakeAnalysisFillHistograms() - Start \n");
-
-  TLorentzVector trigger;
+  AliDebug(1,"Start");
   
   GetPartonsAndJets();
   
@@ -1062,18 +1057,17 @@ void  AliAnaGeneratorKine::MakeAnalysisFillHistograms()
     // If not photon, trigger on pi0
     else if(pdgTrig != 111) continue;
     
-    
     // Acceptance and kinematical cuts
-    if( ptTrig < GetMinPt() )    continue ;
+    if( ptTrig < GetMinPt() ) continue ;
     
     // Recover the kinematics:
-    particle->Momentum(trigger);
+    particle->Momentum(fTrigger);
     
-    Bool_t in = GetFiducialCutForTrigger()->IsInFiducialCut(trigger,fTriggerDetector) ;
+    Bool_t in = GetFiducialCutForTrigger()->IsInFiducialCut(fTrigger.Eta(),fTrigger.Phi(),fTriggerDetector) ;
     if(! in ) continue ;
 
-    if( GetDebug() > 2) printf("Select trigger particle %d: pdg %d status %d, mother index %d, pT %2.2f, eta %2.2f, phi %2.2f \n",
-                               ipr, pdgTrig, statusTrig, imother, ptTrig, particle->Eta(), particle->Phi()*TMath::RadToDeg());
+    AliDebug(1,Form("Select trigger particle %d: pdg %d status %d, mother index %d, pT %2.2f, eta %2.2f, phi %2.2f",
+                    ipr, pdgTrig, statusTrig, imother, ptTrig, particle->Eta(), particle->Phi()*TMath::RadToDeg()));
     
 //    if(pdgTrig==111)
 //    {
@@ -1087,16 +1081,49 @@ void  AliAnaGeneratorKine::MakeAnalysisFillHistograms()
     Bool_t leading[4] ;
     Bool_t isolated[4] ;
 
-    IsLeadingAndIsolated(trigger, ipr, pdgTrig, leading, isolated);
+    IsLeadingAndIsolated(ipr, pdgTrig, leading, isolated);
     
     Int_t iparton = -1;
-    Int_t ok = CorrelateWithPartonOrJet(trigger, ipr, pdgTrig, leading, isolated, iparton); 
+    Int_t ok = CorrelateWithPartonOrJet(ipr, pdgTrig, leading, isolated, iparton);
     if(!ok) continue;
     
-    GetXE(trigger,ipr,pdgTrig,leading,isolated,iparton) ;    
+    GetXE(ipr,pdgTrig,leading,isolated,iparton) ;    
     
   }
   
-  if(GetDebug() > 1) printf("AliAnaGeneratorKine::MakeAnalysisFillHistograms() - End fill histograms \n");
+  AliDebug(1,"End fill histograms");
+  
+}
+
+//_________________________________________________________
+void AliAnaGeneratorKine::SetTriggerDetector(TString & det)
+{
+  // Set the detrimeter for the analysis
+  
+  fTriggerDetectorString = det;
+  
+  if     (det=="EMCAL") fTriggerDetector = kEMCAL;
+  else if(det=="PHOS" ) fTriggerDetector = kPHOS;
+  else if(det=="CTS")   fTriggerDetector = kCTS;
+  else if(det=="DCAL")  fTriggerDetector = kDCAL;
+  else if(det.Contains("DCAL") && det.Contains("PHOS")) fTriggerDetector = kDCALPHOS;
+  else AliFatal(Form("Detector < %s > not known!", det.Data()));
   
-} 
+}
+
+//_____________________________________________________
+void AliAnaGeneratorKine::SetTriggerDetector(Int_t det)
+{
+  // Set the detrimeter for the analysis
+  
+  fTriggerDetector = det;
+  
+  if     (det==kEMCAL)    fTriggerDetectorString = "EMCAL";
+  else if(det==kPHOS )    fTriggerDetectorString = "PHOS";
+  else if(det==kCTS)      fTriggerDetectorString = "CTS";
+  else if(det==kDCAL)     fTriggerDetectorString = "DCAL";
+  else if(det==kDCALPHOS) fTriggerDetectorString = "DCAL_PHOS";
+  else AliFatal(Form("Detector < %d > not known!", det));
+  
+}
+
index 39d5edbcf031974bffb1707a76693a81c2e8b7e1..b310eed7052f8a64bacc5c472d9c15861c2fd288 100755 (executable)
@@ -26,8 +26,7 @@ public:
   AliAnaGeneratorKine() ; // default ctor
   virtual ~AliAnaGeneratorKine() { delete fFidCutTrigger ; } //virtual dtor
   
-  Bool_t CorrelateWithPartonOrJet(TLorentzVector trigger,
-                                  Int_t   indexTrig,
+  Bool_t CorrelateWithPartonOrJet(Int_t   indexTrig,
                                   Int_t   pdgTrig,
                                   Bool_t  leading[4],
                                   Bool_t  isolated[4],
@@ -37,8 +36,7 @@ public:
   
   void    GetPartonsAndJets() ;
     
-  void    GetXE(TLorentzVector trigger,
-                Int_t   indexTrig,
+  void    GetXE(Int_t   indexTrig,
                 Int_t   pdgTrig,
                 Bool_t  leading[4],
                 Bool_t  isolated[4],
@@ -46,15 +44,15 @@ public:
   
   void    InitParameters() ;
   
-  void    IsLeadingAndIsolated(TLorentzVector trigger,
-                               Int_t  indexTrig,
+  void    IsLeadingAndIsolated(Int_t  indexTrig,
                                Int_t  pdgTrig,
                                Bool_t leading[4],     
                                Bool_t isolated[4]) ;
     
   void    MakeAnalysisFillHistograms() ;
   
-  void    SetTriggerDetector( TString name ) { fTriggerDetector = name ; }
+  void    SetTriggerDetector( TString & det ) ;
+  void    SetTriggerDetector( Int_t  det )    ;
   
   void    SetMinChargedPt   ( Float_t pt )   { fMinChargedPt    = pt   ; }
   void    SetMinNeutralPt   ( Float_t pt )   { fMinNeutralPt    = pt   ; }
@@ -64,12 +62,12 @@ public:
   { if(!fFidCutTrigger)  fFidCutTrigger  = new AliFiducialCut(); return  fFidCutTrigger  ; }
   virtual void     SetFiducialCut(AliFiducialCut * fc)
   { delete fFidCutTrigger;  fFidCutTrigger  = fc      ; }
-
   
 private:
-  
-  TString     fTriggerDetector;             //! trigger detector, for fiducial region
-  
+
+  Int_t       fTriggerDetector ;            // Detector : EMCAL, PHOS, CTS
+  TString     fTriggerDetectorString ;      // Detector : EMCAL, PHOS, CTS
+
   AliFiducialCut* fFidCutTrigger;           //! fiducial cut for the trigger detector
   
   Float_t     fMinChargedPt;                //! Minimum energy for charged particles in correlation
@@ -86,8 +84,11 @@ private:
   TLorentzVector fJet6;                     //! Pythia jet close to parton in position 6
   TLorentzVector fJet7;                     //! Pythia jet close to parton in position 7
 
-  Float_t     fPtHard;                      //! Generated pT hard
+  TLorentzVector fTrigger;                  //! Trigger momentum, avoid generating TLorentzVectors per event
+  TLorentzVector fLVTmp;                    //! momentum, avoid generating TLorentzVectors per event
   
+  Float_t     fPtHard;                      //! Generated pT hard
+
   TH1F      * fhPtHard;                     //! pt of parton 
   TH1F      * fhPtParton;                   //! pt of parton  
   TH1F      * fhPtJet;                      //! pt of jet 
@@ -148,7 +149,7 @@ private:
   AliAnaGeneratorKine              (const AliAnaGeneratorKine & gk) ; // cpy ctor
   AliAnaGeneratorKine & operator = (const AliAnaGeneratorKine & gk) ; // cpy assignment
   
-  ClassDef(AliAnaGeneratorKine,3)
+  ClassDef(AliAnaGeneratorKine,4)
   
 } ;
 
index 8824b6e7c92d4cd7082ae6b304437b2b6b34b942..42bc90ad3f4f081ca8b33e208004e7e0deab4a2f 100755 (executable)
@@ -63,6 +63,12 @@ AliAnaInsideClusterInvariantMass::AliAnaInsideClusterInvariantMass() :
   fFillArmenterosHisto(0),                   fFillThetaStarHisto(0),
   fSSWeightN(0),                             fSSECellCutN(0),
   fNLMSettingN(0),                           fWSimu(),
+  fClusterMomentum(),                        fSubClusterMom1(),                         fSubClusterMom2(),
+  fSubClusterMomSum(),                       fSubClusterMomBoost(),
+  fPrimaryMom(),                             fGrandMotherMom(),
+  fMCDaughMom1(),                            fMCDaughMom2(),
+  fProdVertex(),
+// Histograms
   fhMassAsyCutNLocMax1(0),                   fhMassAsyCutNLocMax2(0),                   fhMassAsyCutNLocMaxN(0),
   fhM02AsyCutNLocMax1(0),                    fhM02AsyCutNLocMax2(0),                    fhM02AsyCutNLocMaxN(0),
   fhMassM02CutNLocMax1(0),                   fhMassM02CutNLocMax2(0),                   fhMassM02CutNLocMaxN(0),
@@ -582,10 +588,10 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
 //      Int_t   mpdg = -999999;
 //      Int_t   mstatus = -1;
 //      Int_t   grandLabel = -1;
-//      TLorentzVector mother = GetMCAnalysisUtils()->GetMother(mclabel,GetReader(),mpdg,mstatus,mOK,grandLabel);
+//      fPrimaryMom = GetMCAnalysisUtils()->GetMother(mclabel,GetReader(),mpdg,mstatus,mOK,grandLabel);
 //      
 //      printf("******** mother %d : Label %d, pdg %d; status %d, E %2.2f, Eta %2.2f, Phi %2.2f, ok %d, mother label %d\n",
-//             ilab, mclabel, mpdg, mstatus,mother.E(), mother.Eta(),mother.Phi()*TMath::RadToDeg(),mOK,grandLabel);
+//             ilab, mclabel, mpdg, mstatus,fPrimaryMom.E(), fPrimaryMom.Eta(),fPrimaryMom.Phi()*TMath::RadToDeg(),mOK,grandLabel);
 //      
 //      if( ( mpdg == 22 || TMath::Abs(mpdg)==11 ) && grandLabel >=0 )
 //      {
@@ -709,7 +715,6 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
   
   // Compare the common ancestors of the 2 highest energy local maxima
   Int_t ancPDG = 0, ancStatus = -1;
-  TLorentzVector momentum; TVector3 prodVertex;
   Int_t ancLabel = 0;
   Bool_t high = kFALSE;
   Bool_t low  = kFALSE;
@@ -749,7 +754,7 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       }
       
       ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(mcLabel1,mcLabel2,
-                                                           GetReader(),ancPDG,ancStatus,momentum,prodVertex);
+                                                           GetReader(),ancPDG,ancStatus,fPrimaryMom,fProdVertex);
       if(ancPDG==111)
       {
         if((i==imax && j==imax2) ||  (j==imax && i==imax2))
@@ -770,7 +775,7 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
      
       Bool_t ok  =kFALSE;
       Int_t pdg = -22222, status = -1;
-      TLorentzVector primary  =GetMCAnalysisUtils()->GetMother(ancLabel,GetReader(), pdg, status, ok);
+      fPrimaryMom = GetMCAnalysisUtils()->GetMother(ancLabel,GetReader(), pdg, status, ok);
       //printf("\t i %d label %d - j %d label %d; ancestor label %d, PDG %d-%d; E %2.2f; high %d, any %d \n",i,mcLabel1,j,mcLabel2, ancLabel, ancPDG,pdg, primary.E(), high, low);
 
     }
@@ -829,16 +834,15 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
   Int_t gLabel = -1;
   
   Int_t label = cluster->GetLabel();
-  TLorentzVector pi0Kine;
-    
-  while( pdg!=111 && label>=0 )
+  
+  while( pdg!=111 && label >=0 )
   {
-    pi0Kine = GetMCAnalysisUtils()->GetGrandMother(label,GetReader(),pdg,status,ok, label,gLabel);
+    fPrimaryMom = GetMCAnalysisUtils()->GetGrandMother(label,GetReader(),pdg,status,ok, label,gLabel);
   }
   
   if(pdg!=111 || label < 0)
   {
-    Info("CheckLocalMaximaMCOrigin","Mother Pi0 not found!\n");
+    AliWarning("Mother Pi0 not found!");
     return;
   }
   
@@ -846,35 +850,35 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
   
   if(nDaugthers != 2)
   {
-    Info("CheckLocalMaximaMCOrigin","N daughters %d !=2!\n",nDaugthers);
+    AliWarning(Form("N daughters %d !=2!",nDaugthers));
     return;
   }
   
   // Get daughter photon kinematics
   Int_t pdg0 = -22222, status0   = -1; Int_t label0 = -1;
-  TLorentzVector photon0Kine = GetMCAnalysisUtils()->GetDaughter(0,label,GetReader(),pdg0,status0,ok,label0);
+  fMCDaughMom1 = GetMCAnalysisUtils()->GetDaughter(0,label,GetReader(),pdg0,status0,ok,label0);
   Int_t pdg1 = -22222, status1   = -1; Int_t label1 = -1;
-  TLorentzVector photon1Kine = GetMCAnalysisUtils()->GetDaughter(1,label,GetReader(),pdg1,status1,ok,label1);
+  fMCDaughMom2 = GetMCAnalysisUtils()->GetDaughter(1,label,GetReader(),pdg1,status1,ok,label1);
 
   if(pdg1!=22 || pdg0 != 22)
   {
-    Info("CheckLocalMaximaMCOrigin","Wrong daughters PDG: photon0 %d - photon1 %d\n",pdg0,pdg1);
+    AliWarning(Form("Wrong daughters PDG: photon0 %d - photon1 %d",pdg0,pdg1));
     return;
   }
   
   // In what cells did the photons hit
-  Float_t eta0 = photon0Kine.Eta();
-  Float_t eta1 = photon1Kine.Eta();
+  Float_t eta0 = fMCDaughMom1.Eta();
+  Float_t eta1 = fMCDaughMom2.Eta();
   
-  Float_t phi0 = photon0Kine.Phi();
-  Float_t phi1 = photon1Kine.Phi();
+  Float_t phi0 = fMCDaughMom1.Phi();
+  Float_t phi1 = fMCDaughMom2.Phi();
 
 // if((mass < 0.06 || mass > 1.8) && mcindex==kmcPi0 && noverlaps == 0)
 //  {
 //    printf("MC pi0 label %d E  %2.2f, eta %2.2f, phi %2.2f, mass (ph1, ph2) %2.2f: \n \t photon0 label %d E %2.2f, eta %2.2f, phi %2.2f \n \t photon1 label %d E %2.2f eta %2.2f, phi %2.2f\n",
-//           label , pi0Kine.E()    , pi0Kine.Eta(),pi0Kine.Phi()*TMath::RadToDeg(), (photon0Kine+photon1Kine).M(),
-//           label0, photon0Kine.E(),          eta0,         phi0*TMath::RadToDeg(),
-//           label1, photon1Kine.E(),          eta1,         phi1*TMath::RadToDeg());
+//           label , fPrimaryMom.E()    , fPrimaryMom.Eta(),fPrimaryMom.Phi()*TMath::RadToDeg(), (fMCDaughMom1+fMCDaughMom2).M(),
+//           label0, fMCDaughMom1.E(),          eta0,         phi0*TMath::RadToDeg(),
+//           label1, fMCDaughMom2.E(),          eta1,         phi1*TMath::RadToDeg());
 //    
 //    TLorentzVector momclus;
 //    cluster->GetMomentum(momclus,GetVertex(0));
@@ -978,7 +982,7 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       Int_t tmplabel   = mclabel;
       while((secLabel0 < 0 || secLabel1 < 0) && tmplabel > 0 )
       {
-        TLorentzVector mother = GetMCAnalysisUtils()->GetMother(tmplabel,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
+        fPrimaryMom = GetMCAnalysisUtils()->GetMother(tmplabel,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
         
         //printf("\t \t while secLabel %d, mom %d, granmom %d\n",mclabel,tmplabel,secgrandLabel);
         
@@ -998,14 +1002,14 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
     // Get the position of the found secondaries mother
     if(!match0 && secLabel0 > 0)
     {
-      TLorentzVector mother = GetMCAnalysisUtils()->GetMother(secLabel0,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
+      fPrimaryMom = GetMCAnalysisUtils()->GetMother(secLabel0,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
       
-      //Float_t eta = mother.Eta();
-      //Float_t phi = mother.Phi();
+      //Float_t eta = fPrimaryMom.Eta();
+      //Float_t phi = fPrimaryMom.Phi();
       //if(phi < 0 ) phi+=TMath::TwoPi();
       //GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(eta, phi, absId0second);
       
-      //printf("Secondary MC0 label %d, absId %d E %2.2F eta %2.2f, phi %f\n", secLabel0,absId0second, mother.E(),mother.Eta(),mother.Phi()*TMath::RadToDeg());
+      //printf("Secondary MC0 label %d, absId %d E %2.2F eta %2.2f, phi %f\n", secLabel0,absId0second, fPrimaryMom.E(),fPrimaryMom.Eta(),fPrimaryMom.Phi()*TMath::RadToDeg());
       
       if(absId0second == list[imax] ) { match0 = kTRUE ; imatch0 = imax  ; }
       if(absId0second == list[imax2]) { match0 = kTRUE ; imatch0 = imax2 ; }
@@ -1013,14 +1017,14 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
 
     if(!match1 && secLabel1 > 0)
     {
-      TLorentzVector mother = GetMCAnalysisUtils()->GetMother(secLabel1,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
+      fPrimaryMom = GetMCAnalysisUtils()->GetMother(secLabel1,GetReader(),secpdg,secstatus,secOK,secgrandLabel);
       
-      //Float_t eta = mother.Eta();
-      //Float_t phi = mother.Phi();
+      //Float_t eta = fPrimaryMom.Eta();
+      //Float_t phi = fPrimaryMom.Phi();
       //if(phi < 0 ) phi+=TMath::TwoPi();
       //GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(eta, phi, absId1second);
       
-      //printf("Secondary MC1 label %d absId %d E %2.2F eta %2.2f, phi %f\n",secLabel1, absId1second, mother.E(),mother.Eta(),mother.Phi()*TMath::RadToDeg());
+      //printf("Secondary MC1 label %d absId %d E %2.2F eta %2.2f, phi %f\n",secLabel1, absId1second, fPrimaryMom.E(),fPrimaryMom.Eta(),fPrimaryMom.Phi()*TMath::RadToDeg());
       
       if(absId1second == list[imax] ) { match1 = kTRUE ; imatch1 = imax  ; }
       if(absId1second == list[imax2]) { match1 = kTRUE ; imatch1 = imax2 ; }
@@ -1042,17 +1046,17 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonHitHighLMMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     else
@@ -1061,17 +1065,17 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonHitHighLMOverlapMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax )
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
 
     }
@@ -1117,17 +1121,17 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
 
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     else
@@ -1136,17 +1140,17 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonAdjHighLMOverlapMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM1vsELM1[inlm]->Fill(e1,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjHighLMOverlapDiffELM2vsELM2[inlm]->Fill(e2,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     
@@ -1205,13 +1209,13 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonHitOtherLMMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitOtherLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     else
@@ -1220,13 +1224,13 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonHitOtherLMMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonHitOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     
@@ -1279,13 +1283,13 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonAdjOtherLMMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjOtherLMDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     else
@@ -1294,13 +1298,13 @@ void AliAnaInsideClusterInvariantMass::CheckLocalMaximaMCOrigin(AliVCluster* clu
       fhMCPi0DecayPhotonAdjOtherLMOverlapMass[inlm]->Fill(en,mass);
       if(match0 && imatch0 == imax)
       {
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon0Kine.E())/photon0Kine.E());
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon1Kine.E())/photon1Kine.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom1.E())/fMCDaughMom1.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom2.E())/fMCDaughMom2.E());
       }
       else
       {
-        if(photon1Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-photon1Kine.E())/photon1Kine.E());
-        if(photon0Kine.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-photon0Kine.E())/photon0Kine.E());
+        if(fMCDaughMom2.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM1[inlm]->Fill(en,(e1-fMCDaughMom2.E())/fMCDaughMom2.E());
+        if(fMCDaughMom1.E()>0)fhMCPi0DecayPhotonAdjOtherLMOverlapDiffELM2[inlm]->Fill(en,(e2-fMCDaughMom1.E())/fMCDaughMom1.E());
       }
     }
     
@@ -1496,24 +1500,23 @@ void AliAnaInsideClusterInvariantMass::FillAngleHistograms(Int_t   nMax,      Bo
 
 //______________________________________________________________________________________________________________________
 void AliAnaInsideClusterInvariantMass::FillArmenterosHistograms(Int_t nMax, Int_t ebin, Int_t mcIndex,
-                                                                Float_t en, TLorentzVector g1, TLorentzVector g2,
-                                                                Float_t m02, Int_t pid)
+                                                                Float_t en, Float_t m02, Int_t pid)
 {
   // Fill Armeteros type histograms
   
   // Get pTArm and AlphaArm
-  TLorentzVector pi0 = g1+g2;
-  Float_t momentumSquaredMother = pi0.P()*pi0.P();
+  fSubClusterMomSum = fSubClusterMom1+fSubClusterMom2;
+  Float_t momentumSquaredMother = fSubClusterMomSum.P()*fSubClusterMomSum.P();
   Float_t momentumDaughter1AlongMother = 0.;
   Float_t momentumDaughter2AlongMother = 0.;
 
   if (momentumSquaredMother > 0.)
   {
-    momentumDaughter1AlongMother = (g1.Px()*pi0.Px() + g1.Py()*pi0.Py()+ g1.Pz()*pi0.Pz()) / sqrt(momentumSquaredMother);
-    momentumDaughter2AlongMother = (g2.Px()*pi0.Px() + g2.Py()*pi0.Py()+ g2.Pz()*pi0.Pz()) / sqrt(momentumSquaredMother);
+    momentumDaughter1AlongMother = (fSubClusterMom1.Px()*fSubClusterMomSum.Px() + fSubClusterMom1.Py()*fSubClusterMomSum.Py()+ fSubClusterMom1.Pz()*fSubClusterMomSum.Pz()) / sqrt(momentumSquaredMother);
+    momentumDaughter2AlongMother = (fSubClusterMom2.Px()*fSubClusterMomSum.Px() + fSubClusterMom2.Py()*fSubClusterMomSum.Py()+ fSubClusterMom2.Pz()*fSubClusterMomSum.Pz()) / sqrt(momentumSquaredMother);
   }
 
-  Float_t momentumSquaredDaughter1 = g1.P()*g1.P();
+  Float_t momentumSquaredDaughter1 = fSubClusterMom1.P()*fSubClusterMom1.P();
   Float_t ptArmSquared = momentumSquaredDaughter1 - momentumDaughter1AlongMother*momentumDaughter1AlongMother;
   
   Float_t pTArm = 0.;
@@ -1524,9 +1527,9 @@ void AliAnaInsideClusterInvariantMass::FillArmenterosHistograms(Int_t nMax, Int_
   if(momentumDaughter1AlongMother +momentumDaughter2AlongMother > 0)
     alphaArm = (momentumDaughter1AlongMother -momentumDaughter2AlongMother) / (momentumDaughter1AlongMother + momentumDaughter2AlongMother);
   
-  Float_t asym = TMath::Abs( g1.Energy()-g2.Energy() )/( g1.Energy()+g2.Energy() ) ;
+  Float_t asym = TMath::Abs( fSubClusterMom1.Energy()-fSubClusterMom2.Energy() )/( fSubClusterMom1.Energy()+fSubClusterMom2.Energy() ) ;
   
-   if(GetDebug() > 2 ) Info("FillArmenterosHistograms()","E %f, alphaArm %f, pTArm %f\n",en,alphaArm,pTArm);
+  AliDebug(2,Form("E %f, alphaArm %f, pTArm %f",en,alphaArm,pTArm));
   
   Bool_t m02OK = GetCaloPID()->IsInPi0M02Range(en,m02,nMax);
   Bool_t asyOK = GetCaloPID()->IsInPi0SplitAsymmetryRange(en,asym,nMax);
@@ -1537,7 +1540,7 @@ void AliAnaInsideClusterInvariantMass::FillArmenterosHistograms(Int_t nMax, Int_
   Int_t inlm = nMax-1;
   if(inlm > 2 ) inlm = 2;
   Float_t ensubcut = GetCaloPID()->GetSubClusterEnergyMinimum(inlm);
-  if     (ensubcut > 0.1 && ensubcut < g1.E() && ensubcut < g2.E() ) eCutOK = kTRUE;
+  if     (ensubcut > 0.1 && ensubcut < fSubClusterMom1.E() && ensubcut < fSubClusterMom2.E() ) eCutOK = kTRUE;
   else if(ensubcut < 0.1)                                            eCutOK = kTRUE;
 
   
@@ -1599,19 +1602,18 @@ void AliAnaInsideClusterInvariantMass::FillArmenterosHistograms(Int_t nMax, Int_
 
 //______________________________________________________________________________________________________________
 void AliAnaInsideClusterInvariantMass::FillThetaStarHistograms(Int_t nMax, Bool_t matched, Int_t mcIndex,
-                                                               Float_t en, TLorentzVector g1, TLorentzVector g2,
-                                                               Float_t m02, Int_t pid)
+                                                               Float_t en, Float_t m02, Int_t pid)
 {
   // Fill cos Theta^star histograms
 
   
   // Get cos Theta^star
-  TLorentzVector pi0 = g1+g2;
-  TLorentzVector g1Boost = g1;
-  g1Boost.Boost(-pi0.BoostVector());
-  Float_t  cosThStar=TMath::Cos(g1Boost.Vect().Angle(pi0.Vect()));
+  fSubClusterMomSum = fSubClusterMom1+fSubClusterMom2;
+  fSubClusterMomBoost = fSubClusterMom1;
+  fSubClusterMomBoost.Boost(-fSubClusterMomSum.BoostVector());
+  Float_t  cosThStar=TMath::Cos(fSubClusterMomBoost.Vect().Angle(fSubClusterMomSum.Vect()));
   
-  Float_t asym = TMath::Abs( g1.Energy()-g2.Energy() )/( g1.Energy()+g2.Energy() ) ;
+  Float_t asym = TMath::Abs( fSubClusterMom1.Energy()-fSubClusterMom2.Energy() )/( fSubClusterMom1.Energy()+fSubClusterMom2.Energy() ) ;
 
   Bool_t m02OK = GetCaloPID()->IsInPi0M02Range(en,m02,nMax);
   Bool_t asyOK = GetCaloPID()->IsInPi0SplitAsymmetryRange(en,asym,nMax);
@@ -1622,7 +1624,7 @@ void AliAnaInsideClusterInvariantMass::FillThetaStarHistograms(Int_t nMax, Bool_
   Int_t inlm = nMax-1;
   if(inlm > 2 ) inlm = 2;
   Float_t ensubcut = GetCaloPID()->GetSubClusterEnergyMinimum(inlm);
-  if     (ensubcut > 0.1 && ensubcut < g1.E() && ensubcut < g2.E() ) eCutOK = kTRUE;
+  if     (ensubcut > 0.1 && ensubcut < fSubClusterMom1.E() && ensubcut < fSubClusterMom2.E() ) eCutOK = kTRUE;
   else if(ensubcut < 0.1)                                            eCutOK = kTRUE;
 
   //printf("Reco cos %f, asy %f\n",cosThStar,asym);
@@ -2490,7 +2492,7 @@ void AliAnaInsideClusterInvariantMass::FillMCOverlapHistograms(Float_t en,
       if((mcindex==kmcPi0 || mcindex == kmcPi0Conv) && ebin >=0) fhMCPi0MassM02OverlapN[inlm][ebin]->Fill(l0,mass);
     }
     else
-      Info("FillMCOverlapHistograms","n overlaps = %d!!", noverlaps);
+      AliWarning(Form("n overlaps = %d!!", noverlaps));
   }
   else if(fFillTMHisto)
   {
@@ -2527,7 +2529,7 @@ void AliAnaInsideClusterInvariantMass::FillMCOverlapHistograms(Float_t en,
       if((mcindex==kmcPi0 || mcindex == kmcPi0Conv) && ebin >=0) fhMCPi0MassM02OverlapNMatch[inlm][ebin]->Fill(l0,mass);
     }
     else
-        Info("FillMCOverlapHistograms()","n overlaps in matched = %d!!", noverlaps);
+        AliWarning(Form("n overlaps in matched = %d!!", noverlaps));
   }
 }
 
@@ -2613,7 +2615,6 @@ void AliAnaInsideClusterInvariantMass::FillNLMDiffCutHistograms(AliVCluster *clu
   
   Int_t    nlm  = 0;
   Double_t mass = 0., angle = 0.;
-  TLorentzVector    lv1, lv2;
   Int_t    absId1   =-1; Int_t   absId2   =-1;
   Float_t  distbad1 =-1; Float_t distbad2 =-1;
   Bool_t   fidcut1  = 0; Bool_t  fidcut2  = 0;
@@ -2633,13 +2634,11 @@ void AliAnaInsideClusterInvariantMass::FillNLMDiffCutHistograms(AliVCluster *clu
 
       pidTag = GetCaloPID()->GetIdentifiedParticleTypeFromClusterSplitting(clus,cells,GetCaloUtils(),
                                                                                  GetVertex(0), nlm, mass, angle,
-                                                                                 lv1,lv2,absId1,absId2,
+                                                                                 fSubClusterMom1,fSubClusterMom2,absId1,absId2,
                                                                                  distbad1,distbad2,fidcut1,fidcut2);
       if (nlm <= 0)
       {
-        if(GetDebug() > 0 )
-        Info("MakeAnalysisFillHistograms","No local maximum found! It did not pass CaloPID selection criteria \n");
-        
+        AliWarning("No local maximum found! It did not pass CaloPID selection criteria");
         continue;
       }
 
@@ -2767,7 +2766,7 @@ void AliAnaInsideClusterInvariantMass::FillSSWeightHistograms(AliVCluster *clus,
   // Calculate weights and fill histograms
     
   AliVCaloCells* cells = 0;
-  if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
+  if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
   else                        cells = GetPHOSCells();
   
   // First recalculate energy in case non linearity was applied
@@ -2782,7 +2781,7 @@ void AliAnaInsideClusterInvariantMass::FillSSWeightHistograms(AliVCluster *clus,
   
   if(energy <=0 )
   {
-    Info("WeightHistograms()","Wrong calculated energy %f\n",energy);
+    AliWarning(Form("Wrong calculated energy %f",energy));
     return;
   }
   
@@ -2792,8 +2791,8 @@ void AliAnaInsideClusterInvariantMass::FillSSWeightHistograms(AliVCluster *clus,
   Float_t amp2 = cells->GetCellAmplitude(absId2);
   GetCaloUtils()->RecalibrateCellAmplitude(amp2,GetCalorimeter(), absId2);
 
-  if(amp1 < amp2)        Info("FillSSWeightHistograms","Bad local maxima E ordering : id1 E %f, id2 E %f\n ",amp1,amp2);
-  if(amp1==0 || amp2==0) Info("FillSSWeightHistograms","Null E local maxima : id1 E %f, id2 E %f\n "        ,amp1,amp2);
+  if(amp1 < amp2)        AliWarning(Form("Bad local maxima E ordering : id1 E %f, id2 E %f",amp1,amp2));
+  if(amp1==0 || amp2==0) AliWarning(Form("Null E local maxima : id1 E %f, id2 E %f "       ,amp1,amp2));
   
   if(GetCaloUtils()->IsMCECellClusFracCorrectionOn())
   {
@@ -2833,7 +2832,7 @@ void AliAnaInsideClusterInvariantMass::FillSSWeightHistograms(AliVCluster *clus,
   }
 
   //Recalculate shower shape for different W0
-  if(GetCalorimeter()=="EMCAL")
+  if(GetCalorimeter()==kEMCAL)
   {
     Float_t l0org = clus->GetM02();
     Float_t l1org = clus->GetM20();
@@ -2965,22 +2964,22 @@ TObjString *  AliAnaInsideClusterInvariantMass::GetAnalysisCuts()
   Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaInsideClusterInvariantMass ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaInsideClusterInvariantMass ---:") ;
   parList+=onePar ;    
   
-  snprintf(onePar,buffersize,"Calorimeter: %s\n",        GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",        GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fNLocMaxCutE =%2.2f \n",    GetCaloUtils()->GetLocalMaximaCutE()) ;
+  snprintf(onePar,buffersize,"fNLocMaxCutE =%2.2f;",    GetCaloUtils()->GetLocalMaximaCutE()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fNLocMaxCutEDiff =%2.2f \n",GetCaloUtils()->GetLocalMaximaCutEDiff()) ;
+  snprintf(onePar,buffersize,"fNLocMaxCutEDiff =%2.2f;",GetCaloUtils()->GetLocalMaximaCutEDiff()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinNCells =%d \n",        fMinNCells) ;
+  snprintf(onePar,buffersize,"fMinNCells =%d;",         fMinNCells) ;
   parList+=onePar ;    
-  snprintf(onePar,buffersize,"fMinBadDist =%1.1f \n",    fMinBadDist) ;
+  snprintf(onePar,buffersize,"fMinBadDist =%1.1f;",     fMinBadDist) ;
   parList+=onePar ;  
   if(fFillSSWeightHisto)
   {
-    snprintf(onePar,buffersize," N w %d - N e cut %d \n",fSSWeightN,fSSECellCutN);
+    snprintf(onePar,buffersize," N w %d - N e cut %d;",fSSWeightN,fSSECellCutN);
     parList+=onePar ;
   }
   
@@ -6244,8 +6243,8 @@ void AliAnaInsideClusterInvariantMass::GetMCPrimaryKine(AliVCluster* cluster, In
   Bool_t ok      = kFALSE;
   Int_t  mcLabel = cluster->GetLabel();
   
-  TLorentzVector primary = GetMCAnalysisUtils()->GetMother(mcLabel,GetReader(),ok);
-  eprim = primary.E();
+  fPrimaryMom = GetMCAnalysisUtils()->GetMother(mcLabel,GetReader(),ok);
+  eprim = fPrimaryMom.E();
   
   Int_t mesonLabel = -1;
   
@@ -6255,15 +6254,15 @@ void AliAnaInsideClusterInvariantMass::GetMCPrimaryKine(AliVCluster* cluster, In
     {
       GetMCAnalysisUtils()->GetMCDecayAsymmetryAngleForPDG(mcLabel,111,GetReader(),asymGen,angleGen,ok);
       asymGen = TMath::Abs(asymGen);
-      TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,111,GetReader(),ok,mesonLabel);
-      if(grandmom.E() > 0 && ok) eprim =  grandmom.E();
+      fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,111,GetReader(),ok,mesonLabel);
+      if(fGrandMotherMom.E() > 0 && ok) eprim =  fGrandMotherMom.E();
     }
     else
     {
       GetMCAnalysisUtils()->GetMCDecayAsymmetryAngleForPDG(mcLabel,221,GetReader(),asymGen,angleGen,ok);
       asymGen = TMath::Abs(asymGen);
-      TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,221,GetReader(),ok,mesonLabel);
-      if(grandmom.E() > 0 && ok) eprim =  grandmom.E();
+      fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,221,GetReader(),ok,mesonLabel);
+      if(fGrandMotherMom.E() > 0 && ok) eprim =  fGrandMotherMom.E();
     }
   }
   
@@ -6304,19 +6303,13 @@ void AliAnaInsideClusterInvariantMass::Init()
   //Init
   //Do some checks
   
-  if(GetCalorimeter() == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD())
-  {
-    AliFatal("!!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
-  }
-  else  if(GetCalorimeter() == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD())
-  {
-    AliFatal("!!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
-  }
+  if(GetCalorimeter() == kPHOS && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD())
+    AliFatal("!!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!");
+  else  if(GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD())
+    AliFatal("!!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!");
   
   if( GetReader()->GetDataType() == AliCaloTrackReader::kMC )
-  {
-    AliFatal("!!STOP: You want to use pure MC data!!\n");
-  }
+    AliFatal("!!STOP: You want to use pure MC data!!");
   
 }
 
@@ -6362,12 +6355,12 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
   AliVCaloCells* cells = 0x0;
 
   //Select the Calorimeter of the photon
-  if(GetCalorimeter() == "PHOS")
+  if(GetCalorimeter() == kPHOS)
   {
     pl    = GetPHOSClusters();
     cells = GetPHOSCells();
   }
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
   {
     pl    = GetEMCALClusters();
     cells = GetEMCALCells();
@@ -6375,11 +6368,11 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
   
   if(!pl || !cells) 
   {
-    Info("MakeAnalysisFillHistograms","TObjArray with %s clusters is NULL!\n",GetCalorimeter().Data());
+    AliWarning(Form("TObjArray with %s clusters is NULL!",GetCalorimeterString().Data()));
     return;
   }  
   
-       if(GetCalorimeter() == "PHOS") return; // Not implemented for PHOS yet
+       if(GetCalorimeter() == kPHOS) return; // Not implemented for PHOS yet
 
   for(Int_t icluster = 0; icluster < pl->GetEntriesFast(); icluster++)
   {
@@ -6407,10 +6400,9 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
 
     // Get cluster angles
     
-    TLorentzVector lv;
-    cluster->GetMomentum(lv, GetVertex(0));
-    Float_t eta = lv.Eta();
-    Float_t phi = lv.Phi();
+    cluster->GetMomentum(fClusterMomentum, GetVertex(0));
+    Float_t eta = fClusterMomentum.Eta();
+    Float_t phi = fClusterMomentum.Phi();
     if(phi<0) phi=+TMath::TwoPi();
     
     //printf("en %2.2f, GetMinEnergy() %2.2f, GetMaxEnergy() %2.2f, nc %d, fMinNCells %d,  bd %2.2f, fMinBadDist %2.2f\n",
@@ -6426,20 +6418,19 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
     
     Int_t    nMax = 0;
     Double_t mass = 0., angle = 0.;
-    TLorentzVector    lv1, lv2;
     Int_t    absId1   =-1; Int_t   absId2   =-1;
     Float_t  distbad1 =-1; Float_t distbad2 =-1;
     Bool_t   fidcut1  = 0; Bool_t  fidcut2  = 0;
     
     Int_t pidTag = GetCaloPID()->GetIdentifiedParticleTypeFromClusterSplitting(cluster,cells,GetCaloUtils(),
                                                                                GetVertex(0), nMax, mass, angle,
-                                                                               lv1,lv2,absId1,absId2,
-                                                                               distbad1,distbad2,fidcut1,fidcut2);
+                                                                               fSubClusterMom1,fSubClusterMom2,
+                                                                               absId1,absId2,
+                                                                               distbad1,distbad2,
+                                                                               fidcut1,fidcut2);
     if (nMax <= 0) 
     {
-      if(GetDebug() > 0 )
-        Info("MakeAnalysisFillHistograms","No local maximum found! It did not pass CaloPID selection criteria \n");
-      
+      AliWarning("No local maximum found! It did not pass CaloPID selection criteria");
       continue;
     }
     
@@ -6449,15 +6440,14 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
     if     (nMax == 1) inlm = 0;
     else if(nMax == 2) inlm = 1;
     else if(nMax >  2) inlm = 2;
-    else Info("MakeAnalysisFillHistograms","Wrong N local maximum -> %d, n cells in cluster %d \n",nMax,nc);
+    else AliDebug(2,Form("Wrong N local maximum -> %d, n cells in cluster %d",nMax,nc));
 
     // Skip events where one of the new clusters (lowest energy) is close to an EMCal border or a bad channel
     if( (fCheckSplitDistToBad) &&
         (!fidcut2 || !fidcut1 || distbad1 < fMinBadDist || distbad2 < fMinBadDist))
     {
-      if(GetDebug() > 1)
-        Info("MakeAnalysisFillHistograms","Dist to bad channel cl1 %f, cl2 %f; fid cl1 %d, cl2 %d \n",
-                                 distbad1,distbad2, fidcut1,fidcut2);
+      AliDebug(1,Form("Dist to bad channel cl1 %f, cl2 %f; fid cl1 %d, cl2 %d",
+                      distbad1,distbad2, fidcut1,fidcut2));
       
       if(distbad1 < fMinBadDist || distbad2 < fMinBadDist)
       {
@@ -6476,8 +6466,8 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
 
     // Get sub-cluster parameters
     
-    Float_t e1 = lv1.Energy();
-    Float_t e2 = lv2.Energy();
+    Float_t e1 = fSubClusterMom1.Energy();
+    Float_t e2 = fSubClusterMom2.Energy();
     
     Double_t tof1  = cells->GetCellTime(absId1);
     GetCaloUtils()->RecalibrateCellTime(tof1, GetCalorimeter(), absId1,GetReader()->GetInputEvent()->GetBunchCrossNumber());
@@ -6551,10 +6541,10 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
       FillAngleHistograms(nMax,matched,mcindex,en,e1,e2,angle,mass,angleGen,l0, asym,pidTag,noverlaps);
 
     if(fFillArmenterosHisto && ebin >= 0)
-      FillArmenterosHistograms(nMax, ebin, mcindex, en, lv1, lv2, l0, pidTag);
+      FillArmenterosHistograms(nMax, ebin, mcindex, en, l0, pidTag);
 
     if(fFillThetaStarHisto)
-      FillThetaStarHistograms(nMax,matched,mcindex, en, lv1, lv2, l0, pidTag);
+      FillThetaStarHistograms(nMax,matched,mcindex, en, l0, pidTag);
 
     
     //---------------------------------------------------------------------
@@ -6614,7 +6604,7 @@ void  AliAnaInsideClusterInvariantMass::MakeAnalysisFillHistograms()
     
   }//loop
   
-  if(GetDebug() > 1) Info("MakeAnalysisFillHistograms","END \n");
+  AliDebug(1,"End");
 
 }
 
@@ -6627,13 +6617,12 @@ void AliAnaInsideClusterInvariantMass::Print(const Option_t * opt) const
   
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print("");
-  printf("Calorimeter     =     %s\n",  GetCalorimeter().Data()) ;
+  printf("Calorimeter     =     %s\n",  GetCalorimeterString().Data()) ;
   if(GetCaloUtils()) printf("Loc. Max. E > %2.2f\n",       GetCaloUtils()->GetLocalMaximaCutE());
   if(GetCaloUtils()) printf("Loc. Max. E Diff > %2.2f\n",  GetCaloUtils()->GetLocalMaximaCutEDiff());
   printf("Min. N Cells =%d \n",         fMinNCells) ;
   printf("Min. Dist. to Bad =%1.1f \n", fMinBadDist) ;
   if(fFillSSWeightHisto) printf(" N w %d - N e cut %d \n",fSSWeightN,fSSECellCutN);
-
   printf("    \n") ;
   
 } 
@@ -6653,7 +6642,7 @@ void AliAnaInsideClusterInvariantMass::RecalculateClusterShowerShapeParametersWi
   
   if(!cluster)
   {
-    AliInfo("Cluster pointer null!");
+    AliWarning("Cluster pointer null!");
     return;
   }
   
@@ -6734,7 +6723,7 @@ void AliAnaInsideClusterInvariantMass::RecalculateClusterShowerShapeParametersWi
         sEtaPhi  += w * etai * phii ;
       }
     }
-    else if(energy == 0 || (eCellMin <0.01 && eCell == 0)) AliError(Form("Wrong energy %f and/or amplitude %f\n", eCell, energy));
+    else if(energy == 0 || (eCellMin <0.01 && eCell == 0)) AliError(Form("Wrong energy %f and/or amplitude %f", eCell, energy));
     
   }//cell loop
   
@@ -6745,7 +6734,7 @@ void AliAnaInsideClusterInvariantMass::RecalculateClusterShowerShapeParametersWi
     phiMean /= wtot ;
   }
   else
-    AliError(Form("Wrong weight %f\n", wtot));
+    AliError(Form("Wrong weight %f", wtot));
   
   //Calculate dispersion
   for(Int_t iDigit=0; iDigit < cluster->GetNCells(); iDigit++)
@@ -6787,7 +6776,7 @@ void AliAnaInsideClusterInvariantMass::RecalculateClusterShowerShapeParametersWi
         dPhi +=  w * (phii-phiMean)*(phii-phiMean) ;
       }
     }
-    else if(energy == 0 || (eCellMin <0.01 && eCell == 0)) AliError(Form("Wrong energy %f and/or amplitude %f\n", eCell, energy));
+    else if(energy == 0 || (eCellMin <0.01 && eCell == 0)) AliError(Form("Wrong energy %f and/or amplitude %f", eCell, energy));
   }// cell loop
   
   //Normalize to the weigth and set shower shape parameters
index 6311f3c6d8c922da192405690aab4a4367c52109..5edb7e75e182ef331c548ea90b568bbc7c70b51b 100755 (executable)
@@ -49,12 +49,10 @@ class AliAnaInsideClusterInvariantMass : public AliAnaCaloTrackCorrBaseClass {
                                    Float_t m02,   Float_t asym,    Int_t   pid,    Int_t   noverlaps);
   
   void         FillArmenterosHistograms(Int_t nMax, Int_t ebin, Int_t mcindex,
-                                        Float_t pi0E, TLorentzVector g1, TLorentzVector g2,
-                                        Float_t m02, Int_t pid);
+                                        Float_t pi0E, Float_t m02, Int_t pid);
 
   void         FillThetaStarHistograms(Int_t nMax, Bool_t matched, Int_t mcindex,
-                                       Float_t pi0E, TLorentzVector g1, TLorentzVector g2,
-                                       Float_t m02, Int_t pid);
+                                       Float_t pi0E, Float_t m02, Int_t pid);
 
   void         FillEBinHistograms(Int_t ebin, Int_t nMax, Int_t mcindex, Float_t splitFrac,
                                   Float_t mass, Float_t asym, Float_t l0);
@@ -235,6 +233,18 @@ class AliAnaInsideClusterInvariantMass : public AliAnaCaloTrackCorrBaseClass {
   Float_t      fWSimu[2];              // Constant and slope of the linear correction factor for the shower
                                        // shape weight in simulation, about 1-0.07*w
   
+  TLorentzVector fClusterMomentum;     //! Cluster momentum
+  TLorentzVector fSubClusterMom1;      //! Sub-Cluster momentum
+  TLorentzVector fSubClusterMom2;      //! Sub-Cluster momentum
+  TLorentzVector fSubClusterMomSum;    //! Sub-Cluster momentum sum, armenteros
+  TLorentzVector fSubClusterMomBoost;  //! Sub-Cluster momentum boosted, armenteros
+  
+  TLorentzVector fPrimaryMom;          //! Primary momentum
+  TLorentzVector fGrandMotherMom;      //! Primary momentum
+  TLorentzVector fMCDaughMom1;         //! Primary momentum
+  TLorentzVector fMCDaughMom2;         //! Primary momentum
+  TVector3       fProdVertex;          //! primary production vertex
+
   //Histograms
   
   TH2F       * fhMassNLocMax1[7][2]  ;                  //! Split Inv Mass vs cluster E, NLM=1,  different MC particle types, track matching on/off
index 82addeb653ca4dc374cdc4ae67137e054967ea5c..a6be176168151629b529fa6ef2d65c5c5416bc34 100644 (file)
@@ -154,7 +154,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
   const Int_t buffersize = 255;
   char key[buffersize] ;
   char title[buffersize] ;
-  const char * detector= fInputAODGammaName.Data();
+  const char * detectorName= fInputAODGammaName.Data();
   Int_t ndim=fNVtxZBin*fNCentBin*fNRpBin*fNBadChDistBin*fNpid;
   
   fRealOmega0 =new TH2F*[ndim];
@@ -184,84 +184,84 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             Int_t index=idim*fNpid*fNBadChDistBin+ipid*fNBadChDistBin+idist;
             
             snprintf(key,buffersize,"RealToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s Real Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s Real Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fRealOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;
             fRealOmega0[index]->SetName(key) ;
             fRealOmega0[index]->SetTitle(title);
             outputContainer->Add(fRealOmega0[index]);
             
             snprintf(key,buffersize,"MixAToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixA Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixA Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixAOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixAOmega0[index]->SetName(key) ;
             fMixAOmega0[index]->SetTitle(title);
             outputContainer->Add(fMixAOmega0[index]);
             
             snprintf(key,buffersize,"MixBToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixB Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixB Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixBOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixBOmega0[index]->SetName(key) ;
             fMixBOmega0[index]->SetTitle(title);
             outputContainer->Add(fMixBOmega0[index]);
             
             snprintf(key,buffersize,"MixCToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixC Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixC Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixCOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixCOmega0[index]->SetName(key) ;
             fMixCOmega0[index]->SetTitle(title);
             outputContainer->Add(fMixCOmega0[index]);
             
             snprintf(key,buffersize,"RealToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s Real Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s Real Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fRealOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
             fRealOmega1[index]->SetName(key) ;
             fRealOmega1[index]->SetTitle(title);
             outputContainer->Add(fRealOmega1[index]);
             
             snprintf(key,buffersize,"MixAToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixA Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixA Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixAOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixAOmega1[index]->SetName(key) ;
             fMixAOmega1[index]->SetTitle(title);
             outputContainer->Add(fMixAOmega1[index]);
             
             snprintf(key,buffersize,"MixBToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixB Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixB Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixBOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixBOmega1[index]->SetName(key) ;
             fMixBOmega1[index]->SetTitle(title);
             outputContainer->Add(fMixBOmega1[index]);
             
             snprintf(key,buffersize,"MixCToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixC Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixC Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixCOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixCOmega1[index]->SetName(key) ;
             fMixCOmega1[index]->SetTitle(title);
             outputContainer->Add(fMixCOmega1[index]);
             
             snprintf(key,buffersize,"RealToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s Real Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s Real Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fRealOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
             fRealOmega2[index]->SetName(key) ;
             fRealOmega2[index]->SetTitle(title);
             outputContainer->Add(fRealOmega2[index]);
             
             snprintf(key,buffersize,"MixAToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixA Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixA Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixAOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixAOmega2[index]->SetName(key) ;
             fMixAOmega2[index]->SetTitle(title);
             outputContainer->Add(fMixAOmega2[index]);
             
             snprintf(key,buffersize,"MixBToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixB Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixB Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixBOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixBOmega2[index]->SetName(key) ;
             fMixBOmega2[index]->SetTitle(title);
             outputContainer->Add(fMixBOmega2[index]);
             
             snprintf(key,buffersize,"MixCToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-            snprintf(title,buffersize, "%s MixC Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
+            snprintf(title,buffersize, "%s MixC Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detectorName,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);
             fMixCOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
             fMixCOmega2[index]->SetName(key) ;
             fMixCOmega2[index]->SetTitle(title);
@@ -280,8 +280,8 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
      outputContainer->Add(fhFakeOmega[i]); 
   }
   if(IsDataMC()){
-    snprintf(key,buffersize, "%sOmegaPri",detector);
-    snprintf(title,buffersize,"primary #omega in %s",detector);
+    snprintf(key,buffersize, "%sOmegaPri",detectorName);
+    snprintf(title,buffersize,"primary #omega in %s",detectorName);
     fhOmegaPriPt=new TH1F(key, title,nptbins,ptmin,ptmax);
     fhOmegaPriPt->GetXaxis()->SetTitle("P_{T}");
     fhOmegaPriPt->GetYaxis()->SetTitle("dN/P_{T}");
index e15f74ec9c0692f0559052669e57a35d949212b3..80557e466cb4d469dd2bcc0bbf8a835905a82a54 100755 (executable)
@@ -74,6 +74,8 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fMinLeadHadPt(0),               fMaxLeadHadPt(0),
     fFillEtaGapsHisto(1),           fFillMomImbalancePtAssocBinsHisto(0),
     fMCGenTypeMin(0),               fMCGenTypeMax(0),
+    fTrackVector(),                 fMomentum(),
+    fDecayMom1(),                   fDecayMom2(),
     //Histograms
     fhPtTriggerInput(0),            fhPtTriggerSSCut(0),
     fhPtTriggerIsoCut(0),           fhPtTriggerFidCut(0),
@@ -445,11 +447,9 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
   
   Double_t mcpout = mcAssocPt*TMath::Sin(mcdeltaPhi) ; 
   
-  if(GetDebug() > 0 )
-  {
-    AliInfo(Form("Charged hadron: track Pt %f, track Phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f \n",
-                 mcAssocPt,mcAssocPhi, mcTrigPhi,fDeltaPhiMinCut, mcdeltaPhi, fDeltaPhiMaxCut));
-  }
+  AliDebug(1,Form("Charged hadron: track Pt %f, track Phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f",
+                  mcAssocPt,mcAssocPhi, mcTrigPhi,fDeltaPhiMinCut, mcdeltaPhi, fDeltaPhiMaxCut));
+  
   
   // Fill Histograms
   fhMCEtaCharged     [histoIndex]->Fill(mcAssocPt, mcAssocEta);
@@ -504,8 +504,8 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
     Double_t mcUezT =   mcAssocPt/mcTrigPt;
     
     if(mcUexE < 0.)
-      printf("FillChargedMCCorrelationHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
 
     fhMCPtXEUeCharged[histoIndex]->Fill(mcTrigPt,mcUexE);
     if(mcUexE > 0) fhMCPtHbpXEUeCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
@@ -537,8 +537,8 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
       Double_t mcUezT =   mcAssocPt/mcTrigPt;
       
       if(mcUexE < 0.)
-        printf("FillChargedMCCorrelationHistograms(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-               mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+        AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                        mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
       
       fhMCPtXEUeLeftCharged[histoIndex]->Fill(mcTrigPt,mcUexE);
       if(mcUexE > 0) fhMCPtHbpXEUeLeftCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
@@ -575,8 +575,8 @@ void AliAnaParticleHadronCorrelation::FillChargedMomentumImbalanceHistograms(Flo
   Float_t pout = ptAssoc*TMath::Sin(deltaPhi) ;
 
   if(xE < 0.)
-    printf("FillChargedMomentumImbalanceHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-           xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+    AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+               xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
 
   Float_t hbpXE = -100;
   Float_t hbpZT = -100;
@@ -697,8 +697,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(Float
   Double_t uezT =   ptAssoc/ptTrig;
   
   if(uexE < 0.)
-    printf("FillChargedUnderlyingEventHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-           uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+    AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+               uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
   
   fhXEUeCharged->Fill(ptTrig,uexE);
   if(uexE > 0) fhPtHbpXEUeCharged->Fill(ptTrig,TMath::Log(1/uexE));
@@ -761,8 +761,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uezT =   ptAssoc/ptTrig;
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-              uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftCharged->Fill(ptTrig,uexE);
     if(uexE > 0) fhPtHbpXEUeLeftCharged->Fill(ptTrig,TMath::Log(1/uexE));
@@ -780,8 +780,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftDownCharged->Fill(ptTrig,uexE);
   }
@@ -793,8 +793,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftUpCharged->Fill(ptTrig,uexE);
   }
@@ -806,8 +806,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for right-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeRightUpCharged->Fill(ptTrig,uexE);
   }
@@ -819,33 +819,31 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for right-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeRightDownCharged->Fill(ptTrig,uexE);
   }
 } 
 
-//______________________________________________________________________________________________________________________________
-void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float_t ptAssoc,     Float_t phiAssoc, 
-                                                                           TLorentzVector mom1, TLorentzVector mom2,
-                                                                           Bool_t bChargedOrNeutral)
+//_____________________________________________________________________________________________________________________________________
+void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float_t ptAssoc, Float_t phiAssoc, Bool_t bChargedOrNeutral)
 {
   // Do correlation with decay photons of triggered pi0 or eta
   
   // Calculate the correlation parameters
-  Float_t ptDecay1 = mom1.Pt();
-  Float_t ptDecay2 = mom2.Pt();
+  Float_t ptDecay1 = fDecayMom1.Pt();
+  Float_t ptDecay2 = fDecayMom2.Pt();
   
   Float_t zTDecay1 = -100, zTDecay2 = -100;
   if(ptDecay1 > 0) zTDecay1 = ptAssoc/ptDecay1 ;
   if(ptDecay2 > 0) zTDecay2 = ptAssoc/ptDecay2 ;
   
-  Float_t deltaPhiDecay1 = mom1.Phi()-phiAssoc;
+  Float_t deltaPhiDecay1 = fDecayMom1.Phi()-phiAssoc;
   if(deltaPhiDecay1< -TMath::PiOver2()) deltaPhiDecay1+=TMath::TwoPi();
   if(deltaPhiDecay1>3*TMath::PiOver2()) deltaPhiDecay1-=TMath::TwoPi();
   
-  Float_t deltaPhiDecay2 = mom2.Phi()-phiAssoc;
+  Float_t deltaPhiDecay2 = fDecayMom2.Phi()-phiAssoc;
   if(deltaPhiDecay2< -TMath::PiOver2()) deltaPhiDecay2+=TMath::TwoPi();
   if(deltaPhiDecay2>3*TMath::PiOver2()) deltaPhiDecay2-=TMath::TwoPi();
   
@@ -857,7 +855,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float
     fhDeltaPhiPi0DecayCharged->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiPi0DecayCharged->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms( Charged corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    AliDebug(2,Form("deltaPhoton1 = %f, deltaPhoton2 = %f", deltaPhiDecay1, deltaPhiDecay2));
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -875,7 +873,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float
     fhDeltaPhiPi0DecayNeutral->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiPi0DecayNeutral->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms(Neutral corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    AliDebug(2,Form("deltaPhoton1 = %f, deltaPhoton2 = %f", deltaPhiDecay1, deltaPhiDecay2));
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -971,20 +969,18 @@ void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
   
   TList * pool = fListMixTrackEvents[eventBin];
   
-  TVector3 p3;  
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    Float_t pt   = p3.Pt();
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    Float_t pt   = fTrackVector.Pt();
     
     //Select only hadrons in pt range
     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
     
-    AliAODPWG4Particle * mixedTrack = new AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
-    mixedTrack->SetDetector("CTS");
+    AliAODPWG4Particle * mixedTrack = new AliAODPWG4Particle(track->Px(),track->Py(),track->Pz(),0);
+    mixedTrack->SetDetectorTag(kCTS);
     mixedTrack->SetChargedBit(track->Charge()>0);
     mixEventTracks->Add(mixedTrack);
   }
@@ -1050,8 +1046,6 @@ void AliAnaParticleHadronCorrelation::FillNeutralEventMixPool()
   
   TList * poolCalo = fListMixCaloEvents[eventBin];
   
-  TLorentzVector mom;
-
   for(Int_t ipr = 0;ipr <  pl->GetEntriesFast() ; ipr ++ )
   {
     AliVCluster * calo = (AliVCluster *) (pl->At(ipr)) ;
@@ -1062,20 +1056,20 @@ void AliAnaParticleHadronCorrelation::FillNeutralEventMixPool()
     //Cluster momentum calculation
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
-      calo->GetMomentum(mom,GetVertex(0)) ;
+      calo->GetMomentum(fMomentum,GetVertex(0)) ;
     }//Assume that come from vertex in straight line
     else
     {
       Double_t vertex[]={0,0,0};
-      calo->GetMomentum(mom,vertex) ;
+      calo->GetMomentum(fMomentum,vertex) ;
     }
     
-    Float_t pt = mom.Pt();
+    Float_t pt = fMomentum.Pt();
     //Select only clusters in pt range
     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
     
-    AliAODPWG4Particle * mixedCalo = new AliAODPWG4Particle(mom);
-    mixedCalo->SetDetector("EMCAL");
+    AliAODPWG4Particle * mixedCalo = new AliAODPWG4Particle(fMomentum);
+    mixedCalo->SetDetectorTag(kEMCAL);
     mixEventCalo->Add(mixedCalo);
   }
   
@@ -1114,17 +1108,15 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
   Float_t phiLeadHad = -100 ;
   Float_t etaLeadHad = -100 ;
   Int_t   nTrack     = 0;
-  TVector3 p3;
 
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
     
-    Float_t pt   = p3.Pt();
-    Float_t phi  = p3.Phi() ;
+    Float_t pt   = fTrackVector.Pt();
+    Float_t phi  = fTrackVector.Phi() ;
     if(phi < 0 ) phi+= TMath::TwoPi();
     
     Float_t deltaPhi = phiTrig-phi;
@@ -1141,7 +1133,7 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
       ptLeadHad  = pt ;
       phiLeadHad = phi;
       dphiLeadHad= deltaPhi;
-      etaLeadHad = p3.Eta();
+      etaLeadHad = fTrackVector.Eta();
       nTrack++;
     }
   }// track loop
@@ -1161,15 +1153,14 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
     }
   }
   
-  if(GetDebug() > 1 )
-  {
-    printf("AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow() pT %2.2f, phi %2.2f, eta %2.2f, nTracks away %d, total tracks %d\n",
-           ptLeadHad,phiLeadHad*TMath::RadToDeg(),etaLeadHad,nTrack, GetTrackMultiplicity());
-    
-    printf("\t  pT trig %2.2f, Dphi (trigger-hadron) %2.2f, Deta (trigger-hadron) %2.2f\n",
-           ptTrig, dphiLeadHad*TMath::RadToDeg(), etaLeadHad-etaTrig);
-    printf("\t cuts pT: min %2.2f, max %2.2f; DPhi: min %2.2f, max %2.2f\n",fMinLeadHadPt,fMaxLeadHadPt,fMinLeadHadPhi*TMath::RadToDeg(),fMaxLeadHadPhi*TMath::RadToDeg());
-  }
+  
+    AliDebug(1,Form("pT %2.2f, phi %2.2f, eta %2.2f, nTracks away %d, total tracks %d",
+                    ptLeadHad,phiLeadHad*TMath::RadToDeg(),etaLeadHad,nTrack, GetTrackMultiplicity()));
+    AliDebug(1,Form("\t pT trig %2.2f, Dphi (trigger-hadron) %2.2f, Deta (trigger-hadron) %2.2f",
+           ptTrig, dphiLeadHad*TMath::RadToDeg(), etaLeadHad-etaTrig));
+    AliDebug(1,Form("\t cuts pT: min %2.2f, max %2.2f; DPhi: min %2.2f, max %2.2f",
+                    fMinLeadHadPt,fMaxLeadHadPt,fMinLeadHadPhi*TMath::RadToDeg(),fMaxLeadHadPhi*TMath::RadToDeg()));
+  
   
   // reject the trigger if the leading hadron is not in the requested pt or phi window and
   
@@ -2569,29 +2560,29 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
       fhMCUePart[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtXEUeCharged[i]  =
-      new TH2F(Form("hMCPtXEUeCharged%s",right.Data()),
-               Form("MC %s: #it{x}_{#it{E}} with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtXEUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #it{x}_{#it{E}} with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nxeztbins,xeztmin,xeztmax);
       fhMCPtXEUeCharged[i]->SetYTitle("#it{x}_{#it{E}}");
       fhMCPtXEUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtHbpXEUeCharged[i] =
-      new TH2F(Form("hMCPtHbpXEUeCharged%s",right.Data()),
-               Form("MC %s: #xi = ln(1/#it{x}_{#it{E}}) with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtHbpXEUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #xi = ln(1/#it{x}_{#it{E}}) with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nhbpbins,hbpmin,hbpmax);
       fhMCPtHbpXEUeCharged[i]->SetYTitle("ln(1/#it{x}_{#it{E}})");
       fhMCPtHbpXEUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtZTUeCharged[i] =
-      new TH2F(Form("hMCPtZTUeCharged%s",right.Data()),
-               Form("MC %s: #it{z}_{T} with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtZTUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #it{z}_{T} with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nxeztbins,xeztmin,xeztmax);
       fhMCPtZTUeCharged[i]->SetYTitle("#it{z}_{T}");
       fhMCPtZTUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtHbpZTUeCharged[i] =
-      new TH2F(Form("hMCPtHbpZTUeCharged%s",right.Data()),
-               Form("MC %s: #xi = ln(1/#it{z}_{T}) with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtHbpZTUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #xi = ln(1/#it{z}_{T}) with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nhbpbins,hbpmin,hbpmax);
       fhMCPtHbpZTUeCharged[i]->SetYTitle("ln(1/#it{z}_{T})");
       fhMCPtHbpZTUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
@@ -2860,35 +2851,29 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   
 }
 
-//_________________________________________________________________________________________________
-Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(AliAODPWG4Particle* trigger,
-                                                               TLorentzVector & mom1,
-                                                               TLorentzVector & mom2)
+//_____________________________________________________________________________________________________________________
+Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(Int_t indexPhoton1, Int_t indexPhoton2, Int_t idetector)
 {
   // Get the momentum of the pi0/eta assigned decay photons
   // In case of pi0/eta trigger, we may want to check their decay correlation,
   // get their decay children
   
-  Int_t indexPhoton1 = trigger->GetCaloLabel(0);
-  Int_t indexPhoton2 = trigger->GetCaloLabel(1);
-  
   if(indexPhoton1!=-1 || indexPhoton2!=-1) return kFALSE;
   
-  if(GetDebug() > 1)
-    printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - indexPhoton1 = %d, indexPhoton2 = %d \n", indexPhoton1, indexPhoton2);
+  AliDebug(1,Form("indexPhoton1 = %d, indexPhoton2 = %d", indexPhoton1, indexPhoton2));
   
   TObjArray * clusters  = 0x0 ;
-  if(trigger->GetDetector()=="EMCAL") clusters = GetEMCALClusters() ;
-  else                                clusters = GetPHOSClusters()  ;
+  if(idetector==kEMCAL) clusters = GetEMCALClusters() ;
+  else                  clusters = GetPHOSClusters()  ;
   
   for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++)
   {
     AliVCluster * photon =  (AliVCluster*) (clusters->At(iclus));
     
-    if(photon->GetID()==indexPhoton1) photon->GetMomentum(mom1,GetVertex(0)) ;
-    if(photon->GetID()==indexPhoton2) photon->GetMomentum(mom1,GetVertex(0)) ;
+    if(photon->GetID()==indexPhoton1) photon->GetMomentum(fDecayMom1,GetVertex(0)) ;
+    if(photon->GetID()==indexPhoton2) photon->GetMomentum(fDecayMom2,GetVertex(0)) ;
     
-    if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - Photon1 = %f, Photon2 = %f \n", mom1.Pt(), mom2.Pt());
+    AliDebug(1,Form("Photon1 = %f, Photon2 = %f", fDecayMom1.Pt(), fDecayMom2.Pt()));
     
   } //cluster loop        
   
@@ -2920,7 +2905,7 @@ void AliAnaParticleHadronCorrelation::Init()
   //Do some checks
   
   if(!GetReader()->IsCTSSwitchedOn())
-    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
+    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!");
 }
 
 //____________________________________________________
@@ -3035,7 +3020,6 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   
   // Compare if it is the leading of all tracks
   
-  TVector3 p3;
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
@@ -3043,10 +3027,9 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
     if(track->GetID() == pLeading->GetTrackLabel(0) || track->GetID() == pLeading->GetTrackLabel(1) ||
        track->GetID() == pLeading->GetTrackLabel(2) || track->GetID() == pLeading->GetTrackLabel(3)   ) continue ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    Float_t pt   = p3.Pt();
-    Float_t phi  = p3.Phi() ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    Float_t pt   = fTrackVector.Pt();
+    Float_t phi  = fTrackVector.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
     
     //jump out this event if near side associated particle pt larger than trigger
@@ -3071,24 +3054,23 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   {
     // Select the calorimeter cluster list
     TObjArray * nePl = 0x0;
-    if      (pLeading->GetDetector() == "PHOS" )
+    if      (pLeading->GetDetectorTag() == kPHOS )
       nePl = GetPHOSClusters();
     else
       nePl = GetEMCALClusters();
     
     if(!nePl) return kTRUE; // Do the selection just with the tracks if no calorimeter is available.
     
-    TLorentzVector lv;
     for(Int_t ipr = 0;ipr < nePl->GetEntriesFast() ; ipr ++ )
     {
       AliVCluster * cluster = (AliVCluster *) (nePl->At(ipr)) ;
       
       if(cluster->GetID() == pLeading->GetCaloLabel(0) || cluster->GetID() == pLeading->GetCaloLabel(1) ) continue ;
       
-      cluster->GetMomentum(lv,GetVertex(0));
+      cluster->GetMomentum(fMomentum,GetVertex(0));
       
-      Float_t pt   = lv.Pt();
-      Float_t phi  = lv.Phi() ;
+      Float_t pt   = fMomentum.Pt();
+      Float_t phi  = fMomentum.Phi() ;
       if(phi < 0) phi+=TMath::TwoPi();
       
       if(IsTrackMatched(cluster,GetReader()->GetInputEvent())) continue ; // avoid charged clusters, already covered by tracks, or cluster merging with track.
@@ -3114,7 +3096,7 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   fLeadingTriggerIndex = index ;
   pLeading->SetLeadingParticle(kTRUE);
 
-  if( GetDebug() > 1 ) printf("\t particle AOD with index %d is leading with pT %2.2f\n", fLeadingTriggerIndex, pLeading->Pt());
+  AliDebug(1,Form("\t particle AOD with index %d is leading with pT %2.2f", fLeadingTriggerIndex, pLeading->Pt()));
   
   return kTRUE;
   
@@ -3127,25 +3109,20 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   
   if(!GetInputAODBranch())
   {
-    AliFatal(Form("No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data()));
+    AliFatal(Form("No input particles in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
     return ; // coverity
   }
   
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
   if( naod == 0 )
   {
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - No particle AOD found! \n");
-    
+    AliWarning("No particle AOD found!");
     return ; // no trigger particles found.
   }
 
-  if(GetDebug() > 1)
-  {
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Begin hadron correlation analysis, fill histograms \n");
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", naod);
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In CTS aod entries %d\n",   GetCTSTracks()->GetEntriesFast());
-  }
+  AliDebug(1,Form("Begin hadron correlation analysis, fill histograms"));
+  AliDebug(1,Form("n particle branch aod entries %d", naod));
+  AliDebug(1,Form("In CTS aod entries %d",GetCTSTracks()->GetEntriesFast()));
   
   //------------------------------------------------------
   // Find leading trigger if analysis request only leading,
@@ -3156,12 +3133,11 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   {
     Bool_t leading = IsTriggerTheEventLeadingParticle();
     
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - AOD Leading trigger? %d, with index %d\n",leading,fLeadingTriggerIndex);
+    AliDebug(1,Form("AOD Leading trigger? %d, with index %d",leading,fLeadingTriggerIndex));
     
     if(!leading)
     {
-      if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading was requested and not found\n");
+      AliDebug(1,"Leading was requested and not found");
       return ;
     }
     else
@@ -3206,22 +3182,25 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     //
     Int_t clID1  = particle->GetCaloLabel(0) ;
     Int_t clID2  = particle->GetCaloLabel(1) ; // for photon clusters should not be set.
-    if( GetDebug() > 1 ) printf("%s Trigger : id1 %d, id2 %d, min %f, max %f, det %s\n",
-           GetInputAODName().Data(),clID1,clID2,fM02MinCut,fM02MaxCut,(particle->GetDetector()).Data());
+    AliDebug(1,Form("%s Trigger : id1 %d, id2 %d, min %f, max %f, det %d",
+                    GetInputAODName().Data(),clID1,clID2,fM02MinCut,fM02MaxCut,particle->GetDetectorTag()));
     
     if(clID1 > 0 && clID2 < 0 && fM02MaxCut > 0 && fM02MinCut > 0)
     {
-      Int_t iclus = -1;
-      TObjArray* clusters = 0x0;
-      if     (particle->GetDetector() == "EMCAL") clusters = GetEMCALClusters();
-      else if(particle->GetDetector() == "PHOS" ) clusters = GetPHOSClusters();
-      
-      if(clusters)
-      {
-        AliVCluster *cluster = FindCluster(clusters,clID1,iclus);
-        Float_t m02 = cluster->GetM02();
-        if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
-      }
+//      Int_t iclus = -1;
+//      TObjArray* clusters = 0x0;
+//      if     (particle->GetDetectorTag() == kEMCAL) clusters = GetEMCALClusters();
+//      else if(particle->GetDetectorTag() == kPHOS ) clusters = GetPHOSClusters();
+//      
+//      if(clusters)
+//      {
+//        AliVCluster *cluster = FindCluster(clusters,clID1,iclus);
+//        Float_t m02 = cluster->GetM02();
+//        if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
+//      }
+      
+      Float_t m02 = particle->GetM02();
+      if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
       
       fhPtTriggerSSCut->Fill(pt);
     }
@@ -3241,7 +3220,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     //
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(*particle->Momentum(),particle->GetDetector()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(particle->Eta(),particle->Phi(),particle->GetDetectorTag()) ;
       if(! in ) continue ;
     }
     
@@ -3302,24 +3281,23 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     
     if(fDecayTrigger)
     {
-      Int_t decayTag = particle->GetBtag(); // temporary
-      if(decayTag > 0)
+      Int_t decayTag = particle->DecayTag();
+      if(decayTag < 0) decayTag = 0;
+      
+      for(Int_t ibit = 0; ibit<fNDecayBits; ibit++)
       {
-        for(Int_t ibit = 0; ibit<fNDecayBits; ibit++)
+        if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
         {
-          if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
+          fhPtDecayTrigger[ibit]->Fill(pt);
+          
+          if(IsDataMC() && mcIndex >=0 && mcIndex < fgkNmcTypes)
           {
-            fhPtDecayTrigger[ibit]->Fill(pt);
-            
-            if(IsDataMC() && mcIndex >=0 && mcIndex < fgkNmcTypes)
-            {
-              fhPtDecayTriggerMC[ibit][mcIndex]->Fill(pt);
-              if(lostDecayPair && mcIndex==2 )
-                fhPtDecayTriggerMC[ibit][7]->Fill(pt);
-            }
+            fhPtDecayTriggerMC[ibit][mcIndex]->Fill(pt);
+            if(lostDecayPair && mcIndex==2 )
+              fhPtDecayTriggerMC[ibit][7]->Fill(pt);
           }
-        }
-      }
+        }// check bit
+      }// bit loop
     }
     
     //
@@ -3366,15 +3344,14 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   //Reinit for next event
   fLeadingTriggerIndex = -1;
   
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
+  AliDebug(1,"End fill histograms");
 }
 
 //_______________________________________________________________________________________________________
 void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle)
 {  
   // Charged Hadron Correlation Analysis
-  if(GetDebug() > 1) 
-    printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n");
+  AliDebug(1,"Make trigger particle - charged hadron correlation");
     
   Float_t phiTrig = aodParticle->Phi();
   Float_t etaTrig = aodParticle->Eta();
@@ -3387,8 +3364,8 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   if(fDecayTrigger)
   {
     //decay = aodParticle->IsTagged();
-    decayTag = aodParticle->GetBtag(); // temporary
-    if(decayTag < 0) decayTag = 0; // temporary
+    decayTag = aodParticle->DecayTag();
+    if(decayTag < 0) decayTag = 0;
 //    printf("Correlation: pT %2.2f, BTag %d, Tagged %d\n",ptTrig, decayTag, aodParticle->IsTagged());
 //    printf("\t check bit Pi0 %d, Eta %d,  Pi0Side %d, EtaSide %d\n",
 //           GetNeutralMesonSelection()->CheckDecayBit(decayTag,AliNeutralMesonSelection::kPi0),
@@ -3402,8 +3379,6 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   Float_t eta      = -100. ;
   Float_t deltaPhi = -100. ;
   
-  TVector3 p3;  
-  TLorentzVector photonMom ;   
   TObjArray * reftracks = 0x0;
   Int_t nrefs           = 0;
   
@@ -3427,16 +3402,15 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   // In case of pi0/eta trigger, we may want to check their decay correlation,
   // get their decay children
   //
-  TLorentzVector decayMom1;
-  TLorentzVector decayMom2;
+
   Bool_t decayFound = kFALSE;
   if( fPi0Trigger )
   {
-    decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);
+    decayFound = GetDecayPhotonMomentum(aodParticle->GetCaloLabel(0),aodParticle->GetCaloLabel(1),aodParticle->GetDetectorTag());
     if(decayFound)
     {
-      fhPtPi0DecayRatio->Fill(ptTrig, decayMom1.Pt()/ptTrig);
-      fhPtPi0DecayRatio->Fill(ptTrig, decayMom2.Pt()/ptTrig);
+      fhPtPi0DecayRatio->Fill(ptTrig, fDecayMom1.Pt()/ptTrig);
+      fhPtPi0DecayRatio->Fill(ptTrig, fDecayMom2.Pt()/ptTrig);
     }
   }
   
@@ -3448,11 +3422,10 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    pt   = p3.Pt();
-    eta  = p3.Eta();
-    phi  = p3.Phi() ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    pt   = fTrackVector.Pt();
+    eta  = fTrackVector.Eta();
+    phi  = fTrackVector.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
     
     //Select only hadrons in pt range
@@ -3475,8 +3448,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         continue;
     }    
     
-     if(GetDebug() > 2 )
-      printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
+     AliDebug(2,Form("Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta));
     
     // ------------------------------
     // Track type bin or bits setting
@@ -3567,7 +3539,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
     
     //
     if(fPi0Trigger && decayFound)
-      FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2, kTRUE) ;
+      FillDecayPhotonCorrelationHistograms(pt, phi, kTRUE) ;
     
     //
     // Add track reference to array
@@ -3600,7 +3572,7 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
 {  
   // Mix current trigger with tracks in another MB event
   
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Make trigger particle - charged hadron mixed event correlation \n");
+  AliDebug(1,Form("Make trigger particle - charged hadron mixed event correlation"));
   
   if(GetMixedEvent()) return;  // This is not the mixed event from general mixing frame
   
@@ -3643,16 +3615,15 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
   if(!pool) return ;
     
   if( neutralMix && !poolCalo )
-    printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Careful, cluster pool not available\n");
+    AliWarning("Careful, cluster pool not available");
   
   Double_t ptTrig  = aodParticle->Pt();
   Double_t etaTrig = aodParticle->Eta();
   Double_t phiTrig = aodParticle->Phi();
   if(phiTrig < 0.) phiTrig+=TMath::TwoPi();
   
-  if(GetDebug() > 1) 
-    printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Pool bin %d size %d, trigger trigger pt=%f, phi=%f, eta=%f\n",
-           eventBin,pool->GetSize(), ptTrig,phiTrig,etaTrig);
+  AliDebug(1,Form("Pool bin %d size %d, trigger trigger pt=%f, phi=%f, eta=%f",
+                  eventBin,pool->GetSize(), ptTrig,phiTrig,etaTrig));
   
   Double_t ptAssoc  = -999.;
   Double_t phiAssoc = -999.;
@@ -3677,12 +3648,11 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
     if( neutralMix && poolCalo )
     {
       if(pool->GetSize()!=poolCalo->GetSize()) 
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Different size of calo and track pools\n");
+        AliWarning("Different size of calo and track pools");
       
       bgCalo = static_cast<TObjArray*>(poolCalo->At(ev));
       
-      if(!bgCalo) 
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Event %d in calo pool not available?\n",ev);
+      if(!bgCalo) AliDebug(1,Form("Event %d in calo pool not available?",ev));
     }
     
     //
@@ -3746,12 +3716,11 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
       }
       
       if( !neutralMix && fCheckLeadingWithNeutralClusters )
-        printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Leading of clusters requested but no clusters in mixed event\n");
+        AliWarning("Leading of clusters requested but no clusters in mixed event");
       
       if(neutralMix && fCheckLeadingWithNeutralClusters && bgCalo)
       {
         Int_t nClusters=bgCalo->GetEntriesFast();
-        TLorentzVector mom ;
         for(Int_t jlead = 0;jlead <nClusters; jlead++ )
         {
           AliAODPWG4Particle *cluster= (AliAODPWG4Particle*) bgCalo->At(jlead) ;
@@ -3820,8 +3789,7 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
       if(deltaPhi > 3*TMath::PiOver2()) deltaPhi-=TMath::TwoPi();
       deltaEta = etaTrig-etaAssoc;
       
-      if(GetDebug()>0)
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation(): deltaPhi= %f, deltaEta=%f\n",deltaPhi, deltaEta);
+      AliDebug(1,Form("deltaPhi= %f, deltaEta=%f",deltaPhi, deltaEta));
       
       // Angular correlation
       fhMixDeltaPhiCharged        ->Fill(ptTrig,   deltaPhi);
@@ -3835,8 +3803,8 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
         xE = -ptAssoc/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
         
         if(xE < 0.)
-          printf("MakeChargedMixCorrelation(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-                 xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+          AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                          xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
         
         fhMixXECharged->Fill(ptTrig,xE);
         if(xE > 0 ) fhMixHbpXECharged->Fill(ptTrig, TMath::Log(1./xE));
@@ -3852,8 +3820,8 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
         Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
         
         if(uexE < 0.)
-          printf("MakeChargedMixCorrelation(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-                 uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+          AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                          uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
         
         fhMixXEUeCharged->Fill(ptTrig,uexE);
       }
@@ -3908,8 +3876,7 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
   Int_t npi0 = pi0list->GetEntriesFast();
   if(npi0 == 0) return ;
   
-  if(GetDebug() > 1)
-    printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Particle - pi0 correlation, %d pi0's\n",npi0);
+  AliDebug(1,Form("Particle - pi0 correlation, %d pi0's",npi0));
   
   Int_t evtIndex11 = 0 ; 
   Int_t evtIndex12 = 0 ; 
@@ -3932,15 +3899,12 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
   Float_t etaTrig = aodParticle->Eta();
   Float_t deltaPhi= -100. ;
   Float_t deltaEta= -100. ;
-
-  TLorentzVector photonMom ;
        
   // In case of pi0/eta trigger, we may want to check their decay correlation, 
   // get their decay children
-  TLorentzVector decayMom1;
-  TLorentzVector decayMom2;
+
   Bool_t decayFound = kFALSE;
-  if(fPi0Trigger) decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);
+  if(fPi0Trigger) decayFound = GetDecayPhotonMomentum(aodParticle->GetCaloLabel(0),aodParticle->GetCaloLabel(1),aodParticle->GetDetectorTag());
   
   TObjArray * refpi0 = 0x0;
   Int_t nrefs        = 0;
@@ -4007,8 +3971,8 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
       xE  =-pt/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
 
       if(xE < 0.)
-        printf("MakeNeutralCorrelation(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-               xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+        AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                        xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
       
       if(xE > 0 ) hbpXE = TMath::Log(1./xE);
       
@@ -4041,7 +4005,7 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
     // Decay photon correlations
     //
     if(fPi0Trigger && decayFound)
-      FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2,kFALSE) ;
+      FillDecayPhotonCorrelationHistograms(pt, phi, kFALSE) ;
     
     if(fFillAODWithReferences)
     {
@@ -4053,10 +4017,9 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
         refpi0->SetOwner(kFALSE);
       }
       refpi0->Add(pi0);
-    }//put references in trigger AOD 
+    } // put references in trigger AOD
     
-    if(GetDebug() > 2 ) 
-      printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Selected pi0: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
+    AliDebug(1,Form("Selected pi0: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta));
     
   }//loop
   
@@ -4072,12 +4035,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
 {
   // Charged Hadron Correlation Analysis with MC information
   
-  if ( GetDebug() > 1 )
-    AliInfo("Make trigger particle - charged hadron correlation in AOD MC level");
+  AliDebug(1,"Make trigger particle - charged hadron correlation in AOD MC level");
   
   if( label < 0 )
   {
-    if( GetDebug() > 0 ) AliInfo(Form(" *** bad label ***:  label %d", label));
+    AliDebug(1,Form(" *** bad label ***:  label %d", label));
     return;
   }
 
@@ -4136,7 +4098,6 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
     for (iParticle = 0 ; iParticle <  nTracks ; iParticle++)
     {
       TParticle * particle = stack->Particle(iParticle);
-      TLorentzVector momentum;
       
       //keep only final state particles
       if( particle->GetStatusCode() != 1 ) continue ;
@@ -4146,11 +4107,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
       Int_t charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
       if(charge == 0) continue;
       
-      particle->Momentum(momentum);
+      particle->Momentum(fMomentum);
       
       //Particles in CTS acceptance, make sure to use the same selection as in the reader
-      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
-      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,momentum.Pt(),momentum.Eta(),momentum.Phi()*TMath::RadToDeg());
+      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS);
+      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,fMomentum.Pt(),fMomentum.Eta(),fMomentum.Phi()*TMath::RadToDeg());
       if( !inCTS ) continue;
       
       // Remove conversions
@@ -4208,11 +4169,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
       
       if ( part->Charge() == 0 ) continue;
       
-      TLorentzVector momentum(part->Px(),part->Py(),part->Pz(),part->E());
+      fMomentum.SetPxPyPzE(part->Px(),part->Py(),part->Pz(),part->E());
       
       //Particles in CTS acceptance, make sure to use the same selection as in the reader
-      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
-      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,momentum.Pt(),momentum.Eta(),momentum.Phi()*TMath::RadToDeg());
+      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS);
+      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,fMomentum.Pt(),fMomentum.Eta(),fMomentum.Phi()*TMath::RadToDeg());
       if( !inCTS ) continue;
       
       // Remove conversions
@@ -4252,9 +4213,8 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
   
   if(!leadTrig && (fMakeAbsoluteLeading || fMakeNearSideLeading) )
   {
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(): Not leading primary trigger: pT %2.2f, phi %2.2f, eta %2.2f\n",
-             ptprim,phiprim*TMath::RadToDeg(),etaprim);
+    AliDebug(1,Form("Not leading primary trigger: pT %2.2f, phi %2.2f, eta %2.2f",
+                    ptprim,phiprim*TMath::RadToDeg(),etaprim));
     
     fhMCPtTriggerNotLeading [histoIndex]->Fill(ptprim);
     fhMCPhiTriggerNotLeading[histoIndex]->Fill(ptprim,phiprim);
@@ -4311,7 +4271,7 @@ void AliAnaParticleHadronCorrelation::SetNAssocPtBins(Int_t n)
   }
   else 
   {
-    printf("n = larger than 19 or too small, set to 19 \n");
+    AliWarning("n = larger than 19 or too small, set to 19");
     fNAssocPtBins = 19;
   }
 }
@@ -4327,7 +4287,7 @@ void AliAnaParticleHadronCorrelation::SetAssocPtBinLimit(Int_t ibin, Float_t pt)
   }
   else 
   {
-    printf("AliAnaParticleHadronCorrelation::SetAssocPtBinLimit() - bin  number too large %d > %d or small, nothing done\n", ibin, fNAssocPtBins) ; 
+    AliWarning(Form("Bin  number too large %d > %d or small, nothing done", ibin, fNAssocPtBins)) ;
   }
 }
 
index 4a6348cd6613a2b641d687098a5c1306497d24b6..600f7cf6b890f6a87c0355b542cd90d7cec1e581 100755 (executable)
@@ -45,7 +45,7 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   
   Bool_t       FindLeadingOppositeHadronInWindow(AliAODPWG4ParticleCorrelation * particle);
   
-  Bool_t       GetDecayPhotonMomentum   (AliAODPWG4Particle* trigger, TLorentzVector & mom1, TLorentzVector & mom2);
+  Bool_t       GetDecayPhotonMomentum   (Int_t indexPhoton1, Int_t indexPhoton2, Int_t idetector);
   
   void         MakeChargedCorrelation   (AliAODPWG4ParticleCorrelation * particle) ;
   
@@ -80,9 +80,7 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   void         FillChargedUnderlyingEventSidesHistograms(Float_t ptTrig,   Float_t ptAssoc, 
                                                          Float_t deltaPhi);
   
-  void         FillDecayPhotonCorrelationHistograms     (Float_t ptAssoc,     Float_t phiAssoc, 
-                                                         TLorentzVector mom1, TLorentzVector mom2, 
-                                                         Bool_t bChargedOrNeutral); 
+  void         FillDecayPhotonCorrelationHistograms     (Float_t ptAssoc,  Float_t phiAssoc, Bool_t bChargedOrNeutral);
   
   void         FillNeutralEventMixPool();
   
@@ -262,6 +260,11 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   Int_t        fMCGenTypeMin;                  // Of the fgkNmcTypes possible types, select those between fMCGenTypeMin and fMCGenTypeMax
   Int_t        fMCGenTypeMax;                  // Of the fgkNmcTypes possible types, select those between fMCGenTypeMin and fMCGenTypeMax
   
+  TVector3       fTrackVector;                 //! track momentum vector
+  TLorentzVector fMomentum;                    //! trigger momentum
+  TLorentzVector fDecayMom1;                   //! decay particle momentum
+  TLorentzVector fDecayMom2;                   //! decay particle momentum
+  
   //Histograms
 
   //trigger particles
index b2ac6d68df34584010a3da1f8a6a39613d3a1d56..aa4af4996c8552915e8580148baafcc2b6435c7b 100755 (executable)
@@ -21,8 +21,7 @@
 //  (see AliRoot versions previous Release 4-09)
 //
 // -- Author: Gustavo Conesa (LNF-INFN)
-
-//-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
+//
 //////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
@@ -59,7 +58,7 @@ ClassImp(AliAnaParticleIsolation)
 //______________________________________________________________________________
 AliAnaParticleIsolation::AliAnaParticleIsolation() :
 AliAnaCaloTrackCorrBaseClass(),
-fIsoDetector(""),
+fIsoDetector(-1),                 fIsoDetectorString(""),
 fReMakeIC(0),                     fMakeSeveralIC(0),
 fFillTMHisto(0),                  fFillSSHisto(1),
 fFillUEBandSubtractHistograms(1), fFillCellHistograms(0),
@@ -75,6 +74,9 @@ fMinCellsAngleOverlap(0),
 fNCones(0),                       fNPtThresFrac(0),
 fConeSizes(),                     fPtThresholds(),
 fPtFractions(),                   fSumPtThresholds(),
+fMomentum(),                      fMomIso(),
+fMomDaugh1(),                     fMomDaugh2(),
+fTrackVector(),
 // Histograms
 fhEIso(0),                        fhPtIso(0),
 fhPtCentralityIso(0),             fhPtEventPlaneIso(0),
@@ -258,8 +260,8 @@ fhTimePileUpMainVertexZDistance(0), fhTimePileUpMainVertexZDiamond(0)
   {
     fhTrackMatchedDEta[i] = 0 ;             fhTrackMatchedDPhi[i] = 0 ;   fhTrackMatchedDEtaDPhi  [i] = 0 ;
     fhdEdx            [i] = 0 ;             fhEOverP          [i] = 0 ;   fhTrackMatchedMCParticle[i] = 0 ;
-    fhELambda0        [i] = 0 ;             fhELambda1        [i] = 0 ;   fhPtLambda0       [i] = 0 ;
-    fhELambda0TRD     [i] = 0 ;             fhELambda1TRD     [i] = 0 ;   fhPtLambda0TRD    [i] = 0 ;
+    fhELambda0        [i] = 0 ;             fhPtLambda0       [i] = 0 ;   //fhELambda1        [i] = 0 ;
+    fhELambda0TRD     [i] = 0 ;             fhPtLambda0TRD    [i] = 0 ;   //fhELambda1TRD     [i] = 0 ;
     
     // Number of local maxima in cluster
     fhNLocMax        [i] = 0 ;
@@ -299,13 +301,12 @@ void AliAnaParticleIsolation::CalculateCaloUEBand(AliAODPWG4ParticleCorrelation
   if( GetIsolationCut()->GetParticleTypeInCone()==AliIsolationCut::kOnlyCharged ) return ;
   
   Float_t conesize   = GetIsolationCut()->GetConeSize();
-  TLorentzVector mom ;
   
   //Select the Calorimeter
   TObjArray * pl = 0x0;
-  if      (GetCalorimeter() == "PHOS" )
+  if      (GetCalorimeter() == kPHOS )
     pl    = GetPHOSClusters();
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
     pl    = GetEMCALClusters();
   
   if(!pl) return ;
@@ -323,9 +324,9 @@ void AliAnaParticleIsolation::CalculateCaloUEBand(AliAODPWG4ParticleCorrelation
   {
     AliVCluster* cluster = (AliVCluster *) pl->At(icluster);
     
-    if(!cluster)
+    if ( !cluster )
     {
-      printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Cluster not available?");
+      AliWarning("Cluster not available?");
       continue;
     }
     
@@ -337,31 +338,31 @@ void AliAnaParticleIsolation::CalculateCaloUEBand(AliAODPWG4ParticleCorrelation
     if( GetIsolationCut()->GetParticleTypeInCone()==AliIsolationCut::kNeutralAndCharged &&
        IsTrackMatched(cluster,GetReader()->GetInputEvent())) continue ;
     
-    cluster->GetMomentum(mom,vertex) ;//Assume that come from vertex in straight line
+    cluster->GetMomentum(fMomentum,vertex) ;//Assume that come from vertex in straight line
     
     //exclude particles in cone
-    Float_t rad = GetIsolationCut()->Radius(etaTrig, phiTrig, mom.Eta(), mom.Phi());
+    Float_t rad = GetIsolationCut()->Radius(etaTrig, phiTrig, fMomentum.Eta(), fMomentum.Phi());
     
     // histo of eta and phi for all clusters
-    fhEtaPhiCluster->Fill(mom.Eta(), mom.Phi());
+    fhEtaPhiCluster->Fill(fMomentum.Eta(), fMomentum.Phi());
     if(rad < conesize) {
        // histos for all clusters in cone
-      fhEtaPhiInConeCluster->Fill(mom.Eta(), mom.Phi());
+      fhEtaPhiInConeCluster->Fill(fMomentum.Eta(), fMomentum.Phi());
       continue ;
     }
     //fill histogram for UE in phi band in EMCal acceptance
-    if(mom.Eta() > (etaTrig-conesize) && mom.Eta()  < (etaTrig+conesize))
+    if(fMomentum.Eta() > (etaTrig-conesize) && fMomentum.Eta()  < (etaTrig+conesize))
     {
-      phiBandPtSum+=mom.Pt();
-      fhPhiBandCluster->Fill(mom.Eta(),mom.Phi());
+      phiBandPtSum+=fMomentum.Pt();
+      fhPhiBandCluster->Fill(fMomentum.Eta(),fMomentum.Phi());
       
     }
     
     //fill histogram for UE in eta band in EMCal acceptance
-    if(mom.Phi() > (phiTrig-conesize) && mom.Phi() < (phiTrig+conesize))
+    if(fMomentum.Phi() > (phiTrig-conesize) && fMomentum.Phi() < (phiTrig+conesize))
     {
-      etaBandPtSum+=mom.Pt();
-      fhEtaBandCluster->Fill(mom.Eta(),mom.Phi());
+      etaBandPtSum+=fMomentum.Pt();
+      fhEtaBandCluster->Fill(fMomentum.Eta(),fMomentum.Phi());
     }
   }
   
@@ -386,7 +387,7 @@ void AliAnaParticleIsolation::CalculateCaloCellUEBand(AliAODPWG4ParticleCorrelat
   if(phiTrig<0) phiTrig += TMath::TwoPi();
   Float_t etaTrig = pCandidate->Eta();
   
-  if(pCandidate->GetDetector()=="EMCAL")
+  if(pCandidate->GetDetectorTag()==kEMCAL)
   {
     AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
     Int_t absId = -999;
@@ -496,7 +497,11 @@ void AliAnaParticleIsolation::CalculateCaloCellUEBand(AliAODPWG4ParticleCorrelat
             }
             
             Int_t iabsId = eGeom->GetAbsCellIdFromCellIndexes(inSupMod,irowLoc,icolLoc);
-            if(!eGeom->CheckAbsCellId(iabsId)) {printf("!eGeom->CheckAbsCellId(iabsId=%i) inSupMod %i irowLoc %i icolLoc %i \n",iabsId,inSupMod, irowLoc, icolLoc);continue;}
+            if(!eGeom->CheckAbsCellId(iabsId))
+            {
+              AliWarning(Form("!eGeom->CheckAbsCellId(iabsId=%i) inSupMod %i irowLoc %i icolLoc %i",iabsId,inSupMod, irowLoc, icolLoc));
+              continue;
+            }
             phiBandPtSumCells += cells->GetCellAmplitude(iabsId);
             fhPhiBandCell->Fill(colTrig,rowTrig);
             //printf("inSupMod %i,irowLoc %i,icolLoc %i, iabsId %i, phiBandPtSumCells %f\n",nSupMod,irowLoc,icolLoc,iabsId,phiBandPtSumCells);
@@ -537,7 +542,7 @@ void AliAnaParticleIsolation::CalculateTrackUEBand(AliAODPWG4ParticleCorrelation
     
     if(!track)
     {
-      printf("AliAnaParticleIsolation::CalculateTrackUEBand() - Track not available?");
+      AliWarning("Track not available?");
       continue;
     }
     
@@ -897,30 +902,32 @@ void AliAnaParticleIsolation::CalculateCaloSignalInCone(AliAODPWG4ParticleCorrel
   if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     GetReader()->GetVertex(vertex);
   
-  TLorentzVector mom ;
+  Float_t ptcone = 0;
+  
   for(Int_t icalo=0; icalo < refclusters->GetEntriesFast(); icalo++)
   {
     AliVCluster* calo = (AliVCluster *) refclusters->At(icalo);
-    calo->GetMomentum(mom,vertex) ;//Assume that come from vertex in straight line
+    calo->GetMomentum(fMomentum,vertex) ;//Assume that come from vertex in straight line
+    ptcone = fMomentum.Pt();
     
-    fhPtInCone       ->Fill(ptTrig, mom.Pt());
-    fhPtClusterInCone->Fill(ptTrig, mom.Pt());
+    fhPtInCone       ->Fill(ptTrig, ptcone);
+    fhPtClusterInCone->Fill(ptTrig, ptcone);
     
     if(IsPileUpAnalysisOn())
     {
-      if(GetReader()->IsPileUpFromSPD())               fhPtInConePileUp[0]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromEMCal())             fhPtInConePileUp[1]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromSPDOrEMCal())        fhPtInConePileUp[2]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromSPDAndEMCal())       fhPtInConePileUp[3]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromSPDAndNotEMCal())    fhPtInConePileUp[4]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromEMCalAndNotSPD())    fhPtInConePileUp[5]->Fill(ptTrig,mom.Pt());
-      if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtInConePileUp[6]->Fill(ptTrig,mom.Pt());
+      if(GetReader()->IsPileUpFromSPD())               fhPtInConePileUp[0]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromEMCal())             fhPtInConePileUp[1]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromSPDOrEMCal())        fhPtInConePileUp[2]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromSPDAndEMCal())       fhPtInConePileUp[3]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromSPDAndNotEMCal())    fhPtInConePileUp[4]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromEMCalAndNotSPD())    fhPtInConePileUp[5]->Fill(ptTrig,ptcone);
+      if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtInConePileUp[6]->Fill(ptTrig,ptcone);
     }
     
-    if(IsHighMultiplicityAnalysisOn()) fhPtInConeCent->Fill(GetEventCentrality(),mom.Pt());
+    if(IsHighMultiplicityAnalysisOn()) fhPtInConeCent->Fill(GetEventCentrality(),ptcone);
     
-    coneptsumCluster+=mom.Pt();
-    if(mom.Pt() > coneptLeadCluster) coneptLeadCluster = mom.Pt();
+    coneptsumCluster+=ptcone;
+    if(ptcone > coneptLeadCluster) coneptLeadCluster = ptcone;
   }
   
   fhConeSumPtCluster ->Fill(ptTrig, coneptsumCluster );
@@ -943,7 +950,7 @@ void AliAnaParticleIsolation::CalculateCaloCellSignalInCone(AliAODPWG4ParticleCo
   if(phiTrig<0) phiTrig += TMath::TwoPi();
   Float_t  etaTrig = aodParticle->Eta();
   
-  if(aodParticle->GetDetector()=="EMCAL")
+  if(aodParticle->GetDetectorTag()==kEMCAL)
   {
     AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
     Int_t absId = -999;
@@ -1072,16 +1079,16 @@ void AliAnaParticleIsolation::FillPileUpHistograms(Int_t clusterID)
 {
   // Fill some histograms to understand pile-up
   
-  if(clusterID < 0 )
+  if ( clusterID < 0 )
   {
-    printf("AliAnaParticleIsolation::FillPileUpHistograms(), ID of cluster = %d, not possible! ", clusterID);
+    AliWarning(Form("ID of cluster = %d, not possible!", clusterID));
     return;
   }
   
   Int_t iclus = -1;
   TObjArray* clusters = 0x0;
-  if     (GetCalorimeter() == "EMCAL") clusters = GetEMCALClusters();
-  else if(GetCalorimeter() == "PHOS" ) clusters = GetPHOSClusters();
+  if     (GetCalorimeter() == kEMCAL) clusters = GetEMCALClusters();
+  else if(GetCalorimeter() == kPHOS ) clusters = GetPHOSClusters();
   
   Float_t energy = 0;
   Float_t time   = -1000;
@@ -1169,26 +1176,17 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
   if(!fFillTMHisto && !fFillSSHisto && !fFillBackgroundBinHistograms && !fFillTaggedDecayHistograms) return;
   
   Int_t  clusterID = pCandidate->GetCaloLabel(0) ;
-  Int_t  nMaxima   = pCandidate->GetFiducialArea(); // bad name, just place holder for the moment
+  Int_t  nMaxima   = pCandidate->GetNLM();
   Int_t  mcTag     = pCandidate->GetTag() ;
   Bool_t isolated  = pCandidate->IsIsolated();
   
-  if(clusterID < 0 )
+  if ( clusterID < 0 )
   {
-    printf("AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(), ID of cluster = %d, not possible! \n", clusterID);
+    AliWarning(Form("ID of cluster = %d, not possible!", clusterID));
     return;
   }
-  
-  Int_t iclus = -1;
-  TObjArray* clusters = 0x0;
-  if     (GetCalorimeter() == "EMCAL") clusters = GetEMCALClusters();
-  else if(GetCalorimeter() == "PHOS" ) clusters = GetPHOSClusters();
-  
-  if(!clusters) return;
-  
-  AliVCluster *cluster = FindCluster(clusters,clusterID,iclus);
 
-  Float_t m02    = cluster->GetM02() ;
+  Float_t m02    = pCandidate->GetM02() ;
   Float_t energy = pCandidate->E();
   Float_t pt     = pCandidate->Pt();
   Float_t eta    = pCandidate->Eta();
@@ -1198,8 +1196,8 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
   // Candidates tagged as decay in another analysis (AliAnaPi0EbE)
   if(fFillTaggedDecayHistograms)
   {
-    Int_t decayTag = pCandidate->GetBtag(); // temporary
-    if(decayTag < 0) decayTag = 0; // temporary
+    Int_t decayTag = pCandidate->DecayTag();
+    if(decayTag < 0) decayTag = 0;
 
     for(Int_t ibit = 0; ibit < fNDecayBits; ibit++)
     {
@@ -1237,9 +1235,7 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
     Int_t ptsumBin  = -1;
     Int_t leadptBin = -1;
     
-    if( GetDebug() > 1 )
-      printf("AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms() - pT cand: %2.2f, In cone pT: Sum %2.2f, Lead %2.2f, n bins %d\n",
-             pt,coneptsum,coneleadpt,fNBkgBin);
+    AliDebug(1,Form("pT cand: %2.2f, In cone pT: Sum %2.2f, Lead %2.2f, n bins %d",pt,coneptsum,coneleadpt,fNBkgBin));
     
     for(Int_t ibin = 0; ibin < fNBkgBin; ibin++)
     {
@@ -1248,17 +1244,21 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
     }
     
     // Fill the histograms per bin of pt lead or pt sum
-    if( GetDebug() > 1 && ptsumBin  >=0 ) printf("\t Sum bin %d [%2.2f,%2.2f]\n" , ptsumBin ,fBkgBinLimit[ptsumBin] ,fBkgBinLimit[ptsumBin +1]);
-    if( GetDebug() > 1 && leadptBin >=0 ) printf("\t Lead bin %d [%2.2f,%2.2f]\n", leadptBin,fBkgBinLimit[leadptBin],fBkgBinLimit[leadptBin+1]);
     
-    if( leadptBin >=0 )
+    if ( leadptBin >= 0 )
     {
+      AliDebug(1,Form("\t Lead bin %d [%2.2f,%2.2f]", leadptBin,fBkgBinLimit[leadptBin],fBkgBinLimit[leadptBin+1]));
       fhPtLeadConeBin[leadptBin]->Fill(pt);
       if(fFillSSHisto) fhPtLeadConeBinLambda0[leadptBin]->Fill(pt,m02);
+      
+      if ( leadptBin == 0 )
+        AliDebug(1,Form("No track/clusters in isolation cone: cand pt %2.2f GeV/c, track multiplicity %d, N clusters %d",
+                        pt, GetTrackMultiplicity(),GetEMCALClusters()->GetEntriesFast()));
     }
     
-    if( ptsumBin  >=0 )
+    if ( ptsumBin  >= 0 )
     {
+      AliDebug(1,Form("\t Sum bin %d [%2.2f,%2.2f]" , ptsumBin ,fBkgBinLimit[ptsumBin] ,fBkgBinLimit[ptsumBin +1]));
       fhSumPtConeBin[ptsumBin]->Fill(pt);
       if(fFillSSHisto) fhSumPtConeBinLambda0[ptsumBin]->Fill(pt,m02);
     }
@@ -1266,8 +1266,8 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
     // Check if it was a decay
     if(fFillTaggedDecayHistograms && m02 < 0.3)
     {
-      Int_t decayTag = pCandidate->GetBtag(); // temporary
-      if(decayTag < 0) decayTag = 0;    // temporary
+      Int_t decayTag = pCandidate->DecayTag();
+      if(decayTag < 0) decayTag = 0;
       for(Int_t ibit = 0; ibit < fNDecayBits; ibit++)
       {
         if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
@@ -1280,10 +1280,6 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
       }
     }
     
-    if( GetDebug() > 1 && leadptBin == 0 )
-      printf("No track/clusters in isolation cone: cand pt %2.2f GeV/c, track multiplicity %d, N clusters %d\n",
-             pt, GetTrackMultiplicity(),GetEMCALClusters()->GetEntriesFast());
-    
     if(IsDataMC())
     {
       Int_t leadptBinMC = leadptBin+mcIndex*fNBkgBin;
@@ -1332,10 +1328,11 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
     }
     
     // Fill the histograms per pT candidate bin of pt lead or pt sum
-    if( GetDebug() > 1 && ptTrigBin  >=0 ) printf("Trigger pT %f, bin %d [%2.2f,%2.2f]\n" , pt , ptTrigBin, fPtTrigBinLimit[ptTrigBin] ,fPtTrigBinLimit[ptTrigBin +1]);
     
-    if( ptTrigBin >=0 )
+    if ( ptTrigBin >= 0 )
     {
+      AliDebug(1,Form("Trigger pT %f, bin %d [%2.2f,%2.2f]",pt,ptTrigBin,fPtTrigBinLimit[ptTrigBin],fPtTrigBinLimit[ptTrigBin+1]));
+
       fhPtTrigBinPtLeadCone[ptTrigBin]->Fill(coneleadpt);
       fhPtTrigBinSumPtCone [ptTrigBin]->Fill(coneptsum );
       if(fFillSSHisto)
@@ -1348,8 +1345,8 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
     // Check if it was a decay
     if( fFillTaggedDecayHistograms && m02 < 0.3 )
     {
-      Int_t decayTag = pCandidate->GetBtag(); // temporary
-      if(decayTag < 0) decayTag = 0;    // temporary
+      Int_t decayTag = pCandidate->DecayTag();
+      if(decayTag < 0) decayTag = 0;
       for(Int_t ibit = 0; ibit < fNDecayBits; ibit++)
       {
         if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
@@ -1401,7 +1398,7 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
   {
     fhELambda0 [isolated]->Fill(energy, m02);
     fhPtLambda0[isolated]->Fill(pt,     m02);
-    fhELambda1 [isolated]->Fill(energy, m02);
+    //fhELambda1 [isolated]->Fill(energy, m20);
     
     if(IsDataMC())
     {
@@ -1414,12 +1411,12 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
       fhPtLambda0MC[mcIndex][isolated]->Fill(pt,m02);
     }
     
-    if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
-       GetModuleNumber(cluster) >= GetFirstSMCoveredByTRD()  )
+    if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
+       GetModuleNumber(pCandidate) >= GetFirstSMCoveredByTRD()  )
     {
       fhELambda0TRD [isolated]->Fill(energy, m02 );
       fhPtLambda0TRD[isolated]->Fill(pt    , m02 );
-      fhELambda1TRD [isolated]->Fill(energy, m02 );
+      //fhELambda1TRD [isolated]->Fill(energy, m20 );
     }
     
     if(fFillNLMHistograms)
@@ -1434,6 +1431,15 @@ void AliAnaParticleIsolation::FillTrackMatchingShowerShapeControlHistograms(AliA
   // Track matching dependent histograms
   if(fFillTMHisto)
   {
+    Int_t iclus = -1;
+    TObjArray* clusters = 0x0;
+    if     (GetCalorimeter() == kEMCAL) clusters = GetEMCALClusters();
+    else if(GetCalorimeter() == kPHOS ) clusters = GetPHOSClusters();
+    
+    if(!clusters) return;
+    
+    AliVCluster *cluster = FindCluster(clusters,clusterID,iclus);
+    
     Float_t dZ  = cluster->GetTrackDz();
     Float_t dR  = cluster->GetTrackDx();
     
@@ -1505,46 +1511,46 @@ TObjString *  AliAnaParticleIsolation::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar, buffersize,"--- AliAnaParticleIsolation ---\n") ;
+  snprintf(onePar, buffersize,"--- AliAnaParticleIsolation ---:") ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"Calorimeter: %s\n",GetCalorimeter().Data()) ;
+  snprintf(onePar, buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"Isolation Cand Detector: %s\n",fIsoDetector.Data()) ;
+  snprintf(onePar, buffersize,"Isolation Cand Detector: %s;",fIsoDetectorString.Data()) ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"fReMakeIC =%d (Flag for reisolation during histogram filling) \n",fReMakeIC) ;
+  snprintf(onePar, buffersize,"fReMakeIC =%d (Flag for reisolation during histogram filling);",fReMakeIC) ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"fMakeSeveralIC=%d (Flag for isolation with several cuts at the same time ) \n",fMakeSeveralIC) ;
+  snprintf(onePar, buffersize,"fMakeSeveralIC=%d (Flag for isolation with several cuts at the same time );",fMakeSeveralIC) ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"fFillTMHisto=%d (Flag for track matching histograms) \n",fFillTMHisto) ;
+  snprintf(onePar, buffersize,"fFillTMHisto=%d (Flag for track matching histograms);",fFillTMHisto) ;
   parList+=onePar ;
-  snprintf(onePar, buffersize,"fFillSSHisto=%d (Flag for shower shape histograms) \n",fFillSSHisto) ;
+  snprintf(onePar, buffersize,"fFillSSHisto=%d (Flag for shower shape histograms);",fFillSSHisto) ;
   parList+=onePar ;
   
   if(fMakeSeveralIC)
   {
-    snprintf(onePar, buffersize,"fNCones =%d (Number of cone sizes) \n",fNCones) ;
+    snprintf(onePar, buffersize,"fNCones =%d (Number of cone sizes);",fNCones) ;
     parList+=onePar ;
-    snprintf(onePar, buffersize,"fNPtThresFrac=%d (Flag for isolation with several cuts at the same time ) \n",fNPtThresFrac) ;
+    snprintf(onePar, buffersize,"fNPtThresFrac=%d (Flag for isolation with several cuts at the same time);",fNPtThresFrac) ;
     parList+=onePar ;
     
     for(Int_t icone = 0; icone < fNCones ; icone++)
     {
-      snprintf(onePar, buffersize,"fConeSizes[%d]=%1.2f (isolation cone size) \n",icone, fConeSizes[icone]) ;
+      snprintf(onePar, buffersize,"fConeSizes[%d]=%1.2f (isolation cone size);",icone, fConeSizes[icone]) ;
       parList+=onePar ;
     }
     for(Int_t ipt = 0; ipt < fNPtThresFrac ; ipt++)
     {
-      snprintf(onePar, buffersize,"fPtThresholds[%d]=%1.2f (isolation pt threshold) \n",ipt, fPtThresholds[ipt]) ;
+      snprintf(onePar, buffersize,"fPtThresholds[%d]=%1.2f (isolation pt threshold);",ipt, fPtThresholds[ipt]) ;
       parList+=onePar ;
     }
     for(Int_t ipt = 0; ipt < fNPtThresFrac ; ipt++)
     {
-      snprintf(onePar, buffersize,"fPtFractions[%d]=%1.2f (isolation pt fraction threshold) \n",ipt, fPtFractions[ipt]) ;
+      snprintf(onePar, buffersize,"fPtFractions[%d]=%1.2f (isolation pt fraction threshold);",ipt, fPtFractions[ipt]) ;
       parList+=onePar ;
     }
     for(Int_t ipt = 0; ipt < fNPtThresFrac ; ipt++)
     {
-      snprintf(onePar, buffersize,"fSumPtThresholds[%d]=%1.2f (isolation sum pt threshold) \n",ipt, fSumPtThresholds[ipt]) ;
+      snprintf(onePar, buffersize,"fSumPtThresholds[%d]=%1.2f (isolation sum pt threshold);",ipt, fSumPtThresholds[ipt]) ;
       parList+=onePar ;
     }
   }
@@ -3001,12 +3007,12 @@ TList *  AliAnaParticleIsolation::GetCreateOutputObjects()
         fhELambda0[iso]->SetXTitle("#it{E} (GeV)");
         outputContainer->Add(fhELambda0[iso]) ;
         
-        fhELambda1[iso]  = new TH2F
-        (Form("hELambda1%s",isoName[iso].Data()),
-         Form("%s cluster: #it{E} vs #lambda_{1}, %s",isoTitle[iso].Data(),parTitle.Data()),nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
-        fhELambda1[iso]->SetYTitle("#lambda_{1}^{2}");
-        fhELambda1[iso]->SetXTitle("#it{E} (GeV)");
-        outputContainer->Add(fhELambda1[iso]) ;
+//        fhELambda1[iso]  = new TH2F
+//        (Form("hELambda1%s",isoName[iso].Data()),
+//         Form("%s cluster: #it{E} vs #lambda_{1}, %s",isoTitle[iso].Data(),parTitle.Data()),nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
+//        fhELambda1[iso]->SetYTitle("#lambda_{1}^{2}");
+//        fhELambda1[iso]->SetXTitle("#it{E} (GeV)");
+//        outputContainer->Add(fhELambda1[iso]) ;
         
         fhPtLambda0[iso]  = new TH2F
         (Form("hPtLambda0%s",isoName[iso].Data()),
@@ -3028,7 +3034,7 @@ TList *  AliAnaParticleIsolation::GetCreateOutputObjects()
           }
         }
         
-        if(fIsoDetector=="EMCAL" &&  GetFirstSMCoveredByTRD() >= 0)
+        if(fIsoDetector==kEMCAL &&  GetFirstSMCoveredByTRD() >= 0)
         {
           fhPtLambda0TRD[iso]  = new TH2F
           (Form("hPtLambda0TRD%s",isoName[iso].Data()),
@@ -3044,12 +3050,12 @@ TList *  AliAnaParticleIsolation::GetCreateOutputObjects()
           fhELambda0TRD[iso]->SetXTitle("#it{E} (GeV)");
           outputContainer->Add(fhELambda0TRD[iso]) ;
           
-          fhELambda1TRD[iso]  = new TH2F
-          (Form("hELambda1TRD%s",isoName[iso].Data()),
-           Form("%s cluster: #it{E} vs #lambda_{1}, SM behind TRD, %s",isoTitle[iso].Data(),parTitle.Data()),nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
-          fhELambda1TRD[iso]->SetYTitle("#lambda_{1}^{2}");
-          fhELambda1TRD[iso]->SetXTitle("#it{E} (GeV)");
-          outputContainer->Add(fhELambda1TRD[iso]) ;
+//          fhELambda1TRD[iso]  = new TH2F
+//          (Form("hELambda1TRD%s",isoName[iso].Data()),
+//           Form("%s cluster: #it{E} vs #lambda_{1}, SM behind TRD, %s",isoTitle[iso].Data(),parTitle.Data()),nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
+//          fhELambda1TRD[iso]->SetYTitle("#lambda_{1}^{2}");
+//          fhELambda1TRD[iso]->SetXTitle("#it{E} (GeV)");
+//          outputContainer->Add(fhELambda1TRD[iso]) ;
         }
         
         if(fFillNLMHistograms)
@@ -3677,14 +3683,14 @@ void AliAnaParticleIsolation::Init()
   // The different cones, thresholds are tested for this list of tracks, clusters.
   if(fMakeSeveralIC)
   {
-    printf("AliAnaParticleIsolation::Init() - Open default isolation cuts for multiple Isolation analysis\n");
+    AliInfo("Open default isolation cuts for multiple Isolation analysis");
     GetIsolationCut()->SetPtThreshold(100);
     GetIsolationCut()->SetPtFraction(100);
     GetIsolationCut()->SetConeSize(1);
   }
   
   if(!GetReader()->IsCTSSwitchedOn() && GetIsolationCut()->GetParticleTypeInCone()!=AliIsolationCut::kOnlyNeutral)
-    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
+    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!");
   
 }
 
@@ -3697,7 +3703,8 @@ void AliAnaParticleIsolation::InitParameters()
   SetAODObjArrayName("IsolationCone");
   AddToHistogramsName("AnaIsolation_");
   
-  fIsoDetector = "EMCAL" ;
+  fIsoDetectorString = "EMCAL" ;
+  fIsoDetector       = kEMCAL  ;
   
   fReMakeIC = kFALSE ;
   fMakeSeveralIC = kFALSE ;
@@ -3788,7 +3795,6 @@ Bool_t AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle(Int_t &
   
   // Compare if it is the leading of all tracks
   
-  TVector3 p3;
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
@@ -3796,10 +3802,9 @@ Bool_t AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle(Int_t &
     if(track->GetID() == pLeading->GetTrackLabel(0) || track->GetID() == pLeading->GetTrackLabel(1) ||
        track->GetID() == pLeading->GetTrackLabel(2) || track->GetID() == pLeading->GetTrackLabel(3)   ) continue ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    Float_t pt   = p3.Pt();
-    Float_t phi  = p3.Phi() ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    Float_t pt   = fTrackVector.Pt();
+    Float_t phi  = fTrackVector.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
     
     //skip this event if near side associated particle pt larger than trigger
@@ -3823,24 +3828,23 @@ Bool_t AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle(Int_t &
   {
     // Select the calorimeter cluster list
     TObjArray * nePl = 0x0;
-    if      (pLeading->GetDetector() == "PHOS" )
+    if      (pLeading->GetDetectorTag() == kPHOS )
       nePl = GetPHOSClusters();
     else
       nePl = GetEMCALClusters();
     
     if(!nePl) return kTRUE; // Do the selection just with the tracks if no calorimeter is available.
     
-    TLorentzVector lv;
     for(Int_t ipr = 0;ipr < nePl->GetEntriesFast() ; ipr ++ )
     {
       AliVCluster * cluster = (AliVCluster *) (nePl->At(ipr)) ;
       
       if(cluster->GetID() == pLeading->GetCaloLabel(0) || cluster->GetID() == pLeading->GetCaloLabel(1) ) continue ;
       
-      cluster->GetMomentum(lv,GetVertex(0));
+      cluster->GetMomentum(fMomentum,GetVertex(0));
       
-      Float_t pt   = lv.Pt();
-      Float_t phi  = lv.Phi() ;
+      Float_t pt   = fMomentum.Pt();
+      Float_t phi  = fMomentum.Phi() ;
       if(phi < 0) phi+=TMath::TwoPi();
       
       if(IsTrackMatched(cluster,GetReader()->GetInputEvent())) continue ; // avoid charged clusters, already covered by tracks, or cluster merging with track.
@@ -3860,9 +3864,7 @@ Bool_t AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle(Int_t &
   idLeading = index ;
   pLeading->SetLeadingParticle(kTRUE);
   
-  if( GetDebug() > 1 )
-    printf("AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle() - Particle AOD with index %d is leading with pT %2.2f\n",
-           idLeading, pLeading->Pt());
+  AliDebug(1,Form("Particle AOD with index %d is leading with pT %2.2f",idLeading, pLeading->Pt()));
   
   return kTRUE;
   
@@ -3879,7 +3881,8 @@ void  AliAnaParticleIsolation::MakeAnalysisFillAOD()
     AliFatal(Form("No input particles in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
   
   if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation"))
-    AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName()));
+    AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s>",
+                  GetInputAODBranch()->GetClass()->GetName()));
   
   Int_t n = 0, nfrac = 0;
   Bool_t  isolated  = kFALSE ;
@@ -3887,26 +3890,24 @@ void  AliAnaParticleIsolation::MakeAnalysisFillAOD()
   TObjArray * pl    = 0x0; ;
   
   //Select the calorimeter for candidate isolation with neutral particles
-  if      (GetCalorimeter() == "PHOS" )
+  if      (GetCalorimeter() == kPHOS )
     pl = GetPHOSClusters();
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
     pl = GetEMCALClusters();
   
   //Loop on AOD branch, filled previously in AliAnaPhoton, find leading particle to do isolation only with it
-  TLorentzVector mom ;
   Int_t idLeading = -1 ;
   Int_t iaod0 = 0;
   Int_t naod  = GetInputAODBranch()->GetEntriesFast();
   
-  if(GetDebug() > 0)
-    printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - Input aod branch entries %d\n", naod);
+  AliDebug(1,Form("Input aod branch entries %d", naod));
   
   if(IsLeadingOnlyOn())
   {
     Bool_t leading = IsTriggerTheNearSideEventLeadingParticle(idLeading);
     if(!leading)
     {
-      if(GetDebug() > 1) printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - Not leading; End fill AODs \n");
+      AliDebug(1,"Not leading; End fill AODs");
       return;
     }
     iaod0 = idLeading  ; // first entry in particle loop
@@ -3923,7 +3924,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillAOD()
     
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(*aodinput->Momentum(),aodinput->GetDetector()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(aodinput->Eta(), aodinput->Phi(), aodinput->GetDetectorTag()) ;
       if(! in ) continue ;
     }
     
@@ -3948,11 +3949,8 @@ void  AliAnaParticleIsolation::MakeAnalysisFillAOD()
     
     if(!fMakeSeveralIC) aodinput->SetIsolated(isolated);
 
-    if(GetDebug() > 1)
-    {
-      if(isolated) printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() : Particle %d IS ISOLATED \n",iaod);
-      printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - End fill AODs \n");
-    }
+    AliDebug(1,Form("Particle isolated? %i; if so with index %d",isolated,iaod));
+    
 
   } // particle isolation loop
   
@@ -3969,8 +3967,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
   
   //Loop on stored AOD
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0)
-    printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Histo aod branch entries %d\n", naod);
+  AliDebug(1,Form("Histo aod branch entries %d", naod));
   
   for(Int_t iaod = 0; iaod < naod ; iaod++)
   {
@@ -3981,7 +3978,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     // Check isolation only of clusters in fiducial region
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(*aod->Momentum(),aod->GetDetector()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(aod->Eta(),aod->Phi(),aod->GetDetectorTag()) ;
       if(! in ) continue ;
     }
     
@@ -4026,9 +4023,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     Float_t phi        = aod->Phi();
     Float_t eta        = aod->Eta();
     
-    if(GetDebug() > 0)
-      printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - pt %1.1f, eta %1.1f, phi %1.1f, Isolated %d\n",
-              pt, eta, phi, isolated);
+    AliDebug(1,Form("pt %1.1f, eta %1.1f, phi %1.1f, Isolated %d",pt, eta, phi, isolated));
     
     //---------------------------------------------------------------
     // Fill pt/sum pT distribution of particles in cone or in UE band
@@ -4070,9 +4065,8 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     if(coneptLeadCluster > coneptLeadTrack) coneptLead = coneptLeadCluster;
     fhConePtLead->Fill(pt, coneptLead );
     
-    if(GetDebug() > 1)
-      printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Particle %d Energy Sum in Isolation Cone %2.2f, Leading pT in cone %2.2f\n",
-             iaod, coneptsumTrack+coneptsumCluster, coneptLead);
+    AliDebug(1,Form("Particle %d Energy Sum in Isolation Cone %2.2f, Leading pT in cone %2.2f",
+             iaod, coneptsumTrack+coneptsumCluster, coneptLead));
     
     //normalize phi/eta band per area unit
     if(fFillUEBandSubtractHistograms)
@@ -4092,8 +4086,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     
     if(isolated)
     {
-      if(GetDebug() > 1)
-        printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Particle %d ISOLATED: fill histograms\n", iaod);
+      AliDebug(1,Form("Particle %d ISOLATED: fill histograms", iaod));
       
       fhEIso      ->Fill(energy);
       fhPtIso     ->Fill(pt);
@@ -4124,7 +4117,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
       }//Histograms with MC
       
       if(fFillNLMHistograms)
-        fhPtNLocMaxIso ->Fill(pt,aod->GetFiducialArea()) ; // remember to change method name
+        fhPtNLocMaxIso ->Fill(pt,aod->GetNLM()) ;
       
       if(IsHighMultiplicityAnalysisOn())
       {
@@ -4150,8 +4143,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     }//Isolated histograms
     else // NON isolated
     {
-      if(GetDebug() > 1)
-        printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Particle %d NOT ISOLATED, fill histograms\n", iaod);
+      AliDebug(1,Form("Particle %d NOT ISOLATED, fill histograms", iaod));
       
       fhENoIso        ->Fill(energy);
       fhPtNoIso       ->Fill(pt);
@@ -4169,7 +4161,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
       }
       
       if(fFillNLMHistograms)
-        fhPtNLocMaxNoIso ->Fill(pt,aod->GetFiducialArea()); // remember to change method name
+        fhPtNLocMaxNoIso ->Fill(pt,aod->GetNLM());
       
       if(IsPileUpAnalysisOn())
       {
@@ -4192,7 +4184,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
   // Fill acceptance histograms if MC data is available
   // Only when particle is in the calorimeter. Rethink if CTS is used.
   
-  if(GetDebug() > 0) printf("AliAnaParticleIsolation::FillAcceptanceHistograms() - Start \n");
+  AliDebug(1,"Start");
   
   //Double_t photonY   = -100 ;
   Double_t photonE   = -1 ;
@@ -4208,18 +4200,17 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
   
   TParticle        * primStack = 0;
   AliAODMCParticle * primAOD   = 0;
-  TLorentzVector lv;
   
   // Calorimeter cluster merging angle
   // angle smaller than 3 cells  6 cm (0.014) in EMCal, 2.2 cm in PHOS (0.014*(2.2/6))
   Float_t overlapAngle = 0;
   Float_t minECalo     = 0;
-  if      (GetCalorimeter()=="EMCAL")
+  if      (GetCalorimeter()==kEMCAL)
   {
     overlapAngle = fMinCellsAngleOverlap*0.014  ;
     minECalo = GetReader()->GetEMCALEMin();
   }
-  else if (GetCalorimeter()=="PHOS" )
+  else if (GetCalorimeter()==kPHOS )
   {
     overlapAngle = fMinCellsAngleOverlap*0.00382;
     minECalo = GetReader()->GetPHOSEMin();
@@ -4252,7 +4243,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       primStack = stack->Particle(i) ;
       if(!primStack)
       {
-        printf("AliAnaParticleIsolation::FillAcceptanceHistograms() - ESD primaries pointer not available!!\n");
+        AliWarning("ESD primaries pointer not available!!");
         continue;
       }
       
@@ -4267,7 +4258,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       //photonY   = 0.5*TMath::Log((prim->Energy()+prim->Pz())/(prim->Energy()-prim->Pz())) ;
       
       //Photon kinematics
-      primStack->Momentum(lv);
+      primStack->Momentum(fMomentum);
       
     }
     else
@@ -4275,7 +4266,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       primAOD = (AliAODMCParticle *) mcparticles->At(i);
       if(!primAOD)
       {
-        printf("AliAnaParticleIsolation::FillAcceptanceHistograms() - AOD primaries pointer not available!!\n");
+        AliWarning("AOD primaries pointer not available!!");
         continue;
       }
       
@@ -4287,7 +4278,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       //photonY   = 0.5*TMath::Log((prim->Energy()+prim->Pz())/(prim->Energy()-prim->Pz())) ;
       
       //Photon kinematics
-      lv.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
+      fMomentum.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
     }
     
     // Select only photons in the final state
@@ -4296,21 +4287,22 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     // Consider only final state particles, but this depends on generator,
     // status 1 is the usual one, in case of not being ok, leave the possibility
     // to not consider this.
-    if(pdg == 22 && status != 1 && GetMCAnalysisUtils()->GetMCGenerator()!="" ) continue ;
+    if( pdg == 22 && status != 1 &&
+        GetMCAnalysisUtils()->GetMCGenerator() != AliMCAnalysisUtils::kBoxLike ) continue ;
     
     // If too small or too large pt, skip, same cut as for data analysis
-    photonPt  = lv.Pt () ;
+    photonPt  = fMomentum.Pt () ;
     
     if(photonPt < GetMinPt() || photonPt > GetMaxPt() ) continue ;
     
-    photonE   = lv.E  () ;
-    photonEta = lv.Eta() ;
-    photonPhi = lv.Phi() ;
+    photonE   = fMomentum.E  () ;
+    photonEta = fMomentum.Eta() ;
+    photonPhi = fMomentum.Phi() ;
     
     if(photonPhi < 0) photonPhi+=TMath::TwoPi();
     
     // Check if photons hit the Calorimeter acceptance
-    if(IsRealCaloAcceptanceOn() && fIsoDetector!="CTS") // defined on base class
+    if(IsRealCaloAcceptanceOn() && fIsoDetector!=kCTS) // defined on base class
     {
       if(GetReader()->ReadStack()          &&
          !GetCaloUtils()->IsMCParticleInCalorimeterAcceptance(fIsoDetector, primStack)) continue ;
@@ -4319,7 +4311,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     }
     
     // Check same fidutial borders as in data analysis on top of real acceptance if real was requested.
-    if(!GetFiducialCut()->IsInFiducialCut(lv,fIsoDetector)) continue ;
+    if(!GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),fIsoDetector)) continue ;
     
     // Get tag of this particle photon from fragmentation, decay, prompt ...
     // Set the origin of the photon.
@@ -4348,10 +4340,9 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       //printf("OK pi0 %d, ndaugh %d\n",okpi0,ndaugh);
       Int_t d1Pdg = 0, d1Status = 0; Bool_t ok1 = kFALSE;
       Int_t d2Pdg = 0, d2Status = 0; Bool_t ok2 = kFALSE;
-      TLorentzVector daugh1mom, daugh2mom;
      
-      if ( ndaugh > 0 ) daugh1mom = GetMCAnalysisUtils()->GetDaughter(0,i,GetReader(),d1Pdg, d1Status,ok1, pi0d1Label);
-      if ( ndaugh > 1 ) daugh2mom = GetMCAnalysisUtils()->GetDaughter(1,i,GetReader(),d2Pdg, d2Status,ok2, pi0d2Label);
+      if ( ndaugh > 0 ) fMomDaugh1 = GetMCAnalysisUtils()->GetDaughter(0,i,GetReader(),d1Pdg, d1Status,ok1, pi0d1Label);
+      if ( ndaugh > 1 ) fMomDaugh2 = GetMCAnalysisUtils()->GetDaughter(1,i,GetReader(),d2Pdg, d2Status,ok2, pi0d2Label);
       
       //printf("pi0 daug %d: a) %d, b) %d, c) %d\n", ndaugh,pi0d1Label,pi0d2Label);
       //if ( ndaugh !=2 ) printf("PDG: %d, %d, %d\n",d1Pdg,d2Pdg);
@@ -4362,7 +4353,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       // Check overlap of decays
       if( okpi0 && fMakePrimaryPi0DecayStudy)
       {
-        Float_t d12Angle = daugh1mom.Angle(daugh2mom.Vect());
+        Float_t d12Angle = fMomDaugh1.Angle(fMomDaugh2.Vect());
         if(d12Angle > overlapAngle) overlapPi0 = kFALSE;
         //printf("  -- d12 angle %2.3f, angle limit %2.3f, overlap %d\n",d12Angle,overlapAngle,overlapPi0);
       }
@@ -4398,7 +4389,6 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     Double_t sumPtInCone = 0; Double_t dR=0. ;
     TParticle        * mcisopStack = 0;
     AliAODMCParticle * mcisopAOD   = 0;
-    TLorentzVector     mcisoLV;
     Int_t partInConeStatus = -1, partInConeMother = -1;
     Double_t partInConePt = 0, partInConeE = 0, partInConeEta = 0, partInConePhi = 0;
     Int_t partInConeCharge = 0, npart = 0;
@@ -4421,7 +4411,8 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         // Consider only final state particles, but this depends on generator,
         // status 1 is the usual one, in case of not being ok, leave the possibility
         // to not consider this.
-        if( partInConeStatus != 1 && GetMCAnalysisUtils()->GetMCGenerator()!="" ) continue ;
+        if( partInConeStatus != 1 &&
+            GetMCAnalysisUtils()->GetMCGenerator()!= AliMCAnalysisUtils::kBoxLike ) continue ;
         
         partInConeMother = mcisopStack->GetMother(0);
         partInConePt     = mcisopStack->Pt();
@@ -4429,7 +4420,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         partInConeEta    = mcisopStack->Eta();
         partInConePhi    = mcisopStack->Phi();
         partInConeCharge = TMath::Abs((Int_t) TDatabasePDG::Instance()->GetParticle(mcisopStack->GetPdgCode())->Charge());
-        mcisopStack->Momentum(mcisoLV);
+        mcisopStack->Momentum(fMomIso);
       }
       else
       {
@@ -4440,7 +4431,8 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         // Consider only final state particles, but this depends on generator,
         // status 1 is the usual one, in case of not being ok, leave the possibility
         // to not consider this.
-        if( partInConeStatus != 1 && GetMCAnalysisUtils()->GetMCGenerator()!="" ) continue ;
+        if( partInConeStatus != 1 &&
+            GetMCAnalysisUtils()->GetMCGenerator() != AliMCAnalysisUtils::kBoxLike ) continue ;
         
         partInConeMother = mcisopAOD->GetMother();
         partInConePt     = mcisopAOD->Pt();
@@ -4448,7 +4440,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         partInConeEta    = mcisopAOD->Eta();
         partInConePhi    = mcisopAOD->Phi();
         partInConeCharge = TMath::Abs(mcisopAOD->Charge());
-        mcisoLV.SetPxPyPzE(mcisopAOD->Px(),mcisopAOD->Py(),mcisopAOD->Pz(),mcisopAOD->E());
+        fMomIso.SetPxPyPzE(mcisopAOD->Px(),mcisopAOD->Py(),mcisopAOD->Pz(),mcisopAOD->E());
       }
       
       if( partInConeMother == i ) continue;
@@ -4463,7 +4455,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
           
           if( partInConePt < GetReader()->GetCTSPtMin () ) continue;
           
-          if(!GetReader()->GetFiducialCut()->IsInFiducialCut(mcisoLV,"CTS")) continue ;
+          if(!GetReader()->GetFiducialCut()->IsInFiducialCut(fMomIso.Eta(),fMomIso.Phi(),kCTS)) continue ;
         }
         else // neutrals E cut and acceptance
         {
@@ -4471,7 +4463,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
           
           if( partInConeE  <= minECalo ) continue;
           
-          if(!GetReader()->GetFiducialCut()->IsInFiducialCut(mcisoLV,GetCalorimeter())) continue ;
+          if(!GetReader()->GetFiducialCut()->IsInFiducialCut(fMomIso.Eta(),fMomIso.Phi(),GetCalorimeter())) continue ;
           
           if(IsRealCaloAcceptanceOn()) // defined on base class
           {
@@ -4510,7 +4502,6 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     
     // In case the photon is a decay from pi0,
     // study how the decay kinematics affects the isolation
-    TLorentzVector pi0mom, daugh1mom, daugh2mom;
     Int_t  ndaugh   = -1;
     Bool_t okpi0    =  0, ok1     =  0, ok2     =  0;
     Int_t  pi0label = -1, d1Label = -1, d2Label = -1;
@@ -4519,16 +4510,16 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     Float_t dRdaugh2 = 0, d12Angle = 0;
     if(mcIndex == kmcPrimPi0Decay && fMakePrimaryPi0DecayStudy)
     {
-      pi0mom = GetMCAnalysisUtils()->GetMotherWithPDG(i,111,GetReader(),okpi0, pi0label);
+      GetMCAnalysisUtils()->GetMotherWithPDG(i,111,GetReader(),okpi0, pi0label);
       if(okpi0)
       {
         ndaugh = GetMCAnalysisUtils()->GetNDaughters(pi0label,GetReader(), okpi0);
         if(ndaugh==2)
         {
           Int_t d1Pdg = 0, d1Status = 0;
-          daugh1mom = GetMCAnalysisUtils()->GetDaughter(0,pi0label,GetReader(),d1Pdg, d1Status,ok1, d1Label);
+          fMomDaugh1 = GetMCAnalysisUtils()->GetDaughter(0,pi0label,GetReader(),d1Pdg, d1Status,ok1, d1Label);
           Int_t d2Pdg = 0, d2Status = 0;
-          daugh2mom = GetMCAnalysisUtils()->GetDaughter(1,pi0label,GetReader(),d2Pdg, d2Status,ok2, d2Label);
+          fMomDaugh2 = GetMCAnalysisUtils()->GetDaughter(1,pi0label,GetReader(),d2Pdg, d2Status,ok2, d2Label);
           if(d2Pdg != d1Pdg && d1Pdg!=22) okpi0 = kFALSE;
 
           // Check the momentum and location of second daughter
@@ -4540,28 +4531,29 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
               Int_t tmpLabel = d2Label;
               d2Label = d1Label;
               d1Label = tmpLabel;
-              TLorentzVector tmpLV = daugh2mom;
-              daugh2mom = daugh1mom;
-              daugh1mom = tmpLV;
+              fMomentum  = fMomDaugh2;
+              fMomDaugh2 = fMomDaugh1;
+              fMomDaugh1 = fMomentum;
             }
             
             // Check if photons hit the Calorimeter acceptance
-            if(IsRealCaloAcceptanceOn() && fIsoDetector!="CTS") // defined on base class
-                 d2Acc = GetCaloUtils()->IsMCParticleInCalorimeterAcceptance(fIsoDetector,daugh2mom,d2AbsId) ;
+            if(IsRealCaloAcceptanceOn() && fIsoDetector!=kCTS) // defined on base class
+                 d2Acc = GetCaloUtils()->IsMCParticleInCalorimeterAcceptance(fIsoDetector,fMomDaugh2.Eta(),
+                                                                             fMomDaugh2.Theta(),fMomDaugh2.Phi(),d2AbsId) ;
 
             //printf("D2  (eta %2.2f,phi %2.2f)in real calo %d, with absId %d\n",
             //       daugh2mom.Eta(), daugh2mom.Phi()*TMath::RadToDeg(),d2Acc,d2AbsId);
             
             // Check same fidutial borders as in data analysis on top of real acceptance if real was requested.
-            if(d2Acc) d2Acc = GetReader()->GetFiducialCut()->IsInFiducialCut(daugh2mom,fIsoDetector);
+            if(d2Acc) d2Acc = GetReader()->GetFiducialCut()->IsInFiducialCut(fMomDaugh2.Eta(),fMomDaugh2.Phi(),fIsoDetector);
             //printf("D2 fidcut %d\n",d2Acc);
             
-            Float_t phiDaugh2 = daugh2mom.Phi();
+            Float_t phiDaugh2 = fMomDaugh2.Phi();
             if(phiDaugh2 < 0) phiDaugh2+=TMath::TwoPi();
-            dRdaugh2 = GetIsolationCut()->Radius(photonEta, photonPhi, daugh2mom.Eta(),phiDaugh2);
+            dRdaugh2 = GetIsolationCut()->Radius(photonEta, photonPhi, fMomDaugh2.Eta(),phiDaugh2);
 
             // Opening angle, check if pairs will likely overlap
-            d12Angle = daugh1mom.Angle(daugh2mom.Vect());
+            d12Angle = fMomDaugh1.Angle(fMomDaugh2.Vect());
             if(d12Angle > overlapAngle) overlap = kFALSE;
 
           }
@@ -4576,7 +4568,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         fhPtPrimMCPi0DecayPairOutOfCone->Fill(photonPt);
       
       // Second decay out of acceptance
-      if(!ok2 || !d2Acc || daugh2mom.E() <= minECalo)
+      if(!ok2 || !d2Acc || fMomDaugh2.E() <= minECalo)
       {
         fhPtPrimMCPi0DecayPairOutOfAcceptance->Fill(photonPt);
         if(!overlap) fhPtPrimMCPi0DecayPairOutOfAcceptanceNoOverlap->Fill(photonPt);
@@ -4587,13 +4579,13 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
       
       // Second decay pt smaller than threshold
       if(d2Acc && dRdaugh2 < GetIsolationCut()->GetConeSize() &&
-         daugh2mom.E() < GetIsolationCut()->GetPtThreshold())
+         fMomDaugh2.E() < GetIsolationCut()->GetPtThreshold())
       {
         fhPtPrimMCPi0DecayPairAcceptInConeLowPt->Fill(photonPt);
         if(!overlap)
         {
           fhPtPrimMCPi0DecayPairAcceptInConeLowPtNoOverlap->Fill(photonPt);
-          if(daugh2mom.E() > minECalo)fhPtPrimMCPi0DecayPairAcceptInConeLowPtNoOverlapCaloE->Fill(photonPt);
+          if(fMomDaugh2.E() > minECalo) fhPtPrimMCPi0DecayPairAcceptInConeLowPtNoOverlapCaloE->Fill(photonPt);
         }
       }
     } // pi0 decay
@@ -4626,7 +4618,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
           fhPtPrimMCPi0DecayIsoPairOutOfCone->Fill(photonPt);
         
         // Second decay out of acceptance
-        if(!ok2 || !d2Acc || daugh2mom.E() <= minECalo)
+        if(!ok2 || !d2Acc || fMomDaugh2.E() <= minECalo)
         {
           fhPtPrimMCPi0DecayIsoPairOutOfAcceptance->Fill(photonPt);
           if(!overlap) fhPtPrimMCPi0DecayIsoPairOutOfAcceptanceNoOverlap->Fill(photonPt);
@@ -4634,13 +4626,13 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
         
         // Second decay pt smaller than threshold
         if(d2Acc && dRdaugh2 < GetIsolationCut()->GetConeSize() &&
-           daugh2mom.E() < GetIsolationCut()->GetPtThreshold())
+           fMomDaugh2.E() < GetIsolationCut()->GetPtThreshold())
         {
           fhPtPrimMCPi0DecayIsoPairAcceptInConeLowPt->Fill(photonPt);
           if(!overlap)
           {
             fhPtPrimMCPi0DecayIsoPairAcceptInConeLowPtNoOverlap->Fill(photonPt);
-            if(daugh2mom.E() > minECalo) fhPtPrimMCPi0DecayIsoPairAcceptInConeLowPtNoOverlapCaloE->Fill(photonPt);
+            if(fMomDaugh2.E() > minECalo) fhPtPrimMCPi0DecayIsoPairAcceptInConeLowPtNoOverlapCaloE->Fill(photonPt);
           }
         }
       }// pi0 decay
@@ -4651,7 +4643,7 @@ void AliAnaParticleIsolation::FillAcceptanceHistograms()
     } // isolated
   }//loop on primaries
   
-  if(GetDebug() > 0) printf("AliAnaParticleIsolation::FillAcceptanceHistograms() - End \n");
+  AliDebug(1,"End");
   
 }
 
@@ -4671,12 +4663,11 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
   Int_t   decayTag = 0;
   if(fFillTaggedDecayHistograms)
   {
-    decayTag = ph->GetBtag(); // temporary
-    if(decayTag < 0) decayTag = 0; // temporary
+    decayTag = ph->DecayTag();
+    if(decayTag < 0) decayTag = 0; 
   }
 
-  if(GetDebug() > 0)
-    printf("AliAnaParticleIsolation::MakeSeveralICAnalysis() - Isolate pT %2.2f, decay tag %d\n",ptC, decayTag);
+  AliDebug(1,Form("Isolate pT %2.2f, decay tag %d",ptC, decayTag));
   
   //Keep original setting used when filling AODs, reset at end of analysis
   Float_t ptthresorg = GetIsolationCut()->GetPtThreshold();
@@ -4766,7 +4757,7 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
       //fill the histograms at forward range
       if(!track)
       {
-        printf("AliAnaParticleIsolation::MakeAnalysisFillHistograms() - Track not available?");
+        AliDebug(1,"Track not available?");
         continue;
       }
       
@@ -4809,19 +4800,18 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
     // Clusters in isolation cone, pT distribution and sum
     if(refclusters && GetIsolationCut()->GetParticleTypeInCone()!= AliIsolationCut::kOnlyCharged)
     {
-      TLorentzVector mom ;
       for(Int_t icalo=0; icalo < refclusters->GetEntriesFast(); icalo++)
       {
         AliVCluster* calo = (AliVCluster *) refclusters->At(icalo);
         
-        calo->GetMomentum(mom,vertex) ;//Assume that come from vertex in straight line
+        calo->GetMomentum(fMomentum,vertex) ;//Assume that come from vertex in straight line
         
-        Float_t rad = GetIsolationCut()->Radius(etaC, phiC, mom.Eta(), mom.Phi());
+        Float_t rad = GetIsolationCut()->Radius(etaC, phiC, fMomentum.Eta(), fMomentum.Phi());
         
         if(rad > fConeSizes[icone]) continue ;
         
-        fhPtLeadingPt[icone]->Fill(ptC, mom.Pt());
-        coneptsum += mom.Pt();
+        fhPtLeadingPt[icone]->Fill(ptC, fMomentum.Pt());
+        coneptsum += fMomentum.Pt();
       }
     }
     
@@ -4857,20 +4847,13 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
       
       // Normal pT threshold cut
       
-      if(GetDebug() > 0)
-      {
-        printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - cone size %1.1f, ptThres  %1.1f, sumptThresh  %1.1f\n",
-               fConeSizes[icone],fPtThresholds[ipt],fSumPtThresholds[ipt]);
-        printf("\t n %d, nfrac %d, coneptsum %2.2f\n",
-               n[icone][ipt],nfrac[icone][ipt],coneptsum);
-        
-        printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - pt %1.1f, eta %1.1f, phi %1.1f\n",ptC, etaC, phiC);
-      }
+      AliDebug(1,Form("Cone size %1.1f, ptThres  %1.1f, sumptThresh  %1.1f",fConeSizes[icone],fPtThresholds[ipt],fSumPtThresholds[ipt]));
+      AliDebug(1,Form("\t n %d, nfrac %d, coneptsum %2.2f",n[icone][ipt],nfrac[icone][ipt],coneptsum));
+      AliDebug(1,Form("pt %1.1f, eta %1.1f, phi %1.1f",ptC, etaC, phiC));
       
       if(n[icone][ipt] == 0)
       {
-        if(GetDebug() > 0)
-          printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - filling pt threshold loop\n");
+        AliDebug(1,"Filling pt threshold loop");
         
         fhPtThresIsolated [icone][ipt]->Fill(ptC);
         fhEtaPhiPtThresIso[icone][ipt]->Fill(etaC,phiC);
@@ -4900,8 +4883,7 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
       // pt in cone fraction
       if(nfrac[icone][ipt] == 0)
       {
-        if(GetDebug() > 0)
-          printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - filling frac loop\n");
+        AliDebug(1,"Filling frac loop");
         
         fhPtFracIsolated [icone][ipt]->Fill(ptC);
         fhEtaPhiPtFracIso[icone][ipt]->Fill(etaC,phiC);
@@ -4927,14 +4909,12 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
         }
       }
       
-      if(GetDebug()>0)
-        printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - checking IC method : %i\n",GetIsolationCut()->GetICMethod());
+      AliDebug(1,Form("Checking IC method : %i",GetIsolationCut()->GetICMethod()));
       
       //Pt threshold on pt cand/ sum in cone histograms
       if(coneptsum < fSumPtThresholds[ipt])
       {
-        if(GetDebug() > 0 )
-          printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - filling sum loop\n");
+        AliDebug(1,"Filling sum loop");
         
         fhSumPtIsolated [icone][ipt]->Fill(ptC) ;
         fhEtaPhiPtSumIso[icone][ipt]->Fill(etaC, phiC) ;
@@ -4965,8 +4945,7 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
       
       if(coneptsum < fPtFractions[ipt]*ptC)
       {
-        if(GetDebug() > 0)
-          printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - filling PtFrac PtSum loop\n");
+        AliDebug(1,"Filling PtFrac PtSum loop");
         
         fhPtFracPtSumIso    [icone][ipt]->Fill(ptC) ;
         fhEtaPhiFracPtSumIso[icone][ipt]->Fill(etaC,phiC) ;
@@ -4985,8 +4964,7 @@ void  AliAnaParticleIsolation::MakeSeveralICAnalysis(AliAODPWG4ParticleCorrelati
       Float_t cellDensity = GetIsolationCut()->GetCellDensity( ph, GetReader());
       if(coneptsum < fSumPtThresholds[ipt]*cellDensity)
       {
-        if(GetDebug() > 0)
-          printf(" AliAnaParticleIsolation::MakeSeveralICAnalysis() - filling density loop\n");
+        AliDebug(1,"Filling density loop");
         
         fhPtSumDensityIso    [icone][ipt]->Fill(ptC) ;
         fhEtaPhiSumDensityIso[icone][ipt]->Fill(etaC,phiC) ;
@@ -5026,8 +5004,8 @@ void AliAnaParticleIsolation::Print(const Option_t * opt) const
   
   printf("ReMake Isolation          = %d \n",  fReMakeIC) ;
   printf("Make Several Isolation    = %d \n",  fMakeSeveralIC) ;
-  printf("Calorimeter for isolation = %s \n",  GetCalorimeter().Data()) ;
-  printf("Detector for candidate isolation = %s \n", fIsoDetector.Data()) ;
+  printf("Calorimeter for isolation = %s \n",  GetCalorimeterString().Data()) ;
+  printf("Detector for candidate isolation = %s \n", fIsoDetectorString.Data()) ;
   
   if(fMakeSeveralIC)
   {
@@ -5061,3 +5039,35 @@ void AliAnaParticleIsolation::Print(const Option_t * opt) const
   
 } 
 
+//_____________________________________________________________
+void AliAnaParticleIsolation::SetTriggerDetector(TString & det)
+{
+  // Set the detrimeter for the analysis
+  
+  fIsoDetectorString = det;
+  
+  if     (det=="EMCAL") fIsoDetector = kEMCAL;
+  else if(det=="PHOS" ) fIsoDetector = kPHOS;
+  else if(det=="CTS")   fIsoDetector = kCTS;
+  else if(det=="DCAL")  fIsoDetector = kDCAL;
+  else if(det.Contains("DCAL") && det.Contains("PHOS")) fIsoDetector = kDCALPHOS;
+  else AliFatal(Form("Detector < %s > not known!", det.Data()));
+  
+}
+
+//_________________________________________________________
+void AliAnaParticleIsolation::SetTriggerDetector(Int_t det)
+{
+  // Set the detrimeter for the analysis
+  
+  fIsoDetector = det;
+  
+  if     (det==kEMCAL)    fIsoDetectorString = "EMCAL";
+  else if(det==kPHOS )    fIsoDetectorString = "PHOS";
+  else if(det==kCTS)      fIsoDetectorString = "CTS";
+  else if(det==kDCAL)     fIsoDetectorString = "DCAL";
+  else if(det==kDCALPHOS) fIsoDetectorString = "DCAL_PHOS";
+  else AliFatal(Form("Detector < %d > not known!", det));
+  
+}
+
index 6a1e14b7a4fab013e74d2bf732335d6e26bc53fd..286f850a96aef0abb16a095b7b299eaf7549921a 100755 (executable)
@@ -77,6 +77,7 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
   
   // Analysis Setters and Getters
   
+  TString      GetTriggerDetectorString()      const { return fIsoDetectorString ; }
   TString      GetTriggerDetector()            const { return fIsoDetector       ; }
   Int_t        GetNCones()                     const { return fNCones            ; }
   Int_t        GetNPtThresFrac()               const { return fNPtThresFrac      ; }
@@ -87,7 +88,8 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
   
   Int_t        GetMCIndex(Int_t mcTag);
   
-  void         SetTriggerDetector(TString & det)     { fIsoDetector     = det    ; }
+  void         SetTriggerDetector(TString & det)     ;
+  void         SetTriggerDetector(Int_t  det)        ;
   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      ; }
@@ -162,7 +164,8 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
 
  private:
   
-  TString  fIsoDetector ;                         // Candidate particle for isolation detector ;
+  Int_t    fIsoDetector ;                         // Candidate particle for isolation detector ;
+  TString  fIsoDetectorString ;                   // Candidate particle for isolation detector ;
   Bool_t   fReMakeIC ;                            // Do isolation analysis
   Bool_t   fMakeSeveralIC ;                       // Do analysis for different IC
   Bool_t   fFillTMHisto;                          // Fill track matching plots
@@ -197,6 +200,12 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
   Float_t  fPtFractions[5] ;                      //! Array with pt thresholds to test frac
   Float_t  fSumPtThresholds[5] ;                  //! Array with pt thresholds to test frac
   
+  TLorentzVector fMomentum;                       //! Temporary vector, avoid creation per event
+  TLorentzVector fMomIso;                         //! Temporary vector, avoid creation per event
+  TLorentzVector fMomDaugh1;                      //! Temporary vector, avoid creation per event
+  TLorentzVector fMomDaugh2;                      //! Temporary vector, avoid creation per event
+  TVector3       fTrackVector;                    //! Temporary vector, avoid creation per event
+  
   //Histograms  
   
   TH1F *   fhEIso ;                               //! Number of isolated particles vs energy
@@ -425,10 +434,10 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
   // Shower Shape histograms
   TH2F *   fhELambda0[2];                         //! Shower shape of (non) isolated photons (do not apply SS cut previously)  
   TH2F *   fhPtLambda0[2];                        //! Shower shape of (non) isolated photons (do not apply SS cut previously)
-  TH2F *   fhELambda1[2];                         //! Shower shape of (non) isolated photons (do not apply SS cut previously)
+  //TH2F *   fhELambda1[2];                         //! Shower shape of (non) isolated photons (do not apply SS cut previously)
   TH2F *   fhELambda0TRD[2];                      //! Shower shape of (non) isolated photons, SM behind TRD (do not apply SS cut previously)
   TH2F *   fhPtLambda0TRD[2];                     //! Shower shape of (non) isolated photons, SM behind TRD (do not apply SS cut previously)
-  TH2F *   fhELambda1TRD[2];                      //! Shower shape of (non) isolated photons, SM behind TRD (do not apply SS cut previously)
+  //TH2F *   fhELambda1TRD[2];                      //! Shower shape of (non) isolated photons, SM behind TRD (do not apply SS cut previously)
 
   TH1F **  fhPtLeadConeBin ;                      //![fNBkgBin] Candidate Pt distribution depending on bin of cone leading particle
   TH1F **  fhSumPtConeBin  ;                      //![fNBkgBin] Candidate Pt distribution depending on bin of cone sum pt
@@ -482,7 +491,7 @@ class AliAnaParticleIsolation : public AliAnaCaloTrackCorrBaseClass {
   AliAnaParticleIsolation(              const AliAnaParticleIsolation & iso) ; // cpy ctor
   AliAnaParticleIsolation & operator = (const AliAnaParticleIsolation & iso) ; // cpy assignment
   
-  ClassDef(AliAnaParticleIsolation,31)
+  ClassDef(AliAnaParticleIsolation,32)
 } ;
 
 
index 3fc588e2b607ee662a654640904b32435fed415e..836f2d0fe2022a2ec3ddfea21dcaeefb649471bb 100644 (file)
@@ -61,6 +61,7 @@ AliAnaCaloTrackCorrBaseClass(),
   fGammaConeSize(0.3),fUseBackgroundSubtractionGamma(kFALSE),fSaveGJTree(kTRUE),
   fMostEnergetic(kFALSE),fMostOpposite(kTRUE), fUseHistogramJetBkg(kTRUE),
   fUseHistogramTracks(kTRUE),fUseHistogramJetTracks(kTRUE),fMCStudies(kFALSE),fGenerator(0),
+  fMomentum(),
   fhDeltaEta(0), /*fhDeltaPhi(0),*/fhDeltaPhiCorrect(0),fhDeltaPhi0PiCorrect(0), fhDeltaPt(0), fhPtRatio(0), fhPt(0),
   fhFFz(0),fhFFxi(0),fhFFpt(0),fhNTracksInCone(0),
   fhJetFFz(0),fhJetFFxi(0),fhJetFFpt(0),fhJetFFzCor(0),fhJetFFxiCor(0),
@@ -976,8 +977,7 @@ Int_t  AliAnaParticleJetFinderCorrelation::SelectJet(AliAODPWG4Particle * partic
     
     fhDeltaPhi0PiCorrectBefore->Fill(particlePt, deltaPhi0pi);//good
     
-    if(GetDebug() > 5)
-      printf("AliAnaParticleJetFinderCorrelation::SelectJet() - Jet %d, Ratio pT %2.3f, Delta phi %2.3f\n",ijet,ratio,deltaPhi);
+    AliDebug(5,Form("Jet %d, Ratio pT %2.3f, Delta phi %2.3f",ijet,ratio,deltaPhi));
     
     if((deltaPhi > fDeltaPhiMinCut) && (deltaPhi < fDeltaPhiMaxCut) &&
        (ratio > fRatioMinCut) && (ratio < fRatioMaxCut)  &&
@@ -1014,7 +1014,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
   }
   else
   {
-    if(GetDebug() > 3) AliInfo("There are no jets available for this analysis");
+    AliDebug(1,"There are no jets available for this analysis");
     return;
   }
   
@@ -1038,9 +1038,9 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
   Int_t nJets=-1;
   TClonesArray *aodRecJets = 0;
   //if(IsNonStandardJetFromReader()){//jet branch from reader
-  if(GetDebug() > 3) AliInfo(Form("GetNonStandardJets function (from reader) is called"));
+  AliDebug(3,Form("GetNonStandardJets function (from reader) is called"));
   aodRecJets = GetNonStandardJets();
-  if(GetDebug() > 3) AliInfo(Form("aodRecJets %p",aodRecJets));
+  AliDebug(3,Form("aodRecJets %p",aodRecJets));
   if(aodRecJets==0x0)
     {
       if(GetDebug() > 3) event->Print();
@@ -1048,7 +1048,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
       return;
     }
   nJets=aodRecJets->GetEntries();
-  if(GetDebug() > 3) printf("nJets %d\n",nJets);
+  AliDebug(3,Form("nJets %d",nJets));
   //}
   //end of new part
   
@@ -1062,9 +1062,9 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
   //
   AliAODJetEventBackground* aodBkgJets = 0;
   if(IsBackgroundJetFromReader()){//jet branch from reader
-    if(GetDebug() > 3) printf("GetBackgroundJets function is called\n");
+   AliDebug(3,"GetBackgroundJets function is called");
     aodBkgJets = GetBackgroundJets();
-    if(GetDebug() > 3) printf("aodBkgJets %p\n",aodBkgJets);
+    AliDebug(3,Form("aodBkgJets %p",aodBkgJets));
     if(aodBkgJets==0x0){
       if(GetDebug() > 3) event->Print();
       AliFatal("No jet background found\n");
@@ -1081,12 +1081,11 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
   
   
   Int_t ntrig =  GetInputAODBranch()->GetEntriesFast() ;
-  if(GetDebug() > 3){
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - Begin jet finder  correlation analysis, fill AODs \n");
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", ntrig);
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - In standard jet branch aod entries %d\n", event->GetNJets());
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - In non standard jet branch aod entries %d\n", nJets);
-  }
+  
+  AliDebug(3,"Begin jet finder  correlation analysis, fill AODs");
+  AliDebug(3,Form("In particle branch aod entries %d\n", ntrig));
+  AliDebug(3,Form("In standard jet branch aod entries %d\n", event->GetNJets()));
+  AliDebug(3,Form("In non standard jet branch aod entries %d\n", nJets));
   
   //if(nJets==0)   return;//to speed up
   //  cout<<"ntrig po return "<<ntrig<<endl;
@@ -1206,7 +1205,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
       Int_t ijet = SelectJet(particle,aodRecJets);//input for jets is TClonesArray
       if(ijet > -1){
         //isJetFound=kTRUE;
-        if(GetDebug() > 2) printf ("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - Jet with index %d selected \n",ijet);
+        AliDebug(2,Form("Jet with index %d selected",ijet));
         AliAODJet *jet = dynamic_cast<AliAODJet*>(aodRecJets-> At(ijet));
         if(jet)particle->SetRefJet(jet);
         //printf("Most opposite found\n");
@@ -1215,18 +1214,17 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD()
     //  if(GetReader()->WriteDeltaAODToFile() && isJetFound) WriteJetsToOutputBranch(aodRecJets);
   }//end of take most opposite photon and jet after bkg subtraction
   
-  
-  if(GetDebug() > 1 ) printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
+  AliDebug(1," End fill AODs \n");
 } 
 
 //__________________________________________________________________
 void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
 {
   //Particle-Jet Correlation Analysis, fill histograms
-  if(GetDebug() > 3 ) {
-    printf("I use MakeAnalysisFillHistograms\n");
-    printf("ntracks before iso %d\n",GetCTSTracks()->GetEntriesFast() );
-  }
+  
+  AliDebug(3,"I use MakeAnalysisFillHistograms");
+  AliDebug(3,Form("ntracks before iso %d\n",GetCTSTracks()->GetEntriesFast()));
+
 
   //Get the event, check if there are AODs available, if not, skip this analysis
   AliAODEvent * event = NULL;
@@ -1244,14 +1242,15 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
   {
     event = dynamic_cast<AliAODEvent*>(GetReader()->GetInputEvent());
   }
-  else {
-    if(GetDebug() > 3) printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - There are no jets available for this analysis\n");
+  else
+  {
+    AliDebug(3,"There are no jets available for this analysis");
     return;
   }
   
-  if(!GetInputAODBranch() || !event){
-
-    AliFatal(Form("No input particles in AOD with name branch < %s > \n",
+  if(!GetInputAODBranch() || !event)
+  {
+    AliFatal(Form("No input particles in AOD with name branch < %s >",
                   GetInputAODName().Data()));
     return; // Trick coverity        
   }
@@ -1259,16 +1258,18 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
   Int_t nJets=-1;
   TClonesArray *aodRecJets = 0;
   //if(IsNonStandardJetFromReader()){//branch read in reader from reader
-  if (GetDebug() > 3) printf("GetNonStandardJets function (from reader) is called\n");
+  AliDebug(3,"GetNonStandardJets function (from reader) is called");
   aodRecJets = GetNonStandardJets();
-  if(aodRecJets==0x0){
+  if(aodRecJets==0x0)
+  {
     if(GetDebug() > 3) event->Print();
     AliFatal("Jets container not found\n");
     return; // trick coverity
   }
   nJets=aodRecJets->GetEntries();
   //}
-  if(nJets==0) {
+  if(nJets==0)
+  {
     //    printf("Why number of jets = 0? Check what type of collision it is. If PbPb -problem.\n");
     GetReader()->FillInputNonStandardJets();
     aodRecJets = GetNonStandardJets();
@@ -1282,10 +1283,11 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
   //
   AliAODJetEventBackground* aodBkgJets = 0;
   if(IsBackgroundJetFromReader()){//jet branch from reader
-    if(GetDebug() > 3) printf("GetBackgroundJets function is called\n");
+    AliDebug(3,"GetBackgroundJets function is called");
     aodBkgJets = GetBackgroundJets();
-    if(GetDebug() > 3) printf("aodBkgJets %p\n",aodBkgJets);
-    if(aodBkgJets==0x0){
+    AliDebug(3,Form("aodBkgJets %p",aodBkgJets));
+    if(aodBkgJets==0x0)
+    {
       if(GetDebug() > 3) event->Print();
       AliFatal("No jet background container found");
       return; // trick coverity  
@@ -1293,7 +1295,6 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     if(GetDebug() > 3) aodBkgJets->Print("c");
   }
   
-  
   //
   // only background jets informations
   //
@@ -1417,8 +1418,9 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     fhJetPt->Fill(jetPttmp);
     fhJetChBkgEnergyVsPt->Fill(jetPttmp,effectiveChargedBgEnergy);
     fhJetChAreaVsPt->Fill(jetPttmp,jettmp->EffectiveAreaCharged());
-    if(GetDebug()>5) printf("ChargedBgEnergy %f EffectiveAreaCharged %f\n", jettmp->ChargedBgEnergy(),jettmp->EffectiveAreaCharged());
-    for(iCounter=1;iCounter<10;iCounter++){
+    AliDebug(5,Form("ChargedBgEnergy %f EffectiveAreaCharged %f\n", jettmp->ChargedBgEnergy(),jettmp->EffectiveAreaCharged()));
+    for(iCounter=1;iCounter<10;iCounter++)
+    {
       if(jetPttmp>iCounter) nJetsOverThreshold[iCounter]++;
     }
     
@@ -1453,11 +1455,11 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
   // Photons
   //
   Int_t ntrig   =  GetInputAODBranch()->GetEntriesFast() ;
-  if(GetDebug() > 1){
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - Begin jet finder  correlation analysis, fill histograms \n");
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", ntrig);
-    printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - In jet output branch aod entries %d\n", event->GetNJets());
-  }
+  
+  AliDebug(1,"Begin jet finder  correlation analysis, fill histograms");
+  AliDebug(1,Form("In particle branch aod entries %d\n", ntrig));
+  AliDebug(1,Form("In jet output branch aod entries %d\n", event->GetNJets()));
+  
   fhNjetsNgammas->Fill(nJets,ntrig);
   
   //if(nJets==0)   return;//to speed up
@@ -1621,7 +1623,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     AliAODPWG4ParticleCorrelation* particlecorr =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     fhCuts->Fill(0);
     fhCuts2->Fill(0.,(Double_t)nJets);
-    if(GetDebug() > 5) printf("OnlyIsolated %d  !particlecorr->IsIsolated() %d \n",OnlyIsolated(), !particlecorr->IsIsolated());
+    AliDebug(1,Form("OnlyIsolated %d  !particlecorr->IsIsolated() %d \n",OnlyIsolated(), !particlecorr->IsIsolated()));
     
     if(OnlyIsolated() && !particlecorr->IsIsolated()) continue;
     fhCuts->Fill(1);
@@ -1637,8 +1639,9 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     if(fMakeCorrelationInHistoMaker){
       //Correlate with jets
       Int_t ijet = SelectJet(particlecorr,aodRecJets);//input for jets is TClonesArray
-      if(ijet > -1){
-        if(GetDebug() > 2) printf ("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - Jet with index %d selected \n",ijet);
+      if(ijet > -1)
+      {
+        AliDebug(1,Form("Jet with index %d selected \n",ijet));
         //jet = event->GetJet(ijet);
         jet = dynamic_cast<AliAODJet*>(aodRecJets-> At(ijet));
         
@@ -1691,7 +1694,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     fhSelectedJetChAreaVsPtJet->Fill(ptJet,jet->EffectiveAreaCharged());
     fhSelectedJetNjet->Fill(nJets);
     fhSelectedNtracks->Fill(GetCTSTracks()->GetEntriesFast());//to be checked
-    fhSelectedPhotonNLMVsPt->Fill(ptTrig,particlecorr->GetFiducialArea());
+    fhSelectedPhotonNLMVsPt->Fill(ptTrig,particlecorr->GetNLM());
     
     
     if(clusterID < 0 ){
@@ -1715,25 +1718,24 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
       
       fGamSumPtNeu=0;
       fGamNclusters=0;
-      TLorentzVector mom ;
       //TVector3 p3Tmp;
       //Double_t scalarProduct=0;
       //Double_t vectorLength=particlecorr->P();
       for(Int_t icalo=0; icalo <clusters->GetEntriesFast(); icalo++){
         AliVCluster* calo = (AliVCluster *) clusters->At(icalo);
         if(clusterID==calo->GetID()) continue;//the same cluster as trigger
-        calo->GetMomentum(mom,vertex) ;//Assume that come from vertex in straight line
+        calo->GetMomentum(fMomentum,vertex) ;//Assume that come from vertex in straight line
         //printf("min pt %f\n",GetMinPt());
-        if(mom.Pt()<GetMinPt()) continue; //<<hardcoded here //FIXME 0.5 check if correct
-        p3Tmp.SetXYZ(mom.Px(),mom.Py(),mom.Pz());
+        if(fMomentum.Pt()<GetMinPt()) continue; //<<hardcoded here //FIXME 0.5 check if correct
+        p3Tmp.SetXYZ(fMomentum.Px(),fMomentum.Py(),fMomentum.Pz());
         //calculate sum pt in the cone
         if( TMath::Sqrt((particlecorr->Eta()-p3Tmp.Eta())*(particlecorr->Eta()-p3Tmp.Eta()) +
                         (particlecorr->Phi()-p3Tmp.Phi())*(particlecorr->Phi()-p3Tmp.Phi()) )<fGammaConeSize ){
-          //scalarProduct = particlecorr->Px()*mom.Px() + particlecorr->Py()*mom.Py() + particlecorr->Pz()*mom.Pz();
-          //scalarProduct/=mom.P();
+          //scalarProduct = particlecorr->Px()*fMomentum.Px() + particlecorr->Py()*fMomentum.Py() + particlecorr->Pz()*fMomentum.Pz();
+          //scalarProduct/=fMomentum.P();
           //scalarProduct/=vectorLength;
           //if(scalarProduct>TMath::Cos(0.3)) {//FIXME photon radius
-          fGamSumPtNeu+=mom.Pt();
+          fGamSumPtNeu+=fMomentum.Pt();
           fGamNclusters++;
         }
       }
@@ -1785,18 +1787,17 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     TVector3 p3;
     
     Int_t ntracks =  0;
-    if(GetDebug()>3){
-      printf ("fUseJetRefTracks %d\n",fUseJetRefTracks );
-      printf ("jet->GetRefTracks() %p\n",jet->GetRefTracks());
-      printf ("GetCTSTracks() %p\n",GetCTSTracks() );
-    }
+
+    AliDebug(1,Form("fUseJetRefTracks %d"   ,fUseJetRefTracks   ));
+    AliDebug(1,Form("jet->GetRefTracks() %p",jet->GetRefTracks()));
+    AliDebug(1,Form("GetCTSTracks() %p"     ,GetCTSTracks()     ));
     
     if(!fUseJetRefTracks)
       ntracks =GetCTSTracks()->GetEntriesFast();
     else //If you want to use jet tracks from JETAN
       ntracks =  (jet->GetRefTracks())->GetEntriesFast();
     
-    if(GetDebug()>3)    printf ("ntracks %d\n",ntracks);
+    AliDebug(3,Form("ntracks %d\n",ntracks));
     AliVTrack* track = 0x0 ;
     for(Int_t ipr = 0;ipr < ntracks ; ipr ++ ){
       if(!fUseJetRefTracks)
@@ -1836,7 +1837,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     
     fGamPt      = ptTrig;
     //fGamLambda0  = ;//filled earlier
-    fGamNLM      = particlecorr->GetFiducialArea();
+    fGamNLM      = particlecorr->GetNLM();
     //fGamSumPtCh  = ;//filled earlier
     //fGamTime     = particlecorr->GetTOF();//filled earlier
     //fGamNcells   = particlecorr->GetNCells();//filled earlier
@@ -1870,7 +1871,7 @@ void  AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms()
     
     if(fSaveGJTree) fTreeGJ->Fill();
   }//AOD trigger particle loop
-  if(GetDebug() > 1) printf("AliAnaParticleJetFinderCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
+  AliDebug(1,"End fill histograms");
 }
 
 
@@ -1962,7 +1963,7 @@ void AliAnaParticleJetFinderCorrelation::CalculateBkg(TVector3 gamma, TVector3 j
     Double_t Yz=jx*Xy-jy*Xx;
     //Determinant
     Double_t det = Xx*Yy*jz + Xy*Yz*jx + Xz*Yx*jy - Xx*Yz*jy - Xy*Yx*jz - Xz*Yy*jx;
-    if(det==0)printf("problem det==0\n");
+    if(det==0)AliWarning("problem det==0\n");
     Double_t detX = 0.;
     Double_t detY = 0.;
     Double_t detZ = 0.;
@@ -2036,7 +2037,7 @@ void AliAnaParticleJetFinderCorrelation::CalculateBkg(TVector3 gamma, TVector3 j
     Double_t Yz=jx*Xy-jy*Xx;
     //Determinant
     Double_t det = Xx*Yy*jz + Xy*Yz*jx + Xz*Yx*jy - Xx*Yz*jy - Xy*Yx*jz - Xz*Yy*jx;
-    if(det==0)printf("problem det==0\n");
+    if(det==0)AliWarning("problem det==0");
     Double_t detX = 0.;
     Double_t detY = 0.;
     Double_t detZ = 0.;
@@ -2326,7 +2327,7 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
   std::vector<Int_t> jetParticleIndex;
 
   if(GetReader()->ReadStack()) {//ESD
-     if(GetDebug()>3) printf("I use stack\n");
+     AliDebug(3,"I use stack");
   }//end Stack 
   else if(GetReader()->ReadAODMCParticles()) {//AOD
     TClonesArray * mcparticles = GetReader()->GetAODMCParticles();
@@ -2335,14 +2336,14 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
       //index =6 and 7 is hard scattering (jet-quark or photon)
       primTmp = (AliAODMCParticle *) mcparticles->At(6);
       pdg=primTmp->GetPdgCode();
-       if(GetDebug()>3) printf("id 6 pdg %d, pt %f ",pdg,primTmp->Pt() );
+       AliDebug(3,Form("id 6 pdg %d, pt %f ",pdg,primTmp->Pt() ));
       if(TMath::Abs(pdg)<=6 ||pdg==21) {
        fhMCJetOrigin->Fill(pdg);
        fMCPartonType=pdg;
       }
       primTmp = (AliAODMCParticle *) mcparticles->At(7);
       pdg=primTmp->GetPdgCode();
-       if(GetDebug()>3) printf("id 7 pdg %d, pt %f\n",pdg,primTmp->Pt() );
+       AliDebug(3,Form("id 7 pdg %d, pt %f",pdg,primTmp->Pt() ));
       if(TMath::Abs(pdg)<=6 ||pdg==21) {
        fhMCJetOrigin->Fill(pdg);
        fMCPartonType=pdg;
@@ -2360,7 +2361,7 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
          fhMCPhotonCuts->Fill(0);
          if(prim->GetStatus()!=1) continue;
          fhMCPhotonCuts->Fill(1);
-          if(GetDebug()>5) printf("id %d, prim %d, physPrim %d, status %d\n",i,prim->IsPrimary(),prim->IsPhysicalPrimary(),prim->GetStatus());
+          AliDebug(5,Form("id %d, prim %d, physPrim %d, status %d\n",i,prim->IsPrimary(),prim->IsPhysicalPrimary(),prim->GetStatus()));
          while(mother>7){
            primTmp = (AliAODMCParticle *) mcparticles->At(mother);
            mother=primTmp->GetMother();
@@ -2380,8 +2381,7 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
          fhMCPhotonEtaPhi->Fill(photonPhi,photonEta);
          
          //Check if photons hit the Calorimeter
-         TLorentzVector lv;
-         lv.SetPxPyPzE(prim->Px(),prim->Py(),prim->Pz(),prim->E());
+         fMomentum.SetPxPyPzE(prim->Px(),prim->Py(),prim->Pz(),prim->E());
          inacceptance = kFALSE;
          if(GetCaloUtils()->IsEMCALGeoMatrixSet()){
            fhMCPhotonCuts->Fill(4);
@@ -2389,33 +2389,35 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
            if(GetEMCALGeometry()) {
              GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(prim->Eta(),prim->Phi(),absID);
              if(absID >= 0) inacceptance = kTRUE;
-             if(GetDebug() > 3) printf("In EMCAL Real acceptance? %d\n",inacceptance);
+             AliDebug(3,Form("In EMCAL Real acceptance? %d",inacceptance));
            }
            else{
-             if(GetFiducialCut()->IsInFiducialCut(lv,"EMCAL")) inacceptance = kTRUE ;
-             if(GetDebug() > 3) printf("In EMCAL fiducial cut acceptance? %d\n",inacceptance);
+             if(GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) inacceptance = kTRUE ;
+             AliDebug(1,Form("In EMCAL fiducial cut acceptance? %d",inacceptance));
            }
          }else{//no EMCAL nor EMCALGeoMatrixSet
-           printf("not EMCALGeoMatrix set\n");
+           AliWarning("not EMCALGeoMatrix set");
          }//end of check if EMCAL
          if(inacceptance)fhMCPhotonCuts->Fill(5);
-         if(GetDebug() > 5)
-           printf("Photon Energy %f, Pt %f\n",prim->E(),prim->Pt());
+         AliDebug(5,Form("Photon Energy %f, Pt %f",prim->E(),prim->Pt()));
          fMCGamPt=photonPt;
          fMCGamEta=photonEta;
          fMCGamPhi=photonPhi;
        }//end of check if photon
-       else{//not photon
+       else
+  {//not photon
          if(prim->GetStatus()!=1) continue;
-         if(GetDebug() > 5)
-           printf("id %d, prim %d, physPrim %d, status %d, pdg %d, E %f ",i,prim->IsPrimary(),prim->IsPhysicalPrimary(),prim->GetStatus(),prim->GetPdgCode(),prim->E());
-         while(mother>7){
+         AliDebug(5,Form("id %d, prim %d, physPrim %d, status %d, pdg %d, E %f",
+                    i,prim->IsPrimary(),prim->IsPhysicalPrimary(),prim->GetStatus(),prim->GetPdgCode(),prim->E()));
+    
+         while(mother>7)
+    {
            primTmp = (AliAODMCParticle *) mcparticles->At(mother);
            mother=primTmp->GetMother();
-           if(GetDebug() > 5) printf("next mother %d ",mother);
+           AliDebug(5,Form("next mother %d",mother));
          }
-         if(GetDebug() > 5) printf("\n");
          if(mother<6)continue;//soft part
+    
          primTmp = (AliAODMCParticle *) mcparticles->At(mother);
          pdg=primTmp->GetPdgCode();
          if( !(TMath::Abs(pdg)<=6 || pdg==21) ) continue;//origin not hard q or g
@@ -2546,13 +2548,13 @@ void AliAnaParticleJetFinderCorrelation::FindMCgenInfo(){
 
 
   //printouts
-  if(GetDebug() > 3) {
-    printf("cone full %f, charged %f, full150 %f, charged150 %f\n",coneJet,coneChargedJet,coneJet150,coneChargedJet150);
-    printf("Npart %d, NchPart %d, Npart(pt>150M) %d, NchPart(pt>150M) %d, NchPart(pt>150M)Cone %d\n",nParticlesInJet,nChargedParticlesInJet,nParticlesInJet150,nChargedParticlesInJet150,nChargedParticlesInJet150Cone);
-    printf("Etot %f, Ech %f, E(pt>150M) %f, Ech(pt>150M) %f\n",eneParticlesInJet,eneChargedParticlesInJet,eneParticlesInJet150,eneChargedParticlesInJet150);
-    printf("pt %f, ptch %f, pt(pt>150M) %f,ptch(pt>150M) %f,ptch(pt>150M)Cone %f\n",ptParticlesInJet,ptChargedParticlesInJet,ptParticlesInJet150,ptChargedParticlesInJet150,ptChargedParticlesInJet150Cone);
-    printf("eta/phi tot %f/%f, ch %f/%f, tot150 %f/%f,  ch150 %f/%f, ch150cone %f/%f\n",etaParticlesInJet,phiParticlesInJet,etaChargedParticlesInJet,phiChargedParticlesInJet,etaParticlesInJet150,phiParticlesInJet150,etaChargedParticlesInJet150,phiChargedParticlesInJet150,etaChargedParticlesInJet150Cone,phiChargedParticlesInJet150Cone);
-  }
+  
+  AliDebug(3,Form("cone full %f, charged %f, full150 %f, charged150 %f",coneJet,coneChargedJet,coneJet150,coneChargedJet150));
+  AliDebug(3,Form("Npart %d, NchPart %d, Npart(pt>150M) %d, NchPart(pt>150M) %d, NchPart(pt>150M)Cone %d\n",nParticlesInJet,nChargedParticlesInJet,nParticlesInJet150,nChargedParticlesInJet150,nChargedParticlesInJet150Cone));
+  AliDebug(3,Form("Etot %f, Ech %f, E(pt>150M) %f, Ech(pt>150M) %f\n",eneParticlesInJet,eneChargedParticlesInJet,eneParticlesInJet150,eneChargedParticlesInJet150));
+  AliDebug(3,Form("pt %f, ptch %f, pt(pt>150M) %f,ptch(pt>150M) %f,ptch(pt>150M)Cone %f\n",ptParticlesInJet,ptChargedParticlesInJet,ptParticlesInJet150,ptChargedParticlesInJet150,ptChargedParticlesInJet150Cone));
+  AliDebug(3,Form("eta/phi tot %f/%f, ch %f/%f, tot150 %f/%f,  ch150 %f/%f, ch150cone %f/%f\n",etaParticlesInJet,phiParticlesInJet,etaChargedParticlesInJet,phiChargedParticlesInJet,etaParticlesInJet150,phiParticlesInJet150,etaChargedParticlesInJet150,phiChargedParticlesInJet150,etaChargedParticlesInJet150Cone,phiChargedParticlesInJet150Cone));
+  
   //fill histograms
   if(ptParticlesInJet) fhMCJetRatioChFull->Fill(ptChargedParticlesInJet/ptParticlesInJet);
   if(ptChargedParticlesInJet) fhMCJetRatioCh150Ch->Fill(ptChargedParticlesInJet150/ptChargedParticlesInJet);
index 943bf9850f8528c76760b4407fcf96b62d34c1a4..dccff8eb8121be4a2978ba79f426fce8b9604db3 100644 (file)
@@ -156,6 +156,8 @@ private:
 
   TRandom2 * fGenerator;//! pointer to random generator object
 
+  TLorentzVector fMomentum; //! momentum
+  
   // Histograms
   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
index 9d9d466ffbd8b1f5e200922f254b24b340ffe48a..283dbc16f39f13f5984e4ca5b1792dfb6136ad27 100755 (executable)
 // 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 
+//  Class created from old AliPHOSGammaJet
 //  (see AliRoot versions previous Release 4-09)
 //
-//*-- Author: Gustavo Conesa (LNF-INFN) 
+//*-- Author: Gustavo Conesa (LNF-INFN)
 //////////////////////////////////////////////////////////////////////////////
 
 
@@ -38,7 +38,7 @@
 #include "AliVCluster.h"
 #include "AliCaloTrackReader.h"
 #include "AliNeutralMesonSelection.h"
-#include "AliAnaParticleJetLeadingConeCorrelation.h"  
+#include "AliAnaParticleJetLeadingConeCorrelation.h"
 #include "AliCaloPID.h"
 #include "AliAODPWG4ParticleCorrelation.h"
 #include "AliFiducialCut.h"
 ClassImp(AliAnaParticleJetLeadingConeCorrelation)
 
 
-//____________________________________________________________________________
-  AliAnaParticleJetLeadingConeCorrelation::AliAnaParticleJetLeadingConeCorrelation() : 
-    AliAnaCaloTrackCorrBaseClass(), 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),
-    fSelectIsolated(0),        
-    //Histograms
-    fOutCont(0x0),
-    //Leading
-    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),fhChargedLeadingXi(0), fhNeutralLeadingXi(0),
-    fhChargedLeadingDeltaPhiRatioPt30(0), fhNeutralLeadingDeltaPhiRatioPt30(0),
-    fhChargedLeadingDeltaPhiRatioPt50(0), fhNeutralLeadingDeltaPhiRatioPt50(0),
-    //Jet
-    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()
+//_________________________________________________________________________________
+AliAnaParticleJetLeadingConeCorrelation::AliAnaParticleJetLeadingConeCorrelation() :
+AliAnaCaloTrackCorrBaseClass(), 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),fSelectIsolated(0),
+fTrackVector(),fBkgMom(),fJetMom(),fJetConstMom(),
+fLeadingMom(),fLeadingPi0Mom(),fLeadingPhoMom1(),fLeadingPhoMom2(),fLeadingChargeMom(),
+//Histograms
+fOutCont(0x0),
+//Leading
+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),fhChargedLeadingXi(0), fhNeutralLeadingXi(0),
+fhChargedLeadingDeltaPhiRatioPt30(0), fhNeutralLeadingDeltaPhiRatioPt30(0),
+fhChargedLeadingDeltaPhiRatioPt50(0), fhNeutralLeadingDeltaPhiRatioPt50(0),
+//Jet
+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 ;
@@ -112,7 +113,7 @@ ClassImp(AliAnaParticleJetLeadingConeCorrelation)
     for(Int_t j = 0; j<5; j++){
       fhJetPts[i][j]=0 ;
       fhJetRatioPts[i][j]=0 ;
-      fhJetDeltaPhis[i][j]=0 ; 
+      fhJetDeltaPhis[i][j]=0 ;
       fhJetDeltaEtas[i][j]=0 ;
       fhJetLeadingRatioPts[i][j]=0 ;
       fhJetLeadingDeltaPhis[i][j]=0 ;
@@ -123,7 +124,7 @@ ClassImp(AliAnaParticleJetLeadingConeCorrelation)
       fhJetNTracksInCones[i][j]=0 ;
       fhBkgPts[i][j]=0 ;
       fhBkgRatioPts[i][j]=0 ;
-      fhBkgDeltaPhis[i][j]=0 ; 
+      fhBkgDeltaPhis[i][j]=0 ;
       fhBkgDeltaEtas[i][j]=0 ;
       fhBkgLeadingRatioPts[i][j]=0 ;
       fhBkgLeadingDeltaPhis[i][j]=0 ;
@@ -134,228 +135,13 @@ ClassImp(AliAnaParticleJetLeadingConeCorrelation)
       fhBkgNTracksInCones[i][j]=0 ;
     }
   }
-
-  InitParameters();
-
-}
-/*
-//____________________________________________________________________________
-AliAnaParticleJetLeadingConeCorrelation::AliAnaParticleJetLeadingConeCorrelation(const AliAnaParticleJetLeadingConeCorrelation & jetlc) :   
-  AliAnaCaloTrackCorrBaseClass(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), 
-  fSelectIsolated(jetlc.fSelectIsolated),    
-  //Histograms
-  fOutCont(jetlc. fOutCont),
-  //Leading
-  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),
-  fhChargedLeadingXi(jetlc.fhChargedLeadingXi), fhNeutralLeadingXi(jetlc.fhNeutralLeadingXi),
-  fhChargedLeadingDeltaPhiRatioPt30(jetlc.fhChargedLeadingDeltaPhiRatioPt30), fhNeutralLeadingDeltaPhiRatioPt30(jetlc.fhNeutralLeadingDeltaPhiRatioPt30),
-  fhChargedLeadingDeltaPhiRatioPt50(jetlc.fhChargedLeadingDeltaPhiRatioPt50), fhNeutralLeadingDeltaPhiRatioPt50(jetlc.fhNeutralLeadingDeltaPhiRatioPt50),
-  //Jet
-  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;
-  ((AliAnaCaloTrackCorrBaseClass *)this)->operator=(jetlc);
+  InitParameters();
   
-  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 ;  
-  fSelectIsolated        = jetlc.fSelectIsolated ;
-
-  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;
-  fhChargedLeadingXi = jetlc.fhChargedLeadingXi; 
-  fhNeutralLeadingXi = jetlc.fhNeutralLeadingXi;
-
-  fhChargedLeadingDeltaPhiRatioPt30 = jetlc.fhChargedLeadingDeltaPhiRatioPt30; 
-  fhNeutralLeadingDeltaPhiRatioPt30 = jetlc.fhNeutralLeadingDeltaPhiRatioPt30;
-  fhChargedLeadingDeltaPhiRatioPt50 = jetlc.fhChargedLeadingDeltaPhiRatioPt50; 
-  fhNeutralLeadingDeltaPhiRatioPt50 = jetlc.fhNeutralLeadingDeltaPhiRatioPt50; 
-       
-  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.
 }
 
 //____________________________________________________________________________
-Double_t AliAnaParticleJetLeadingConeCorrelation::CalculateJetRatioLimit(const Double_t ptg, const Double_t *par, const Double_t *x) const {
+Double_t AliAnaParticleJetLeadingConeCorrelation::CalculateJetRatioLimit(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
   //printf("CalculateLimit: x1 %2.3f, x2%2.3f\n",x[0],x[1]);
@@ -370,21 +156,23 @@ Double_t AliAnaParticleJetLeadingConeCorrelation::CalculateJetRatioLimit(const D
   return rat ;
 }
 
-//____________________________________________________________________________
-void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector  leading, const TLorentzVector jet, const TString type, const TString lastname)
+//___________________________________________________________________________________________________
+void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCorrelation * particle,
+                                                            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();
+  //Fill jet and background histograms
+  Double_t ptTrig  = particle->Pt();
+  Double_t ptJet   = jet.Pt();
+  Double_t ptLead  = fLeadingMom.Pt();
   Double_t phiTrig = particle->Phi();
-  Double_t phiJet = jet.Phi();
+  Double_t phiJet  = jet.Phi();
   if(phiJet < 0) phiJet+=TMath::TwoPi();
-  Double_t phiLead = leading.Phi();
+  Double_t phiLead = fLeadingMom.Phi();
   if(phiLead < 0) phiLead+=TMath::TwoPi();
   Double_t etaTrig = particle->Eta();
-  Double_t etaJet = jet.Eta();
-  Double_t etaLead = leading.Eta();
+  Double_t etaJet  = jet.Eta();
+  Double_t etaLead = fLeadingMom.Eta();
   
   TH2F *h1 = 0x0;
   h1 = dynamic_cast<TH2F*>(GetOutputContainer()->FindObject(Form("%s%sPt%s",GetAddedHistogramsStringToName().Data(),type.Data(),lastname.Data())));
@@ -429,27 +217,26 @@ void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCo
   //Float_t ptcut = fJetPtThreshold;
   //if(fPbPb && !fSeveralConeAndPtCuts && ptTrig > fPtTriggerSelectionCut)  ptcut = fJetPtThresPbPb ;
   
-  TVector3 p3;
-  Int_t nTracksInCone = 0; 
+  Int_t nTracksInCone = 0;
   
   for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack* track = dynamic_cast<AliVTrack *>(pl->At(ipr)) ;
-    if(track)p3.SetXYZ(track->Px(),track->Py(),track->Pz());
-    else printf("AliAnaParticleJetLeadingConeCorrelation::FillJetHistos() - Track not available\n");
+    if(track)fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    else AliDebug(1,"Track not available");
     
     //Recheck if particle is in jet cone
     if(fReMakeJet || fSeveralConeAndPtCuts)
-      if(!IsParticleInJetCone(p3.Eta(), p3.Phi(), leading.Eta(), leading.Phi()) ) continue ; 
+      if(!IsParticleInJetCone(fTrackVector.Eta(), fTrackVector.Phi(), fLeadingMom.Eta(), fLeadingMom.Phi()) ) continue ;
     
-    nTracksInCone++; 
+    nTracksInCone++;
     
     TH2F *ha =dynamic_cast<TH2F*>(GetOutputContainer()->FindObject(Form("%s%sFFz%s",GetAddedHistogramsStringToName().Data(),type.Data(),lastname.Data())));
-    if(ha) ha->Fill(ptTrig,p3.Pt()/ptTrig);
+    if(ha) ha->Fill(ptTrig,fTrackVector.Pt()/ptTrig);
     TH2F *hb  =dynamic_cast<TH2F*>(GetOutputContainer()->FindObject(Form("%s%sFFxi%s",GetAddedHistogramsStringToName().Data(),type.Data(),lastname.Data())));
-    if(hb) hb->Fill(ptTrig,TMath::Log(ptTrig/p3.Pt()));
+    if(hb) hb->Fill(ptTrig,TMath::Log(ptTrig/fTrackVector.Pt()));
     TH2F *hc =dynamic_cast<TH2F*>(GetOutputContainer()->FindObject(Form("%s%sFFpt%s",GetAddedHistogramsStringToName().Data(),type.Data(),lastname.Data())));
-    if(hc) hc->Fill(ptTrig,p3.Pt());
+    if(hc) hc->Fill(ptTrig,fTrackVector.Pt());
     
   }//track loop
   
@@ -463,14 +250,12 @@ void AliAnaParticleJetLeadingConeCorrelation::FillJetHistos(AliAODPWG4ParticleCo
 
 //________________________________________________________________________
 TList *  AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects()
-{  
-  // Create histograms to be saved in output file and 
+{
+  // Create histograms to be saved in output file and
   // store them in fOutCont
   
-  if(GetDebug()>1) printf("AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects() - Init histograms \n");
-  
-  fOutCont = new TList() ; 
-  fOutCont->SetName("ParticleJetLeadingInConeCorrelationHistograms") ; 
+  fOutCont = new TList() ;
+  fOutCont->SetName("ParticleJetLeadingInConeCorrelationHistograms") ;
   
   Int_t nptbins  = GetHistogramRanges()->GetHistoPtBins();
   Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins();
@@ -480,164 +265,164 @@ TList *  AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects()
   Float_t etamax = GetHistogramRanges()->GetHistoEtaMax();
   Float_t ptmin  = GetHistogramRanges()->GetHistoPtMin();
   Float_t phimin = GetHistogramRanges()->GetHistoPhiMin();
-  Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();     
+  Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();
   
-  fhChargedLeadingPt  = new TH2F("ChargedLeadingPt","p_{T leading charge} vs p_{T trigger}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+  fhChargedLeadingPt  = new TH2F("ChargedLeadingPt","p_{T leading charge} vs p_{T trigger}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
   fhChargedLeadingPt->SetYTitle("p_{T leading charge}");
   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  = 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  = 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  = 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  = 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  = 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  = 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)");
   
-  fhChargedLeadingXi  = new TH2F("ChargedLeadingXi","ln(p_{T trigger} / p_{T leading charge} ) vs p_{T trigger}",nptbins,ptmin,ptmax,120,0,10); 
+  fhChargedLeadingXi  = new TH2F("ChargedLeadingXi","ln(p_{T trigger} / p_{T leading charge} ) vs p_{T trigger}",nptbins,ptmin,ptmax,120,0,10);
   fhChargedLeadingXi->SetYTitle("#xi");
   fhChargedLeadingXi->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(fhChargedLeadingDeltaPt) ;
+  fOutCont->Add(fhChargedLeadingDeltaPhi) ;
+  fOutCont->Add(fhChargedLeadingDeltaEta) ;
   fOutCont->Add(fhChargedLeadingRatioPt) ;
   fOutCont->Add(fhChargedLeadingXi) ;
-       
-  fhChargedLeadingDeltaPhiRatioPt30  = new TH2F("ChargedLeadingDeltaPhiRatioPt30","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, charged leading, p_{T trigger} > 30 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1); 
+  
+  fhChargedLeadingDeltaPhiRatioPt30  = new TH2F("ChargedLeadingDeltaPhiRatioPt30","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, charged leading, p_{T trigger} > 30 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1);
   fhChargedLeadingDeltaPhiRatioPt30->SetXTitle("#Delta #phi (rad)");
-  fhChargedLeadingDeltaPhiRatioPt30->SetYTitle("p_{T leading} / p_{T trigger}");       
-       
-  fhChargedLeadingDeltaPhiRatioPt50  = new TH2F("ChargedLeadingDeltaPhiRatioPt50","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, charged leading, p_{T trigger} > 50 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1); 
+  fhChargedLeadingDeltaPhiRatioPt30->SetYTitle("p_{T leading} / p_{T trigger}");
+  
+  fhChargedLeadingDeltaPhiRatioPt50  = new TH2F("ChargedLeadingDeltaPhiRatioPt50","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, charged leading, p_{T trigger} > 50 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1);
   fhChargedLeadingDeltaPhiRatioPt50->SetXTitle("#Delta #phi (rad)");
-  fhChargedLeadingDeltaPhiRatioPt50->SetYTitle("p_{T leading} / p_{T trigger}");         
-       
-  fOutCont->Add(fhChargedLeadingDeltaPhiRatioPt30) ; 
-  fOutCont->Add(fhChargedLeadingDeltaPhiRatioPt50) ; 
-       
+  fhChargedLeadingDeltaPhiRatioPt50->SetYTitle("p_{T leading} / p_{T trigger}");
+  
+  fOutCont->Add(fhChargedLeadingDeltaPhiRatioPt30) ;
+  fOutCont->Add(fhChargedLeadingDeltaPhiRatioPt50) ;
+  
   if(!fJetsOnlyInCTS){
     
-    fhNeutralLeadingPt  = new TH2F("NeutralLeadingPt","p_{T leading #pi^{0}} vs p_{T trigger}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    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}}");
     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  = 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  = 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  = 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  = 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  = 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  = 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)");
     
-    fhNeutralLeadingXi  = new TH2F("NeutralLeadingXi","ln(p_{T trigger} / p_{T leading #pi^{0}} ) vs p_{T trigger}",nptbins,ptmin,ptmax,120,0,10); 
+    fhNeutralLeadingXi  = new TH2F("NeutralLeadingXi","ln(p_{T trigger} / p_{T leading #pi^{0}} ) vs p_{T trigger}",nptbins,ptmin,ptmax,120,0,10);
     fhNeutralLeadingXi->SetYTitle("#xi");
     fhNeutralLeadingXi->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(fhNeutralLeadingDeltaPt) ;
+    fOutCont->Add(fhNeutralLeadingDeltaPhi) ;
+    fOutCont->Add(fhNeutralLeadingDeltaEta) ;
     fOutCont->Add(fhNeutralLeadingRatioPt) ;
     fOutCont->Add(fhNeutralLeadingXi) ;
-         
-       fhNeutralLeadingDeltaPhiRatioPt30  = new TH2F("NeutralLeadingDeltaPhiRatioPt30","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, neutral leading, p_{T trigger} > 30 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1); 
-       fhNeutralLeadingDeltaPhiRatioPt30->SetXTitle("#Delta #phi (rad)");
-       fhNeutralLeadingDeltaPhiRatioPt30->SetYTitle("p_{T leading} / p_{T trigger}");
-         
-       fhNeutralLeadingDeltaPhiRatioPt50  = new TH2F("NeutralLeadingDeltaPhiRatioPt50","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, neutral leading, p_{T trigger} > 50 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1); 
-       fhNeutralLeadingDeltaPhiRatioPt50->SetXTitle("#Delta #phi (rad)");
-       fhNeutralLeadingDeltaPhiRatioPt50->SetYTitle("p_{T leading} / p_{T trigger}");
-       fOutCont->Add(fhNeutralLeadingDeltaPhiRatioPt30) ; 
-       fOutCont->Add(fhNeutralLeadingDeltaPhiRatioPt50) ; 
-
+    
+    fhNeutralLeadingDeltaPhiRatioPt30  = new TH2F("NeutralLeadingDeltaPhiRatioPt30","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, neutral leading, p_{T trigger} > 30 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1);
+    fhNeutralLeadingDeltaPhiRatioPt30->SetXTitle("#Delta #phi (rad)");
+    fhNeutralLeadingDeltaPhiRatioPt30->SetYTitle("p_{T leading} / p_{T trigger}");
+    
+    fhNeutralLeadingDeltaPhiRatioPt50  = new TH2F("NeutralLeadingDeltaPhiRatioPt50","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T leading}/p_{T trigger}, neutral leading, p_{T trigger} > 50 GeV/c",120,0,TMath::TwoPi(),nptbins,0,1);
+    fhNeutralLeadingDeltaPhiRatioPt50->SetXTitle("#Delta #phi (rad)");
+    fhNeutralLeadingDeltaPhiRatioPt50->SetYTitle("p_{T leading} / p_{T trigger}");
+    fOutCont->Add(fhNeutralLeadingDeltaPhiRatioPt30) ;
+    fOutCont->Add(fhNeutralLeadingDeltaPhiRatioPt50) ;
+    
   }
   
   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  = 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  = 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  = 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  = 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  = 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,-TMath::Pi(),TMath::Pi()); 
+    fhJetLeadingDeltaPhi  = new TH2F("JetLeadingDeltaPhi","#phi_{jet} - #phi_{leading} vs p_{T trigger}",nptbins,ptmin,ptmax,120,-TMath::Pi(),TMath::Pi());
     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  = 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  = 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  = 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  = 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  = 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(fhJetPt) ;
+    fOutCont->Add(fhJetRatioPt) ;
     fOutCont->Add(fhJetDeltaPhi) ;
     fOutCont->Add(fhJetDeltaEta) ;
     fOutCont->Add(fhJetLeadingRatioPt) ;
@@ -649,52 +434,52 @@ TList *  AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects()
     fOutCont->Add(fhJetNTracksInCone) ;
     
     //Bkg Distributions
-    fhBkgPt  = new TH2F("BkgPt","p_{T  bkg} vs p_{T trigger}",nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    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  = 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  = 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  = 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  = 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  = 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  = 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  = 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  = 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  = 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  = 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(fhBkgPt) ;
+    fOutCont->Add(fhBkgRatioPt) ;
     fOutCont->Add(fhBkgDeltaPhi) ;
     fOutCont->Add(fhBkgDeltaEta) ;
     fOutCont->Add(fhBkgLeadingRatioPt) ;
@@ -709,124 +494,124 @@ TList *  AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects()
   else{ //If we want to study the jet for different cones and pt
     for(Int_t icone = 0; icone<fJetNCone; icone++){//icone
       for(Int_t ipt = 0; ipt<fJetNPt;ipt++){ //ipt
-       
-       TString lastnamehist ="Cone"+ fJetNameCones[icone]+"Pt"+ fJetNamePtThres[ipt];
-       TString lastnametitle =", cone ="+fJetNameCones[icone]+", pt > " +fJetNamePtThres[ipt]+" GeV/c";
-       
-       //Jet Distributions
-       fhJetPts[icone][ipt] = new TH2F(Form("JetPt%s",lastnamehist.Data()),Form("p_{T  jet} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetRatioPt%s",lastnamehist.Data()),Form("p_{T  jet}/p_{T trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetDeltaPhi%s",lastnamehist.Data()),Form("#phi_{jet} - #phi_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetDeltaEta%s",lastnamehist.Data()),Form("#eta_{jet} - #eta_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingRatioPt%s",lastnamehist.Data()),Form("p_{T  jet} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingDeltaPhi%s",lastnamehist.Data()),Form("#phi_{jet} - #phi_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingDeltaEta%s",lastnamehist.Data()),Form("#eta_{jet} - #eta_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetFFz%s",lastnamehist.Data()),"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(Form("JetFFxi%s",lastnamehist.Data()),"#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(Form("JetFFpt%s",lastnamehist.Data()),"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(Form("JetNTracksInCone%s",lastnamehist.Data()),Form("N particles in cone vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgPt%s",lastnamehist.Data()),Form("p_{T  bkg} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgRatioPt%s",lastnamehist.Data()),Form("p_{T  bkg}/p_{T trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgDeltaPhi%s",lastnamehist.Data()),Form("#phi_{bkg} - #phi_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgDeltaEta%s",lastnamehist.Data()),Form("#eta_{bkg} - #eta_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingRatioPt%s",lastnamehist.Data()),Form("p_{T  bkg} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingDeltaPhi%s",lastnamehist.Data()),Form("#phi_{bkg} - #phi_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingDeltaEta%s",lastnamehist.Data()),Form("#eta_{bkg} - #eta_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgFFz%s",lastnamehist.Data()),"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(Form("BkgFFxi%s",lastnamehist.Data()),"#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(Form("BkgFFpt%s",lastnamehist.Data()),"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(Form("BkgNTracksInCone%s",lastnamehist.Data()),Form("N particles in cone vs p_{T trigger} %s",lastnametitle.Data()),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]) ;
-       
+        
+        TString lastnamehist ="Cone"+ fJetNameCones[icone]+"Pt"+ fJetNamePtThres[ipt];
+        TString lastnametitle =", cone ="+fJetNameCones[icone]+", pt > " +fJetNamePtThres[ipt]+" GeV/c";
+        
+        //Jet Distributions
+        fhJetPts[icone][ipt] = new TH2F(Form("JetPt%s",lastnamehist.Data()),Form("p_{T  jet} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetRatioPt%s",lastnamehist.Data()),Form("p_{T  jet}/p_{T trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetDeltaPhi%s",lastnamehist.Data()),Form("#phi_{jet} - #phi_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetDeltaEta%s",lastnamehist.Data()),Form("#eta_{jet} - #eta_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingRatioPt%s",lastnamehist.Data()),Form("p_{T  jet} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingDeltaPhi%s",lastnamehist.Data()),Form("#phi_{jet} - #phi_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetLeadingDeltaEta%s",lastnamehist.Data()),Form("#eta_{jet} - #eta_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("JetFFz%s",lastnamehist.Data()),"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(Form("JetFFxi%s",lastnamehist.Data()),"#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(Form("JetFFpt%s",lastnamehist.Data()),"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(Form("JetNTracksInCone%s",lastnamehist.Data()),Form("N particles in cone vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgPt%s",lastnamehist.Data()),Form("p_{T  bkg} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgRatioPt%s",lastnamehist.Data()),Form("p_{T  bkg}/p_{T trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgDeltaPhi%s",lastnamehist.Data()),Form("#phi_{bkg} - #phi_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgDeltaEta%s",lastnamehist.Data()),Form("#eta_{bkg} - #eta_{trigger} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingRatioPt%s",lastnamehist.Data()),Form("p_{T  bkg} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingDeltaPhi%s",lastnamehist.Data()),Form("#phi_{bkg} - #phi_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgLeadingDeltaEta%s",lastnamehist.Data()),Form("#eta_{bkg} - #eta_{leading} vs p_{T trigger} %s",lastnametitle.Data()),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(Form("BkgFFz%s",lastnamehist.Data()),"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(Form("BkgFFxi%s",lastnamehist.Data()),"#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(Form("BkgFFpt%s",lastnamehist.Data()),"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(Form("BkgNTracksInCone%s",lastnamehist.Data()),Form("N particles in cone vs p_{T trigger} %s",lastnametitle.Data()),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
@@ -837,207 +622,216 @@ TList *  AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects()
     TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
     if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
       for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) fOutCont->Add(nmsHistos->At(i)) ;
-       delete nmsHistos;
+    delete nmsHistos;
   }
   
   
-  if(GetDebug() > 2){
-    printf("AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects() - All histograms names : \n");
-    for(Int_t i  = 0 ;  i<  fOutCont->GetEntries(); i++)
-      printf("Histo i %d name %s\n",i,((fOutCont->At(i))->GetName()));
-    //cout<< (fOutCont->At(i))->GetName()<<endl;
-  }
+  //  if(GetDebug() > 2)
+  //  {
+  //    printf("AliAnaParticleJetLeadingConeCorrelation::GetCreateOutputObjects() - All histograms names : \n");
+  //    for(Int_t i  = 0 ;  i<  fOutCont->GetEntries(); i++)
+  //      printf("Histo i %d name %s\n",i,((fOutCont->At(i))->GetName()));
+  //    //cout<< (fOutCont->At(i))->GetName()<<endl;
+  //  }
   
   return fOutCont;
-
+  
 }
 
-//____________________________________________________________________________
-Bool_t  AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle(AliAODPWG4ParticleCorrelation *particle, TLorentzVector & pLeading) 
+//__________________________________________________________________________________________________________
+Bool_t  AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle(AliAODPWG4ParticleCorrelation * particle)
 {
   //Search Charged or Neutral leading particle, select the highest one and fill AOD
   
-  TLorentzVector pLeadingCh(0,0,0,0) ;
-  TLorentzVector pLeadingPi0(0,0,0,0) ;
   
-  GetLeadingCharge(particle, pLeadingCh) ;
-  if(!fJetsOnlyInCTS) GetLeadingPi0(particle, pLeadingPi0) ;
+  GetLeadingCharge(particle) ;
+  if(!fJetsOnlyInCTS) GetLeadingPi0(particle) ;
+  
+  Double_t ptch = fLeadingChargeMom.Pt();
+  Double_t ptpi = fLeadingPi0Mom   .Pt();
   
-  Double_t ptch = pLeadingCh.Pt(); 
-  Double_t ptpi = pLeadingPi0.Pt(); 
-  if (ptch > 0 || ptpi > 0){
-    if((ptch >= ptpi)){
-      if(GetDebug() > 1)printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle() - Leading found in CTS \n");
-      pLeading = pLeadingCh;
-      if(GetDebug() > 1) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle() - Found Leading: pt %2.3f, phi %2.3f deg, eta %2.3f\n", 
-                               pLeading.Pt(),pLeading.Phi()*TMath::RadToDeg(),pLeading.Eta()) ;
+  if (ptch > 0 || ptpi > 0)
+  {
+    if((ptch >= ptpi))
+    {
+      AliDebug(1,"Leading found in CTS");
+      
+      fLeadingMom = fLeadingChargeMom;
+      
+      AliDebug(1,Form("Found Leading: pt %2.3f, phi %2.3f deg, eta %2.3f",fLeadingMom.Pt(),fLeadingMom.Phi()*TMath::RadToDeg(),fLeadingMom.Eta())) ;
+      
       //Put leading in AOD
-      particle->SetLeading(pLeadingCh);
+      particle->SetLeading(fLeadingChargeMom);
       particle->SetLeadingDetector("CTS");
       return kTRUE;
     }
-    else{
-      if(GetDebug() > 1)
-       printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle() - Leading found in EMCAL \n");
-      pLeading = pLeadingPi0;
-      if(GetDebug() > 1) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle() - Found Leading: pt %2.3f, phi %2.3f, eta %2.3f\n", 
-                               pLeading.Pt(),pLeading.Phi()*TMath::RadToDeg(),pLeading.Eta()) ;
+    else
+    {
+      AliDebug(1,"Leading found in EMCAL");
+      
+      fLeadingMom = fLeadingPi0Mom;
+      
+      AliDebug(1,Form("Found Leading: pt %2.3f, phi %2.3f, eta %2.3f",fLeadingMom.Pt(),fLeadingMom.Phi()*TMath::RadToDeg(),fLeadingMom.Eta())) ;
       //Put leading in AOD
-      particle->SetLeading(pLeadingPi0);
+      particle->SetLeading(fLeadingPi0Mom);
       particle->SetLeadingDetector("EMCAL");
-      return kTRUE;   
+      return kTRUE;
     }
-  }  
+  }
   
-  if(GetDebug() > 1)printf ("AliAnaParticleJetLeadingConeCorrelation::GetLeadingParticle() - NO LEADING PARTICLE FOUND \n");
+  AliDebug(1,"NO LEADING PARTICLE FOUND");
   
-  return kFALSE; 
+  return kFALSE;
   
 }
 
-//____________________________________________________________________________
-void  AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge(AliAODPWG4ParticleCorrelation* const particle, TLorentzVector & pLeading) const
-{  
-  //Search for the charged particle with highest pt and with 
-  //Phi=Phi_trigger-Pi and pT=0.1E_gamma 
-  
-  if(GetCTSTracks()){
-    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 < GetCTSTracks()->GetEntriesFast() ; ipr ++ ){
-      AliVTrack* track = (AliVTrack *)(GetCTSTracks()->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 ;
-      //printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge() - Tracks: pt %2.3f eta %2.3f phi %2.3f pt/ptTrig %2.3f \n", 
-      //          pt, p3.Eta(), phi,pt/ptTrig) ; 
-      Float_t deltaphi = TMath::Abs(phiTrig-phi);
-      if((deltaphi > fDeltaPhiMinCut) && (deltaphi < fDeltaPhiMaxCut) &&
-         (rat > fLeadingRatioMinCut) && (rat < fLeadingRatioMaxCut)  && (pt  > ptl)) {
-       phil = phi ;
-       ptl  = pt ;
-       pLeading.SetVect(p3);
-      }
-    }// track loop
+//_______________________________________________________________________________________________________
+void  AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge(AliAODPWG4ParticleCorrelation * particle)
+{
+  //Search for the charged particle with highest pt and with
+  //Phi=Phi_trigger-Pi and pT=0.1E_gamma
+  
+  if(!GetCTSTracks()) return;
+  
+  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.;
+  
+  for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
+  {
+    AliVTrack* track = (AliVTrack *)(GetCTSTracks()->At(ipr)) ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    pt   = fTrackVector.Pt();
+    phi  = fTrackVector.Phi() ;
+    if(phi < 0) phi+=TMath::TwoPi();
+    rat  = pt/ptTrig ;
     
-    if(GetDebug() > 1 && ptl > 0 ) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge() - Leading in CTS: pt %2.3f eta %2.3f phi %2.3f pt/ptTrig %2.3f, |phiTrig-phi| %2.3f \n", 
-                                         ptl, pLeading.Eta(), phil,ptl/ptTrig, TMath::Abs(phiTrig-phil)) ;
+    //printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingCharge() - Tracks: pt %2.3f eta %2.3f phi %2.3f pt/ptTrig %2.3f \n",
+    //    pt, fTrackVector.Eta(), phi,pt/ptTrig) ;
     
-  }//CTS list exist
+    Float_t deltaphi = TMath::Abs(phiTrig-phi);
+    if((deltaphi > fDeltaPhiMinCut)     && (deltaphi < fDeltaPhiMaxCut) &&
+       (rat      > fLeadingRatioMinCut) && (rat      < fLeadingRatioMaxCut)  && (pt  > ptl))
+    {
+      phil = phi ;
+      ptl  = pt ;
+      fLeadingChargeMom.SetVect(fTrackVector);
+    }
+  }// track loop
+  
+  if( ptl > 0 )AliDebug(1,Form("Leading in CTS: pt %2.3f eta %2.3f phi %2.3f pt/ptTrig %2.3f, |phiTrig-phi| %2.3f",
+                               ptl, fLeadingChargeMom.Eta(), phil,ptl/ptTrig, TMath::Abs(phiTrig-phil))) ;
+  
 }
 
-//____________________________________________________________________________
-void  AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0(AliAODPWG4ParticleCorrelation* const particle, TLorentzVector & pLeading)
-{  
-  //Search for the neutral pion with highest pt and with 
+//____________________________________________________________________________________________________
+void  AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0(AliAODPWG4ParticleCorrelation * particle)
+{
+  //Search for the neutral pion with highest pt and with
   //Phi=Phi_trigger-Pi and pT=0.1E_gamma
   
-  if(GetEMCALClusters()){
-    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.;
+  if(!GetEMCALClusters()) return ;
+  
+  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.;
+  
+  //Get vertex for photon momentum calculation
+  Double_t vertex [] = {0,0,0} ; //vertex
+  if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
+  {
+    GetVertex(vertex);
+  }
+  
+  //Cluster loop, select pairs with good pt, phi and fill AODs or histograms
+  for(Int_t iclus = 0;iclus < GetEMCALClusters()->GetEntriesFast() ; iclus ++ )
+  {
+    AliVCluster * calo = (AliVCluster *)(GetEMCALClusters()->At(iclus)) ;
     
-    TLorentzVector gammai;
-    TLorentzVector gammaj;
-         
-    //Get vertex for photon momentum calculation
-    Double_t vertex [] = {0,0,0} ; //vertex 
-    if(GetReader()->GetDataType() != AliCaloTrackReader::kMC) 
+    //Cluster selection, not charged, with photon or pi0 id and in fiducial cut
+    Int_t pdgi=0;
+    if(!SelectCluster(calo, vertex,  fLeadingPhoMom1, pdgi))  continue ;
+    
+    AliDebug(1,Form("Neutral cluster: pt %2.3f, phi %2.3f",fLeadingPhoMom1.Pt(),fLeadingPhoMom1.Phi()));
+    
+    //2 gamma overlapped, found with PID
+    if(pdgi == AliCaloPID::kPi0)
     {
-      GetVertex(vertex);
-    }
-         
-    //Cluster loop, select pairs with good pt, phi and fill AODs or histograms
-    for(Int_t iclus = 0;iclus < GetEMCALClusters()->GetEntriesFast() ; iclus ++ ){
-      AliVCluster * calo = (AliVCluster *)(GetEMCALClusters()->At(iclus)) ;
-      
-      //Cluster selection, not charged, with photon or pi0 id and in fiducial cut
-      Int_t pdgi=0;
-      if(!SelectCluster(calo, vertex,  gammai, pdgi))  continue ;
+      AliDebug(1,"Neutral cluster ID as Pi0");
       
-      if(GetDebug() > 2) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0() - Neutral cluster: pt %2.3f, phi %2.3f \n", 
-                                gammai.Pt(),gammai.Phi());
+      pt  = fLeadingPhoMom1.Pt();
+      rat = pt/ptTrig;
+      phi = fLeadingPhoMom1.Phi();
+      if(phi < 0) phi+=TMath::TwoPi();
       
-      //2 gamma overlapped, found with PID
-      if(pdgi == AliCaloPID::kPi0){ 
+      //Selection within angular and energy limits
+      Float_t deltaphi = TMath::Abs(phiTrig-phi);
+      if(pt > ptl  && rat > fLeadingRatioMinCut  && rat < fLeadingRatioMaxCut  &&
+         deltaphi > fDeltaPhiMinCut && deltaphi < fDeltaPhiMaxCut )
+      {
+        phil = phi ;
+        ptl  = pt ;
+        fLeadingPi0Mom.SetPxPyPzE(fLeadingPhoMom1.Px(),fLeadingPhoMom1.Py(),fLeadingPhoMom1.Pz(),fLeadingPhoMom1.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 < GetEMCALClusters()->GetEntriesFast() ; jclus++ )
+      {
+        AliVCluster * calo2 = (AliVCluster *) (GetEMCALClusters()->At(jclus)) ;
         
-        if(GetDebug() > 2) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0() - Neutral cluster ID as Pi0 \n");
+        //Cluster selection, not charged with photon or pi0 id and in fiducial cut
+        Int_t pdgj=0;
         
-        pt  = gammai.Pt();
-        rat = pt/ptTrig;
-        phi = gammai.Phi();
-        if(phi < 0) phi+=TMath::TwoPi();
+        if     (!SelectCluster(calo2, vertex,  fLeadingPhoMom2, pdgj))  continue ;
         
-        //Selection within angular and energy limits
-        Float_t deltaphi = TMath::Abs(phiTrig-phi);
-        if(pt > ptl  && rat > fLeadingRatioMinCut  && rat < fLeadingRatioMaxCut  && 
-           deltaphi > fDeltaPhiMinCut && deltaphi < fDeltaPhiMaxCut )
+        if(pdgj == AliCaloPID::kPhoton )
         {
-          phil = phi ;
-          ptl  = pt ;
-          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 < GetEMCALClusters()->GetEntriesFast() ; jclus ++ ){
-          AliVCluster * calo2 = (AliVCluster *) (GetEMCALClusters()->At(jclus)) ;
+          pt  = (fLeadingPhoMom1+fLeadingPhoMom2).Pt();
+          phi = (fLeadingPhoMom1+fLeadingPhoMom2).Phi();
+          if(phi < 0) phi+=TMath::TwoPi();
+          rat = pt/ptTrig;
           
-          //Cluster selection, not charged with photon or pi0 id and in fiducial cut
-          Int_t pdgj=0;
+          //Selection within angular and energy limits
+          Float_t deltaphi = TMath::Abs(phiTrig-phi);
           
-          if     (!SelectCluster(calo2, vertex,  gammaj, pdgj))  continue ;
-
-          if(pdgj == AliCaloPID::kPhoton ){
-            
-            pt  = (gammai+gammaj).Pt();
-            phi = (gammai+gammaj).Phi();
-            if(phi < 0) phi+=TMath::TwoPi();  
-            rat = pt/ptTrig;
+          AliDebug(1,Form("Neutral Hadron Correlation: gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, |phiTrig-phi| %2.3f, pt/ptTrig %2.3f, M %2.3f",
+                          pt,phi,(fLeadingPhoMom1+fLeadingPhoMom2).Eta(), deltaphi, rat, (fLeadingPhoMom1+fLeadingPhoMom2).M()));
+          
+          if(pt > ptl  && rat > fLeadingRatioMinCut  && rat < fLeadingRatioMaxCut  &&
+             deltaphi > fDeltaPhiMinCut && deltaphi < fDeltaPhiMaxCut ){
+            //Select good pair (aperture and invariant mass)
+            if(GetNeutralMesonSelection()->SelectPair(fLeadingPhoMom1, fLeadingPhoMom2,kEMCAL)){
+              phil = phi ;
+              ptl  = pt ;
+              fLeadingPi0Mom=(fLeadingPhoMom1+fLeadingPhoMom2);
+              
+              AliDebug(1,Form("Neutral Hadron Correlation: Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f",
+                              ptl,phil,(fLeadingPhoMom1+fLeadingPhoMom2).Eta(), (fLeadingPhoMom1+fLeadingPhoMom2).M()));
+            }//pi0 selection
             
-            //Selection within angular and energy limits
-            Float_t deltaphi = TMath::Abs(phiTrig-phi);  
-            if(GetDebug() > 3 ) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0() - Neutral Hadron Correlation: gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, |phiTrig-phi| %2.3f, pt/ptTrig %2.3f, M %2.3f\n",
-                                       pt,phi,(gammai+gammaj).Eta(), deltaphi, rat, (gammai+gammaj).M());
             
-            if(pt > ptl  && rat > fLeadingRatioMinCut  && rat < fLeadingRatioMaxCut  && 
-               deltaphi > fDeltaPhiMinCut && deltaphi < fDeltaPhiMaxCut ){
-              //Select good pair (aperture and invariant mass)
-              if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj,"EMCAL")){
-                phil = phi ;
-                ptl  = pt ;
-                pLeading=(gammai+gammaj);      
-                
-                if(GetDebug() > 3 ) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0() - Neutral Hadron Correlation: Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f\n",
-                                           ptl,phil,(gammai+gammaj).Eta(), (gammai+gammaj).M());
-              }//pi0 selection
-              
-              
-            }//Pair selected as leading
-          }//if pair of gammas
-        }//2nd loop
-      }// if pdg = 22
-    }// 1st Loop
-    
-    if(GetDebug() > 2 && pLeading.Pt() > 0 ) printf("AliAnaParticleJetLeadingConeCorrelation::GetLeadingPi0() - Leading EMCAL: pt %2.3f eta %2.3f phi %2.3f pt/Eg %2.3f \n",  
-                                                    pLeading.Pt(), pLeading.Eta(), phil,  pLeading.Pt()/ptTrig) ;
-    
-  }//EMCAL list exists
+          }//Pair selected as leading
+        }//if pair of gammas
+      }//2nd loop
+    }// if pdg = 22
+  }// 1st Loop
+  
+  if(fLeadingPi0Mom.Pt() > 0 )
+    AliDebug(1,Form("Leading EMCAL: pt %2.3f eta %2.3f phi %2.3f pt/Eg %2.3f",
+                    fLeadingPi0Mom.Pt(), fLeadingPi0Mom.Eta(), phil,  fLeadingPi0Mom.Pt()/ptTrig)) ;
+  
 }
 
 //____________________________________________________________________________
@@ -1045,7 +839,7 @@ void AliAnaParticleJetLeadingConeCorrelation::InitParameters()
 {
   //Initialize the parameters of the analysis.
   SetInputAODName("PWG4Particle");
-  SetAODObjArrayName("JetLeadingCone");    
+  SetAODObjArrayName("JetLeadingCone");
   AddToHistogramsName("AnaJetLCCorr_");
   
   fJetsOnlyInCTS      = kFALSE ;
@@ -1054,14 +848,14 @@ void AliAnaParticleJetLeadingConeCorrelation::InitParameters()
   
   //Leading selection parameters
   fDeltaPhiMinCut     = 2.9 ;
-  fDeltaPhiMaxCut     = 3.4 ; 
+  fDeltaPhiMaxCut     = 3.4 ;
   fLeadingRatioMinCut = 0.1;
-  fLeadingRatioMaxCut = 1.5; 
+  fLeadingRatioMaxCut = 1.5;
   
   //Jet selection parameters
-  //Fixed cut   
-  fJetRatioMaxCut     = 1.2 ; 
-  fJetRatioMinCut     = 0.3 ; 
+  //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
@@ -1070,45 +864,45 @@ void AliAnaParticleJetLeadingConeCorrelation::InitParameters()
   
   //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. 
+  //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. 
+  //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 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; 
-
+  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 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[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[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[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[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.   ;
@@ -1118,17 +912,18 @@ void AliAnaParticleJetLeadingConeCorrelation::InitParameters()
   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 {
+//__________________________________________________________________________________________________
+Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(Double_t ptTrig, 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 
+  //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;
@@ -1151,8 +946,8 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptT
       iCTS = 3 ;
     
     if(!fPbPb){
-      //Phythia alone, jets with pt_th > 0.2, r = 0.3 
-      par[0] = fJetE1[0]; par[1] = fJetE2[0]; 
+      //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];
@@ -1162,47 +957,47 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptT
       //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, 
+      //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
-       
+        //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
-       
+        //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
     
@@ -1210,7 +1005,7 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptT
     Double_t min = CalculateJetRatioLimit(ptTrig, par, xmin);
     Double_t max = CalculateJetRatioLimit(ptTrig, par, xmax);
     
-    if(GetDebug() > 3)printf("AliAnaParticleJetLeadingConeCorrelation::IsJetSelected() - Jet selection?  : Limits min %2.3f, max %2.3f,  pt_jet %2.3f,  pt_gamma %2.3f, pt_jet / pt_gamma %2.3f\n",min,max,ptjet,ptTrig,rat);
+    AliDebug(3,Form("Jet selection? : Limits min %2.3f, max %2.3f,  pt_jet %2.3f,  pt_gamma %2.3f, pt_jet / pt_gamma %2.3f",min,max,ptjet,ptTrig,rat));
     
     if(( min < rat ) && ( max > ptjet/rat))
       return kTRUE;
@@ -1218,18 +1013,22 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptT
       return kFALSE;
   }//fSelect = 1
   //###############################################################
-  else if(fSelect == 2){
+  else if(fSelect == 2)
+  {
     //Simple selection
-    if(!fJetsOnlyInCTS){
+    if(!fJetsOnlyInCTS)
+    {
       if((rat <  fJetRatioMaxCut) && (rat > fJetRatioMinCut )) return kTRUE;
     }
-    else{
+    else
+    {
       if((rat <  fJetCTSRatioMaxCut) && (rat > fJetCTSRatioMinCut )) return kTRUE;
     }
   }// fSelect = 2
   //###############################################################
-  else{
-    printf("AliAnaParticleJetLeadingConeCorrelation::IsJetSelected() - Jet selection option larger than 2, DON'T SELECT JETS\n");
+  else
+  {
+    AliWarning(")Jet selection option larger than 2, DON'T SELECT JETS");
     return kFALSE ;
   }
   
@@ -1238,13 +1037,13 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsJetSelected(const Double_t ptT
 }
 
 //___________________________________________________________________
-Bool_t AliAnaParticleJetLeadingConeCorrelation::IsParticleInJetCone(const Double_t eta, Double_t phi, const Double_t etal,  Double_t phil)
-  const {
+Bool_t AliAnaParticleJetLeadingConeCorrelation::IsParticleInJetCone(Double_t eta, Double_t phi, 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();  
+  if(phil < 0) phil+=TMath::TwoPi();
   Double_t  rad = 10000 + fJetCone;
   
   if(TMath::Abs(phi-phil) <= (TMath::TwoPi() - fJetCone))
@@ -1262,308 +1061,314 @@ Bool_t AliAnaParticleJetLeadingConeCorrelation::IsParticleInJetCone(const Double
 }
 
 //__________________________________________________________________
-void  AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() 
-{  
+void  AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD()
+{
   //Particle-Hadron Correlation Analysis, fill AODs
   
-  if(!GetInputAODBranch()){
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s > \n",
-          GetInputAODName().Data());
-    abort();
-  }    
-  
-  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
-    abort();
-  }    
-  
-  if(GetDebug() > 1){
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - Begin jet leading cone  correlation analysis, fill AODs \n");
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - In CTS aod entries %d\n", GetCTSTracks()->GetEntriesFast());
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - In EMCAL aod entries %d\n", GetEMCALClusters()->GetEntriesFast());
+  if(!GetInputAODBranch())
+  {
+    AliFatal(Form("No input particles in AOD with name branch < %s >",GetInputAODName().Data()));
+    return;// coverity
   }
   
-  TLorentzVector pLeading(0,0,0,0); //It will contain the kinematics of the found leading particle
+  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation"))
+    AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s>",
+                  GetInputAODBranch()->GetClass()->GetName()));
+  
+  
+  AliDebug(1,"Begin jet leading cone  correlation analysis, fill AODs");
+  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
+  AliDebug(1,Form("In CTS aod entries %d",             GetCTSTracks()     ->GetEntriesFast()));
+  AliDebug(1,Form("In EMCAL aod entries %d",           GetEMCALClusters() ->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));                 
+  for(Int_t iaod = 0; iaod < naod ; iaod++)
+  {
+    AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     
     //  printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - Trigger : pt %3.2f, phi %2.2f, eta %2.2f\n",particle->Pt(), particle->Phi(), particle->Eta());
     
-    //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);
+    //Search leading particles in CTS and EMCAL
+    if(GetLeadingParticle(particle))
+    {
+      //Construct the jet around the leading, Fill AOD jet particle list, select jet
+      //and fill AOD with jet and background
+      MakeAODJet(particle);
       
     }//Leading found
   }//AOD trigger particle loop
   
-  if(GetDebug() >1)printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillAOD() - End of jet leading cone analysis, fill AODs \n");
+  AliDebug(1,"End of jet leading cone analysis, fill AODs");
   
-} 
+}
 
-//__________________________________________________________________
-void  AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() 
+//_________________________________________________________________________
+void  AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms()
 {
   
   //Particle-Hadron Correlation Analysis, fill histograms
   
-  if(!GetInputAODBranch()){
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s > \n",
-          GetInputAODName().Data());   
-    abort();
-  }
-  if(GetDebug() > 1){
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - Begin jet leading cone  correlation analysis, fill histograms \n");
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - In CTS aod entries %d\n", GetCTSTracks()->GetEntriesFast());
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - In EMCAL aod entries %d\n", GetEMCALClusters()->GetEntriesFast());
+  if(!GetInputAODBranch())
+  {
+    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s >",
+           GetInputAODName().Data());
+    return;
   }
   
-  TLorentzVector pLeading(0,0,0,0) ;
+  AliDebug(1,"Begin jet leading cone  correlation analysis, fill histograms");
+  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
+  AliDebug(1,Form("In CTS aod entries %d",             GetCTSTracks()     ->GetEntriesFast()));
+  AliDebug(1,Form("In EMCAL aod entries %d",           GetEMCALClusters() ->GetEntriesFast()));
   
   //Loop on stored AOD particles, trigger
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
-  for(Int_t iaod = 0; iaod < naod ; iaod++){
+  for(Int_t iaod = 0; iaod < naod ; iaod++)
+  {
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     
     if(OnlyIsolated() && !particle->IsIsolated()) continue;
     
-    Double_t pt = particle->Pt();
+    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();      
+    fLeadingMom = particle->GetLeading();
+    TString det = particle->GetLeadingDetector();
     
-    if(det!="" && pLeading.Pt() > 0){
-      Double_t ptL = pLeading.Pt(); 
-      Double_t phiL = pLeading.Phi(); 
+    if(det!="" && fLeadingMom.Pt() > 0)
+    {
+      Double_t ptL = fLeadingMom.Pt();
+      Double_t phiL = fLeadingMom.Phi();
       if(phiL < 0 ) phiL+=TMath::TwoPi();
-      Double_t etaL = pLeading.Eta(); 
+      Double_t etaL = fLeadingMom.Eta();
       
-      if(GetDebug() > 1)   printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - Trigger with pt %3.2f, phi %2.2f, eta %2.2f\n", pt, phi, eta);      
-
-      if(det == "CTS"){
-       fhChargedLeadingPt->Fill(pt,ptL);
-       fhChargedLeadingPhi->Fill(pt,phiL);
-       fhChargedLeadingEta->Fill(pt,etaL);
-       fhChargedLeadingDeltaPt->Fill(pt,pt-ptL);
-       fhChargedLeadingDeltaPhi->Fill(pt,TMath::Abs(phi-phiL));
-       fhChargedLeadingDeltaEta->Fill(pt,eta-etaL);
-       fhChargedLeadingRatioPt->Fill(pt,ptL/pt);
-       fhChargedLeadingXi->Fill(pt,TMath::Log(pt/ptL));
-       if(pt > 30) fhChargedLeadingDeltaPhiRatioPt30->Fill(TMath::Abs(phi-phiL),ptL/pt);
-       if(pt > 50) fhChargedLeadingDeltaPhiRatioPt50->Fill(TMath::Abs(phi-phiL),ptL/pt);
+      AliDebug(1,Form("Trigger with pt %3.2f, phi %2.2f, eta %2.2f", pt, phi, eta));
+      
+      if(det == "CTS")
+      {
+        fhChargedLeadingPt->Fill(pt,ptL);
+        fhChargedLeadingPhi->Fill(pt,phiL);
+        fhChargedLeadingEta->Fill(pt,etaL);
+        fhChargedLeadingDeltaPt->Fill(pt,pt-ptL);
+        fhChargedLeadingDeltaPhi->Fill(pt,TMath::Abs(phi-phiL));
+        fhChargedLeadingDeltaEta->Fill(pt,eta-etaL);
+        fhChargedLeadingRatioPt->Fill(pt,ptL/pt);
+        fhChargedLeadingXi->Fill(pt,TMath::Log(pt/ptL));
+        if(pt > 30) fhChargedLeadingDeltaPhiRatioPt30->Fill(TMath::Abs(phi-phiL),ptL/pt);
+        if(pt > 50) fhChargedLeadingDeltaPhiRatioPt50->Fill(TMath::Abs(phi-phiL),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,TMath::Abs(phi-phiL));
-       fhNeutralLeadingDeltaEta->Fill(pt,eta-etaL);
-       fhNeutralLeadingRatioPt->Fill(pt,ptL/pt);
-       fhNeutralLeadingXi->Fill(pt,TMath::Log(pt/ptL));
-       if(pt > 30) fhNeutralLeadingDeltaPhiRatioPt30->Fill(TMath::Abs(phi-phiL),ptL/pt);
-       if(pt > 50) fhNeutralLeadingDeltaPhiRatioPt50->Fill(TMath::Abs(phi-phiL),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,TMath::Abs(phi-phiL));
+        fhNeutralLeadingDeltaEta->Fill(pt,eta-etaL);
+        fhNeutralLeadingRatioPt->Fill(pt,ptL/pt);
+        fhNeutralLeadingXi->Fill(pt,TMath::Log(pt/ptL));
+        if(pt > 30) fhNeutralLeadingDeltaPhiRatioPt30->Fill(TMath::Abs(phi-phiL),ptL/pt);
+        if(pt > 50) fhNeutralLeadingDeltaPhiRatioPt50->Fill(TMath::Abs(phi-phiL),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","");
-       }
+      
+      if(!fSeveralConeAndPtCuts)
+      {//just fill histograms
+        if(!fReMakeJet)
+        {
+          fJetMom=particle->GetCorrelatedJet();
+          fBkgMom=particle->GetCorrelatedBackground();
+        }
+        else  MakeJetFromAOD(particle);
+        
+        if(fJetMom.Pt() > 0)
+        {//Jet was found
+          FillJetHistos(particle, fJetMom,"Jet","");
+          FillJetHistos(particle, fBkgMom,"Bkg","");
+        }
       }
-      else if(fSeveralConeAndPtCuts){
-       for(Int_t icone = 0; icone<fJetNCone; icone++) {
-         fJetCone=fJetCones[icone];      
-         for(Int_t ipt = 0; ipt<fJetNPt;ipt++) {  
-           TString lastname ="Cone"+ fJetNameCones[icone]+"Pt"+ fJetNamePtThres[ipt];
-           fJetPtThreshold=fJetPtThres[ipt];
-           MakeJetFromAOD(particle, pLeading, jet,bkg);
-           if(jet.Pt() > 0) {//Jet was found
-             FillJetHistos(particle, pLeading, jet,"Jet",lastname);
-             FillJetHistos(particle, pLeading, bkg,"Bkg",lastname);
-           }
-         }//icone
-       }//ipt
+      else if(fSeveralConeAndPtCuts)
+      {
+        for(Int_t icone = 0; icone<fJetNCone; icone++)
+        {
+          fJetCone=fJetCones[icone];
+          for(Int_t ipt = 0; ipt<fJetNPt;ipt++)
+          {
+            TString lastname ="Cone"+ fJetNameCones[icone]+"Pt"+ fJetNamePtThres[ipt];
+            fJetPtThreshold=fJetPtThres[ipt];
+            
+            MakeJetFromAOD(particle);
+            
+            if(fJetMom.Pt() > 0)
+            {//Jet was found
+              FillJetHistos(particle, fJetMom,"Jet",lastname);
+              FillJetHistos(particle, fBkgMom,"Bkg",lastname);
+            }
+          }//icone
+        }//ipt
       }//fSeveralConeAndPtCuts
     }//Leading
   }//AOD trigger particle loop
   
-  if(GetDebug() >1)printf("AliAnaParticleJetLeadingConeCorrelation::MakeAnalysisFillHistograms() - End of jet leading cone analysis, fill histograms \n");
+  AliDebug(1,"End of jet leading cone analysis, fill histograms");
   
-} 
+}
 
 //_______________________________________________________________________________________________
-void AliAnaParticleJetLeadingConeCorrelation::MakeAODJet(AliAODPWG4ParticleCorrelation *particle, 
-                                                         const TLorentzVector  pLeading)
+void AliAnaParticleJetLeadingConeCorrelation::MakeAODJet(AliAODPWG4ParticleCorrelation *particle)
 {
-  //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 
+  //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
   
   Double_t ptTrig   = particle->Pt();
   Double_t phiTrig  = particle->Phi();
-  Double_t phil     = pLeading.Phi();
+  Double_t phil     = fLeadingMom.Phi();
   if(phil<0) phil+=TMath::TwoPi();
-  Double_t etal     = pLeading.Eta();
-
+  Double_t etal     = fLeadingMom.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(!GetCTSTracks()) {
-    printf("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - Cannot construct jets without tracks, STOP analysis");
+  if(!GetCTSTracks())
+  {
+    AliFatal("Cannot construct jets without tracks, STOP analysis");
     return;
   }
   
   //Fill jet with tracks
-  TVector3 p3;
   //Initialize reference arrays that will contain jet and background tracks
-  TObjArray * reftracks  = new TObjArray;
+  TObjArray * reftracks     = new TObjArray;
   TObjArray * reftracksbkg  = new TObjArray;
   
   for(Int_t ipr = 0;ipr < (GetCTSTracks())->GetEntriesFast() ; ipr ++ ){
     AliVTrack* track = (AliVTrack *)((GetCTSTracks())->At(ipr)) ;
-    p3.SetXYZ(track->Px(),track->Py(),track->Pz());
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
     
-    //Particles in jet 
-    if(IsParticleInJetCone(p3.Eta(), p3.Phi(), etal, phil)){
+    //Particles in jet
+    if(IsParticleInJetCone(fTrackVector.Eta(), fTrackVector.Phi(), etal, phil)){
       
-      reftracks->Add(track); 
+      reftracks->Add(track);
       
-      if(p3.Pt() > ptcut ){
-       lv.SetVect(p3);
-       jet+=lv;
+      if(fTrackVector.Pt() > ptcut )
+      {
+        fJetConstMom.SetVect(fTrackVector);
+        fJetMom+=fJetConstMom;
       }
-    } 
-
+    }
+    
     //Background around (phi_gamma-pi, eta_leading)
-    else if(IsParticleInJetCone(p3.Eta(),p3.Phi(),etal, phiTrig)) { 
+    else if(IsParticleInJetCone(fTrackVector.Eta(),fTrackVector.Phi(),etal, phiTrig)) {
       
-      reftracksbkg->Add(track); 
-
-      if(p3.Pt() > ptcut ){
-       lv.SetVect(p3);
-       bkg+=lv;
+      reftracksbkg->Add(track);
+      
+      if(fTrackVector.Pt() > ptcut ){
+        fJetConstMom.SetVect(fTrackVector);
+        fBkgMom+=fJetConstMom;
       }
     }
   }//Track loop
   
   //Add referenced tracks to AOD
-  if(reftracks->GetEntriesFast() > 0 ){
+  if(reftracks->GetEntriesFast() > 0 )
+  {
     reftracks->SetName(Form("%sTracks",GetAODObjArrayName().Data()));
     particle->AddObjArray(reftracks);
   }
-  else  if(GetDebug() > 2 ) printf("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - No tracks in jet cone\n");
-  if(reftracksbkg->GetEntriesFast() > 0 ){
+  else  AliDebug(2,"No tracks in jet cone");
+  
+  if(reftracksbkg->GetEntriesFast() > 0 )
+  {
     reftracksbkg->SetName(Form("%sTracksBkg",GetAODObjArrayName().Data()));
     particle->AddObjArray(reftracksbkg);
   }
-  else  if(GetDebug() > 2 ) printf("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - No background tracks in jet cone\n");
+  else AliDebug(1,"No background tracks in jet cone");
   
   //Add neutral particles to jet
   //Initialize reference arrays that will contain jet and background tracks
-  TObjArray * refclusters  = new TObjArray;
+  TObjArray * refclusters     = new TObjArray;
   TObjArray * refclustersbkg  = new TObjArray;
   if(!fJetsOnlyInCTS && GetEMCALClusters()){
     
-       //Get vertex for photon momentum calculation
-       Double_t vertex[]  = {0,0,0} ; //vertex 
-       if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) 
-       {
-               GetReader()->GetVertex(vertex);
-               //if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2);
-       }
-         
-    for(Int_t iclus = 0;iclus < (GetEMCALClusters())->GetEntriesFast() ; iclus ++ ){
+    //Get vertex for photon momentum calculation
+    Double_t vertex[]  = {0,0,0} ; //vertex
+    if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC)
+    {
+      GetReader()->GetVertex(vertex);
+      //if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2);
+    }
+    
+    for(Int_t iclus = 0;iclus < (GetEMCALClusters())->GetEntriesFast() ; iclus ++ )
+    {
       AliVCluster * calo = (AliVCluster *) (GetEMCALClusters()->At(iclus)) ;
       
       //Cluster selection, not charged
       if(IsTrackMatched(calo,GetReader()->GetInputEvent())) continue ;
       
-      //Get Momentum vector, 
-      calo->GetMomentum(lv,vertex) ;//Assume that come from vertex in straight line
-               
-      //Particles in jet 
-      if(IsParticleInJetCone(lv.Eta(),lv.Phi(), etal, phil)){
-
-       refclusters->Add(calo); 
-       
-       if(lv.Pt() > ptcut )  jet+=lv;
+      //Get Momentum vector,
+      calo->GetMomentum(fJetConstMom,vertex) ;//Assume that come from vertex in straight line
+      
+      //Particles in jet
+      if(IsParticleInJetCone(fJetConstMom.Eta(),fJetConstMom.Phi(), etal, phil)){
+        
+        refclusters->Add(calo);
+        
+        if(fJetConstMom.Pt() > ptcut )  fJetMom+=fJetConstMom;
       }
       //Background around (phi_gamma-pi, eta_leading)
-      else if(IsParticleInJetCone(lv.Eta(),lv.Phi(),etal, phiTrig)){
-       
-       
-       refclustersbkg->Add(calo); 
-       
-       if(lv.Pt() > ptcut )  bkg+=lv;
+      else if(IsParticleInJetCone(fJetConstMom.Eta(),fJetConstMom.Phi(),etal, phiTrig)){
+        
+        
+        refclustersbkg->Add(calo);
+        
+        if(fJetConstMom.Pt() > ptcut )  fBkgMom+=fJetConstMom;
       }
     }//cluster loop
   }//jets with neutral particles
   
   //Add referenced clusters to AOD
-  if(refclusters->GetEntriesFast() > 0 ){
+  if(refclusters->GetEntriesFast() > 0 )
+  {
     refclusters->SetName(Form("%sClusters",GetAODObjArrayName().Data()));
     particle->AddObjArray(refclusters);
   }
-  else  if(GetDebug() > 2 ) printf("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - No clusters in jet cone\n");
-  if(refclustersbkg->GetEntriesFast() > 0 ){
+  else  AliDebug(2,"No clusters in jet cone");
+  
+  if(refclustersbkg->GetEntriesFast() > 0 )
+  {
     refclustersbkg->SetName(Form("%sClustersBkg",GetAODObjArrayName().Data()));
     particle->AddObjArray(refclustersbkg);
   }
-  else if(GetDebug() > 2 ) printf("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - No background clusters in jet cone\n");
+  else AliDebug(1,"No background clusters in jet cone");
   
-  //If there is any jet found, select after some criteria and 
+  //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("AliAnaParticleJetLeadingConeCorrelation::MakeAODJet() - Found jet: Trigger  pt %2.3f, Jet pt %2.3f, Bkg pt %2.3f\n",ptTrig,jet.Pt(),bkg.Pt());
-  }  
+  if(IsJetSelected(particle->Pt(), fJetMom.Pt()))
+  {
+    particle->SetCorrelatedJet(fJetMom);
+    particle->SetCorrelatedBackground(fBkgMom);
+    AliDebug(1,Form("Found jet: Trigger  pt %2.3f, Jet pt %2.3f, Bkg pt %2.3f",ptTrig,fJetMom.Pt(),fBkgMom.Pt()));
+  }
   
 }
 
 //______________________________________________________________________________________________________
-void AliAnaParticleJetLeadingConeCorrelation::MakeJetFromAOD(AliAODPWG4ParticleCorrelation *particle, 
-                                                             const TLorentzVector  pLeading, 
-                                                             TLorentzVector & jet, TLorentzVector & bkg) const 
+void AliAnaParticleJetLeadingConeCorrelation::MakeJetFromAOD(AliAODPWG4ParticleCorrelation *particle)
 {
-  //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 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    = fLeadingMom.Eta();
+  Double_t phil    = fLeadingMom.Phi();
   if(phil < 0) phil+=TMath::TwoPi();
-  Double_t etal = pLeading.Eta();
   
   TObjArray * refclusters    = particle->GetObjArray(Form("Clusters%s"   ,GetAODObjArrayName().Data()));
   TObjArray * reftracks      = particle->GetObjArray(Form("Tracks%s"     ,GetAODObjArrayName().Data()));
@@ -1575,73 +1380,80 @@ void AliAnaParticleJetLeadingConeCorrelation::MakeJetFromAOD(AliAODPWG4ParticleC
   if(fPbPb && !fSeveralConeAndPtCuts && ptTrig > fPtTriggerSelectionCut)  ptcut = fJetPtThresPbPb ;
   
   //Fill jet with tracks
-  //Particles in jet   
-  TVector3 p3;
-  if(reftracks){
-    for(Int_t ipr = 0;ipr < reftracks->GetEntriesFast() ; ipr ++ ){
+  //Particles in jet
+  if(reftracks)
+  {
+    for(Int_t ipr = 0;ipr < reftracks->GetEntriesFast() ; ipr ++ )
+    {
       AliVTrack* track = (AliVTrack *) reftracks->At(ipr) ;
-      p3.SetXYZ(track->Px(),track->Py(),track->Pz());
-      Float_t phi = p3.Phi();
+      fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+      Float_t phi = fTrackVector.Phi();
       if(phi < 0) phi+=TMath::TwoPi();
-      if(p3.Pt() > ptcut && IsParticleInJetCone(p3.Eta(), phi, etal, phil) ){
-        lv.SetVect(p3);
-        jet+=lv;
+      if(fTrackVector.Pt() > ptcut && IsParticleInJetCone(fTrackVector.Eta(), phi, etal, phil) )
+      {
+        fJetConstMom.SetVect(fTrackVector);
+        fJetMom+=fJetConstMom;
       }
     }//jet Track loop
   }
-  //Particles in background   
+  //Particles in background
   if(reftracksbkg){
-    for(Int_t ipr = 0;ipr < reftracksbkg->GetEntriesFast() ; ipr ++ ){
+    for(Int_t ipr = 0;ipr < reftracksbkg->GetEntriesFast() ; ipr ++ )
+    {
       AliVTrack* track = (AliVTrack *) reftracksbkg->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;   
+      fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+      if(fTrackVector.Pt() > ptcut && IsParticleInJetCone(fTrackVector.Eta(),fTrackVector.Phi(),etal, phiTrig) )
+      {
+        fJetConstMom.SetVect(fTrackVector);
+        fBkgMom+=fJetConstMom;
       }
     }//background Track loop
   }
   
   //Add neutral particles to jet
-  if(!fJetsOnlyInCTS && refclusters){
-    
+  if(!fJetsOnlyInCTS && refclusters)
+  {
     //Get vertex for photon momentum calculation
-    Double_t vertex[]  = {0,0,0} ; //vertex 
-    if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC) 
+    Double_t vertex[]  = {0,0,0} ; //vertex
+    if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC)
     {
       GetReader()->GetVertex(vertex);
     }
-         
+    
     //Loop on jet particles
     if(refclusters){
-      for(Int_t iclus = 0;iclus < refclusters->GetEntriesFast() ; iclus ++ ){
+      for(Int_t iclus = 0;iclus < refclusters->GetEntriesFast() ; iclus ++ )
+      {
         AliVCluster * calo = (AliVCluster *) refclusters->At(iclus) ;
         
-        calo->GetMomentum(lv,vertex) ;//Assume that come from vertex in straight line
+        calo->GetMomentum(fJetConstMom,vertex) ;//Assume that come from vertex in straight line
         
-        if(lv.Pt() > ptcut && IsParticleInJetCone(lv.Eta(),lv.Phi(), etal, phil)) jet+=lv;   
+        if(fJetConstMom.Pt() > ptcut && IsParticleInJetCone(fJetConstMom.Eta(),fJetConstMom.Phi(), etal, phil)) fJetMom+=fJetConstMom;
       }//jet cluster loop
     }
     
     //Loop on background particles
-    if(refclustersbkg){
-      for(Int_t iclus = 0;iclus < refclustersbkg->GetEntriesFast() ; iclus ++ ){
+    if(refclustersbkg)
+    {
+      for(Int_t iclus = 0;iclus < refclustersbkg->GetEntriesFast() ; iclus ++ )
+      {
         AliVCluster * calo = (AliVCluster *) refclustersbkg->At(iclus) ;
         
-        calo->GetMomentum(lv,vertex) ;//Assume that come from vertex in straight line
+        calo->GetMomentum(fJetConstMom,vertex) ;//Assume that come from vertex in straight line
         
-        if( lv.Pt() > ptcut && IsParticleInJetCone(lv.Eta(),lv.Phi(),etal, phiTrig)) bkg+=lv;
-      }//background cluster loop 
+        if( fJetConstMom.Pt() > ptcut && IsParticleInJetCone(fJetConstMom.Eta(),fJetConstMom.Phi(),etal, phiTrig)) fBkgMom+=fJetConstMom;
+      }//background cluster loop
     }
   }//clusters in jet
   
-  //If there is any jet found, leave jet and bkg as they are, 
+  //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.);
+  if(!IsJetSelected(particle->Pt(), fJetMom.Pt()))
+  {
+    fJetMom.SetPxPyPzE(0.,0.,0.,0.);
+    fBkgMom.SetPxPyPzE(0.,0.,0.,0.);
   }
-  else
-    if(GetDebug()>1) printf("AliAnaParticleJetLeadingConeCorrelation::MakeJetFromAOD() - Found jet: Trigger  pt %2.3f, Jet pt %2.3f, Bkg pt %2.3f\n",ptTrig,jet.Pt(),bkg.Pt());
+  else AliDebug(1,Form("Found jet: Trigger  pt %2.3f, Jet pt %2.3f, Bkg pt %2.3f",ptTrig,fJetMom.Pt(),fBkgMom.Pt()));
   
 }
 
@@ -1664,13 +1476,13 @@ void AliAnaParticleJetLeadingConeCorrelation::Print(const Option_t * opt) const
   
   printf("If pT of trigger < %2.3f, select jets as in pp? \n", fPtTriggerSelectionCut);
   
-  printf("Phi gamma-Leading        <     %3.2f\n", fDeltaPhiMaxCut) ; 
+  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", 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", 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) ;
@@ -1683,5 +1495,5 @@ void AliAnaParticleJetLeadingConeCorrelation::Print(const Option_t * opt) const
     printf("Wrong jet selection option:   %d \n", fSelect) ;
   
   printf("Isolated Trigger?  %d\n", fSelectIsolated) ;
-
+  
 } 
index 46c2841ec4ffe871a923233ef149d7be34a70391..6521c76006ce1c0739cc8cb0cc0783f1bcef62e0 100755 (executable)
@@ -28,98 +28,100 @@ class AliNeutralMesonSelection;
 
 class AliAnaParticleJetLeadingConeCorrelation : public AliAnaCaloTrackCorrBaseClass {
 
-public: 
-  AliAnaParticleJetLeadingConeCorrelation() ; // default ctor
-  virtual ~AliAnaParticleJetLeadingConeCorrelation() ; //virtual dtor
+public:
+  
+  AliAnaParticleJetLeadingConeCorrelation() ;              // default ctor
+  virtual ~AliAnaParticleJetLeadingConeCorrelation() { ; } // virtual dtor
 
   TList * GetCreateOutputObjects();
 
-  void InitParameters();
+  void    InitParameters();
   
-  void Print(const Option_t * opt) const;
+  void    Print(const Option_t * opt) const;
   
-  Bool_t AreJetsRecalculated() const {return fReMakeJet ; } 
-  void SwitchOnJetsRecalculation(){fReMakeJet = kTRUE; }
-  void SwitchOffJetsRecalculation(){fReMakeJet = kFALSE; }
+  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  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  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; }
+  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 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 ; }  
+  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] ; }
+  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      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      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 ; }
+  void      SetJetRatioCutRange(Double_t ratiomin, Double_t ratiomax)
+                                          { fJetRatioMaxCut =ratiomax;  fJetRatioMinCut = ratiomin ; }
+  void      SetJetCTSRatioCutRange(Double_t ratiomin, Double_t ratiomax)
+                                          { fJetCTSRatioMaxCut =ratiomax;  fJetCTSRatioMinCut = ratiomin ; }
   
-  Bool_t OnlyIsolated() const {return fSelectIsolated ; }
-  void SelectIsolated(Bool_t select) {fSelectIsolated = select ; }
+  Bool_t    OnlyIsolated()          const { return fSelectIsolated   ; }
+  void      SelectIsolated(Bool_t select) { fSelectIsolated = select ; }
     
  private:
   
-  Double_t CalculateJetRatioLimit(const Double_t ptTrig, const Double_t *param, const Double_t *x) const ;
+  Double_t  CalculateJetRatioLimit(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);
+  void      FillJetHistos(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector jet, const TString & type, const TString & lastname);
   
-  TList * GetOutputContainer() const {return fOutCont; }
+  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 ;
+  Bool_t    IsJetSelected(Double_t ptTrig, Double_t ptjet) const ;
+  Bool_t    IsParticleInJetCone(Double_t eta, Double_t phi, Double_t etal, Double_t phil) const ;
   
-  void GetLeadingCharge(AliAODPWG4ParticleCorrelation* const particle, TLorentzVector & pLeading) const ;
-  void GetLeadingPi0   (AliAODPWG4ParticleCorrelation* const particle, TLorentzVector & pLeading) ;
-  Bool_t GetLeadingParticle(AliAODPWG4ParticleCorrelation *particle, TLorentzVector &  pLeading)  ;
+  void      GetLeadingCharge  (AliAODPWG4ParticleCorrelation * particle) ;
+  void      GetLeadingPi0     (AliAODPWG4ParticleCorrelation * particle) ;
+  Bool_t    GetLeadingParticle(AliAODPWG4ParticleCorrelation * particle) ;
   
-  void MakeAnalysisFillAOD();
-  void MakeAnalysisFillHistograms();   
-  void MakeAODJet(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector pLeading) ; 
-  void MakeJetFromAOD(AliAODPWG4ParticleCorrelation * particle, const TLorentzVector pLeading, 
-                     TLorentzVector & jet, TLorentzVector & bkg) const ; 
+  void      MakeAnalysisFillAOD();
+  void      MakeAnalysisFillHistograms();
+  void      MakeAODJet(AliAODPWG4ParticleCorrelation * particle) ;
+  void      MakeJetFromAOD(AliAODPWG4ParticleCorrelation * particle) ;
   
-  Bool_t  SelectCluster(AliVCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) ;
+  Bool_t    SelectCluster(AliVCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) ;
   
  private:
   
@@ -153,19 +155,29 @@ public:
   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
+  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.
-  Bool_t     fSelectIsolated ;      // Select only trigger particles isolated
+  UInt_t     fSelect  ;              // kTRUE: Selects all jets, no limits.
+  Bool_t     fSelectIsolated ;       // Select only trigger particles isolated
 
+  TVector3       fTrackVector;       //! track vector
+  TLorentzVector fBkgMom;            //! bkg momentum
+  TLorentzVector fJetMom;            //! jet momentum
+  TLorentzVector fJetConstMom;       //! jet constituent momentum
+  TLorentzVector fLeadingMom;        //! leading particle momentum
+  TLorentzVector fLeadingPi0Mom;     //! leading particle momentum
+  TLorentzVector fLeadingPhoMom1;    //! leading particle momentum
+  TLorentzVector fLeadingPhoMom2;    //! leading particle momentum
+  TLorentzVector fLeadingChargeMom;  //! leading particle momentum
+  
   //Histograms
   //Leading particle distributions
   TList *  fOutCont ; //! Container for histograms
@@ -249,7 +261,7 @@ public:
   AliAnaParticleJetLeadingConeCorrelation(const AliAnaParticleJetLeadingConeCorrelation & g) ; // cpy ctor
   AliAnaParticleJetLeadingConeCorrelation & operator = (const AliAnaParticleJetLeadingConeCorrelation & g) ;//cpy assignment
   
-  ClassDef(AliAnaParticleJetLeadingConeCorrelation,1)
+  ClassDef(AliAnaParticleJetLeadingConeCorrelation,2)
  } ;
  
 
index aaef0031d6f2221a3c42a31f15248083731dfd05..3213484e49b8604ca089c00ba507585a97d37508 100755 (executable)
@@ -146,33 +146,33 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
   //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()){
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
-    abort();   
-  }
-       
-  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
-    abort();
-  }    
+  if(!GetInputAODBranch())
+    AliFatal(Form("No input particles in AOD with name branch < %s > ",GetInputAODName().Data()));
+  
        
-  if(GetDebug() > 1){
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Begin fill AODs \n");
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
-  }
+  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation"))
+    AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s>",
+             GetInputAODBranch()->GetClass()->GetName()));
+  
+  AliDebug(1,"Begin fill AODs");
+  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
   
   //Loop on stored AOD particles
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
-  for(Int_t iaod = 0; iaod < naod ; iaod++){
+  for(Int_t iaod = 0; iaod < naod ; iaod++)
+  {
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     
     AliStack * stack =  GetMCStack() ;
-    if(!stack){ 
-      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No Stack available, STOP\n");
-      abort();
+    if(!stack)
+    {
+      AliFatal("No Stack available, STOP");
+      return; // coverity
     }
-    if(stack->GetNtrack() < 8) {
-      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() *** small number of particles, not a PYTHIA simulation? ***:  n tracks %d \n", stack->GetNprimary());
+    
+    if(stack->GetNtrack() < 8)
+    {
+      AliWarning(Form("*** small number of particles, not a PYTHIA simulation? ***:  n tracks %d", stack->GetNprimary()));
       continue ;
     }
     
@@ -198,26 +198,27 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
     
   }//Aod branch loop
   
-  if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
+  AliDebug(1,"End fill AODs");
 }
 
 //_________________________________________________________________
 void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() 
 {
   //Particle-Parton Correlation Analysis, fill histograms
-  if(!GetInputAODBranch()){
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
-    abort();   
-  }
-  if(GetDebug() > 1){
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Begin parton correlation analysis, fill histograms \n");
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
+  
+  if(!GetInputAODBranch())
+  {
+    AliFatal(Form("No input particles in AOD with name branch < %s >",GetInputAODName().Data()));
+    return; //coverity
   }
   
+  AliDebug(1,"Begin parton correlation analysis, fill histograms");
+  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
+  
   AliStack * stack =  GetMCStack() ;
-  if(!stack) {
-    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No Stack available, STOP\n");
-    abort();
+  if(!stack)
+  {
+    AliFatal("No Stack available, STOP");
   }
   
   //Loop on stored AOD particles
@@ -235,9 +236,10 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     Int_t iawayparent = -1;
     
     TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
-    if(!(objarray) || (objarray->GetEntriesFast() < 7) ) {
-      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Reference list with partons not filled, STOP analysis\n");
-      abort();
+    if(!(objarray) || (objarray->GetEntriesFast() < 7) )
+    {
+      AliFatal("Reference list with partons not filled, STOP analysis");
+      return; // coverity
     }
     
     //Check and get indeces of mother and parton    
@@ -259,11 +261,11 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
       }
     }
     
-    if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - N reference partons %d; labels:  mother %d, parent %d \n", objarray->GetEntriesFast(), imom, iparent);
-    
+    AliDebug(1,Form("N reference partons %d; labels:  mother %d, parent %d", objarray->GetEntriesFast(), imom, iparent));
     
-    if(iparent < 0 || iparent > 8) { 
-      if(GetDebug() > 0 ) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Failed to find appropriate parton, index %d", iparent);
+    if(iparent < 0 || iparent > 8)
+    {
+      AliWarning(Form("Failed to find appropriate parton, index %d", iparent));
       continue ;
     }
     
@@ -278,10 +280,11 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     fhDeltaPtNearParton->Fill(ptTrigg,ptTrigg-ptNearParton);
     fhPtRatNearParton->Fill(ptTrigg,ptNearParton/ptTrigg);
     
-    if(iparent == 7) iawayparent =6;
-    else if(iparent == 6) iawayparent =7;
-    else{
-      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Parent parton is not final state, skip \n");
+    if     (iparent == 7) iawayparent = 6;
+    else if(iparent == 6) iawayparent = 7;
+    else
+    {
+      AliWarning("Parent parton is not final state, skip");
       continue;
     }
     
@@ -297,6 +300,6 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     
   }
   
-  if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
+  AliDebug(1,"End fill histograms");
   
 } 
index a4671b17fee55728b90bea0cf41fc8f875bd8637..6068fb46c6afad2f973f034155be15e389c672e8 100755 (executable)
@@ -61,6 +61,7 @@ fNCellsCut(0),
 fNLMCutMin(-1),               fNLMCutMax(10),
 fFillSSHistograms(kFALSE),    fFillOnlySimpleSSHisto(1),
 fNOriginHistograms(8),        fNPrimaryHistograms(4),
+fMomentum(),                  fPrimaryMom(),
 // Histograms
 
 // Control histograms
@@ -204,23 +205,22 @@ fhPtClusterSM(0),                     fhPtPhotonSM(0)
 }
 
 //_________________________________________________________________________________________
-Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int_t nMaxima)
+Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, Int_t nMaxima)
 {
   //Select clusters if they pass different cuts
   
-  Float_t ptcluster  = mom.Pt();
-  Float_t ecluster   = mom.E();
-  Float_t etacluster = mom.Eta();
-  Float_t phicluster = mom.Phi();
+  Float_t ptcluster  = fMomentum.Pt();
+  Float_t ecluster   = fMomentum.E();
+  Float_t etacluster = fMomentum.Eta();
+  Float_t phicluster = fMomentum.Phi();
 
   if(phicluster < 0) phicluster+=TMath::TwoPi();
   
   Bool_t matched = IsTrackMatched(calo,GetReader()->GetInputEvent());
   
-  if(GetDebug() > 2)
-    printf("AliAnaPhoton::ClusterSelected() - Current Event %d; Before selection : E %2.2f, pT %2.2f, phi %2.2f, eta %2.2f\n",
+  AliDebug(2,Form("Current Event %d; Before selection : E %2.2f, pT %2.2f, phi %2.2f, eta %2.2f",
            GetReader()->GetEventNumber(),
-           ecluster,ptcluster, phicluster*TMath::RadToDeg(),etacluster);
+           ecluster,ptcluster, phicluster*TMath::RadToDeg(),etacluster));
   
   fhClusterCutsE [1]->Fill( ecluster);
   fhClusterCutsPt[1]->Fill(ptcluster);
@@ -238,7 +238,7 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   //If too small or big energy, skip it
   if(ecluster < GetMinEnergy() || ecluster > GetMaxEnergy() ) return kFALSE ;
   
-  if(GetDebug() > 2) printf("\t Cluster %d Pass E Cut \n",calo->GetID());
+  AliDebug(2,Form("\t Cluster %d Pass E Cut",calo->GetID()));
   
   fhClusterCutsE [2]->Fill( ecluster);
   fhClusterCutsPt[2]->Fill(ptcluster);
@@ -248,7 +248,7 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   Double_t tof = calo->GetTOF()*1e9;
   if(tof < fTimeCutMin || tof > fTimeCutMax) return kFALSE;
   
-  if(GetDebug() > 2)  printf("\t Cluster %d Pass Time Cut \n",calo->GetID());
+  AliDebug(2,Form("\t Cluster %d Pass Time Cut",calo->GetID()));
   
   fhClusterCutsE [3]->Fill( ecluster);
   fhClusterCutsPt[3]->Fill(ptcluster);
@@ -256,13 +256,13 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   //.......................................
   if(calo->GetNCells() <= fNCellsCut && GetReader()->GetDataType() != AliCaloTrackReader::kMC) return kFALSE;
   
-  if(GetDebug() > 2) printf("\t Cluster %d Pass NCell Cut \n",calo->GetID());
+  AliDebug(2,Form("\t Cluster %d Pass NCell Cut",calo->GetID()));
   
   fhClusterCutsE [4]->Fill( ecluster);
   fhClusterCutsPt[4]->Fill(ptcluster);
   
   if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) return kFALSE ;
-  if(GetDebug() > 2) printf(" \t Cluster %d pass NLM %d of out of range \n",calo->GetID(), nMaxima);
+  AliDebug(2,Form("\t Cluster %d pass NLM %d of out of range",calo->GetID(), nMaxima));
   
   fhClusterCutsE [5]->Fill( ecluster);
   fhClusterCutsPt[5]->Fill(ptcluster);
@@ -271,11 +271,11 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   //Check acceptance selection
   if(IsFiducialCutOn())
   {
-    Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ;
+    Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter()) ;
     if(! in ) return kFALSE ;
   }
   
-  if(GetDebug() > 2) printf("\t Fiducial cut passed \n");
+  AliDebug(2,Form("\t Fiducial cut passed"));
   
   fhClusterCutsE [6]->Fill( ecluster);
   fhClusterCutsPt[6]->Fill(ptcluster);
@@ -290,11 +290,11 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   {
     if(matched)
     {
-      if(GetDebug() > 2) printf("\t Reject track-matched clusters\n");
+      AliDebug(2,"\t Reject track-matched clusters");
       return kFALSE ;
     }
     else
-      if(GetDebug() > 2)  printf(" Track-matching cut passed \n");
+      AliDebug(2,"\t Track-matching cut passed");
   }// reject matched clusters
   
   fhClusterCutsE [7]->Fill( ecluster);
@@ -308,15 +308,14 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
   {//In bad channel (PHOS cristal size 2.2x2.2 cm), EMCAL ( cell units )
     return kFALSE ;
   }
-  else if(GetDebug() > 2) printf("\t Bad channel cut passed %4.2f > %2.2f \n",distBad, fMinDist);
+  else AliDebug(2,Form("\t Bad channel cut passed %4.2f > %2.2f",distBad, fMinDist));
   
   fhClusterCutsE [8]->Fill( ecluster);
   fhClusterCutsPt[8]->Fill(ptcluster);
   
-  if(GetDebug() > 0)
-    printf("AliAnaPhoton::ClusterSelected() Current Event %d; After  selection : E %2.2f, pT %2.2f, phi %2.2f, eta %2.2f\n",
+  AliDebug(1,Form("Current Event %d; After  selection : E %2.2f, pT %2.2f, phi %2.2f, eta %2.2f",
            GetReader()->GetEventNumber(),
-           ecluster, ptcluster,mom.Phi()*TMath::RadToDeg(),mom.Eta());
+           ecluster, ptcluster,fMomentum.Phi()*TMath::RadToDeg(),fMomentum.Eta()));
   
   //All checks passed, cluster selected
   return kTRUE;
@@ -343,7 +342,6 @@ void AliAnaPhoton::FillAcceptanceHistograms()
   
   TParticle        * primStack = 0;
   AliAODMCParticle * primAOD   = 0;
-  TLorentzVector lv;
   
   // Get the ESD MC particles container
   AliStack * stack = 0;
@@ -372,7 +370,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
       primStack = stack->Particle(i) ;
       if(!primStack)
       {
-        printf("AliAnaPhoton::FillAcceptanceHistograms() - ESD primaries pointer not available!!\n");
+        AliWarning("ESD primaries pointer not available!!");
         continue;
       }
       
@@ -385,7 +383,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
       //       prim->GetName(), prim->GetPdgCode());
       
       //Photon kinematics
-      primStack->Momentum(lv);
+      primStack->Momentum(fMomentum);
       
       photonY = 0.5*TMath::Log((primStack->Energy()+primStack->Pz())/(primStack->Energy()-primStack->Pz())) ;
     }
@@ -394,7 +392,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
       primAOD = (AliAODMCParticle *) mcparticles->At(i);
       if(!primAOD)
       {
-        printf("AliAnaPhoton::FillAcceptanceHistograms() - AOD primaries pointer not available!!\n");
+        AliWarning("AOD primaries pointer not available!!");
         continue;
       }
       
@@ -404,7 +402,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
       if(primAOD->E() == TMath::Abs(primAOD->Pz()))  continue ; //Protection against floating point exception
       
       //Photon kinematics
-      lv.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
+      fMomentum.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
 
       photonY = 0.5*TMath::Log((primAOD->E()+primAOD->Pz())/(primAOD->E()-primAOD->Pz())) ;
     }
@@ -413,13 +411,13 @@ void AliAnaPhoton::FillAcceptanceHistograms()
     if(pdg != 22 ) continue ;
     
     // If too small or too large pt, skip, same cut as for data analysis
-    photonPt  = lv.Pt () ;
+    photonPt  = fMomentum.Pt () ;
     
     if(photonPt < GetMinPt() || photonPt > GetMaxPt() ) continue ;
     
-    photonE   = lv.E  () ;
-    photonEta = lv.Eta() ;
-    photonPhi = lv.Phi() ;
+    photonE   = fMomentum.E  () ;
+    photonEta = fMomentum.Eta() ;
+    photonPhi = fMomentum.Phi() ;
     
     if(photonPhi < 0) photonPhi+=TMath::TwoPi();
     
@@ -427,7 +425,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
     inacceptance = kTRUE;
     
     // Check same fidutial borders as in data analysis on top of real acceptance if real was requested.
-    if( IsFiducialCutOn() && !GetFiducialCut()->IsInFiducialCut(lv,GetCalorimeter())) inacceptance = kFALSE ;
+    if( IsFiducialCutOn() && !GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter())) inacceptance = kFALSE ;
     
     // Check if photons hit the Calorimeter acceptance
     if(IsRealCaloAcceptanceOn()) // defined on base class
@@ -457,7 +455,7 @@ void AliAnaPhoton::FillAcceptanceHistograms()
     if(status > 1) continue ; // Avoid "partonic" photons
     
     Bool_t takeIt  = kFALSE ;
-    if(status == 1 && GetMCAnalysisUtils()->GetMCGenerator()!="" ) takeIt = kTRUE ;
+    if(status == 1 && GetMCAnalysisUtils()->GetMCGenerator() != AliMCAnalysisUtils::kBoxLike ) takeIt = kTRUE ;
 
     if      (GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion)) continue;
     
@@ -538,13 +536,12 @@ void AliAnaPhoton::FillAcceptanceHistograms()
 }
 
 //________________________________________________________________________________
-void AliAnaPhoton::FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cells)
+void AliAnaPhoton::FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cells,
+                                        Int_t absIdMax)
 {
   // Fill some histograms to understand pile-up
   
-  TLorentzVector mom;
-  cluster->GetMomentum(mom,GetVertex(0));
-  Float_t pt   = mom.Pt();
+  Float_t pt   = fMomentum.Pt();
   Float_t time = cluster->GetTOF()*1.e9;
   
   AliVEvent * event = GetReader()->GetInputEvent();
@@ -561,9 +558,7 @@ void AliAnaPhoton::FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cel
   if(GetReader()->IsPileUpFromSPD()) fhTimePtPhotonSPD->Fill(pt,time);
   
   // cells inside the cluster
-  Float_t maxCellFraction = 0.;
-  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell( cells, cluster, maxCellFraction);
-  
+
   //Loop on cells inside cluster, max cell must be over 100 MeV and time in BC=0
   if(cells->GetCellAmplitude(absIdMax) > 0.1 && TMath::Abs(time) < 30)
   {
@@ -637,8 +632,9 @@ void AliAnaPhoton::FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cel
   
 }
 
-//____________________________________________________________________________________
-void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
+//_______________________________________________________________________________
+void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster,
+                                              Int_t mcTag, Int_t maxCellFraction)
 {
   //Fill cluster Shower Shape histograms
   
@@ -650,26 +646,15 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
   Float_t lambda1 = cluster->GetM20();
   Float_t disp    = cluster->GetDispersion()*cluster->GetDispersion();
   
-  TLorentzVector mom;
-  if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
-  {
-    cluster->GetMomentum(mom,GetVertex(0)) ;
-  }//Assume that come from vertex in straight line
-  else
-  {
-    Double_t vertex[]={0,0,0};
-    cluster->GetMomentum(mom,vertex) ;
-  }
-  
-  Float_t eta = mom.Eta();
-  Float_t phi = mom.Phi();
+  Float_t eta = fMomentum.Eta();
+  Float_t phi = fMomentum.Phi();
   if(phi < 0) phi+=TMath::TwoPi();
   
   fhLam0E ->Fill(energy,lambda0);
   fhLam1E ->Fill(energy,lambda1);
   fhDispE ->Fill(energy,disp);
   
-  if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
+  if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
      GetModuleNumber(cluster) >= GetFirstSMCoveredByTRD()  )
   {
     fhLam0ETRD->Fill(energy,lambda0);
@@ -680,7 +665,7 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
   Float_t l0   = 0., l1   = 0.;
   Float_t dispp= 0., dEta = 0., dPhi    = 0.;
   Float_t sEta = 0., sPhi = 0., sEtaPhi = 0.;
-  if(GetCalorimeter() == "EMCAL" && !fFillOnlySimpleSSHisto)
+  if(GetCalorimeter() == kEMCAL && !fFillOnlySimpleSSHisto)
   {
     GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), GetReader()->GetInputEvent()->GetEMCALCells(), cluster,
                                                                                  l0, l1, dispp, dEta, dPhi, sEta, sPhi, sEtaPhi);
@@ -731,7 +716,7 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
       fhLam1ETM ->Fill(energy,lambda1);
       fhDispETM ->Fill(energy,disp);
       
-      if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD()   >= 0 &&
+      if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD()   >= 0 &&
          GetModuleNumber(cluster) >= GetFirstSMCoveredByTRD()  )
       {
         fhLam0ETMTRD->Fill(energy,lambda0);
@@ -773,7 +758,7 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
   if(IsDataMC())
   {
     AliVCaloCells* cells = 0;
-    if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
+    if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
     else                        cells = GetPHOSCells();
     
     //Fill histograms to check shape of embedded clusters
@@ -795,19 +780,12 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
       //Fraction of total energy due to the embedded signal
       fraction/=clusterE;
       
-      if(GetDebug() > 1 )
-        printf("AliAnaPhoton::FillShowerShapeHistogram() - Energy fraction of embedded signal %2.3f, Energy %2.3f\n",fraction, clusterE);
+      AliDebug(1,Form("Energy fraction of embedded signal %2.3f, Energy %2.3f",fraction, clusterE));
       
       fhEmbeddedSignalFractionEnergy->Fill(clusterE,fraction);
       
     }  // embedded fraction
-    
-    // Get the fraction of the cluster energy that carries the cell with highest energy
-    Float_t maxCellFraction = 0.;
-    Int_t absID = GetCaloUtils()->GetMaxEnergyCell(cells, cluster,maxCellFraction);
-    
-    if( absID < 0 ) AliFatal("Wrong absID");
-      
+        
     // Check the origin and fill histograms
     
     Int_t mcIndex = -1;
@@ -845,7 +823,7 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
         }
         else
         {
-          printf("AliAnaPhoton::FillShowerShapeHistogram() - n overlaps = %d!!\n", noverlaps);
+          AliWarning(Form("n overlaps = %d!!", noverlaps));
         }
       }//No embedding
       
@@ -942,7 +920,7 @@ void  AliAnaPhoton::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag)
         fhMCNCellsvsClusterMaxCellDiffE6 [mcIndex]->Fill(ncells,  maxCellFraction);
       }
       
-      if(GetCalorimeter() == "EMCAL")
+      if(GetCalorimeter() == kEMCAL)
       {
         fhMCEDispEta        [mcIndex]-> Fill(energy,dEta);
         fhMCEDispPhi        [mcIndex]-> Fill(energy,dPhi);
@@ -1013,7 +991,7 @@ void AliAnaPhoton::FillTrackMatchingResidualHistograms(AliVCluster* cluster,
     
     Int_t nSMod = GetModuleNumber(cluster);
     
-    if(GetCalorimeter()=="EMCAL" &&   GetFirstSMCoveredByTRD() >= 0 &&
+    if(GetCalorimeter()==kEMCAL &&   GetFirstSMCoveredByTRD() >= 0 &&
        nSMod >= GetFirstSMCoveredByTRD()   )
     {
       fhTrackMatchedDEtaTRD[cut]->Fill(cluster->E(),dZ);
@@ -1032,16 +1010,14 @@ void AliAnaPhoton::FillTrackMatchingResidualHistograms(AliVCluster* cluster,
         fhdEdx[cut]  ->Fill(cluster->E(), dEdx);
         fhEOverP[cut]->Fill(cluster->E(), eOverp);
         
-        if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
+        if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
            nSMod >= GetFirstSMCoveredByTRD()  )
           fhEOverPTRD[cut]->Fill(cluster->E(), eOverp);
         
         
       }
       else
-        printf("AliAnaPhoton::FillTrackMatchingResidualHistograms() - Residual OK but (dR, dZ)= (%2.4f,%2.4f) no track associated WHAT? \n", dR,dZ);
-      
-      
+        AliWarning(Form("Residual OK but (dR, dZ)= (%2.4f,%2.4f) no track associated WHAT?", dR,dZ));
       
       if(IsDataMC())
       {
@@ -1109,17 +1085,17 @@ TObjString *  AliAnaPhoton::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaPhoton ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaPhoton ---:") ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Calorimeter: %s\n",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
+  snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster);",fMinDist) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
+  snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation);",fMinDist2) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
+  snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study);",fMinDist3) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"fRejectTrackMatch: %d\n",fRejectTrackMatch) ;
+  snprintf(onePar,buffersize,"fRejectTrackMatch: %d",fRejectTrackMatch) ;
   parList+=onePar ;
   
   //Get parameters set in base class.
@@ -1329,7 +1305,7 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
       outputContainer->Add(fhDispETM);
     }
     
-    if(GetCalorimeter() == "EMCAL" &&  GetFirstSMCoveredByTRD() >= 0)
+    if(GetCalorimeter() == kEMCAL &&  GetFirstSMCoveredByTRD() >= 0)
     {
       fhLam0ETRD  = new TH2F ("hLam0ETRD","#lambda_{0}^{2} vs E, EMCAL SM covered by TRD", nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
       fhLam0ETRD->SetYTitle("#lambda_{0}^{2}");
@@ -1447,7 +1423,7 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
       fhDispLam1HighE->SetYTitle("#lambda_{1}^{2}");
       outputContainer->Add(fhDispLam1HighE);
       
-      if(GetCalorimeter() == "EMCAL")
+      if(GetCalorimeter() == kEMCAL)
       {
         fhDispEtaE  = new TH2F ("hDispEtaE","#sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",  nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
         fhDispEtaE->SetXTitle("#it{E} (GeV)");
@@ -1615,7 +1591,7 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
       outputContainer->Add(fhdEdx[i]);
       outputContainer->Add(fhEOverP[i]);
       
-      if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >=0 )
+      if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >=0 )
       {
         fhTrackMatchedDEtaTRD[i]  = new TH2F
         (Form("hTrackMatchedDEtaTRD%s",cutTM[i].Data()),
@@ -2029,7 +2005,7 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
           fhMCNCellsvsClusterMaxCellDiffE6[i]->SetYTitle("#it{E} (GeV)");
           outputContainer->Add(fhMCNCellsvsClusterMaxCellDiffE6[i]) ;
           
-          if(GetCalorimeter()=="EMCAL")
+          if(GetCalorimeter()==kEMCAL)
           {
             fhMCEDispEta[i]  = new TH2F (Form("hEDispEtaE_MC%s",pnamess[i].Data()),
                                          Form("cluster from %s : #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",ptypess[i].Data()),
@@ -2198,19 +2174,14 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
 //_______________________
 void AliAnaPhoton::Init()
 {
-  
   //Init
   //Do some checks
-  if(GetCalorimeter() == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD())
-  {
-    printf("AliAnaPhoton::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
-  else  if(GetCalorimeter() == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD())
-  {
-    printf("AliAnaPhoton::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
+  
+  if      ( GetCalorimeter() == kPHOS  && !GetReader()->IsPHOSSwitchedOn()  && NewOutputAOD() )
+    AliFatal("!!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!");
+  else  if( GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD() )
+    AliFatal("!!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!");
   
   if(GetReader()->GetDataType() == AliCaloTrackReader::kMC) GetCaloPID()->SwitchOnBayesian();
   
@@ -2247,12 +2218,12 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
   //Select the Calorimeter of the photon
   TObjArray * pl = 0x0;
   AliVCaloCells* cells    = 0;
-  if      (GetCalorimeter() == "PHOS" )
+  if      (GetCalorimeter() == kPHOS )
   {
     pl    = GetPHOSClusters();
     cells = GetPHOSCells();
   }
-  else if (GetCalorimeter() == "EMCAL")
+  else if (GetCalorimeter() == kEMCAL)
   {
     pl    = GetEMCALClusters();
     cells = GetEMCALCells();
@@ -2260,31 +2231,29 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
   
   if(!pl)
   {
-    Info("MakeAnalysisFillAOD","TObjArray with %s clusters is NULL!\n",GetCalorimeter().Data());
+    AliWarning(Form("TObjArray with %s clusters is NULL!",GetCalorimeterString().Data()));
     return;
   }
   
-  TLorentzVector mom;
-
   // Loop on raw clusters before filtering in the reader and fill control histogram
-  if((GetReader()->GetEMCALClusterListName()=="" && GetCalorimeter()=="EMCAL") || GetCalorimeter()=="PHOS")
+  if((GetReader()->GetEMCALClusterListName()=="" && GetCalorimeter()==kEMCAL) || GetCalorimeter()==kPHOS)
   {
     for(Int_t iclus = 0; iclus < GetReader()->GetInputEvent()->GetNumberOfCaloClusters(); iclus++ )
     {
       AliVCluster * clus = GetReader()->GetInputEvent()->GetCaloCluster(iclus);
-      if     (GetCalorimeter() == "PHOS"  && clus->IsPHOS()  && clus->E() > GetReader()->GetPHOSPtMin() )
+      if     (GetCalorimeter() == kPHOS  && clus->IsPHOS()  && clus->E() > GetReader()->GetPHOSPtMin() )
       {
         fhClusterCutsE [0]->Fill(clus->E());
         
-        clus->GetMomentum(mom,GetVertex(0)) ;
-        fhClusterCutsPt[0]->Fill(mom.Pt());
+        clus->GetMomentum(fMomentum,GetVertex(0)) ;
+        fhClusterCutsPt[0]->Fill(fMomentum.Pt());
       }
-      else if(GetCalorimeter() == "EMCAL" && clus->IsEMCAL() && clus->E() > GetReader()->GetEMCALPtMin())
+      else if(GetCalorimeter() == kEMCAL && clus->IsEMCAL() && clus->E() > GetReader()->GetEMCALPtMin())
       {
         fhClusterCutsE [0]->Fill(clus->E());
         
-        clus->GetMomentum(mom,GetVertex(0)) ;
-        fhClusterCutsPt[0]->Fill(mom.Pt());
+        clus->GetMomentum(fMomentum,GetVertex(0)) ;
+        fhClusterCutsPt[0]->Fill(fMomentum.Pt());
       }
     }
   }
@@ -2307,18 +2276,17 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
         {
           fhClusterCutsE [0]->Fill(clus->E());
           
-          clus->GetMomentum(mom,GetVertex(0)) ;
-          fhClusterCutsPt[0]->Fill(mom.Pt());
+          clus->GetMomentum(fMomentum,GetVertex(0)) ;
+          fhClusterCutsPt[0]->Fill(fMomentum.Pt());
         }
       }
     }
   }
   
-  //Init arrays, variables, get number of clusters
-  TLorentzVector mom2 ;
+  // Init arrays, variables, get number of clusters
   Int_t nCaloClusters = pl->GetEntriesFast();
   
-  if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillAOD() - input %s cluster entries %d\n", GetCalorimeter().Data(), nCaloClusters);
+  AliDebug(1,Form("Input %s cluster entries %d", GetCalorimeterString().Data(), nCaloClusters));
   
   //----------------------------------------------------
   // Fill AOD with PHOS/EMCAL AliAODPWG4Particle objects
@@ -2341,31 +2309,31 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     //Cluster selection, not charged, with photon id and in fiducial cut
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
-      calo->GetMomentum(mom,GetVertex(evtIndex)) ;
+      calo->GetMomentum(fMomentum,GetVertex(evtIndex)) ;
     }//Assume that come from vertex in straight line
     else
     {
       Double_t vertex[]={0,0,0};
-      calo->GetMomentum(mom,vertex) ;
+      calo->GetMomentum(fMomentum,vertex) ;
     }
     
     //-----------------------------
     // Cluster selection
     //-----------------------------
     Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(calo, cells); // NLM
-    if(!ClusterSelected(calo,mom,nMaxima)) continue;
+    if(!ClusterSelected(calo,nMaxima)) continue;
     
     //----------------------------
-    //Create AOD for analysis
+    // Create AOD for analysis
     //----------------------------
-    AliAODPWG4Particle aodph = AliAODPWG4Particle(mom);
+    AliAODPWG4Particle aodph = AliAODPWG4Particle(fMomentum);
     
     //...............................................
     //Set the indeces of the original caloclusters (MC, ID), and calorimeter
     Int_t label = calo->GetLabel();
     aodph.SetLabel(label);
     aodph.SetCaloLabel(calo->GetID(),-1);
-    aodph.SetDetector(GetCalorimeter());
+    aodph.SetDetectorTag(GetCalorimeter());
     //printf("Index %d, Id %d, iaod %d\n",icalo, calo->GetID(),GetOutputAODBranch()->GetEntriesFast());
     
     //...............................................
@@ -2388,18 +2356,24 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
       tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader(),GetCalorimeter());
       aodph.SetTag(tag);
       
-      if(GetDebug() > 0)
-        printf("AliAnaPhoton::MakeAnalysisFillAOD() - Origin of candidate, bit map %d\n",aodph.GetTag());
+      AliDebug(1,Form("Origin of candidate, bit map %d",aodph.GetTag()));
     }//Work with stack also
     
     //--------------------------------------------------------
-    //Fill some shower shape histograms before PID is applied
+    // Fill some shower shape histograms before PID is applied
     //--------------------------------------------------------
     
-    FillShowerShapeHistograms(calo,tag);
+    Float_t maxCellFraction = 0;
+    Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(cells, calo, maxCellFraction);
+    if( absIdMax < 0 ) AliFatal("Wrong absID");
+    
+    FillShowerShapeHistograms(calo,tag,maxCellFraction);
+    
+    aodph.SetM02(calo->GetM02());
+    aodph.SetNLM(nMaxima);
     
     //-------------------------------------
-    //PID selection or bit setting
+    // PID selection or bit setting
     //-------------------------------------
     
     //...............................................
@@ -2411,7 +2385,7 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
       
       aodph.SetIdentifiedParticleType(GetCaloPID()->GetIdentifiedParticleType(calo));
       
-      if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodph.GetIdentifiedParticleType());
+      AliDebug(1,Form("PDG of identified particle %d",aodph.GetIdentifiedParticleType()));
       
       //If cluster does not pass pid, not photon, skip it.
       if(aodph.GetIdentifiedParticleType() != AliCaloPID::kPhoton) continue ;
@@ -2427,40 +2401,47 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
       
       GetCaloPID()->SetPIDBits(calo,&aodph, GetCaloUtils(),GetReader()->GetInputEvent());
       
-      if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PID Bits set \n");
+      AliDebug(1,"PID Bits set");
     }
     
-    if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",
-                              aodph.Pt(), aodph.GetIdentifiedParticleType());
+    AliDebug(1,Form("Photon selection cuts passed: pT %3.2f, pdg %d",aodph.Pt(),aodph.GetIdentifiedParticleType()));
     
     fhClusterCutsE [9]->Fill(calo->E());
-    fhClusterCutsPt[9]->Fill(mom.Pt());
+    fhClusterCutsPt[9]->Fill(fMomentum.Pt());
     
     Int_t   nSM  = GetModuleNumber(calo);
     if(nSM < GetCaloUtils()->GetNumberOfSuperModulesUsed() && nSM >=0)
     {
-      fhEPhotonSM ->Fill(mom.E (),nSM);
-      fhPtPhotonSM->Fill(mom.Pt(),nSM);
+      fhEPhotonSM ->Fill(fMomentum.E (),nSM);
+      fhPtPhotonSM->Fill(fMomentum.Pt(),nSM);
     }
     
     fhNLocMax->Fill(calo->E(),nMaxima);
     
+    // Few more control histograms for selected clusters
+    fhMaxCellDiffClusterE->Fill(calo->E() ,maxCellFraction);
+    fhNCellsE            ->Fill(calo->E() ,calo->GetNCells());
+    fhTimePt             ->Fill(fMomentum.Pt()  ,calo->GetTOF()*1.e9);
+    
+    if(cells)
+    {
+      for(Int_t icell = 0; icell <  calo->GetNCells(); icell++)
+        fhCellsE->Fill(calo->E(),cells->GetCellAmplitude(calo->GetCellsAbsId()[icell]));
+    }
+    
     // Matching after cuts
     if( fFillTMHisto )          FillTrackMatchingResidualHistograms(calo,1);
     
     // Fill histograms to undertand pile-up before other cuts applied
     // Remember to relax time cuts in the reader
-    if( IsPileUpAnalysisOn() ) FillPileUpHistograms(calo,cells);
-    
-    // Add number of local maxima to AOD, method name in AOD to be FIXED
-    aodph.SetFiducialArea(nMaxima);
+    if( IsPileUpAnalysisOn() ) FillPileUpHistograms(calo,cells, absIdMax);
     
-    //Add AOD with photon object to aod branch
+    // Add AOD with photon object to aod branch
     AddAODParticle(aodph);
     
   }//loop
   
-  if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD()  End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());
+  AliDebug(1,Form("End fill AODs, with %d entries",GetOutputAODBranch()->GetEntriesFast()));
   
 }
 
@@ -2481,7 +2462,7 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
   //----------------------------------
   //Loop on stored AOD photons
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
   Float_t cen = GetEventCentrality();
   // printf("++++++++++ GetEventCentrality() %f\n",cen);
@@ -2493,17 +2474,14 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
     AliAODPWG4Particle* ph =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
     Int_t pdg = ph->GetIdentifiedParticleType();
     
-    if(GetDebug() > 3)
-      printf("AliAnaPhoton::MakeAnalysisFillHistograms() - PDG %d, MC TAG %d, Calorimeter %s\n",
-             ph->GetIdentifiedParticleType(),ph->GetTag(), (ph->GetDetector()).Data()) ;
+    AliDebug(2,Form("PDG %d, MC TAG %d, Calorimeter <%d>",ph->GetIdentifiedParticleType(),ph->GetTag(), ph->GetDetectorTag())) ;
     
     //If PID used, fill histos with photons in Calorimeter GetCalorimeter()
     if(IsCaloPIDOn() && pdg != AliCaloPID::kPhoton) continue;
     
-    if(ph->GetDetector() != GetCalorimeter()) continue;
+    if(((Int_t) ph->GetDetectorTag()) != GetCalorimeter()) continue;
     
-    if(GetDebug() > 2)
-      printf("AliAnaPhoton::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
+    AliDebug(2,Form("ID Photon: pt %f, phi %f, eta %f", ph->Pt(),ph->Phi(),ph->Eta())) ;
     
     //................................
     //Fill photon histograms
@@ -2524,75 +2502,49 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
       fhPtCentralityPhoton ->Fill(ptcluster,cen) ;
       fhPtEventPlanePhoton ->Fill(ptcluster,ep ) ;
     }
-    
-    //Get original cluster, to recover some information
-    AliVCaloCells* cells    = 0;
-    TObjArray * clusters    = 0;
-    if(GetCalorimeter() == "EMCAL")
-    {
-      cells    = GetEMCALCells();
-      clusters = GetEMCALClusters();
-    }
-    else
-    {
-      cells    = GetPHOSCells();
-      clusters = GetPHOSClusters();
-    }
-    
-    Int_t iclus = -1;
-    AliVCluster *cluster = FindCluster(clusters,ph->GetCaloLabel(0),iclus);
-    if(cluster)
-    {
-      Float_t maxCellFraction = 0;
-      Int_t absID = GetCaloUtils()->GetMaxEnergyCell(cells, cluster, maxCellFraction);
-      if( absID < 0 ) AliFatal("Wrong absID");
-
-      // Control histograms
-      fhMaxCellDiffClusterE->Fill(ph->E() ,maxCellFraction);
-      fhNCellsE            ->Fill(ph->E() ,cluster->GetNCells());
-      fhTimePt             ->Fill(ph->Pt(),cluster->GetTOF()*1.e9);
-
-      if(cells)
-      {
-        for(Int_t icell = 0; icell <  cluster->GetNCells(); icell++)
-          fhCellsE->Fill(ph->E(),cells->GetCellAmplitude(cluster->GetCellsAbsId()[icell]));
-      }
-    }
+  
+//    Comment this part, not needed but in case to know how to do it in the future
+//    //Get original cluster, to recover some information
+//    AliVCaloCells* cells    = 0;
+//    TObjArray * clusters    = 0;
+//    if(GetCalorimeter() == kEMCAL)
+//    {
+//      cells    = GetEMCALCells();
+//      clusters = GetEMCALClusters();
+//    }
+//    else
+//    {
+//      cells    = GetPHOSCells();
+//      clusters = GetPHOSClusters();
+//    }
+    
+//    Int_t iclus = -1;
+//    AliVCluster *cluster = FindCluster(clusters,ph->GetCaloLabel(0),iclus);
+//    if(cluster)
     
     //.......................................
     //Play with the MC data if available
     if(IsDataMC())
     {
-      if(GetDebug()>0)
-      {
-        if(GetReader()->ReadStack() && !GetMCStack())
-        {
-          printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called?\n");
-        }
-        else if(GetReader()->ReadAODMCParticles() && !GetReader()->GetAODMCParticles())
-        {
-          printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
-        }
-      }
-            
       //....................................................................
       // Access MC information in stack if requested, check that it exists.
-      Int_t label =ph->GetLabel();
+      Int_t label = ph->GetLabel();
       
       if(label < 0)
       {
-        if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
+        AliDebug(1,Form("*** bad label ***:  label %d", label));
         continue;
       }
       
       Float_t eprim   = 0;
       Float_t ptprim  = 0;
       Bool_t ok = kFALSE;
-      TLorentzVector primary = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok);
+      fPrimaryMom = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok);
+                 
       if(ok)
       {
-        eprim   = primary.Energy();
-        ptprim  = primary.Pt();
+        eprim   = fPrimaryMom.Energy();
+        ptprim  = fPrimaryMom.Pt();
       }
       
       Int_t tag =ph->GetTag();
@@ -2709,7 +2661,7 @@ void AliAnaPhoton::Print(const Option_t * opt) const
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print(" ");
   
-  printf("Calorimeter            =     %s\n", GetCalorimeter().Data()) ;
+  printf("Calorimeter            =     %s\n", GetCalorimeterString().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);
index 65b8b97e9636cbdb22d091ba4593a7946e39ec7f..cd81d8d39e25619d2f268ac5e0534fd5b74aee0f 100755 (executable)
@@ -17,7 +17,6 @@
 // --- ROOT system ---
 class TH2F ;
 class TH1F;
-class TString ;
 class TObjString;
 class TList ;
 
@@ -51,11 +50,11 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   
   // Analysis methods
   
-  Bool_t       ClusterSelected(AliVCluster* cl, TLorentzVector mom, Int_t nlm) ;
+  Bool_t       ClusterSelected(AliVCluster* cl, Int_t nlm) ;
   
   void         FillAcceptanceHistograms();
   
-  void         FillShowerShapeHistograms( AliVCluster* cluster, Int_t mcTag) ;
+  void         FillShowerShapeHistograms( AliVCluster* cluster, Int_t mcTag, Int_t maxCellEFraction) ;
   
   void         SwitchOnFillShowerShapeHistograms()    { fFillSSHistograms      = kTRUE  ; }
   void         SwitchOffFillShowerShapeHistograms()   { fFillSSHistograms      = kFALSE ; }  
@@ -68,7 +67,7 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   void         SwitchOnTMHistoFill()                  { fFillTMHisto           = kTRUE  ; }
   void         SwitchOffTMHistoFill()                 { fFillTMHisto           = kFALSE ; }
 
-  void         FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cells) ;
+  void         FillPileUpHistograms(AliVCluster* cluster, AliVCaloCells *cells, Int_t absIdMax) ;
  
   // Analysis parameters setters getters
     
@@ -129,6 +128,9 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   Int_t    fNOriginHistograms;                      // Fill only NOriginHistograms of the 14 defined types
   Int_t    fNPrimaryHistograms;                     // Fill only NPrimaryHistograms of the 7 defined types
   
+  TLorentzVector fMomentum;                         //! Cluster momentum
+  TLorentzVector fPrimaryMom;                       //! Primary MC momentum
+  
   //Histograms 
   TH1F * fhClusterCutsE [10];                       //! control histogram on the different photon selection cuts, E
   TH1F * fhClusterCutsPt[10];                       //! control histogram on the different photon selection cuts, pT
@@ -313,7 +315,7 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   AliAnaPhoton(              const AliAnaPhoton & g) ; // cpy ctor
   AliAnaPhoton & operator = (const AliAnaPhoton & g) ; // cpy assignment
   
-  ClassDef(AliAnaPhoton,37)
+  ClassDef(AliAnaPhoton,38)
 
 } ;
  
index 415f81f117121170df242a5be439bbad424863ec..1b69c759887540cf8802cb87dcf711a936d6fc08 100755 (executable)
@@ -45,7 +45,7 @@
 
 ClassImp(AliAnaPhotonConvInCalo)
 
-//________________________________________
+//________________________________________________
 AliAnaPhotonConvInCalo::AliAnaPhotonConvInCalo() : 
 AliAnaCaloTrackCorrBaseClass(),   
 fRemoveConvertedPair(kFALSE), 
@@ -53,7 +53,7 @@ fAddConvertedPairsToAOD(kFALSE),
 fMassCut(0),                  
 fConvAsymCut(1.),                  fConvDEtaCut(2.),
 fConvDPhiMinCut(-1.),              fConvDPhiMaxCut(7.), 
-
+fMomentum(),                       fProdVertex(),
 // Histograms
 fhPtPhotonConv(0),                 fhEtaPhiPhotonConv(0),          fhEtaPhi05PhotonConv(0),
 fhConvDeltaEta(0),                 fhConvDeltaPhi(0),              fhConvDeltaEtaPhi(0), 
@@ -89,7 +89,7 @@ fhConvDistMCConversion(0),         fhConvDistMCConversionCuts(0)
   
 }
 
-//_________________________________________________
+//_____________________________________________________
 TObjString *  AliAnaPhotonConvInCalo::GetAnalysisCuts()
 {      
   //Save parameters used for analysis
@@ -97,348 +97,347 @@ TObjString *  AliAnaPhotonConvInCalo::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaPhotonConvInCalo---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaPhotonConvInCalo---:") ;
   parList+=onePar ;    
-  snprintf(onePar,buffersize,"Conversion Selection: fConvAsymCut %1.2f, fConvDEtaCut %1.2f fConvDPhiCut (%1.2f,%1.2f)\n",
+  snprintf(onePar,buffersize,"Conversion Selection: fConvAsymCut %1.2f, fConvDEtaCut %1.2f fConvDPhiCut (%1.2f,%1.2f)",
            fConvAsymCut, fConvDEtaCut, fConvDPhiMinCut, fConvDPhiMaxCut) ;
   parList+=onePar ; 
   
   return new TObjString(parList) ;
 }
 
-//___________________________________________________
+//_______________________________________________________
 TList *  AliAnaPhotonConvInCalo::GetCreateOutputObjects()
-{  
-  // Create histograms to be saved in output file and 
+{
+  // Create histograms to be saved in output file and
   // store them in outputContainer
-  TList * outputContainer = new TList() ; 
-  outputContainer->SetName("PhotonConvInCaloHistos") ; 
-       
-  Int_t nptbins  = GetHistogramRanges()->GetHistoPtBins();  Float_t ptmax  = GetHistogramRanges()->GetHistoPtMax();  Float_t ptmin  = GetHistogramRanges()->GetHistoPtMin(); 
-  Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin(); 
-  Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();  
+  TList * outputContainer = new TList() ;
+  outputContainer->SetName("PhotonConvInCaloHistos") ;
+  
+  Int_t nptbins  = GetHistogramRanges()->GetHistoPtBins();  Float_t ptmax  = GetHistogramRanges()->GetHistoPtMax();  Float_t ptmin  = GetHistogramRanges()->GetHistoPtMin();
+  Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin();
+  Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();
   
-  fhPtPhotonConv  = new TH1F("hPtPhotonConv","Number of #gamma over calorimeter, conversion",nptbins,ptmin,ptmax); 
+  fhPtPhotonConv  = new TH1F("hPtPhotonConv","Number of #gamma over calorimeter, conversion",nptbins,ptmin,ptmax);
   fhPtPhotonConv->SetYTitle("N");
   fhPtPhotonConv->SetXTitle("p_{T #gamma}(GeV/c)");
-  outputContainer->Add(fhPtPhotonConv) ; 
+  outputContainer->Add(fhPtPhotonConv) ;
   
   fhEtaPhiPhotonConv  = new TH2F
-  ("hEtaPhiPhotonConv","#eta vs #phi",netabins,etamin,etamax,nphibins,phimin,phimax); 
+  ("hEtaPhiPhotonConv","#eta vs #phi",netabins,etamin,etamax,nphibins,phimin,phimax);
   fhEtaPhiPhotonConv->SetYTitle("#phi (rad)");
   fhEtaPhiPhotonConv->SetXTitle("#eta");
   outputContainer->Add(fhEtaPhiPhotonConv) ;
   if(GetMinPt() < 0.5){
     fhEtaPhi05PhotonConv  = new TH2F
-    ("hEtaPhi05PhotonConv","#eta vs #phi, E > 0.5",netabins,etamin,etamax,nphibins,phimin,phimax); 
+    ("hEtaPhi05PhotonConv","#eta vs #phi, E > 0.5",netabins,etamin,etamax,nphibins,phimin,phimax);
     fhEtaPhi05PhotonConv->SetYTitle("#phi (rad)");
     fhEtaPhi05PhotonConv->SetXTitle("#eta");
     outputContainer->Add(fhEtaPhi05PhotonConv) ;
   }
   
   fhConvDeltaEta  = new TH2F
-  ("hConvDeltaEta","#Delta #eta of selected conversion pairs",100,0,fMassCut,netabins*2,-0.5,0.5); 
+  ("hConvDeltaEta","#Delta #eta of selected conversion pairs",100,0,fMassCut,netabins*2,-0.5,0.5);
   fhConvDeltaEta->SetYTitle("#Delta #eta");
   fhConvDeltaEta->SetXTitle("Pair Mass (GeV/c^2)");
   outputContainer->Add(fhConvDeltaEta) ;
   
   fhConvDeltaPhi  = new TH2F
-  ("hConvDeltaPhi","#Delta #phi of selected conversion pairs",100,0,fMassCut,nphibins*2,-0.5,0.5); 
+  ("hConvDeltaPhi","#Delta #phi of selected conversion pairs",100,0,fMassCut,nphibins*2,-0.5,0.5);
   fhConvDeltaPhi->SetYTitle("#Delta #phi");
   fhConvDeltaPhi->SetXTitle("Pair Mass (GeV/c^2)");
   outputContainer->Add(fhConvDeltaPhi) ;
   
   fhConvDeltaEtaPhi  = new TH2F
-  ("hConvDeltaEtaPhi","#Delta #eta vs #Delta #phi of selected conversion pairs",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+  ("hConvDeltaEtaPhi","#Delta #eta vs #Delta #phi of selected conversion pairs",netabins,-0.5,0.5,nphibins,-0.5,0.5);
   fhConvDeltaEtaPhi->SetYTitle("#Delta #phi");
   fhConvDeltaEtaPhi->SetXTitle("#Delta #eta");
   outputContainer->Add(fhConvDeltaEtaPhi) ;
   
   fhConvAsym  = new TH2F
-  ("hConvAsym","Asymmetry of selected conversion pairs",100,0,fMassCut,100,0,1); 
+  ("hConvAsym","Asymmetry of selected conversion pairs",100,0,fMassCut,100,0,1);
   fhConvAsym->SetYTitle("Asymmetry");
   fhConvAsym->SetXTitle("Pair Mass (GeV/c^2)");
-  outputContainer->Add(fhConvAsym) ;  
+  outputContainer->Add(fhConvAsym) ;
   
   fhConvPt  = new TH2F
-  ("hConvPt","p_{T} of selected conversion pairs",100,0,fMassCut,100,0.,10.); 
+  ("hConvPt","p_{T} of selected conversion pairs",100,0,fMassCut,100,0.,10.);
   fhConvPt->SetYTitle("Pair p_{T} (GeV/c)");
   fhConvPt->SetXTitle("Pair Mass (GeV/c^2)");
   outputContainer->Add(fhConvPt) ;
   
   fhConvDistEta  = new TH2F
-  ("hConvDistEta","distance to conversion vertex",100,-0.7,0.7,100,0.,5.); 
+  ("hConvDistEta","distance to conversion vertex",100,-0.7,0.7,100,0.,5.);
   fhConvDistEta->SetXTitle("#eta");
   fhConvDistEta->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEta) ;
   
   fhConvDistEn  = new TH2F
-  ("hConvDistEn","distance to conversion vertex",nptbins,ptmin,ptmax,100,0.,5.); 
+  ("hConvDistEn","distance to conversion vertex",nptbins,ptmin,ptmax,100,0.,5.);
   fhConvDistEn->SetXTitle("E (GeV)");
   fhConvDistEn->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEn) ;
   
   fhConvDistMass  = new TH2F
-  ("hConvDistMass","distance to conversion vertex",100,0,fMassCut,100,0.,5.); 
+  ("hConvDistMass","distance to conversion vertex",100,0,fMassCut,100,0.,5.);
   fhConvDistMass->SetXTitle("m (GeV/c^2)");
   fhConvDistMass->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistMass) ;
   
   fhConvDistEtaCutEta  = new TH2F
-  ("hConvDistEtaCutEta","distance to conversion vertex, dEta < 0.05",100,-0.7,0.7,100,0.,5.); 
+  ("hConvDistEtaCutEta","distance to conversion vertex, dEta < 0.05",100,-0.7,0.7,100,0.,5.);
   fhConvDistEtaCutEta->SetXTitle("#eta");
   fhConvDistEtaCutEta->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEtaCutEta) ;
   
   fhConvDistEnCutEta  = new TH2F
-  ("hConvDistEnCutEta","distance to conversion vertex, dEta < 0.05",nptbins,ptmin,ptmax,100,0.,5.); 
+  ("hConvDistEnCutEta","distance to conversion vertex, dEta < 0.05",nptbins,ptmin,ptmax,100,0.,5.);
   fhConvDistEnCutEta->SetXTitle("E (GeV)");
   fhConvDistEnCutEta->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEnCutEta) ;
   
   fhConvDistMassCutEta  = new TH2F
-  ("hConvDistMassCutEta","distance to conversion vertex, dEta < 0.05",100,0,fMassCut,100,0.,5.); 
+  ("hConvDistMassCutEta","distance to conversion vertex, dEta < 0.05",100,0,fMassCut,100,0.,5.);
   fhConvDistMassCutEta->SetXTitle("m (GeV/c^2)");
   fhConvDistMassCutEta->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistMassCutEta) ;
   
   fhConvDistEtaCutMass  = new TH2F
-  ("hConvDistEtaCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",100,-0.7,0.7,100,0.,5.); 
+  ("hConvDistEtaCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",100,-0.7,0.7,100,0.,5.);
   fhConvDistEtaCutMass->SetXTitle("#eta");
   fhConvDistEtaCutMass->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEtaCutMass) ;
   
   fhConvDistEnCutMass  = new TH2F
-  ("hConvDistEnCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",nptbins,ptmin,ptmax,100,0.,5.); 
+  ("hConvDistEnCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",nptbins,ptmin,ptmax,100,0.,5.);
   fhConvDistEnCutMass->SetXTitle("E (GeV)");
   fhConvDistEnCutMass->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEnCutMass) ;
   
   fhConvDistEtaCutAsy  = new TH2F
-  ("hConvDistEtaCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",100,-0.7,0.7,100,0.,5.); 
+  ("hConvDistEtaCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",100,-0.7,0.7,100,0.,5.);
   fhConvDistEtaCutAsy->SetXTitle("#eta");
   fhConvDistEtaCutAsy->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEtaCutAsy) ;
   
   fhConvDistEnCutAsy  = new TH2F
-  ("hConvDistEnCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",nptbins,ptmin,ptmax,100,0.,5.); 
+  ("hConvDistEnCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",nptbins,ptmin,ptmax,100,0.,5.);
   fhConvDistEnCutAsy->SetXTitle("E (GeV)");
   fhConvDistEnCutAsy->SetYTitle(" distance (m)");
   outputContainer->Add(fhConvDistEnCutAsy) ;
   
-  if(IsDataMC()){
-    
-    fhPtConversionTagged  = new TH1F("hPtMCConversionTagged","Number of converted #gamma over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+  if(IsDataMC())
+  {
+    fhPtConversionTagged  = new TH1F("hPtMCConversionTagged","Number of converted #gamma over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
     fhPtConversionTagged->SetYTitle("N");
     fhPtConversionTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-    outputContainer->Add(fhPtConversionTagged) ; 
+    outputContainer->Add(fhPtConversionTagged) ;
     
     
-    fhPtAntiNeutronTagged  = new TH1F("hPtMCAntiNeutronTagged","Number of AntiNeutron id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtAntiNeutronTagged  = new TH1F("hPtMCAntiNeutronTagged","Number of AntiNeutron id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
     fhPtAntiNeutronTagged->SetYTitle("N");
     fhPtAntiNeutronTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-    outputContainer->Add(fhPtAntiNeutronTagged) ; 
+    outputContainer->Add(fhPtAntiNeutronTagged) ;
     
-    fhPtAntiProtonTagged  = new TH1F("hPtMCAntiProtonTagged","Number of AntiProton id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtAntiProtonTagged  = new TH1F("hPtMCAntiProtonTagged","Number of AntiProton id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
     fhPtAntiProtonTagged->SetYTitle("N");
     fhPtAntiProtonTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-    outputContainer->Add(fhPtAntiProtonTagged) ; 
+    outputContainer->Add(fhPtAntiProtonTagged) ;
     
-    fhPtUnknownTagged  = new TH1F("hPtMCUnknownTagged","Number of Unknown id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtUnknownTagged  = new TH1F("hPtMCUnknownTagged","Number of Unknown id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
     fhPtUnknownTagged->SetYTitle("N");
     fhPtUnknownTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-    outputContainer->Add(fhPtUnknownTagged) ;     
+    outputContainer->Add(fhPtUnknownTagged) ;
     
     fhConvDeltaEtaMCConversion  = new TH2F
-    ("hConvDeltaEtaMCConversion","#Delta #eta of selected conversion pairs from real conversions",100,0,fMassCut,netabins,-0.5,0.5); 
+    ("hConvDeltaEtaMCConversion","#Delta #eta of selected conversion pairs from real conversions",100,0,fMassCut,netabins,-0.5,0.5);
     fhConvDeltaEtaMCConversion->SetYTitle("#Delta #eta");
     fhConvDeltaEtaMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaEtaMCConversion) ;
     
     fhConvDeltaPhiMCConversion  = new TH2F
-    ("hConvDeltaPhiMCConversion","#Delta #phi of selected conversion pairs from real conversions",100,0,fMassCut,nphibins,-0.5,0.5); 
+    ("hConvDeltaPhiMCConversion","#Delta #phi of selected conversion pairs from real conversions",100,0,fMassCut,nphibins,-0.5,0.5);
     fhConvDeltaPhiMCConversion->SetYTitle("#Delta #phi");
     fhConvDeltaPhiMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaPhiMCConversion) ;
     
     fhConvDeltaEtaPhiMCConversion  = new TH2F
-    ("hConvDeltaEtaPhiMCConversion","#Delta #eta vs #Delta #phi of selected conversion pairs, from real conversions",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    ("hConvDeltaEtaPhiMCConversion","#Delta #eta vs #Delta #phi of selected conversion pairs, from real conversions",netabins,-0.5,0.5,nphibins,-0.5,0.5);
     fhConvDeltaEtaPhiMCConversion->SetYTitle("#Delta #phi");
     fhConvDeltaEtaPhiMCConversion->SetXTitle("#Delta #eta");
     outputContainer->Add(fhConvDeltaEtaPhiMCConversion) ;
     
     fhConvAsymMCConversion  = new TH2F
-    ("hConvAsymMCConversion","Asymmetry of selected conversion pairs from real conversions",100,0,fMassCut,100,0,1); 
+    ("hConvAsymMCConversion","Asymmetry of selected conversion pairs from real conversions",100,0,fMassCut,100,0,1);
     fhConvAsymMCConversion->SetYTitle("Asymmetry");
     fhConvAsymMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvAsymMCConversion) ;
     
     fhConvPtMCConversion  = new TH2F
-    ("hConvPtMCConversion","p_{T} of selected conversion pairs from real conversions",100,0,fMassCut,100,0.,10.); 
+    ("hConvPtMCConversion","p_{T} of selected conversion pairs from real conversions",100,0,fMassCut,100,0.,10.);
     fhConvPtMCConversion->SetYTitle("Pair p_{T} (GeV/c)");
     fhConvPtMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvPtMCConversion) ;    
+    outputContainer->Add(fhConvPtMCConversion) ;
     
     fhConvDispersionMCConversion  = new TH2F
-    ("hConvDispersionMCConversion","p_{T} of selected conversion pairs from real conversions",100,0.,1.,100,0.,1.); 
+    ("hConvDispersionMCConversion","p_{T} of selected conversion pairs from real conversions",100,0.,1.,100,0.,1.);
     fhConvDispersionMCConversion->SetYTitle("Dispersion cluster 1");
     fhConvDispersionMCConversion->SetXTitle("Dispersion cluster 2");
-    outputContainer->Add(fhConvDispersionMCConversion) ;   
+    outputContainer->Add(fhConvDispersionMCConversion) ;
     
     fhConvM02MCConversion  = new TH2F
-    ("hConvM02MCConversion","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    ("hConvM02MCConversion","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
     fhConvM02MCConversion->SetYTitle("M02 cluster 1");
     fhConvM02MCConversion->SetXTitle("M02 cluster 2");
-    outputContainer->Add(fhConvM02MCConversion) ;           
+    outputContainer->Add(fhConvM02MCConversion) ;
     
     fhConvDeltaEtaMCAntiNeutron  = new TH2F
-    ("hConvDeltaEtaMCAntiNeutron","#Delta #eta of selected conversion pairs from anti-neutrons",100,0,fMassCut,netabins,-0.5,0.5); 
+    ("hConvDeltaEtaMCAntiNeutron","#Delta #eta of selected conversion pairs from anti-neutrons",100,0,fMassCut,netabins,-0.5,0.5);
     fhConvDeltaEtaMCAntiNeutron->SetYTitle("#Delta #eta");
     fhConvDeltaEtaMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaEtaMCAntiNeutron) ;
     
     fhConvDeltaPhiMCAntiNeutron  = new TH2F
-    ("hConvDeltaPhiMCAntiNeutron","#Delta #phi of selected conversion pairs from anti-neutrons",100,0,fMassCut,nphibins,-0.5,0.5); 
+    ("hConvDeltaPhiMCAntiNeutron","#Delta #phi of selected conversion pairs from anti-neutrons",100,0,fMassCut,nphibins,-0.5,0.5);
     fhConvDeltaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
     fhConvDeltaPhiMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaPhiMCAntiNeutron) ;
     
     fhConvDeltaEtaPhiMCAntiNeutron  = new TH2F
-    ("hConvDeltaEtaPhiMCAntiNeutron","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-neutrons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    ("hConvDeltaEtaPhiMCAntiNeutron","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-neutrons",netabins,-0.5,0.5,nphibins,-0.5,0.5);
     fhConvDeltaEtaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
     fhConvDeltaEtaPhiMCAntiNeutron->SetXTitle("#Delta #eta");
-    outputContainer->Add(fhConvDeltaEtaPhiMCAntiNeutron) ;    
+    outputContainer->Add(fhConvDeltaEtaPhiMCAntiNeutron) ;
     
     fhConvAsymMCAntiNeutron  = new TH2F
-    ("hConvAsymMCAntiNeutron","Asymmetry of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0,1); 
+    ("hConvAsymMCAntiNeutron","Asymmetry of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0,1);
     fhConvAsymMCAntiNeutron->SetYTitle("Asymmetry");
     fhConvAsymMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvAsymMCAntiNeutron) ;
     
     fhConvPtMCAntiNeutron  = new TH2F
-    ("hConvPtMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0.,10.); 
+    ("hConvPtMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0.,10.);
     fhConvPtMCAntiNeutron->SetYTitle("Pair p_{T} (GeV/c)");
     fhConvPtMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvPtMCAntiNeutron) ;    
+    outputContainer->Add(fhConvPtMCAntiNeutron) ;
     
     fhConvDispersionMCAntiNeutron  = new TH2F
-    ("hConvDispersionMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0.,1.,100,0.,1.); 
+    ("hConvDispersionMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0.,1.,100,0.,1.);
     fhConvDispersionMCAntiNeutron->SetYTitle("Dispersion cluster 1");
     fhConvDispersionMCAntiNeutron->SetXTitle("Dispersion cluster 2");
-    outputContainer->Add(fhConvDispersionMCAntiNeutron) ;       
+    outputContainer->Add(fhConvDispersionMCAntiNeutron) ;
     
     fhConvM02MCAntiNeutron  = new TH2F
-    ("hConvM02MCAntiNeutron","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    ("hConvM02MCAntiNeutron","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
     fhConvM02MCAntiNeutron->SetYTitle("M02 cluster 1");
     fhConvM02MCAntiNeutron->SetXTitle("M02 cluster 2");
-    outputContainer->Add(fhConvM02MCAntiNeutron) ;  
+    outputContainer->Add(fhConvM02MCAntiNeutron) ;
     
     fhConvDeltaEtaMCAntiProton  = new TH2F
-    ("hConvDeltaEtaMCAntiProton","#Delta #eta of selected conversion pairs from anti-protons",100,0,fMassCut,netabins,-0.5,0.5); 
+    ("hConvDeltaEtaMCAntiProton","#Delta #eta of selected conversion pairs from anti-protons",100,0,fMassCut,netabins,-0.5,0.5);
     fhConvDeltaEtaMCAntiProton->SetYTitle("#Delta #eta");
     fhConvDeltaEtaMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaEtaMCAntiProton) ;
     
     fhConvDeltaPhiMCAntiProton  = new TH2F
-    ("hConvDeltaPhiMCAntiProton","#Delta #phi of selected conversion pairs from anti-protons",100,0,fMassCut,nphibins,-0.5,0.5); 
+    ("hConvDeltaPhiMCAntiProton","#Delta #phi of selected conversion pairs from anti-protons",100,0,fMassCut,nphibins,-0.5,0.5);
     fhConvDeltaPhiMCAntiProton->SetYTitle("#Delta #phi");
     fhConvDeltaPhiMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaPhiMCAntiProton) ;
     
     fhConvDeltaEtaPhiMCAntiProton  = new TH2F
-    ("hConvDeltaEtaPhiMCAntiProton","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-protons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    ("hConvDeltaEtaPhiMCAntiProton","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-protons",netabins,-0.5,0.5,nphibins,-0.5,0.5);
     fhConvDeltaEtaPhiMCAntiProton->SetYTitle("#Delta #phi");
     fhConvDeltaEtaPhiMCAntiProton->SetXTitle("#Delta #eta");
-    outputContainer->Add(fhConvDeltaEtaPhiMCAntiProton) ;    
+    outputContainer->Add(fhConvDeltaEtaPhiMCAntiProton) ;
     
     fhConvAsymMCAntiProton  = new TH2F
-    ("hConvAsymMCAntiProton","Asymmetry of selected conversion pairs from anti-protons",100,0,fMassCut,100,0,1); 
+    ("hConvAsymMCAntiProton","Asymmetry of selected conversion pairs from anti-protons",100,0,fMassCut,100,0,1);
     fhConvAsymMCAntiProton->SetYTitle("Asymmetry");
     fhConvAsymMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvAsymMCAntiProton) ;
     
     fhConvPtMCAntiProton  = new TH2F
-    ("hConvPtMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0,fMassCut,100,0.,10.); 
+    ("hConvPtMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0,fMassCut,100,0.,10.);
     fhConvPtMCAntiProton->SetYTitle("Pair p_{T} (GeV/c)");
     fhConvPtMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvPtMCAntiProton) ;
     
     fhConvDispersionMCAntiProton  = new TH2F
-    ("hConvDispersionMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0.,1.,100,0.,1.); 
+    ("hConvDispersionMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0.,1.,100,0.,1.);
     fhConvDispersionMCAntiProton->SetYTitle("Dispersion cluster 1");
     fhConvDispersionMCAntiProton->SetXTitle("Dispersion cluster 2");
-    outputContainer->Add(fhConvDispersionMCAntiProton) ;       
+    outputContainer->Add(fhConvDispersionMCAntiProton) ;
     
     fhConvM02MCAntiProton  = new TH2F
-    ("hConvM02MCAntiProton","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    ("hConvM02MCAntiProton","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
     fhConvM02MCAntiProton->SetYTitle("M02 cluster 1");
     fhConvM02MCAntiProton->SetXTitle("M02 cluster 2");
-    outputContainer->Add(fhConvM02MCAntiProton) ;       
+    outputContainer->Add(fhConvM02MCAntiProton) ;
     
     fhConvDeltaEtaMCString  = new TH2F
-    ("hConvDeltaEtaMCString","#Delta #eta of selected conversion pairs from string",100,0,fMassCut,netabins,-0.5,0.5); 
+    ("hConvDeltaEtaMCString","#Delta #eta of selected conversion pairs from string",100,0,fMassCut,netabins,-0.5,0.5);
     fhConvDeltaEtaMCString->SetYTitle("#Delta #eta");
     fhConvDeltaEtaMCString->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaEtaMCString) ;
     
     fhConvDeltaPhiMCString  = new TH2F
-    ("hConvDeltaPhiMCString","#Delta #phi of selected conversion pairs from string",100,0,fMassCut,nphibins,-0.5,0.5); 
+    ("hConvDeltaPhiMCString","#Delta #phi of selected conversion pairs from string",100,0,fMassCut,nphibins,-0.5,0.5);
     fhConvDeltaPhiMCString->SetYTitle("#Delta #phi");
     fhConvDeltaPhiMCString->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvDeltaPhiMCString) ;
     
     fhConvDeltaEtaPhiMCString  = new TH2F
-    ("hConvDeltaEtaPhiMCString","#Delta #eta vs #Delta #phi of selected conversion pairs from string",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    ("hConvDeltaEtaPhiMCString","#Delta #eta vs #Delta #phi of selected conversion pairs from string",netabins,-0.5,0.5,nphibins,-0.5,0.5);
     fhConvDeltaEtaPhiMCString->SetYTitle("#Delta #phi");
     fhConvDeltaEtaPhiMCString->SetXTitle("#Delta #eta");
-    outputContainer->Add(fhConvDeltaEtaPhiMCString) ;    
+    outputContainer->Add(fhConvDeltaEtaPhiMCString) ;
     
     fhConvAsymMCString  = new TH2F
-    ("hConvAsymMCString","Asymmetry of selected conversion pairs from string",100,0,fMassCut,100,0,1); 
+    ("hConvAsymMCString","Asymmetry of selected conversion pairs from string",100,0,fMassCut,100,0,1);
     fhConvAsymMCString->SetYTitle("Asymmetry");
     fhConvAsymMCString->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvAsymMCString) ;
     
     fhConvPtMCString  = new TH2F
-    ("hConvPtMCString","p_{T} of selected conversion pairs from string",100,0,fMassCut,100,0.,10.); 
+    ("hConvPtMCString","p_{T} of selected conversion pairs from string",100,0,fMassCut,100,0.,10.);
     fhConvPtMCString->SetYTitle("Pair p_{T} (GeV/c)");
     fhConvPtMCString->SetXTitle("Pair Mass (GeV/c^2)");
     outputContainer->Add(fhConvPtMCString) ;
     
     fhConvDispersionMCString  = new TH2F
-    ("hConvDispersionMCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    ("hConvDispersionMCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
     fhConvDispersionMCString->SetYTitle("Dispersion cluster 1");
     fhConvDispersionMCString->SetXTitle("Dispersion cluster 2");
-    outputContainer->Add(fhConvDispersionMCString) ;       
+    outputContainer->Add(fhConvDispersionMCString) ;
     
     fhConvM02MCString  = new TH2F
-    ("hConvM02MCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    ("hConvM02MCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
     fhConvM02MCString->SetYTitle("M02 cluster 1");
     fhConvM02MCString->SetXTitle("M02 cluster 2");
-    outputContainer->Add(fhConvM02MCString) ; 
+    outputContainer->Add(fhConvM02MCString) ;
     
     fhConvDistMCConversion  = new TH2F
-    ("hConvDistMCConversion","calculated conversion distance vs real vertes for MC conversion",100,0.,5.,100,0.,5.); 
+    ("hConvDistMCConversion","calculated conversion distance vs real vertes for MC conversion",100,0.,5.,100,0.,5.);
     fhConvDistMCConversion->SetYTitle("distance");
     fhConvDistMCConversion->SetXTitle("vertex R");
-    outputContainer->Add(fhConvDistMCConversion) ; 
+    outputContainer->Add(fhConvDistMCConversion) ;
     
     fhConvDistMCConversionCuts  = new TH2F
-    ("hConvDistMCConversionCuts","calculated conversion distance vs real vertes for MC conversion, deta < 0.05, m < 10 MeV, asym < 0.1",100,0.,5.,100,0.,5.); 
+    ("hConvDistMCConversionCuts","calculated conversion distance vs real vertes for MC conversion, deta < 0.05, m < 10 MeV, asym < 0.1",100,0.,5.,100,0.,5.);
     fhConvDistMCConversionCuts->SetYTitle("distance");
     fhConvDistMCConversionCuts->SetXTitle("vertex R");
-    outputContainer->Add(fhConvDistMCConversionCuts) ; 
-        
+    outputContainer->Add(fhConvDistMCConversionCuts) ;
+    
   }
   
   return outputContainer ;
-
+  
 }
 
-//_______________________________________
+//___________________________________________
 void AliAnaPhotonConvInCalo::InitParameters()
 {
-  
   //Initialize the parameters of the analysis.
   AddToHistogramsName("AnaPhotonConvInCalo_");
   
@@ -448,20 +447,21 @@ void AliAnaPhotonConvInCalo::InitParameters()
        
 }
 
-//_____________________________________________
-void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD() 
+//_________________________________________________
+void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
 {
   //Do conversion photon analysis and fill aods
   
   //Loop on stored AOD photons
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD() - aod branch entries %d\n", naod);
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
   //List to be used in conversion analysis, to tag the cluster as candidate for conversion
   Bool_t * indexConverted = new Bool_t[naod];
   for (Int_t i = 0; i < naod; i++) indexConverted[i] = kFALSE;
-       
-  for(Int_t iaod = 0; iaod < naod ; iaod++){
+  
+  for(Int_t iaod = 0; iaod < naod ; iaod++)
+  {
     AliAODPWG4Particle* calo =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
     
     Bool_t bConverted = kFALSE;
@@ -472,7 +472,8 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
     
     // Second cluster loop
     AliAODPWG4Particle* calo2 = 0;
-    for(Int_t jaod = iaod + 1 ; jaod < naod ; jaod++) {
+    for(Int_t jaod = iaod + 1 ; jaod < naod ; jaod++)
+    {
       //Check if set previously as converted couple, if so skip its use.
       if (indexConverted[jaod]) continue;
       //printf("Check Conversion indeces %d and %d\n",iaod,jaod);
@@ -482,12 +483,13 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
       //Get mass of pair, if small, take this pair.
       Float_t pairM     = calo->GetPairMass(calo2);
       //printf("\t both in calo, mass %f, cut %f\n",pairM,fMassCut);
-      if(pairM < fMassCut){  
+      if(pairM < fMassCut)
+      {
         calo->SetTagged(kFALSE);
         id2 = calo2->GetCaloLabel(0);
         Float_t asymmetry = TMath::Abs(calo->E()-calo2->E())/(calo->E()+calo2->E());
         Float_t dPhi      = (calo->Momentum())->Phi()-(calo2->Momentum())->Phi();
-        Float_t dEta      = (calo->Momentum())->Eta()-(calo2->Momentum())->Eta();  
+        Float_t dEta      = (calo->Momentum())->Eta()-(calo2->Momentum())->Eta();
         
         //...............................................
         //Fill few histograms with kinematics of the pair
@@ -497,35 +499,32 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
         fhConvDeltaPhi   ->Fill( pairM, dEta      );
         fhConvAsym       ->Fill( pairM, asymmetry );
         fhConvDeltaEtaPhi->Fill( dEta , dPhi      );
-        fhConvPt         ->Fill( pairM, (calo->Momentum())->Pt()+(calo2->Momentum())->Pt());          
+        fhConvPt         ->Fill( pairM, (calo->Momentum())->Pt()+(calo2->Momentum())->Pt());
         
         //Estimate conversion distance, T. Awes, M. Ivanov
-        //Under the assumption that the pair has zero mass, and that each electron 
-        //of the pair has the same momentum, they will each have the same bend radius 
-        //given by R=p/(qB) = p / (300 B) with p in [MeV/c], B in [Tesla] and R in [m]. 
-        //With nominal ALICE magnet current of 30kA B=0.5T, and so with E_cluster=p,  
-        //R = E/1.5 [cm].  Under these assumptions, the distance from the conversion 
-        //point to the MCEal can be related to the separation distance, L=2y, on the MCEal 
-        //as d = sqrt(R^2 -(R-y)^2) = sqrt(2Ry - y^2). And since R>>y we can write as 
-        //d = sqrt(E*L/1.5) where E is the cluster energy and L is the distance in cm between 
+        //Under the assumption that the pair has zero mass, and that each electron
+        //of the pair has the same momentum, they will each have the same bend radius
+        //given by R=p/(qB) = p / (300 B) with p in [MeV/c], B in [Tesla] and R in [m].
+        //With nominal ALICE magnet current of 30kA B=0.5T, and so with E_cluster=p,
+        //R = E/1.5 [cm].  Under these assumptions, the distance from the conversion
+        //point to the MCEal can be related to the separation distance, L=2y, on the MCEal
+        //as d = sqrt(R^2 -(R-y)^2) = sqrt(2Ry - y^2). And since R>>y we can write as
+        //d = sqrt(E*L/1.5) where E is the cluster energy and L is the distance in cm between
         //the clusters.
         
-        TObjArray * clusters    = 0; 
-        if(calo->GetDetector() == "EMCAL"){
-          clusters = GetEMCALClusters();
-        }
-        else{
-          clusters = GetPHOSClusters();
-        }
+        TObjArray * clusters    = 0;
+        if(calo->GetDetectorTag() == kEMCAL) clusters = GetEMCALClusters();
+        else                                 clusters = GetPHOSClusters();
+        
         
         Int_t iclus = -1;
-        AliVCluster *cluster1 = FindCluster(clusters,calo ->GetCaloLabel(0),iclus); 
-        AliVCluster *cluster2 = FindCluster(clusters,calo2->GetCaloLabel(0),iclus); 
-
+        AliVCluster *cluster1 = FindCluster(clusters,calo ->GetCaloLabel(0),iclus);
+        AliVCluster *cluster2 = FindCluster(clusters,calo2->GetCaloLabel(0),iclus);
+        
         Float_t pos1[3];
-        cluster1->GetPosition(pos1); 
+        cluster1->GetPosition(pos1);
         Float_t pos2[3];
-        cluster2->GetPosition(pos2); 
+        cluster2->GetPosition(pos2);
         Float_t clustDist = TMath::Sqrt((pos1[0]-pos2[0])*(pos1[0]-pos2[0])+
                                         (pos1[1]-pos2[1])*(pos1[1]-pos2[1])+
                                         (pos1[2]-pos2[2])*(pos1[2]-pos2[2]));
@@ -533,71 +532,74 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
         Float_t convDist  = TMath::Sqrt(calo->E() *clustDist*0.01/0.15);
         Float_t convDist2 = TMath::Sqrt(calo2->E()*clustDist*0.01/0.15);
         //printf("l = %f, e1 = %f, d1=%f, e2 = %f, d2=%f\n",clustDist,calo->E(),convDist,calo2->E(),convDist2);
-        if(GetDebug() > 2)
-          printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD(): Pair with mass %2.3f < %2.3f, %1.2f < dPhi %2.2f < %2.2f, dEta %f < %2.2f, asymmetry %2.2f< %2.2f; \n    cluster1 id %d, e %2.3f  SM %d, eta %2.3f, phi %2.3f ; \n    cluster2 id %d, e %2.3f, SM %d,eta %2.3f, phi %2.3f\n",
-                 pairM,fMassCut,fConvDPhiMinCut, dPhi, fConvDPhiMaxCut, dEta, fConvDEtaCut, asymmetry, fConvAsymCut,
-                 calo->GetCaloLabel(0),calo->E(),GetCaloUtils()->GetModuleNumber(calo,GetReader()->GetInputEvent()), calo->Eta(), calo->Phi(),
-                 id2, calo2->E(), GetCaloUtils()->GetModuleNumber(calo2,GetReader()->GetInputEvent()),calo2->Eta(), calo2->Phi());
+        AliDebug(2,Form("Pair with mass %2.3f < %2.3f, %1.2f < dPhi %2.2f < %2.2f, dEta %f < %2.2f, asymmetry %2.2f< %2.2f; \n    cluster1 id %d, e %2.3f  SM %d, eta %2.3f, phi %2.3f ; \n    cluster2 id %d, e %2.3f, SM %d,eta %2.3f, phi %2.3f",
+                        pairM,fMassCut,fConvDPhiMinCut, dPhi, fConvDPhiMaxCut, dEta, fConvDEtaCut, asymmetry, fConvAsymCut,
+                        calo->GetCaloLabel(0),calo->E(),GetCaloUtils()->GetModuleNumber(calo,GetReader()->GetInputEvent()), calo->Eta(), calo->Phi(),
+                        id2, calo2->E(), GetCaloUtils()->GetModuleNumber(calo2,GetReader()->GetInputEvent()),calo2->Eta(), calo2->Phi()));
         
         fhConvDistEta ->Fill(calo ->Eta(),convDist );
         fhConvDistEta ->Fill(calo2->Eta(),convDist2);
         fhConvDistEn  ->Fill(calo ->E(),  convDist );
-        fhConvDistEn  ->Fill(calo2->E(),  convDist2);        
+        fhConvDistEn  ->Fill(calo2->E(),  convDist2);
         fhConvDistMass->Fill(pairM, convDist );
         //dEta cut
-        if(dEta<0.05){
+        if(dEta<0.05)
+        {
           fhConvDistEtaCutEta ->Fill(calo->Eta(), convDist );
           fhConvDistEtaCutEta ->Fill(calo2->Eta(),convDist2);
           fhConvDistEnCutEta  ->Fill(calo->E(),   convDist );
-          fhConvDistEnCutEta  ->Fill(calo2->E(),  convDist2);        
+          fhConvDistEnCutEta  ->Fill(calo2->E(),  convDist2);
           fhConvDistMassCutEta->Fill(pairM, convDist );
           //mass cut
-          if(pairM<0.01){//10 MeV
+          if(pairM<0.01)
+          {//10 MeV
             fhConvDistEtaCutMass ->Fill(calo ->Eta(), convDist );
             fhConvDistEtaCutMass ->Fill(calo2->Eta(), convDist2);
             fhConvDistEnCutMass  ->Fill(calo ->E(),   convDist );
-            fhConvDistEnCutMass  ->Fill(calo2->E(),   convDist2);        
+            fhConvDistEnCutMass  ->Fill(calo2->E(),   convDist2);
             // asymmetry cut
-            if(asymmetry<0.1){
+            if(asymmetry<0.1)
+            {
               fhConvDistEtaCutAsy ->Fill(calo ->Eta(), convDist );
               fhConvDistEtaCutAsy ->Fill(calo2->Eta(), convDist2);
               fhConvDistEnCutAsy  ->Fill(calo ->E(),   convDist );
-              fhConvDistEnCutAsy  ->Fill(calo2->E(),   convDist2); 
+              fhConvDistEnCutAsy  ->Fill(calo2->E(),   convDist2);
             }//asymmetry cut
-          }//mass cut            
+          }//mass cut
         }//dEta cut
         
         //...............................................
         //Select pairs in a eta-phi window
-        if(TMath::Abs(dEta) < fConvDEtaCut    && 
+        if(TMath::Abs(dEta) < fConvDEtaCut    &&
            TMath::Abs(dPhi) < fConvDPhiMaxCut &&
-           TMath::Abs(dPhi) > fConvDPhiMinCut && 
-           asymmetry        < fConvAsymCut       ){
+           TMath::Abs(dPhi) > fConvDPhiMinCut &&
+           asymmetry        < fConvAsymCut       )
+        {
           indexConverted[iaod] = kTRUE;
-          indexConverted[jaod] = kTRUE; 
-          bConverted           = kTRUE;          
+          indexConverted[jaod] = kTRUE;
+          bConverted           = kTRUE;
         }
         //printf("Accepted? %d\n",bConverted);
         //...........................................
         //Fill more histograms, simulated data
         //FIXME, move all this to MakeAnalysisFillHistograms ...
-        if(IsDataMC()){
-          
+        if(IsDataMC())
+        {
           //Check the origin of the pair, look for conversion, antinucleons or jet correlations (strings)
           Int_t ancPDG    = 0;
           Int_t ancStatus = 0;
-          TLorentzVector momentum;
-          TVector3 prodVertex;
-          Int_t ancLabel  = GetMCAnalysisUtils()->CheckCommonAncestor(cluster1->GetLabel(), cluster2->GetLabel(), 
-                                                                      GetReader(), ancPDG, ancStatus, momentum, prodVertex);
+          Int_t ancLabel  = GetMCAnalysisUtils()->CheckCommonAncestor(cluster1->GetLabel(), cluster2->GetLabel(),
+                                                                      GetReader(), ancPDG, ancStatus, fMomentum, fProdVertex);
           
           // printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - Common ancestor label %d, pdg %d, name %s, status %d; \n",
           //                          ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
           
           Int_t tag1 = calo ->GetTag();
           Int_t tag2 = calo2->GetTag();
-          if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCConversion)){
-            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCConversion) && (ancPDG==22 || TMath::Abs(ancPDG)==11) && ancLabel > -1){
+          if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCConversion))
+          {
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCConversion) && (ancPDG==22 || TMath::Abs(ancPDG)==11) && ancLabel > -1)
+            {
               fhConvDeltaEtaMCConversion   ->Fill( pairM, dEta      );
               fhConvDeltaPhiMCConversion   ->Fill( pairM, dPhi      );
               fhConvAsymMCConversion       ->Fill( pairM, asymmetry );
@@ -605,18 +607,21 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
               fhConvPtMCConversion         ->Fill( pairM, calo->Pt()+calo2->Pt());
               fhConvDispersionMCConversion ->Fill( cluster1->GetDispersion(), cluster2->GetDispersion());
               fhConvM02MCConversion        ->Fill( cluster1->GetM02(), cluster2->GetM02());
-              fhConvDistMCConversion       ->Fill( convDist , prodVertex.Mag() );
-              fhConvDistMCConversion       ->Fill( convDist2, prodVertex.Mag() );
+              fhConvDistMCConversion       ->Fill( convDist , fProdVertex.Mag() );
+              fhConvDistMCConversion       ->Fill( convDist2, fProdVertex.Mag() );
               
-              if(dEta<0.05 && pairM<0.01 && asymmetry<0.1){
-                fhConvDistMCConversionCuts->Fill( convDist , prodVertex.Mag() );
-                fhConvDistMCConversionCuts->Fill( convDist2, prodVertex.Mag() );
+              if(dEta<0.05 && pairM<0.01 && asymmetry<0.1)
+              {
+                fhConvDistMCConversionCuts->Fill( convDist , fProdVertex.Mag() );
+                fhConvDistMCConversionCuts->Fill( convDist2, fProdVertex.Mag() );
               }
               
-            }              
+            }
           }
-          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiNeutron)){
-            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiNeutron) && ancPDG==-2112 && ancLabel > -1){
+          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiNeutron))
+          {
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiNeutron) && ancPDG==-2112 && ancLabel > -1)
+            {
               fhConvDeltaEtaMCAntiNeutron    ->Fill( pairM, dEta      );
               fhConvDeltaPhiMCAntiNeutron    ->Fill( pairM, dPhi      );
               fhConvAsymMCAntiNeutron        ->Fill( pairM, asymmetry );
@@ -626,8 +631,10 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
               fhConvM02MCAntiNeutron         ->Fill( cluster1->GetM02(), cluster2->GetM02());
             }
           }
-          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiProton)){
-            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiProton) && ancPDG==-2212 && ancLabel > -1){
+          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiProton))
+          {
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiProton) && ancPDG==-2212 && ancLabel > -1)
+            {
               fhConvDeltaEtaMCAntiProton    ->Fill( pairM, dEta      );
               fhConvDeltaPhiMCAntiProton    ->Fill( pairM, dPhi      );
               fhConvAsymMCAntiProton        ->Fill( pairM, asymmetry );
@@ -639,7 +646,8 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
           }
           
           //Pairs coming from fragmenting pairs.
-          if(ancPDG < 22 && ancLabel > 7 && (ancStatus == 11 || ancStatus == 12) ){
+          if( ancPDG < 22 && ancLabel > 7 && (ancStatus == 11 || ancStatus == 12) )
+          {
             fhConvDeltaEtaMCString    ->Fill( pairM, dPhi);
             fhConvDeltaPhiMCString    ->Fill( pairM, dPhi);
             fhConvAsymMCString        ->Fill( pairM, TMath::Abs(calo->E()-calo2->E())/(calo->E()+calo2->E()) );
@@ -658,18 +666,20 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
     
     //..........................................................................................................
     //Pair selected as converted, remove both clusters or recombine them into a photon and put them in the AOD
-    if(bConverted){ 
+    if(bConverted)
+    {
       //Add to AOD
-      if(fAddConvertedPairsToAOD){
+      if(fAddConvertedPairsToAOD)
+      {
         //Create AOD of pair analysis
-        TLorentzVector mpair = *(calo->Momentum())+*(calo2->Momentum());
-        AliAODPWG4Particle aodpair = AliAODPWG4Particle(mpair);
+        fMomentum = *(calo->Momentum())+*(calo2->Momentum());
+        AliAODPWG4Particle aodpair = AliAODPWG4Particle(fMomentum);
         aodpair.SetLabel(calo->GetLabel());
         
         //printf("Index %d, Id %d\n",iaod, calo->GetID());
-        //Set the indeces of the original caloclusters  
+        //Set the indeces of the original caloclusters
         aodpair.SetCaloLabel(calo->GetCaloLabel(0),id2);
-        aodpair.SetDetector(calo->GetDetector());
+        aodpair.SetDetectorTag(calo->GetDetectorTag());
         aodpair.SetIdentifiedParticleType(calo->GetIdentifiedParticleType());
         aodpair.SetTag(calo ->GetTag());
         aodpair.SetTagged(kTRUE);
@@ -679,7 +689,7 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
       }
       
       //Do not add the current calocluster
-      if(!fRemoveConvertedPair) 
+      if(!fRemoveConvertedPair)
       {
         //printf("TAGGED\n");
         //Tag this cluster as likely conversion
@@ -691,66 +701,65 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()
   
   // Remove entries identified as conversion electrons
   // Revise if this is OK
-  if(fRemoveConvertedPair || fAddConvertedPairsToAOD){
+  if(fRemoveConvertedPair || fAddConvertedPairsToAOD)
+  {
     for(Int_t iaod = 0; iaod < naod ; iaod++)
+    {
       if(indexConverted[iaod])GetOutputAODBranch()->RemoveAt(iaod);
+    }
     GetOutputAODBranch()->Compress();
   }
   
   delete [] indexConverted;
-       
-  if(GetDebug() > 1) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()  End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());  
+  
+  AliDebug(1,Form("End fill AODs, with %d entries",GetOutputAODBranch()->GetEntriesFast()));
   
 }
 
-//____________________________________________________
-void  AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() 
+//________________________________________________________
+void  AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms()
 {
   //Fill histograms
   
   //-------------------------------------------------------------------
-  // Access MC information in stack if requested, check that it exists.        
+  // Access MC information in stack if requested, check that it exists.
   AliStack         * stack       = 0x0;
-  TParticle        * primary     = 0x0;   
+  TParticle        * primary     = 0x0;
   TClonesArray     * mcparticles = 0x0;
-  AliAODMCParticle * aodprimary  = 0x0; 
+  AliAODMCParticle * aodprimary  = 0x0;
   
-  if(IsDataMC()){
-    
-    if(GetReader()->ReadStack()){
+  if(IsDataMC())
+  {
+    if(GetReader()->ReadStack())
+    {
       stack =  GetMCStack() ;
-      if(!stack) {
-        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
-        abort();
-      }
-      
+      if(!stack)
+        AliFatal("Stack not available, is the MC handler called? STOP");
     }
-    else if(GetReader()->ReadAODMCParticles()){
-      
+    else if(GetReader()->ReadAODMCParticles())
+    {
       //Get the list of MC particles
       mcparticles = GetReader()->GetAODMCParticles();
-      if(!mcparticles && GetDebug() > 0)
-      {
-        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
-      }        
+      if(!mcparticles)
+        AliFatal("Standard MCParticles not available!");
     }
   }// is data and MC
+  
   //----------------------------------
   //Loop on stored AOD photons
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
-  for(Int_t iaod = 0; iaod < naod ; iaod++){
+  for(Int_t iaod = 0; iaod < naod ; iaod++)
+  {
     AliAODPWG4Particle* ph =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
     //Int_t pdg = ph->GetIdentifiedParticleType();
     
-    if(ph->IsTagged()){
-      
-      if(GetDebug() > 2) 
-        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
+    if(ph->IsTagged())
+    {
+      AliDebug(2,Form("ID Photon: pt %f, phi %f, eta %f", ph->Pt(),ph->Phi(),ph->Eta())) ;
       //................................
-      //Fill photon histograms 
+      //Fill photon histograms
       Float_t ptcluster  = ph->Pt();
       Float_t phicluster = ph->Phi();
       Float_t etacluster = ph->Eta();
@@ -760,54 +769,60 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms()
       if(ecluster > 0.5)        fhEtaPhiPhotonConv  ->Fill(etacluster, phicluster);
       else if(GetMinPt() < 0.5) fhEtaPhi05PhotonConv->Fill(etacluster, phicluster);
       
-      
       //.......................................
       //Play with the MC data if available
-      if(IsDataMC()){
-        
-        
+      if(IsDataMC())
+      {
         //....................................................................
         // Access MC information in stack if requested, check that it exists.
         Int_t label =ph->GetLabel();
-        if(label < 0) {
-          if(GetDebug() > 1) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
+        if(label < 0)
+        {
+          AliDebug(1,Form("*** bad label ***:  label %d", label));
           continue;
         }
         
         //Float_t eprim   = 0;
         //Float_t ptprim  = 0;
-        if(GetReader()->ReadStack()){
-          
-          if(label >=  stack->GetNtrack()) {
-            if(GetDebug() > 2)  printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
+        if(GetReader()->ReadStack())
+        {
+          if(label >=  stack->GetNtrack())
+          {
+            AliDebug(1,Form("*** large label ***:  label %d, n tracks %d", label, stack->GetNtrack()));
             continue ;
           }
           
           primary = stack->Particle(label);
-          if(!primary){
-            printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+          if(!primary)
+          {
+            AliDebug(1,Form("*** no primary ***:  label %d", label));
             continue;
           }
           //eprim   = primary->Energy();
           //ptprim  = primary->Pt();
           
         }
-        else if(GetReader()->ReadAODMCParticles()){
+        else if(GetReader()->ReadAODMCParticles())
+        {
           //Check which is the input
-          if(ph->GetInputFileIndex() == 0){
+          if(ph->GetInputFileIndex() == 0)
+          {
             if(!mcparticles) continue;
-            if(label >=  mcparticles->GetEntriesFast()) {
-              if(GetDebug() > 2)  printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", 
-                                         label, mcparticles->GetEntriesFast());
+            
+            if(label >=  mcparticles->GetEntriesFast())
+            {
+              AliDebug(2,Form("*** large label ***:  label %d, n tracks %d",label, mcparticles->GetEntriesFast()));
               continue ;
             }
+            
             //Get the particle
             aodprimary = (AliAODMCParticle*) mcparticles->At(label);
             
           }
           
-          if(!aodprimary){
-            printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+          if(!aodprimary)
+          {
+            AliDebug(2,Form("*** no primary ***:  label %d", label));
             continue;
           }
           
@@ -820,29 +835,22 @@ void  AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms()
         
         if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton))
         {
-          
           if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion))
           {
-            
             fhPtConversionTagged ->Fill(ptcluster);
-            
-          }                    
+          }
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron))
         {
-          
           fhPtAntiNeutronTagged ->Fill(ptcluster);
-          
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton))
         {
           fhPtAntiProtonTagged ->Fill(ptcluster);
-          
-        } 
-        
-        else {
+        }
+        else
+        {
           fhPtUnknownTagged ->Fill(ptcluster);
-          
         }
         
       }//Histograms with MC
index 2f9de34edb8f6d61d7197d03fc2f71eba073ee5f..b95d7564d9944def8922cfdc2143e3de553a2d07 100755 (executable)
@@ -80,6 +80,9 @@ class AliAnaPhotonConvInCalo : public AliAnaCaloTrackCorrBaseClass {
   Float_t  fConvDPhiMinCut;               // Select conversion pairs when dphi of pair lager than cut
   Float_t  fConvDPhiMaxCut;               // Select conversion pairs when dphi of pair smaller than cut
 
+  TLorentzVector fMomentum ;              //! Cluster momentum
+  TVector3       fProdVertex;             //! Production vertex
+  
   // Histograms
   TH1F * fhPtPhotonConv   ;               //! Number of identified photon vs transerse momentum 
   TH2F * fhEtaPhiPhotonConv  ;            //! Pseudorapidity vs Phi of identified  photon for transerse momentum > 0.5, for converted
index 3cf7b723a3d99771f3d483463c31bbaff8a6b633..7002617aee5a3f71eac417795cea53954948937d 100755 (executable)
 //_________________________________________________________________________
 // Class to collect two-photon invariant mass distributions for
 // extracting raw pi0 yield.
-// Input is produced by AliAnaPhoton (or any other analysis producing output AliAODPWG4Particles), 
+// Input is produced by AliAnaPhoton (or any other analysis producing output AliAODPWG4Particles),
 // it will do nothing if executed alone
 //
-//-- Author: Dmitri Peressounko (RRC "KI") 
+//-- Author: Dmitri Peressounko (RRC "KI")
 //-- Adapted to CaloTrackCorr frame by Lamia Benhabib (SUBATECH)
 //-- and Gustavo Conesa (INFN-Frascati)
 //_________________________________________________________________________
@@ -51,7 +51,7 @@
 #include "AliMixedEvent.h"
 #include "AliAODMCParticle.h"
 
-// --- Detectors --- 
+// --- Detectors ---
 #include "AliPHOSGeoUtils.h"
 #include "AliEMCALGeometry.h"
 
@@ -63,24 +63,27 @@ fEventsList(0x0),
 fNModules(22),
 fUseAngleCut(kFALSE),        fUseAngleEDepCut(kFALSE),     fAngleCut(0),                 fAngleMaxCut(7.),
 fMultiCutAna(kFALSE),        fMultiCutAnaSim(kFALSE),
-fNPtCuts(0),                 fNAsymCuts(0),                fNCellNCuts(0),               fNPIDBits(0),  
-fMakeInvPtPlots(kFALSE),     fSameSM(kFALSE),              
+fNPtCuts(0),                 fNAsymCuts(0),                fNCellNCuts(0),               fNPIDBits(0),
+fMakeInvPtPlots(kFALSE),     fSameSM(kFALSE),
 fFillSMCombinations(kFALSE), fCheckConversion(kFALSE),
-fFillBadDistHisto(kFALSE),   fFillSSCombinations(kFALSE),  
+fFillBadDistHisto(kFALSE),   fFillSSCombinations(kFALSE),
 fFillAngleHisto(kFALSE),     fFillAsymmetryHisto(kFALSE),  fFillOriginHisto(0),          fFillArmenterosThetaStar(0),
 fCheckAccInSector(kFALSE),
+fPhotonMom1(),               fPhotonMom1Boost(),           fPhotonMom2(),                fPi0Mom(),
+fProdVertex(),
+
 //Histograms
 fhAverTotECluster(0),        fhAverTotECell(0),            fhAverTotECellvsCluster(0),
 fhEDensityCluster(0),        fhEDensityCell(0),            fhEDensityCellvsCluster(0),
-fhReMod(0x0),                fhReSameSideEMCALMod(0x0),    fhReSameSectorEMCALMod(0x0),  fhReDiffPHOSMod(0x0), 
+fhReMod(0x0),                fhReSameSideEMCALMod(0x0),    fhReSameSectorEMCALMod(0x0),  fhReDiffPHOSMod(0x0),
 fhMiMod(0x0),                fhMiSameSideEMCALMod(0x0),    fhMiSameSectorEMCALMod(0x0),  fhMiDiffPHOSMod(0x0),
 fhReConv(0x0),               fhMiConv(0x0),                fhReConv2(0x0),  fhMiConv2(0x0),
-fhRe1(0x0),                  fhMi1(0x0),                   fhRe2(0x0),                   fhMi2(0x0),      
-fhRe3(0x0),                  fhMi3(0x0),                   fhReInvPt1(0x0),              fhMiInvPt1(0x0),  
+fhRe1(0x0),                  fhMi1(0x0),                   fhRe2(0x0),                   fhMi2(0x0),
+fhRe3(0x0),                  fhMi3(0x0),                   fhReInvPt1(0x0),              fhMiInvPt1(0x0),
 fhReInvPt2(0x0),             fhMiInvPt2(0x0),              fhReInvPt3(0x0),              fhMiInvPt3(0x0),
-fhRePtNCellAsymCuts(0x0),    fhMiPtNCellAsymCuts(0x0),     fhRePtNCellAsymCutsSM(),  
-fhRePIDBits(0x0),            fhRePtMult(0x0),              fhReSS(), 
-fhRePtAsym(0x0),             fhRePtAsymPi0(0x0),           fhRePtAsymEta(0x0),  
+fhRePtNCellAsymCuts(0x0),    fhMiPtNCellAsymCuts(0x0),     fhRePtNCellAsymCutsSM(),
+fhRePIDBits(0x0),            fhRePtMult(0x0),              fhReSS(),
+fhRePtAsym(0x0),             fhRePtAsymPi0(0x0),           fhRePtAsymEta(0x0),
 fhEventBin(0),               fhEventMixBin(0),
 fhCentrality(0x0),           fhCentralityNoPair(0x0),
 fhEventPlaneResolution(0x0),
@@ -94,7 +97,7 @@ fhPrimPi0Phi(0x0),           fhPrimPi0AccPhi(0x0),
 fhPrimPi0OpeningAngle(0x0),  fhPrimPi0OpeningAngleAsym(0x0),fhPrimPi0CosOpeningAngle(0x0),
 fhPrimPi0PtCentrality(0),    fhPrimPi0PtEventPlane(0),
 fhPrimPi0AccPtCentrality(0), fhPrimPi0AccPtEventPlane(0),
-fhPrimEtaE(0x0),             fhPrimEtaPt(0x0),             
+fhPrimEtaE(0x0),             fhPrimEtaPt(0x0),
 fhPrimEtaAccE(0x0),          fhPrimEtaAccPt(0x0),
 fhPrimEtaY(0x0),             fhPrimEtaAccY(0x0),
 fhPrimEtaYeta(0x0),          fhPrimEtaYetaYcut(0x0),       fhPrimEtaAccYeta(0x0),
@@ -104,7 +107,7 @@ fhPrimEtaPtCentrality(0),    fhPrimEtaPtEventPlane(0),
 fhPrimEtaAccPtCentrality(0), fhPrimEtaAccPtEventPlane(0),
 fhPrimPi0PtOrigin(0x0),      fhPrimEtaPtOrigin(0x0),
 fhMCOrgMass(),               fhMCOrgAsym(),                fhMCOrgDeltaEta(),            fhMCOrgDeltaPhi(),
-fhMCPi0MassPtRec(),          fhMCPi0MassPtTrue(),          fhMCPi0PtTruePtRec(),         
+fhMCPi0MassPtRec(),          fhMCPi0MassPtTrue(),          fhMCPi0PtTruePtRec(),
 fhMCEtaMassPtRec(),          fhMCEtaMassPtTrue(),          fhMCEtaPtTruePtRec(),
 fhMCPi0PtOrigin(0x0),        fhMCEtaPtOrigin(0x0),
 fhMCPi0ProdVertex(0),        fhMCEtaProdVertex(0),
@@ -113,7 +116,7 @@ fhReMCFromConversion(0),     fhReMCFromNotConversion(0),   fhReMCFromMixConversi
 fhCosThStarPrimPi0(0),       fhCosThStarPrimEta(0)//,
 {
   //Default Ctor
+  
   InitParameters();
   
   for(Int_t i = 0; i < 4; i++)
@@ -142,9 +145,9 @@ AliAnaPi0::~AliAnaPi0()
         }
       }
     }
-    delete[] fEventsList; 
+    delete[] fEventsList;
   }
-       
+  
 }
 
 //______________________________
@@ -158,8 +161,8 @@ void AliAnaPi0::InitParameters()
   
   fUseAngleCut = kFALSE;
   fUseAngleEDepCut = kFALSE;
-  fAngleCut    = 0.; 
-  fAngleMaxCut = TMath::Pi(); 
+  fAngleCut    = 0.;
+  fAngleMaxCut = TMath::Pi();
   
   fMultiCutAna = kFALSE;
   
@@ -168,11 +171,11 @@ void AliAnaPi0::InitParameters()
   for(Int_t i = fNPtCuts; i < 10; i++)fPtCuts[i] = 0.;
   
   fNAsymCuts = 2;
-  fAsymCuts[0] = 1.;  fAsymCuts[1] = 0.7; //fAsymCuts[2] = 0.6; //  fAsymCuts[3] = 0.1;    
+  fAsymCuts[0] = 1.;  fAsymCuts[1] = 0.7; //fAsymCuts[2] = 0.6; //  fAsymCuts[3] = 0.1;
   for(Int_t i = fNAsymCuts; i < 10; i++)fAsymCuts[i] = 0.;
   
   fNCellNCuts = 3;
-  fCellNCuts[0] = 0; fCellNCuts[1] = 1;   fCellNCuts[2] = 2;   
+  fCellNCuts[0] = 0; fCellNCuts[1] = 1;   fCellNCuts[2] = 2;
   for(Int_t i = fNCellNCuts; i < 10; i++)fCellNCuts[i]  = 0;
   
   fNPIDBits = 2;
@@ -184,38 +187,39 @@ void AliAnaPi0::InitParameters()
 
 //_______________________________________
 TObjString * AliAnaPi0::GetAnalysisCuts()
-{  
+{
   //Save parameters used for analysis
   TString parList ; //this will be list of parameters used for this analysis.
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
-  snprintf(onePar,buffersize,"--- AliAnaPi0 ---\n") ;
-  parList+=onePar ;    
-  snprintf(onePar,buffersize,"Number of bins in Centrality:  %d \n",GetNCentrBin()) ;
+  snprintf(onePar,buffersize,"--- AliAnaPi0 ---:") ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d \n",GetNZvertBin()) ;
+  snprintf(onePar,buffersize,"Number of bins in Centrality:  %d;",GetNCentrBin()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d \n",GetNRPBin()) ;
+  snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d;",GetNZvertBin()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Depth of event buffer: %d \n",GetNMaxEvMix()) ;
+  snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d;",GetNRPBin()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Select pairs with their angle: %d, edep %d, min angle %2.3f, max angle %2.3f,\n",fUseAngleCut, fUseAngleEDepCut,fAngleCut,fAngleMaxCut) ;
+  snprintf(onePar,buffersize,"Depth of event buffer: %d;",GetNMaxEvMix()) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"Select pairs with their angle: %d, edep %d, min angle %2.3f, max angle %2.3f;",fUseAngleCut, fUseAngleEDepCut,fAngleCut,fAngleMaxCut) ;
   parList+=onePar ;
   snprintf(onePar,buffersize," Asymmetry cuts: n = %d, asymmetry < ",fNAsymCuts) ;
   for(Int_t i = 0; i < fNAsymCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fAsymCuts[i]);
   parList+=onePar ;
-  snprintf(onePar,buffersize," PID selection bits: n = %d, PID bit =\n",fNPIDBits) ;
+  snprintf(onePar,buffersize," PID selection bits: n = %d, PID bit =",fNPIDBits) ;
   for(Int_t i = 0; i < fNPIDBits; i++) snprintf(onePar,buffersize,"%s %d;",onePar,fPIDBits[i]);
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Cuts: \n") ;
+  snprintf(onePar,buffersize,"Cuts:") ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f \n",GetZvertexCut(),GetZvertexCut()) ;
+  snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f;",GetZvertexCut(),GetZvertexCut()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Calorimeter: %s \n",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Number of modules: %d \n",fNModules) ;
+  snprintf(onePar,buffersize,"Number of modules: %d:",fNModules) ;
   parList+=onePar ;
-  if(fMultiCutAna){
+  if(fMultiCutAna)
+  {
     snprintf(onePar, buffersize," pT cuts: n = %d, pt > ",fNPtCuts) ;
     for(Int_t i = 0; i < fNPtCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fPtCuts[i]);
     parList+=onePar ;
@@ -224,22 +228,22 @@ TObjString * AliAnaPi0::GetAnalysisCuts()
     parList+=onePar ;
   }
   
-  return new TObjString(parList) ;     
+  return new TObjString(parList) ;
 }
 
 //_________________________________________
 TList * AliAnaPi0::GetCreateOutputObjects()
-{  
-  // Create histograms to be saved in output file and 
+{
+  // Create histograms to be saved in output file and
   // store them in fOutputContainer
   
   // Init the number of modules, set in the class AliCalorimeterUtils
   fNModules = GetCaloUtils()->GetNumberOfSuperModulesUsed();
-  if(GetCalorimeter()=="PHOS" && fNModules > 4) fNModules = 4;
+  if(GetCalorimeter()==kPHOS && fNModules > 4) fNModules = 4;
   
   //create event containers
   fEventsList = new TList*[GetNCentrBin()*GetNZvertBin()*GetNRPBin()] ;
-
+  
   for(Int_t ic=0; ic<GetNCentrBin(); ic++)
   {
     for(Int_t iz=0; iz<GetNZvertBin(); iz++)
@@ -253,21 +257,21 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     }
   }
   
-  TList * outputContainer = new TList() ; 
-  outputContainer->SetName(GetName()); 
-       
+  TList * outputContainer = new TList() ;
+  outputContainer->SetName(GetName());
+  
   fhReMod                = new TH2F*[fNModules]   ;
   fhMiMod                = new TH2F*[fNModules]   ;
   
-  if(GetCalorimeter() == "PHOS")
+  if(GetCalorimeter() == kPHOS)
   {
-    fhReDiffPHOSMod        = new TH2F*[fNModules]   ;  
+    fhReDiffPHOSMod        = new TH2F*[fNModules]   ;
     fhMiDiffPHOSMod        = new TH2F*[fNModules]   ;
   }
   else
   {
     fhReSameSectorEMCALMod = new TH2F*[fNModules/2] ;
-    fhReSameSideEMCALMod   = new TH2F*[fNModules-2] ;  
+    fhReSameSideEMCALMod   = new TH2F*[fNModules-2] ;
     fhMiSameSectorEMCALMod = new TH2F*[fNModules/2] ;
     fhMiSameSideEMCALMod   = new TH2F*[fNModules-2] ;
   }
@@ -292,7 +296,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhMiInvPt2 = new TH2F*[GetNCentrBin()*fNPIDBits*fNAsymCuts] ;
       fhMiInvPt3 = new TH2F*[GetNCentrBin()*fNPIDBits*fNAsymCuts] ;
     }
-  } 
+  }
   
   const Int_t buffersize = 255;
   char key[buffersize] ;
@@ -306,8 +310,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   Float_t etamax  = GetHistogramRanges()->GetHistoEtaMax();
   Float_t ptmin   = GetHistogramRanges()->GetHistoPtMin();
   Float_t phimin  = GetHistogramRanges()->GetHistoPhiMin();
-  Float_t etamin  = GetHistogramRanges()->GetHistoEtaMin();    
-       
+  Float_t etamin  = GetHistogramRanges()->GetHistoEtaMin();
+  
   Int_t nmassbins = GetHistogramRanges()->GetHistoMassBins();
   Int_t nasymbins = GetHistogramRanges()->GetHistoAsymmetryBins();
   Float_t massmax = GetHistogramRanges()->GetHistoMassMax();
@@ -316,8 +320,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   Float_t asymmin = GetHistogramRanges()->GetHistoAsymmetryMin();
   Int_t ntrmbins  = GetHistogramRanges()->GetHistoTrackMultiplicityBins();
   Int_t ntrmmax   = GetHistogramRanges()->GetHistoTrackMultiplicityMax();
-  Int_t ntrmmin   = GetHistogramRanges()->GetHistoTrackMultiplicityMin(); 
-    
+  Int_t ntrmmin   = GetHistogramRanges()->GetHistoTrackMultiplicityMin();
+  
   if(fCheckConversion)
   {
     fhReConv = new TH2F("hReConv","Real Pair with one recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
@@ -383,7 +387,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
           outputContainer->Add(fhRe3[index]) ;
         }
         
-        //Inverse pT 
+        //Inverse pT
         if(fMakeInvPtPlots)
         {
           //Distance to bad module 1
@@ -477,7 +481,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
               outputContainer->Add(fhMiInvPt3[index]) ;
             }
           }
-        } 
+        }
       }
     }
   }
@@ -517,7 +521,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     
     if(fFillSMCombinations)
       for(Int_t iSM = 0; iSM < fNModules; iSM++) fhRePtNCellAsymCutsSM[iSM] = new TH2F*[fNPtCuts*fNAsymCuts*fNCellNCuts];
-      
+    
     
     for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
     {
@@ -539,7 +543,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
           fhMiPtNCellAsymCuts[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
           fhMiPtNCellAsymCuts[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
           fhMiPtNCellAsymCuts[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
-          outputContainer->Add(fhMiPtNCellAsymCuts[index]) ;          
+          outputContainer->Add(fhMiPtNCellAsymCuts[index]) ;
           
           if(fFillSMCombinations)
           {
@@ -612,7 +616,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
                            GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
     fhEventMixBin->SetXTitle("bin");
     outputContainer->Add(fhEventMixBin) ;
-       }
+  }
   
   if(GetNCentrBin()>1)
   {
@@ -636,13 +640,13 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   if(fFillAngleHisto)
   {
     fhRealOpeningAngle  = new TH2F
-    ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,300,0,TMath::Pi()); 
+    ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,300,0,TMath::Pi());
     fhRealOpeningAngle->SetYTitle("#theta(rad)");
     fhRealOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
     outputContainer->Add(fhRealOpeningAngle) ;
     
     fhRealCosOpeningAngle  = new TH2F
-    ("hRealCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,1); 
+    ("hRealCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,1);
     fhRealCosOpeningAngle->SetYTitle("cos (#theta) ");
     fhRealCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
     outputContainer->Add(fhRealCosOpeningAngle) ;
@@ -650,43 +654,43 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     if(DoOwnMix())
     {
       fhMixedOpeningAngle  = new TH2F
-      ("hMixedOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,300,0,TMath::Pi()); 
+      ("hMixedOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,300,0,TMath::Pi());
       fhMixedOpeningAngle->SetYTitle("#theta(rad)");
       fhMixedOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
       outputContainer->Add(fhMixedOpeningAngle) ;
       
       fhMixedCosOpeningAngle  = new TH2F
-      ("hMixedCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,100,0,1); 
+      ("hMixedCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,100,0,1);
       fhMixedCosOpeningAngle->SetYTitle("cos (#theta) ");
       fhMixedCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
       outputContainer->Add(fhMixedCosOpeningAngle) ;
       
     }
-  } 
+  }
   
-  //Histograms filled only if MC data is requested     
+  //Histograms filled only if MC data is requested
   if(IsDataMC())
   {
     fhReMCFromConversion = new TH2F("hReMCFromConversion","Invariant mass of 2 clusters originated in conversions",
-                         nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
+                                    nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
     fhReMCFromConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     fhReMCFromConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
     outputContainer->Add(fhReMCFromConversion) ;
     
     fhReMCFromNotConversion = new TH2F("hReMCNotFromConversion","Invariant mass of 2 clusters not originated in conversions",
-                                    nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
+                                       nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
     fhReMCFromNotConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     fhReMCFromNotConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
     outputContainer->Add(fhReMCFromNotConversion) ;
     
     fhReMCFromMixConversion = new TH2F("hReMCFromMixConversion","Invariant mass of 2 clusters one from conversion and the other not",
-                                    nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
+                                       nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
     fhReMCFromMixConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     fhReMCFromMixConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
     outputContainer->Add(fhReMCFromMixConversion) ;
     
     //Pi0
-
+    
     fhPrimPi0E     = new TH1F("hPrimPi0E","Primary #pi^{0} E, |#it{Y}|<1",nptbins,ptmin,ptmax) ;
     fhPrimPi0AccE  = new TH1F("hPrimPi0AccE","Primary #pi^{0} #it{E} with both photons in acceptance",nptbins,ptmin,ptmax) ;
     fhPrimPi0E   ->SetXTitle("#it{E} (GeV)");
@@ -706,12 +710,12 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     fhPrimPi0Y   ->SetYTitle("#it{Rapidity}");
     fhPrimPi0Y   ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimPi0Y) ;
-
+    
     fhPrimPi0Yeta      = new TH2F("hPrimPi0PseudoRapidity","PseudoRapidity of primary #pi^{0}",nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
     fhPrimPi0Yeta   ->SetYTitle("#eta");
     fhPrimPi0Yeta   ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimPi0Yeta) ;
-
+    
     fhPrimPi0YetaYcut      = new TH2F("hPrimPi0PseudoRapidityYcut","PseudoRapidity of primary #pi^{0}, |#it{Y}|<1",nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
     fhPrimPi0YetaYcut   ->SetYTitle("#eta");
     fhPrimPi0YetaYcut   ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
@@ -734,7 +738,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     outputContainer->Add(fhPrimPi0Phi) ;
     
     fhPrimPi0AccPhi = new TH2F("hPrimPi0AccPhi","#phi of primary #pi^{0} with accepted daughters",nptbins,ptmin,ptmax,
-                               nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ; 
+                               nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
     fhPrimPi0AccPhi->SetYTitle("#phi (deg)");
     fhPrimPi0AccPhi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimPi0AccPhi) ;
@@ -762,7 +766,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     outputContainer->Add(fhPrimPi0AccPtEventPlane) ;
     
     //Eta
-
+    
     fhPrimEtaE     = new TH1F("hPrimEtaE","Primary eta E",nptbins,ptmin,ptmax) ;
     fhPrimEtaAccE  = new TH1F("hPrimEtaAccE","Primary #eta #it{E} with both photons in acceptance",nptbins,ptmin,ptmax) ;
     fhPrimEtaE   ->SetXTitle("#it{E} (GeV)");
@@ -781,12 +785,12 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     fhPrimEtaY->SetYTitle("#it{Rapidity}");
     fhPrimEtaY->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimEtaY) ;
-
+    
     fhPrimEtaYeta      = new TH2F("hPrimEtaPseudoRapidityEta","PseudoRapidity of primary #eta",nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
     fhPrimEtaYeta->SetYTitle("#it{Rapidity}");
     fhPrimEtaYeta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimEtaYeta) ;
-
+    
     fhPrimEtaYetaYcut      = new TH2F("hPrimEtaPseudoRapidityEtaYcut","PseudoRapidity of primary #eta, |#it{Y}|<1",nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
     fhPrimEtaYetaYcut->SetYTitle("#it{Pseudorapidity}");
     fhPrimEtaYetaYcut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
@@ -796,12 +800,12 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     fhPrimEtaAccY->SetYTitle("#it{Rapidity}");
     fhPrimEtaAccY->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimEtaAccY) ;
+    
     fhPrimEtaAccYeta  = new TH2F("hPrimEtaAccPseudoRapidity","PseudoRapidity of primary #eta",nptbins,ptmin,ptmax, netabins,etamin,etamax) ;
     fhPrimEtaAccYeta->SetYTitle("#it{Pseudorapidity}");
     fhPrimEtaAccYeta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPrimEtaAccYeta) ;
-
+    
     fhPrimEtaPhi    = new TH2F("hPrimEtaPhi","Azimuthal of primary #eta",nptbins,ptmin,ptmax, nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
     fhPrimEtaPhi->SetYTitle("#phi (deg)");
     fhPrimEtaPhi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
@@ -830,10 +834,10 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     outputContainer->Add(fhPrimEtaPtEventPlane) ;
     outputContainer->Add(fhPrimEtaAccPtEventPlane) ;
     
-     if(fFillAngleHisto)
+    if(fFillAngleHisto)
     {
       fhPrimPi0OpeningAngle  = new TH2F
-      ("hPrimPi0OpeningAngle","Angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,0.5); 
+      ("hPrimPi0OpeningAngle","Angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,0.5);
       fhPrimPi0OpeningAngle->SetYTitle("#theta(rad)");
       fhPrimPi0OpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
       outputContainer->Add(fhPrimPi0OpeningAngle) ;
@@ -845,7 +849,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       outputContainer->Add(fhPrimPi0OpeningAngleAsym) ;
       
       fhPrimPi0CosOpeningAngle  = new TH2F
-      ("hPrimPi0CosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,-1,1); 
+      ("hPrimPi0CosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,-1,1);
       fhPrimPi0CosOpeningAngle->SetYTitle("cos (#theta) ");
       fhPrimPi0CosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
       outputContainer->Add(fhPrimPi0CosOpeningAngle) ;
@@ -861,15 +865,13 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhPrimEtaOpeningAngleAsym->SetXTitle("|#it{A}|=| (#it{E}_{1}-#it{E}_{2}) / (#it{E}_{1}+#it{E}_{2}) |");
       fhPrimEtaOpeningAngleAsym->SetYTitle("#theta(rad)");
       outputContainer->Add(fhPrimEtaOpeningAngleAsym) ;
-
+      
       
       fhPrimEtaCosOpeningAngle  = new TH2F
       ("hPrimEtaCosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#eta}",nptbins,ptmin,ptmax,100,-1,1);
       fhPrimEtaCosOpeningAngle->SetYTitle("cos (#theta) ");
       fhPrimEtaCosOpeningAngle->SetXTitle("#it{E}_{ #eta} (GeV)");
       outputContainer->Add(fhPrimEtaCosOpeningAngle) ;
-
-      
     }
     
     if(fFillOriginHisto)
@@ -904,7 +906,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(8 ,"Other");
       fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(9 ,"#eta");
       fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(10 ,"#eta prime");
-      outputContainer->Add(fhMCPi0PtOrigin) ;    
+      outputContainer->Add(fhMCPi0PtOrigin) ;
       
       //Eta
       fhPrimEtaPtOrigin     = new TH2F("hPrimEtaPtOrigin","Primary #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,7,0,7) ;
@@ -930,27 +932,27 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(6 ,"#eta prime");
       
       outputContainer->Add(fhMCEtaPtOrigin) ;
-
+      
       fhMCPi0ProdVertex = new TH2F("hMCPi0ProdVertex","Selected reco pair from generated #pi^{0} #it{p}_{T} vs production vertex",
                                    200,0.,20.,5000,0,500) ;
       fhMCPi0ProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
       fhMCPi0ProdVertex->SetYTitle("#it{R} (cm)");
       outputContainer->Add(fhMCPi0ProdVertex) ;
-
+      
       fhMCEtaProdVertex = new TH2F("hMCEtaProdVertex","Selected reco pair from generated #eta #it{p}_{T} vs production vertex",
                                    200,0.,20.,5000,0,500) ;
       fhMCEtaProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
       fhMCEtaProdVertex->SetYTitle("#it{R} (cm)");
       outputContainer->Add(fhMCEtaProdVertex) ;
-
+      
       fhPrimPi0ProdVertex = new TH2F("hPrimPi0ProdVertex","generated #pi^{0} #it{p}_{T} vs production vertex",
-                                   200,0.,20.,5000,0,500) ;
+                                     200,0.,20.,5000,0,500) ;
       fhPrimPi0ProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
       fhPrimPi0ProdVertex->SetYTitle("#it{R} (cm)");
       outputContainer->Add(fhPrimPi0ProdVertex) ;
       
       fhPrimEtaProdVertex = new TH2F("hPrimEtaProdVertex","generated #eta #it{p}_{T} vs production vertex",
-                                   200,0.,20.,5000,0,500) ;
+                                     200,0.,20.,5000,0,500) ;
       fhPrimEtaProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
       fhPrimEtaProdVertex->SetYTitle("#it{R} (cm)");
       outputContainer->Add(fhPrimEtaProdVertex) ;
@@ -997,7 +999,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
                                                  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
               fhMCPi0MassPtRec[index]->SetXTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
               fhMCPi0MassPtRec[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
-              outputContainer->Add(fhMCPi0MassPtRec[index]) ;    
+              outputContainer->Add(fhMCPi0MassPtRec[index]) ;
               
               fhMCPi0MassPtTrue[index] = new TH2F(Form("hMCPi0MassPtTrue_pt%d_cell%d_asym%d",ipt,icell,iasym),
                                                   Form("Reconstructed #it{M} vs generated #it{p}_{T} of true #pi^{0} cluster pairs for #it{p}_{T} >%2.2f, #it{N}^{cluster}_{cell}>%d and |#it{A}|>%1.2f",fPtCuts[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
@@ -1035,7 +1037,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
               outputContainer->Add(fhMCEtaPtTruePtRec[index]) ;
             }
           }
-        }  
+        }
       }//multi cut ana
       else
       {
@@ -1079,7 +1081,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhReMod[imod]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
       fhReMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
       outputContainer->Add(fhReMod[imod]) ;
-      if(GetCalorimeter()=="PHOS")
+      if(GetCalorimeter()==kPHOS)
       {
         snprintf(key, buffersize,"hReDiffPHOSMod_%d",imod) ;
         snprintf(title, buffersize,"Real pairs PHOS, clusters in different Modules: %s",(pairnamePHOS[imod]).Data()) ;
@@ -1088,7 +1090,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
         fhReDiffPHOSMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
         outputContainer->Add(fhReDiffPHOSMod[imod]) ;
       }
-      else{//EMCAL
+      else
+      {//EMCAL
         if(imod<fNModules/2)
         {
           snprintf(key, buffersize,"hReSameSectorEMCAL_%d",imod) ;
@@ -1110,7 +1113,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       }//EMCAL
       
       if(DoOwnMix())
-      { 
+      {
         snprintf(key, buffersize,"hMiMod_%d",imod) ;
         snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for Module %d",imod) ;
         fhMiMod[imod]  = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
@@ -1118,7 +1121,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
         fhMiMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
         outputContainer->Add(fhMiMod[imod]) ;
         
-        if(GetCalorimeter()=="PHOS"){
+        if(GetCalorimeter()==kPHOS)
+        {
           snprintf(key, buffersize,"hMiDiffPHOSMod_%d",imod) ;
           snprintf(title, buffersize,"Mixed pairs PHOS, clusters in different Modules: %s",(pairnamePHOS[imod]).Data()) ;
           fhMiDiffPHOSMod[imod]  = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
@@ -1126,7 +1130,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
           fhMiDiffPHOSMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
           outputContainer->Add(fhMiDiffPHOSMod[imod]) ;
         }//PHOS
-        else{//EMCAL
+        else
+        {//EMCAL
           if(imod<fNModules/2)
           {
             snprintf(key, buffersize,"hMiSameSectorEMCALMod_%d",imod) ;
@@ -1145,7 +1150,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
             fhMiSameSideEMCALMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
             outputContainer->Add(fhMiSameSideEMCALMod[imod]) ;
           }
-        }//EMCAL      
+        }//EMCAL
       }// own mix
     }//loop combinations
   } // SM combinations
@@ -1165,10 +1170,10 @@ TList * AliAnaPi0::GetCreateOutputObjects()
       fhArmPrimPi0[i]->SetYTitle("#it{p}_{T}^{Arm}");
       fhArmPrimPi0[i]->SetXTitle("#alpha^{Arm}");
       outputContainer->Add(fhArmPrimPi0[i]) ;
-
+      
       fhArmPrimEta[i] =  new TH2F(Form("hArmenterosPrimEtaEBin%d",i),
-                                      Form("Armenteros of primary #eta, %s",ebin[i].Data()),
-                                      200, -1, 1, narmbins,armmin,armmax);
+                                  Form("Armenteros of primary #eta, %s",ebin[i].Data()),
+                                  200, -1, 1, narmbins,armmin,armmax);
       fhArmPrimEta[i]->SetYTitle("#it{p}_{T}^{Arm}");
       fhArmPrimEta[i]->SetXTitle("#alpha^{Arm}");
       outputContainer->Add(fhArmPrimEta[i]) ;
@@ -1191,9 +1196,9 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   }
   
   //  for(Int_t i = 0; i < outputContainer->GetEntries() ; i++){
-  //  
+  //
   //    printf("Histogram %d, name: %s\n ",i, outputContainer->At(i)->GetName());
-  //  
+  //
   //  }
   
   return outputContainer;
@@ -1225,7 +1230,8 @@ void AliAnaPi0::Print(const Option_t * /*opt*/) const
   for(Int_t i = 0; i < fNPIDBits; i++) printf("%d ",fPIDBits[i]);
   printf("\n");
   
-  if(fMultiCutAna){
+  if(fMultiCutAna)
+  {
     printf("pT cuts: n = %d, \n",fNPtCuts) ;
     printf("\tpT > ");
     for(Int_t i = 0; i < fNPtCuts; i++) printf("%2.2f ",fPtCuts[i]);
@@ -1238,7 +1244,7 @@ void AliAnaPi0::Print(const Option_t * /*opt*/) const
     
   }
   printf("------------------------------------------------------\n") ;
-} 
+}
 
 //________________________________________
 void AliAnaPi0::FillAcceptanceHistograms()
@@ -1262,7 +1268,6 @@ void AliAnaPi0::FillAcceptanceHistograms()
   
   TParticle        * primStack = 0;
   AliAODMCParticle * primAOD   = 0;
-  TLorentzVector lvmeson;
   
   // Get the ESD MC particles container
   AliStack * stack = 0;
@@ -1291,13 +1296,13 @@ void AliAnaPi0::FillAcceptanceHistograms()
       primStack = stack->Particle(i) ;
       if(!primStack)
       {
-        printf("AliAnaPi0::FillAcceptanceHistograms() - ESD primaries pointer not available!!\n");
+        AliWarning("ESD primaries pointer not available!!");
         continue;
       }
       
       // If too small  skip
       if( primStack->Energy() < 0.4 ) continue;
-
+      
       pdg       = primStack->GetPdgCode();
       nDaught   = primStack->GetNDaughters();
       iphot1    = primStack->GetDaughter(0) ;
@@ -1308,7 +1313,7 @@ void AliAnaPi0::FillAcceptanceHistograms()
       //       prim->GetName(), prim->GetPdgCode());
       
       //Photon kinematics
-      primStack->Momentum(lvmeson);
+      primStack->Momentum(fPi0Mom);
       
       mesonY = 0.5*TMath::Log((primStack->Energy()+primStack->Pz())/(primStack->Energy()-primStack->Pz())) ;
     }
@@ -1317,7 +1322,7 @@ void AliAnaPi0::FillAcceptanceHistograms()
       primAOD = (AliAODMCParticle *) mcparticles->At(i);
       if(!primAOD)
       {
-        printf("AliAnaPi0::FillAcceptanceHistograms() - AOD primaries pointer not available!!\n");
+        AliWarning("AOD primaries pointer not available!!");
         continue;
       }
       
@@ -1332,7 +1337,7 @@ void AliAnaPi0::FillAcceptanceHistograms()
       if(primAOD->E() == TMath::Abs(primAOD->Pz()))  continue ; //Protection against floating point exception
       
       //Photon kinematics
-      lvmeson.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
+      fPi0Mom.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
       
       mesonY = 0.5*TMath::Log((primAOD->E()+primAOD->Pz())/(primAOD->E()-primAOD->Pz())) ;
     }
@@ -1340,10 +1345,10 @@ void AliAnaPi0::FillAcceptanceHistograms()
     // Select only pi0 or eta
     if( pdg != 111 && pdg != 221) continue ;
     
-    mesonPt  = lvmeson.Pt () ;
-    mesonE   = lvmeson.E  () ;
-    mesonYeta= lvmeson.Eta() ;
-    mesonPhi = lvmeson.Phi() ;
+    mesonPt  = fPi0Mom.Pt () ;
+    mesonE   = fPi0Mom.E  () ;
+    mesonYeta= fPi0Mom.Eta() ;
+    mesonPhi = fPi0Mom.Phi() ;
     if( mesonPhi < 0 ) mesonPhi+=TMath::TwoPi();
     mesonPhi *= TMath::RadToDeg();
     
@@ -1449,7 +1454,6 @@ void AliAnaPi0::FillAcceptanceHistograms()
     
     if(iphot1 < 0 || iphot1 >= nprim || iphot2 < 0 || iphot2 >= nprim) continue ;
     
-    TLorentzVector lv1, lv2;
     Int_t pdg1 = 0;
     Int_t pdg2 = 0;
     Bool_t inacceptance1 = kTRUE;
@@ -1465,8 +1469,8 @@ void AliAnaPi0::FillAcceptanceHistograms()
       pdg1 = phot1->GetPdgCode();
       pdg2 = phot2->GetPdgCode();
       
-      phot1->Momentum(lv1);
-      phot2->Momentum(lv2);
+      phot1->Momentum(fPhotonMom1);
+      phot2->Momentum(fPhotonMom2);
       
       // Check if photons hit the Calorimeter acceptance
       if(IsRealCaloAcceptanceOn())
@@ -1486,8 +1490,8 @@ void AliAnaPi0::FillAcceptanceHistograms()
       pdg1 = phot1->GetPdgCode();
       pdg2 = phot2->GetPdgCode();
       
-      lv1.SetPxPyPzE(phot1->Px(),phot1->Py(),phot1->Pz(),phot1->E());
-      lv2.SetPxPyPzE(phot2->Px(),phot2->Py(),phot2->Pz(),phot2->E());
+      fPhotonMom1.SetPxPyPzE(phot1->Px(),phot1->Py(),phot1->Pz(),phot1->E());
+      fPhotonMom2.SetPxPyPzE(phot2->Px(),phot2->Py(),phot2->Pz(),phot2->E());
       
       // Check if photons hit the Calorimeter acceptance
       if(IsRealCaloAcceptanceOn())
@@ -1502,25 +1506,25 @@ void AliAnaPi0::FillAcceptanceHistograms()
     // Check if photons hit desired acceptance in the fidutial borders fixed in the analysis
     if(IsFiducialCutOn())
     {
-      if( inacceptance1 && !GetFiducialCut()->IsInFiducialCut(lv1,GetCalorimeter()) ) inacceptance1 = kFALSE ;
-      if( inacceptance2 && !GetFiducialCut()->IsInFiducialCut(lv2,GetCalorimeter()) ) inacceptance2 = kFALSE ;
+      if( inacceptance1 && !GetFiducialCut()->IsInFiducialCut(fPhotonMom1.Eta(), fPhotonMom1.Phi(), GetCalorimeter()) ) inacceptance1 = kFALSE ;
+      if( inacceptance2 && !GetFiducialCut()->IsInFiducialCut(fPhotonMom2.Eta(), fPhotonMom2.Phi(), GetCalorimeter()) ) inacceptance2 = kFALSE ;
     }
     
-    if(fFillArmenterosThetaStar) FillArmenterosThetaStar(pdg,lvmeson,lv1,lv2);
-
-    if(GetCalorimeter()=="EMCAL" && inacceptance1 && inacceptance2 && fCheckAccInSector)
+    if(fFillArmenterosThetaStar) FillArmenterosThetaStar(pdg);
+    
+    if(GetCalorimeter()==kEMCAL && inacceptance1 && inacceptance2 && fCheckAccInSector)
     {
       Int_t absID1=0;
       Int_t absID2=0;
       
-      Float_t photonPhi1 = lv1.Phi();
-      Float_t photonPhi2 = lv2.Phi();
+      Float_t photonPhi1 = fPhotonMom1.Phi();
+      Float_t photonPhi2 = fPhotonMom2.Phi();
       
       if(photonPhi1 < 0) photonPhi1+=TMath::TwoPi();
       if(photonPhi2 < 0) photonPhi2+=TMath::TwoPi();
       
-      GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv1.Eta(),photonPhi1,absID1);
-      GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(lv2.Eta(),photonPhi2,absID2);
+      GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(fPhotonMom1.Eta(),photonPhi1,absID1);
+      GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(fPhotonMom2.Eta(),photonPhi2,absID2);
       
       Int_t sm1 = GetEMCALGeometry()->GetSuperModuleNumber(absID1);
       Int_t sm2 = GetEMCALGeometry()->GetSuperModuleNumber(absID2);
@@ -1543,22 +1547,19 @@ void AliAnaPi0::FillAcceptanceHistograms()
       //                    inacceptance = kTRUE;
     }
     
-    if(GetDebug() > 2)
-      printf("Accepted in %s?: m (%2.2f,%2.2f,%2.2f), p1 (%2.2f,%2.2f,%2.2f), p2 (%2.2f,%2.2f,%2.2f) : in1 %d, in2 %d\n",
-             GetCalorimeter().Data(),
-             mesonPt,mesonYeta,mesonPhi,
-             lv1.Pt(),lv1.Eta(),lv1.Phi()*TMath::RadToDeg(),
-             lv2.Pt(),lv2.Eta(),lv2.Phi()*TMath::RadToDeg(),
-             inacceptance1, inacceptance2);
-
+    AliDebug(2,Form("Accepted in %s?: m (%2.2f,%2.2f,%2.2f), p1 (%2.2f,%2.2f,%2.2f), p2 (%2.2f,%2.2f,%2.2f) : in1 %d, in2 %d",
+                    GetCalorimeterString().Data(),
+                    mesonPt,mesonYeta,mesonPhi,
+                    fPhotonMom1.Pt(),fPhotonMom1.Eta(),fPhotonMom1.Phi()*TMath::RadToDeg(),
+                    fPhotonMom2.Pt(),fPhotonMom2.Eta(),fPhotonMom2.Phi()*TMath::RadToDeg(),
+                    inacceptance1, inacceptance2));
     
     if(inacceptance1 && inacceptance2)
     {
-      Float_t  asym  = TMath::Abs((lv1.E()-lv2.E()) / (lv1.E()+lv2.E()));
-      Double_t angle = lv1.Angle(lv2.Vect());
+      Float_t  asym  = TMath::Abs((fPhotonMom1.E()-fPhotonMom2.E()) / (fPhotonMom1.E()+fPhotonMom2.E()));
+      Double_t angle = fPhotonMom1.Angle(fPhotonMom2.Vect());
       
-      if(GetDebug() > 2)
-        printf("\t ACCEPTED pdg %d: pt %2.2f, phi %2.2f, eta %2.2f\n",pdg,mesonPt,mesonPhi,mesonYeta);
+      AliDebug(2,Form("\t ACCEPTED pdg %d: pt %2.2f, phi %2.2f, eta %2.2f",pdg,mesonPt,mesonPhi,mesonYeta));
       
       if(pdg==111)
       {
@@ -1600,24 +1601,23 @@ void AliAnaPi0::FillAcceptanceHistograms()
   
 }
 
-//__________________________________________________________________________________
-void AliAnaPi0::FillArmenterosThetaStar(Int_t pdg,             TLorentzVector meson,
-                                        TLorentzVector daugh1, TLorentzVector daugh2)
+//________________________________________________
+void AliAnaPi0::FillArmenterosThetaStar(Int_t pdg)
 {
   // Fill armenteros plots
   
   // Get pTArm and AlphaArm
-  Float_t momentumSquaredMother = meson.P()*meson.P();
+  Float_t momentumSquaredMother = fPi0Mom.P()*fPi0Mom.P();
   Float_t momentumDaughter1AlongMother = 0.;
   Float_t momentumDaughter2AlongMother = 0.;
   
   if (momentumSquaredMother > 0.)
   {
-    momentumDaughter1AlongMother = (daugh1.Px()*meson.Px() + daugh1.Py()*meson.Py()+ daugh1.Pz()*meson.Pz()) / sqrt(momentumSquaredMother);
-    momentumDaughter2AlongMother = (daugh2.Px()*meson.Px() + daugh2.Py()*meson.Py()+ daugh2.Pz()*meson.Pz()) / sqrt(momentumSquaredMother);
+    momentumDaughter1AlongMother = (fPhotonMom1.Px()*fPi0Mom.Px() + fPhotonMom1.Py()*fPi0Mom.Py()+ fPhotonMom1.Pz()*fPi0Mom.Pz()) / sqrt(momentumSquaredMother);
+    momentumDaughter2AlongMother = (fPhotonMom2.Px()*fPi0Mom.Px() + fPhotonMom2.Py()*fPi0Mom.Py()+ fPhotonMom2.Pz()*fPi0Mom.Pz()) / sqrt(momentumSquaredMother);
   }
   
-  Float_t momentumSquaredDaughter1 = daugh1.P()*daugh1.P();
+  Float_t momentumSquaredDaughter1 = fPhotonMom1.P()*fPhotonMom1.P();
   Float_t ptArmSquared = momentumSquaredDaughter1 - momentumDaughter1AlongMother*momentumDaughter1AlongMother;
   
   Float_t pTArm = 0.;
@@ -1625,14 +1625,14 @@ void AliAnaPi0::FillArmenterosThetaStar(Int_t pdg,             TLorentzVector me
     pTArm = sqrt(ptArmSquared);
   
   Float_t alphaArm = 0.;
-  if(momentumDaughter1AlongMother +momentumDaughter2AlongMother > 0)
+  if(momentumDaughter1AlongMother + momentumDaughter2AlongMother > 0)
     alphaArm = (momentumDaughter1AlongMother -momentumDaughter2AlongMother) / (momentumDaughter1AlongMother + momentumDaughter2AlongMother);
   
-  TLorentzVector daugh1Boost = daugh1;
-  daugh1Boost.Boost(-meson.BoostVector());
-  Float_t  cosThStar=TMath::Cos(daugh1Boost.Vect().Angle(meson.Vect()));
+  fPhotonMom1Boost = fPhotonMom1;
+  fPhotonMom1Boost.Boost(-fPi0Mom.BoostVector());
+  Float_t  cosThStar=TMath::Cos(fPhotonMom1Boost.Vect().Angle(fPi0Mom.Vect()));
   
-  Float_t en   = meson.Energy();
+  Float_t en   = fPi0Mom.Energy();
   Int_t   ebin = -1;
   if(en > 8  && en <= 12) ebin = 0;
   if(en > 12 && en <= 16) ebin = 1;
@@ -1652,14 +1652,14 @@ void AliAnaPi0::FillArmenterosThetaStar(Int_t pdg,             TLorentzVector me
     fhArmPrimEta[ebin]->Fill(alphaArm,pTArm);
   }
   
-  if(GetDebug() > 2 )
-  {
-    Float_t asym = 0;
-    if(daugh1.E()+daugh2.E() > 0) asym = TMath::Abs(daugh1.E()-daugh2.E())/(daugh1.E()+daugh2.E());
-
-    printf("AliAnaPi0::FillArmenterosThetaStar() - E %f, alphaArm %f, pTArm %f, cos(theta*) %f, asymmetry %1.3f\n",
-         en,alphaArm,pTArm,cosThStar,asym);
-  }
+  //  if(GetDebug() > 2 )
+  //  {
+  //    Float_t asym = 0;
+  //    if(fPhotonMom1.E()+fPhotonMom2.E() > 0) asym = TMath::Abs(fPhotonMom1.E()-fPhotonMom2.E())/(fPhotonMom1.E()+fPhotonMom2.E());
+  //
+  //    printf("AliAnaPi0::FillArmenterosThetaStar() - E %f, alphaArm %f, pTArm %f, cos(theta*) %f, asymmetry %1.3f\n",
+  //         en,alphaArm,pTArm,cosThStar,asym);
+  //  }
 }
 
 //_______________________________________________________________________________________
@@ -1676,26 +1676,21 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
   
   Int_t ancPDG    = 0;
   Int_t ancStatus = 0;
-  TLorentzVector ancMomentum;
-  TVector3 prodVertex;
   Int_t ancLabel  = GetMCAnalysisUtils()->CheckCommonAncestor(index1, index2,
-                                                              GetReader(), ancPDG, ancStatus,ancMomentum, prodVertex);
+                                                              GetReader(), ancPDG, ancStatus,fPi0Mom, fProdVertex);
   
   Int_t momindex  = -1;
   Int_t mompdg    = -1;
   Int_t momstatus = -1;
-  if(GetDebug() > 1 )
-  {
-    if(ancLabel >= 0) printf("AliAnaPi0::FillMCVersusRecDataHistograms() - Common ancestor label %d, pdg %d, name %s, status %d; \n",
-                             ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
-    else              printf("AliAnaPi0::FillMCVersusRecDataHistograms() - Common ancestor not found \n");
-  }
   
   Float_t prodR = -1;
   Int_t mcIndex = -1;
   
   if(ancLabel > -1)
   {
+    AliDebug(1,Form("Common ancestor label %d, pdg %d, name %s, status %d",
+                    ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus));
+    
     if(ancPDG==22)
     {//gamma
       mcIndex = 0;
@@ -1721,8 +1716,8 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
                  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell])
               {
                 fhMCPi0MassPtRec [index]->Fill(pt,mass);
-                fhMCPi0MassPtTrue[index]->Fill(ancMomentum.Pt(),mass);
-                if(mass < 0.17 && mass > 0.1) fhMCPi0PtTruePtRec[index]->Fill(ancMomentum.Pt(),pt);
+                fhMCPi0MassPtTrue[index]->Fill(fPi0Mom.Pt(),mass);
+                if(mass < 0.17 && mass > 0.1) fhMCPi0PtTruePtRec[index]->Fill(fPi0Mom.Pt(),pt);
               }//pass the different cuts
             }// pid bit cut loop
           }// icell loop
@@ -1730,11 +1725,11 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
       }//Multi cut ana sim
       else
       {
-        fhMCPi0MassPtTrue[0]->Fill(ancMomentum.Pt(),mass);
+        fhMCPi0MassPtTrue[0]->Fill(fPi0Mom.Pt(),mass);
         
         if(mass < 0.17 && mass > 0.1)
         {
-          fhMCPi0PtTruePtRec[0]->Fill(ancMomentum.Pt(),pt);
+          fhMCPi0PtTruePtRec[0]->Fill(fPi0Mom.Pt(),pt);
           
           //Int_t uniqueId = -1;
           if(GetReader()->ReadStack())
@@ -1799,8 +1794,8 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
                  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell])
               {
                 fhMCEtaMassPtRec [index]->Fill(pt,mass);
-                fhMCEtaMassPtTrue[index]->Fill(ancMomentum.Pt(),mass);
-                if(mass < 0.65 && mass > 0.45) fhMCEtaPtTruePtRec[index]->Fill(ancMomentum.Pt(),pt);
+                fhMCEtaMassPtTrue[index]->Fill(fPi0Mom.Pt(),mass);
+                if(mass < 0.65 && mass > 0.45) fhMCEtaPtTruePtRec[index]->Fill(fPi0Mom.Pt(),pt);
               }//pass the different cuts
             }// pid bit cut loop
           }// icell loop
@@ -1808,8 +1803,8 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
       } //Multi cut ana sim
       else
       {
-        fhMCEtaMassPtTrue[0]->Fill(ancMomentum.Pt(),mass);
-        if(mass < 0.65 && mass > 0.45) fhMCEtaPtTruePtRec[0]->Fill(ancMomentum.Pt(),pt);
+        fhMCEtaMassPtTrue[0]->Fill(fPi0Mom.Pt(),mass);
+        if(mass < 0.65 && mass > 0.45) fhMCEtaPtTruePtRec[0]->Fill(fPi0Mom.Pt(),pt);
         
         if(GetReader()->ReadStack())
         {
@@ -1895,12 +1890,15 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(Int_t index1,  Int_t index2,
       // }
     }////Partons, colliding protons, strings, intermediate corrections
   }//ancLabel > -1
-  else { //ancLabel <= -1
+  else
+  { //ancLabel <= -1
     //printf("Not related at all label = %d\n",ancLabel);
+    AliDebug(1,"Common ancestor not found");
+    
     mcIndex = 12;
   }
   
-  if(mcIndex >=0 && mcIndex < 13)
+  if(mcIndex >= 0 && mcIndex < 13)
   {
     fhMCOrgMass[mcIndex]->Fill(pt,mass);
     fhMCOrgAsym[mcIndex]->Fill(pt,asym);
@@ -1919,26 +1917,24 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   //In case of simulated data, fill acceptance histograms
   if(IsDataMC())FillAcceptanceHistograms();
   
-  //if (GetReader()->GetEventNumber()%10000 == 0) 
+  //if (GetReader()->GetEventNumber()%10000 == 0)
   // printf("--- Event %d ---\n",GetReader()->GetEventNumber());
   
   if(!GetInputAODBranch())
   {
-    printf("AliAnaPi0::MakeAnalysisFillHistograms() - No input aod photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
-    abort();
+    AliFatal(Form("No input aod photons in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
+    return;
   }
   
   //Init some variables
   Int_t   nPhot    = GetInputAODBranch()->GetEntriesFast() ;
   
-  if(GetDebug() > 1) 
-    printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot);
+  AliDebug(1,Form("Photon entries %d", nPhot));
   
   //If less than photon 2 entries in the list, skip this event
-  if(nPhot < 2 )
+  if ( nPhot < 2 )
   {
-    if(GetDebug() > 2)
-      printf("AliAnaPi0::MakeAnalysisFillHistograms() - nPhotons %d, cent bin %d continue to next event\n",nPhot, GetEventCentrality());
+    AliDebug(1,Form("nPhotons %d, cent bin %d continue to next event",nPhot, GetEventCentrality()));
     
     if(GetNCentrBin() > 1) fhCentralityNoPair->Fill(GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt());
     
@@ -1951,9 +1947,9 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   //Init variables
   Int_t module1         = -1;
   Int_t module2         = -1;
-  Double_t vert[]       = {0.0, 0.0, 0.0} ; //vertex 
-  Int_t evtIndex1       = 0 ; 
-  Int_t currentEvtIndex = -1; 
+  Double_t vert[]       = {0.0, 0.0, 0.0} ; //vertex
+  Int_t evtIndex1       = 0 ;
+  Int_t currentEvtIndex = -1;
   Int_t curCentrBin     = GetEventCentralityBin();
   //Int_t curVzBin        = GetEventVzBin();
   //Int_t curRPBin        = GetEventRPBin();
@@ -1961,14 +1957,15 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   
   if(eventbin > GetNCentrBin()*GetNZvertBin()*GetNRPBin())
   {
-     printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mix Bin not exepcted: cen bin %d, z bin %d, rp bin %d, total bin %d, Event Centrality %d, z vertex %2.3f, Reaction Plane %2.3f\n",GetEventCentralityBin(),GetEventVzBin(), GetEventRPBin(),eventbin,GetEventCentrality(),vert[2],GetEventPlaneAngle());
+    AliWarning(Form("Mix Bin not expected: cen bin %d, z bin %d, rp bin %d, total bin %d, Event Centrality %d, z vertex %2.3f, Reaction Plane %2.3f",
+                    GetEventCentralityBin(),GetEventVzBin(), GetEventRPBin(),eventbin,GetEventCentrality(),vert[2],GetEventPlaneAngle()));
     return;
   }
-    
+  
   //Get shower shape information of clusters
   TObjArray *clusters = 0;
-  if     (GetCalorimeter()=="EMCAL") clusters = GetEMCALClusters();
-  else if(GetCalorimeter()=="PHOS" ) clusters = GetPHOSClusters() ;
+  if     (GetCalorimeter()==kEMCAL) clusters = GetEMCALClusters();
+  else if(GetCalorimeter()==kPHOS ) clusters = GetPHOSClusters() ;
   
   //---------------------------------
   //First loop on photons/clusters
@@ -1978,33 +1975,33 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
     //printf("AliAnaPi0::MakeAnalysisFillHistograms() : cluster1 id %d/%d\n",i1,nPhot-1);
     
-    // get the event index in the mixed buffer where the photon comes from 
+    // get the event index in the mixed buffer where the photon comes from
     // in case of mixing with analysis frame, not own mixing
     evtIndex1 = GetEventIndex(p1, vert) ;
     if ( evtIndex1 == -1 )
-      return ; 
+      return ;
     if ( evtIndex1 == -2 )
-      continue ; 
-
+      continue ;
+    
     // Only effective in case of mixed event frame
     if(TMath::Abs(vert[2]) > GetZvertexCut()) continue ;   //vertex cut
     
-    if (evtIndex1 != currentEvtIndex) 
+    if (evtIndex1 != currentEvtIndex)
     {
       //Fill event bin info
       if(DoOwnMix()) fhEventBin->Fill(eventbin) ;
-      if(GetNCentrBin() > 1) 
+      if(GetNCentrBin() > 1)
       {
         fhCentrality->Fill(curCentrBin);
         if(GetNRPBin() > 1 && GetEventPlane()) fhEventPlaneResolution->Fill(curCentrBin,TMath::Cos(2.*GetEventPlane()->GetQsubRes()));
       }
-      currentEvtIndex = evtIndex1 ; 
+      currentEvtIndex = evtIndex1 ;
     }
     
     //printf("AliAnaPi0::MakeAnalysisFillHistograms(): Photon 1 Evt %d  Vertex : %f,%f,%f\n",evtIndex1, GetVertex(evtIndex1)[0] ,GetVertex(evtIndex1)[1],GetVertex(evtIndex1)[2]);
     
     //Get the momentum of this cluster
-    TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
+    fPhotonMom1.SetPxPyPzE(p1->Px(),p1->Py(),p1->Pz(),p1->E());
     
     //Get (Super)Module number of this cluster
     module1 = GetModuleNumber(p1);
@@ -2013,8 +2010,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     // Recover original cluster
     Int_t iclus1 = -1 ;
     AliVCluster * cluster1 = FindCluster(clusters,p1->GetCaloLabel(0),iclus1);
-    if(!cluster1) printf("AliAnaPi0 - Cluster1 not found!\n");
-
+    if(!cluster1) AliWarning("Cluster1 not found!");
+    
     //---------------------------------
     //Second loop on photons/clusters
     //---------------------------------
@@ -2022,13 +2019,13 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     {
       AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ;
       //printf("AliAnaPi0::MakeAnalysisFillHistograms() : cluster2 i %d/%d\n",i2,nPhot);
-
+      
       //In case of mixing frame, check we are not in the same event as the first cluster
-      Int_t evtIndex2 = GetEventIndex(p2, vert) ; 
+      Int_t evtIndex2 = GetEventIndex(p2, vert) ;
       if ( evtIndex2 == -1 )
-        return ; 
+        return ;
       if ( evtIndex2 == -2 )
-        continue ;    
+        continue ;
       if (GetMixedEvent() && (evtIndex1 == evtIndex2))
         continue ;
       
@@ -2037,8 +2034,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       Int_t iclus2 = -1;
       AliVCluster * cluster2 = FindCluster(clusters,p2->GetCaloLabel(0),iclus2,iclus1+1);
       // start new loop from iclus1+1 to gain some time
-      if(!cluster2) printf("AliAnaPi0 - Cluster2 not found!\n");
-
+      if(!cluster2) AliWarning("Cluster2 not found!");
+      
       // Get the TOF,l0 and ncells from the clusters
       Float_t tof1  = -1;
       Float_t l01   = -1;
@@ -2076,38 +2073,36 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       //printf("AliAnaPi0::MakeAnalysisFillHistograms(): Photon 2 Evt %d  Vertex : %f,%f,%f\n",evtIndex2, GetVertex(evtIndex2)[0] ,GetVertex(evtIndex2)[1],GetVertex(evtIndex2)[2]);
       
       //Get the momentum of this cluster
-      TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
+      fPhotonMom2.SetPxPyPzE(p2->Px(),p2->Py(),p2->Pz(),p2->E());
+      
       //Get module number
       module2       = GetModuleNumber(p2);
       
       //---------------------------------
       // Get pair kinematics
       //---------------------------------
-      Double_t m    = (photon1 + photon2).M() ;
-      Double_t pt   = (photon1 + photon2).Pt();
-      Double_t deta = photon1.Eta() - photon2.Eta();
-      Double_t dphi = photon1.Phi() - photon2.Phi();
+      Double_t m    = (fPhotonMom1 + fPhotonMom2).M() ;
+      Double_t pt   = (fPhotonMom1 + fPhotonMom2).Pt();
+      Double_t deta = fPhotonMom1.Eta() - fPhotonMom2.Eta();
+      Double_t dphi = fPhotonMom1.Phi() - fPhotonMom2.Phi();
       Double_t a    = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
       
-      if(GetDebug() > 2)
-        printf(" E: photon1 %f, photon2 %f; Pair: pT %f, mass %f, a %f\n", p1->E(), p2->E(), (photon1 + photon2).E(),m,a);
+      AliDebug(2,Form("E: fPhotonMom1 %f, fPhotonMom2 %f; Pair: pT %f, mass %f, a %f", p1->E(), p2->E(), (fPhotonMom1 + fPhotonMom2).E(),m,a));
       
       //--------------------------------
       // Opening angle selection
       //--------------------------------
-      //Check if opening angle is too large or too small compared to what is expected  
-      Double_t angle   = photon1.Angle(photon2.Vect());
-      if(fUseAngleEDepCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle+0.05))
+      //Check if opening angle is too large or too small compared to what is expected
+      Double_t angle   = fPhotonMom1.Angle(fPhotonMom2.Vect());
+      if(fUseAngleEDepCut && !GetNeutralMesonSelection()->IsAngleInWindow((fPhotonMom1+fPhotonMom2).E(),angle+0.05))
       {
-        if(GetDebug() > 2)
-          printf("AliAnaPi0::MakeAnalysisFillHistograms() -Real pair angle %f not in E %f window\n",angle, (photon1+photon2).E());
+        AliDebug(2,Form("Real pair angle %f not in E %f window",angle, (fPhotonMom1+fPhotonMom2).E()));
         continue;
       }
       
       if(fUseAngleCut && (angle < fAngleCut || angle > fAngleMaxCut))
       {
-        if(GetDebug() > 2)
-          printf("AliAnaPi0::MakeAnalysisFillHistograms() - Real pair cut %f < angle %f < cut %f\n",fAngleCut, angle, fAngleMaxCut);
+        AliDebug(2,Form("Real pair cut %f < angle %f < cut %f",fAngleCut, angle, fAngleMaxCut));
         continue;
       }
       
@@ -2119,7 +2114,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         if(module1==module2 && module1 >=0 && module1<fNModules)
           fhReMod[module1]->Fill(pt,m) ;
         
-        if(GetCalorimeter()=="EMCAL")
+        if(GetCalorimeter()==kEMCAL)
         {
           // Same sector
           Int_t j=0;
@@ -2131,12 +2126,12 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
           
           // Same side
           for(Int_t i = 0; i < fNModules-2; i++){
-            if((module1==i && module2==i+2) || (module1==i+2 && module2==i)) fhReSameSideEMCALMod[i]->Fill(pt,m); 
+            if((module1==i && module2==i+2) || (module1==i+2 && module2==i)) fhReSameSideEMCALMod[i]->Fill(pt,m);
           }
         }//EMCAL
         else {//PHOS
-          if((module1==0 && module2==1) || (module1==1 && module2==0)) fhReDiffPHOSMod[0]->Fill(pt,m) ; 
-          if((module1==0 && module2==2) || (module1==2 && module2==0)) fhReDiffPHOSMod[1]->Fill(pt,m) ; 
+          if((module1==0 && module2==1) || (module1==1 && module2==0)) fhReDiffPHOSMod[0]->Fill(pt,m) ;
+          if((module1==0 && module2==2) || (module1==2 && module2==0)) fhReDiffPHOSMod[1]->Fill(pt,m) ;
           if((module1==1 && module2==2) || (module1==2 && module2==1)) fhReDiffPHOSMod[2]->Fill(pt,m) ;
         }//PHOS
       }
@@ -2146,7 +2141,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       if(fSameSM && module1!=module2) ok=kFALSE;
       if(ok)
       {
-        //Check if one of the clusters comes from a conversion 
+        //Check if one of the clusters comes from a conversion
         if(fCheckConversion)
         {
           if     (p1->IsTagged() && p2->IsTagged()) fhReConv2->Fill(pt,m);
@@ -2156,8 +2151,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         // Fill shower shape cut histograms
         if(fFillSSCombinations)
         {
-          if     ( l01 > 0.01 && l01 < 0.4  && 
-                   l02 > 0.01 && l02 < 0.4 )               fhReSS[0]->Fill(pt,m); // Tight
+          if     ( l01 > 0.01 && l01 < 0.4  &&
+                  l02 > 0.01 && l02 < 0.4 )               fhReSS[0]->Fill(pt,m); // Tight
           else if( l01 > 0.4  && l02 > 0.4 )               fhReSS[1]->Fill(pt,m); // Loose
           else if( l01 > 0.01 && l01 < 0.4  && l02 > 0.4 ) fhReSS[2]->Fill(pt,m); // Both
           else if( l02 > 0.01 && l02 < 0.4  && l01 > 0.4 ) fhReSS[2]->Fill(pt,m); // Both
@@ -2174,7 +2169,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
               {
                 Int_t index = ((curCentrBin*fNPIDBits)+ipid)*fNAsymCuts + iasym;
                 //printf("index %d :(cen %d * nPID %d + ipid %d)*nasym %d + iasym %d - max index %d\n",index,curCentrBin,fNPIDBits,ipid,fNAsymCuts,iasym, curCentrBin*fNPIDBits*fNAsymCuts);
-               
+                
                 if(index < 0 || index >= ncentr*fNPIDBits*fNAsymCuts) continue ;
                 
                 fhRe1     [index]->Fill(pt,m);
@@ -2218,12 +2213,12 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         //Do some MC checks on the origin of the pair, is there any common ancestor and if there is one, who?
         if(IsDataMC())
         {
-          if(GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) && 
+          if(GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) &&
              GetMCAnalysisUtils()->CheckTagBit(p2->GetTag(),AliMCAnalysisUtils::kMCConversion))
           {
             fhReMCFromConversion->Fill(pt,m);
           }
-          else if(!GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) && 
+          else if(!GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) &&
                   !GetMCAnalysisUtils()->CheckTagBit(p2->GetTag(),AliMCAnalysisUtils::kMCConversion))
           {
             fhReMCFromNotConversion->Fill(pt,m);
@@ -2245,7 +2240,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
           //Histograms for different PID bits selection
           for(Int_t ipid=0; ipid<fNPIDBits; ipid++)
           {
-            if(p1->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton)    && 
+            if(p1->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton)    &&
                p2->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton))   fhRePIDBits[ipid]->Fill(pt,m) ;
             
             //printf("ipt %d, ipid%d, name %s\n",ipt, ipid, fhRePtPIDCuts[ipt*fNPIDBitsBits+ipid]->GetName());
@@ -2259,7 +2254,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
               for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
               {
                 Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
-                if(p1->E() >   fPtCuts[ipt]      && p2->E() > fPtCuts[ipt]        && 
+                if(p1->E() >   fPtCuts[ipt]      && p2->E() > fPtCuts[ipt]        &&
                    a        <   fAsymCuts[iasym]                                  &&
                    ncell1   >=  fCellNCuts[icell] && ncell2   >= fCellNCuts[icell])
                 {
@@ -2302,25 +2297,23 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     
     if(!evMixList)
     {
-      printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mix event list not available, bin %d \n",eventbin);
+      AliWarning(Form("Mix event list not available, bin %d",eventbin));
       return;
     }
     
     Int_t nMixed = evMixList->GetSize() ;
     for(Int_t ii=0; ii<nMixed; ii++)
-    {  
+    {
       TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
       Int_t nPhot2=ev2->GetEntriesFast() ;
       Double_t m = -999;
-      if(GetDebug() > 1) 
-        printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d, centrality bin %d\n",
-               ii, nPhot2, GetEventCentralityBin());
-
+      AliDebug(1,Form("Mixed event %d photon entries %d, centrality bin %d",ii, nPhot2, GetEventCentralityBin()));
+      
       fhEventMixBin->Fill(eventbin) ;
-
+      
       //---------------------------------
       //First loop on photons/clusters
-      //---------------------------------      
+      //---------------------------------
       for(Int_t i1=0; i1<nPhot; i1++)
       {
         AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
@@ -2328,53 +2321,49 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         if(fSameSM && GetModuleNumber(p1)!=module1) continue;
         
         //Get kinematics of cluster and (super) module of this cluster
-        TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
+        fPhotonMom1.SetPxPyPzE(p1->Px(),p1->Py(),p1->Pz(),p1->E());
         module1 = GetModuleNumber(p1);
         
         //---------------------------------
         //First loop on photons/clusters
-        //---------------------------------        
+        //---------------------------------
         for(Int_t i2=0; i2<nPhot2; i2++)
         {
           AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ;
           
           //Get kinematics of second cluster and calculate those of the pair
-          TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
-          m           = (photon1+photon2).M() ; 
-          Double_t pt = (photon1 + photon2).Pt();
+          fPhotonMom2.SetPxPyPzE(p2->Px(),p2->Py(),p2->Pz(),p2->E());
+          m           = (fPhotonMom1+fPhotonMom2).M() ;
+          Double_t pt = (fPhotonMom1 + fPhotonMom2).Pt();
           Double_t a  = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
           
           //Check if opening angle is too large or too small compared to what is expected
-          Double_t angle   = photon1.Angle(photon2.Vect());
-          if(fUseAngleEDepCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle+0.05))
+          Double_t angle   = fPhotonMom1.Angle(fPhotonMom2.Vect());
+          if(fUseAngleEDepCut && !GetNeutralMesonSelection()->IsAngleInWindow((fPhotonMom1+fPhotonMom2).E(),angle+0.05))
           {
-            if(GetDebug() > 2)
-              printf("AliAnaPi0::MakeAnalysisFillHistograms() -Mix pair angle %f not in E %f window\n",angle, (photon1+photon2).E());
+            AliDebug(2,Form("Mix pair angle %f not in E %f window",angle, (fPhotonMom1+fPhotonMom2).E()));
             continue;
           }
           
           if(fUseAngleCut && (angle < fAngleCut || angle > fAngleMaxCut))
           {
-            if(GetDebug() > 2)
-              printf("AliAnaPi0::MakeAnalysisFillHistograms() -Mix pair angle %f < cut %f\n",angle,fAngleCut);
+            AliDebug(2,Form("Mix pair angle %f < cut %f",angle,fAngleCut));
             continue;
-          } 
+          }
           
-          if(GetDebug() > 2)
-            printf("AliAnaPi0::MakeAnalysisFillHistograms() - 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);        
+          AliDebug(2,Form("Mixed Event: pT: fPhotonMom1 %2.2f, fPhotonMom2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %2.3f",p1->Pt(), p2->Pt(), pt,m,a));
           
           //In case we want only pairs in same (super) module, check their origin.
           module2 = GetModuleNumber(p2);
           
           //-------------------------------------------------------------------------------------------------
           //Fill module dependent histograms, put a cut on assymmetry on the first available cut in the array
-          //-------------------------------------------------------------------------------------------------          
+          //-------------------------------------------------------------------------------------------------
           if(a < fAsymCuts[0] && fFillSMCombinations){
             if(module1==module2 && module1 >=0 && module1<fNModules)
               fhMiMod[module1]->Fill(pt,m) ;
             
-            if(GetCalorimeter()=="EMCAL")
+            if(GetCalorimeter()==kEMCAL)
             {
               // Same sector
               Int_t j=0;
@@ -2387,13 +2376,13 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
               // Same side
               for(Int_t i = 0; i < fNModules-2; i++)
               {
-                if((module1==i && module2==i+2) || (module1==i+2 && module2==i)) fhMiSameSideEMCALMod[i]->Fill(pt,m); 
+                if((module1==i && module2==i+2) || (module1==i+2 && module2==i)) fhMiSameSideEMCALMod[i]->Fill(pt,m);
               }
             }//EMCAL
             else
             {//PHOS
-              if((module1==0 && module2==1) || (module1==1 && module2==0)) fhMiDiffPHOSMod[0]->Fill(pt,m) ; 
-              if((module1==0 && module2==2) || (module1==2 && module2==0)) fhMiDiffPHOSMod[1]->Fill(pt,m) ; 
+              if((module1==0 && module2==1) || (module1==1 && module2==0)) fhMiDiffPHOSMod[0]->Fill(pt,m) ;
+              if((module1==0 && module2==2) || (module1==2 && module2==0)) fhMiDiffPHOSMod[1]->Fill(pt,m) ;
               if((module1==1 && module2==2) || (module1==2 && module2==1)) fhMiDiffPHOSMod[2]->Fill(pt,m) ;
             }//PHOS
             
@@ -2404,7 +2393,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
           if(fSameSM && module1!=module2) ok=kFALSE;
           if(ok){
             
-            //Check if one of the clusters comes from a conversion 
+            //Check if one of the clusters comes from a conversion
             if(fCheckConversion)
             {
               if     (p1->IsTagged() && p2->IsTagged()) fhMiConv2->Fill(pt,m);
@@ -2422,7 +2411,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
                     Int_t index = ((curCentrBin*fNPIDBits)+ipid)*fNAsymCuts + iasym;
                     
                     if(index < 0 || index >= ncentr*fNPIDBits*fNAsymCuts) continue ;
-
+                    
                     fhMi1     [index]->Fill(pt,m) ;
                     
                     if(fMakeInvPtPlots)fhMiInvPt1[index]->Fill(pt,m,1./pt) ;
@@ -2446,8 +2435,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
             }//loop for histograms
             
             //-----------------------
-            //Multi cuts analysis 
-            //-----------------------            
+            //Multi cuts analysis
+            //-----------------------
             if(fMultiCutAna){
               //Several pt,ncell and asymmetry cuts
               
@@ -2458,8 +2447,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
                   for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
                   {
                     Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
-                    if(p1->Pt() >   fPtCuts[ipt]      && p2->Pt() > fPtCuts[ipt]        && 
-                       a        <   fAsymCuts[iasym]                                    //&& 
+                    if(p1->Pt() >   fPtCuts[ipt]      && p2->Pt() > fPtCuts[ipt]        &&
+                       a        <   fAsymCuts[iasym]                                    //&&
                        //p1->GetBtag() >=  fCellNCuts[icell] && p2->GetBtag() >= fCellNCuts[icell] // trick, correct it.
                        )
                     {
@@ -2488,7 +2477,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     //--------------------------------------------------------
     
     TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch());
-    //Add current event to buffer and Remove redundant events 
+    //Add current event to buffer and Remove redundant events
     if( currentEvent->GetEntriesFast() > 0 )
     {
       evMixList->AddFirst(currentEvent) ;
@@ -2499,31 +2488,31 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         evMixList->RemoveLast() ;
         delete tmp ;
       }
-    } 
+    }
     else
     { //empty event
       delete currentEvent ;
-      currentEvent=0 ; 
+      currentEvent=0 ;
     }
   }// DoOwnMix
-  if(GetDebug() > 0) printf("AliAnaPi0::MakeAnalysisFillHistograms() - End fill histograms\n");
+  
+  AliDebug(1,"End fill histograms");
 }
 
 //________________________________________________________________________
-Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)  
+Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)
 {
   // retieves the event index and checks the vertex
   //    in the mixed buffer returns -2 if vertex NOK
   //    for normal events   returns 0 if vertex OK and -1 if vertex NOK
   
-  Int_t evtIndex = -1 ; 
+  Int_t evtIndex = -1 ;
   if(GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
   {
     if (GetMixedEvent())
     {
       evtIndex = GetMixedEvent()->EventIndexForCaloCluster(part->GetCaloLabel(0)) ;
-      GetVertex(vert,evtIndex); 
+      GetVertex(vert,evtIndex);
       
       if(TMath::Abs(vert[2])> GetZvertexCut())
         evtIndex = -2 ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
@@ -2535,7 +2524,7 @@ Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)
       
       if(TMath::Abs(vert[2])> GetZvertexCut())
         evtIndex = -1 ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
-      else 
+      else
         evtIndex = 0 ;
     }
   }//No MC reader
index 30360d9d8a35d66450b6b70ab300f1cad657d94b..9e17c54dce021a629201451efe1a3d57f8e6f521 100755 (executable)
@@ -130,8 +130,7 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
                                              Double_t mass,    Double_t pt,     Double_t asym,
                                              Double_t deta,    Double_t dphi);
   
-  void         FillArmenterosThetaStar(Int_t pdg,             TLorentzVector meson,
-                                       TLorentzVector daugh1, TLorentzVector daugh2);
+  void         FillArmenterosThetaStar(Int_t pdg);
 
   
   private:
@@ -171,6 +170,12 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   
   Bool_t   fCheckAccInSector;          // Check that the decay pi0 falls in the same SM or sector
   
+  TLorentzVector fPhotonMom1;          //! photon cluster momentum
+  TLorentzVector fPhotonMom1Boost;     //! photon cluster momentum
+  TLorentzVector fPhotonMom2;          //! photon cluster momentum
+  TLorentzVector fPi0Mom;              //! pi0 cluster momentum
+  TVector3       fProdVertex;          //! production vertex
+  
   //Histograms
   
   //Event characterization
@@ -320,7 +325,7 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   AliAnaPi0(              const AliAnaPi0 & api0) ; // cpy ctor
   AliAnaPi0 & operator = (const AliAnaPi0 & api0) ; // cpy assignment
   
-  ClassDef(AliAnaPi0,28)
+  ClassDef(AliAnaPi0,29)
 } ;
 
 
index 100dfcbd3bdb334aa7f50e288883c7bd117bdb48..bc8c7e803bf4b7bd3a92caae8080cf4aadf94bdd 100755 (executable)
@@ -54,12 +54,15 @@ fMinDist(0.),fMinDist2(0.),         fMinDist3(0.),
 fNLMCutMin(-1),                     fNLMCutMax(10),
 fTimeCutMin(-10000),                fTimeCutMax(10000),
 fRejectTrackMatch(kTRUE),           fSelectIsolatedDecay(kFALSE),
+fCheckSplitDistToBad(0),            fSelectPairInIsoCone(0),
+fR(0),                              fIsoCandMinPt(0),
 fFillWeightHistograms(kFALSE),      fFillTMHisto(0),
 fFillSelectClHisto(0),              fFillOnlySimpleSSHisto(1),
 fFillEMCALBCHistograms(0),
 fFillAllNLMHistograms(0),
 fInputAODGammaConvName(""),
-fCheckSplitDistToBad(0),
+fMomentum(),  fMomentum1(),  fMomentum2(),
+fMomentum12(),fPrimaryMom(), fGrandMotherMom(),
 // Histograms
 fhPt(0),                            fhE(0),
 fhPtEta(0),                         fhPtPhi(0),                         fhEtaPhi(0),
@@ -71,7 +74,8 @@ fhPtCentrality(),                   fhPtEventPlane(0),                  fhMCPtCe
 fhPtReject(0),                      fhEReject(0),
 fhPtEtaReject(0),                   fhPtPhiReject(0),                   fhEtaPhiReject(0),
 fhMass(0),                          fhMassPt(0),                        fhMassSplitPt(0),
-fhSelectedMass(),                   fhSelectedMassPt(0),                fhSelectedMassSplitPt(0),
+fhSelectedMass(0),                  fhSelectedMassPt(0),                fhSelectedMassSplitPt(0),
+fhMassPtIsoRCut(0),
 fhMassNoOverlap(0),                 fhMassPtNoOverlap(0),               fhMassSplitPtNoOverlap(0),
 fhSelectedMassNoOverlap(0),         fhSelectedMassPtNoOverlap(0),       fhSelectedMassSplitPtNoOverlap(0),
 fhMCPi0PtRecoPtPrim(0),                       fhMCEtaPtRecoPtPrim(0),
@@ -87,6 +91,7 @@ fhSplitE(0),                        fhSplitPt(0),
 fhSplitPtEta(0),                    fhSplitPtPhi(0),
 fhNLocMaxSplitPt(0),
 fhPtDecay(0),
+
 // Shower shape histos
 fhPtDispersion(0),                  fhPtLambda0(0),                     fhPtLambda0NoSplitCut(0),
 fhPtLambda1(0),                     fhPtLambda0NoTRD(0),                fhPtLambda0FracMaxCellCut(0),
@@ -269,8 +274,7 @@ void AliAnaPi0EbE::FillEMCALBCHistograms(Float_t energy, Float_t eta, Float_t ph
   if( id < 0 ) return;
 
   Int_t bc = GetReader()->GetTriggerClusterBC();
-  if(TMath::Abs(bc) >= 6)
-    Info("FillEMCALBCHistograms","Trigger BC not expected = %d\n",bc);
+  if(TMath::Abs(bc) >= 6) AliInfo(Form("Trigger BC not expected = %d",bc));
   
   if(phi < 0) phi+=TMath::TwoPi();
   
@@ -332,7 +336,7 @@ void AliAnaPi0EbE::FillPileUpHistograms(Float_t pt, Float_t time, AliVCluster *
   // cells in cluster
   
   AliVCaloCells* cells = 0;
-  if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
+  if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
   else                        cells = GetPHOSCells();
 
   Float_t maxCellFraction = 0.;
@@ -482,15 +486,15 @@ void AliAnaPi0EbE::FillPileUpHistograms(Float_t pt, Float_t time, AliVCluster *
 
 
 //______________________________________________________________________________________________
-void AliAnaPi0EbE::FillRejectedClusterHistograms(TLorentzVector mom, Int_t mctag, Int_t nMaxima)
+void AliAnaPi0EbE::FillRejectedClusterHistograms(Int_t mctag, Int_t nMaxima)
 {
   // Fill histograms that do not pass the identification (SS case only)
   
-  Float_t ener  = mom.E();
-  Float_t pt    = mom.Pt();
-  Float_t phi   = mom.Phi();
+  Float_t ener  = fMomentum.E();
+  Float_t pt    = fMomentum.Pt();
+  Float_t phi   = fMomentum.Phi();
   if(phi < 0) phi+=TMath::TwoPi();
-  Float_t eta = mom.Eta();
+  Float_t eta = fMomentum.Eta();
 
   fhPtReject     ->Fill(pt);
   fhEReject      ->Fill(ener);
@@ -558,7 +562,7 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, Float_t p
   AliVCaloCells * cell = 0x0;
   Float_t maxCellFraction = 0;
 
-  if(GetCalorimeter() == "EMCAL" && !fFillOnlySimpleSSHisto)
+  if(GetCalorimeter() == kEMCAL && !fFillOnlySimpleSSHisto)
   {
     cell = GetEMCALCells();
     
@@ -606,7 +610,7 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, Float_t p
   }
   
   
-  if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
+  if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
      GetModuleNumber(cluster) < GetFirstSMCoveredByTRD() )
   {
     fhPtLambda0NoTRD    ->Fill(pt, l0  );
@@ -670,7 +674,7 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, Float_t p
         fhEOverP->Fill(pt,  eOverp);
         
         // Change nSM for year > 2011 (< 4 in 2012-13, none after)
-        if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >= 0 &&
+        if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >= 0 &&
            GetModuleNumber(cluster) < GetFirstSMCoveredByTRD() )
           fhEOverPNoTRD->Fill(pt,  eOverp);
         
@@ -715,11 +719,11 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, Float_t p
     fhMCPtLambda1[mcIndex]    ->Fill(pt, l1);
     if(fFillAllNLMHistograms) fhMCPtLambda0LocMax[mcIndex][indexMax]->Fill(pt,l0);
 
-    if(GetCalorimeter()=="EMCAL" && GetFirstSMCoveredByTRD() >= 0 &&
+    if(GetCalorimeter()==kEMCAL && GetFirstSMCoveredByTRD() >= 0 &&
        GetModuleNumber(cluster) < GetFirstSMCoveredByTRD() )
       fhMCPtLambda0NoTRD[mcIndex]->Fill(pt, l0  );
     
-    if(GetCalorimeter() == "EMCAL" && !fFillOnlySimpleSSHisto)
+    if(GetCalorimeter() == kEMCAL && !fFillOnlySimpleSSHisto)
     {
       if(maxCellFraction < 0.5)
         fhMCPtLambda0FracMaxCellCut[mcIndex]->Fill(pt, l0  );
@@ -757,7 +761,7 @@ void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
   if(!fFillWeightHistograms || GetMixedEvent()) return;
   
   AliVCaloCells* cells = 0;
-  if(GetCalorimeter() == "EMCAL") cells = GetEMCALCells();
+  if(GetCalorimeter() == kEMCAL) cells = GetEMCALCells();
   else                        cells = GetPHOSCells();
   
   // First recalculate energy in case non linearity was applied
@@ -781,7 +785,7 @@ void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
   
   if(energy <=0 )
   {
-    printf("AliAnaPi0EbE::WeightHistograms()- Wrong calculated energy %f\n",energy);
+    AliInfo(Form("Wrong calculated energy %f",energy));
     return;
   }
   
@@ -802,7 +806,7 @@ void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
   }
   
   //Recalculate shower shape for different W0
-  if(GetCalorimeter()=="EMCAL"){
+  if(GetCalorimeter()==kEMCAL){
     
     Float_t l0org = clus->GetM02();
     Float_t l1org = clus->GetM20();
@@ -838,7 +842,7 @@ TObjString * AliAnaPi0EbE::GetAnalysisCuts()
   parList+=onePar ;
   snprintf(onePar,buffersize,"fAnaType=%d (selection type) \n",fAnaType) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeter().Data()) ;
+  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
   parList+=onePar ;
   snprintf(onePar,buffersize,"Local maxima in cluster: %d < nlm < %d;",fNLMCutMin,fNLMCutMax) ;
   parList+=onePar ;
@@ -959,7 +963,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   fhEtaPhi->SetXTitle("#eta");
   outputContainer->Add(fhEtaPhi) ;
   
-  if(GetCalorimeter()=="EMCAL" && fFillEMCALBCHistograms)
+  if(GetCalorimeter()==kEMCAL && fFillEMCALBCHistograms)
   {
     fhEtaPhiEMCALBC0  = new TH2F
     ("hEtaPhiEMCALBC0","cluster, #it{E} > 2 GeV, #eta vs #phi, for clusters with |#it{t}| < 25 ns, EMCAL-BC=0",netabins,etamin,etamax,nphibins,phimin,phimax);
@@ -1122,6 +1126,16 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   fhSelectedMassPt->SetXTitle("#it{p}_{T} (GeV/#it{c})");
   outputContainer->Add(fhSelectedMassPt) ;
   
+  if(fAnaType != kSSCalo && fSelectPairInIsoCone)
+  {
+    fhMassPtIsoRCut  = new TH2F
+    ("hMassPtIsoRCut",Form("#it{M}: #it{p}_{T} vs #it{M}, for R = %1.1f, #it{p}_{T,1} < %2.2f",fR,fIsoCandMinPt),
+     nptbins,ptmin,ptmax, nmassbins,massmin,massmax);
+    fhMassPtIsoRCut->SetYTitle("#it{M} (GeV/#it{c}^{2})");
+    fhMassPtIsoRCut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
+    outputContainer->Add(fhMassPtIsoRCut) ;
+  }
+  
   if(fAnaType == kSSCalo)
   {
     fhPtLambda0NoSplitCut  = new TH2F
@@ -1254,7 +1268,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
     fhPtLambda1->SetXTitle("#it{p}_{T} (GeV/#it{c})");
     outputContainer->Add(fhPtLambda1) ;
     
-    if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >=0 )
+    if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >=0 )
     {
       fhPtLambda0NoTRD  = new TH2F
       ("hPtLambda0NoTRD","Selected #pi^{0} (#eta) pairs: #it{p}_{T} vs #lambda_{0}, not behind TRD",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
@@ -1401,7 +1415,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
         fhPtLambda1LocMax[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
         outputContainer->Add(fhPtLambda1LocMax[i]) ;
         
-        if(GetCalorimeter() == "EMCAL" && !fFillOnlySimpleSSHisto)
+        if(GetCalorimeter() == kEMCAL && !fFillOnlySimpleSSHisto)
         {
           fhPtDispersionLocMax[i]  = new TH2F(Form("hPtDispersionLocMax%d",i+1),
                                               Form("Selected #pi^{0} (#eta) pairs: #it{p}_{T} vs dispersion^{2}, %s",nlm[i].Data()),
@@ -1580,7 +1594,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
     fhEOverP->SetYTitle("#it{E}/#it{p}");
     outputContainer->Add(fhEOverP);
     
-    if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >=0)
+    if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >=0)
     {
       fhEOverPNoTRD  = new TH2F ("hEOverPNoTRD","matched track E/p vs cluster E, SM not behind TRD ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
       fhEOverPNoTRD->SetXTitle("#it{E} (GeV)");
@@ -1941,7 +1955,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
         fhMCPtLambda1[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
         outputContainer->Add(fhMCPtLambda1[i]) ;
         
-        if(GetCalorimeter()=="EMCAL" &&  GetFirstSMCoveredByTRD() >= 0)
+        if(GetCalorimeter()==kEMCAL &&  GetFirstSMCoveredByTRD() >= 0)
         {
           fhMCPtLambda0NoTRD[i]  = new TH2F(Form("hELambda0NoTRD_MC%s",pname[i].Data()),
                                             Form("Selected pair, cluster from %s : #it{p}_{T} vs #lambda_{0}^{2}, NoTRD",ptype[i].Data()),
@@ -2616,24 +2630,18 @@ Int_t AliAnaPi0EbE::GetMCIndex(const Int_t tag)
 }
 
 //__________________________________________________________________
-void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
-                                       AliAODPWG4Particle * photon2,
+void AliAnaPi0EbE::HasPairSameMCMother(Int_t label1 , Int_t label2,
+                                       Int_t tag1   , Int_t tag2,
                                        Int_t & label, Int_t & tag)
 {
   // Check the labels of pair in case mother was same pi0 or eta
   // Set the new AOD accordingly
   
-  Int_t  label1 = photon1->GetLabel();
-  Int_t  label2 = photon2->GetLabel();
   
   if(label1 < 0 || label2 < 0 || label1 == label2) return ;
   
-  //Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader());
-  //Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader());
-  Int_t tag1 = photon1->GetTag();
-  Int_t tag2 = photon2->GetTag();
+  AliDebug(0,Form("Origin of: photon1 %d; photon2 %d",tag1, tag2));
   
-  if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
   if( (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) &&
        GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)    ) ||
       (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCEtaDecay) &&
@@ -2687,16 +2695,13 @@ void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
     {
       label = label1;
       
-      TLorentzVector mom1 = *(photon1->Momentum());
-      TLorentzVector mom2 = *(photon2->Momentum());
-      
-      Double_t angle = mom2.Angle(mom1.Vect());
-      Double_t mass  = (mom1+mom2).M();
-      Double_t epair = (mom1+mom2).E();
+      Double_t angle = fMomentum2.Angle(fMomentum1.Vect());
+      Double_t mass  = (fMomentum1+fMomentum2).M();
+      Double_t epair = (fMomentum1+fMomentum2).E();
       
       if(pdg1==111)
       {
-        //printf("Real pi0 pair: pt %f, mass %f\n",(mom1+mom2).Pt(),mass);
+        //printf("Real pi0 pair: pt %f, mass %f\n",(fMomentum1+fMomentum2).Pt(),mass);
         fhMassPairMCPi0 ->Fill(epair,mass);
         fhAnglePairMCPi0->Fill(epair,angle);
         GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0);
@@ -2725,14 +2730,11 @@ void AliAnaPi0EbE::Init()
 {
   //Init
   //Do some checks
-  if(GetCalorimeter() == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD()){
-    printf("AliAnaPi0EbE::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
-  else  if(GetCalorimeter() == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD()){
-    printf("AliAnaPi0EbE::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
-    abort();
-  }
+  
+  if       ( GetCalorimeter() == kPHOS  && !GetReader()->IsPHOSSwitchedOn()  && NewOutputAOD() )
+    AliFatal("STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!");
+  else  if ( GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD() )
+    AliFatal("STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!");
   
 }
 
@@ -2744,7 +2746,6 @@ void AliAnaPi0EbE::InitParameters()
   
   fInputAODGammaConvName = "PhotonsCTS" ;
   fAnaType = kIMCalo ;
-  GetCalorimeter() = "EMCAL" ;
   fMinDist  = 2.;
   fMinDist2 = 4.;
   fMinDist3 = 5.;
@@ -2752,6 +2753,10 @@ void AliAnaPi0EbE::InitParameters()
   fNLMECutMin[0] = 10.;
   fNLMECutMin[1] = 6. ;
   fNLMECutMin[2] = 6. ;
+  
+  fIsoCandMinPt = 8;
+  fR            = 0.4;
+  
 }
 
 //__________________________________________________________________
@@ -2759,7 +2764,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillAOD()
 {
   //Do analysis and fill aods
   
-  if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillAOD() - Start analysis type %d\n",fAnaType);
+  AliDebug(1,Form("Start analysis type %d",fAnaType));
   
   switch(fAnaType)
   {
@@ -2777,7 +2782,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillAOD()
       
   }
   
-  if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillAOD() - End\n");
+  AliDebug(1,"End");
 
 }
 
@@ -2789,20 +2794,16 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
   //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 ;
-  
   if(!GetInputAODBranch())
   {
-    AliFatal(Form("No input calo photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data()));
+    AliFatal(Form("No input calo photons in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
     return; // coverity
   }
   
   //Get shower shape information of clusters
   TObjArray *clusters = 0;
-  if     (GetCalorimeter()=="EMCAL") clusters = GetEMCALClusters();
-  else if(GetCalorimeter()=="PHOS")  clusters = GetPHOSClusters() ;
+  if     (GetCalorimeter()==kEMCAL) clusters = GetEMCALClusters();
+  else if(GetCalorimeter()==kPHOS)  clusters = GetPHOSClusters() ;
   
   Int_t nphoton = GetInputAODBranch()->GetEntriesFast();
   for(Int_t iphoton = 0; iphoton < nphoton-1; iphoton++)
@@ -2817,7 +2818,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       if(TMath::Abs(GetVertex(evtIndex1)[2]) > GetZvertexCut()) continue ;  //vertex cut
     }
     
-    mom1 = *(photon1->Momentum());
+    fMomentum1 = *(photon1->Momentum());
     
     //Get original cluster, to recover some information
     Int_t iclus = -1;
@@ -2825,7 +2826,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
     
     if(!cluster1)
     {
-      printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - First cluster not found\n");
+      AliWarning("First cluster not found");
       return;
     }
     
@@ -2854,7 +2855,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
         if(TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) continue ;  //vertex cut
       }
       
-      mom2 = *(photon2->Momentum());
+      fMomentum2 = *(photon2->Momentum());
       
       //Get original cluster, to recover some information
       Int_t iclus2 = -1;
@@ -2863,7 +2864,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       
       if(!cluster2)
       {
-        printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Second cluster not found\n");
+        AliWarning("Second cluster not found");
         return;
       }
       
@@ -2883,20 +2884,21 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       Int_t label   =-1;
       if(IsDataMC())
       {
-        HasPairSameMCMother(photon1, photon2, label, tag) ;
+        HasPairSameMCMother(photon1->GetLabel(), photon2->GetLabel(),
+                            photon1->GetTag()  , photon2->GetTag(),
+                            label, tag) ;
         mcIndex = GetMCIndex(tag);
       }
       
       // Check the invariant mass for different selection on the local maxima
-      // Name of AOD method TO BE FIXED
-      Int_t nMaxima1 = photon1->GetFiducialArea();
-      Int_t nMaxima2 = photon2->GetFiducialArea();
+      Int_t nMaxima1 = photon1->GetNLM();
+      Int_t nMaxima2 = photon2->GetNLM();
       
-      mom = mom1+mom2;
+      fMomentum = fMomentum1+fMomentum2;
       
-      Double_t mass  = mom.M();
-      Double_t epair = mom.E();
-      Float_t ptpair = mom.Pt();
+      Double_t mass  = fMomentum.M();
+      Double_t epair = fMomentum.E();
+      Float_t ptpair = fMomentum.Pt();
       
       if(fFillAllNLMHistograms)
       {
@@ -2924,48 +2926,55 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       //
       // Skip events with too few or too many  NLM
       //
-      if((nMaxima1 < fNLMCutMin || nMaxima1 > fNLMCutMax) || (nMaxima2 < fNLMCutMin || nMaxima2 > fNLMCutMax)) continue ;
-      
-      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - NLM of out of range: cluster1 %d, cluster2 %d \n",nMaxima1, nMaxima2);
+      if((nMaxima1 < fNLMCutMin || nMaxima1 > fNLMCutMax) || (nMaxima2 < fNLMCutMin || nMaxima2 > fNLMCutMax))
+      {
+        AliDebug(1,Form("NLM out of range: cluster1 %d, cluster2 %d",nMaxima1, nMaxima2));
+        continue ;
+      }
       
       //Mass of all pairs
       fhMass  ->Fill( epair,mass);
       fhMassPt->Fill(ptpair,mass);
       if(IsDataMC() && mcIndex < 2) fhMCMassPt[mcIndex]->Fill(ptpair,mass);
       
+      if(fSelectPairInIsoCone && fMomentum1.Pt() > fIsoCandMinPt)
+      {
+        //Double_t angleOp  = fMomentum1.Angle(fMomentum2.Vect());
+        Double_t radius   = GetIsolationCut()->Radius(fMomentum1.Eta(),fMomentum1.Phi(),fMomentum2.Eta(),fMomentum2.Phi());
+        
+        //printf("pT pair (%f, %f), opening angle %f, radius %f; fR %1.1f, MinPt1 %2.2f\n",fMomentum1.Pt(),fMomentum2.Pt(),angleOp,radius,fR,fIsoCandMinPt);
+        
+        if(radius < fR) fhMassPtIsoRCut->Fill(ptpair,mass);
+      }
+      
       //
       // Select good pair (good phi, pt cuts, aperture and invariant mass)
       //
-      if(!GetNeutralMesonSelection()->SelectPair(mom1, mom2,GetCalorimeter())) continue;
+      if(!GetNeutralMesonSelection()->SelectPair(fMomentum1, fMomentum2,GetCalorimeter())) continue;
       
-      if(GetDebug()>1)
-        printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Selected gamma pair: pt %f, phi %f, eta%f \n",
-               mom.Pt(), mom.Phi()*TMath::RadToDeg(), mom.Eta());
+      AliDebug(1,Form("Selected gamma pair: pt %f, phi %f, eta%f",
+                      fMomentum.Pt(), fMomentum.Phi()*TMath::RadToDeg(), fMomentum.Eta()));
       
       //
       // Tag both photons as decay if not done before
       // set the corresponding bit for pi0 or eta or "side" case
       //
-      Int_t bit1 = photon1->GetBtag(); // temporary
-      if( bit1 < 0 ) bit1 = 0 ; // temporary
+      Int_t bit1 = photon1->DecayTag();
+      if( bit1 < 0 ) bit1 = 0 ;
       if( !GetNeutralMesonSelection()->CheckDecayBit(bit1) )
       {
-        if( GetDebug() > 1 )
-          printf("AliAnaPi0EbE::MakeInvMassInCalorimeter - pT1 %2.2f; bit requested %d; decay bit1: In %d, ",
-                 mom1.Pt(), GetNeutralMesonSelection()->GetDecayBit(), bit1);
+        AliDebug(1,Form("pT1 %2.2f; bit requested %d; decay bit1: In %d",fMomentum1.Pt(), GetNeutralMesonSelection()->GetDecayBit(), bit1));
         
-        photon1->SetTagged(kTRUE); // temporary
         GetNeutralMesonSelection()->SetDecayBit(bit1);
-        photon1->SetBtag(bit1); // temporary
+        photon1->SetDecayTag(bit1);
         
-        if( GetDebug() > 1 )
-          printf("Out %d \n", bit1);
+        AliDebug(1,Form("\t Out %d", bit1));
         
         fhPtDecay->Fill(photon1->Pt());
 
         //Fill some histograms about shower shape
         if(fFillSelectClHisto && cluster1 && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
-          FillSelectedClusterHistograms(cluster1, mom1.Pt(), nMaxima1, photon1->GetTag());
+          FillSelectedClusterHistograms(cluster1, fMomentum1.Pt(), nMaxima1, photon1->GetTag());
         
         if(IsDataMC())
         {
@@ -2979,26 +2988,22 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
         }
       }
       
-      Int_t bit2 = photon2->GetBtag(); // temporary
-      if( bit2 < 0 ) bit2 = 0 ; // temporary
+      Int_t bit2 = photon2->DecayTag();
+      if( bit2 < 0 ) bit2 = 0 ;
       if( !GetNeutralMesonSelection()->CheckDecayBit(bit2) )
       {
-        if( GetDebug() > 1 )
-          printf("AliAnaPi0EbE::MakeInvMassInCalorimeter - pT2 %2.2f; bit requested %d; decay bit2: In %d, ",
-                 mom2.Pt(), GetNeutralMesonSelection()->GetDecayBit(), bit2);
+        AliDebug(1,Form("pT2 %2.2f; bit requested %d; decay bit2: In %d",fMomentum2.Pt(), GetNeutralMesonSelection()->GetDecayBit(), bit2));
         
-        photon2->SetTagged(kTRUE); // temporary
         GetNeutralMesonSelection()->SetDecayBit(bit2);
-        photon2->SetBtag(bit2); // temporary
+        photon2->SetDecayTag(bit2);
         
-        if( GetDebug() > 1 )
-          printf("Out %d \n", bit2);
+        AliDebug(1,Form("\t Out %d", bit2));
         
         fhPtDecay->Fill(photon2->Pt());
         
         //Fill some histograms about shower shape
         if(fFillSelectClHisto && cluster2 && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
-          FillSelectedClusterHistograms(cluster2, mom2.Pt(), nMaxima2, photon2->GetTag());
+          FillSelectedClusterHistograms(cluster2, fMomentum2.Pt(), nMaxima2, photon2->GetTag());
         
         if(IsDataMC())
         {
@@ -3022,16 +3027,16 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       FillPileUpHistograms(ptpair,((cluster1->GetTOF()+cluster2->GetTOF())*1e9)/2,cluster1);
       
       //Create AOD for analysis
-      AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
+      AliAODPWG4Particle pi0 = AliAODPWG4Particle(fMomentum);
       
       if     ( (GetNeutralMesonSelection()->GetParticle()).Contains("Pi0") ) pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
       else if( (GetNeutralMesonSelection()->GetParticle()).Contains("Eta") ) pi0.SetIdentifiedParticleType(AliCaloPID::kEta);
       else
       {
-        printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Particle type declared in AliNeutralMeson not correct, do not add \n");
+        AliWarning("Particle type declared in AliNeutralMeson not correct, do not add");
         return ;
       }
-      pi0.SetDetector(photon1->GetDetector());
+      pi0.SetDetectorTag(photon1->GetDetectorTag());
       
       // MC
       pi0.SetLabel(label);
@@ -3047,7 +3052,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
     
   }//1st photon loop
   
-  if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - End fill AODs \n");
+  AliDebug(1,"End fill AODs");
   
 }
 
@@ -3059,15 +3064,10 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
   //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 ;
-  
   // Check calorimeter input
   if(!GetInputAODBranch())
   {
-    printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
-    abort();
+    AliFatal(Form("No input calo photons in AOD branch with name < %s > , STOP",GetInputAODName().Data()));
   }
   
   // Get the array with conversion photons
@@ -3078,33 +3078,31 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
     
     if(!inputAODGammaConv)
     {
-      printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input gamma conversions in AOD branch with name < %s >\n",fInputAODGammaConvName.Data());
-      
-      return;
+      AliFatal(Form("No input gamma conversions in AOD branch with name < %s >",fInputAODGammaConvName.Data()));
+      return; // coverity
     }
   }
   
   //Get shower shape information of clusters
   TObjArray *clusters = 0;
-  if     (GetCalorimeter()=="EMCAL") clusters = GetEMCALClusters();
-  else if(GetCalorimeter()=="PHOS")  clusters = GetPHOSClusters() ;
+  if     (GetCalorimeter()==kEMCAL) clusters = GetEMCALClusters();
+  else if(GetCalorimeter()==kPHOS)  clusters = GetPHOSClusters() ;
   
   Int_t nCTS  = inputAODGammaConv->GetEntriesFast();
   Int_t nCalo = GetInputAODBranch()->GetEntriesFast();
   if(nCTS<=0 || nCalo <=0)
   {
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - nCalo %d, nCTS %d, cannot loop\n",nCalo,nCTS);
+    AliDebug(1,Form("nCalo %d, nCTS %d, cannot loop",nCalo,nCTS));
     return;
   }
   
-  if(GetDebug() > 1)
-    printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Number of conversion photons %d\n",nCTS);
+  AliDebug(1,Form("Number of conversion photons %d and number of clusters %d",nCTS,nCalo));
   
   // Do the loop, first calo, second CTS
   for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++)
   {
     AliAODPWG4Particle * photon1 =  (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
-    mom1 = *(photon1->Momentum());
+    fMomentum1 = *(photon1->Momentum());
     
     // Do analysis only when one of the decays is isolated
     // Run AliAnaParticleIsolation before
@@ -3129,15 +3127,15 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
         if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ;  //vertex cut
       }
       
-      mom2 = *(photon2->Momentum());
+      fMomentum2 = *(photon2->Momentum());
       
-      mom = mom1+mom2;
+      fMomentum = fMomentum1+fMomentum2;
       
-      Double_t mass  = mom.M();
-      Double_t epair = mom.E();
-      Float_t ptpair = mom.Pt();
+      Double_t mass  = fMomentum.M();
+      Double_t epair = fMomentum.E();
+      Float_t ptpair = fMomentum.Pt();
       
-      Int_t nMaxima = photon1->GetFiducialArea();
+      Int_t nMaxima = photon1->GetNLM();
       if(fFillAllNLMHistograms)
       {
         if     (nMaxima==1) fhMassPairLocMax[0]->Fill(epair,mass);
@@ -3145,8 +3143,11 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
         else                fhMassPairLocMax[2]->Fill(epair,mass);
       }
       
-      if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) continue ;
-      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - NLM %d of out of range \n",nMaxima);
+      if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax)
+      {
+        AliDebug(1,Form("NLM %d out of range",nMaxima));
+        continue ;
+      }
       
       //Play with the MC stack if available
       Int_t mcIndex = kmcHadron;
@@ -3155,9 +3156,11 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
       if(IsDataMC())
       {
         Int_t  label2 = photon2->GetLabel();
-        if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(),"CTS"));
+        if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(),kCTS));
         
-        HasPairSameMCMother(photon1, photon2, label, tag) ;
+        HasPairSameMCMother(photon1->GetLabel(), photon2->GetLabel(),
+                            photon1->GetTag()  , photon2->GetTag(),
+                            label, tag) ;
         mcIndex = GetMCIndex(tag);
       }
       
@@ -3169,27 +3172,26 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
       //
       // Select good pair (good phi, pt cuts, aperture and invariant mass)
       //
-      if(!GetNeutralMesonSelection()->SelectPair(mom1, mom2,GetCalorimeter())) continue ;
+      if(!GetNeutralMesonSelection()->SelectPair(fMomentum1, fMomentum2,GetCalorimeter())) continue ;
       
-      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Selected gamma pair: pt %f, phi %f, eta%f\n",
-                                mom.Pt(), mom.Phi()*TMath::RadToDeg(), mom.Eta());
+      AliDebug(1,Form("Selected gamma pair: pt %f, phi %f, eta%f",fMomentum.Pt(), fMomentum.Phi()*TMath::RadToDeg(), fMomentum.Eta()));
       
       //
       // Tag both photons as decay if not done before
       // set the corresponding bit for pi0 or eta or "side" case
       //
-      Int_t bit1 = photon1->GetBtag(); // temporary
-      if( bit1 < 0 ) bit1 = 0 ; // temporary
+      Int_t bit1 = photon1->DecayTag();
+      if( bit1 < 0 ) bit1 = 0 ;
       if( !GetNeutralMesonSelection()->CheckDecayBit(bit1) )
       {
-        photon1->SetTagged(kTRUE); // temporary
         GetNeutralMesonSelection()->SetDecayBit(bit1);
-        photon1->SetBtag(bit1); // temporary
+        photon1->SetDecayTag(bit1);
+        
         fhPtDecay->Fill(photon1->Pt());
         
         //Fill some histograms about shower shape
         if(fFillSelectClHisto && cluster && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
-          FillSelectedClusterHistograms(cluster, mom1.Pt(), nMaxima, photon1->GetTag());
+          FillSelectedClusterHistograms(cluster, fMomentum1.Pt(), nMaxima, photon1->GetTag());
         
         if(IsDataMC())
         {
@@ -3203,13 +3205,12 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
         }
       }
       
-      Int_t bit2 = photon2->GetBtag(); // temporary
-      if( bit2 < 0 ) bit2 = 0 ; // temporary
+      Int_t bit2 = photon2->DecayTag();
+      if( bit2 < 0 ) bit2 = 0 ;
       if( !GetNeutralMesonSelection()->CheckDecayBit(bit2) )
       {
-        photon2->SetTagged(kTRUE); // temporary
         GetNeutralMesonSelection()->SetDecayBit(bit2);
-        photon2->SetBtag(bit2); // temporary
+        photon2->SetDecayTag(bit2);
       }
       
       //Mass of selected pairs
@@ -3219,20 +3220,20 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
       
       // Fill histograms to undertand pile-up before other cuts applied
       // Remember to relax time cuts in the reader
-      if(cluster) FillPileUpHistograms(mom.Pt(),cluster->GetTOF()*1e9,cluster);
+      if(cluster) FillPileUpHistograms(fMomentum.Pt(),cluster->GetTOF()*1e9,cluster);
       
       //Create AOD for analysis
       
-      AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
+      AliAODPWG4Particle pi0 = AliAODPWG4Particle(fMomentum);
       
       if     ( (GetNeutralMesonSelection()->GetParticle()).Contains("Pi0") ) pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
       else if( (GetNeutralMesonSelection()->GetParticle()).Contains("Eta") ) pi0.SetIdentifiedParticleType(AliCaloPID::kEta);
       else
       {
-        printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Particle type declared in AliNeutralMeson not correct, do not add \n");
+        AliWarning("Particle type declared in AliNeutralMeson not correct, do not add");
         return ;
       }
-      pi0.SetDetector(photon1->GetDetector());
+      pi0.SetDetectorTag(photon1->GetDetectorTag());
       
       // MC
       pi0.SetLabel(label);
@@ -3249,7 +3250,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
     
   }//1st photon loop
   
-  if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - End fill AODs \n");
+  AliDebug(1,"End fill AODs");
   
 }
 
@@ -3261,12 +3262,12 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
   TObjArray * pl        = 0x0;
   AliVCaloCells * cells = 0x0;
   //Select the Calorimeter of the photon
-  if      (GetCalorimeter() == "EMCAL" )
+  if      (GetCalorimeter() == kEMCAL )
   {
     pl    = GetEMCALClusters();
     cells = GetEMCALCells();
   }
-  else if (GetCalorimeter() == "PHOS")
+  else if (GetCalorimeter() == kPHOS)
   {
     AliFatal("kSSCalo case not implememted for PHOS");
     return; // for coverity
@@ -3277,11 +3278,10 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
   
   if(!pl)
   {
-    Info("MakeShowerShapeIdentification","TObjArray with %s clusters is NULL!\n",GetCalorimeter().Data());
+    AliInfo(Form("TObjArray with %s clusters is NULL!",GetCalorimeterString().Data()));
     return;
   }
 
-  TLorentzVector mom ;
   for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++)
   {
     AliVCluster * calo = (AliVCluster*) (pl->At(icalo));
@@ -3297,25 +3297,24 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     Double_t vertex[]={0,0,0};
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
-      calo->GetMomentum(mom,GetVertex(evtIndex)) ;
+      calo->GetMomentum(fMomentum,GetVertex(evtIndex)) ;
     }//Assume that come from vertex in straight line
     else
     {
-      calo->GetMomentum(mom,vertex) ;
+      calo->GetMomentum(fMomentum,vertex) ;
     }
     
     //If too small or big pt, skip it
-    if(mom.E() < GetMinEnergy() || mom.E() > GetMaxEnergy() ) continue ;
+    if(fMomentum.E() < GetMinEnergy() || fMomentum.E() > GetMaxEnergy() ) continue ;
     
     //Check acceptance selection
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,GetCalorimeter()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter()) ;
       if(! in ) continue ;
     }
     
-    if(GetDebug() > 1)
-      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",mom.Pt(),mom.Phi(),mom.Eta());
+    AliDebug(1,Form("Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f",fMomentum.Pt(),fMomentum.Phi(),fMomentum.Eta()));
     
     //Play with the MC stack if available
     //Check origin of the candidates
@@ -3324,7 +3323,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     {
       tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader(),GetCalorimeter());
       //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
-      if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",tag);
+      AliDebug(1,Form("Origin of candidate %d",tag));
     }
 
     //Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(calo, cells); // NLM
@@ -3333,29 +3332,27 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     Double_t distBad=calo->GetDistanceToBadChannel() ; //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)
-      //FillRejectedClusterHistograms(mom,tag,nMaxima);
+      //FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
  
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
+    AliDebug(1,Form("Bad channel cut passed %4.2f",distBad));
     
     //If too low number of cells, skip it
     if ( calo->GetNCells() < GetCaloPID()->GetClusterSplittingMinNCells())
     {
-      //FillRejectedClusterHistograms(mom,tag,nMaxima);
+      //FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
-    if(GetDebug() > 1)
-      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: N cells cut passed %d > %d\n",
-             calo->GetNCells(), GetCaloPID()->GetClusterSplittingMinNCells());
+    AliDebug(1,Form("N cells cut passed %d > %d",calo->GetNCells(), GetCaloPID()->GetClusterSplittingMinNCells()));
     
     //.......................................
     // TOF cut, BE CAREFUL WITH THIS CUT
     Double_t tof = calo->GetTOF()*1e9;
     if(tof < fTimeCutMin || tof > fTimeCutMax)
     {
-      //FillRejectedClusterHistograms(mom,tag,nMaxima);
+      //FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
 
@@ -3366,70 +3363,70 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     Int_t    absId1   =-1, absId2   =-1;
     Float_t  distbad1 =-1, distbad2 =-1;
     Bool_t   fidcut1  = 0, fidcut2  = 0;
-    TLorentzVector    l1, l2;
 
     Int_t idPartType = GetCaloPID()->GetIdentifiedParticleTypeFromClusterSplitting(calo,cells,GetCaloUtils(),
                                                                                    GetVertex(evtIndex),nMaxima,
-                                                                                   mass,angle,l1,l2,absId1,absId2,
-                                                                                   distbad1,distbad2,fidcut1,fidcut2) ;
+                                                                                   mass,angle,
+                                                                                   fMomentum1,fMomentum2,
+                                                                                   absId1,absId2,
+                                                                                   distbad1,distbad2,
+                                                                                   fidcut1,fidcut2) ;
     
     
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",idPartType);
+    AliDebug(1,Form("PDG of identified particle %d",idPartType));
     
     // Skip events where one of the new clusters (lowest energy) is close to an EMCal border or a bad channel
     if( (fCheckSplitDistToBad) &&
        (!fidcut2 || !fidcut1 || distbad1 < fMinDist || distbad2 < fMinDist))
     {
-      if(GetDebug() > 1)
-        Info("MakeShowerShapeIdentification", "Dist to bad channel cl %f, cl1 %f, cl2 %f; fid cl1 %d, cl2 %d \n",
-               calo->GetDistanceToBadChannel(),distbad1,distbad2, fidcut1,fidcut2);
+      AliDebug(1,Form("Dist to bad channel cl %f, cl1 %f, cl2 %f; fid cl1 %d, cl2 %d",
+                      calo->GetDistanceToBadChannel(),distbad1,distbad2, fidcut1,fidcut2));
       
-      //FillRejectedClusterHistograms(mom,tag,nMaxima);
+      //FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
     //Skip events with too few or too many  NLM
     if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax)
     {
-      //FillRejectedClusterHistograms(mom,tag,nMaxima);
+      //FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
-    if(GetDebug() > 1)
-      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - NLM %d accepted \n",nMaxima);
+    AliDebug(1,Form("NLM %d accepted",nMaxima));
     
     //Skip matched clusters with tracks
     if(fRejectTrackMatch && IsTrackMatched(calo, GetReader()->GetInputEvent()))
     {
-      FillRejectedClusterHistograms(mom,tag,nMaxima);
+      FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
     Float_t l0 = calo->GetM02();
-    Float_t e1 = l1.Energy();
-    Float_t e2 = l2.Energy();
-    TLorentzVector l12 = l1+l2;
-    Float_t ptSplit = l12.Pt();
+    Float_t e1 = fMomentum1.Energy();
+    Float_t e2 = fMomentum2.Energy();
+    fMomentum12 = fMomentum1+fMomentum2;
+    Float_t ptSplit = fMomentum12.Pt();
     Float_t  eSplit = e1+e2;
 
     //mass of all clusters
-    fhMass       ->Fill(mom.E() ,mass);
-    fhMassPt     ->Fill(mom.Pt(),mass);
+    fhMass       ->Fill(fMomentum.E() ,mass);
+    fhMassPt     ->Fill(fMomentum.Pt(),mass);
     fhMassSplitPt->Fill(ptSplit ,mass);
-    fhPtLambda0NoSplitCut->Fill(mom.Pt(),l0);
+    fhPtLambda0NoSplitCut->Fill(fMomentum.Pt(),l0);
     
     // Asymmetry of all clusters
     Float_t asy =-10;
     
     if(e1+e2 > 0) asy = (e1-e2) / (e1+e2);
-    fhAsymmetry->Fill(mom.E(),asy);
+    fhAsymmetry->Fill(fMomentum.E(),asy);
     
     // Divide NLM in 3 cases, 1 local maxima, 2 local maxima, more than 2 local maxima
     Int_t indexMax = -1;
     if     (nMaxima==1) indexMax = 0 ;
     else if(nMaxima==2) indexMax = 1 ;
     else                indexMax = 2 ;
-    fhMassPtLocMax[indexMax]->Fill(mom.Pt(),mass);
+    fhMassPtLocMax[indexMax]->Fill(fMomentum.Pt(),mass);
     
     Int_t   mcIndex   =-1;
     Int_t   noverlaps = 0;
@@ -3441,7 +3438,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       Bool_t ok      = kFALSE;
       Int_t  mcLabel = calo->GetLabel();
       
-      TLorentzVector primary = GetMCAnalysisUtils()->GetMother(mcLabel,GetReader(),ok);
+      fPrimaryMom = GetMCAnalysisUtils()->GetMother(mcLabel,GetReader(),ok);
       
       Int_t mesonLabel = -1;
       
@@ -3449,13 +3446,13 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       {
         if(mcIndex == kmcPi0)
         {
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,111,GetReader(),ok,mesonLabel);
-          if(grandmom.E() > 0 && ok) ptprim =  grandmom.Pt();
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,111,GetReader(),ok,mesonLabel);
+          if(fGrandMotherMom.E() > 0 && ok) ptprim =  fGrandMotherMom.Pt();
         }
         else
         {
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,221,GetReader(),ok,mesonLabel);
-          if(grandmom.E() > 0 && ok) ptprim =  grandmom.Pt();
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(mcLabel,221,GetReader(),ok,mesonLabel);
+          if(fGrandMotherMom.E() > 0 && ok) ptprim = fGrandMotherMom.Pt();
         }
       }
             
@@ -3463,21 +3460,21 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       Int_t overpdg[nlabels];
       noverlaps = GetMCAnalysisUtils()->GetNOverlaps(calo->GetLabels(), nlabels,tag,mesonLabel,GetReader(),overpdg);
  
-      fhMCMassPt     [mcIndex]->Fill(mom.Pt(),mass);
+      fhMCMassPt     [mcIndex]->Fill(fMomentum.Pt(),mass);
       fhMCMassSplitPt[mcIndex]->Fill(ptSplit ,mass);
       if(mcIndex==kmcPi0)
       {
-        fhMCPi0PtRecoPtPrim                     ->Fill(mom.Pt(),ptprim);
+        fhMCPi0PtRecoPtPrim                     ->Fill(fMomentum.Pt(),ptprim);
         fhMCPi0SplitPtRecoPtPrim                ->Fill(ptSplit ,ptprim);
-        fhMCPi0PtRecoPtPrimLocMax     [indexMax]->Fill(mom.Pt(),ptprim);
+        fhMCPi0PtRecoPtPrimLocMax     [indexMax]->Fill(fMomentum.Pt(),ptprim);
         fhMCPi0SplitPtRecoPtPrimLocMax[indexMax]->Fill(ptSplit ,ptprim);
 
       }
       else if(mcIndex==kmcEta)
       {
-        fhMCEtaPtRecoPtPrim                     ->Fill(mom.Pt(),ptprim);
+        fhMCEtaPtRecoPtPrim                     ->Fill(fMomentum.Pt(),ptprim);
         fhMCEtaSplitPtRecoPtPrim                ->Fill(ptSplit ,ptprim);
-        fhMCEtaPtRecoPtPrimLocMax     [indexMax]->Fill(mom.Pt(),ptprim);
+        fhMCEtaPtRecoPtPrimLocMax     [indexMax]->Fill(fMomentum.Pt(),ptprim);
         fhMCEtaSplitPtRecoPtPrimLocMax[indexMax]->Fill(ptSplit ,ptprim);
       }
 
@@ -3485,90 +3482,88 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       {
         if(mcIndex==kmcPi0)
         {
-          fhMCPi0PtRecoPtPrimNoOverlap     ->Fill(mom.Pt(),ptprim);
+          fhMCPi0PtRecoPtPrimNoOverlap     ->Fill(fMomentum.Pt(),ptprim);
           fhMCPi0SplitPtRecoPtPrimNoOverlap->Fill(ptSplit ,ptprim);
         }
         else if(mcIndex==kmcEta)
         {
-          fhMCEtaPtRecoPtPrimNoOverlap     ->Fill(mom.Pt(),ptprim);
+          fhMCEtaPtRecoPtPrimNoOverlap     ->Fill(fMomentum.Pt(),ptprim);
           fhMCEtaSplitPtRecoPtPrimNoOverlap->Fill(ptSplit ,ptprim);
         }
         
-        fhMassNoOverlap       ->Fill(mom.E() ,mass);
-        fhMassPtNoOverlap     ->Fill(mom.Pt(),mass);
+        fhMassNoOverlap       ->Fill(fMomentum.E() ,mass);
+        fhMassPtNoOverlap     ->Fill(fMomentum.Pt(),mass);
         fhMassSplitPtNoOverlap->Fill(ptSplit ,mass);
         
-        fhMCMassPtNoOverlap     [mcIndex]->Fill(mom.Pt(),mass);
+        fhMCMassPtNoOverlap     [mcIndex]->Fill(fMomentum.Pt(),mass);
         fhMCMassSplitPtNoOverlap[mcIndex]->Fill(ptSplit ,mass);
       }
 
-      fhMCPtAsymmetry[mcIndex]->Fill(mom.Pt(),asy);
+      fhMCPtAsymmetry[mcIndex]->Fill(fMomentum.Pt(),asy);
     }
     
     // If cluster does not pass pid, not pi0/eta, skip it.
     if     (GetOutputAODName().Contains("Pi0") && idPartType != AliCaloPID::kPi0)
     {
-      if(GetDebug() > 1) Info("MakeShowerShapeIdentification","Cluster is not Pi0\n");
-      FillRejectedClusterHistograms(mom,tag,nMaxima);
+      AliDebug(1,"Cluster is not Pi0");
+      FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
     else if(GetOutputAODName().Contains("Eta") && idPartType != AliCaloPID::kEta)
     {
-      if(GetDebug() > 1) Info("MakeShowerShapeIdentification","Cluster is not Eta\n");
-      FillRejectedClusterHistograms(mom,tag,nMaxima);
+      AliDebug(1,"Cluster is not Eta");
+      FillRejectedClusterHistograms(tag,nMaxima);
       continue ;
     }
     
-    if(GetDebug() > 1)
-      Info("MakeShowerShapeIdentification","Pi0/Eta selection cuts passed: pT %3.2f, pdg %d\n",
-             mom.Pt(), idPartType);
+    AliDebug(1,Form("Pi0/Eta selection cuts passed: pT %3.2f, pdg %d",fMomentum.Pt(), idPartType));
         
     //Mass and asymmetry of selected pairs
-    fhSelectedAsymmetry  ->Fill(mom.E() ,asy );
-    fhSelectedMass       ->Fill(mom.E() ,mass);
-    fhSelectedMassPt     ->Fill(mom.Pt(),mass);
+    fhSelectedAsymmetry  ->Fill(fMomentum.E() ,asy );
+    fhSelectedMass       ->Fill(fMomentum.E() ,mass);
+    fhSelectedMassPt     ->Fill(fMomentum.Pt(),mass);
     fhSelectedMassSplitPt->Fill(ptSplit ,mass);
-    if(fFillAllNLMHistograms) fhSelectedMassPtLocMax[indexMax]->Fill(mom.Pt(),mass);
+    fhSelectedMassPtLocMax[indexMax]->Fill(fMomentum.Pt(),mass);
 
     Int_t   nSM  = GetModuleNumber(calo);
     if(nSM < GetCaloUtils()->GetNumberOfSuperModulesUsed() && nSM >=0 && fFillAllNLMHistograms)
     {
-      fhSelectedMassPtLocMaxSM   [indexMax][nSM]->Fill(mom.Pt(),mass);
-      fhSelectedLambda0PtLocMaxSM[indexMax][nSM]->Fill(mom.Pt(),l0  );
+      fhSelectedMassPtLocMaxSM   [indexMax][nSM]->Fill(fMomentum.Pt(),mass);
+      fhSelectedLambda0PtLocMaxSM[indexMax][nSM]->Fill(fMomentum.Pt(),l0  );
     }
 
     if(IsDataMC())
     {
       if(mcIndex==kmcPi0)
       {
-        fhMCPi0SelectedPtRecoPtPrim                     ->Fill(mom.Pt(),ptprim);
+        fhMCPi0SelectedPtRecoPtPrim                     ->Fill(fMomentum.Pt(),ptprim);
         fhMCPi0SelectedSplitPtRecoPtPrim                ->Fill(ptSplit ,ptprim);
-        fhMCPi0SelectedPtRecoPtPrimLocMax     [indexMax]->Fill(mom.Pt(),ptprim);
+        fhMCPi0SelectedPtRecoPtPrimLocMax     [indexMax]->Fill(fMomentum.Pt(),ptprim);
         fhMCPi0SelectedSplitPtRecoPtPrimLocMax[indexMax]->Fill(ptSplit ,ptprim);
       }
       else if(mcIndex==kmcEta)
       {
-        fhMCEtaSelectedPtRecoPtPrim                     ->Fill(mom.Pt(),ptprim);
+        fhMCEtaSelectedPtRecoPtPrim                     ->Fill(fMomentum.Pt(),ptprim);
         fhMCEtaSelectedSplitPtRecoPtPrim                ->Fill(ptSplit ,ptprim);
-        fhMCEtaSelectedPtRecoPtPrimLocMax     [indexMax]->Fill(mom.Pt(),ptprim);
+        fhMCEtaSelectedPtRecoPtPrimLocMax     [indexMax]->Fill(fMomentum.Pt(),ptprim);
         fhMCEtaSelectedSplitPtRecoPtPrimLocMax[indexMax]->Fill(ptSplit ,ptprim);
       }
       
       if(noverlaps==0)
       {
-        fhSelectedMassNoOverlap       ->Fill(mom.E() ,mass);
-        fhSelectedMassPtNoOverlap     ->Fill(mom.Pt(),mass);
+        fhSelectedMassNoOverlap       ->Fill(fMomentum.E() ,mass);
+        fhSelectedMassPtNoOverlap     ->Fill(fMomentum.Pt(),mass);
         fhSelectedMassSplitPtNoOverlap->Fill(ptSplit ,mass);
         
         if(mcIndex==kmcPi0)
         {
-          fhMCPi0SelectedPtRecoPtPrimNoOverlap     ->Fill(mom.Pt(),ptprim);
+          fhMCPi0SelectedPtRecoPtPrimNoOverlap     ->Fill(fMomentum.Pt(),ptprim);
           fhMCPi0SelectedSplitPtRecoPtPrimNoOverlap->Fill(ptSplit ,ptprim);
         }
         else if(mcIndex==kmcEta)
         {
-          fhMCEtaSelectedPtRecoPtPrimNoOverlap     ->Fill(mom.Pt(),ptprim);
+          fhMCEtaSelectedPtRecoPtPrimNoOverlap     ->Fill(fMomentum.Pt(),ptprim);
           fhMCEtaSelectedSplitPtRecoPtPrimNoOverlap->Fill(ptSplit ,ptprim);
         }
       }
@@ -3576,10 +3571,10 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     
     fhSplitE        ->Fill( eSplit);
     fhSplitPt       ->Fill(ptSplit);
-    Float_t phi = mom.Phi();
+    Float_t phi = fMomentum.Phi();
     if(phi<0) phi+=TMath::TwoPi();
     fhSplitPtPhi    ->Fill(ptSplit,phi);
-    fhSplitPtEta    ->Fill(ptSplit,mom.Eta());
+    fhSplitPtEta    ->Fill(ptSplit,fMomentum.Eta());
     fhNLocMaxSplitPt->Fill(ptSplit ,nMaxima);
     
     //Check split-clusters with good time window difference
@@ -3599,50 +3594,50 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       fhMCSplitE        [mcIndex]->Fill( eSplit);
       fhMCSplitPt       [mcIndex]->Fill(ptSplit);
       fhMCSplitPtPhi    [mcIndex]->Fill(ptSplit,phi);
-      fhMCSplitPtEta    [mcIndex]->Fill(ptSplit,mom.Eta());
+      fhMCSplitPtEta    [mcIndex]->Fill(ptSplit,fMomentum.Eta());
       fhMCNLocMaxSplitPt[mcIndex]->Fill(ptSplit ,nMaxima);
-      fhMCNLocMaxPt     [mcIndex]->Fill(mom.Pt(),nMaxima);
+      fhMCNLocMaxPt     [mcIndex]->Fill(fMomentum.Pt(),nMaxima);
       
-      fhMCSelectedMassPt     [mcIndex]->Fill(mom.Pt(),mass);
+      fhMCSelectedMassPt     [mcIndex]->Fill(fMomentum.Pt(),mass);
       fhMCSelectedMassSplitPt[mcIndex]->Fill(ptSplit,mass);
-      fhMCSelectedMassPtLocMax[mcIndex][indexMax]->Fill(mom.Pt(),mass);
+      fhMCSelectedMassPtLocMax[mcIndex][indexMax]->Fill(fMomentum.Pt(),mass);
 
       if(noverlaps==0)
       {
-        fhMCSelectedMassPtNoOverlap     [mcIndex]->Fill(mom.Pt(),mass);
+        fhMCSelectedMassPtNoOverlap     [mcIndex]->Fill(fMomentum.Pt(),mass);
         fhMCSelectedMassSplitPtNoOverlap[mcIndex]->Fill(ptSplit,mass);
       }
     }
     
     // Remove clusters with NLM=x depeding on a minimim energy cut
-    if(nMaxima == 1 && fNLMECutMin[0] > mom.E()) continue;
-    if(nMaxima == 2 && fNLMECutMin[1] > mom.E()) continue;
-    if(nMaxima >  2 && fNLMECutMin[2] > mom.E()) continue;
+    if(nMaxima == 1 && fNLMECutMin[0] > fMomentum.E()) continue;
+    if(nMaxima == 2 && fNLMECutMin[1] > fMomentum.E()) continue;
+    if(nMaxima >  2 && fNLMECutMin[2] > fMomentum.E()) continue;
 
     //Fill some histograms about shower shape
     if(fFillSelectClHisto && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
     {
-      FillSelectedClusterHistograms(calo, mom.Pt(), nMaxima, tag, asy);
+      FillSelectedClusterHistograms(calo, fMomentum.Pt(), nMaxima, tag, asy);
     }
     
     // Fill histograms to undertand pile-up before other cuts applied
     // Remember to relax time cuts in the reader
     Double_t tofcluster   = calo->GetTOF()*1e9;
     
-    FillPileUpHistograms(mom.Pt(),tofcluster,calo);
+    FillPileUpHistograms(fMomentum.Pt(),tofcluster,calo);
     
-    if(fFillEMCALBCHistograms && GetCalorimeter()=="EMCAL")
-      FillEMCALBCHistograms(mom.E(), mom.Eta(), mom.Phi(), tofcluster);
+    if(fFillEMCALBCHistograms && GetCalorimeter()==kEMCAL)
+      FillEMCALBCHistograms(fMomentum.E(), fMomentum.Eta(), fMomentum.Phi(), tofcluster);
     
     //-----------------------
     //Create AOD for analysis
     
-    AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
+    AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(fMomentum);
     aodpi0.SetLabel(calo->GetLabel());
     
     //Set the indeces of the original caloclusters
     aodpi0.SetCaloLabel(calo->GetID(),-1);
-    aodpi0.SetDetector(GetCalorimeter());
+    aodpi0.SetDetectorTag(GetCalorimeter());
     
     if     (distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
     else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ;
@@ -3652,7 +3647,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     aodpi0.SetIdentifiedParticleType(idPartType);
     
     // Add number of local maxima to AOD, method name in AOD to be FIXED
-    aodpi0.SetFiducialArea(nMaxima);
+    aodpi0.SetNLM(nMaxima);
     
     aodpi0.SetTag(tag);
 
@@ -3661,7 +3656,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
         
   }//loop
   
-  if(GetDebug() > 1) Info("MakeShowerShapeIdentification","End fill AODs \n");
+  AliDebug(1,"End fill AODs");
   
 }
 
@@ -3672,13 +3667,14 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
   
   if(!GetOutputAODBranch())
   {
-    AliFatal(Form("No output pi0 in AOD branch with name < %s >,STOP \n",GetOutputAODName().Data()));
+    AliFatal(Form("No output pi0 in AOD branch with name < %s >,STOP",GetOutputAODName().Data()));
     return;
   }
   
   //Loop on stored AOD pi0
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  
+  AliDebug(1,Form("AOD branch entries %d", naod));
   
   Float_t cen = GetEventCentrality();
   Float_t ep  = GetEventPlaneAngle();
@@ -3733,44 +3729,44 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
         Int_t   momlabel  = -1;
         Bool_t  ok        = kFALSE;
         
-        TLorentzVector mom   = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok);
+        fPrimaryMom = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok);
         if(!ok) continue;
         
         if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0))
         {
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok,momlabel);
-          if(grandmom.E() > 0 && ok)
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok,momlabel);
+          if(fGrandMotherMom.E() > 0 && ok)
           {
-            efracMC =  grandmom.E()/ener;
+            efracMC =  fGrandMotherMom.E()/ener;
             fhMCPi0PtGenRecoFraction ->Fill(pt,efracMC);
           }
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay))
         {
           fhMCPi0DecayPt->Fill(pt);
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok,momlabel);
-          if(grandmom.E() > 0 && ok)
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok,momlabel);
+          if(fGrandMotherMom.E() > 0 && ok)
           {
-            efracMC =  mom.E()/grandmom.E();
+            efracMC =  fPrimaryMom.E()/fGrandMotherMom.E();
             fhMCPi0DecayPtFraction ->Fill(pt,efracMC);
           }
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta))
         {
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok,momlabel);
-          if(grandmom.E() > 0 && ok)
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok,momlabel);
+          if(fGrandMotherMom.E() > 0 && ok)
           {
-            efracMC =  grandmom.E()/ener;
+            efracMC =  fGrandMotherMom.E()/ener;
             fhMCEtaPtGenRecoFraction ->Fill(pt,efracMC);
           }
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay))
         {
           fhMCEtaDecayPt->Fill(pt);
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok,momlabel);
-          if(grandmom.E() > 0 && ok)
+          fGrandMotherMom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok,momlabel);
+          if(fGrandMotherMom.E() > 0 && ok)
           {
-            efracMC =  mom.E()/grandmom.E();
+            efracMC =  fPrimaryMom.E()/fGrandMotherMom.E();
             fhMCEtaDecayPtFraction ->Fill(pt,efracMC);
           }
         }
@@ -3848,7 +3844,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
     
   }// aod loop
   
-  if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - end\n");
+  AliDebug(1,"End");
 
 }
 
@@ -3864,7 +3860,7 @@ void AliAnaPi0EbE::Print(const Option_t * opt) const
   printf("Analysis Type = %d \n",  fAnaType) ;
   if(fAnaType == kSSCalo)
   {
-    printf("Calorimeter            =     %s\n", GetCalorimeter().Data()) ;
+    printf("Calorimeter            =     %s\n", GetCalorimeterString().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);
index 1790a84e6a23c351e4fa6d62cbb1ff50339dd3d7..0e228717b3b815d5a16f6091be74411a66b471bd 100755 (executable)
@@ -50,7 +50,7 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   
   void           FillPileUpHistograms(Float_t pt, Float_t time, AliVCluster * c) ;
   
-  void           FillRejectedClusterHistograms(TLorentzVector mom, Int_t mctag, Int_t nMaxima);
+  void           FillRejectedClusterHistograms(Int_t mctag, Int_t nMaxima);
   
   void           FillSelectedClusterHistograms(AliVCluster* cluster, Float_t pt,
                                                Int_t nLocMax,        Int_t tag,
@@ -58,8 +58,8 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
     
   void           FillWeightHistograms(AliVCluster *clus);
     
-  void           HasPairSameMCMother(AliAODPWG4Particle * photon1, 
-                                     AliAODPWG4Particle * photon2, 
+  void           HasPairSameMCMother(Int_t label1 , Int_t label2,
+                                     Int_t tag1   , Int_t tag2,
                                      Int_t & label, Int_t & tag);
   
   void           MakeInvMassInCalorimeter() ;
@@ -123,6 +123,13 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
 
   void           SwitchOnSelectIsolatedDecay()               { fSelectIsolatedDecay    = kTRUE ; }
   void           SwitchOffSelectIsolatedDecay()              { fSelectIsolatedDecay    = kFALSE; }
+
+  void           SwitchOnSelectPairInIsolationCone()         { fSelectPairInIsoCone    = kTRUE ; }
+  void           SwitchOffSelectPairInIsolationCone()        { fSelectPairInIsoCone    = kFALSE; }
+
+  void           SetR(Float_t r)                             { fR = r                          ; }
+  void           SetIsolationCandidateMinPt(Float_t min)     { fIsoCandMinPt = min             ; }
+
   
   //For histograms
   enum mcTypes   { kmcPi0      = 0, kmcEta      = 1, kmcPhoton           = 2,
@@ -146,6 +153,11 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   Double_t       fTimeCutMax  ;            // Remove clusters/cells with time larger than this value, in ns
   Bool_t         fRejectTrackMatch ;       // Remove clusters which have an associated TPC track
   Bool_t         fSelectIsolatedDecay;     // Select pairs where at least one is declared isolated (run first AliAnaParticleIsolation)
+  Bool_t         fCheckSplitDistToBad;     // Check the distance to bad channel and to EMCal borders of split clusters
+
+  Bool_t         fSelectPairInIsoCone;     // Select pair in IsoCone
+  Float_t        fR;                       // isolation cone
+  Float_t        fIsoCandMinPt;            // isolation candidate min pT
   
   Bool_t         fFillWeightHistograms ;   // Fill weigth histograms
   Bool_t         fFillTMHisto;             // Fill track matching plots
@@ -156,9 +168,14 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
 
   //Only for combination of calorimeter and conversion photons, kIMCaloTracks
   TString        fInputAODGammaConvName;   //  Name of AOD branch with conversion photons
-
-  Bool_t         fCheckSplitDistToBad;     // Check the distance to bad channel and to EMCal borders of split clusters
   
+  TLorentzVector fMomentum;                //! cluster/pi0 momentum
+  TLorentzVector fMomentum1;               //! cluster/photon momentum
+  TLorentzVector fMomentum2;               //! cluster/photon momentum
+  TLorentzVector fMomentum12;              //! cluster/pi0 momentum, sum 1+2
+  TLorentzVector fPrimaryMom;              //! primary momentum
+  TLorentzVector fGrandMotherMom;          //! primary momentum
+
   //Histograms
   
   TH1F         * fhPt  ;                   //! Number of identified  pi0/eta vs pT
@@ -196,7 +213,9 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   TH2F         * fhSelectedMass  ;         //! pair mass vs E, for selected pairs
   TH2F         * fhSelectedMassPt  ;       //! pair mass vs pT, for selected pairs
   TH2F         * fhSelectedMassSplitPt  ;  //! pair mass vs pT (split), for selected pairs
-    
+  
+  TH2F         * fhMassPtIsoRCut  ;        //! pair mass vs pT, for all pairs when opening angle not larger than iso cone radius
+
   TH2F         * fhMassPtLocMax[3] ;             //! pair mass vs pT, for all pairs, for each NLM case
   TH2F         * fhSelectedMassPtLocMax[3] ;     //! pair mass vs pT, for selected pairs, for each NLM case
   TH2F         * fhSelectedMassPtLocMaxSM[3][22];//! pair mass vs pT, for selected pairs, for each NLM case, for each SM
@@ -412,7 +431,7 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   AliAnaPi0EbE(              const AliAnaPi0EbE & pi0ebe) ; // cpy ctor
   AliAnaPi0EbE & operator = (const AliAnaPi0EbE & pi0ebe) ; // cpy assignment
   
-  ClassDef(AliAnaPi0EbE,41)
+  ClassDef(AliAnaPi0EbE,42)
 } ;
 
 
index 9b873636bee2c0e534563cfff5500e8533caca5d..9199be2cc6786386398f11aed2a79be6d1591fc5 100755 (executable)
@@ -37,7 +37,10 @@ ClassImp(AliAnaRandomTrigger)
 //__________________________________________
 AliAnaRandomTrigger::AliAnaRandomTrigger() : 
     AliAnaCaloTrackCorrBaseClass(),
-    fDetector("EMCAL"), fRandom(0), fNRandom(0),
+    fTriggerDetector(kEMCAL),
+    fTriggerDetectorString("EMCAL"),
+    fRandom(0),         fNRandom(0),
+    fMomentum(),
     fhE(0),             fhPt(0),
     fhPhi(0),           fhEta(0), 
     fhEtaPhi(0) 
@@ -54,8 +57,8 @@ Bool_t AliAnaRandomTrigger::ExcludeDeadBadRegions(Float_t eta, Float_t phi)
 {
   // Check if there is a dead or bad region in a detector
   // Now only EMCAL
-  
-  if(fDetector!="EMCAL") return kFALSE;
+
+  if(fTriggerDetector!=kEMCAL) return kFALSE;
   
   //-------------------------------------
   // Get the corresponding cell in EMCAL, check if it exists in acceptance (phi gaps, borders)
@@ -65,7 +68,7 @@ Bool_t AliAnaRandomTrigger::ExcludeDeadBadRegions(Float_t eta, Float_t phi)
   if(!GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(eta,phi, absId)) return kTRUE; // remove if out of EMCAL acceptance, phi gaps
   
   Int_t icol = -1, irow = -1, iRCU = -1;
-  Int_t sm = GetCaloUtils()->GetModuleNumberCellIndexes(absId,"EMCAL", icol, irow, iRCU);
+  Int_t sm = GetCaloUtils()->GetModuleNumberCellIndexes(absId,kEMCAL, icol, irow, iRCU);
   
   //printf("eta %f, phi %f, ieta %d, iphi %d, sm %d\n",eta,phi,icol,irow,sm);
   
@@ -140,17 +143,17 @@ TObjString *  AliAnaRandomTrigger::GetAnalysisCuts()
   const Int_t buffersize = 255;
   char onePar[buffersize] ;
   
-  snprintf(onePar,buffersize,"--- AliAnaRandomTrigger ---\n") ;
+  snprintf(onePar,buffersize,"--- AliAnaRandomTrigger ---:") ;
   parList+=onePar ;    
-  snprintf(onePar,buffersize,"Detector: %s\n"    , fDetector.Data()) ;
+  snprintf(onePar,buffersize,"Detector: %s;"    , fTriggerDetectorString.Data()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"N per event = %d\n", fNRandom       ) ;
+  snprintf(onePar,buffersize,"N per event = %d;", fNRandom       ) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Min E   = %3.2f - Max E   = %3.2f\n", GetMinPt(), GetMaxPt()) ;
+  snprintf(onePar,buffersize,"Min E   = %3.2f - Max E   = %3.2f;", GetMinPt(), GetMaxPt()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Min Eta = %3.2f - Max Eta = %3.2f\n", fEtaCut[0], fEtaCut[1]) ;
+  snprintf(onePar,buffersize,"Min Eta = %3.2f - Max Eta = %3.2f;", fEtaCut[0], fEtaCut[1]) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Min Phi = %3.2f - Max Phi = %3.2f\n", fPhiCut[0], fPhiCut[1]) ;
+  snprintf(onePar,buffersize,"Min Phi = %3.2f - Max Phi = %3.2f;", fPhiCut[0], fPhiCut[1]) ;
   parList+=onePar ;
    
   return new TObjString(parList) ;
@@ -225,7 +228,7 @@ void AliAnaRandomTrigger::Print(const Option_t * opt) const
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaCaloTrackCorrBaseClass::Print(" ");    
 
-  printf("Detector = %s\n",  fDetector.Data());
+  printf("Detector = %s\n",  fTriggerDetectorString.Data());
   printf("Min E   = %3.2f - Max E   = %3.2f\n", GetMinPt(), GetMaxPt());
   printf("Min Eta = %3.2f - Max Eta = %3.2f\n", fEtaCut[0], fEtaCut[1]);
   printf("Min Phi = %3.2f - Max Phi = %3.2f\n", fPhiCut[0], fPhiCut[1]);
@@ -260,21 +263,18 @@ void  AliAnaRandomTrigger::MakeAnalysisFillAOD()
     }
     
     // Create the AOD trigger object
-    TLorentzVector mom;
-    mom.SetPtEtaPhiM(pt,eta,phi,0);
+    fMomentum.SetPtEtaPhiM(pt,eta,phi,0);
     
-    AliAODPWG4Particle trigger = AliAODPWG4Particle(mom);
-    trigger.SetDetector(fDetector);
+    AliAODPWG4Particle trigger = AliAODPWG4Particle(fMomentum);
+    trigger.SetDetectorTag(fTriggerDetector);
     
-    if(GetDebug() > 1) 
-      printf("AliAnaRandomTrigger::MakeAnalysisFillAOD() -  iRandom %d, Trigger e %2.2f pt %2.2f, phi %2.2f, eta %2.2f \n",
-             irandom, trigger.E(), trigger.Pt(), trigger.Phi(), trigger.Eta());
+    AliDebug(1,Form("iRandom %d, Trigger e %2.2f pt %2.2f, phi %2.2f, eta %2.2f",
+                    irandom, trigger.E(), trigger.Pt(), trigger.Phi(), trigger.Eta()));
     
     AddAODParticle(trigger);
   }
   
-  if(GetDebug() > 0)   
-    printf("AliAnaRandomTrigger::MakeAnalysisFillAOD() - Final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast());   
+  AliDebug(1,Form("Final aod branch entries %d", GetOutputAODBranch()->GetEntriesFast()));
 } 
 
 //_____________________________________________________
@@ -285,8 +285,7 @@ void  AliAnaRandomTrigger::MakeAnalysisFillHistograms()
   //Loop on stored AODParticles
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
   
-  if(GetDebug() > 0) 
-    printf("AliAnaRandomTrigger::MakeAnalysisFillHistograms() - aod branch entries %d, fNRandom %d\n", naod, fNRandom);
+  AliDebug(1,Form("AOD branch entries %d, fNRandom %d", naod, fNRandom));
   
   for(Int_t iaod = 0; iaod < naod ; iaod++)
   {
@@ -301,3 +300,38 @@ void  AliAnaRandomTrigger::MakeAnalysisFillHistograms()
   }// aod branch loop
   
 }
+
+
+//_________________________________________________________
+void AliAnaRandomTrigger::SetTriggerDetector(TString & det)
+{
+  // Set the detrimeter for the analysis
+  
+  fTriggerDetectorString = det;
+  
+  if     (det=="EMCAL") fTriggerDetector = kEMCAL;
+  else if(det=="PHOS" ) fTriggerDetector = kPHOS;
+  else if(det=="CTS")   fTriggerDetector = kCTS;
+  else if(det=="DCAL")  fTriggerDetector = kDCAL;
+  else if(det.Contains("DCAL") && det.Contains("PHOS")) fTriggerDetector = kDCALPHOS;
+  else AliFatal(Form("Detector < %s > not known!", det.Data()));
+  
+}
+
+//______________________________________________________
+void AliAnaRandomTrigger::SetTriggerDetector(Int_t det)
+{
+  // Set the detrimeter for the analysis
+  
+  fTriggerDetector = det;
+  
+  if     (det==kEMCAL)    fTriggerDetectorString = "EMCAL";
+  else if(det==kPHOS )    fTriggerDetectorString = "PHOS";
+  else if(det==kCTS)      fTriggerDetectorString = "CTS";
+  else if(det==kDCAL)     fTriggerDetectorString = "DCAL";
+  else if(det==kDCALPHOS) fTriggerDetectorString = "DCAL_PHOS";
+  else AliFatal(Form("Detector < %d > not known!", det));
+  
+}
+
+
index 2a5c4d7f12b92d71532ccb14aeca5e8dc8973ee2..fa435e5eddd2115221338b74fd018b9442a48c78 100755 (executable)
@@ -38,34 +38,37 @@ class AliAnaRandomTrigger : public AliAnaCaloTrackCorrBaseClass {
   
   void         Print(const Option_t * opt) const;
   
-  void         SetDetector(TString detector)       { fDetector  = detector ; }  
-  
   void         SetEtaCut(Float_t min, Float_t max) { fEtaCut[0] = min ; fEtaCut[1] = max;}
   
   void         SetPhiCut(Float_t min, Float_t max) { fPhiCut[0] = min ; fPhiCut[1] = max;} // radians
   
   void         SetNumberOfRandomParticles(Int_t n) { fNRandom   = n   ; }
   
- private:
+  void         SetTriggerDetector(TString & det) ;
+  void         SetTriggerDetector(Int_t  det)    ;
   
-  TString    fDetector ; // Detector : EMCAL, PHOS, CTS
+ private:
+
+  Int_t      fTriggerDetector ;       // Detector : EMCAL, PHOS, CTS
+  TString    fTriggerDetectorString ; // Detector : EMCAL, PHOS, CTS
   Float_t    fEtaCut[2]; // Eta acceptance
   Float_t    fPhiCut[2]; // Phi acceptance, radians
   TRandom3   fRandom   ; // Random generator
   Int_t      fNRandom  ; // Number of random particles per event
   
+  TLorentzVector fMomentum; //! avoid generating TLorentzVectors per event
+  
   //Constrol histograms 
   TH1F     * fhE;        //! E distribution
   TH1F     * fhPt;       //! pT distribution
   TH2F     * fhPhi;      //! phi distribution vs pT, negative
   TH2F     * fhEta;      //! eta distribution vs pT, negative
-  TH2F     * fhEtaPhi;   //! eta vs phi distribution of positive charge  
-
-
+  TH2F     * fhEtaPhi;   //! eta vs phi distribution of positive charge
+  
   AliAnaRandomTrigger(              const AliAnaRandomTrigger & r) ; // cpy ctor
-  AliAnaRandomTrigger & operator = (const AliAnaRandomTrigger & r) ; //cpy assignment
+  AliAnaRandomTrigger & operator = (const AliAnaRandomTrigger & r) ; // cpy assignment
   
-  ClassDef(AliAnaRandomTrigger,2)
+  ClassDef(AliAnaRandomTrigger,4)
 
 } ;
 
index 0a80aff2a70d229b196bee7f2c23ad057638b743..b7b142c51103ac2f06d062d18b7b8718ae3b3902 100644 (file)
@@ -13,11 +13,10 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskPi0IMGammaCorrQA(const TString  calo
   // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
   
   
-  if(simulation)
+  if(simulation && !suffix.Contains("default"))
   {
     printf("AddTaskPi0IMGammaCorrQA - CAREFUL : Triggered events not checked in simulation!! \n");
-    TString ssuffix = suffix;
-    if(!ssuffix.Contains("default")) return 0x0;
+    return 0x0;
   }
 
   // Get the pointer to the existing analysis manager via the static access method.
@@ -55,7 +54,7 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskPi0IMGammaCorrQA(const TString  calo
   AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
 
   // General frame setting and configuration
-  maker->SetReader   ( ConfigureReader   (inputDataType,minCen,maxCen,simulation,debugLevel) );
+  maker->SetReader   ( ConfigureReader   (inputDataType,collision,minCen,maxCen,simulation,debugLevel) );
   maker->SetCaloUtils( ConfigureCaloUtils(calorimeter,simulation,debugLevel) );
   
   // Analysis tasks setting and configuration
@@ -77,9 +76,8 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskPi0IMGammaCorrQA(const TString  calo
   maker->SetAnaDebug(debugLevel)  ;
   maker->SwitchOnHistogramsMaker()  ;
   maker->SwitchOnAODsMaker() ;
-  if(simulation || !suffix.Contains("EMC"))
-    maker->SwitchOffDataControlHistograms();
-  else
+  maker->SwitchOffDataControlHistograms();
+  if(suffix.Contains("EMC"))
     maker->SwitchOnDataControlHistograms();
 
   if(debugLevel > 0) maker->Print("");
@@ -119,8 +117,8 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskPi0IMGammaCorrQA(const TString  calo
 }
 
 //___________________________________________________________________________
-AliCaloTrackReader * ConfigureReader(TString inputDataType,
-                                     Int_t minCen,          Int_t maxCen,
+AliCaloTrackReader * ConfigureReader(TString inputDataType, TString collision,
+                                     Int_t   minCen,        Int_t maxCen,
                                      Bool_t  simulation,    Int_t debugLevel)
 {
   
@@ -229,9 +227,12 @@ AliCaloTrackReader * ConfigureReader(TString inputDataType,
   reader->SwitchOffPileUpEventRejection();  // remove pileup
   reader->SwitchOffV0ANDSelection() ;       // and besides v0 AND
   
-  reader->SetCentralityBin(minCen,maxCen); // Accept all events, if not select range
-  reader->SetCentralityOpt(100);  // 10 (c= 0-10, 10-20 ...), 20  (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
-
+  if(collision=="PbPb")
+  {
+    reader->SetCentralityBin(minCen,maxCen); // Accept all events, if not select range
+    reader->SetCentralityOpt(100);  // 10 (c= 0-10, 10-20 ...), 20  (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
+  }
+  
   if(debugLevel > 0) reader->Print("");
   
   return reader;
@@ -421,6 +422,8 @@ AliAnaPi0* ConfigurePi0Analysis(TString calorimeter, TString collision,
   ana->SwitchOffFillAngleHisto();
   ana->SwitchOffFillOriginHisto();
 
+  ana->SetNPIDBits(1);
+  
   //Set Histograms name tag, bins and ranges
   
   ana->AddToHistogramsName("AnaPi0_");
index 35e0086fbf835768bf8451b70da7f66a4ce991c5..61d541d0596b277271ee52e5dd8c51ef80aae369 100644 (file)
@@ -96,10 +96,10 @@ void CaloQA()
   ccalo->cd(2);
   //gPad->SetLogy();
   
-  TH1F* hRaw  = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open");
-  TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells");
-  TH1F* hTM   = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching");
-  TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID");
+  TH1F* hRaw  = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_0_Open");
+  TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_4_NCells");
+  TH1F* hTM   = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_7_Matching");
+  TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_9_PID");
   
   hRaw->Sumw2();
   
index 0ba00e3416d62fd6ddbd2e0d83242e89bfff8408..11f67ef4a935bb83cfa6077c535e2714d256c2d4 100644 (file)
@@ -196,17 +196,15 @@ Bool_t AliAnalysisTaskEMCALClusterize::AcceptEventEMCAL()
        fRecoUtils->IsGoodCluster(clus,fGeom,caloCell,bc))
     {
       
-      if (fDebug > 0)
-        printf("AliAnalysisTaskEMCALClusterize::AcceptEventEMCAL() - Accept :  E %2.2f > %2.2f, nCells %d > %d \n",
-               clus->E(), fEMCALEnergyCut, clus->GetNCells(), fEMCALNcellsCut);
+      AliDebug(1, Form("Accept :  E %2.2f > %2.2f, nCells %d > %d",
+                       clus->E(), fEMCALEnergyCut, clus->GetNCells(), fEMCALNcellsCut));
       
       return kTRUE;
     }
     
   }// loop
   
-  if (fDebug > 0)
-    printf("AliAnalysisTaskEMCALClusterize::AcceptEventEMCAL() - Reject \n");
+  AliDebug(1,"Reject");
   
   return kFALSE;
   
@@ -224,7 +222,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
   Int_t   runnumber = InputEvent()->GetRunNumber() ;
   TString pass      = GetPass();
   
-  printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Get AODB parameters from EMCAL in %s for run %d, and <%s> \n",fOADBFilePath.Data(),runnumber,pass.Data());
+  AliInfo(Form("Get AODB parameters from EMCAL in %s for run %d, and <%s>",fOADBFilePath.Data(),runnumber,pass.Data()));
   
   Int_t nSM = fGeom->GetNumberOfSuperModules();
   
@@ -239,7 +237,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
     if(arrayBC)
     {
         fRecoUtils->SwitchOnDistToBadChannelRecalculation();
-        printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Remove EMCAL bad cells \n");
+        AliInfo("Remove EMCAL bad cells");
         
         for (Int_t i=0; i<nSM; ++i) 
         {
@@ -260,7 +258,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
           fRecoUtils->SetEMCALChannelStatusMap(i,hbm);
           
         } // loop
-    } else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT remove EMCAL bad channels\n"); // run array
+    } else AliInfo("Do NOT remove EMCAL bad channels"); // run array
   }  // Remove bad
   
   // Energy Recalibration
@@ -282,7 +280,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
         
         if(recalib)
         {
-          printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Recalibrate EMCAL \n");
+          AliInfo("Recalibrate EMCAL");
           for (Int_t i=0; i<nSM; ++i) 
           {
             TH2F *h = fRecoUtils->GetEMCALChannelRecalibrationFactors(i);
@@ -302,9 +300,9 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
             
             fRecoUtils->SetEMCALChannelRecalibrationFactors(i,h);
           } // SM loop
-        }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params object array \n"); // array ok
-      }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for pass\n"); // array pass ok
-    }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n");  // run number array ok
+        } else AliInfo("Do NOT recalibrate EMCAL, no params object array"); // array ok
+      } else AliInfo("Do NOT recalibrate EMCAL, no params for pass"); // array pass ok
+    } else AliInfo("Do NOT recalibrate EMCAL, no params for run");  // run number array ok
         
   } // Recalibration on
   
@@ -343,7 +341,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
 
     if(htd)
     {
-      printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+      AliInfo("Recalibrate (Temperature) EMCAL");
       
       for (Int_t ism=0; ism<nSM; ++ism) 
       {        
@@ -361,7 +359,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
           } // columns
         } // rows 
       } // SM loop
-    }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n"); 
+    } else AliInfo("Do NOT recalibrate EMCAL with T variations, no params TH1");
   } // Run by Run T calibration
   
   // Time Recalibration
@@ -381,7 +379,7 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
 
       if(trecalpass)
       {
-        printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Time Recalibrate EMCAL \n");
+        AliInfo("Time Recalibrate EMCAL");
         for (Int_t ibc = 0; ibc < 4; ++ibc) 
         {
           TH1F *h = fRecoUtils->GetEMCALChannelTimeRecalibrationFactors(ibc);
@@ -401,8 +399,8 @@ void AliAnalysisTaskEMCALClusterize::AccessOADB()
           
           fRecoUtils->SetEMCALChannelTimeRecalibrationFactors(ibc,h);
         } // bunch crossing loop
-      }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate time EMCAL, no params for pass\n"); // array pass ok
-    }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate time EMCAL, no params for run\n");  // run number array ok
+      } else AliInfo("Do NOT recalibrate time EMCAL, no params for pass"); // array pass ok
+    } else AliInfo("Do NOT recalibrate time EMCAL, no params for run");  // run number array ok
     
   } // Time recalibration on    
   
@@ -427,8 +425,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
     return kTRUE;
   fRun = fEvent->GetRunNumber();
   
-  if(DebugLevel() > 1 )
-    printf("AliAnalysisTaksEMCALClusterize::AccessOCDB() - Begin");
+  AliDebug(1,"Begin");
   
   AliCDBManager *cdb = AliCDBManager::Instance();
   
@@ -436,7 +433,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::AccessOCDB()
   if (fOCDBpath.Length())
   {
     cdb->SetDefaultStorage(fOCDBpath.Data());
-    printf("AliAnalysisTaksEMCALClusterize::AccessOCDB() - Default storage %s",fOCDBpath.Data());
+    AliInfo(Form("Default storage %s",fOCDBpath.Data()));
   }
   
   cdb->SetRun(fEvent->GetRunNumber());
@@ -499,32 +496,32 @@ void AliAnalysisTaskEMCALClusterize::CheckAndGetEvent()
   
   //Check if input event are embedded events
   //If so, take output event
-  if (aodIH && aodIH->GetMergeEvents()) 
+  if (aodIH && aodIH->GetMergeEvents())
   {
     fEvent  = AODEvent();
     
-    if(!aodIH->GetMergeEMCALCells()) 
+    if(!aodIH->GetMergeEMCALCells())
       AliFatal("Events merged but not EMCAL cells, check analysis settings!");
     
-    if(DebugLevel() > 1)
-    {
-      printf("AliAnalysisTaksEMCALClusterize::UserExec() - Use embedded events\n");
-      
-      printf("\t InputEvent  N Clusters %d, N Cells %d\n",InputEvent()->GetNumberOfCaloClusters(),
-             InputEvent()->GetEMCALCells()->GetNumberOfCells());
-      
-      printf("\t MergedEvent  N Clusters %d, N Cells %d\n",aodIH->GetEventToMerge()->GetNumberOfCaloClusters(),
-             aodIH->GetEventToMerge()->GetEMCALCells()->GetNumberOfCells());
-      
-      for (Int_t icl=0; icl < aodIH->GetEventToMerge()->GetNumberOfCaloClusters(); icl++) 
-      {
-        AliAODCaloCluster *sigCluster = aodIH->GetEventToMerge()->GetCaloCluster(icl);
-        if(sigCluster->IsEMCAL()) printf("\t \t Signal cluster: i %d, E  %f\n",icl,sigCluster->E());
-      }
-      
-      printf("\t OutputEvent N Clusters %d, N Cells %d\n", AODEvent()->GetNumberOfCaloClusters(),
-             AODEvent()->GetEMCALCells()->GetNumberOfCells());
-    }
+    AliDebug(1,"Use embedded events");
+    
+    AliDebug(1,Form("\t InputEvent  N Clusters %d, N Cells %d",
+                    InputEvent()->GetNumberOfCaloClusters(),InputEvent()->GetEMCALCells()->GetNumberOfCells()));
+    
+    AliDebug(1,Form("\t MergedEvent  N Clusters %d, N Cells %d",
+                    aodIH->GetEventToMerge()->GetNumberOfCaloClusters(), aodIH->GetEventToMerge()->GetEMCALCells()->GetNumberOfCells()));
+    
+//    if(DebugLevel() > 1)
+//    {
+//      for (Int_t icl=0; icl < aodIH->GetEventToMerge()->GetNumberOfCaloClusters(); icl++)
+//      {
+//        AliAODCaloCluster *sigCluster = aodIH->GetEventToMerge()->GetCaloCluster(icl);
+//        if(sigCluster->IsEMCAL()) AliInfo(Form("\t \t Signal cluster: i %d, E  %f",icl,sigCluster->E()));
+//      }
+//    }
+    
+    AliDebug(1,Form("\t OutputEvent N Clusters %d, N Cells %d",
+                    AODEvent()->GetNumberOfCaloClusters(), AODEvent()->GetEMCALCells()->GetNumberOfCells()));
   }
   else if(fInputFromFilter)
   {
@@ -540,7 +537,7 @@ void AliAnalysisTaskEMCALClusterize::CheckAndGetEvent()
   
   if (!fEvent) 
   {
-    Error("UserExec","Event not available");
+    AliError("Event not available");
     return ;
   }
   
@@ -570,7 +567,7 @@ void AliAnalysisTaskEMCALClusterize::CheckAndGetEvent()
     // Create array and put it in the input event, if output AOD not selected, only once
     InputEvent()->AddObject(fOutputAODBranch);
     fOutputAODBranchSet = kTRUE;
-    printf("AliAnalysisTaskEMCALClusterize::UserExec() - Add AOD branch <%s> to input event\n",fOutputAODBranchName.Data());
+    AliInfo(Form("Add AOD branch <%s> to input event",fOutputAODBranchName.Data()));
   }
   
 }
@@ -663,9 +660,8 @@ void AliAnalysisTaskEMCALClusterize::ClusterizeCells()
     
     if( !accept )
     {
-      if( DebugLevel() > 2 )
-        printf("AliAnalysisTaksEMCALClusterize::ClusterizeCells() - Remove channel absId %d, index %d of %d, amp %f, time %f\n",
-               id,icell, cells->GetNumberOfCells(), amp, time*1.e9);
+        AliDebug(2,Form("Remove channel absId %d, index %d of %d, amp %f, time %f",
+               id,icell, cells->GetNumberOfCells(), amp, time*1.e9));
       continue;
     }
     
@@ -712,21 +708,20 @@ void AliAnalysisTaskEMCALClusterize::ClusterizeCells()
   
   if(!fCaloClusterArr)
   { 
-    printf("AliAnalysisTaksEMCALClusterize::UserExec() - No array with CaloClusters, input RecPoints entries %d\n",fClusterArr->GetEntriesFast());
+    AliWarning(Form("No array with CaloClusters, input RecPoints entries %d",fClusterArr->GetEntriesFast()));
     return;    
   }
   
-  if( DebugLevel() > 0 )
-  {
-    printf("AliAnalysisTaksEMCALClusterize::ClusterizeCells() - N clusters: before recluster %d, after recluster %d\n",nClustersOrg, fCaloClusterArr->GetEntriesFast());
-    
-    if(fCaloClusterArr->GetEntriesFast() != fClusterArr->GetEntriesFast())
-    {
-      printf("\t Some RecRoints not transformed into CaloClusters (clusterizer %d, unfold %d): Input entries %d - Output entries %d - %d (not fast)\n",
-             fRecParam->GetClusterizerFlag(),fRecParam->GetUnfold(),
-             fClusterArr->GetEntriesFast(), fCaloClusterArr->GetEntriesFast(), fCaloClusterArr->GetEntries());
-    }
-  }
+  AliDebug(1,Form("N clusters: before recluster %d, after recluster %d, recpoints %d",
+                  nClustersOrg, fCaloClusterArr->GetEntriesFast(),fClusterArr->GetEntriesFast()));
+  
+//    if(fCaloClusterArr->GetEntriesFast() != fClusterArr->GetEntriesFast())
+//    {
+//      AliInfo("\t Some RecRoints not transformed into CaloClusters (clusterizer %d, unfold %d): Input entries %d - Output entries %d - %d (not fast)\n",
+//             fRecParam->GetClusterizerFlag(),fRecParam->GetUnfold(),
+//             fClusterArr->GetEntriesFast(), fCaloClusterArr->GetEntriesFast(), fCaloClusterArr->GetEntries());
+//    }
+  
 }
 
 //_____________________________________________________
@@ -792,7 +787,7 @@ void AliAnalysisTaskEMCALClusterize::ClusterUnfolding()
         fCaloClusterArr->Add( new AliAODCaloCluster(*aodCluster) );   
       }//AOD
       else 
-        Warning("UserExec()"," - Wrong CaloCluster type?");
+        AliWarning("Wrong CaloCluster type?");
       
       nClustersOrg++;
     }
@@ -970,7 +965,7 @@ void AliAnalysisTaskEMCALClusterize::FillCaloClusterInEvent()
     
     newCluster->SetID(i);
     
-    // Correct cluster energy non linearity    
+    // Correct cluster energy non linearity
     newCluster->SetE(fRecoUtils->CorrectClusterEnergyLinearity(newCluster));
     
     //Add matched track
@@ -980,8 +975,7 @@ void AliAnalysisTaskEMCALClusterize::FillCaloClusterInEvent()
       if(trackIndex >= 0)
       {
         newCluster->AddTrackMatched(fEvent->GetTrack(trackIndex));
-        if(DebugLevel() > 1) 
-          printf("AliAnalysisTaksEMCALClusterize::UserExec() - Matched Track index %d to new cluster %d \n",trackIndex,i);
+        AliDebug(2,Form("Matched Track index %d to new cluster %d",trackIndex,i));
       }
       
       Float_t dR = 999., dZ = 999.;
@@ -989,7 +983,7 @@ void AliAnalysisTaskEMCALClusterize::FillCaloClusterInEvent()
       newCluster->SetTrackDistance(dR,dZ);
       
     }
-    else 
+    else
     {// Assign previously assigned matched track in reco, very very rough
       Int_t absId0 = newCluster->GetCellsAbsId()[0]; // Assign match of first cell in cluster
       newCluster->SetTrackDistance(fCellMatchdPhi[absId0],fCellMatchdEta[absId0]);
@@ -1004,8 +998,8 @@ void AliAnalysisTaskEMCALClusterize::FillCaloClusterInEvent()
     
     new((*fOutputAODBranch)[i])  AliAODCaloCluster(*newCluster);
     
-    if(DebugLevel() > 1 )
-      printf("AliAnalysisTaksEMCALClusterize::UserExec() - New cluster %d of %d, energy %f, mc label %d \n",newCluster->GetID(), kNumberOfCaloClusters, newCluster->E(), newCluster->GetLabel());
+    AliDebug(2,Form("New cluster %d of %d, energy %f, mc label %d",
+                    newCluster->GetID(), kNumberOfCaloClusters, newCluster->E(), newCluster->GetLabel()));
     
   } // cluster loop
   
@@ -1021,13 +1015,13 @@ TString AliAnalysisTaskEMCALClusterize::GetPass()
   
   if (!AliAnalysisManager::GetAnalysisManager()->GetTree()) 
   {
-    AliError("AliAnalysisTaskEMCALClusterize::GetPass() - Pointer to tree = 0, returning null\n");
+    AliError("AliAnalysisTaskEMCALClusterize::GetPass() - Pointer to tree = 0, returning null");
     return TString("");
   }
   
   if (!AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()) 
   {
-    AliError("AliAnalysisTaskEMCALClusterize::GetPass() - Null pointer input file, returning null\n");
+    AliError("AliAnalysisTaskEMCALClusterize::GetPass() - Null pointer input file, returning null");
     return TString("");
   }
   
@@ -1040,12 +1034,12 @@ TString AliAnalysisTaskEMCALClusterize::GetPass()
   else if (pass.Contains("LHC11c") && pass.Contains("spc_calo") ) return TString("spc_calo");
   else if (pass.Contains("calo") || pass.Contains("high_lumi"))
   {
-    printf("AliAnalysisTaskEMCALClusterize::GetPass() - Path contains <calo> or <high-lumi>, set as <pass1>\n");
+    printf("AliAnalysisTaskEMCALClusterize::GetPass() - Path contains <calo> or <high-lumi>, set as <pass1>");
     return TString("pass1");
   }
   
   // No condition fullfilled, give a default value
-  printf("AliAnalysisTaskEMCALClusterize::GetPass() - Pass number string not found \n");
+  AliInfo("Pass number string not found");
   return TString("");            
   
 }
@@ -1055,6 +1049,8 @@ void AliAnalysisTaskEMCALClusterize::Init()
 {
   //Init analysis with configuration macro if available
   
+  if(fDebug >=0) (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
+
   fOADBSet           = kFALSE;
   if(fOADBFilePath == "") fOADBFilePath = "$ALICE_ROOT/OADB/EMCAL" ;          
   
@@ -1076,7 +1072,7 @@ void AliAnalysisTaskEMCALClusterize::Init()
   
   if(gROOT->LoadMacro(fConfigName) >=0)
   {
-    printf("AliAnalysisTaksEMCALClusterize::Init() - Configure analysis with %s\n",fConfigName.Data());
+    AliInfo(Form("Configure analysis with %s",fConfigName.Data()));
     AliAnalysisTaskEMCALClusterize *clus = (AliAnalysisTaskEMCALClusterize*)gInterpreter->ProcessLine("ConfigEMCALClusterize()");
     fGeomName         = clus->fGeomName; 
     fLoadGeomMatrices = clus->fLoadGeomMatrices;
@@ -1181,8 +1177,7 @@ void AliAnalysisTaskEMCALClusterize::InitGeometry()
       if     (runnumber < 140000) fGeomName = "EMCAL_FIRSTYEARV1";
       else if(runnumber < 171000) fGeomName = "EMCAL_COMPLETEV1";
       else                        fGeomName = "EMCAL_COMPLETE12SMV1";  
-      printf("AliAnalysisTaskEMCALClusterize::InitGeometry() - Set EMCAL geometry name to <%s> for run %d\n",
-             fGeomName.Data(),runnumber);
+      AliInfo(Form("Set EMCAL geometry name to <%s> for run %d",fGeomName.Data(),runnumber));
     }
     
                fGeom = AliEMCALGeometry::GetInstance(fGeomName);
@@ -1199,36 +1194,30 @@ void AliAnalysisTaskEMCALClusterize::InitGeometry()
                 runnumber <  171000) fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root";
         else                         fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2012.root"; // 2012-2013
       }
-      printf("AliAnalysisTaskEMCALClusterize::InitGeometry() - Import %s\n",fImportGeometryFilePath.Data());
+      
+      AliInfo(Form("Import %s",fImportGeometryFilePath.Data()));
       TGeoManager::Import(fImportGeometryFilePath) ;
     }
 
-               if(fDebug > 0)
-    {
-                       printf("AliAnalysisTaskEMCALClusterize::InitGeometry(run=%d)",runnumber);
-                       if (!gGeoManager) printf(" - Careful!, gGeoManager not loaded, load misalign matrices");
-                       printf("\n");
-               }
+    AliDebug(1,Form("Init for run=%d",runnumber));
+    if (!gGeoManager) AliDebug(1,"Careful!, gGeoManager not loaded, load misalign matrices");
        } // geometry pointer did not exist before
   
   if(fLoadGeomMatrices)
   {
-    printf("AliAnalysisTaskEMCALClusterize::InitGeometry() - Load user defined EMCAL geometry matrices\n");
+    AliInfo("Load user defined EMCAL geometry matrices");
     
     // OADB if available
     AliOADBContainer emcGeoMat("AliEMCALgeo");
     emcGeoMat.InitFromFile(Form("%s/EMCALlocal2master.root",fOADBFilePath.Data()),"AliEMCALgeo");
     TObjArray *matEMCAL=(TObjArray*)emcGeoMat.GetObject(runnumber,"EmcalMatrices");
     
-    
     for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
     {
       
       if (!fGeomMatrix[mod]) // Get it from OADB
       {
-        if(fDebug > 1 ) 
-          printf("AliAnalysisTaskEMCALClusterize::InitGeometry() - EMCAL matrices SM %d, %p\n",
-                 mod,((TGeoHMatrix*) matEMCAL->At(mod)));
+        AliDebug(2,Form("EMCAL matrices SM %d, %p",mod,((TGeoHMatrix*) matEMCAL->At(mod))));
         //((TGeoHMatrix*) matEMCAL->At(mod))->Print();
         
         fGeomMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod) ;
@@ -1248,12 +1237,11 @@ void AliAnalysisTaskEMCALClusterize::InitGeometry()
   }//Load matrices
   else if(!gGeoManager)
   {
-    printf("AliAnalysisTaksEMCALClusterize::InitGeometry() - Get geo matrices from data");
+    AliInfo("AliAnalysisTaksEMCALClusterize::InitGeometry() - Get geo matrices from data");
     //Still not implemented in AOD, just a workaround to be able to work at least with ESDs    
     if(!strcmp(fEvent->GetName(),"AliAODEvent")) 
     {
-      if(DebugLevel() > 1) 
-        Warning("UserExec","Use ideal geometry, values geometry matrix not kept in AODs.");
+      AliWarning("Use ideal geometry, values geometry matrix not kept in AODs");
     }//AOD
     else 
     {  
@@ -1264,7 +1252,7 @@ void AliAnalysisTaskEMCALClusterize::InitGeometry()
       
       if(!esd)
       {
-        Error("InitGeometry"," - This event does not contain ESDs?");
+        AliError("This event does not contain ESDs?");
         if(fFillAODFile) AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kFALSE);
         return;
       }
@@ -1347,7 +1335,7 @@ Bool_t AliAnalysisTaskEMCALClusterize::IsLEDEvent(const Int_t run)
   
   if( ncellsSM3 >= ncellcut)
   {
-    printf("AliAnalysisTaksEMCALClusterize::IsLEDEvent() - reject event %d with ncells in SM3 %d\n",(Int_t)Entry(),ncellsSM3);
+    AliInfo(Form("Reject event %d with ncells in SM3 %d",(Int_t)Entry(),ncellsSM3));
     if(fFillAODFile) AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kFALSE);;
     return kTRUE;
   }
@@ -1393,12 +1381,9 @@ void AliAnalysisTaskEMCALClusterize::RecPoints2Clusters()
       {
         if     (recPoint->GetEnergiesList()[c] < fSelectCellMinE || ratios[ncellsTrue] < fSelectCellMinFrac)  
         {
-          if(DebugLevel() > 1)
-          {
-            printf("AliAnalysisTaksEMCALClusterize::RecPoints2Clusters() - Too small energy in cell of cluster: cluster cell %f, digit %f\n",
-                   recPoint->GetEnergiesList()[c],digit->GetAmplitude());
-          }
-          
+         
+          AliDebug(2,Form("Too small energy in cell of cluster: cluster cell %f, digit %f",
+                          recPoint->GetEnergiesList()[c],digit->GetAmplitude()));
           continue;
           
         } // if cuts
@@ -1430,9 +1415,8 @@ void AliAnalysisTaskEMCALClusterize::RecPoints2Clusters()
     
     if (ncellsTrue < 1) 
     {
-      if (DebugLevel() > 1) 
-        printf("AliAnalysisTaskEMCALClusterize::RecPoints2Clusters() - Skipping cluster with no cells avobe threshold E = %f, ncells %d\n",
-               recPoint->GetEnergy(), ncells);
+        AliDebug(2,Form("Skipping cluster with no cells avobe threshold E = %f, ncells %d",
+                        recPoint->GetEnergy(), ncells));
       continue;
     }
     
@@ -1440,8 +1424,7 @@ void AliAnalysisTaskEMCALClusterize::RecPoints2Clusters()
     
     if(clusterE <  fRecParam->GetClusteringThreshold()) 
     {
-      if (DebugLevel()>1)
-        printf("AliAnalysisTaskEMCALClusterize::RecPoints2Clusters() - Remove cluster with energy below seed threshold %f\n",clusterE);
+      AliDebug(2,Form("Remove cluster with energy below seed threshold %f",clusterE));
       continue;
     }
     
@@ -1482,8 +1465,7 @@ void AliAnalysisTaskEMCALClusterize::RecPoints2Clusters()
     {
       // In case some cells rejected, in unfolding case, recalculate
       // shower shape parameters and position
-      if(DebugLevel() > 1) 
-        printf("AliAnalysisTaskEMCALClusterize::RecPoints2Clusters() - Cells removed from cluster (ncells %d, ncellsTrue %d), recalculate Shower Shape\n",ncells,ncellsTrue);
+      AliDebug(2,Form("Cells removed from cluster (ncells %d, ncellsTrue %d), recalculate Shower Shape",ncells,ncellsTrue));
       
       AliVCaloCells* cells = 0x0; 
       if (aodIH && aodIH->GetMergeEvents()) cells = AODEvent()  ->GetEMCALCells();
@@ -1754,7 +1736,7 @@ void AliAnalysisTaskEMCALClusterize::UserCreateOutputObjects()
   if(fOutputAODBranchName.Length()==0)
   {
     fOutputAODBranchName = "newEMCALClustersArray";
-    printf("Cluster branch name not set, set it to newEMCALClustersArray \n");
+    printf("Cluster branch name not set, set it to newEMCALClustersArray");
   }
   
   fOutputAODBranch->SetName(fOutputAODBranchName);
@@ -1787,7 +1769,6 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   
   //-------
   // Step 1
-  
 
   //Remove the contents of AOD branch output list set in the previous event 
   fOutputAODBranch->Clear("C");
@@ -1813,7 +1794,7 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   
   if (!fEvent) 
   {
-    if(DebugLevel() > 0 ) printf("AliAnalysisTaksEMCALClusterize::UserExec() - Skip Event %d", (Int_t) Entry());
+    AliDebug(1,Form("Skip Event %d", (Int_t) Entry()));
     return ;
   }
 
@@ -1837,5 +1818,6 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   
   FillCaloClusterInEvent();
   
-}      
+}
+
 
index a9baa0d5e2f17325392fde6671aa28bf196d8c7e..53ab4bcb3447722f70d73b4dc5562e9395145a4e 100644 (file)
@@ -156,7 +156,7 @@ private:
   virtual void   RecPoints2Clusters();
   
   virtual void   ResetArrays();
-  
+    
   AliVEvent             *fEvent;                   // Event 
   
   //Geometry  
index 78cabcc0c16eeed754cc623a4c94a6431acd87b4..029150d45b901aa8bceeee44b562624de8118b77 100644 (file)
@@ -94,6 +94,7 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton() :
   fPileUpRejSPD(kFALSE),
   fDistToBadChan(0),
   fInConeInvMass(""),
+  fInConePairClEt(""),
   fESD(0),
   fAOD(0),
   fVEvent(0),
@@ -127,7 +128,7 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton() :
   fAllIsoEtMcGamma(0),
   fAllIsoNoUeEtMcGamma(0),
   fMCDirPhotonPtEtaPhiNoClus(0),
-  fInvMassWithConeVsEtAndIso(0),
+  fEtCandIsoAndIsoWoPairEt(0),
   fInConePairedClusEtVsCandEt(0),
   fHnOutput(0),
   fQAList(0),
@@ -209,6 +210,7 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton(const char *name) :
   fPileUpRejSPD(kFALSE),
   fDistToBadChan(0),
   fInConeInvMass(""),
+  fInConePairClEt(""),
   fESD(0),
   fAOD(0),
   fVEvent(0),
@@ -242,7 +244,7 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton(const char *name) :
   fAllIsoEtMcGamma(0),
   fAllIsoNoUeEtMcGamma(0),
   fMCDirPhotonPtEtaPhiNoClus(0),
-  fInvMassWithConeVsEtAndIso(0),
+  fEtCandIsoAndIsoWoPairEt(0),
   fInConePairedClusEtVsCandEt(0),
   fHnOutput(0),
   fQAList(0),
@@ -385,22 +387,23 @@ void AliAnalysisTaskEMCALIsoPhoton::UserCreateOutputObjects()
   fMCDirPhotonPtEtaPhiNoClus = new TH3F("hMCDirPhotonPhiEtaNoClus","p_{T}, #eta and  #phi of prompt photons with no reco clusters;p_{T};#eta;#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,154,-0.77,0.77,130,1.38,3.20);
   fOutputList->Add(fMCDirPhotonPtEtaPhiNoClus);
 
-  fInvMassWithConeVsEtAndIso = new TH3F("hInvMassWithConeVsEtAndIso","M_{cand+in_cone_clus} vs E_{T}^{cand} vs. E_{T}^{ISO} (EMC+Trk) (0.1<M02<0.3 only)",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,400,0,1,1000,0,200);
-  fOutputList->Add(fInvMassWithConeVsEtAndIso);
+  fEtCandIsoAndIsoWoPairEt = new TH3F("hEtCandIsoAndIsoWoPairEt","E_{T}^{cand} vs. E_{T}^{ISO} (EMC+Trk) (0.1<M02<0.3, 0.110<m_{#gamma#gamma}<0.165 only);E_{T}^{cand}; E_{T}^{ISO}; E_{T}^{ISO} (w/o #pi^{0} pair E_{T})",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,1000,0,200,1000,0,200);
+  fOutputList->Add(fEtCandIsoAndIsoWoPairEt);
 
   fInConePairedClusEtVsCandEt = new TH2F("hInConePairedClusEtVsCandEt","E_{T}^{partner} vs. E_{T}^{cand} (R<0.4, 0.110<m_{#gamma#gamma}<0.165);E_{T}^{cand};E_{T}^{partner}",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,200,0,40);
   fOutputList->Add(fInConePairedClusEtVsCandEt);
 
-  Int_t nEt=fNBinsPt*5, nM02=400, nCeIso=1000, nTrIso=1000,  nAllIso=1000,  nCeIsoNoUE=1000,  nAllIsoNoUE=1000, nTrClDphi=200, nTrClDeta=100, nClEta=140, nClPhi=128, nTime=60, nMult=100, nPhoMcPt=fNBinsPt;
-  Int_t bins[] = {nEt, nM02, nCeIso, nTrIso, nAllIso, nCeIsoNoUE, nAllIsoNoUE, nTrClDphi, nTrClDeta,nClEta,nClPhi,nTime,nMult,nPhoMcPt};
+  Int_t nEt=fNBinsPt*5, nM02=400, nCeIso=1000, nTrIso=1000,  nAllIso=1000,  nCeIsoNoUE=1000,  nAllIsoNoUE=1000, nTrClDphi=200, nTrClDeta=100, nClEta=140, nClPhi=128, nTime=60, nMult=100, nPhoMcPt=fNBinsPt, nInConeMass=100;
+  Int_t bins[] = {nEt, nM02, nCeIso, nTrIso, nAllIso, nCeIsoNoUE, nAllIsoNoUE, nTrClDphi, nTrClDeta,nClEta,nClPhi,nTime,nMult,nPhoMcPt,nInConeMass};
   fNDimensions = sizeof(bins)/sizeof(Int_t);
   const Int_t ndims =   fNDimensions;
-  Double_t xmin[] = { fPtBinLowEdge,   0.,  -10.,   -10., -10., -10., -10., -0.1,-0.05, -0.7, 1.4,-0.15e-06,-0.5,fPtBinLowEdge};
-  Double_t xmax[] = { fPtBinHighEdge, 4., 190., 190., 190.,  190., 190., 0.1, 0.05, 0.7, 3.192, 0.15e-06,99.5,fPtBinHighEdge};
+  Double_t xmin[] = { fPtBinLowEdge,   0.,  -10.,   -10., -10., -10., -10., -0.1,-0.05, -0.7, 1.4,-0.15e-06,-0.5,fPtBinLowEdge,0.0};
+  Double_t xmax[] = { fPtBinHighEdge, 4., 190., 190., 190.,  190., 190., 0.1, 0.05, 0.7, 3.192, 0.15e-06,99.5,fPtBinHighEdge, 1.0};
   if(fPeriod.Contains("11h")){
     xmax[12]=3999.5;
   }
   fHnOutput =  new THnSparseF("fHnOutput","Output matrix: E_{T},M02,CeIso,TrIso,AllIso, CeIsoNoUESub, AllIsoNoUESub, d#phi_{trk},d#eta_{trk},#eta_{clus},#phi_{clus},T_{max},mult,mc-p_{T}^{#gamma}", ndims, bins, xmin, xmax);
+  fHnOutput->Sumw2();
   fOutputList->Add(fHnOutput);
 
   //QA outputs
@@ -789,19 +792,28 @@ void AliAnalysisTaskEMCALIsoPhoton::FillClusHists()
       isCPV = kTRUE;
     GetCeIso(clsVec, id, ceiso, cephiband, cecore, Et);
     GetTrIso(clsVec, triso, trphiband, trcore);
+    Int_t nInConePairs = 0;
+    Double_t onePairMass = 0;
     if(c->GetM02()>0.1 && c->GetM02()<0.3 && isCPV){
       TObjArray *inConeInvMassArr = (TObjArray*)fInConeInvMass.Tokenize(";");
-      Int_t nInConePairs = inConeInvMassArr->GetEntriesFast();
-      Double_t *inConeInvMass = new Double_t[nInConePairs];
+      TObjArray *inConePairClEt =  (TObjArray*)fInConePairClEt.Tokenize(";");
+      nInConePairs = inConeInvMassArr->GetEntriesFast();
+      Int_t nInConePi0 = inConePairClEt->GetEntriesFast();
+      if(nInConePairs != nInConePi0)
+       printf("Inconsistent number of in cone pairs!!!\n");
       for(int ipair=0;ipair<nInConePairs;ipair++){
        TObjString *obs = (TObjString*)inConeInvMassArr->At(ipair);
+       TObjString *obet = (TObjString*)inConePairClEt->At(ipair);
        TString smass = obs->GetString();
+       TString spairEt = obet->GetString();
        Double_t pairmass = smass.Atof();
+       Double_t pairEt = spairEt.Atof();//this must be zero when inv mass outside pi0 range
+       if(0==ipair && nInConePairs==1)
+         onePairMass = pairmass;
        if(fDebug)
          printf("=================+++++++++++++++Inv mass inside the cone for photon range: %1.1f,%1.1f,%1.1f+-++++-+-+-+-++-+-+-\n",Et,pairmass,ceiso+triso);
-       fInvMassWithConeVsEtAndIso->Fill(Et,pairmass,ceiso+triso);
+       fEtCandIsoAndIsoWoPairEt->Fill(Et,ceiso+triso,ceiso+triso-pairEt);
       }
-      delete [] inConeInvMass;
     }
     Double_t dr = TMath::Sqrt(c->GetTrackDx()*c->GetTrackDx() + c->GetTrackDz()*c->GetTrackDz());
     if(Et>10 && Et<15 && dr>0.025){
@@ -867,6 +879,10 @@ void AliAnalysisTaskEMCALIsoPhoton::FillClusHists()
       outputValues[11] = fAODCells->GetCellTime(id);
     outputValues[12] = fTrackMult;
     outputValues[13] = ptmc;
+    if(nInConePairs == 1)
+      outputValues[14] = onePairMass;
+    else
+      outputValues[14] = -1;
     fHnOutput->Fill(outputValues);
     if(c->E()>maxE)
       maxE = c->E();
@@ -902,6 +918,7 @@ void AliAnalysisTaskEMCALIsoPhoton::GetCeIso(TVector3 vec, Int_t maxid, Float_t
     return;
   
   fInConeInvMass = "";
+  fInConePairClEt="";
   const Int_t nclus = clusters->GetEntries();
   //const Int_t ncells = cells->GetNumberOfCells();
   Float_t totiso=0;
@@ -975,9 +992,13 @@ void AliAnalysisTaskEMCALIsoPhoton::GetCeIso(TVector3 vec, Int_t maxid, Float_t
        lv.SetPtEtaPhiM(Et,cv.Eta(),cv.Phi(),0);
        lvec.SetPtEtaPhiM(EtCl,vec.Eta(),vec.Phi(),0);
        TLorentzVector lpair = lv + lvec;
-       fInConeInvMass += Form(";%f",lpair.M());
-       if(lpair.M()>0.11 && lpair.M()<0.165)
+       fInConeInvMass += Form("%f;",lpair.M());
+       if(lpair.M()>0.11 && lpair.M()<0.165){
          fInConePairedClusEtVsCandEt->Fill(EtCl,Et);
+         fInConePairClEt += Form("%f;",Et);
+       }
+       else 
+         fInConePairClEt += Form("%f;",0.0);
       }
       if(R<0.04)
        totcore += nEt;
index db7e2d7dae306176c081e2e56fbbfe053d51914e..109f01d2ebb70c5736fc8518c14caa1d25a36892 100644 (file)
@@ -128,6 +128,7 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   Bool_t                 fPileUpRejSPD;          // flag to set pile-up rejection via SPD (multiple vertices)
   Double_t               fDistToBadChan;         // distance to bad channel
   TString                fInConeInvMass;         // string to hold the array of inv. mass values of the candidate with isolation clusters
+  TString                fInConePairClEt;        // string to hold the array of Et of paired clusters in the pi0 mass (isolation clusters pairs only)
   
  private:
   AliESDEvent *fESD;      //! ESD object
@@ -165,7 +166,7 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   TH2F        *fAllIsoEtMcGamma;           //!all iso distribution vs. Et clus for clusters comming from a MC prompt photon
   TH2F        *fAllIsoNoUeEtMcGamma;       //!all iso distribution (without UE subtraction) vs. Et clus for clusters comming from a MC prompt photon
   TH3F        *fMCDirPhotonPtEtaPhiNoClus; //!pt x eta x phi for prompt photons that didn't produce clusters
-  TH3F        *fInvMassWithConeVsEtAndIso; //!Candidate Et vs. Inv Mass with in cone cluster vs. Iso(EMC+trk), only for 0.1<M02<0.3 clusters
+  TH3F        *fEtCandIsoAndIsoWoPairEt;   //!Candidate Et vs. isolation with and w/o the Et of the paired cluster in the pi0 mass, only for 0.1<M02<0.3 clusters
   TH2F        *fInConePairedClusEtVsCandEt;//!Et of the paired cluster (0.11<m<0.165 GeV) vs. candidate Et
   THnSparse   *fHnOutput;                  //!Output matrix with 7 dimensions
 
index 9836af29664eee8eda2df5bf703df9c94bc7b987..eb623a1b8887b5193491086e92adea8fb63c3656 100644 (file)
@@ -510,7 +510,7 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
-               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
+               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){ 
                        TString TriggerNames = "Not Trigger: ";
                        TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
                        fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
@@ -578,10 +578,10 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
                                SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
-                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
-                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
                        }
index cf35b3669fe6045ff1b9812ddbd48bc52e00f2aa..e24b9cecd72a054ebfc27b5004bd13f132ed4a7c 100644 (file)
@@ -113,6 +113,8 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(
        fHistoMotherEtaPtAlpha(NULL),
        fHistoMotherPi0PtOpenAngle(NULL),
        fHistoMotherEtaPtOpenAngle(NULL),
+    fHistoMotherPi0ConvPhotonEtaPhi(NULL),
+    fHistoMotherEtaConvPhotonEtaPhi(NULL),
        fHistoMotherInvMassECalib(NULL),
        fHistoMotherInvMassECalibalpha(NULL),
        fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
@@ -312,6 +314,8 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
        fHistoMotherEtaPtAlpha(NULL),
        fHistoMotherPi0PtOpenAngle(NULL),
        fHistoMotherEtaPtOpenAngle(NULL),
+    fHistoMotherPi0ConvPhotonEtaPhi(NULL),
+    fHistoMotherEtaConvPhotonEtaPhi(NULL),
        fHistoMotherInvMassECalib(NULL),
        fHistoMotherInvMassECalibalpha(NULL),
        fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
@@ -622,6 +626,8 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                        fHistoMotherEtaPtAlpha =  new TH2F*[fnCuts];
                        fHistoMotherPi0PtOpenAngle =  new TH2F*[fnCuts];
                        fHistoMotherEtaPtOpenAngle =  new TH2F*[fnCuts];
+            fHistoMotherPi0ConvPhotonEtaPhi = new TH2F*[fnCuts];
+            fHistoMotherEtaConvPhotonEtaPhi = new TH2F*[fnCuts];
                }
                if(fDoMesonQA == 1){
                        fHistoMotherInvMassECalib = new TH2F*[fnCuts];
@@ -659,7 +665,7 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
-               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
+               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){ 
                        TString TriggerNames = "Not Trigger: ";
                        TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
                        fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
@@ -816,12 +822,16 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                                fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
                                SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
-                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
-                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
+                fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi","ESD_MotherPi0ConvPhoton_Eta_Phi",600,0,2*TMath::Pi(),400,-2,2);
+                fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
+                fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi","ESD_MotherEtaConvPhoton_Eta_Phi",600,0,2*TMath::Pi(),400,-2,2);
+                fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
                        }
                }    
        }
@@ -2436,12 +2446,14 @@ void AliAnalysisTaskGammaConvCalo::CalculatePi0Candidates(){
                                                        if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
                                                                fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
                                                                fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
-                                                               fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());      
+                                fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
+                                fHistoMotherPi0ConvPhotonEtaPhi[fiCut]->Fill(gamma0->GetPhotonPhi(), gamma0->GetPhotonEta());
                                                        }
                                                        if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
                                                                fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
                                                                fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
                                                                fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
+                                fHistoMotherEtaConvPhotonEtaPhi[fiCut]->Fill(gamma0->GetPhotonPhi(), gamma0->GetPhotonEta());
                                                        }
                                                }
                                                if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
index d83bc84665913d70e16062b9fe82a167aa18da51..4d9034413997a53621f48ea87f796d85692f493d 100644 (file)
@@ -164,6 +164,8 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                TH2F                                                            **fHistoMotherEtaPtAlpha;                       //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, alpha
                TH2F                                                            **fHistoMotherPi0PtOpenAngle;           //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17, pt, openAngle
                TH2F                                                            **fHistoMotherEtaPtOpenAngle;           //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65, pt, openAngle
+        TH2F                                **fHistoMotherPi0ConvPhotonEtaPhi;  //! array of histograms with invariant mass cut of 0.05 && pi0cand->M() < 0.17 ,eta/phi of conversion photon
+        TH2F                                **fHistoMotherEtaConvPhotonEtaPhi;  //! array of histograms with invariant mass cut of 0.45 && pi0cand->M() < 0.65 ,eta/phi of conversion photon
                TH2F                                                            **fHistoMotherInvMassECalib;            //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster
                TH2F                                                            **fHistoMotherInvMassECalibalpha;       //! array of histogram with signal + BG for same event photon pairs, inv Mass, energy of cluster, alpha cut 0.1
                TTree                                                           **fTreeMesonsInvMassPtDcazMinDcazMaxFlag; //! array of trees with dca information for mesons
index f11c9283e8af744334366174a971348de25ecb48..83b56a6cfcc1366c3d6f2f617d2bdbf47cd2675a 100644 (file)
@@ -139,6 +139,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1():
        hMCAllPositronsPt(NULL),
        hMCAllElectronsPt(NULL),
        hMCConvGammaEta(NULL),
+       hMCConvGammaR(NULL),
        hMCAllPositronsEta(NULL),
        hMCAllElectronsEta(NULL),
        hMCPi0DalitzGammaPt(NULL),
@@ -182,6 +183,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1():
        hESDTrueBckContInvMassPt(NULL),
        hESDTrueMotherGGInvMassPt(NULL),
        hESDTrueConvGammaPt(NULL),
+       hESDTrueConvGammaR(NULL),
        hESDTruePositronPt(NULL),
        hESDTrueElectronPt(NULL),
        hESDTrueSecConvGammaPt(NULL),
@@ -308,6 +310,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char*
        hMCAllPositronsPt(NULL),
        hMCAllElectronsPt(NULL),
        hMCConvGammaEta(NULL),
+       hMCConvGammaR(NULL),
        hMCAllPositronsEta(NULL),
        hMCAllElectronsEta(NULL),
        hMCPi0DalitzGammaPt(NULL),
@@ -351,6 +354,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char*
        hESDTrueBckContInvMassPt(NULL),
        hESDTrueMotherGGInvMassPt(NULL),
        hESDTrueConvGammaPt(NULL),
+       hESDTrueConvGammaR(NULL),
        hESDTruePositronPt(NULL),
        hESDTrueElectronPt(NULL),
        hESDTrueSecConvGammaPt(NULL),
@@ -856,9 +860,11 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
                if( fDoMesonQA ) {
 
                hMCConvGammaEta    = new TH1F*[fnCuts];
+               hMCConvGammaR      = new TH1F*[fnCuts];
                hMCAllPositronsEta = new TH1F*[fnCuts];
                hMCAllElectronsEta = new TH1F*[fnCuts];
                
+               
                }
                hMCPi0DalitzGammaPt    = new TH1F*[fnCuts];
                hMCPi0DalitzElectronPt = new TH1F*[fnCuts];
@@ -870,26 +876,26 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
                hMCEtaGGPt = new TH1F*[fnCuts];
                hMCPi0InAccPt = new TH1F*[fnCuts];
                hMCEtaInAccPt = new TH1F*[fnCuts];
-                               hMCChiCPt = new TH1F*[fnCuts];
-                               hMCChiCInAccPt = new TH1F*[fnCuts];
+               hMCChiCPt = new TH1F*[fnCuts];
+               hMCChiCInAccPt = new TH1F*[fnCuts];
                                
                                
                if ( fDoMesonQA ) {
                
                hMCPi0EposEnegInvMassPt                      = new TH2F*[fnCuts];       
-                       hMCEtaEposEnegInvMassPt                      = new TH2F*[fnCuts];
-               
+               hMCEtaEposEnegInvMassPt                      = new TH2F*[fnCuts];
                hESDEposEnegTruePi0DalitzInvMassPt           = new TH2F*[fnCuts];
                hESDEposEnegTruePrimPi0DalitzInvMass         = new TH1F*[fnCuts];
-                       hESDEposEnegTruePi0DalitzPsiPairDPhi         = new TH2F*[fnCuts];
+               hESDEposEnegTruePi0DalitzPsiPairDPhi         = new TH2F*[fnCuts];
                hESDEposEnegTrueEtaDalitzInvMassPt           = new TH2F*[fnCuts];
                hESDEposEnegTruePrimEtaDalitzInvMass         = new TH1F*[fnCuts];
-                       hESDEposEnegTrueEtaDalitzPsiPairDPhi         = new TH2F*[fnCuts];
+               hESDEposEnegTrueEtaDalitzPsiPairDPhi         = new TH2F*[fnCuts];
                hESDEposEnegTruePhotonInvMassPt              = new TH2F*[fnCuts];
                hESDEposEnegTrueInvMassPt                    = new TH2F*[fnCuts];
-                       hESDEposEnegTruePhotonPsiPairDPhi            = new TH2F*[fnCuts];
+               hESDEposEnegTruePhotonPsiPairDPhi            = new TH2F*[fnCuts];
                hESDEposEnegTruePhotonPsiPairDPhiPtCut       = new TH2F*[fnCuts];
                hESDEposEnegTrueJPsiInvMassPt                = new TH2F*[fnCuts];
+               hESDTrueConvGammaR                           = new TH1F*[fnCuts];
                }
                
                
@@ -948,6 +954,8 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
                        if ( fDoMesonQA ){
                                hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",600,-1.5,1.5);
                                fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
+                               hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
+                               fMCList[iCut]->Add(hMCConvGammaR[iCut]);
                                hMCAllPositronsEta[iCut] = new TH1F("MC_AllPositrons_Eta","MC_AllPositrons_Eta",600,-1.5,1.5);
                                fMCList[iCut]->Add(hMCAllPositronsEta[iCut]);
                                hMCAllElectronsEta[iCut] = new TH1F("MC_AllElectrons_Eta","MC_AllElectrons_Eta",600,-1.5,1.5);
@@ -1037,6 +1045,9 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
                        
                                hESDEposEnegTrueJPsiInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueJPsi_InvMassPt","ESD_EposEneg_TrueJPsi_InvMassPt",5000,0.,5.,100,0.,10.);
                                fTrueList[iCut]->Add(hESDEposEnegTrueJPsiInvMassPt[iCut]);
+                               
+                               hESDTrueConvGammaR[iCut] = new TH1F("ESD_TrueConvGamma_R","ESD_TrueConvGamma_R",800,0,200);
+                               fTrueList[iCut]->Add(hESDTrueConvGammaR[iCut]);
                        }
 
                        hESDTruePositronPt[iCut] = new TH1F("ESD_TruePositron_Pt","ESD_TruePositron_Pt",1000,0,25);
@@ -1504,6 +1515,7 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTruePhotonCandidates(AliAODConvers
        if( labelGamma < MCStack->GetNprimary() ){
                if( fIsFromMBHeader ){
                        hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       hESDTrueConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
                }
        } else {
                if( fIsFromMBHeader){
@@ -1892,10 +1904,10 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
                                AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
                                if (Vgamma==NULL) continue;
                                //Check for same Electron ID
-                               if(gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelPositive() ||
-                               gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelNegative() ||
-                               gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelPositive() ||
-                               gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelNegative() ) continue;
+                            if(gamma->GetTrackLabelPositive()    == Vgamma->GetTrackLabelPositive() ||
+                               gamma->GetTrackLabelNegative()    == Vgamma->GetTrackLabelNegative() ||
+                               gamma->GetTrackLabelNegative()    == Vgamma->GetTrackLabelPositive() ||
+                               gamma->GetTrackLabelPositive()    == Vgamma->GetTrackLabelNegative() ) continue;
 
                                AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma,Vgamma);
                                pi0cand->SetLabels(GammaIndex,virtualGammaIndex);
@@ -1926,6 +1938,10 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
                                                        hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());   
                                                        Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
                                                        sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                                       
+                                                       if(fMCEvent){
+                                                         ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
+                                                       }
                                                
                                                        if ( fDoMesonQA ) {
                                                                hESDMotherPhi[fiCut]->Fill(pi0cand->Phi());
@@ -1943,6 +1959,10 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
                                                Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
                                                sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
                                                
+                                               if(fMCEvent){
+                                                         ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
+                                               }
+                                               
                                                if ( fDoMesonQA ) {
                                                        hESDMotherPhi[fiCut]->Fill(pi0cand->Phi());
                                                        if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
@@ -1962,11 +1982,15 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
                                                if( Vgamma->M() > 2.5 && Vgamma->M() < 3.4){
                                                        hESDPi0MotherDiffLimInvMassPt[fiCut]->Fill( diffMass , pi0cand->Pt() );
                                                }
+                                               
+                                               if(fMCEvent){
+                                                 ProcessTrueChicCandidates(pi0cand,gamma,Vgamma);
+                                               }
+                                               
+                                               
                                        }
                                        
-                                       if(fMCEvent){
-                                               ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
-                                       }
+                                       
                                }
                                delete pi0cand;
                                pi0cand=0x0;
@@ -2139,23 +2163,23 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
 
        // Process True Mesons
        AliStack *MCStack = fMCEvent->Stack();
-       if(     TrueGammaCandidate->GetV0Index()<fESDEvent->GetNumberOfV0s()    ){
-               //cout<<"Entro True Meson"<<endl;
+       
+       if( TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s() ){
+               
+         
 
                Bool_t isTruePi0 = kFALSE;
                Bool_t isTrueEta = kFALSE;
-               Bool_t massCutAccept = kFALSE;
-               //Bool_t isTrueChiC = kFALSE;
-               Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(MCStack);
+               
+               Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(MCStack);
                Int_t gammaMotherLabel = -1;
+               
+               
 
-               if(  ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {          
-                       if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( Pi0Candidate->Pt() , TrueVirtualGammaCandidate->M() ) == kTRUE ){
-                               massCutAccept = kTRUE;
-                       }
-               } else {
-                       massCutAccept  = kTRUE;
-               }
+               
+               
+               //Checking if the gamma candidate is a real gamma
+               
                
                if(gammaMCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                        // Daughters Gamma 0
@@ -2173,13 +2197,16 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
                }
 
 
+               
+               //Checking if the virtual gamma is a real virtual gamma
+               
                Int_t virtualGammaMCLabel = TrueVirtualGammaCandidate->GetMCParticleLabel(MCStack);
                Int_t virtualGammaMotherLabel = -1;
-               Int_t virtualGamma = 1;
-               Int_t virtualGammaGrandMotherLabel =-1;
+               Int_t virtualGamma = -1;
+               
 
 
-               if(virtualGammaMCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
+               if( virtualGammaMCLabel != -1 ){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                        // Daughters Gamma 1
                        TParticle * negativeMC = (TParticle*)TrueVirtualGammaCandidate->GetNegativeMCDaughter(MCStack);
                        TParticle * positiveMC = (TParticle*)TrueVirtualGammaCandidate->GetPositiveMCDaughter(MCStack);
@@ -2189,9 +2216,8 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
 
                                if( virtualGammaMotherMC->GetPdgCode() != 22 ){
                                        virtualGammaMotherLabel=virtualGammaMCLabel;
-                                       if(virtualGammaMotherMC->GetPdgCode() == 443){
-                                               virtualGammaGrandMotherLabel=virtualGammaMotherMC->GetFirstMother();
-                                       }
+                                       virtualGamma = 1;
+                                       
                                } else if (negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
                                        virtualGammaMotherLabel=virtualGammaMotherMC->GetFirstMother();
                                        virtualGamma = 0; //no virtual gamma
@@ -2199,8 +2225,11 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
                        }
                }
 
+               
+               //Checking if both gamma and virtual gamma comming from Pi0 or Eta
+               
 
-               if(gammaMotherLabel >= 0 && ( gammaMotherLabel == virtualGammaMotherLabel) ){
+               if( gammaMotherLabel >= 0 && ( gammaMotherLabel == virtualGammaMotherLabel) ){
                        if(((TParticle*)MCStack->Particle(virtualGammaMotherLabel))->GetPdgCode() == 111){
                                isTruePi0=kTRUE;
                        }
@@ -2209,19 +2238,9 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
                        }
                }
 
-               if( fDoChicAnalysis) {
-                       if(gammaMotherLabel>=0 && ( gammaMotherLabel == virtualGammaGrandMotherLabel) ){
-                               if(((TParticle*)MCStack->Particle(virtualGammaGrandMotherLabel))->GetPdgCode() == 445 ||
-                                       ((TParticle*)MCStack->Particle(virtualGammaGrandMotherLabel))->GetPdgCode() == 10443 ||
-                                       ((TParticle*)MCStack->Particle(virtualGammaGrandMotherLabel))->GetPdgCode() == 20443 ){
-                               
-                                       hESDTrueMotherChiCInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                       hESDTrueMotherChiCDiffInvMassPt[fiCut]->Fill(Pi0Candidate->M()-TrueVirtualGammaCandidate->M(),Pi0Candidate->Pt());
-                               }
-                       }  
-               }
+               
 
-               if( ( isTruePi0 || isTrueEta) && massCutAccept ){ // True Pion or Eta
+               if(  isTruePi0 || isTrueEta ){ // True Pion or Eta
                        if ( virtualGamma == 1 ) { //True Dalitz        
                                Float_t weighted= 1;
                                
@@ -2279,8 +2298,8 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
                        }
                }
 
-               if(!isTruePi0 && !isTrueEta && massCutAccept ){ // Background
-                       if(gammaMotherLabel>-1 && virtualGammaMotherLabel>-1 && virtualGamma == 0){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
+               if( !isTruePi0 && !isTrueEta ){ // Background
+                       if( gammaMotherLabel > -1 && virtualGammaMotherLabel > -1 && virtualGamma == 0 ){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
                                hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                        } else { // No photon or without mother
                                hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
@@ -2289,6 +2308,86 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversi
        }
 }
 
+//______________________________________________________________________
+void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueChicCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TruejpsiCandidate)
+{
+
+       
+       AliStack *MCStack = fMCEvent->Stack();
+       
+       
+       if(     TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s()  ){
+               
+         
+         
+               //Checking gamma
+               
+               Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(MCStack);
+               Int_t gammaMotherLabel = -1;
+
+               
+               
+               if( gammaMCLabel != -1){// Gamma is Combinatorial; MC Particles don't belong to the same Mother
+                       // Daughters Gamma 0
+                       
+                       TParticle * negativeMC = (TParticle*)TrueGammaCandidate->GetNegativeMCDaughter(MCStack);
+                       TParticle * positiveMC = (TParticle*)TrueGammaCandidate->GetPositiveMCDaughter(MCStack);
+                       TParticle * gammaMC = (TParticle*)MCStack->Particle(gammaMCLabel);
+
+                       if( TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11 ){  // Electrons ...
+                               if( negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() == 5 ){ // ... From Conversion ...
+                                       if(gammaMC->GetPdgCode() == 22){ // ... with Gamma Mother
+                                               gammaMotherLabel=gammaMC->GetFirstMother();
+                                       }
+                               }
+                       }
+               }
+
+
+               
+               //Checking jpsi
+               
+               Int_t jpsiMCLabel               = TruejpsiCandidate->GetMCParticleLabel(MCStack);
+               Int_t jpsiMotherLabel           = -1;
+
+               
+
+               if( jpsiMCLabel != -1 ){ 
+                       
+                       TParticle * negativeMC = (TParticle*)TruejpsiCandidate->GetNegativeMCDaughter(MCStack);
+                       TParticle * positiveMC = (TParticle*)TruejpsiCandidate->GetPositiveMCDaughter(MCStack);
+                       TParticle * jpsiMC = (TParticle*)MCStack->Particle(jpsiMCLabel);
+
+                       if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){  // Electrons ...
+
+                                                                       
+                               if(jpsiMC->GetPdgCode() == 443){
+                                 
+                                               jpsiMotherLabel=jpsiMC->GetFirstMother();
+                                               
+                               }
+                                
+                                                               
+                       }
+               }
+
+
+               if( gammaMotherLabel>=0 && ( gammaMotherLabel == jpsiMotherLabel) ){
+                 if(                   ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 445   ||
+                                       ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 10443 ||
+                                       ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 20443 ){
+                               
+                                       hESDTrueMotherChiCInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       hESDTrueMotherChiCDiffInvMassPt[fiCut]->Fill(Pi0Candidate->M()-TruejpsiCandidate->M(),Pi0Candidate->Pt());
+                 }
+               }  
+               
+       }
+}
+
+
+
+
 
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvDalitzV1::MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
@@ -2351,8 +2450,13 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessMCParticles()
                }
                
                if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
+                       
                        hMCConvGammaPt[fiCut]->Fill(particle->Pt());
-                       if(fDoMesonQA) hMCConvGammaEta[fiCut]->Fill( particle->Eta());
+                       
+                       if(fDoMesonQA) {
+                         hMCConvGammaEta[fiCut]->Fill( particle->Eta());
+                         hMCConvGammaR[fiCut]->Fill( ((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R() );
+                       }
                
                        if(mcIsFromMB){
                                hMCConvGammaRSPt[fiCut]->Fill(particle->Pt());
index f6f8334fc220cc90fc7a6bd52645e7e1f001e9ba..f023158cb2a3e41179bb9379d16b16921a4a5e9c 100644 (file)
@@ -68,6 +68,7 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
                void ProcessPhotonCandidates();
                void ProcessTruePhotonCandidates(AliAODConversionPhoton*);
                void ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TrueVirtualGammaCandidate);
+               void ProcessTrueChicCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TruejpsiCandidate);
                void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
                void ProcessElectronCandidates();
                void ProcessVirtualGammasCandidates();
@@ -161,6 +162,7 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
                TH1F                                                                    **hMCAllPositronsPt;
                TH1F                                                                    **hMCAllElectronsPt;
                TH1F                                                                    **hMCConvGammaEta;
+               TH1F                                                                    **hMCConvGammaR;
                TH1F                                                                    **hMCAllPositronsEta;
                TH1F                                                                    **hMCAllElectronsEta;
                TH1F                                                                    **hMCPi0DalitzGammaPt;
@@ -204,6 +206,7 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
                TH2F                                                                    **hESDTrueBckContInvMassPt;
                TH2F                                                                    **hESDTrueMotherGGInvMassPt;
                TH1F                                                                    **hESDTrueConvGammaPt;
+               TH1F                                                                    **hESDTrueConvGammaR;
                TH1F                                                                    **hESDTruePositronPt;
                TH1F                                                                    **hESDTrueElectronPt;
                TH1F                                                                    **hESDTrueSecConvGammaPt;
index 3a22d9409c648f5b9b17f1e7ce8955ad2f4b6694..b1e58f28985efec9e5382c40144ea67273201c49 100644 (file)
@@ -509,7 +509,7 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
                hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
                hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
                hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
-               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 3 ){
+               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){ 
                        TString TriggerNames = "Not Trigger: ";
                        TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
                        hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
@@ -610,10 +610,10 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
                                hESDMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
                                SetLogBinningXTH2(hESDMotherEtaPtAlpha[iCut]);
                                fESDList[iCut]->Add(hESDMotherEtaPtAlpha[iCut]);
-                               hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());            
+                               hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());            
                                SetLogBinningXTH2(hESDMotherPi0PtOpenAngle[iCut]);
                                fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
-                               hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());            
+                               hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());            
                                SetLogBinningXTH2(hESDMotherEtaPtOpenAngle[iCut]);
                                fESDList[iCut]->Add(hESDMotherEtaPtOpenAngle[iCut]);
                        }
index 307fa9b11af40fae2929fa867e374ad50508fdaa..c36a13ac47532ad678d2115fb781ad177ecb1d2e 100644 (file)
@@ -90,6 +90,7 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const char *name,const char *title) :
        fUseTimeDiff(0),
        fMinDistTrackToCluster(0),
        fUseDistTrackToCluster(0),
+    fExtendedMatching(kFALSE),
        fExoticCell(0),
        fUseExoticCell(0),
        fMinEnergy(0),
@@ -135,11 +136,18 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const char *name,const char *title) :
     //fHistNLMAfterQA(NULL),
     fHistClusterRBeforeQA(NULL),
     fHistClusterRAfterQA(NULL),
-    fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
-    fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+    fHistClusterdEtadPhiBeforeQA(NULL),
     fHistClusterdEtadPhiAfterQA(NULL),
     fHistDistanceTrackToClusterBeforeQA(NULL),
-    fHistDistanceTrackToClusterAfterQA(NULL)
+    fHistDistanceTrackToClusterAfterQA(NULL),
+    fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
+    fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+    fHistClusterdEtadPtBeforeQA(NULL),
+    fHistClusterdPhidPtBeforeQA(NULL),
+    fHistClusterM20Pt_dPhiBeforeQA(NULL),
+    fHistClusterM02Pt_dPhiBeforeQA(NULL),
+    fHistClusterM20M02BeforeQA(NULL),
+    fHistClusterM20M02AfterQA(NULL)
 {
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
    fCutString=new TObjString((GetCutNumber()).Data());
@@ -162,6 +170,7 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const AliCaloPhotonCuts &ref) :
        fUseTimeDiff(ref.fUseTimeDiff),
        fMinDistTrackToCluster(ref.fMinDistTrackToCluster),
        fUseDistTrackToCluster(ref.fUseDistTrackToCluster),
+    fExtendedMatching(ref.fExtendedMatching),
        fExoticCell(ref.fExoticCell),
        fUseExoticCell(ref.fUseExoticCell),
        fMinEnergy(ref.fMinEnergy),
@@ -207,11 +216,18 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const AliCaloPhotonCuts &ref) :
     //fHistNLMAfterQA(NULL),
     fHistClusterRBeforeQA(NULL),
     fHistClusterRAfterQA(NULL),
-    fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
-    fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+    fHistClusterdEtadPhiBeforeQA(NULL),
     fHistClusterdEtadPhiAfterQA(NULL),
     fHistDistanceTrackToClusterBeforeQA(NULL),
-    fHistDistanceTrackToClusterAfterQA(NULL)
+    fHistDistanceTrackToClusterAfterQA(NULL),
+    fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
+    fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+    fHistClusterdEtadPtBeforeQA(NULL),
+    fHistClusterdPhidPtBeforeQA(NULL),
+    fHistClusterM20Pt_dPhiBeforeQA(NULL),
+    fHistClusterM02Pt_dPhiBeforeQA(NULL),
+    fHistClusterM20M02BeforeQA(NULL),
+    fHistClusterM20M02AfterQA(NULL)
 {
    // Copy Constructor
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
@@ -284,11 +300,11 @@ void AliCaloPhotonCuts::InitCutHistograms(TString name){
        fHistograms->Add(fHistClusterIdentificationCuts);
 
        // Acceptance related histogramms
-       fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+    fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
        fHistograms->Add(fHistClusterEtavsPhiBeforeAcc);
-       fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+    fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
        fHistograms->Add(fHistClusterEtavsPhiAfterAcc);
-       fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+    fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
        fHistograms->Add(fHistClusterEtavsPhiAfterQA);
     //fHistDistanceToBadChannelBeforeAcc = new TH1F(Form("DistanceToBadChannel_beforeAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_beforeAcceptance",200,0,40);
     //fHistograms->Add(fHistDistanceToBadChannelBeforeAcc);
@@ -296,9 +312,11 @@ void AliCaloPhotonCuts::InitCutHistograms(TString name){
     //fHistograms->Add(fHistDistanceToBadChannelAfterAcc);
        
        // Cluster quality related histograms
-       fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,-10e-6,10e-6,100,0.,40);
+       Double_t timeMin = -10e-6;
+       Double_t timeMax = 10e-6;
+       fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,timeMin,timeMax,100,0.,40);
        fHistograms->Add(fHistClusterTimevsEBeforeQA);
-       fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,-10e-6,10e-6,100,0.,40);
+       fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,timeMin,timeMax,100,0.,40);
        fHistograms->Add(fHistClusterTimevsEAfterQA);
     //fHistExoticCellBeforeQA=new TH2F(Form("ExoticCell_beforeClusterQA %s",GetCutNumber().Data()),"ExoticCell_beforeClusterQA",400,0,40,50,0.75,1);
     //fHistograms->Add(fHistExoticCellBeforeQA);
@@ -337,18 +355,34 @@ void AliCaloPhotonCuts::InitCutHistograms(TString name){
         fHistograms->Add(fHistClusterRBeforeQA);
         fHistClusterRAfterQA = new TH1F(Form("R_Cluster_afterClusterQA %s",GetCutNumber().Data()),"R of cluster_matched",200,400,500);
         fHistograms->Add(fHistClusterRAfterQA);
-        fHistClusterdEtadPhiPosTracksBeforeQA=new TH2F(Form("dEtaVsdPhi_posTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_posTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
-        fHistograms->Add(fHistClusterdEtadPhiPosTracksBeforeQA);
-               fHistClusterdEtadPhiNegTracksBeforeQA=new TH2F(Form("dEtaVsdPhi_negTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_negTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
-        fHistograms->Add(fHistClusterdEtadPhiNegTracksBeforeQA);
+        fHistClusterdEtadPhiBeforeQA=new TH2F(Form("dEtaVsdPhi_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+        fHistograms->Add(fHistClusterdEtadPhiBeforeQA);
         fHistClusterdEtadPhiAfterQA=new TH2F(Form("dEtaVsdPhi_afterClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_afterClusterQA",240,-0.3,0.3,240,-0.3,0.3);
         fHistograms->Add(fHistClusterdEtadPhiAfterQA);
         fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,2);
         fHistograms->Add(fHistDistanceTrackToClusterBeforeQA);
         fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,2);
         fHistograms->Add(fHistDistanceTrackToClusterAfterQA);
-    }
        
+        if(fExtendedMatching){
+            fHistClusterdEtadPhiPosTracksBeforeQA = new TH2F(Form("dEtaVsdPhi_posTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_posTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+            fHistograms->Add(fHistClusterdEtadPhiPosTracksBeforeQA);
+            fHistClusterdEtadPhiNegTracksBeforeQA = new TH2F(Form("dEtaVsdPhi_negTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_negTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+            fHistograms->Add(fHistClusterdEtadPhiNegTracksBeforeQA);
+            fHistClusterdEtadPtBeforeQA = new TH2F(Form("dEtaVsPt_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsPt_beforeClusterQA",240,-0.3,0.3,250,0,25);
+            fHistograms->Add(fHistClusterdEtadPtBeforeQA);
+            fHistClusterdPhidPtBeforeQA = new TH2F(Form("dPhiVsPt_beforeClusterQA %s",GetCutNumber().Data()),"dPhiVsPt_beforeClusterQA",480,-0.6,0.6,250,0,25);
+            fHistograms->Add(fHistClusterdPhidPtBeforeQA);
+            fHistClusterM20Pt_dPhiBeforeQA = new TH2F(Form("M20VsPt_dPhi_beforeClusterQA %s",GetCutNumber().Data()),"M20VsPt_dPhi_beforeClusterQA",200,0,2.5,250,0,25);
+            fHistograms->Add(fHistClusterM20Pt_dPhiBeforeQA);
+            fHistClusterM02Pt_dPhiBeforeQA = new TH2F(Form("M02VsPt_dPhi_beforeClusterQA %s",GetCutNumber().Data()),"M20VsPt_dPhi_beforeClusterQA",400,0,5,250,0,25);
+            fHistograms->Add(fHistClusterM02Pt_dPhiBeforeQA);
+            fHistClusterM20M02BeforeQA = new TH2F(Form("M20VsM02_beforeClusterQA %s",GetCutNumber().Data()),"M20VsM02_beforeClusterQA",200,0,2.5,400,0,5);
+            fHistograms->Add(fHistClusterM20M02BeforeQA);
+            fHistClusterM20M02AfterQA = new TH2F(Form("M20VsM02_afterClusterQA %s",GetCutNumber().Data()),"M20VsM02_afterClusterQA",200,0,2.5,400,0,5);
+            fHistograms->Add(fHistClusterM20M02AfterQA);
+        }
+    }
        TH1::AddDirectory(kTRUE);
 }
 
@@ -563,8 +597,8 @@ Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *ev
        if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //10
 
        // Histos after Cuts
-       Double_t vertex[3] = {0};
-       event->GetPrimaryVertex()->GetXYZ(vertex);
+    Double_t vertex[3] = {0,0,0};
+//     event->GetPrimaryVertex()->GetXYZ(vertex);
        // TLorentzvector with cluster
        TLorentzVector clusterVector;
        cluster->GetMomentum(clusterVector,vertex);
@@ -594,8 +628,8 @@ Bool_t AliCaloPhotonCuts::ClusterIsSelected(AliVCluster *cluster, AliVEvent * ev
 
        FillClusterCutIndex(kPhotonIn);
 
-       Double_t vertex[3] = {0};
-       event->GetPrimaryVertex()->GetXYZ(vertex);
+    Double_t vertex[3] = {0,0,0};
+//     event->GetPrimaryVertex()->GetXYZ(vertex);
        // TLorentzvector with cluster
        TLorentzVector clusterVector;
        cluster->GetMomentum(clusterVector,vertex);
@@ -665,7 +699,7 @@ Bool_t AliCaloPhotonCuts::AcceptanceCuts(AliVCluster *cluster, AliVEvent* event)
        
        // check phi range
        if (fUsePhiCut ){
-               if (phiCluster < fMinPhiCut || phiCluster > fMaxEtaCut){
+        if (phiCluster < fMinPhiCut || phiCluster > fMaxPhiCut){
                        if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
                        return kFALSE;
                }
@@ -702,8 +736,8 @@ Bool_t AliCaloPhotonCuts::MatchConvPhotonToCluster(AliAODConversionPhoton* convP
                }
        }
 
-    Double_t vertex[3] = {0,0,0};
-       event->GetPrimaryVertex()->GetXYZ(vertex);
+//    Double_t vertex[3] = {0,0,0};
+//     event->GetPrimaryVertex()->GetXYZ(vertex);
 
     if(!cluster->IsEMCAL() && !cluster->IsPHOS()){AliError("Cluster is neither EMCAL nor PHOS, returning"); return kFALSE;}
 
@@ -735,7 +769,6 @@ Bool_t AliCaloPhotonCuts::MatchConvPhotonToCluster(AliAODConversionPhoton* convP
                                }
                        }
                }
-               //      if( inTrack->Pt() < 0.005 ) continue;
 
                AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(inTrack);
                AliAODTrack *aodt = 0;
@@ -784,15 +817,31 @@ Bool_t AliCaloPhotonCuts::MatchConvPhotonToCluster(AliAODConversionPhoton* convP
 
                if (propagated){
                        Float_t dR2 = dPhi*dPhi + dEta*dEta;
-                       if (fHistDistanceTrackToClusterBeforeQA)fHistDistanceTrackToClusterBeforeQA->Fill(TMath::Sqrt(dR2));
-                       if (fHistClusterdEtadPhiPosTracksBeforeQA && inTrack->Charge()< 0) fHistClusterdEtadPhiPosTracksBeforeQA->Fill(dEta, dPhi);
-                       if (fHistClusterdEtadPhiNegTracksBeforeQA && inTrack->Charge()> 0) fHistClusterdEtadPhiNegTracksBeforeQA->Fill(dEta, dPhi);
+            if(fHistDistanceTrackToClusterBeforeQA)fHistDistanceTrackToClusterBeforeQA->Fill(TMath::Sqrt(dR2));
+            if(fHistClusterdEtadPhiBeforeQA) fHistClusterdEtadPhiBeforeQA->Fill(dEta, dPhi);
+
+            Float_t clusM02 = (Float_t)cluster->GetM02();
+            Float_t clusM20 = (Float_t)cluster->GetM20();
+            if(fExtendedMatching){
+                if(inTrack->Charge() > 0) fHistClusterdEtadPhiPosTracksBeforeQA->Fill(dEta, dPhi);
+                if(inTrack->Charge() < 0) fHistClusterdEtadPhiNegTracksBeforeQA->Fill(dEta, dPhi);
+                fHistClusterdEtadPtBeforeQA->Fill(dEta, inTrack->Pt());
+                fHistClusterdPhidPtBeforeQA->Fill(dPhi, inTrack->Pt());
+                if(abs(dPhi) > 0.05) fHistClusterM20Pt_dPhiBeforeQA->Fill(clusM20, inTrack->Pt());
+                if(abs(dPhi) > 0.05) fHistClusterM02Pt_dPhiBeforeQA->Fill(clusM02, inTrack->Pt());
+                fHistClusterM20M02BeforeQA->Fill(clusM20, clusM02);
+            }
+
                        if(dR2 < fMinDistTrackToCluster*fMinDistTrackToCluster){
                                matched = kTRUE;
-                               if (fHistDistanceTrackToClusterAfterQA)fHistDistanceTrackToClusterAfterQA->Fill(TMath::Sqrt(dR2));
-                               if (fHistClusterdEtadPhiAfterQA) fHistClusterdEtadPhiAfterQA->Fill(dEta, dPhi);
-                               if (fHistClusterRAfterQA) fHistClusterRAfterQA->Fill(clusterR);
-                       }
+                       } else {
+                if(fHistDistanceTrackToClusterAfterQA)fHistDistanceTrackToClusterAfterQA->Fill(TMath::Sqrt(dR2));
+                if(fHistClusterdEtadPhiAfterQA) fHistClusterdEtadPhiAfterQA->Fill(dEta, dPhi);
+                if(fHistClusterRAfterQA) fHistClusterRAfterQA->Fill(clusterR);
+                if(fExtendedMatching){
+                    fHistClusterM20M02AfterQA->Fill(clusM20, clusM02);
+                }
+                       }       
                }
                delete trackParam;
        }
index ddb3c041691acb8304ee5a1fb3fa8841c2b71f85..fa785ce8df7459e4baf8cff1b17d200421ba3d97 100644 (file)
@@ -93,9 +93,11 @@ class AliCaloPhotonCuts : public AliAnalysisCuts {
                Bool_t ClusterIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray);
                        
                void InitCutHistograms(TString name="");
-               void SetFillCutHistograms(TString name=""){if(!fHistograms){InitCutHistograms(name);};}
+        void SetFillCutHistograms(TString name=""){if(!fHistograms){InitCutHistograms(name);}}
                TList *GetCutHistograms(){return fHistograms;}
                void FillClusterCutIndex(Int_t photoncut){if(fHistCutIndex)fHistCutIndex->Fill(photoncut);}
+
+        void SetExtendedMatching(Bool_t extendedMatching){fExtendedMatching = extendedMatching;}
                        
                ///Cut functions
                Bool_t AcceptanceCuts(AliVCluster* cluster, AliVEvent *event);
@@ -139,6 +141,7 @@ class AliCaloPhotonCuts : public AliAnalysisCuts {
                Bool_t fUseTimeDiff;                                            // flag for switching on time difference cut
                Double_t fMinDistTrackToCluster;                        // minimum distance between track and cluster
                Bool_t fUseDistTrackToCluster;                          // flag for switching on distance between track and cluster cut
+        Bool_t fExtendedMatching;                   // flag for switching on extended matching histograms
                Double_t fExoticCell;                                           // exotic cell cut
                Bool_t fUseExoticCell;                                          // flag for switching on exotic cell cut
                Double_t fMinEnergy;                                            // minium energy per cluster
@@ -191,12 +194,21 @@ class AliCaloPhotonCuts : public AliAnalysisCuts {
         //Track matching histograms
                TH1F* fHistClusterRBeforeQA;                            // cluster position in R=SQRT(x^2+y^2) (before QA)
                TH1F* fHistClusterRAfterQA;                                     // cluster position in R=SQRT(x^2+y^2) for matched tracks (After QA)
-               TH2F* fHistClusterdEtadPhiPosTracksBeforeQA;                    // 2-dim plot dEta vs. dPhi
-               TH2F* fHistClusterdEtadPhiNegTracksBeforeQA;                    // 2-dim plot dEta vs. dPhi
+        TH2F* fHistClusterdEtadPhiBeforeQA;                    // 2-dim plot dEta vs. dPhi
                TH2F* fHistClusterdEtadPhiAfterQA;                      // 2-dim plot dEta vs. dPhi for matched tracks (after QA)
                TH1F* fHistDistanceTrackToClusterBeforeQA;      // distance cluster to track before acceptance cuts
         TH1F* fHistDistanceTrackToClusterAfterQA;      // distance cluster to track after cluster quality cuts
 
+        //Extended track matching histograms
+        TH2F* fHistClusterdEtadPhiPosTracksBeforeQA;// 2-dim plot dEta vs. dPhi
+        TH2F* fHistClusterdEtadPhiNegTracksBeforeQA;// 2-dim plot dEta vs. dPhi
+        TH2F* fHistClusterdEtadPtBeforeQA;          // 2-dim plot dEta vs. Pt
+        TH2F* fHistClusterdPhidPtBeforeQA;          // 2-dim plot dEta vs. Pt
+        TH2F* fHistClusterM20Pt_dPhiBeforeQA;       // 2-dim plot M20 vs. Pt for given dPhi>0.05
+        TH2F* fHistClusterM02Pt_dPhiBeforeQA;       // 2-dim plot M02 vs. Pt for given dPhi>0.05
+        TH2F* fHistClusterM20M02BeforeQA;           // 2-dim plot M20 vs. M02
+        TH2F* fHistClusterM20M02AfterQA;            // 2-dim plot M20 vs. M20
+
        private:
 
                ClassDef(AliCaloPhotonCuts,2)
index a0a330d38ee8ed2ccadda9eb0e3610a6024ae407..0998f168f900cf042b2dc3344f43b203c889a288 100644 (file)
@@ -665,14 +665,18 @@ void AliConvEventCuts::PrintCutsWithValues() {
        if (fIsHeavyIon == 0) {
                printf("Running in pp mode \n");
                if (fSpecialTrigger == 0){
-                       printf("\t only events triggered by V0OR will be analysed \n");
+                       if (fSpecialSubTrigger == 0){
+                               printf("\t only events triggered by V0OR will be analysed \n");
+                       } else if (fSpecialSubTrigger == 1){
+                               printf("\t only events where SDD was present will be analysed \n");
+                       }
                } else if (fSpecialTrigger == 1){
-                       printf("\t only events triggered by V0AND will be analysed \n");
-               } else if (fSpecialTrigger == 2){
-                       printf("\t only events where SDD was present will be analysed \n");
-               } else if (fSpecialTrigger == 3){
-                       printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
-               } else if (fSpecialTrigger > 3){ 
+                       if (fSpecialSubTrigger == 0){
+                               printf("\t only events triggered by V0AND will be analysed \n");
+                       } else if(fSpecialSubTrigger == 1){
+                               printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
+                       }    
+               } else if (fSpecialTrigger > 1){ 
                        printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
                }
        } else if (fIsHeavyIon == 1){ 
@@ -697,8 +701,10 @@ void AliConvEventCuts::PrintCutsWithValues() {
                }
                if (fSpecialTrigger == 0){
                        printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
-               } else if (fSpecialTrigger > 4){   
+               } else if (fSpecialTrigger > 1){
                        printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
+                       printf("\n\t        SpecialTrigger is:  %s\n", fSpecialTriggerName.Data());
+                       printf("\t        SpecialSubTrigger is: %s\n\n", fSpecialSubTriggerName.Data());
                }
        } else if (fIsHeavyIon == 2){
                printf("Running in pPb mode \n");
@@ -712,7 +718,7 @@ void AliConvEventCuts::PrintCutsWithValues() {
                }
                if (fSpecialTrigger == 0){
                        printf("\t only events triggered by kINT7 will be analysed \n");
-               } else if (fSpecialTrigger > 4){   
+               } else if (fSpecialTrigger > 1){ 
                        printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
                }
        }
@@ -810,18 +816,18 @@ Bool_t AliConvEventCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
 
        switch(selectSpecialTrigger){
        case 0:
-               fSpecialTrigger=0; // dont care
+               fSpecialTrigger=0; // V0OR
                break;
        case 1:
                fSpecialTrigger=1; // V0AND
                break;
-       case 2:
-               fSpecialTrigger=2; // with SDD requested
+//     case 2:
+//             fSpecialTrigger=2; // 
+//             break;
+       case 3:       
+               fSpecialTrigger=3; //specific centrality trigger selection
+               fSpecialTriggerName="AliVEvent::kCentral/kSemiCentral/kMB";
                break;
-       case 3:
-               fSpecialTrigger=3; // V0AND plus with SDD requested
-               break;
-       // allows to run MB & 6 other different trigger classes in parallel with the same photon cut
        case 4:
                fSpecialTrigger=4; // trigger alias kTRD 
                fOfflineTriggerMask=AliVEvent::kTRD;
@@ -875,13 +881,30 @@ Bool_t AliConvEventCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger)
 Bool_t AliConvEventCuts::SetSelectSubTriggerClass(Int_t selectSpecialSubTriggerClass)
 {// Set Cut
 
-       if (fSpecialTrigger == 1){ //V0AND with different detectors
+       if (fSpecialTrigger == 0){ //OR 
                switch(selectSpecialSubTriggerClass){
-               case 0: //with VZERO
-                       fSpecialTrigger=1;
+               case 0://with VZERO
+                       fSpecialTrigger=0;
                        fSpecialSubTrigger=0; 
 //                     AliInfo("Info: Nothing to be done");
+                       break;  
+               case 3: //V0OR with SDD requested (will only work with LHC11a dataset)
+                       fSpecialSubTrigger=1; 
+                       cout << "V0OR with SDD requested" << endl;          
                        break;
+               default:
+                       AliError("Warning: Special Subtrigger Class Not known");
+                       return 0;
+               }       
+       } else if (fSpecialTrigger == 1){ //AND with different detectors
+               switch(selectSpecialSubTriggerClass){
+               case 0: //with VZERO general implementation of V0AND (periods LHC11c onwards)
+                       fSpecialTrigger=0;
+                       fSpecialSubTrigger=0; 
+                       fOfflineTriggerMask=AliVEvent::kINT7;
+                       fTriggerSelectedManually = kTRUE;
+                       fSpecialTriggerName="AliVEvent::kINT7";
+               break;
                case 1: //with TZERO
                        fSpecialTrigger=0;
                        fSpecialSubTrigger=0; 
@@ -889,11 +912,78 @@ Bool_t AliConvEventCuts::SetSelectSubTriggerClass(Int_t selectSpecialSubTriggerC
                        fTriggerSelectedManually = kTRUE;
                        fSpecialTriggerName="AliVEvent::kINT8";
                        break;
+               case 2: //with VZERO (will only work with LHC11a dataset)
+                       fSpecialTrigger=1;
+                       fSpecialSubTrigger=0; 
+//                     AliInfo("Info: Nothing to be done");
+                       break;  
+               case 3: //V0AND with SDD requested (will only work with LHC11a dataset)
+                       fSpecialTrigger=1;
+                       fSpecialSubTrigger=1; 
+                       break;
                default:
                        AliError("Warning: Special Subtrigger Class Not known");
                        return 0;
-               }       
-                       
+               }               
+       } else if (fSpecialTrigger == 3){ // Selecting kCentral and kSemiCentral from trigger classes, not aliases
+               switch(selectSpecialSubTriggerClass){
+               case 0: // all together
+                       fSpecialSubTrigger=0; 
+                       fSpecialSubTriggerName="";
+//                     AliInfo("Info: Nothing to be done");
+                       break;
+               case 1: // kCentral - no vertex restriction
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CVHN";
+                       cout << "kCentralOpen" << endl;
+                       break;
+               case 2: // kCentral - T00 +- 10 cm
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CCENT";
+                       cout << "kCentralVertex" << endl;
+                       break;
+               case 3: // kCentral - both
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CVHN|CCENT";
+                       cout << "kCentral both" << endl;
+                       break;
+               case 4: // kSemiCentral - no vertex restriction
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CVLN";
+                       cout << "kSemiCentralOpen" << endl;
+                       break;
+               case 5: // kSemiCentral - T00 +- 10 cm
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CSEMI";
+                       cout << "kSemiCentralVertex" << endl;
+                       break;
+               case 6: // kSemiCentral - both
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CSEMI%CVLN";
+                       cout << "kSemiCentral both" << endl;
+                       break;
+               case 7: // kMB
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CPBI1_|CPBI1-";
+                       cout << "kMB 1" << endl;
+                       break;                  
+               case 8: // kMB
+                       fSpecialSubTrigger=1; 
+                       fNSpecialSubTriggerOptions=1;
+                       fSpecialSubTriggerName="CPBI2_|CPBI2-";
+                       cout << "kMB 2" << endl;
+                       break;                  
+               default:
+                       AliError("Warning: Special Subtrigger Class Not known");
+                       return 0;
+               }               
        } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
                switch(selectSpecialSubTriggerClass){
                case 0: // all together
@@ -1474,7 +1564,36 @@ Bool_t AliConvEventCuts::IsTriggerSelected(AliVEvent *fInputEvent, Bool_t isMC)
                                                        isSelected = 1;
                                                }       
                                        }       
-                               }       
+                               }
+                               //if for specif centrality trigger selection 
+                               if(fSpecialSubTrigger == 1){
+                                       if(fSpecialSubTriggerName.Contains("|")){
+                                               TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("|");
+                                               for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
+                                                       TObjString *NameClass = (TObjString*)ClassesList->At(i);
+                                                       if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
+//                                                     cout << "|||||||| \t" << NameClass->GetString() << "\t ||||||||" << endl;
+                                               }
+                                       } else if(fSpecialSubTriggerName.Contains("%")){
+                                               TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("%");
+                                               for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
+                                                       TObjString *NameClass = (TObjString*)ClassesList->At(i);
+                                                       if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
+//                                                     cout << "|||||||| \t" << NameClass->GetString() << "\t ||||||||" << endl;
+                                               }       
+                                       } else if(fSpecialSubTriggerName.Contains("&")){
+                                               TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("&");
+                                               TString CheckClass = "";
+                                               for (Int_t i=0; i<ClassesList->GetEntriesFast(); i++){
+                                                       TObjString *NameClass = (TObjString*)ClassesList->At(i);
+                                                       if (firedTrigClass.Contains(NameClass->GetString())) CheckClass+="1";
+                                                       else CheckClass+="0";
+                                               }
+                                               if(CheckClass.Contains("0")) isSelected = 0;
+//                                             cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
+                                       }       
+                                       else if(firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
+                               }
                        }                               
                }        
        }
@@ -1877,6 +1996,17 @@ Int_t AliConvEventCuts::IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVE
 
        Bool_t hasV0And = ReaderCuts->HasV0AND();
        Bool_t isSDDFired = ReaderCuts->IsSDDFired();
+       
+       if( ( (IsSpecialTrigger() == 0 && IsSpecialSubTrigger() == 1) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !isSDDFired && !MCEvent) 
+       //if V0OR with SDD requested or V0AND with SDD request but the SDD has not fired
+       return 7; // V0 with SDD requested but no fired
+
+       if( ( (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 0) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !hasV0And) 
+       //if V0AND (only) or V0AND with SDD requested but V0AND requested but no fired
+       return 8; // V0AND requested but no fired
+
+
+       
        if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent)
                return 7; // With SDD requested but no fired
 
index 17e395c6177299d551204be33ba93d5eb0641d83..f4b89142d8b020e74e7ce924097377525e64a88a 100644 (file)
@@ -179,6 +179,7 @@ class AliConvEventCuts : public AliAnalysisCuts {
                Bool_t          HasV0AND()                                                                                              { return fHasV0AND                                                                              ; }
                Bool_t          IsSDDFired()                                                                                    { return fIsSDDFired                                                                    ; }
                Int_t           IsSpecialTrigger()                                                                              { return fSpecialTrigger                                                                ; }
+               Int_t           IsSpecialSubTrigger()                                                                   { return fSpecialSubTrigger                                                             ; }     
                void            InitializeEMCALTrigger( AliVEvent *fInputEvent);
                Bool_t          HasTriggerType(TriggerTypeEMCAL t);
                
index 8c9d009d67b4f81ce3588f54c86775759e22446d..a17ca3f8216fe883bfda773edbdc9108d4ac579b 100644 (file)
@@ -117,8 +117,8 @@ void AddTask_GammaCalo_pp(  Int_t trainConfig = 1,  //change different set of cu
        // 0 "ClusterType",  1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
        // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
        if (trainConfig == 1){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3)
-               eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
-               eventCutArray[ 1] = "0002011"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
+               eventCutArray[ 0] = "0000311"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
+               eventCutArray[ 1] = "0000311"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
                eventCutArray[ 2] = "0005111"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005111"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 2){  // EMCAL clusters, EMCEGA triggers
@@ -137,8 +137,8 @@ void AddTask_GammaCalo_pp(  Int_t trainConfig = 1,  //change different set of cu
                eventCutArray[ 2] = "0005211"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005211"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 5){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3)
-               eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000040062030000"; mesonCutArray[0] = "01631031009000"; // 400 MeV cluster min energy
-               eventCutArray[ 1] = "0002011"; clusterCutArray[1] = "10000040062031000"; mesonCutArray[1] = "01631031009000"; // 400 MeV cluster min energy, min M20 > 0.02
+               eventCutArray[ 0] = "0000311"; clusterCutArray[0] = "10000040062030000"; mesonCutArray[0] = "01631031009000"; // 400 MeV cluster min energy
+               eventCutArray[ 1] = "0000311"; clusterCutArray[1] = "10000040062031000"; mesonCutArray[1] = "01631031009000"; // 400 MeV cluster min energy, min M20 > 0.02
                eventCutArray[ 2] = "0005111"; clusterCutArray[2] = "10000040062030000"; mesonCutArray[2] = "01631031009000"; // 500 MeV cluster min energy
                eventCutArray[ 3] = "0005111"; clusterCutArray[3] = "10000040062031000"; mesonCutArray[3] = "01631031009000"; // 500 MeV cluster min energy, min M20 > 0.02
        } else if (trainConfig == 6){  // EMCAL clusters, EMCEGA triggers
@@ -157,16 +157,16 @@ void AddTask_GammaCalo_pp(  Int_t trainConfig = 1,  //change different set of cu
                eventCutArray[ 2] = "0005211"; clusterCutArray[2] = "10000040062030000"; mesonCutArray[2] = "01631031009000"; // 400 MeV cluster min energy
                eventCutArray[ 3] = "0005211"; clusterCutArray[3] = "10000040062031000"; mesonCutArray[3] = "01631031009000"; // 400 MeV cluster min energy, min M20 > 0.02
        } else if (trainConfig == 9){ // Trigger test
-               eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; 
+               eventCutArray[ 0] = "0000311"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; 
                eventCutArray[ 1] = "0005011"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01631031009000"; 
                eventCutArray[ 2] = "0008311"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; 
                eventCutArray[ 3] = "0009311"; clusterCutArray[3] = "10000040022030000"; mesonCutArray[3] = "01631031009000"; 
                eventCutArray[ 4] = "0008511"; clusterCutArray[4] = "10000040022030000"; mesonCutArray[4] = "01631031009000"; 
                eventCutArray[ 5] = "0009511"; clusterCutArray[5] = "10000040022030000"; mesonCutArray[5] = "01631031009000"; 
        } else if (trainConfig == 10){ // Validation
-               eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000040062000000"; mesonCutArray[0] = "01630031009000"; 
+               eventCutArray[ 0] = "0000311"; clusterCutArray[0] = "10000040062000000"; mesonCutArray[0] = "01630031009000"; 
        } else if (trainConfig == 31) { //PHOS clusters
-               eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
+               eventCutArray[ 0] = "0000311"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
                eventCutArray[ 1] = "0000011"; clusterCutArray[1] = "20000030022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
                eventCutArray[ 2] = "0006111"; clusterCutArray[2] = "20000030022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
                eventCutArray[ 3] = "0006211"; clusterCutArray[3] = "20000030022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
index 819b555c070ba69d0a0bdead5618dd04e0d8be3a..67555d844f75ad7013955fdf91b93140f44ab69a 100644 (file)
@@ -6,7 +6,8 @@ void AddTask_GammaConvCalo_PbPb(        Int_t trainConfig = 1,  //change different s
                                                                        Int_t headerSelectionInt = 0,  // 1 pi0 header, 2 eta header, 3 both (only for "named" boxes)
                                                                        TString cutnumberAODBranch = "1000000060084000001500000",
                                                                        TString periodName = "LHC13d2",  //name of the period for added signals and weighting
-                                                                       Bool_t doWeighting = kFALSE  //enable Weighting
+                                    Bool_t doWeighting = kFALSE,  //enable Weighting
+                                    Bool_t enableExtendedMatching = kFALSE //enable or disable extended matching histograms for conversion electrons <-> cluster
                                                                ) {
 
        // ================= Load Librariers =================================
@@ -208,6 +209,7 @@ void AddTask_GammaConvCalo_PbPb(    Int_t trainConfig = 1,  //change different s
                analysisClusterCuts[i] = new AliCaloPhotonCuts();
                analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
                ClusterCutList->Add(analysisClusterCuts[i]);
+        analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
                analysisClusterCuts[i]->SetFillCutHistograms("");
 
                analysisMesonCuts[i] = new AliConversionMesonCuts();
index d58ded68f97f4fd6f70f732d368b5a4d64f5fd2b..b7f8ffe4740d7178df996b5854301990a4724cd0 100644 (file)
@@ -5,7 +5,8 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
                               TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
                               Int_t doWeightingPart = 0,  //enable Weighting
                               TString generatorName = "DPMJET",
-                              TString cutnumberAODBranch = "8000000060084000001500000" // cutnumber for AOD branch
+                              TString cutnumberAODBranch = "8000000060084000001500000", // cutnumber for AOD branch
+                              Bool_t enableExtendedMatching = kFALSE //enable or disable extended matching histograms for conversion electrons <-> cluster
                                                        ) {
 
        // ================= Load Librariers =================================
@@ -208,6 +209,7 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
                analysisClusterCuts[i] = new AliCaloPhotonCuts();
                analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
                ClusterCutList->Add(analysisClusterCuts[i]);
+        analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
                analysisClusterCuts[i]->SetFillCutHistograms("");
                
                analysisMesonCuts[i] = new AliConversionMesonCuts();
index 56d0d9b09b607156ba2883f3bec50a7d24b9e8d7..44eec1f4db06dba1d2572ffef20632a9cc5a9bb4 100644 (file)
@@ -3,7 +3,8 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
                                                                Int_t enableQAMesonTask = 1, //enable QA in AliAnalysisTaskGammaConvV1
                                                                Int_t enableQAPhotonTask = 1, // enable additional QA task
                                                                TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
-                                                               TString cutnumberAODBranch = "0000000060084001001500000" 
+                                TString cutnumberAODBranch = "0000000060084001001500000",
+                                Bool_t enableExtendedMatching = kFALSE //enable or disable extended matching histograms for conversion electrons <-> cluster
                                                        ) {
 
        // ================= Load Librariers =================================
@@ -120,8 +121,8 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
        // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
        
        if (trainConfig == 1){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3)
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
-               eventCutArray[ 1] = "0002011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
+               eventCutArray[ 1] = "0000311"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
                eventCutArray[ 2] = "0005111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005111"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 2){  // EMCAL clusters, EMCEGA triggers
@@ -135,8 +136,8 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
                eventCutArray[ 2] = "0009511"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // EMCEJ2, 100 MeV cluster min energy
                eventCutArray[ 3] = "0009511"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // EMCEJ2, 300 MeV cluster min energy
        } else if (trainConfig == 4){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3), track matching 0.035
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
-               eventCutArray[ 1] = "0002011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
+               eventCutArray[ 1] = "0000311"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
                eventCutArray[ 2] = "0005111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005111"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000042052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 5){  // EMCAL clusters, EMCEGA triggers, track matching 0.035
@@ -150,8 +151,8 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
                eventCutArray[ 2] = "0009511"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031009000"; // EMCEJ2, 100 MeV cluster min energy
                eventCutArray[ 3] = "0009511"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000042052030000"; mesonCutArray[3] = "01631031009000"; // EMCEJ2, 300 MeV cluster min energy
        } else if (trainConfig == 7){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3), track matching 0.04
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000043022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
-               eventCutArray[ 1] = "0002011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000043052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "10000043022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
+               eventCutArray[ 1] = "0000311"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "10000043052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
                eventCutArray[ 2] = "0005111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000043022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005111"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000043052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 8){  // EMCAL clusters, EMCEGA triggers, track matching 0.04
@@ -180,17 +181,17 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
                eventCutArray[ 2] = "0005211"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "10000043022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
                eventCutArray[ 3] = "0005211"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "10000043052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
        } else if (trainConfig == 31) { //PHOS clusters
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
                eventCutArray[ 1] = "0000011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "20000030022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
                eventCutArray[ 2] = "0006111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "20000030022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
                eventCutArray[ 3] = "0006211"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "20000030022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
        } else if (trainConfig == 32) { //PHOS clusters, track matching 0.035
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000032022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000032022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
                eventCutArray[ 1] = "0000011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "20000032022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
                eventCutArray[ 2] = "0006111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "20000032022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
                eventCutArray[ 3] = "0006211"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "20000032022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
        } else if (trainConfig == 32) { //PHOS clusters, track matching 0.04
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000033022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; clusterCutArray[0] = "20000033022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
                eventCutArray[ 1] = "0000011"; photonCutArray[ 1] = "002093663003800000000"; clusterCutArray[1] = "20000033022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
                eventCutArray[ 2] = "0006111"; photonCutArray[ 2] = "002093663003800000000"; clusterCutArray[2] = "20000033022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
                eventCutArray[ 3] = "0006211"; photonCutArray[ 3] = "002093663003800000000"; clusterCutArray[3] = "20000033022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
@@ -244,6 +245,7 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
                analysisClusterCuts[i] = new AliCaloPhotonCuts();
                analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
                ClusterCutList->Add(analysisClusterCuts[i]);
+        analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
                analysisClusterCuts[i]->SetFillCutHistograms("");
                
                analysisMesonCuts[i] = new AliConversionMesonCuts();
index 5c4aaa88bf496c9b53521cda70c3a5e17e1f9e3e..94494a4bc1e7c363c7b1fea4bbb4c59deef1d960 100644 (file)
@@ -416,6 +416,15 @@ if( trainConfig == 1 ) {  // No eta shift |Y| < 0.8
 } else if( trainConfig == 51 ){
   
        eventCutArray[0]="8000011"; photonCutArray[0] = "009093603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny + new psiPair Cut + gammaR >  7.5 cm
+       
+} else if( trainConfig == 52 ){
+  
+       eventCutArray[0]="8000011"; photonCutArray[0] = "000093603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny + new psiPair Cut + gammaR >  0 cm
+       
+} else if( trainConfig == 53 ) {  
+                                            
+        eventCutArray[0]="8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233202623700"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011  + kAny  + New psi pair cut + New psi pair cut  fPsiPairCut = 0.60    fDeltaPhiCutMin = 0.0 fDeltaPhiCutMax = 0.12
+
 }
        
 
@@ -461,8 +470,7 @@ if( trainConfig == 1 ) {  // No eta shift |Y| < 0.8
 
          if (  ( trainConfig >= 1 && trainConfig <= 6 ) || trainConfig == 9  ||  trainConfig == 11  || trainConfig == 13 || trainConfig == 14 || trainConfig == 16 || trainConfig == 17 || trainConfig == 18 || trainConfig == 19 || trainConfig == 20 || trainConfig == 21 || trainConfig == 22 || trainConfig == 23 ||
                  trainConfig == 28 || trainConfig == 29 || trainConfig == 30 ||  trainConfig == 31  || trainConfig == 32 || trainConfig == 33 || trainConfig == 37 || trainConfig == 38 || trainConfig == 39 || trainConfig == 40 || trainConfig == 41 || trainConfig == 41 || trainConfig == 43 || trainConfig == 44 ||
-                 trainConfig == 45 || trainConfig == 46 || trainConfig == 47 ||  trainConfig == 48  || trainConfig == 49 || trainConfig == 50 || trainConfig == 51 )
-         ){
+                 trainConfig == 45 || trainConfig == 46 || trainConfig == 47 ||  trainConfig == 48  || trainConfig == 49 || trainConfig == 50 || trainConfig == 51 || trainConfig == 52 ) {
            
            if (doWeighting){
              if (generatorName.CompareTo("DPMJET")==0){
index 49126ecae040f94fec1d1f1950b194b78f722743..cea5047ccd5b6415dc28c15a145565fcf70cd689 100644 (file)
@@ -370,7 +370,106 @@ if( trainConfig == 1 ) {  // No eta shift |Y| < 0.8
        eventCutArray[3]="8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400233102653710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + Pt{e} > 0.175
        
   
+} else if ( trainConfig == 24 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400833202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth  + new psiPair cut   0.60, 0.0 0.12
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400133202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kFirst + new psiPair cut + 0.60  0.0 0.12
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut   0.60, 0.0 0.12
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "005093603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  10cm  0.60, 0.0 0.12
+  
+} else if ( trainConfig == 25 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "008093603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  12.5cm  0.60, 0.0 0.12
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "006093603007200000000"; ElecCutarray[1] = "90475400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  20 cm  0.60, 0.0 0.12
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "007093603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  35 cm  0.60, 0.0 0.12
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "009093603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  7.5 cm  0.60, 0.0 0.12
+       
+} else if ( trainConfig == 26 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "008093603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  12.5cm  0.60, 0.0 0.12
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "006093603007200000000"; ElecCutarray[1] = "90475400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  20 cm  0.60, 0.0 0.12
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "007093603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  35 cm  0.60, 0.0 0.12
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "009093603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + new psiPair Cut + gammaR >  7.5 cm  0.60, 0.0 0.12
+       
+} else if ( trainConfig == 27 ) {
+  
+       eventCutArray[0]= "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233202613710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Ptprim > 100 MeV
+       eventCutArray[1]= "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400233202633710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Ptprim > 150 MeV
+       eventCutArray[2]= "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400233202603710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Ptprim > 75 MeV
+       eventCutArray[3]= "8000011"; photonCutArray[3] = "002493603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Ptsec  > 75 MeV
+       
+} else if ( trainConfig == 28 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002193603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Pt sec  > 100 MeV
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400233202653710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Pt prim > 175 GeV
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603001200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Qt > 0.1
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603002200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12 + Qt > 0.07
+       
+} else if ( trainConfig == 29 ) {
+  
+       eventCutArray[0]= "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90375400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx primary electron -5,5                            
+       eventCutArray[1]= "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90575400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx primary electron -3,5
+       eventCutArray[2]= "8000011"; photonCutArray[2] = "002091603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx secondary electron -5,5
+       eventCutArray[3]= "8000011"; photonCutArray[3] = "002092603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx secondary electron -3,5
+       
+} else if ( trainConfig == 30 ) {
+  
+       eventCutArray[0]= "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90435400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx pion rejec primary 2.0 sigmas Low and 0 High momentum
+       eventCutArray[1]= "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90425400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx pion rejec primary 2.0 sigmas Low and -1 High momentum 
+       eventCutArray[2]= "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90477400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx pion rejec primary 0.3 GeV Low and 3.5 High momentum 
+       eventCutArray[3]= "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475200233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth + dEdx pion rejec primary 0.5 GeV Low and 5.0 High momentum*/
+       
+} else if ( trainConfig == 31 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093653007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + dEdx pion rejec sec 0.3 GeV Low and 3.5 High momentum
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093601007200000000"; ElecCutarray[1] = "90475400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + dEdx pion rejec sec 0.5 GeV Low and 5.0 High momentum
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093803007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + dEdx pion rejec sec  2.0 sigmas Low and  1 High momentum
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007900000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + Chi2  < 15
+       
+} else if ( trainConfig == 32 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007800000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + Chi2  < 20
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007100000000"; ElecCutarray[1] = "90475400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + Chi2  < 50
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031005009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair cut + Alpha < 0.7
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400233002623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny   + no psi pair +  weights
+       
+} else if ( trainConfig == 33 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233202622710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + DCAxy < 1 cm
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400233202623810"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + 0.015 < InvMass(e+,e-) < 0.050
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400233202623910"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + 0.025 < InvMass(e+,e-) < 0.035
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400233202723710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + 100 events background
+       
+} else if ( trainConfig == 34 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233201623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + Background method V0 multiplicity
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "032093603007200000000"; ElecCutarray[1] = "90475400239202623710"; MesonCutarray[1] = "01033035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + |Y| < 0.6 and |Gamma_eta| < 0.65 and |e+_eta| < 0.65 and |e-_eta| < 0.65 
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "042093603007200000000"; ElecCutarray[2] = "90475400235202623710"; MesonCutarray[2] = "01032035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + |Y| < 0.7 and |Gamma_eta| < 0.75 and |e+_eta| < 0.75 and |e-_eta| < 0.75
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "012093603007200000000"; ElecCutarray[3] = "90475400236202623710"; MesonCutarray[3] = "01034035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + |Y| < 0.5 and |Gamma_eta| < 0.60 and |e+_eta| < 0.60 and |e-_eta| < 0.60
+       
+} else if ( trainConfig == 35 ) {
+       
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + new psiPair Cut    0.60, 0.0 0.12
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603003200000000"; ElecCutarray[1] = "90475400233202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  +  Qt < 0.05
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002083603007200000000"; ElecCutarray[2] = "90475400233202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + Findable Cls > 0.35 Secondary
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400273202623710"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + Findable Cls > 0.60 primary
+       
+} else if ( trainConfig == 36 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400433202623710"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + ITScls >= 3
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400533202623710"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + ITScls >= 4
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400633202623710"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + ITScls >= 5
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400233202623710"; MesonCutarray[3] = "01031035000000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny  + No extra smearing
+       
+} else if ( trainConfig == 37 ) {
+  
+       eventCutArray[0] = "8000011"; photonCutArray[0] = "002093603007200000000"; ElecCutarray[0] = "90475400233202623700"; MesonCutarray[0] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny    + new psiPair Cut    0.60, 0.0 0.12
+       eventCutArray[1] = "8000011"; photonCutArray[1] = "002093603007200000000"; ElecCutarray[1] = "90475400833202623700"; MesonCutarray[1] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kBoth   + new psiPair cut    0.60, 0.0 0.12
+       eventCutArray[2] = "8000011"; photonCutArray[2] = "002093603007200000000"; ElecCutarray[2] = "90475400133202623700"; MesonCutarray[2] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kFirst  + new psiPair Cut    0.60, 0.0 0.12
+       eventCutArray[3] = "8000011"; photonCutArray[3] = "002093603007200000000"; ElecCutarray[3] = "90475400233002623700"; MesonCutarray[3] = "01031035009000"; //standard cut Pi0 pPb 00-100  //Tracks 2011 + kAny    + no psi pair + no weights
+       
 }
+       
 
 
 
@@ -403,7 +502,7 @@ if( trainConfig == 1 ) {  // No eta shift |Y| < 0.8
 
       analysisEventCuts[i] = new AliConvEventCuts();
 
-         if (  ( trainConfig >= 1 && trainConfig <= 9 ) || trainConfig == 19  || trainConfig == 21 || trainConfig == 23 ){
+         if (  ( trainConfig >= 1 && trainConfig <= 9 ) || trainConfig == 19  || trainConfig == 21 || trainConfig == 23 || ( trainConfig >= 24 && trainConfig <=36 )  ){
            
            if (doWeighting){
              if (generatorName.CompareTo("DPMJET")==0){
index 65d2aaf3002f23466a47c999293a91804d21e032..7b713d1ef76ad5902897579e88989aca4bafda3a 100644 (file)
@@ -852,6 +852,18 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
                eventCutArray[ 2] = "5010002"; photonCutArray[ 2] = "007092970028250440000"; mesonCutArray[ 2] = "01525065000000"; // 0-10%
                eventCutArray[ 3] = "5240002"; photonCutArray[ 3] = "007092970028250440000"; mesonCutArray[ 3] = "01525065000000"; // 10-20%
                eventCutArray[ 4] = "5250002"; photonCutArray[ 4] = "007092970028250440000"; mesonCutArray[ 4] = "01525065000000"; // 0-20%             
+       } else if ( trainConfig == 124){ // cleaner cuts, specific centrality trigger selection 
+               eventCutArray[ 0] = "5080001"; photonCutArray[ 0] = "007092970028250440000"; mesonCutArray[ 0] = "01525065000000"; // normal centrality
+               eventCutArray[ 1] = "5083101"; photonCutArray[ 1] = "007092970028250440000"; mesonCutArray[ 1] = "01525065000000"; // kCentral open
+               eventCutArray[ 2] = "5083201"; photonCutArray[ 2] = "007092970028250440000"; mesonCutArray[ 2] = "01525065000000"; // kCentral vertex
+               eventCutArray[ 3] = "5083301"; photonCutArray[ 3] = "007092970028250440000"; mesonCutArray[ 3] = "01525065000000"; // kCentral both
+               eventCutArray[ 4] = "5083401"; photonCutArray[ 4] = "007092970028250440000"; mesonCutArray[ 4] = "01525065000000"; // kSemiCentral open
+       } else if ( trainConfig == 125){ // cleaner cuts, specific centrality trigger selection 
+               eventCutArray[ 0] = "5080001"; photonCutArray[ 0] = "007092970028250440000"; mesonCutArray[ 0] = "01525065000000"; // normal centrality
+               eventCutArray[ 1] = "5083501"; photonCutArray[ 1] = "007092970028250440000"; mesonCutArray[ 1] = "01525065000000"; // kSemiCentral vertex
+               eventCutArray[ 2] = "5083601"; photonCutArray[ 2] = "007092970028250440000"; mesonCutArray[ 2] = "01525065000000"; // kSemiCentral both
+               eventCutArray[ 3] = "5083701"; photonCutArray[ 3] = "007092970028250440000"; mesonCutArray[ 3] = "01525065000000"; // kMB 1 only
+               eventCutArray[ 4] = "5083801"; photonCutArray[ 4] = "007092970028250440000"; mesonCutArray[ 4] = "01525065000000"; // kMB 2 only                
        } else {
                Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
                return;
index 652081ad01fb603765fe2d5f4aba41a9f9d17626..8fcbd52d17491c29656059e6e6372267455944c0 100644 (file)
@@ -112,19 +112,19 @@ void AddTask_GammaConvV1_pp(  Int_t trainConfig = 1,                                                                              // change differ
        
        if(trainConfig == 1){
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only Minbias MC
-               eventCutArray[ 1] = "0001011"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
+               eventCutArray[ 1] = "0001211"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
                eventCutArray[ 2] = "0000011"; photonCutArray[ 2] = "002093260003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV
                eventCutArray[ 3] = "0000011"; photonCutArray[ 3] = "002093660003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV
        } else if (trainConfig == 2) {
                eventCutArray[ 0] = "0000012"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only boxes
-               eventCutArray[ 1] = "0001012"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
+               eventCutArray[ 1] = "0001212"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
                eventCutArray[ 2] = "0000012"; photonCutArray[ 2] = "002093260003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
                eventCutArray[ 3] = "0000012"; photonCutArray[ 3] = "002093660003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV 
        } else if (trainConfig == 3) {
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
-               eventCutArray[ 1] = "0003011"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
-               eventCutArray[ 2] = "0002012"; photonCutArray[ 2] = "002093663003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
-               eventCutArray[ 3] = "0003012"; photonCutArray[ 3] = "002093663003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
+               eventCutArray[ 1] = "0001311"; photonCutArray[ 1] = "002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
+               eventCutArray[ 2] = "0000312"; photonCutArray[ 2] = "002093663003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
+               eventCutArray[ 3] = "0001312"; photonCutArray[ 3] = "002093663003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
        } else if (trainConfig == 4) {
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , all photon qualities
                eventCutArray[ 1] = "0000011"; photonCutArray[ 1] = "002093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 1
@@ -156,15 +156,15 @@ void AddTask_GammaConvV1_pp(  Int_t trainConfig = 1,                                                                              // change differ
                eventCutArray[ 2] = "0000011"; photonCutArray[ 2] = "007083663000200030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 2, min R = 35 cm
                eventCutArray[ 3] = "0000011"; photonCutArray[ 3] = "007083663000200040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 3, min R = 35 cm      
        } else if (trainConfig == 10) {
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities
-               eventCutArray[ 1] = "0002011"; photonCutArray[ 1] = "002093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1
-               eventCutArray[ 2] = "0002011"; photonCutArray[ 2] = "002093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2
-               eventCutArray[ 3] = "0002011"; photonCutArray[ 3] = "002093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities
+               eventCutArray[ 1] = "0000311"; photonCutArray[ 1] = "002093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1
+               eventCutArray[ 2] = "0000311"; photonCutArray[ 2] = "002093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2
+               eventCutArray[ 3] = "0000311"; photonCutArray[ 3] = "002093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3
        } else if (trainConfig == 11) {
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities, min R = 35 cm
-               eventCutArray[ 1] = "0002011"; photonCutArray[ 1] = "007093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1, min R = 35 cm
-               eventCutArray[ 2] = "0002011"; photonCutArray[ 2] = "007093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2, min R = 35 cm
-               eventCutArray[ 3] = "0002011"; photonCutArray[ 3] = "007093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3, min R = 35 cm
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities, min R = 35 cm
+               eventCutArray[ 1] = "0000311"; photonCutArray[ 1] = "007093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1, min R = 35 cm
+               eventCutArray[ 2] = "0000311"; photonCutArray[ 2] = "007093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2, min R = 35 cm
+               eventCutArray[ 3] = "0000311"; photonCutArray[ 3] = "007093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3, min R = 35 cm
        } else if (trainConfig == 12) {
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002092970028250400000"; mesonCutArray[0] = "01525065000000"; //standard cut LHC11h pp 2.76TeV 
                eventCutArray[ 1] = "0000011"; photonCutArray[ 1] = "032092970028250400000"; mesonCutArray[1] = "01525065000000"; //variation eta 0.65
index 31aab34bb1d432579fe85871fd2fe41825bbb537..d1ac063e0f9ff457dd2ac2428ea341354d6bbe1d 100644 (file)
@@ -123,21 +123,21 @@ void AddTask_GammaConvV1_pp2(  Int_t trainConfig = 1,  //change different set of
        } else if (trainConfig == 6) { 
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002093260003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Gamma pp 2-76TeV
        } else if (trainConfig == 7) {    
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
        } else if (trainConfig == 8) {    
-               eventCutArray[ 0] = "0003011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
+               eventCutArray[ 0] = "0001311"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
        } else if (trainConfig == 9) {    
-               eventCutArray[ 0] = "0002012"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
+               eventCutArray[ 0] = "0000312"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
        } else if (trainConfig == 10) { 
-               eventCutArray[ 0] = "0003012"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
+               eventCutArray[ 0] = "0001312"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
        } else if (trainConfig == 11) { 
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , all photon qualities
        } else if (trainConfig == 12) { 
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , all photon qualities, min R = 35 cm
        } else if (trainConfig == 13) { 
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities
        } else if (trainConfig == 14) { 
-               eventCutArray[ 0] = "0002011"; photonCutArray[ 0] = "007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities, min R = 35 cm
+               eventCutArray[ 0] = "0000311"; photonCutArray[ 0] = "007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities, min R = 35 cm
        } else if (trainConfig == 15) { 
                eventCutArray[ 0] = "0000011"; photonCutArray[ 0] = "002092970028250400000"; mesonCutArray[0] = "01525065000000"; //standard cut LHC11h pp 2.76TeV 
        } else if (trainConfig == 16) { 
index 085b85df5c7429f0168d70112c0cddee2c2ceb13..973f6d7d6cf7bdfaed5886ab093d11097a71e4c4 100644 (file)
@@ -770,7 +770,10 @@ void AliAnalysisTaskTaggedPhotons::UserExec(Option_t *)
     
     TLorentzVector momentum ;
     clu->GetMomentum(momentum, vtx5);
+    
     AliCaloPhoton *p = new ((*fPHOSEvent)[inList]) AliCaloPhoton(momentum.Px(),momentum.Py(),momentum.Pz(),clu->E() );
+//    momentum*= clu->GetCoreEnergy()/momentum.E() ;
+//    AliCaloPhoton *p = new ((*fPHOSEvent)[inList]) AliCaloPhoton(momentum.Px(),momentum.Py(),momentum.Pz(),clu->GetCoreEnergy() );
     inList++;
     
     Int_t isolation = EvalIsolation(&momentum,kTRUE) ;
@@ -814,7 +817,10 @@ void AliAnalysisTaskTaggedPhotons::UserExec(Option_t *)
       p->SetWeight(1.) ;
     }
     //PID criteria
-    p->SetDispBit(clu->Chi2()<2.5*2.5) ;
+//  Cut on full Lambdas    
+//    p->SetDispBit(clu->Chi2()<2.5*2.5) ;
+//  Cut on CoreLamdas
+    p->SetDispBit(clu->GetDispersion()<2.5*2.5) ;
     p->SetTOFBit(TestTOF(clu->GetTOF(),clu->E())) ;
     p->SetCPVBit(clu->GetEmcCpvDistance()>2.5) ;   
     
index 81dffff0f1c36274ed428d5246f9a8c8517595fe..f79e24826be3f302d98e9ade65eb156c95583483 100644 (file)
@@ -2145,16 +2145,20 @@ void AliAnalysisTaskFlowTPCTOFEPSP::UserExec(Option_t */*option*/)
        AliHFEpidObject hfetrack;
        if(!fAODAnalysis){
          hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
-         if(fVariableMultiplicity==0)
-           if(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
+         if(fVariableMultiplicity==0) 
+           hfetrack.SetMulitplicity(cntr);
          if(fVariableMultiplicity==1)
            hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetNumberOfESDTracks()/8.);
+         if(fVariableMultiplicity==2)
+           hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
        }else{
          hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
-         if(fVariableMultiplicity==0)
-           if(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
+         if(fVariableMultiplicity==0) 
+           hfetrack.SetMulitplicity(cntr);
          if(fVariableMultiplicity==1)
            hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetNumberOfESDTracks()/8.);
+         if(fVariableMultiplicity==2)
+           hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
        }
        hfetrack.SetRecTrack(track);
        hfetrack.SetCentrality((Int_t)binct);
index c2721fbeffba3899b808908f7b525a1c90b9d4d3..59a33a4b57d3954d25917865d55577a5ba272b91 100644 (file)
 
 #include "AliAnalysisTaskHFEemcQA.h"
 
+//QA task for EMCAL electron analysis 
+
 using std::cout;
 using std::endl;
-//QA task for EMCAL electron analysis 
 
 ClassImp(AliAnalysisTaskHFEemcQA)
   //________________________________________________________________________
@@ -41,6 +42,9 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   fAOD(0),
   fpidResponse(0),
   fFlagSparse(kFALSE),
+  fUseTender(kTRUE),
+  fTracks_tender(0),
+  fCaloClusters_tender(0),
   fOutputList(0),
   fNevents(0),
   fVtxZ(0),
@@ -67,6 +71,10 @@ ClassImp(AliAnalysisTaskHFEemcQA)
   fHistdEdxEop(0),
   fHistNsigEop(0),
   fHistEop(0),
+  fM20(0),
+  fM02(0),
+  fM20EovP(0),
+  fM02EovP(0),
   fEleCanTPCNpts(0),
   fEleCanTPCNCls(0),
   fEleCanITSNCls(0),
@@ -96,6 +104,9 @@ AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA()
   fAOD(0),
   fpidResponse(0),
   fFlagSparse(kFALSE),
+  fUseTender(kTRUE),
+  fTracks_tender(0),
+  fCaloClusters_tender(0),
   fOutputList(0),
   fNevents(0),
   fVtxZ(0),
@@ -122,6 +133,10 @@ AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA()
   fHistdEdxEop(0),
   fHistNsigEop(0),
   fHistEop(0),
+  fM20(0),
+  fM02(0),
+  fM20EovP(0),
+  fM02EovP(0),
   fEleCanTPCNpts(0),
   fEleCanTPCNCls(0),
   fEleCanITSNCls(0),
@@ -150,6 +165,8 @@ AliAnalysisTaskHFEemcQA::~AliAnalysisTaskHFEemcQA()
 {
   //Destructor 
   delete fOutputList;
+  delete fTracks_tender;
+  delete fCaloClusters_tender;
   delete fSparseElectron;
   delete []fvalueElectron;
 }
@@ -240,7 +257,7 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
 
   fEMCdEdx = new TH2F("fEMCdEdx","dE/dx distribution of tracks matched to EMCAL;p (GeV/c);dE/dx",200,0,20,500,0,160);
   fOutputList->Add(fEMCdEdx);
-    
+
   fEMCTPCnsig = new TH2F("fEMCTPCnsig","TPC Nsigma distribution of tracks matched to EMCAL;p (GeV/c);#sigma_{TPC-dE/dx}",1000,0,50,200,-10,10);
   fOutputList->Add(fEMCTPCnsig);
 
@@ -252,10 +269,22 @@ void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
 
   fHistdEdxEop = new TH2F("fHistdEdxEop", "E/p vs dE/dx;E/p;dE/dx", 60, 0.0, 3.0, 500,0,160);
   fOutputList->Add(fHistdEdxEop);
-    
+
   fHistNsigEop = new TH2F ("fHistNsigEop", "E/p vs TPC nsig",60, 0.0, 3.0, 200, -10,10);
   fOutputList->Add(fHistNsigEop);
 
+  fM20 = new TH2F ("fM20","M20 vs pt distribution",200,0,20,400,0,2);
+  fOutputList->Add(fM20);
+
+  fM02 = new TH2F ("fM02","M02 vs pt distribution",200,0,20,400,0,2);
+  fOutputList->Add(fM02);
+
+  fM20EovP = new TH2F ("fM20EovP","M20 vs E/p distribution",400,0,3,400,0,2);
+  fOutputList->Add(fM20EovP);
+
+  fM02EovP = new TH2F ("fM02EovP","M02 vs E/p distribution",400,0,3,400,0,2);
+  fOutputList->Add(fM02EovP);
+
   fEleCanTPCNpts = new TH2F("fEleCanTPCNpts","TPC Npoints used for dE/dx for electron candidates;p_{T} (GeV/c);N points",200,0,20,200,0,200);
   fOutputList->Add(fEleCanTPCNpts);
 
@@ -309,6 +338,17 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
     //   printf("fESD available\n");
     //return;
   }
+    
+  //////////////
+  //if Tender //
+  //////////////
+  if(fUseTender){
+        //new branches with calibrated tracks and clusters
+        if(IsAODanalysis()) fTracks_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("AODFilterTracks"));
+        if(!IsAODanalysis()) fTracks_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("ESDFilterTracks"));
+        
+        fCaloClusters_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("EmcCaloClusters"));
+  }
 
   ////////////////////
   //cuts initialised//
@@ -333,7 +373,8 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
   //Event vertex//
   ///////////////
   Int_t ntracks;
-  ntracks = fVevent->GetNumberOfTracks();
+  if(!fUseTender)ntracks = fVevent->GetNumberOfTracks();
+  if(fUseTender) ntracks = fTracks_tender->GetEntries();
   printf("There are %d tracks in this event\n",ntracks);
 
   fNevents->Fill(0); //all events
@@ -398,12 +439,16 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
   /////////////////////////////
   //EMCAL cluster information//
   ////////////////////////////
-  Int_t Nclust = 0;
-  Nclust = fVevent->GetNumberOfCaloClusters();
+  Int_t Nclust = -999;
+  if(!fUseTender) Nclust = fVevent->GetNumberOfCaloClusters();
+  if(fUseTender) Nclust = fCaloClusters_tender->GetEntries();
   for(Int_t icl=0; icl<Nclust; icl++)
   {
     AliVCluster *clust = 0x0;
-    clust = fVevent->GetCaloCluster(icl);
+    if(!fUseTender) clust = fVevent->GetCaloCluster(icl);
+    if(fUseTender) clust = dynamic_cast<AliVCluster*>(fCaloClusters_tender->At(icl));
+    if(!clust)  printf("ERROR: Could not receive cluster matched calibrated from track %d\n", icl);
+      
     if(clust && clust->IsEMCAL())
     {
       Double_t clustE = clust->E();
@@ -445,7 +490,10 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
   ///////////////
   for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
 
-    AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
+    AliVParticle* Vtrack = 0x0;
+    if(!fUseTender) Vtrack  = fVevent->GetTrack(iTracks);
+    if(fUseTender) Vtrack = dynamic_cast<AliVTrack*>(fTracks_tender->At(iTracks));
+      
     if (!Vtrack) {
       printf("ERROR: Could not receive track %d\n", iTracks);
       continue;
@@ -478,7 +526,6 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
       if(etrack->GetKinkIndex(0) != 0) continue;
     }
 
-
     ////////////////////
     //Track properties//
     ///////////////////
@@ -519,13 +566,20 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
       //E/p distribution
       Double_t clustMatchE = clustMatch->E();
       Double_t eop = -1.0;
+      Double_t m02 = -99999;
       if(track->P()>0)eop = clustMatchE/track->P();
+      m02 =clustMatch->GetM02();
 
       if(track->Pt()>1.0){
         fHistdEdxEop->Fill(eop,dEdx);
         fHistNsigEop->Fill(eop,fTPCnSigma);
+        fM20EovP->Fill(eop,clustMatch->GetM20());
+        fM02EovP->Fill(eop,clustMatch->GetM02());
       }
+
       fHistEop->Fill(track->Pt(),eop);
+      fM20->Fill(track->Pt(),clustMatch->GetM20());
+      fM02->Fill(track->Pt(),clustMatch->GetM02());
 
       //EID THnsparse
       fvalueElectron[0] = trigger;
@@ -543,7 +597,7 @@ void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
       ////////////////////////////////////////////////
       //Track properties of EMCAL electron cadidates//
       ///////////////////////////////////////////////
-      if(fTPCnSigma > -1 && fTPCnSigma < 3 && eop>0.8 && eop<1.2){
+      if(fTPCnSigma > -1 && fTPCnSigma < 3 && eop>0.9 && eop<1.2 && m02 > 0.006 && m02 < 0.035){
         fEleCanTPCNpts->Fill(track->Pt(),track->GetTPCsignalN());
         fEleCanTPCNCls->Fill(track->Pt(),track->GetTPCNcls());
 
index f854d2c804e03a8d5f4e3b5c729db7dad5a16aef..3593accdc19179e50e27638306baef40fddf4fee 100644 (file)
@@ -16,76 +16,87 @@ class AliCFManager;
 #include "AliAnalysisTaskSE.h"
 
 class AliAnalysisTaskHFEemcQA : public AliAnalysisTaskSE {
- public:
-  AliAnalysisTaskHFEemcQA();
-  AliAnalysisTaskHFEemcQA(const char *name);
-  virtual ~AliAnalysisTaskHFEemcQA();
-  
-  virtual void   UserCreateOutputObjects();
-  virtual void   UserExec(Option_t *option);
-  virtual void   Terminate(Option_t *);
-
-  void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
-  void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
-  Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
-
-  Bool_t GetElecIDsparse() {return fFlagSparse;};
-  void SetElecIDsparse(Bool_t flagelecIDsparse){fFlagSparse = flagelecIDsparse;};
-
- private:
-  enum{
-    kAODanalysis = BIT(20),
-  };
-
-  AliVEvent   *fVevent;  //!event object
-  AliESDEvent *fESD;    //!ESD object
-  AliAODEvent *fAOD;    //!AOD object
-  AliPIDResponse *fpidResponse; //!pid response
-
-  Bool_t      fFlagSparse;// switch to THnspare
-
-  TList       *fOutputList; //!Output list
-  TH1F        *fNevents;//! no of events
-  TH1F        *fVtxZ;//!Vertex z 
-  TH1F        *fVtxX;//!Vertex x 
-  TH1F        *fVtxY;//!Vertex y 
-  TH2F        *fTrigMulti;//!trigger multiplicity 
-  TH1F        *fHistClustE;//!cluster energy
-  TH2F        *fEMCClsEtaPhi;//! EMC cluster eta and phi 
-  TH1F        *fNegTrkIDPt;//!neg track ID
-  TH1F        *fTrkPt;//!track pt
-  TH1F        *fTrketa;//!track eta
-  TH1F        *fTrkphi;//!track phi 
-  TH2F        *fdEdx;//!dedx vs pt
-  TH2F        *fTPCNpts;//!TPC Npoints used for dedx
-  TH2F        *fTPCnsig;//!TPC Nsigma
-  TH1F        *fHistPtMatch;//!tracks matched to EMCAL 
-  TH2F        *fEMCTrkMatch;//!Distance of EMC cluster to closest track in phi and z
-  TH1F        *fEMCTrkPt;//!tracks with EMCAL cluster
-  TH1F        *fEMCTrketa;//!EMC trk eta
-  TH1F        *fEMCTrkphi;//!EMC trk phi
-  TH2F        *fEMCdEdx;//!EMC trk dedx
-  TH2F        *fEMCTPCnsig;//! EMC trk nsig
-  TH2F        *fEMCTPCNpts;//!EMC Npoints used for dedx
-  TH2F        *fHistdEdxEop;//!E/p vs dedx
-  TH2F        *fHistNsigEop;//!E/p vs dedx
-  TH2F        *fHistEop;//!pt vs E/p
-  TH2F        *fEleCanTPCNpts;//!ele cand TPC Npoints used for dedx
-  TH2F        *fEleCanTPCNCls;//!ele cand TPC N clusters
-  TH2F        *fEleCanITSNCls;//!ele cand ITS N clusters
-  TH1F        *fEleCanITShit;//!ele cand ITS hit map
-  TH2F        *fEleCanSPD1;//!ele cand hit SPD layer 1
-  TH2F        *fEleCanSPD2;//!ele cand hit SPD layer 2
-  TH2F        *fEleCanSPDBoth;//!ele cand SPD both layer
-  TH2F        *fEleCanSPDOr;//!ele cand SPD or
-
-  THnSparse  *fSparseElectron;//!Electron info 
-  Double_t *fvalueElectron;//!Electron info
-
-  AliAnalysisTaskHFEemcQA(const AliAnalysisTaskHFEemcQA&); // not implemented
-  AliAnalysisTaskHFEemcQA& operator=(const AliAnalysisTaskHFEemcQA&); // not implemented
-
-  ClassDef(AliAnalysisTaskHFEemcQA, 1); // example of analysis
+  public:
+    AliAnalysisTaskHFEemcQA();
+    AliAnalysisTaskHFEemcQA(const char *name);
+    virtual ~AliAnalysisTaskHFEemcQA();
+
+    virtual void   UserCreateOutputObjects();
+    virtual void   UserExec(Option_t *option);
+    virtual void   Terminate(Option_t *);
+
+    void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
+    void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
+    Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
+
+    Bool_t GetElecIDsparse() {return fFlagSparse;};
+    void SetElecIDsparse(Bool_t flagelecIDsparse){fFlagSparse = flagelecIDsparse;};
+    
+    Bool_t GetTenderSwitch() {return fUseTender;};
+    void SetTenderSwitch(Bool_t usetender){fUseTender = usetender;};
+
+  private:
+    enum{
+      kAODanalysis = BIT(20),
+    };
+
+    AliVEvent   *fVevent;  //!event object
+    AliESDEvent *fESD;    //!ESD object
+    AliAODEvent *fAOD;    //!AOD object
+    AliPIDResponse *fpidResponse; //!pid response
+
+    Bool_t      fFlagSparse;// switch to THnspare
+    Bool_t       fUseTender;// switch to add tender
+    
+    TClonesArray  *fTracks_tender;
+    TClonesArray  *fCaloClusters_tender;
+
+    TList       *fOutputList; //!Output list
+    TH1F        *fNevents;//! no of events
+    TH1F        *fVtxZ;//!Vertex z 
+    TH1F        *fVtxX;//!Vertex x 
+    TH1F        *fVtxY;//!Vertex y 
+    TH2F        *fTrigMulti;//!trigger multiplicity 
+    TH1F        *fHistClustE;//!cluster energy
+    TH2F        *fEMCClsEtaPhi;//! EMC cluster eta and phi 
+    TH1F        *fNegTrkIDPt;//!neg track ID
+    TH1F        *fTrkPt;//!track pt
+    TH1F        *fTrketa;//!track eta
+    TH1F        *fTrkphi;//!track phi 
+    TH2F        *fdEdx;//!dedx vs pt
+    TH2F        *fTPCNpts;//!TPC Npoints used for dedx
+    TH2F        *fTPCnsig;//!TPC Nsigma
+    TH1F        *fHistPtMatch;//!tracks matched to EMCAL 
+    TH2F        *fEMCTrkMatch;//!Distance of EMC cluster to closest track in phi and z
+    TH1F        *fEMCTrkPt;//!tracks with EMCAL cluster
+    TH1F        *fEMCTrketa;//!EMC trk eta
+    TH1F        *fEMCTrkphi;//!EMC trk phi
+    TH2F        *fEMCdEdx;//!EMC trk dedx
+    TH2F        *fEMCTPCnsig;//! EMC trk nsig
+    TH2F        *fEMCTPCNpts;//!EMC Npoints used for dedx
+    TH2F        *fHistdEdxEop;//!E/p vs dedx
+    TH2F        *fHistNsigEop;//!E/p vs dedx
+    TH2F        *fHistEop;//!pt vs E/p
+    TH2F        *fM20;//!M20 vs pt
+    TH2F        *fM02;//!M20 vs pt
+    TH2F        *fM20EovP;//!M20 vs E/p
+    TH2F        *fM02EovP;//!M20 vs E/p
+    TH2F        *fEleCanTPCNpts;//!ele cand TPC Npoints used for dedx
+    TH2F        *fEleCanTPCNCls;//!ele cand TPC N clusters
+    TH2F        *fEleCanITSNCls;//!ele cand ITS N clusters
+    TH1F        *fEleCanITShit;//!ele cand ITS hit map
+    TH2F        *fEleCanSPD1;//!ele cand hit SPD layer 1
+    TH2F        *fEleCanSPD2;//!ele cand hit SPD layer 2
+    TH2F        *fEleCanSPDBoth;//!ele cand SPD both layer
+    TH2F        *fEleCanSPDOr;//!ele cand SPD or
+
+    THnSparse  *fSparseElectron;//!Electron info 
+    Double_t *fvalueElectron;//!Electron info
+
+    AliAnalysisTaskHFEemcQA(const AliAnalysisTaskHFEemcQA&); // not implemented
+    AliAnalysisTaskHFEemcQA& operator=(const AliAnalysisTaskHFEemcQA&); // not implemented
+
+    ClassDef(AliAnalysisTaskHFEemcQA, 1); // example of analysis
 };
 
 #endif
index 4f807b39e0d4de18f3b834b63aaaa0063f174899..bcde3fa1288e31909cc418adadd30d68d7ef86fd 100644 (file)
@@ -27,6 +27,7 @@
 //  
 #include <TF1.h>
 #include <TMath.h>
+#include <TH2D.h>
 
 #include "AliTPCdEdxInfo.h"
 #include "AliAODPid.h"
@@ -86,6 +87,8 @@ AliHFEpidTPC::AliHFEpidTPC(const char* name) :
   , fkEtaWidthCorrection(NULL)
   , fkCentralityMeanCorrection(NULL)
   , fkCentralityWidthCorrection(NULL)
+  , fkCentralityEtaCorrectionMeanJpsi(NULL)
+  , fkCentralityEtaCorrectionWidthJpsi(NULL)
   , fHasCutModel(kFALSE)
   , fUseOnlyOROC(kFALSE)
   , fNsigmaTPC(3)
@@ -115,6 +118,8 @@ AliHFEpidTPC::AliHFEpidTPC(const AliHFEpidTPC &ref) :
   , fkEtaWidthCorrection(NULL)
   , fkCentralityMeanCorrection(NULL)
   , fkCentralityWidthCorrection(NULL)
+  , fkCentralityEtaCorrectionMeanJpsi(NULL)
+  , fkCentralityEtaCorrectionWidthJpsi(NULL)
   , fHasCutModel(ref.fHasCutModel)
   , fUseOnlyOROC(ref.fUseOnlyOROC)
   , fNsigmaTPC(2)
@@ -201,20 +206,6 @@ Int_t AliHFEpidTPC::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager
   const AliVTrack *rectrack;
   AliESDtrack esdtrack;
   AliAODTrack aodtrack;
-  /*if(fUseOnlyOROC && !(fkEtaCorrection || fkCentralityCorrection)) {
-    if(track->IsESDanalysis()){
-      esdtrack.~AliESDtrack();
-      new(&esdtrack) AliESDtrack(*(static_cast<const AliESDtrack *>(track->GetRecTrack())));
-      UseOROC(&esdtrack, anatype);
-      rectrack = &esdtrack;
-    } else {
-      aodtrack.~AliAODTrack();
-      new(&aodtrack) AliAODTrack(*(static_cast<const AliAODTrack *>(track->GetRecTrack())));
-      UseOROC(&aodtrack, anatype);
-      rectrack = &aodtrack;
-    }
-  }
-  else if(fkEtaCorrection || fkCentralityCorrection){*/
   Double_t correctedTPCnSigma=0.;
   Bool_t TPCnSigmaCorrected=kFALSE;
   if((fkEtaMeanCorrection&&fkEtaWidthCorrection)||
@@ -222,6 +213,12 @@ Int_t AliHFEpidTPC::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager
     TPCnSigmaCorrected=kTRUE;
     correctedTPCnSigma=GetCorrectedTPCnSigma(track->GetRecTrack()->Eta(), track->GetMultiplicity(), fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron));
   }
+  // jpsi
+  if((fkCentralityEtaCorrectionMeanJpsi)&&
+     (fkCentralityEtaCorrectionWidthJpsi)){
+    TPCnSigmaCorrected=kTRUE;
+    correctedTPCnSigma=GetCorrectedTPCnSigmaJpsi(track->GetRecTrack()->Eta(), track->GetMultiplicity(), fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron));
+  }
   if(fkEtaCorrection || fkCentralityCorrection){
     // Correction available
     // apply it on copy
@@ -384,7 +381,6 @@ Double_t AliHFEpidTPC::GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEs
   // N.B. This correction has to be applied on a copy track
   //
   Double_t corrtpcNsigma = tpcNsigma;
-  AliDebug(1, Form("Applying correction function %s\n", fkEtaCorrection->GetName()));
   if(fkEtaMeanCorrection&&fkEtaWidthCorrection){
     if(TMath::Abs(fkEtaWidthCorrection->Eval(eta))>0.0000001) corrtpcNsigma=(corrtpcNsigma-fkEtaMeanCorrection->Eval(eta))/fkEtaWidthCorrection->Eval(eta);
   }
@@ -394,6 +390,32 @@ Double_t AliHFEpidTPC::GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEs
   return corrtpcNsigma;
 }
 
+//___________________________________________________________________
+Double_t AliHFEpidTPC::GetCorrectedTPCnSigmaJpsi(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const{
+  //
+  // Apply correction for the eta dependence
+  // N.B. This correction has to be applied on a copy track
+  //
+  Double_t corrtpcNsigma = tpcNsigma;
+  if(fkCentralityEtaCorrectionMeanJpsi&&fkCentralityEtaCorrectionWidthJpsi){
+    const TAxis *caxis = fkCentralityEtaCorrectionMeanJpsi->GetXaxis();
+    const TAxis *eaxis = fkCentralityEtaCorrectionMeanJpsi->GetYaxis();
+    Int_t cbin = caxis->FindFixBin(centralityEstimator);
+    Int_t ebin = eaxis->FindFixBin(eta);
+    Double_t cbinlowedge = caxis->GetBinLowEdge(cbin);
+    Double_t cbinupedge = caxis->GetBinUpEdge(cbin);
+    Double_t ebinlowedge = eaxis->GetBinLowEdge(ebin);
+    Double_t ebinupedge = eaxis->GetBinUpEdge(ebin);
+    Double_t center = fkCentralityEtaCorrectionMeanJpsi->GetBinContent(cbin,ebin);
+    Double_t width = fkCentralityEtaCorrectionWidthJpsi->GetBinContent(cbin,ebin);
+    //printf("cbin %d, cbinlowe %f, cbinupe %f, centrality %f\n",cbin,cbinlowedge,cbinupedge,centralityEstimator);
+    //printf("ebin %d, ebinlowe %f, ebinupe %f, eta %f\n",ebin,ebinlowedge,ebinupedge,eta);
+    //printf("mean %f, width %f\n",center,width);
+    if(TMath::Abs(width)>0.0000001) corrtpcNsigma=(corrtpcNsigma-center)/width;
+  }
+  return corrtpcNsigma;
+}
+
 //___________________________________________________________________
 void AliHFEpidTPC::UseOROC(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const{
   //
index e9bdc23d6355d6403d8a9eb62311c892609da670..7108eaf0c5ae8f2d7ac6633ede357c5436fe598d 100644 (file)
@@ -30,6 +30,7 @@
 
 class TList;
 class TF1;
+class TH2D;
 class AliAODTrack;
 class AliAODMCParticle;
 class AliESDtrack;
@@ -63,8 +64,9 @@ class AliHFEpidTPC : public AliHFEpidBase{
     void SetLowerSigmaCutCentrality(const TF1 * const model, Int_t centralityBin) { if(centralityBin < 11) fkLowerSigmaCut[centralityBin+1] = model; fHasCutModel = kTRUE; }
     void SetEtaCorrection(const TF1 *const param) { fkEtaCorrection = param; }
     void SetCentralityCorrection(const TF1 *const param){ fkCentralityCorrection = param; }
-  void SetEtaCorrections(const TF1 *const mean, const TF1 *const wdth) { fkEtaMeanCorrection = mean; fkEtaWidthCorrection = wdth; }
-  void SetCentralityCorrections(const TF1 *const mean, const TF1 *const wdth) { fkCentralityMeanCorrection = mean; fkCentralityWidthCorrection = wdth; }
+    void SetEtaCorrections(const TF1 *const mean, const TF1 *const wdth) { fkEtaMeanCorrection = mean; fkEtaWidthCorrection = wdth; }
+    void SetCentralityCorrections(const TF1 *const mean, const TF1 *const wdth) { fkCentralityMeanCorrection = mean; fkCentralityWidthCorrection = wdth; }
+    void SetJpsiCorrections(const TH2D *const mean, const TH2D *const wdth) { fkCentralityEtaCorrectionMeanJpsi = mean; fkCentralityEtaCorrectionWidthJpsi = wdth; }
     void UsedEdx() { fUsedEdx = kTRUE; }
     void UseNSigma() { fUsedEdx = kFALSE; }
     Bool_t HasEtaCorrection() const { return fkEtaCorrection != NULL; }
@@ -75,6 +77,7 @@ class AliHFEpidTPC : public AliHFEpidBase{
     void ApplyEtaCorrection(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;
     void ApplyCentralityCorrection(AliVTrack *track, Double_t centralityEstimator, AliHFEpidObject::AnalysisType_t anatype) const;
     Double_t GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
+    Double_t GetCorrectedTPCnSigmaJpsi(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
     void UseOROC(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;
 
   protected:
@@ -98,6 +101,8 @@ class AliHFEpidTPC : public AliHFEpidBase{
     const TF1 *fkEtaWidthCorrection;                        // Correct eta dependence of the width of the TPC n sigma
     const TF1 *fkCentralityMeanCorrection;                  // Correct centrality dependence of the mean of the TPC n sigma
     const TF1 *fkCentralityWidthCorrection;                 // Correct centrality dependence of the width of the TPC n sigma
+    const TH2D *fkCentralityEtaCorrectionMeanJpsi;          // Correction from J/psi group for the mean
+    const TH2D *fkCentralityEtaCorrectionWidthJpsi;         // Correction from J/psi group for the width
     Bool_t fHasCutModel;                                    // Has cut model functions
     Bool_t fUseOnlyOROC;                                    // Use only OROC
     Float_t fPAsigCut[2];                                   // Momentum region where to perform asymmetric sigma cut
@@ -107,7 +112,7 @@ class AliHFEpidTPC : public AliHFEpidBase{
     UChar_t fRejectionEnabled;                              // Bitmap for enabled particle rejection
     Bool_t  fUsedEdx;                                       // Apply cut on dE/dx instead of number of sigmas
 
-  ClassDef(AliHFEpidTPC, 2)   // TPC Electron ID class
+  ClassDef(AliHFEpidTPC, 3)   // TPC Electron ID class
 };
 
 inline void AliHFEpidTPC::SetAsymmetricTPCsigmaCut(Float_t pmin, Float_t pmax, Float_t sigmaMin, Float_t sigmaMax) { 
index 273196655171fb9688cbf9ef97bb5756ed1d41d6..11a2443a77aa573317944e56d2fcfac22bf33180 100644 (file)
@@ -198,16 +198,16 @@ void AliHFEtpcPIDqa::Initialize(){
   Int_t kDedxbins = fQAmanager->HasHighResolutionHistos() ? 400 : 200;
   Int_t kSigmaBins = fQAmanager->HasHighResolutionHistos() ? 1400 : 240;
   kSigmaBins = fQAmanager->HasMidResolutionHistos() ? 400 : kSigmaBins;
-  Int_t kEtabins = fQAmanager->HasHighResolutionEtaHistos() ? 27 : 18;
+  Int_t kEtabins = fQAmanager->HasHighResolutionEtaHistos() ? 33 : 18;
 
   // 1st histogram: TPC dEdx: (species, p, dEdx, step)
-  Int_t nBinsdEdx[kNdim] = {kPIDbins, kPbins, kDedxbins, kSteps, kCentralityBins, kEtabins, 50};
+  Int_t nBinsdEdx[kNdim] = {kPIDbins, kPbins, kDedxbins, kSteps, kCentralityBins, kEtabins, 33};
   Double_t mindEdx[kNdim] =  {kMinPID, kMinP, 20., 0., 0., kMinEta, 0};
   Double_t maxdEdx[kNdim] =  {kMaxPID, kMaxP, 130, 2., 11., kMaxEta, 2000};
   fHistos->CreateTHnSparse("tpcDedx", "TPC signal; species; p [GeV/c]; TPC signal [a.u.]; Selection Step; Centrality; Eta; pVx contrib", kNdim, nBinsdEdx, mindEdx, maxdEdx);
   
   // 2nd histogram: TPC sigmas: (species, p nsigma, step)
-  Int_t nBinsSigma[kNdim] = {kPIDbins, kPbins, kSigmaBins, kSteps, kCentralityBins, kEtabins, 50};
+  Int_t nBinsSigma[kNdim] = {kPIDbins, kPbins, kSigmaBins, kSteps, kCentralityBins, kEtabins, 33};
   Double_t minSigma[kNdim] = {kMinPID, kMinP, -12., 0., 0., kMinEta, 0};
   Double_t maxSigma[kNdim] = {kMaxPID, kMaxP, 12., 2., 11., kMaxEta, 2000};
   fHistos->CreateTHnSparse("tpcnSigma", "TPC signal; species; p [GeV/c]; TPC signal [a.u.]; Selection Step; Centrality; Eta; pVx contrib", kNdim, nBinsSigma, minSigma, maxSigma);
index 96eb4419591345e5141b79efca46863bdd6a7911..1d1a42d6e14244e9e31f6003ed2b4da179e0986f 100644 (file)
@@ -12,6 +12,8 @@ AliAnalysisTask *AddTaskHFEFlowTPCTOFEPSP(Int_t trigger=0,Int_t aodfilter=16,Boo
   // 0.19 40-50%, sigma=1.2
   // 0.2 50-60%
   // 0.2 60-80% list_t65536f16TPC110r60p80s11km0ITS4C36Pi2DCAr100z200TOF30TPCe50V1D0er8i0t-20t50
+
+  /*
   tpcdedx[0]=-0.2;
   tpcdedx[1]=-0.15;
   tpcdedx[2]=-0.1;
@@ -60,6 +62,7 @@ AliAnalysisTask *AddTaskHFEFlowTPCTOFEPSP(Int_t trigger=0,Int_t aodfilter=16,Boo
     tpcdedx[6]=0.473;
     tpcdedx[7]=0.473;
   }
+  */
 
   // Name
   TString appendixx(TString::Format("t%df%ds%dp%dM%dTPC%dr%dp%dITS%dPi%dDCAr%dz%dTOF%dTPCe%dV%dD%der%dbin%di%dt%dt%d",(Int_t)trigger,aodfilter,(Int_t)scalarProduct,(Int_t)cutPileup,(Int_t)variableM,tpcCls,(Int_t)tpcClsr,tpcClspid,itsCls,(Int_t) pixellayer,(Int_t) dcaxy,(Int_t)dcaz,(Int_t) tofsig,(Int_t)tpceff,vzero,debuglevel,(Int_t)(etarange*0.1),(Int_t)withetacorrection,(Int_t)withmultcorrection,(Int_t)ITSclustersback,(Int_t)(minTPCback*10.0),(Int_t)(maxTPCback*10.0)));
index cf014756c563f3f3c76701229cb96466b4dd72ca..b751be66abc05b832697986da104e6dc6d495e9e 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
+AliAnalysisTask *AddTaskHFEemcQA(Bool_t UseTender=kTRUE, Bool_t FillElecSparse=kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
@@ -18,12 +18,14 @@ AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
   }else{
     MCthere=kTRUE;
   }
+  
 
   // +++ EMCal MB
   AliAnalysisTaskHFEemcQA *hfecalqa = new AliAnalysisTaskHFEemcQA("emcqa");
   mgr->AddTask(hfecalqa);
   hfecalqa->SelectCollisionCandidates(AliVEvent::kINT8);
   hfecalqa->SetElecIDsparse(FillElecSparse);
+  hfecalqa->SetTenderSwitch(UseTender);
 
   TString containerName = mgr->GetCommonFileName();
   containerName += ":PWGHF_hfeHFEemcQAINT8";
@@ -36,6 +38,7 @@ AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
   mgr->AddTask(hfecalqa7);
   hfecalqa7->SelectCollisionCandidates(AliVEvent::kINT7);
   hfecalqa7->SetElecIDsparse(FillElecSparse);
+  hfecalqa7->SetTenderSwitch(UseTender);
 
   TString containerName7 = mgr->GetCommonFileName();
   containerName7 += ":PWGHF_hfeHFEemcQAINT7";
@@ -49,6 +52,7 @@ AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
   mgr->AddTask(hfecalqaTrig0);
   hfecalqaTrig0->SelectCollisionCandidates(AliVEvent::kEMCEGA);
   hfecalqaTrig0->SetElecIDsparse(FillElecSparse);
+  hfecalqaTrig0->SetTenderSwitch(UseTender);
 
   TString containerName1 = mgr->GetCommonFileName();
   containerName1 += ":PWGHF_hfeHFEemcQATrigGA";
@@ -63,6 +67,7 @@ AliAnalysisTask *AddTaskHFEemcQA(Bool_t FillElecSparse=kFALSE){
   mgr->AddTask(hfecalqaTrig1);
   hfecalqaTrig1->SelectCollisionCandidates(AliVEvent::kEMCEJE);
   hfecalqaTrig1->SetElecIDsparse(FillElecSparse);
+  hfecalqaTrig1->SetTenderSwitch(UseTender);
 
   TString containerName2 = mgr->GetCommonFileName();
   containerName2 += ":PWGHF_hfeHFEemcQATrigJE";
index 3ee2f7041af237f3a79fe39d629855b58f25dced..25f272fcbadd8ae1e8fa07cc1527875787060e66 100644 (file)
@@ -1,3 +1,27 @@
+TH2D *GetCorrectionsJpsiMean(TString map){
+  if (gSystem->AccessPathName(gSystem->ExpandPathName(map.Data()))){
+    Warning("ConfigHFE","Centrality map not found: %s",map.Data());
+    printf("ConfigHFE: Centrality map not found: %s\n",map.Data());
+    return kFALSE;
+  }
+  printf("File %s\n",map.Data());
+  TFile *f = TFile::Open(map.Data());
+  if(!f->IsOpen()) return kFALSE;
+  f->ls();
+  return (TH2D*)f->Get("centroidCentEta");
+}
+TH2D *GetCorrectionsJpsiWidth(TString map){
+  if (gSystem->AccessPathName(gSystem->ExpandPathName(map.Data()))){
+    Warning("ConfigHFE","Centrality map not found: %s",map.Data());
+    printf("ConfigHFE: Centrality map not found: %s\n",map.Data());
+    return kFALSE;
+  }
+  printf("File %s\n",map.Data());
+  TFile *f = TFile::Open(map.Data());
+  if(!f->IsOpen()) return kFALSE;
+  f->ls();
+  return (TH2D*)f->Get("widthCentEta");
+}
 TF1* GetCentralityCorrection(TString listname="LHC11h"){
   
   TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/CentCorrMapsTPC.root";
@@ -113,7 +137,7 @@ Double_t Contamination_40_50(const Double_t *x, const Double_t *par)
 
   
 }
-AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appendix,Int_t trigger,Int_t aodfilter=-1,Bool_t scalarProduct=kFALSE,Bool_t cutPileup=kTRUE,Int_t variableM = 1,Int_t tpcCls=110, Double_t tpcClsr=60.,Int_t tpcClspid=80, Int_t itsCls=4, Int_t pixellayer=2, Double_t dcaxy=100., Double_t dcaz=200.,  Double_t tofsig=30., Double_t *tpcdedx=NULL, Int_t vzero=1, Int_t debuglevel=0, Double_t etarange=80, Bool_t withetacorrection=kFALSE, Bool_t withmultcorrection=kFALSE, Double_t ITSclustersback=0,Double_t minTPCback=-2.0,Double_t maxTPCback=5.0)
+AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appendix,Int_t trigger,Int_t aodfilter=-1,Bool_t scalarProduct=kFALSE,Bool_t cutPileup=kTRUE,Int_t variableMr = 1,Int_t tpcCls=110, Double_t tpcClsr=60.,Int_t tpcClspid=80, Int_t itsCls=4, Int_t pixellayer=2, Double_t dcaxy=100., Double_t dcaz=200.,  Double_t tofsig=30., Double_t *tpcdedx=NULL, Int_t vzero=1, Int_t debuglevel=0, Double_t etarange=80, Bool_t withetacorrection=kFALSE, Bool_t withmultcorrection=kFALSE, Double_t ITSclustersback=0,Double_t minTPCback=-2.0,Double_t maxTPCback=5.0)
 {
   //
   // HFE flow task 
@@ -121,6 +145,10 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   Double_t tpcsharedfraction=11;
   Double_t chi2peritscl=36.;
 
+  // multEst = 0 or 10 (VZERO centrality, good, bad runs for Jpsi), = 1 (GetNumberOfESDtracks, Theo)
+  Int_t variableM = variableMr;
+  if(variableMr==10) variableM = 0;
+
   printf("Summary settings flow task\n");
   printf("filter %d\n",aodfilter);
   printf("TPC number of tracking clusters %d\n",tpcCls);
@@ -151,6 +179,7 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   printf("Max TPC back %f\n",maxTPCback);
   printf("PileUp cut %d\n",cutPileup);
   printf("Scalar Product %d\n",scalarProduct);
+  printf("Multiplicity Esimator %d\n",variableM);
 
   // Cut HFE
   AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
@@ -196,9 +225,9 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   task->SetTriggerUsed(trigger);
   task->SetDebugLevel(1);
   task->SetVariableMultiplicity(variableM);
-  task->GetPIDQAManager()->SetHighResolutionEtaHistos();
+  //task->GetPIDQAManager()->SetHighResolutionEtaHistos();
   task->GetPIDQAManager()->SetMidResolutionHistos();
-  task->GetPIDQAManager()->SetFillMultiplicity();
+  //task->GetPIDQAManager()->SetFillMultiplicity();
   task->SetHFECuts(hfecuts);
   task->SetHFEBackgroundCuts(hfeBackgroundCuts);
   if(aodfilter > 0) {
@@ -237,17 +266,36 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   
   if(withetacorrection || withmultcorrection) {
     AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
-    TF1 *etaCorrMean = GetEtaCorrection("LHC11h_etaCorrMean");
-    TF1 *etaCorrWdth = GetEtaCorrection("LHC11h_etaCorrWidth");
-    if(etaCorrMean && etaCorrWdth && withetacorrection){
-      tpcpid->SetEtaCorrections(etaCorrMean, etaCorrWdth);
-      printf("TPC dE/dx Eta correction %p %p\n",etaCorrMean,etaCorrWdth);
+    // Jpsi
+    if(variableMr==0) {
+      TH2D *meanc = GetCorrectionsJpsiMean("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root");
+      TH2D *widthc = GetCorrectionsJpsiWidth("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root");
+      //printf("Set\n");
+      if(meanc && widthc) {
+       tpcpid->SetJpsiCorrections(meanc,widthc);
+       //printf("Set the histos\n");
+      }
+    }
+    if(variableMr==10) {
+      TH2D *meanc = GetCorrectionsJpsiMean("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root");
+      TH2D *widthc = GetCorrectionsJpsiWidth("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root");
+      if(meanc && widthc) tpcpid->SetJpsiCorrections(meanc,widthc);
     }
-    TF1 *centCorrMean = GetCentralityCorrection("LHC11h_multCorrMean");
-    TF1 *centCorrWdth = GetCentralityCorrection("LHC11h_multCorrWidth");
-    if(centCorrMean && centCorrWdth && withmultcorrection){
-      tpcpid->SetCentralityCorrections(centCorrMean, centCorrWdth);
-      printf("TPC dE/dx multiplicity correction %p %p\n",centCorrMean,centCorrWdth);
+    // Theo
+    if(variableMr==1) {
+      task->GetPIDQAManager()->SetFillMultiplicity();
+      TF1 *etaCorrMean = GetEtaCorrection("LHC11h_etaCorrMean");
+      TF1 *etaCorrWdth = GetEtaCorrection("LHC11h_etaCorrWidth");
+      if(etaCorrMean && etaCorrWdth && withetacorrection){
+       tpcpid->SetEtaCorrections(etaCorrMean, etaCorrWdth);
+       printf("TPC dE/dx Eta correction %p %p\n",etaCorrMean,etaCorrWdth);
+      }
+      TF1 *centCorrMean = GetCentralityCorrection("LHC11h_multCorrMean");
+      TF1 *centCorrWdth = GetCentralityCorrection("LHC11h_multCorrWidth");
+      if(centCorrMean && centCorrWdth && withmultcorrection){
+       tpcpid->SetCentralityCorrections(centCorrMean, centCorrWdth);
+       printf("TPC dE/dx multiplicity correction %p %p\n",centCorrMean,centCorrWdth);
+      }
     }
   }
  
diff --git a/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root
new file mode 100644 (file)
index 0000000..758df72
Binary files /dev/null and b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root differ
diff --git a/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root
new file mode 100644 (file)
index 0000000..8b3219b
Binary files /dev/null and b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root differ
index 10fd239e986fdc42b7de04dbb40f15955648f591..a950ffa43ca7362d6eb544ee6d4caea4acf8aeff 100644 (file)
@@ -1001,7 +1001,7 @@ void AliAnalysisTaskCombinHF::DoMixing(Int_t poolIndex){
   if(poolIndex<0 || poolIndex>fNzVertPools*fNMultPools) return;
 
   Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
-  printf("Start Event Mixing of %d events\n",nEvents);
+  if(fDebug > 1) printf("Start Event Mixing of %d events\n",nEvents);
   TObjArray* karray=0x0;
   TObjArray* parray=0x0;
   fEventBuffer[poolIndex]->SetBranchAddress("karray", &karray);
index 70818a85de97503f0599580f77f225a101d19543..3dfa2798161990679fff0bebec042914957e02c0 100644 (file)
@@ -100,7 +100,9 @@ AliAnalysisTaskSELc2V0bachelor::AliAnalysisTaskSELc2V0bachelor() : AliAnalysisTa
   fMaxAngleForRot(7*TMath::Pi()/6),
   fMinMass(0),
   fMaxMass(0),
-  fNRotations(9)
+  fNRotations(9),
+  fPtMinToFillTheTree(0.),
+  fPtMaxToFillTheTree(999.)
 {
   //
   // Default ctor
@@ -138,13 +140,20 @@ AliAnalysisTaskSELc2V0bachelor::AliAnalysisTaskSELc2V0bachelor(const Char_t* nam
   fMaxAngleForRot(7*TMath::Pi()/6),
   fMinMass(0),
   fMaxMass(0),
-  fNRotations(9)
+  fNRotations(9),
+  fPtMinToFillTheTree(0.),
+  fPtMaxToFillTheTree(999.)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
   //
   Info("AliAnalysisTaskSELc2V0bachelor","Calling Constructor");
 
+  if (fWriteVariableTree && fTrackRotation) {
+    AliInfo(Form("You cannot initialize fWriteVariableTree=%d and fTrackRotation=%d => fTrackRotation=0",fWriteVariableTree,fTrackRotation));
+    fTrackRotation=kFALSE;
+  }
+
   Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
   fMinMass=mLcPDG-0.250;
   fMaxMass=mLcPDG+0.250;
@@ -386,6 +395,12 @@ void AliAnalysisTaskSELc2V0bachelor::Terminate(Option_t*)
       }
     }
 
+  } else {
+    fVariablesTree = dynamic_cast<TTree*> (GetOutputData(4));
+    if (!fVariablesTree) {
+      AliError("fVariablesTree not available");
+      return;
+    }
   }
 
   return;
@@ -621,7 +636,9 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
   if ( fWriteVariableTree ) {
     Double_t invmassK0S = v0part->MassK0Short();
     Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
-    if ( !onFlyV0 && isInCascadeWindow && part->CosV0PointingAngle()>0.99 && TMath::Abs(invmassK0S-mk0sPDG)<=0.05)
+    if ( !onFlyV0 && isInCascadeWindow &&
+        part->CosV0PointingAngle()>0.99 && TMath::Abs(invmassK0S-mk0sPDG)<=0.05 &&
+        part->Pt()>=fPtMinToFillTheTree && part->Pt()<fPtMaxToFillTheTree)
       FillTheTree(part,cutsAnal,mcArray,isLc);
     return;
   }
@@ -658,49 +675,94 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
   cutsAnal->GetPidHF()->GetnSigmaTOF(bachelor,3,nSigmaTOFka);
 
   if (onFlyV0) {  
-    if (isCandidateSelectedCuts) {
-      FillAnalysisHistograms(part,isBachelorID,"");
-    }
+
+    fillthis="histArmPodK0S";
+    FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+    fillthis="histArmPodLc";
+    FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+    //if (isCandidateSelectedCuts) {
+    FillAnalysisHistograms(part,cutsAnal,"");
+    //}
   }
   else {
+
+    fillthis="histArmPodK0SOffline";
+    FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+    fillthis="histArmPodLcOffline";
+    FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+    FillAnalysisHistograms(part,cutsAnal,"Offline");
     if (isCandidateSelectedCuts) {
       fillthis="histoprotonBachSigmaVspTOF";
       ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
       fillthis="histoprotonBachSigmaVspTPC";
       ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
-      FillAnalysisHistograms(part,isBachelorID,"Offline");
+      //FillAnalysisHistograms(part,cutsAnal,"Offline");
     }
   }
   if (fUseMCInfo) {
     if (isLc==1) {
       if (onFlyV0) {
-       if (isCandidateSelectedCuts) {
-         FillAnalysisHistograms(part,isBachelorID,"Sgn");
-       }
+
+       fillthis="histArmPodK0SSgn";
+       FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       fillthis="histArmPodLcSgn";
+       FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       //if (isCandidateSelectedCuts) {
+       FillAnalysisHistograms(part,cutsAnal,"Sgn");
+       //}
       }     
-      else {  
+      else {
+
+       fillthis="histArmPodK0SOfflineSgn";
+       FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       fillthis="histArmPodLcOfflineSgn";
+       FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
        if (isCandidateSelectedCuts) {
          fillthis="histoprotonBachSigmaVspTOFsgn";
          ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
          fillthis="histoprotonBachSigmaVspTPCsgn";
          ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
-         FillAnalysisHistograms(part,isBachelorID,"OfflineSgn");
+         //FillAnalysisHistograms(part,cutsAnal,"OfflineSgn");
        }
       }
     }// sgn
     else { // bkg
       if (onFlyV0) {
-       if (isCandidateSelectedCuts) {
-         FillAnalysisHistograms(part,isBachelorID,"Bkg");
-       }
+
+       fillthis="histArmPodK0SBkg";
+       FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       fillthis="histArmPodLcBkg";
+       FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       //if (isCandidateSelectedCuts) {
+       FillAnalysisHistograms(part,cutsAnal,"Bkg");
+       //}
       }
       else {
+
+       fillthis="histArmPodK0SOfflineBkg";
+       FillArmPodDistribution(v0part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       fillthis="histArmPodLcOfflineBkg";
+       FillArmPodDistribution(part,fillthis,isCandidateSelectedCuts,isBachelorID);
+
+       FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
        if (isCandidateSelectedCuts) {
          fillthis="histoprotonBachSigmaVspTOFbkg";
          ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTOFpr);
          fillthis="histoprotonBachSigmaVspTPCbkg";
          ((TH2F*)(fOutput->FindObject(fillthis)))->Fill(momBach,nSigmaTPCpr);
-         FillAnalysisHistograms(part,isBachelorID,"OfflineBkg");
+         //FillAnalysisHistograms(part,cutsAnal,"OfflineBkg");
        }
       }
     }
@@ -713,303 +775,820 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
 void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
 { 
 
-  TString nameMass=" ", nameSgn=" ", nameBkg=" ";
-
   Double_t mLcPDG  = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
   Double_t mK0SPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
+  Double_t mMinLambdaPDG  = TDatabasePDG::Instance()->GetParticle(2212)->Mass()+
+    TDatabasePDG::Instance()->GetParticle(211)->Mass();
+
+  TString nameHisto=" ", nameHistoSgn=" ", nameHistoBkg=" ";
+  TString titleHisto=" ", titleHistoSgn=" ", titleHistoBkg=" ";
+
+  // pt(Lc)
+  Double_t *binLimpTLc=new Double_t[11+1]; // 11 pT(Lc) bins
+  binLimpTLc[ 0]= 0.;
+  binLimpTLc[ 1]= 1.;
+  binLimpTLc[ 2]= 2.;
+  binLimpTLc[ 3]= 3.;
+  binLimpTLc[ 4]= 4.;
+  binLimpTLc[ 5]= 5.;
+  binLimpTLc[ 6]= 6.;
+  binLimpTLc[ 7]= 8.;
+  binLimpTLc[ 8]=12.;
+  binLimpTLc[ 9]=17.;
+  binLimpTLc[10]=25.;
+  binLimpTLc[11]=35.;
+
+  // pt(prong)
+  Double_t *binLimpTprong=new Double_t[41+1]; // 41 pT(prong) bins
+  binLimpTprong[ 0]= 0.0;
+  binLimpTprong[ 1]= 0.1;
+  binLimpTprong[ 2]= 0.2;
+  binLimpTprong[ 3]= 0.3;
+  binLimpTprong[ 4]= 0.4;
+  binLimpTprong[ 5]= 0.5;
+  binLimpTprong[ 6]= 0.6;
+  binLimpTprong[ 7]= 0.7;
+  binLimpTprong[ 8]= 0.8;
+  binLimpTprong[ 9]= 0.9;
+  binLimpTprong[10]= 1.0;
+  binLimpTprong[11]= 1.2;
+  binLimpTprong[12]= 1.4;
+  binLimpTprong[13]= 1.6;
+  binLimpTprong[14]= 1.8;
+  binLimpTprong[15]= 2.0;
+  binLimpTprong[16]= 2.2;
+  binLimpTprong[17]= 2.4;
+  binLimpTprong[18]= 2.6;
+  binLimpTprong[19]= 2.8;
+  binLimpTprong[20]= 3.0;
+  binLimpTprong[21]= 3.5;
+  binLimpTprong[22]= 4.0;
+  binLimpTprong[23]= 4.5;
+  binLimpTprong[24]= 5.0;
+  binLimpTprong[25]= 5.5;
+  binLimpTprong[26]= 6.0;
+  binLimpTprong[27]= 6.5;
+  binLimpTprong[28]= 7.0;
+  binLimpTprong[29]= 7.5;
+  binLimpTprong[30]= 8.0;
+  binLimpTprong[31]= 9.0;
+  binLimpTprong[32]=10.0;
+  binLimpTprong[33]=11.0;
+  binLimpTprong[34]=12.0;
+  binLimpTprong[35]=13.0;
+  binLimpTprong[36]=14.0;
+  binLimpTprong[37]=15.0;
+  binLimpTprong[38]=20.0;
+  binLimpTprong[39]=25.0;
+  binLimpTprong[40]=30.0;
+  binLimpTprong[41]=35.0;
 
   if (fUseOnTheFlyV0) {
 
     // V0 invariant masses (on-the-fly)
-    nameMass="histK0SMass";
-    TH2F* spectrumK0SMass = new TH2F(nameMass.Data(),"K^{0}_{S} invariant mass VS p_{T}; M(#pi^{+}#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                   1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
+    nameHisto="histK0SMass";
+    titleHisto="K^{0}_{S} invariant mass VS p_{T}; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    TH2F* spectrumK0SMass = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
 
     // Lc invariant masses (x K0S on-the-fly)
-    nameMass="histLcMassByK0S";
-    TH2F* spectrumLcMassByK0S = new TH2F(nameMass.Data(),"#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T} ; m_{inv}(p-K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]",
-                                        1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
+    nameHisto="histLcMassByK0S";
+    titleHisto="#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T}; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+    TH2F* spectrumLcMassByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
 
-    nameMass="histpK0Svsp";
-    TH2F* momentumDistributionK0Svsp = new TH2F(nameMass.Data(),"#Lambda_{c}: p(K^{0}_{S}) vs p(p);  p_{p}; p_{K^{0}_{S}}  ",
-                                               175,0.,35.,175,0.,35.);
+    nameHisto="histpK0Svsp";
+    titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+    TH2F* momentumDistributionK0Svsp = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
 
-    nameMass="histArmPodK0S";
-    TH2F* armenterosPodK0S = new TH2F(nameMass.Data(),"K^{0}_{S}: Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                     200,-1.,1.,300,0.,0.3);
+    nameHisto="histArmPodK0S";
+    titleHisto="K^{0}_{S} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
+    nameHisto="histArmPodLc";
+    titleHisto="#Lambda_{c} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodLc = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
  
-    nameMass="histDCAtoPVvspK0S";
-    TH2F *dcatoPVvspK0S = new TH2F(nameMass.Data(),"K^{0}_{S}: DCA to Primary Vertex vs K^{0}_{S} momentum ; p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",
-                                  175,0.,35.,50,0.,5.);
-
-    nameMass="histK0ScosPAwrtPVvspK0S";
-    TH2F *cosPAwrtPVvspK0S = new TH2F(nameMass.Data(),"K^{0}_{S}: cosine of pointing angle wrt primary vertex vs K^{0}_{S} momentum ; p(K^{0}_{S}) [GeV/c]; cosine; Entries",
-                                     175,0.,35.,100,0.99,1.);
-
     TH2F* allspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone(); 
-    TH2F* allspectrumLcMassByK0S    = (TH2F*)spectrumLcMassByK0S->Clone(); 
-    TH2F* allmomentumDistributionK0Svsp= (TH2F*)momentumDistributionK0Svsp->Clone(); 
-    TH2F* alldcatoPVvspK0S=(TH2F*)dcatoPVvspK0S->Clone(); 
-    TH2F* allcosV0PAwrtPVvspK0S=(TH2F*)cosPAwrtPVvspK0S->Clone(); 
+    TH2F* allspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone(); 
+    TH2F* allmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
+    TH2F* allArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
+    TH2F* allArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
 
     TH2F* pidBachspectrumK0SMass = (TH2F*)spectrumK0SMass->Clone(); 
-    TH2F* pidBachspectrumLcMassByK0S    = (TH2F*)spectrumLcMassByK0S->Clone(); 
-    TH2F* pidBachmomentumDistributionK0Svsp= (TH2F*)momentumDistributionK0Svsp->Clone(); 
-    TH2F* pidBachdcatoPVvspK0S=(TH2F*)dcatoPVvspK0S->Clone(); 
-    TH2F* pidBachcosV0PAwrtPVvspK0S=(TH2F*)cosPAwrtPVvspK0S->Clone(); 
-
-    TH2F* allArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
+    TH2F* pidBachspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone(); 
+    TH2F* pidBachmomentumDistributionK0Svsp = (TH2F*)momentumDistributionK0Svsp->Clone();
     TH2F* pidBachArmenterosPodK0S = (TH2F*)armenterosPodK0S->Clone();
+    TH2F* pidBachArmenterosPodLc = (TH2F*)armenterosPodLc->Clone();
 
     fOutputAll->Add(allspectrumK0SMass);
     fOutputAll->Add(allspectrumLcMassByK0S);
     fOutputAll->Add(allmomentumDistributionK0Svsp); 
     fOutputAll->Add(allArmenterosPodK0S);
-    fOutputAll->Add(alldcatoPVvspK0S);
-    fOutputAll->Add(allcosV0PAwrtPVvspK0S);
+    fOutputAll->Add(allArmenterosPodLc);
 
     fOutputPIDBach->Add(pidBachspectrumK0SMass);
     fOutputPIDBach->Add(pidBachspectrumLcMassByK0S);
     fOutputPIDBach->Add(pidBachmomentumDistributionK0Svsp); 
     fOutputPIDBach->Add(pidBachArmenterosPodK0S);
-    fOutputPIDBach->Add(pidBachdcatoPVvspK0S);
-    fOutputPIDBach->Add(pidBachcosV0PAwrtPVvspK0S);
+    fOutputPIDBach->Add(pidBachArmenterosPodLc);
+    nameHisto="histArmPodK0S0";
+    titleHisto="K^{0}_{S} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodK0S0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
+    nameHisto="histArmPodLc0";
+    titleHisto="#Lambda_{c} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodLc0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
+    fOutputAll->Add(armenterosPodK0S0);
+    fOutputAll->Add(armenterosPodLc0);
  
-    if (fTrackRotation){
-      TH2F* pidBachTRspectrumLcMassByK0S    = (TH2F*)spectrumLcMassByK0S->Clone(); 
+
+    if (fTrackRotation) {
+      TH2F* pidBachTRspectrumLcMassByK0S = (TH2F*)spectrumLcMassByK0S->Clone(); 
       fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0S);
     }
 
-  }
 
-  // V0 invariant masses (offline)
-  nameMass="histK0SMassOffline";
-  TH2F* spectrumK0SMassOffline = new TH2F(nameMass.Data(),"K^{0}_{S} invariant mass VS p_{T}; M(#pi^{+}#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                        1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
 
-  // Lc invariant masses (x K0S offline)
-  nameMass="histLcMassByK0SOffline";
-  TH2F* spectrumLcMassOfflineByK0S = new TH2F(nameMass.Data(),"#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T}; M(K^{0}_{S}p) [GeV/c^{2}]; p_{T} [GeV/c]",
-                                             1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
+    nameHisto="histptK0S";
+    titleHisto="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    TH2F* ptK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHisto="histptP";
+    titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+    TH2F* ptP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHisto="histptPip";
+    titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+    TH2F* ptPiP = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHisto="histptPim";
+    titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+    TH2F* ptPiM = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHisto="histLambdaMass";
+    titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massLambda = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHisto="histLambdaBarMass";
+    titleHisto="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+    TH2F* massLambdaBar = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHisto="histGammaMass";
+    titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massGamma = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
+
+    nameHisto="histD0K0S";
+    titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+    TH2F* d0K0S = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHisto="histD0P";
+    titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+    TH2F* d0P = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHisto="histCosPAK0S";
+    titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+    TH2F *cosPAK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
+
+    TH2F* allptK0S = (TH2F*)ptK0S->Clone();
+    TH2F* allptP = (TH2F*)ptP->Clone();
+    TH2F* allptPiP = (TH2F*)ptPiP->Clone();
+    TH2F* allptPiM = (TH2F*)ptPiM->Clone();
+    TH2F* allmassLambda = (TH2F*)massLambda->Clone();
+    TH2F* allmassLambdaBar = (TH2F*)massLambdaBar->Clone();
+    TH2F* allmassGamma = (TH2F*)massGamma->Clone();
+    TH2F* alld0K0S = (TH2F*)d0K0S->Clone();
+    TH2F* alld0P = (TH2F*)d0P->Clone();
+    TH2F* allcosPAK0S = (TH2F*)cosPAK0S->Clone();
+
+    TH2F* pidptK0S = (TH2F*)ptK0S->Clone();
+    TH2F* pidptP = (TH2F*)ptP->Clone();
+    TH2F* pidptPiP = (TH2F*)ptPiP->Clone();
+    TH2F* pidptPiM = (TH2F*)ptPiM->Clone();
+    TH2F* pidmassLambda = (TH2F*)massLambda->Clone();
+    TH2F* pidmassLambdaBar = (TH2F*)massLambdaBar->Clone();
+    TH2F* pidmassGamma = (TH2F*)massGamma->Clone();
+    TH2F* pidd0K0S = (TH2F*)d0K0S->Clone();
+    TH2F* pidd0P = (TH2F*)d0P->Clone();
+    TH2F* pidcosPAK0S = (TH2F*)cosPAK0S->Clone();
+
+    fOutputAll->Add(allptK0S);
+    fOutputAll->Add(allptP);
+    fOutputAll->Add(allptPiP);
+    fOutputAll->Add(allptPiM);
+    fOutputAll->Add(allmassLambda);
+    fOutputAll->Add(allmassLambdaBar);
+    fOutputAll->Add(allmassGamma);
+    fOutputAll->Add(alld0K0S);
+    fOutputAll->Add(alld0P);
+    fOutputAll->Add(allcosPAK0S);
+
+    fOutputPIDBach->Add(pidptK0S);
+    fOutputPIDBach->Add(pidptP);
+    fOutputPIDBach->Add(pidptPiP);
+    fOutputPIDBach->Add(pidptPiM);
+    fOutputPIDBach->Add(pidmassLambda);
+    fOutputPIDBach->Add(pidmassLambdaBar);
+    fOutputPIDBach->Add(pidmassGamma);
+    fOutputPIDBach->Add(pidd0K0S);
+    fOutputPIDBach->Add(pidd0P);
+    fOutputPIDBach->Add(pidcosPAK0S);
 
-  nameMass="histpK0SvspOffline";
-  TH2F* momentumDistributionK0SvspOffline = new TH2F(nameMass.Data(),"#Lambda_{c}: p(K^{0}_{S}) vs p(p) - Offline ;  p_{p} [GeV/c]; p_{K^{0}_{S}} [GeV/c]",
-                                                    175,0.,35.,175,0.,35.);
+    if (fTrackRotation) {
 
-  nameMass="histArmPodK0SOffline";
-  TH2F* armenterosPodK0SOff = new TH2F(nameMass.Data(),"K^{0}_{S}  Armenteros-Podolanski distribution - Offline; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                      200,-1.,1.,300,0.,0.3);
+      TH2F* pidTRptK0S = (TH2F*)ptK0S->Clone();
+      TH2F* pidTRptP = (TH2F*)ptP->Clone();
+      TH2F* pidTRptPiP = (TH2F*)ptPiP->Clone();
+      TH2F* pidTRptPiM = (TH2F*)ptPiM->Clone();
+      TH2F* pidTRmassLambda = (TH2F*)massLambda->Clone();
+      TH2F* pidTRmassLambdaBar = (TH2F*)massLambdaBar->Clone();
+      TH2F* pidTRmassGamma = (TH2F*)massGamma->Clone();
+      TH2F* pidTRcosPAK0S = (TH2F*)cosPAK0S->Clone();
+      fOutputPIDBachTR->Add(pidTRptK0S);
+      fOutputPIDBachTR->Add(pidTRptP);
+      fOutputPIDBachTR->Add(pidTRptPiP);
+      fOutputPIDBachTR->Add(pidTRptPiM);
+      fOutputPIDBachTR->Add(pidTRmassLambda);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBar);
+      fOutputPIDBachTR->Add(pidTRmassGamma);
+      fOutputPIDBachTR->Add(pidTRcosPAK0S);
 
-  nameMass="histDCAtoPVvspK0SOffline";
-  TH2F *dcatoPVvspK0SOffline = new TH2F(nameMass.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass - Offline; p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",
-                                       175,0.,35.,50,0.,5.);
+    }
 
-  nameMass="histK0ScosPAwrtPVvspK0SOffline";
-  TH2F *cosPAwrtPVvspK0SOffline = new TH2F(nameMass.Data(),"K^{0}_{S}: cosine of pointing angle wrt primary vertex vs K^{0}_{S} momentum - Offline; p(K^{0}_{S}) [GeV/c]; cosine; Entries",
-                                          175,0.,35.,100,0.99,1.);
+  }
 
+  // V0 invariant masses (offline)
+  nameHisto="histK0SMassOffline";
+  titleHisto="K^{0}_{S} invariant mass VS p_{T}; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+  TH2F* spectrumK0SMassOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
+
+  // Lc invariant masses (x K0S offline)
+  nameHisto="histLcMassByK0SOffline";
+  titleHisto="#Lambda_{c} invariant mass (by K^{0}_{S}) vs p_{T}; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+  TH2F* spectrumLcMassOfflineByK0S = new TH2F(nameHisto.Data(),titleHisto.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
 
+  nameHisto="histpK0SvspOffline";
+  titleHisto="p(K^{0}_{S}) vs p(p); p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+  TH2F* momentumDistributionK0SvspOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,41,binLimpTprong);
+
+  nameHisto="histArmPodK0SOffline";
+  titleHisto="K^{0}_{S} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+  TH2F* armenterosPodK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
+
+  nameHisto="histArmPodLcOffline";
+  titleHisto="#Lambda_{c} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+  TH2F* armenterosPodLcOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
 
   TH2F* allspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone(); 
-  TH2F* allspectrumLcMassOfflineByK0S    = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
-  TH2F* allmomentumDistributionK0SvspOffline= (TH2F*)momentumDistributionK0SvspOffline->Clone(); 
-  TH2F* alldcatoPVvspK0SOffline=(TH2F*)dcatoPVvspK0SOffline->Clone(); 
-  TH2F* allcosPAwrtPVvspK0SOffline=(TH2F*)cosPAwrtPVvspK0SOffline->Clone(); 
-  TH2F* allArmenterosPodK0SOff = (TH2F*)armenterosPodK0SOff->Clone();
+  TH2F* allspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
+  TH2F* allmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
+  TH2F* allArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
+  TH2F* allArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
 
   TH2F* pidBachspectrumK0SMassOffline = (TH2F*)spectrumK0SMassOffline->Clone(); 
-  TH2F* pidBachspectrumLcMassOfflineByK0S    = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
-  TH2F* pidBachmomentumDistributionK0SvspOffline= (TH2F*)momentumDistributionK0SvspOffline->Clone(); 
-  TH2F* pidBachdcatoPVvspK0SOffline=(TH2F*)dcatoPVvspK0SOffline->Clone(); 
-  TH2F* pidBachcosPAwrtPVvspK0SOffline=(TH2F*)cosPAwrtPVvspK0SOffline->Clone(); 
-  TH2F* pidBachArmenterosPodK0SOff = (TH2F*)armenterosPodK0SOff->Clone();
-
+  TH2F* pidBachspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
+  TH2F* pidBachmomentumDistributionK0SvspOffline = (TH2F*)momentumDistributionK0SvspOffline->Clone();
+  TH2F* pidBachArmenterosPodK0SOffline = (TH2F*)armenterosPodK0SOffline->Clone();
+  TH2F* pidBachArmenterosPodLcOffline = (TH2F*)armenterosPodLcOffline->Clone();
 
   fOutputAll->Add(allspectrumK0SMassOffline);
   fOutputAll->Add(allspectrumLcMassOfflineByK0S);
   fOutputAll->Add(allmomentumDistributionK0SvspOffline); 
-  fOutputAll->Add(allArmenterosPodK0SOff);
-  fOutputAll->Add(alldcatoPVvspK0SOffline);
-  fOutputAll->Add(allcosPAwrtPVvspK0SOffline);
+  fOutputAll->Add(allArmenterosPodK0SOffline);
+  fOutputAll->Add(allArmenterosPodLcOffline);
 
   fOutputPIDBach->Add(pidBachspectrumK0SMassOffline);
   fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0S);
   fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOffline); 
-  fOutputPIDBach->Add(pidBachArmenterosPodK0SOff);
-  fOutputPIDBach->Add(pidBachdcatoPVvspK0SOffline);
-  fOutputPIDBach->Add(pidBachcosPAwrtPVvspK0SOffline);
+  fOutputPIDBach->Add(pidBachArmenterosPodK0SOffline);
+  fOutputPIDBach->Add(pidBachArmenterosPodLcOffline);
+
+  nameHisto="histArmPodK0SOffline0";
+  titleHisto="K^{0}_{S} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+  TH2F* armenterosPodK0SOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-1.,1.,300,0.,0.3);
+  nameHisto="histArmPodLcOffline0";
+  titleHisto="#Lambda_{c} Armenteros-Podolanski distribution; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+  TH2F* armenterosPodLcOffline0 = new TH2F(nameHisto.Data(),titleHisto.Data(),200,-4.,4.,800,0.,1.6);
+  fOutputAll->Add(armenterosPodK0SOffline0);
+  fOutputAll->Add(armenterosPodLcOffline0);
 
   if (fTrackRotation) {
-    TH2F* pidBachTRspectrumLcMassOfflineByK0S    = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
+    TH2F* pidBachTRspectrumLcMassOfflineByK0S = (TH2F*)spectrumLcMassOfflineByK0S->Clone(); 
     fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0S);
   }
 
+
+
+
+  nameHisto="histptK0SOffline";
+  titleHisto="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+  TH2F* ptK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+  nameHisto="histptPOffline";
+  titleHisto="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+  TH2F* ptPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+  nameHisto="histptPipOffline";
+  titleHisto="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+  TH2F* ptPiPOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+  nameHisto="histptPimOffline";
+  titleHisto="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+  TH2F* ptPiMOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,41,binLimpTprong);
+
+  nameHisto="histLambdaMassOffline";
+  titleHisto="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+  TH2F* massLambdaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+  nameHisto="histLambdaBarMassOffline";
+  titleHisto="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+  TH2F* massLambdaBarOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+  nameHisto="histGammaMassOffline";
+  titleHisto="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+  TH2F* massGammaOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,100,0.,1.);
+
+  nameHisto="histD0K0SOffline";
+  titleHisto="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+  TH2F* d0K0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
+
+  nameHisto="histD0POffline";
+  titleHisto="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+  TH2F* d0POffline = new TH2F(nameHisto.Data(),titleHisto.Data(),11,binLimpTLc,1000,-1.,1.);
+
+  nameHisto="histCosPAK0SOffline";
+  titleHisto="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+  TH2F *cosPAK0SOffline = new TH2F(nameHisto.Data(),titleHisto.Data(),41,binLimpTprong,100,0.99,1.);
+
+  TH2F* allptK0SOffline = (TH2F*)ptK0SOffline->Clone();
+  TH2F* allptPOffline = (TH2F*)ptPOffline->Clone();
+  TH2F* allptPiPOffline = (TH2F*)ptPiPOffline->Clone();
+  TH2F* allptPiMOffline = (TH2F*)ptPiMOffline->Clone();
+  TH2F* allmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
+  TH2F* allmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
+  TH2F* allmassGammaOffline = (TH2F*)massGammaOffline->Clone();
+  TH2F* alld0K0SOffline = (TH2F*)d0K0SOffline->Clone();
+  TH2F* alld0POffline = (TH2F*)d0POffline->Clone();
+  TH2F* allcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
+
+  TH2F* pidptK0SOffline = (TH2F*)ptK0SOffline->Clone();
+  TH2F* pidptPOffline = (TH2F*)ptPOffline->Clone();
+  TH2F* pidptPiPOffline = (TH2F*)ptPiPOffline->Clone();
+  TH2F* pidptPiMOffline = (TH2F*)ptPiMOffline->Clone();
+  TH2F* pidmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
+  TH2F* pidmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
+  TH2F* pidmassGammaOffline = (TH2F*)massGammaOffline->Clone();
+  TH2F* pidd0K0SOffline = (TH2F*)d0K0SOffline->Clone();
+  TH2F* pidd0POffline = (TH2F*)d0POffline->Clone();
+  TH2F* pidcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
+
+  fOutputAll->Add(allptK0SOffline);
+  fOutputAll->Add(allptPOffline);
+  fOutputAll->Add(allptPiPOffline);
+  fOutputAll->Add(allptPiMOffline);
+  fOutputAll->Add(allmassLambdaOffline);
+  fOutputAll->Add(allmassLambdaBarOffline);
+  fOutputAll->Add(allmassGammaOffline);
+  fOutputAll->Add(alld0K0SOffline);
+  fOutputAll->Add(alld0POffline);
+  fOutputAll->Add(allcosPAK0SOffline);
+
+  fOutputPIDBach->Add(pidptK0SOffline);
+  fOutputPIDBach->Add(pidptPOffline);
+  fOutputPIDBach->Add(pidptPiPOffline);
+  fOutputPIDBach->Add(pidptPiMOffline);
+  fOutputPIDBach->Add(pidmassLambdaOffline);
+  fOutputPIDBach->Add(pidmassLambdaBarOffline);
+  fOutputPIDBach->Add(pidmassGammaOffline);
+  fOutputPIDBach->Add(pidd0K0SOffline);
+  fOutputPIDBach->Add(pidd0POffline);
+  fOutputPIDBach->Add(pidcosPAK0SOffline);
+
+  if (fTrackRotation) {
+
+    TH2F* pidTRptK0SOffline = (TH2F*)ptK0SOffline->Clone();
+    TH2F* pidTRptPOffline = (TH2F*)ptPOffline->Clone();
+    TH2F* pidTRptPiPOffline = (TH2F*)ptPiPOffline->Clone();
+    TH2F* pidTRptPiMOffline = (TH2F*)ptPiMOffline->Clone();
+    TH2F* pidTRmassLambdaOffline = (TH2F*)massLambdaOffline->Clone();
+    TH2F* pidTRmassLambdaBarOffline = (TH2F*)massLambdaBarOffline->Clone();
+    TH2F* pidTRmassGammaOffline = (TH2F*)massGammaOffline->Clone();
+    TH2F* pidTRcosPAK0SOffline = (TH2F*)cosPAK0SOffline->Clone();
+    fOutputPIDBachTR->Add(pidTRptK0SOffline);
+    fOutputPIDBachTR->Add(pidTRptPOffline);
+    fOutputPIDBachTR->Add(pidTRptPiPOffline);
+    fOutputPIDBachTR->Add(pidTRptPiMOffline);
+    fOutputPIDBachTR->Add(pidTRmassLambdaOffline);
+    fOutputPIDBachTR->Add(pidTRmassLambdaBarOffline);
+    fOutputPIDBachTR->Add(pidTRmassGammaOffline);
+    fOutputPIDBachTR->Add(pidTRcosPAK0SOffline);
+
+  }
+
+
+
+
+
   if (fUseMCInfo) {
 
     if (fUseOnTheFlyV0) {
 
-      nameSgn="histK0SMassSgn";
-      nameBkg="histK0SMassBkg";
-      TH2F* spectrumK0SMassSgn = new TH2F(nameSgn.Data(), "K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+}#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                         1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
-      TH2F* spectrumK0SMassBkg = new TH2F(nameBkg.Data(), "K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+}#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                         1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
-
-      nameSgn="histLcMassByK0SSgn";
-      nameBkg="histLcMassByK0SBkg";
-      TH2F* spectrumLcMassByK0SSgn = new TH2F(nameSgn.Data(), "#Lambda_{c} - sgn: invariant mass (by K^{0}_{S}) vs p_{T}  - MC; m_{inv}(p-K^{0}_{S}) [GeV/c^{2}];  p_{T}",
-                                             1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
-      TH2F* spectrumLcMassByK0SBkg = new TH2F(nameBkg.Data(), "#Lambda_{c} - bkg: invariant mass (by K^{0}_{S}) vs p_{T}  - MC; m_{inv}(p-K^{0}_{S}) [GeV/c^{2}]; p_{T}",
-                                             1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
-      nameSgn="histpK0SvspSgn";
-      nameBkg="histpK0SvspBkg";
-      TH2F* momentumDistributionK0SvspSgn= new TH2F(nameSgn.Data(),"#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - MC; p_{p}; p_{K^{0}_{S}}",
-                                                   175,0.,35.,175,0.,35.);
-      TH2F* momentumDistributionK0SvspBkg= new TH2F(nameBkg.Data(),"#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - MC; p_{p}; p_{K^{0}_{S}}",
-                                                   175,0.,35.,175,0.,35.);
+      nameHistoSgn="histK0SMassSgn";
+      nameHistoBkg="histK0SMassBkg";
+      titleHistoSgn="K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+      titleHistoBkg="K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+      TH2F* spectrumK0SMassSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
+      TH2F* spectrumK0SMassBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
+
+      nameHistoSgn="histLcMassByK0SSgn";
+      nameHistoBkg="histLcMassByK0SBkg";
+      titleHistoSgn="#Lambda_{c} - sgn: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+      titleHistoBkg="#Lambda_{c} - bkg: invariant mass (by K^{0}_{S}) vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+      TH2F* spectrumLcMassByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
+      TH2F* spectrumLcMassByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
+
+      nameHistoSgn="histpK0SvspSgn";
+      nameHistoBkg="histpK0SvspBkg";
+      titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+      titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+      TH2F* momentumDistributionK0SvspSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
+      TH2F* momentumDistributionK0SvspBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
+
       // armenteros-podolanski plots K0S
-      nameSgn="histArmPodK0SSgn";
-      nameBkg="histArmPodK0SBkg";
-      TH2F* armenterosPodK0SSgn = new TH2F(nameSgn.Data(),"K^{0}_{S}  Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                          200,-1.,1.,300,0.,0.3);
-      TH2F* armenterosPodK0SBkg = new TH2F(nameBkg.Data(),"K^{0}_{S}  Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                          200,-1.,1.,300,0.,0.3);
-      nameSgn="histDCAtoPVvspK0SSgn";
-      nameBkg="histDCAtoPVvspK0SBkg";
-      TH2F *dcatoPVvspK0SSgn=new TH2F(nameSgn.Data(),"K^{0}_{S} - sgn: DCA to Primary Vertex vs  K^{0}_{S} invariant mass (sgn); p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",175,0.,35.,50,0.,5.);
-      TH2F *dcatoPVvspK0SBkg=new TH2F(nameBkg.Data(),"K^{0}_{S} - bkg: DCA to Primary Vertex vs  K^{0}_{S} invariant mass (bkg); p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",175,0.,35.,50,0.,5.);
-
-      TH2F* allspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone(); 
-      TH2F* allspectrumK0SMassBkg = (TH2F*) spectrumK0SMassBkg->Clone();  
-      TH2F* allspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone(); 
-      TH2F* allspectrumLcMassByK0SBkg = (TH2F*) spectrumLcMassByK0SBkg->Clone();  
-      TH2F* allmomentumDistributionK0SvspSgn= (TH2F*)momentumDistributionK0SvspSgn->Clone(); 
-      TH2F* allmomentumDistributionK0SvspBkg= (TH2F*)momentumDistributionK0SvspBkg->Clone(); 
+      nameHistoSgn="histArmPodK0SSgn";
+      nameHistoBkg="histArmPodK0SBkg";
+      titleHistoSgn="K^{0}_{S} Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      titleHistoBkg="K^{0}_{S} Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      TH2F* armenterosPodK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+      TH2F* armenterosPodK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
+
+      nameHistoSgn="histArmPodLcSgn";
+      nameHistoBkg="histArmPodLcBkg";
+      titleHistoSgn="#Lambda_{c} Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      titleHistoBkg="#Lambda_{c} Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      TH2F* armenterosPodLcSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
+      TH2F* armenterosPodLcBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
+
+      TH2F* allspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
+      TH2F* allspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
+      TH2F* allspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
+      TH2F* allspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
+      TH2F* allmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
+      TH2F* allmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
       TH2F* allArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
       TH2F* allArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
-      TH2F* alldcatoPVvspK0SSgn= (TH2F*)dcatoPVvspK0SSgn->Clone();
-      TH2F* alldcatoPVvspK0SBkg= (TH2F*)dcatoPVvspK0SBkg->Clone();
-
-      TH2F* pidBachspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone(); 
-      TH2F* pidBachspectrumK0SMassBkg = (TH2F*) spectrumK0SMassBkg->Clone();  
-      TH2F* pidBachspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone(); 
-      TH2F* pidBachspectrumLcMassByK0SBkg = (TH2F*) spectrumLcMassByK0SBkg->Clone();  
-      TH2F* pidBachmomentumDistributionK0SvspSgn= (TH2F*)momentumDistributionK0SvspSgn->Clone(); 
-      TH2F* pidBachmomentumDistributionK0SvspBkg= (TH2F*)momentumDistributionK0SvspBkg->Clone(); 
+      TH2F* allArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
+      TH2F* allArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
+
+      TH2F* pidBachspectrumK0SMassSgn = (TH2F*)spectrumK0SMassSgn->Clone();
+      TH2F* pidBachspectrumK0SMassBkg = (TH2F*)spectrumK0SMassBkg->Clone();
+      TH2F* pidBachspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
+      TH2F* pidBachspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
+      TH2F* pidBachmomentumDistributionK0SvspSgn = (TH2F*)momentumDistributionK0SvspSgn->Clone();
+      TH2F* pidBachmomentumDistributionK0SvspBkg = (TH2F*)momentumDistributionK0SvspBkg->Clone();
       TH2F* pidBachArmenterosPodK0SSgn = (TH2F*)armenterosPodK0SSgn->Clone();
       TH2F* pidBachArmenterosPodK0SBkg = (TH2F*)armenterosPodK0SBkg->Clone();
-      TH2F* pidBachdcatoPVvspK0SSgn= (TH2F*)dcatoPVvspK0SSgn->Clone();
-      TH2F* pidBachdcatoPVvspK0SBkg= (TH2F*)dcatoPVvspK0SBkg->Clone();
+      TH2F* pidBachArmenterosPodLcSgn = (TH2F*)armenterosPodLcSgn->Clone();
+      TH2F* pidBachArmenterosPodLcBkg = (TH2F*)armenterosPodLcBkg->Clone();
 
       fOutputAll->Add(allspectrumK0SMassSgn);
       fOutputAll->Add(allspectrumK0SMassBkg);
       fOutputAll->Add(allspectrumLcMassByK0SSgn);
       fOutputAll->Add(allspectrumLcMassByK0SBkg);
-      fOutputAll->Add(allmomentumDistributionK0SvspSgn); 
-      fOutputAll->Add(allmomentumDistributionK0SvspBkg); 
+      fOutputAll->Add(allmomentumDistributionK0SvspSgn);
+      fOutputAll->Add(allmomentumDistributionK0SvspBkg);
       fOutputAll->Add(allArmenterosPodK0SSgn);
       fOutputAll->Add(allArmenterosPodK0SBkg);
-      fOutputAll->Add(alldcatoPVvspK0SSgn);
-      fOutputAll->Add(alldcatoPVvspK0SBkg);
+      fOutputAll->Add(allArmenterosPodLcSgn);
+      fOutputAll->Add(allArmenterosPodLcBkg);
 
       fOutputPIDBach->Add(pidBachspectrumK0SMassSgn);
       fOutputPIDBach->Add(pidBachspectrumK0SMassBkg);
       fOutputPIDBach->Add(pidBachspectrumLcMassByK0SSgn);
       fOutputPIDBach->Add(pidBachspectrumLcMassByK0SBkg);
-      fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspSgn); 
-      fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspBkg); 
+      fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspSgn);
+      fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspBkg);
       fOutputPIDBach->Add(pidBachArmenterosPodK0SSgn);
       fOutputPIDBach->Add(pidBachArmenterosPodK0SBkg);
-      fOutputPIDBach->Add(pidBachdcatoPVvspK0SSgn);
-      fOutputPIDBach->Add(pidBachdcatoPVvspK0SBkg);
+      fOutputPIDBach->Add(pidBachArmenterosPodLcSgn);
+      fOutputPIDBach->Add(pidBachArmenterosPodLcBkg);
+
+      nameHistoSgn="histArmPodK0SSgn0";
+      nameHistoBkg="histArmPodK0SBkg0";
+      titleHistoSgn="K^{0}_{S} Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      titleHistoBkg="K^{0}_{S} Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      TH2F* armenterosPodK0SSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+      TH2F* armenterosPodK0SBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-1.,1.,300,0.,0.3);
+      fOutputAll->Add(armenterosPodK0SSgn0);
+      fOutputAll->Add(armenterosPodK0SBkg0);
+      nameHistoSgn="histArmPodLcSgn0";
+      nameHistoBkg="histArmPodLcBkg0";
+      titleHistoSgn="#Lambda_{c} Armenteros-Podolanski distribution (sgn); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      titleHistoBkg="#Lambda_{c} Armenteros-Podolanski distribution (bkg); #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+      TH2F* armenterosPodLcSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
+      TH2F* armenterosPodLcBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),200,-4.,4.,800,0.,1.6);
+      fOutputAll->Add(armenterosPodLcSgn0);
+      fOutputAll->Add(armenterosPodLcBkg0);
 
       if (fTrackRotation) {
-       TH2F* pidBachTRspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone(); 
-       TH2F* pidBachTRspectrumLcMassByK0SBkg = (TH2F*) spectrumLcMassByK0SBkg->Clone();  
+       TH2F* pidBachTRspectrumLcMassByK0SSgn = (TH2F*)spectrumLcMassByK0SSgn->Clone();
+       TH2F* pidBachTRspectrumLcMassByK0SBkg = (TH2F*)spectrumLcMassByK0SBkg->Clone();
        fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SSgn);
        fOutputPIDBachTR->Add(pidBachTRspectrumLcMassByK0SBkg);
       }
 
+
+
+    nameHistoSgn="histptK0SSgn";
+    nameHistoBkg="histptK0SBkg";
+    titleHistoSgn="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    TH2F* ptK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPSgn";
+    nameHistoBkg="histptPBkg";
+    titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+    TH2F* ptPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPipSgn";
+    nameHistoBkg="histptPipBkg";
+    titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+    TH2F* ptPiPSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPiPBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPimSgn";
+    nameHistoBkg="histptPimBkg";
+    titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+    TH2F* ptPiMSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPiMBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histLambdaMassSgn";
+    nameHistoBkg="histLambdaMassBkg";
+    titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massLambdaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+    TH2F* massLambdaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHistoSgn="histLambdaBarMassSgn";
+    nameHistoBkg="histLambdaBarMassBkg";
+    titleHistoSgn="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+    TH2F* massLambdaBarSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+    TH2F* massLambdaBarBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHistoSgn="histGammaMassSgn";
+    nameHistoBkg="histGammaMassBkg";
+    titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massGammaSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
+    TH2F* massGammaBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
+
+    nameHistoSgn="histD0K0SSgn";
+    nameHistoBkg="histD0K0SBkg";
+    titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+    titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+    TH2F* d0K0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
+    TH2F* d0K0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHistoSgn="histD0PSgn";
+    nameHistoBkg="histD0PBkg";
+    titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+    titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+    TH2F* d0PSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
+    TH2F* d0PBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHistoSgn="histCosPAK0SSgn";
+    nameHistoBkg="histCosPAK0SBkg";
+    titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+    titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+    TH2F *cosPAK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
+    TH2F *cosPAK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
+
+    TH2F* allptK0SSgn = (TH2F*)ptK0SSgn->Clone();
+    TH2F* allptK0SBkg = (TH2F*)ptK0SBkg->Clone();
+    TH2F* allptPSgn = (TH2F*)ptPSgn->Clone();
+    TH2F* allptPBkg = (TH2F*)ptPBkg->Clone();
+    TH2F* allptPiPSgn = (TH2F*)ptPiPSgn->Clone();
+    TH2F* allptPiPBkg = (TH2F*)ptPiPBkg->Clone();
+    TH2F* allptPiMSgn = (TH2F*)ptPiMSgn->Clone();
+    TH2F* allptPiMBkg = (TH2F*)ptPiMBkg->Clone();
+    TH2F* allmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
+    TH2F* allmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
+    TH2F* allmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
+    TH2F* allmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
+    TH2F* allmassGammaSgn = (TH2F*)massGammaSgn->Clone();
+    TH2F* allmassGammaBkg = (TH2F*)massGammaBkg->Clone();
+    TH2F* alld0K0SSgn = (TH2F*)d0K0SSgn->Clone();
+    TH2F* alld0K0SBkg = (TH2F*)d0K0SBkg->Clone();
+    TH2F* alld0PSgn = (TH2F*)d0PSgn->Clone();
+    TH2F* alld0PBkg = (TH2F*)d0PBkg->Clone();
+    TH2F* allcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
+    TH2F* allcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
+
+    TH2F* pidptK0SSgn = (TH2F*)ptK0SSgn->Clone();
+    TH2F* pidptK0SBkg = (TH2F*)ptK0SBkg->Clone();
+    TH2F* pidptPSgn = (TH2F*)ptPSgn->Clone();
+    TH2F* pidptPBkg = (TH2F*)ptPBkg->Clone();
+    TH2F* pidptPiPSgn = (TH2F*)ptPiPSgn->Clone();
+    TH2F* pidptPiPBkg = (TH2F*)ptPiPBkg->Clone();
+    TH2F* pidptPiMSgn = (TH2F*)ptPiMSgn->Clone();
+    TH2F* pidptPiMBkg = (TH2F*)ptPiMBkg->Clone();
+    TH2F* pidmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
+    TH2F* pidmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
+    TH2F* pidmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
+    TH2F* pidmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
+    TH2F* pidmassGammaSgn = (TH2F*)massGammaSgn->Clone();
+    TH2F* pidmassGammaBkg = (TH2F*)massGammaBkg->Clone();
+    TH2F* pidd0K0SSgn = (TH2F*)d0K0SSgn->Clone();
+    TH2F* pidd0K0SBkg = (TH2F*)d0K0SBkg->Clone();
+    TH2F* pidd0PSgn = (TH2F*)d0PSgn->Clone();
+    TH2F* pidd0PBkg = (TH2F*)d0PBkg->Clone();
+    TH2F* pidcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
+    TH2F* pidcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
+
+    fOutputAll->Add(allptK0SSgn);
+    fOutputAll->Add(allptK0SBkg);
+    fOutputAll->Add(allptPSgn);
+    fOutputAll->Add(allptPBkg);
+    fOutputAll->Add(allptPiPSgn);
+    fOutputAll->Add(allptPiPBkg);
+    fOutputAll->Add(allptPiMSgn);
+    fOutputAll->Add(allptPiMBkg);
+    fOutputAll->Add(allmassLambdaSgn);
+    fOutputAll->Add(allmassLambdaBkg);
+    fOutputAll->Add(allmassLambdaBarSgn);
+    fOutputAll->Add(allmassLambdaBarBkg);
+    fOutputAll->Add(allmassGammaSgn);
+    fOutputAll->Add(allmassGammaBkg);
+    fOutputAll->Add(alld0K0SSgn);
+    fOutputAll->Add(alld0K0SBkg);
+    fOutputAll->Add(alld0PSgn);
+    fOutputAll->Add(alld0PBkg);
+    fOutputAll->Add(allcosPAK0SSgn);
+    fOutputAll->Add(allcosPAK0SBkg);
+
+    fOutputPIDBach->Add(pidptK0SSgn);
+    fOutputPIDBach->Add(pidptK0SBkg);
+    fOutputPIDBach->Add(pidptPSgn);
+    fOutputPIDBach->Add(pidptPBkg);
+    fOutputPIDBach->Add(pidptPiPSgn);
+    fOutputPIDBach->Add(pidptPiPBkg);
+    fOutputPIDBach->Add(pidptPiMSgn);
+    fOutputPIDBach->Add(pidptPiMBkg);
+    fOutputPIDBach->Add(pidmassLambdaSgn);
+    fOutputPIDBach->Add(pidmassLambdaBkg);
+    fOutputPIDBach->Add(pidmassLambdaBarSgn);
+    fOutputPIDBach->Add(pidmassLambdaBarBkg);
+    fOutputPIDBach->Add(pidmassGammaSgn);
+    fOutputPIDBach->Add(pidmassGammaBkg);
+    fOutputPIDBach->Add(pidd0K0SSgn);
+    fOutputPIDBach->Add(pidd0K0SBkg);
+    fOutputPIDBach->Add(pidd0PSgn);
+    fOutputPIDBach->Add(pidd0PBkg);
+    fOutputPIDBach->Add(pidcosPAK0SSgn);
+    fOutputPIDBach->Add(pidcosPAK0SBkg);
+
+    if (fTrackRotation) {
+
+      TH2F* pidTRptK0SSgn = (TH2F*)ptK0SSgn->Clone();
+      TH2F* pidTRptK0SBkg = (TH2F*)ptK0SBkg->Clone();
+      TH2F* pidTRptPSgn = (TH2F*)ptPSgn->Clone();
+      TH2F* pidTRptPBkg = (TH2F*)ptPBkg->Clone();
+      TH2F* pidTRptPiPSgn = (TH2F*)ptPiPSgn->Clone();
+      TH2F* pidTRptPiPBkg = (TH2F*)ptPiPBkg->Clone();
+      TH2F* pidTRptPiMSgn = (TH2F*)ptPiMSgn->Clone();
+      TH2F* pidTRptPiMBkg = (TH2F*)ptPiMBkg->Clone();
+      TH2F* pidTRmassLambdaSgn = (TH2F*)massLambdaSgn->Clone();
+      TH2F* pidTRmassLambdaBkg = (TH2F*)massLambdaBkg->Clone();
+      TH2F* pidTRmassLambdaBarSgn = (TH2F*)massLambdaBarSgn->Clone();
+      TH2F* pidTRmassLambdaBarBkg = (TH2F*)massLambdaBarBkg->Clone();
+      TH2F* pidTRmassGammaSgn = (TH2F*)massGammaSgn->Clone();
+      TH2F* pidTRmassGammaBkg = (TH2F*)massGammaBkg->Clone();
+      TH2F* pidTRcosPAK0SSgn = (TH2F*)cosPAK0SSgn->Clone();
+      TH2F* pidTRcosPAK0SBkg = (TH2F*)cosPAK0SBkg->Clone();
+      fOutputPIDBachTR->Add(pidTRptK0SSgn);
+      fOutputPIDBachTR->Add(pidTRptK0SBkg);
+      fOutputPIDBachTR->Add(pidTRptPSgn);
+      fOutputPIDBachTR->Add(pidTRptPBkg);
+      fOutputPIDBachTR->Add(pidTRptPiPSgn);
+      fOutputPIDBachTR->Add(pidTRptPiPBkg);
+      fOutputPIDBachTR->Add(pidTRptPiMSgn);
+      fOutputPIDBachTR->Add(pidTRptPiMBkg);
+      fOutputPIDBachTR->Add(pidTRmassLambdaSgn);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBkg);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBarSgn);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBarBkg);
+      fOutputPIDBachTR->Add(pidTRmassGammaSgn);
+      fOutputPIDBachTR->Add(pidTRmassGammaBkg);
+      fOutputPIDBachTR->Add(pidTRcosPAK0SSgn);
+      fOutputPIDBachTR->Add(pidTRcosPAK0SBkg);
+
     }
 
 
-    nameSgn="histK0SMassOfflineSgn";
-    nameBkg="histK0SMassOfflineBkg";
-    TH2F* spectrumK0SMassOfflineSgn = new TH2F(nameSgn.Data(), "K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+}-#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                             1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
-    TH2F* spectrumK0SMassOfflineBkg = new TH2F(nameBkg.Data(), "K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+}-#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries",
-                                             1000,mK0SPDG-0.050,mK0SPDG+0.050,175,0.,35.);
-
-    nameSgn="histLcMassByK0SOfflineSgn";
-    nameBkg="histLcMassByK0SOfflineBkg";
-    TH2F* spectrumLcMassOfflineByK0SSgn = new TH2F(nameSgn.Data(), "#Lambda_{c} - sgn: invariant mass (by K^{0}_{S})  vs p_{T} - MC; M(#Lambda_{c}) [GeV/c^{2}]; p_{T}",
-                                                  1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
-    TH2F* spectrumLcMassOfflineByK0SBkg = new TH2F(nameBkg.Data(), "#Lambda_{c} - bkg: invariant mass (by K^{0}_{S})  vs p_{T} - MC; M(#Lambda_{c}) [GeV/c^{2}]; p_{T}",
-                                                  1000,mLcPDG-0.250,mLcPDG+0.250,175,0.,35.);
-    nameSgn="histpK0SvspOfflineSgn";
-    nameBkg="histpK0SvspOfflineBkg";
-    TH2F* momentumDistributionK0SvspOfflineSgn= new TH2F(nameSgn.Data(),"#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC; p_{p}; p_{K^{0}_{S}}",
-                                                        175,0.,35.,175,0.,35.);
-    TH2F* momentumDistributionK0SvspOfflineBkg= new TH2F(nameBkg.Data(),"#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC; p_{p}; p_{K^{0}_{S}}",
-                                                        175,0.,35.,175,0.,35.);
+    } // useOnTheFly
+
+
+    nameHistoSgn="histK0SMassOfflineSgn";
+    nameHistoBkg="histK0SMassOfflineBkg";
+    titleHistoSgn="K^{0}_{S} - sgn: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    titleHistoBkg="K^{0}_{S} - bkg: invariant mass VS p_{T} - MC; m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    TH2F* spectrumK0SMassOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
+    TH2F* spectrumK0SMassOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mK0SPDG-0.050,mK0SPDG+0.050,41,binLimpTprong);
+
+    nameHistoSgn="histLcMassByK0SOfflineSgn";
+    nameHistoBkg="histLcMassByK0SOfflineBkg";
+    titleHistoSgn="#Lambda_{c} - sgn: invariant mass (by K^{0}_{S})  vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+    titleHistoBkg="#Lambda_{c} - bkg: invariant mass (by K^{0}_{S})  vs p_{T} - MC; m_{inv}(p,K^{0}_{S}) [GeV/c^{2}]; p_{T}(#Lambda_{c}) [GeV/c]";
+    TH2F* spectrumLcMassOfflineByK0SSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
+    TH2F* spectrumLcMassOfflineByK0SBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),1000,mLcPDG-0.250,mLcPDG+0.250,11,binLimpTLc);
+
+    nameHistoSgn="histpK0SvspOfflineSgn";
+    nameHistoBkg="histpK0SvspOfflineBkg";
+    titleHistoSgn="#Lambda_{c} - sgn: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+    titleHistoBkg="#Lambda_{c} - bkg: K^{0}_{S} vs p Total Momentum Distribution - Offline - MC; p(p) [GeV/c]; p(K^{0}_{S}) [GeV/c]";
+    TH2F* momentumDistributionK0SvspOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,41,binLimpTprong);
+    TH2F* momentumDistributionK0SvspOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,41,binLimpTprong);
+
     // armenteros-podolanski plots K0S (offline)
-    nameSgn="histArmPodK0SOfflineSgn";
-    nameBkg="histArmPodK0SOfflineBkg";
-    TH2F* armenterosPodK0SOffSgn = new TH2F(nameSgn.Data(),"K^{0}_{S}  Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                           200,-1.,1.,300,0.,0.3);
-    TH2F* armenterosPodK0SOffBkg = new TH2F(nameBkg.Data(),"K^{0}_{S}  Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]",
-                                           200,-1.,1.,300,0.,0.3);
-    nameSgn="histDCAtoPVvspK0SOfflineSgn";
-    nameBkg="histDCAtoPVvspK0SOfflineBkg";
-    TH2F *dcatoPVvspK0SOfflineSgn=new TH2F(nameSgn.Data(),"K^{0}_{S} -offline - (sgn): DCA to Primary Vertex vs  K^{0}_{S} invariant mass; p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",
-                                          175,0.,35.,50,0.,5.);
-    TH2F *dcatoPVvspK0SOfflineBkg=new TH2F(nameBkg.Data(),"K^{0}_{S} -offline - (bkg): DCA to Primary Vertex vs  K^{0}_{S} invariant mass; p(K^{0}_{S}) [GeV/c]; DCA to Primary Vertex [n#sigmas]; Entries",
-                                          175,0.,35.,50,0.,5.);
+    nameHistoSgn="histArmPodK0SOfflineSgn";
+    nameHistoBkg="histArmPodK0SOfflineBkg";
+    titleHistoSgn="K^{0}_{S} Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    titleHistoBkg="K^{0}_{S} Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+    TH2F* armenterosPodK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+
+    nameHistoSgn="histArmPodLcOfflineSgn";
+    nameHistoBkg="histArmPodLcOfflineBkg";
+    titleHistoSgn="#Lambda_{c} Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    titleHistoBkg="#Lambda_{c} Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodLcOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
+    TH2F* armenterosPodLcOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
 
 
     TH2F* allspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone(); 
     TH2F* allspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();  
     TH2F* allspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone(); 
     TH2F* allspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();  
-    TH2F* allmomentumDistributionK0SvspOfflineSgn= (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone(); 
-    TH2F* allmomentumDistributionK0SvspOfflineBkg= (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone(); 
-    TH2F* allArmenterosPodK0SOffSgn = (TH2F*)armenterosPodK0SOffSgn->Clone();
-    TH2F* allArmenterosPodK0SOffBkg = (TH2F*)armenterosPodK0SOffBkg->Clone();
-    TH2F* alldcatoPVvspK0SOfflineSgn= (TH2F*)dcatoPVvspK0SOfflineSgn->Clone();
-    TH2F* alldcatoPVvspK0SOfflineBkg= (TH2F*)dcatoPVvspK0SOfflineBkg->Clone();
-
-    TH2F* pidBachspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone(); 
-    TH2F* pidBachspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();  
-    TH2F* pidBachspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone(); 
+    TH2F* allmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
+    TH2F* allmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
+    TH2F* allArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
+    TH2F* allArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
+    TH2F* allArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
+    TH2F* allArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
+
+    TH2F* pidBachspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone();
+    TH2F* pidBachspectrumLcMassOfflineByK0SBkg = (TH2F*) spectrumLcMassOfflineByK0SBkg->Clone();
+    TH2F* pidBachspectrumK0SMassOfflineSgn = (TH2F*)spectrumK0SMassOfflineSgn->Clone();
     TH2F* pidBachspectrumK0SMassOfflineBkg = (TH2F*) spectrumK0SMassOfflineBkg->Clone();
-    TH2F* pidBachmomentumDistributionK0SvspOfflineSgn= (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone(); 
-    TH2F* pidBachmomentumDistributionK0SvspOfflineBkg= (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone(); 
-    TH2F* pidBachArmenterosPodK0SOffSgn = (TH2F*)armenterosPodK0SOffSgn->Clone();
-    TH2F* pidBachArmenterosPodK0SOffBkg = (TH2F*)armenterosPodK0SOffBkg->Clone();
-    TH2F* pidBachdcatoPVvspK0SOfflineSgn= (TH2F*)dcatoPVvspK0SOfflineSgn->Clone();
-    TH2F* pidBachdcatoPVvspK0SOfflineBkg= (TH2F*)dcatoPVvspK0SOfflineBkg->Clone();
+    TH2F* pidBachmomentumDistributionK0SvspOfflineSgn = (TH2F*)momentumDistributionK0SvspOfflineSgn->Clone();
+    TH2F* pidBachmomentumDistributionK0SvspOfflineBkg = (TH2F*)momentumDistributionK0SvspOfflineBkg->Clone();
+    TH2F* pidBachArmenterosPodK0SOfflineSgn = (TH2F*)armenterosPodK0SOfflineSgn->Clone();
+    TH2F* pidBachArmenterosPodK0SOfflineBkg = (TH2F*)armenterosPodK0SOfflineBkg->Clone();
+    TH2F* pidBachArmenterosPodLcOfflineSgn = (TH2F*)armenterosPodLcOfflineSgn->Clone();
+    TH2F* pidBachArmenterosPodLcOfflineBkg = (TH2F*)armenterosPodLcOfflineBkg->Clone();
 
     fOutputAll->Add(allspectrumK0SMassOfflineSgn);
     fOutputAll->Add(allspectrumK0SMassOfflineBkg);
     fOutputAll->Add(allspectrumLcMassOfflineByK0SSgn);
     fOutputAll->Add(allspectrumLcMassOfflineByK0SBkg);
-    fOutputAll->Add(allmomentumDistributionK0SvspOfflineSgn); 
-    fOutputAll->Add(allmomentumDistributionK0SvspOfflineBkg); 
-    fOutputAll->Add(allArmenterosPodK0SOffSgn);
-    fOutputAll->Add(allArmenterosPodK0SOffBkg);
-    fOutputAll->Add(alldcatoPVvspK0SOfflineSgn);
-    fOutputAll->Add(alldcatoPVvspK0SOfflineBkg);
+    fOutputAll->Add(allmomentumDistributionK0SvspOfflineSgn);
+    fOutputAll->Add(allmomentumDistributionK0SvspOfflineBkg);
+    fOutputAll->Add(allArmenterosPodK0SOfflineSgn);
+    fOutputAll->Add(allArmenterosPodK0SOfflineBkg);
+    fOutputAll->Add(allArmenterosPodLcOfflineSgn);
+    fOutputAll->Add(allArmenterosPodLcOfflineBkg);
 
     fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineSgn);
     fOutputPIDBach->Add(pidBachspectrumK0SMassOfflineBkg);
     fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SSgn);
     fOutputPIDBach->Add(pidBachspectrumLcMassOfflineByK0SBkg);
-    fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineSgn); 
-    fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineBkg);  
-    fOutputPIDBach->Add(pidBachArmenterosPodK0SOffSgn);
-    fOutputPIDBach->Add(pidBachArmenterosPodK0SOffBkg);    
-    fOutputPIDBach->Add(pidBachdcatoPVvspK0SOfflineSgn);
-    fOutputPIDBach->Add(pidBachdcatoPVvspK0SOfflineBkg);
+    fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineSgn);
+    fOutputPIDBach->Add(pidBachmomentumDistributionK0SvspOfflineBkg);
+    fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineSgn);
+    fOutputPIDBach->Add(pidBachArmenterosPodK0SOfflineBkg);
+    fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineSgn);
+    fOutputPIDBach->Add(pidBachArmenterosPodLcOfflineBkg);
+
+    nameHistoSgn="histArmPodK0SOfflineSgn0";
+    nameHistoBkg="histArmPodK0SOfflineBkg0";
+    titleHistoSgn="K^{0}_{S} Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    titleHistoBkg="K^{0}_{S} Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodK0SOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+    TH2F* armenterosPodK0SOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-1.,1.,300,0.,0.3);
+    nameHistoSgn="histArmPodLcOfflineSgn0";
+    nameHistoBkg="histArmPodLcOfflineBkg0";
+    titleHistoSgn="#Lambda_{c} Armenteros-Podolanski distribution (sgn) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    titleHistoBkg="#Lambda_{c} Armenteros-Podolanski distribution (bkg) -offline-; #frac{p_{L}^{+}-p_{L}^{-}}{p_{L}^{+}+p_{L}^{-}}; p_{T}^{+} [GeV/c]";
+    TH2F* armenterosPodLcOfflineSgn0 = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
+    TH2F* armenterosPodLcOfflineBkg0 = new TH2F(nameHistoBkg.Data(),titleHistoSgn.Data(),200,-4.,4.,800,0.,1.6);
+    fOutputAll->Add(armenterosPodK0SOfflineSgn0);
+    fOutputAll->Add(armenterosPodK0SOfflineBkg0);
+    fOutputAll->Add(armenterosPodLcOfflineSgn0);
+    fOutputAll->Add(armenterosPodLcOfflineBkg0);
 
     if (fTrackRotation) {
       TH2F* pidBachTRspectrumLcMassOfflineByK0SSgn = (TH2F*)spectrumLcMassOfflineByK0SSgn->Clone(); 
@@ -1018,143 +1597,420 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
       fOutputPIDBachTR->Add(pidBachTRspectrumLcMassOfflineByK0SBkg);
     }
 
-  }
+
+
+
+    nameHistoSgn="histptK0SOfflineSgn";
+    nameHistoBkg="histptK0SOfflineBkg";
+    titleHistoSgn="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(K^{0}_{S}) [GeV/c]; Entries";
+    TH2F* ptK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPOfflineSgn";
+    nameHistoBkg="histptPOfflineBkg";
+    titleHistoSgn="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(p) [GeV/c]; Entries";
+    TH2F* ptPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPipOfflineSgn";
+    nameHistoBkg="histptPipOfflineBkg";
+    titleHistoSgn="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{+}) [GeV/c]; Entries";
+    TH2F* ptPiPOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPiPOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histptPimOfflineSgn";
+    nameHistoBkg="histptPimOfflineBkg";
+    titleHistoSgn="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+    titleHistoBkg="p_{T}(#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; p_{T}(#pi^{-}) [GeV/c]; Entries";
+    TH2F* ptPiMOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,41,binLimpTprong);
+    TH2F* ptPiMOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,41,binLimpTprong);
+
+    nameHistoSgn="histLambdaMassOfflineSgn";
+    nameHistoBkg="histLambdaMassOfflineBkg";
+    titleHistoSgn="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(p,#pi^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(p,#pi^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massLambdaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+    TH2F* massLambdaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHistoSgn="histLambdaBarMassOfflineSgn";
+    nameHistoBkg="histLambdaBarMassOfflineBkg";
+    titleHistoSgn="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(#bar{p},#pi^{+}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(#bar{p},#pi^{+}) [GeV/c^{2}]; Entries";
+    TH2F* massLambdaBarOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+    TH2F* massLambdaBarOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,mMinLambdaPDG,mMinLambdaPDG+0.5);
+
+    nameHistoSgn="histGammaMassOfflineSgn";
+    nameHistoBkg="histGammaMassOfflineBkg";
+    titleHistoSgn="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+    titleHistoBkg="m_{inv}(e^{+},e^{-}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; m_{inv}(e^{+},e^{-}) [GeV/c^{2}]; Entries";
+    TH2F* massGammaOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,100,0.,1.);
+    TH2F* massGammaOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,100,0.,1.);
+
+    nameHistoSgn="histD0K0SOfflineSgn";
+    nameHistoBkg="histD0K0SOfflineBkg";
+    titleHistoSgn="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+    titleHistoBkg="d_{0}(K^{0}_{S}) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(K^{0}_{S}) [#sigmas]; Entries";
+    TH2F* d0K0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
+    TH2F* d0K0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHistoSgn="histD0POfflineSgn";
+    nameHistoBkg="histD0POfflineBkg";
+    titleHistoSgn="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+    titleHistoBkg="d_{0}(p) vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; d_{0}(p) [cm]; Entries";
+    TH2F* d0POfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),11,binLimpTLc,1000,-1.,1.);
+    TH2F* d0POfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),11,binLimpTLc,1000,-1.,1.);
+
+    nameHistoSgn="histCosPAK0SOfflineSgn";
+    nameHistoBkg="histCosPAK0SOfflineBkg";
+    titleHistoSgn="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+    titleHistoBkg="K^{0}_{S} cosine of pointing angle wrt primary vertex vs p_{T}(#Lambda_{c}); p_{T}(#Lambda_{c}) [GeV/c]; cosine; Entries";
+    TH2F *cosPAK0SOfflineSgn = new TH2F(nameHistoSgn.Data(),titleHistoSgn.Data(),41,binLimpTprong,100,0.99,1.);
+    TH2F *cosPAK0SOfflineBkg = new TH2F(nameHistoBkg.Data(),titleHistoBkg.Data(),41,binLimpTprong,100,0.99,1.);
+
+    TH2F* allptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
+    TH2F* allptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
+    TH2F* allptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
+    TH2F* allptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
+    TH2F* allptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
+    TH2F* allptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
+    TH2F* allptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
+    TH2F* allptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
+    TH2F* allmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
+    TH2F* allmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
+    TH2F* allmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
+    TH2F* allmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
+    TH2F* allmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
+    TH2F* allmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
+    TH2F* alld0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
+    TH2F* alld0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
+    TH2F* alld0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
+    TH2F* alld0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
+    TH2F* allcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
+    TH2F* allcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
+
+    TH2F* pidptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
+    TH2F* pidptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
+    TH2F* pidptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
+    TH2F* pidptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
+    TH2F* pidptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
+    TH2F* pidptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
+    TH2F* pidptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
+    TH2F* pidptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
+    TH2F* pidmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
+    TH2F* pidmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
+    TH2F* pidmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
+    TH2F* pidmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
+    TH2F* pidmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
+    TH2F* pidmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
+    TH2F* pidd0K0SOfflineSgn = (TH2F*)d0K0SOfflineSgn->Clone();
+    TH2F* pidd0K0SOfflineBkg = (TH2F*)d0K0SOfflineBkg->Clone();
+    TH2F* pidd0POfflineSgn = (TH2F*)d0POfflineSgn->Clone();
+    TH2F* pidd0POfflineBkg = (TH2F*)d0POfflineBkg->Clone();
+    TH2F* pidcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
+    TH2F* pidcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
+
+    fOutputAll->Add(allptK0SOfflineSgn);
+    fOutputAll->Add(allptK0SOfflineBkg);
+    fOutputAll->Add(allptPOfflineSgn);
+    fOutputAll->Add(allptPOfflineBkg);
+    fOutputAll->Add(allptPiPOfflineSgn);
+    fOutputAll->Add(allptPiPOfflineBkg);
+    fOutputAll->Add(allptPiMOfflineSgn);
+    fOutputAll->Add(allptPiMOfflineBkg);
+    fOutputAll->Add(allmassLambdaOfflineSgn);
+    fOutputAll->Add(allmassLambdaOfflineBkg);
+    fOutputAll->Add(allmassLambdaBarOfflineSgn);
+    fOutputAll->Add(allmassLambdaBarOfflineBkg);
+    fOutputAll->Add(allmassGammaOfflineSgn);
+    fOutputAll->Add(allmassGammaOfflineBkg);
+    fOutputAll->Add(alld0K0SOfflineSgn);
+    fOutputAll->Add(alld0K0SOfflineBkg);
+    fOutputAll->Add(alld0POfflineSgn);
+    fOutputAll->Add(alld0POfflineBkg);
+    fOutputAll->Add(allcosPAK0SOfflineSgn);
+    fOutputAll->Add(allcosPAK0SOfflineBkg);
+
+    fOutputPIDBach->Add(pidptK0SOfflineSgn);
+    fOutputPIDBach->Add(pidptK0SOfflineBkg);
+    fOutputPIDBach->Add(pidptPOfflineSgn);
+    fOutputPIDBach->Add(pidptPOfflineBkg);
+    fOutputPIDBach->Add(pidptPiPOfflineSgn);
+    fOutputPIDBach->Add(pidptPiPOfflineBkg);
+    fOutputPIDBach->Add(pidptPiMOfflineSgn);
+    fOutputPIDBach->Add(pidptPiMOfflineBkg);
+    fOutputPIDBach->Add(pidmassLambdaOfflineSgn);
+    fOutputPIDBach->Add(pidmassLambdaOfflineBkg);
+    fOutputPIDBach->Add(pidmassLambdaBarOfflineSgn);
+    fOutputPIDBach->Add(pidmassLambdaBarOfflineBkg);
+    fOutputPIDBach->Add(pidmassGammaOfflineSgn);
+    fOutputPIDBach->Add(pidmassGammaOfflineBkg);
+    fOutputPIDBach->Add(pidd0K0SOfflineSgn);
+    fOutputPIDBach->Add(pidd0K0SOfflineBkg);
+    fOutputPIDBach->Add(pidd0POfflineSgn);
+    fOutputPIDBach->Add(pidd0POfflineBkg);
+    fOutputPIDBach->Add(pidcosPAK0SOfflineSgn);
+    fOutputPIDBach->Add(pidcosPAK0SOfflineBkg);
+
+    if (fTrackRotation) {
+
+      TH2F* pidTRptK0SOfflineSgn = (TH2F*)ptK0SOfflineSgn->Clone();
+      TH2F* pidTRptK0SOfflineBkg = (TH2F*)ptK0SOfflineBkg->Clone();
+      TH2F* pidTRptPOfflineSgn = (TH2F*)ptPOfflineSgn->Clone();
+      TH2F* pidTRptPOfflineBkg = (TH2F*)ptPOfflineBkg->Clone();
+      TH2F* pidTRptPiPOfflineSgn = (TH2F*)ptPiPOfflineSgn->Clone();
+      TH2F* pidTRptPiPOfflineBkg = (TH2F*)ptPiPOfflineBkg->Clone();
+      TH2F* pidTRptPiMOfflineSgn = (TH2F*)ptPiMOfflineSgn->Clone();
+      TH2F* pidTRptPiMOfflineBkg = (TH2F*)ptPiMOfflineBkg->Clone();
+      TH2F* pidTRmassLambdaOfflineSgn = (TH2F*)massLambdaOfflineSgn->Clone();
+      TH2F* pidTRmassLambdaOfflineBkg = (TH2F*)massLambdaOfflineBkg->Clone();
+      TH2F* pidTRmassLambdaBarOfflineSgn = (TH2F*)massLambdaBarOfflineSgn->Clone();
+      TH2F* pidTRmassLambdaBarOfflineBkg = (TH2F*)massLambdaBarOfflineBkg->Clone();
+      TH2F* pidTRmassGammaOfflineSgn = (TH2F*)massGammaOfflineSgn->Clone();
+      TH2F* pidTRmassGammaOfflineBkg = (TH2F*)massGammaOfflineBkg->Clone();
+      TH2F* pidTRcosPAK0SOfflineSgn = (TH2F*)cosPAK0SOfflineSgn->Clone();
+      TH2F* pidTRcosPAK0SOfflineBkg = (TH2F*)cosPAK0SOfflineBkg->Clone();
+      fOutputPIDBachTR->Add(pidTRptK0SOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRptK0SOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRptPOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRptPOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRptPiPOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRptPiPOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRptPiMOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRptPiMOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRmassLambdaOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRmassLambdaOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRmassLambdaBarOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRmassGammaOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRmassGammaOfflineBkg);
+      fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineSgn);
+      fOutputPIDBachTR->Add(pidTRcosPAK0SOfflineBkg);
+
+    }
+
+  } // useMCinfo
 
 
   if (fTrackRotation) {
 
-    TH1F *hNormRotated=new TH1F("hNormRotated","",11,-0.5,10.5);
-    TH1F *hNormRotatedOffline=new TH1F("hNormRotatedOffline","",11,-0.5,10.5);
-    TH1F *hNormRotatedSgn=new TH1F("hNormRotatedSgn","",11,-0.5,10.5);
-    TH1F *hNormRotatedOfflineSgn=new TH1F("hNormRotatedOfflineSgn","",11,-0.5,10.5);
-    TH1F *hNormRotatedBkg=new TH1F("hNormRotatedBkg","",11,-0.5,10.5);
-    TH1F *hNormRotatedOfflineBkg=new TH1F("hNormRotatedOfflineBkg","",11,-0.5,10.5);
+    TH3F *phiVSthetaVSpt = new TH3F("phiVSthetaVSpt","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+    TH3F *phiVSthetaVSptRot = new TH3F("phiVSthetaVSptRot","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+    TH3F *phiVSthetaVSptOffline = new TH3F("phiVSthetaVSptOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+    TH3F *phiVSthetaVSptRotOffline = new TH3F("phiVSthetaVSptRotOffline","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+    fOutputPIDBachTR->Add(phiVSthetaVSpt);
+    fOutputPIDBachTR->Add(phiVSthetaVSptRot);
+    fOutputPIDBachTR->Add(phiVSthetaVSptOffline);
+    fOutputPIDBachTR->Add(phiVSthetaVSptRotOffline);
+
+    TH1F *hNormRotated=new TH1F("hNormRotated","",fNRotations+1,-0.5,fNRotations+0.5);
+    TH1F *hNormRotatedOffline=new TH1F("hNormRotatedOffline","",fNRotations+1,-0.5,fNRotations+0.5);
+    /*
     hNormRotated->Sumw2();
     hNormRotatedOffline->Sumw2();
-    hNormRotatedSgn->Sumw2();
-    hNormRotatedOfflineSgn->Sumw2();
-    hNormRotatedBkg->Sumw2();
-    hNormRotatedOfflineBkg->Sumw2();
     hNormRotated->SetMinimum(0);
     hNormRotatedOffline->SetMinimum(0);
-    hNormRotatedSgn->SetMinimum(0);
-    hNormRotatedOfflineSgn->SetMinimum(0);
-    hNormRotatedBkg->SetMinimum(0);
-    hNormRotatedOfflineBkg->SetMinimum(0);
+    */
 
     fOutputPIDBachTR->Add(hNormRotated);
     fOutputPIDBachTR->Add(hNormRotatedOffline);
-    fOutputPIDBachTR->Add(hNormRotatedSgn);
-    fOutputPIDBachTR->Add(hNormRotatedOfflineSgn);
-    fOutputPIDBachTR->Add(hNormRotatedBkg);
-    fOutputPIDBachTR->Add(hNormRotatedOfflineBkg);
 
-    Int_t nMassBins=static_cast<Int_t>(fMaxMass*1000.-fMinMass*1000.);
-    Double_t maxm=fMinMass+nMassBins*0.001;
-    TH3F *hMassVsPtVsY=new TH3F("hMassVsPtVsY","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYOffline=new TH3F("hMassVsPtVsYOffline","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYSgn=new TH3F("hMassVsPtVsYSgn","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYOfflineSgn=new TH3F("hMassVsPtVsYOfflineSgn","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYBkg=new TH3F("hMassVsPtVsYBkg","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYOfflineBkg=new TH3F("hMassVsPtVsYOfflineBkg","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
+    if (fUseMCInfo) {
 
+      TH3F *phiVSthetaVSptSgn = new TH3F("phiVSthetaVSptSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptRotSgn = new TH3F("phiVSthetaVSptRotSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptOfflineSgn = new TH3F("phiVSthetaVSptOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptRotOfflineSgn = new TH3F("phiVSthetaVSptRotOfflineSgn","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      fOutputPIDBachTR->Add(phiVSthetaVSptSgn);
+      fOutputPIDBachTR->Add(phiVSthetaVSptRotSgn);
+      fOutputPIDBachTR->Add(phiVSthetaVSptOfflineSgn);
+      fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineSgn);
+
+      TH3F *phiVSthetaVSptBkg = new TH3F("phiVSthetaVSptBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptRotBkg = new TH3F("phiVSthetaVSptRotBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptOfflineBkg = new TH3F("phiVSthetaVSptOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      TH3F *phiVSthetaVSptRotOfflineBkg = new TH3F("phiVSthetaVSptRotOfflineBkg","",35,0.,35.,360,0.,2.*TMath::Pi(),100,40.*TMath::DegToRad(),140.*TMath::DegToRad());
+      fOutputPIDBachTR->Add(phiVSthetaVSptBkg);
+      fOutputPIDBachTR->Add(phiVSthetaVSptRotBkg);
+      fOutputPIDBachTR->Add(phiVSthetaVSptOfflineBkg);
+      fOutputPIDBachTR->Add(phiVSthetaVSptRotOfflineBkg);
+
+      TH1F *hNormRotatedSgn=new TH1F("hNormRotatedSgn","",fNRotations+1,-0.5,fNRotations+0.5);
+      TH1F *hNormRotatedOfflineSgn=new TH1F("hNormRotatedOfflineSgn","",fNRotations+1,-0.5,fNRotations+0.5);
+      TH1F *hNormRotatedBkg=new TH1F("hNormRotatedBkg","",fNRotations+1,-0.5,fNRotations+0.5);
+      TH1F *hNormRotatedOfflineBkg=new TH1F("hNormRotatedOfflineBkg","",fNRotations+1,-0.5,fNRotations+0.5);
+      /*
+      hNormRotatedSgn->Sumw2();
+      hNormRotatedOfflineSgn->Sumw2();
+      hNormRotatedBkg->Sumw2();
+      hNormRotatedOfflineBkg->Sumw2();
+
+      hNormRotatedSgn->SetMinimum(0);
+      hNormRotatedOfflineSgn->SetMinimum(0);
+      hNormRotatedBkg->SetMinimum(0);
+      hNormRotatedOfflineBkg->SetMinimum(0);
+      */
+
+      fOutputPIDBachTR->Add(hNormRotatedSgn);
+      fOutputPIDBachTR->Add(hNormRotatedOfflineSgn);
+      fOutputPIDBachTR->Add(hNormRotatedBkg);
+      fOutputPIDBachTR->Add(hNormRotatedOfflineBkg);
+
+    }
+
+    Int_t nMassBins=fMaxMass*1000.-fMinMass*1000.;
+    Double_t maxm=fMinMass+nMassBins*0.001;
+    TH3F *hMassVsPtVsY=new TH3F("hMassVsPtVsY","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+    TH3F *hMassVsPtVsYOffline=new TH3F("hMassVsPtVsYOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+    /*
     hMassVsPtVsY->Sumw2();
     hMassVsPtVsYOffline->Sumw2();
-    hMassVsPtVsYSgn->Sumw2();
-    hMassVsPtVsYOfflineSgn->Sumw2();
-    hMassVsPtVsYBkg->Sumw2();
-    hMassVsPtVsYOfflineBkg->Sumw2();
+
     hMassVsPtVsY->SetMinimum(0);
     hMassVsPtVsYOffline->SetMinimum(0);
-    hMassVsPtVsYSgn->SetMinimum(0);
-    hMassVsPtVsYOfflineSgn->SetMinimum(0);
-    hMassVsPtVsYBkg->SetMinimum(0);
-    hMassVsPtVsYOfflineBkg->SetMinimum(0);
+    */
 
     fOutputPIDBachTR->Add(hMassVsPtVsY);
     fOutputPIDBachTR->Add(hMassVsPtVsYOffline);
-    fOutputPIDBachTR->Add(hMassVsPtVsYSgn);
-    fOutputPIDBachTR->Add(hMassVsPtVsYOfflineSgn);
-    fOutputPIDBachTR->Add(hMassVsPtVsYBkg);
-    fOutputPIDBachTR->Add(hMassVsPtVsYOfflineBkg);
-
-    TH3F *hMassVsPtVsYRot=new TH3F("hMassVsPtVsYRot","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYRotOffline=new TH3F("hMassVsPtVsYRotOffline","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYRotSgn=new TH3F("hMassVsPtVsYRotSgn","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYRotOfflineSgn=new TH3F("hMassVsPtVsYRotOfflineSgn","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYRotBkg=new TH3F("hMassVsPtVsYRotBkg","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
-    TH3F *hMassVsPtVsYRotOfflineBkg=new TH3F("hMassVsPtVsYRotOfflineBkg","",nMassBins,fMinMass,maxm,20,0.,10.,20,-1.,1.);
 
+    if (fUseMCInfo) {
+
+      TH3F *hMassVsPtVsYSgn=new TH3F("hMassVsPtVsYSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYOfflineSgn=new TH3F("hMassVsPtVsYOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYBkg=new TH3F("hMassVsPtVsYBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYOfflineBkg=new TH3F("hMassVsPtVsYOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+
+      /*
+      hMassVsPtVsYSgn->Sumw2();
+      hMassVsPtVsYOfflineSgn->Sumw2();
+      hMassVsPtVsYBkg->Sumw2();
+      hMassVsPtVsYOfflineBkg->Sumw2();
+
+      hMassVsPtVsYSgn->SetMinimum(0);
+      hMassVsPtVsYOfflineSgn->SetMinimum(0);
+      hMassVsPtVsYBkg->SetMinimum(0);
+      hMassVsPtVsYOfflineBkg->SetMinimum(0);
+      */
+
+      fOutputPIDBachTR->Add(hMassVsPtVsYSgn);
+      fOutputPIDBachTR->Add(hMassVsPtVsYOfflineSgn);
+      fOutputPIDBachTR->Add(hMassVsPtVsYBkg);
+      fOutputPIDBachTR->Add(hMassVsPtVsYOfflineBkg);
+
+    }
+
+    TH3F *hMassVsPtVsYRot=new TH3F("hMassVsPtVsYRot","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+    TH3F *hMassVsPtVsYRotOffline=new TH3F("hMassVsPtVsYRotOffline","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+    /*
     hMassVsPtVsYRot->Sumw2();
     hMassVsPtVsYRotOffline->Sumw2();
-    hMassVsPtVsYRotSgn->Sumw2();
-    hMassVsPtVsYRotOfflineSgn->Sumw2();
-    hMassVsPtVsYRotBkg->Sumw2();
-    hMassVsPtVsYRotOfflineBkg->Sumw2();
+
     hMassVsPtVsYRot->SetMinimum(0);
     hMassVsPtVsYRotOffline->SetMinimum(0);
-    hMassVsPtVsYRotSgn->SetMinimum(0);
-    hMassVsPtVsYRotOfflineSgn->SetMinimum(0);
-    hMassVsPtVsYRotBkg->SetMinimum(0);
-    hMassVsPtVsYRotOfflineBkg->SetMinimum(0);
+    */
 
     fOutputPIDBachTR->Add(hMassVsPtVsYRot);
     fOutputPIDBachTR->Add(hMassVsPtVsYRotOffline);
-    fOutputPIDBachTR->Add(hMassVsPtVsYRotSgn);
-    fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineSgn);
-    fOutputPIDBachTR->Add(hMassVsPtVsYRotBkg);
-    fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineBkg);
 
+    if (fUseMCInfo) {
+
+      TH3F *hMassVsPtVsYRotSgn=new TH3F("hMassVsPtVsYRotSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYRotOfflineSgn=new TH3F("hMassVsPtVsYRotOfflineSgn","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYRotBkg=new TH3F("hMassVsPtVsYRotBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      TH3F *hMassVsPtVsYRotOfflineBkg=new TH3F("hMassVsPtVsYRotOfflineBkg","",nMassBins,fMinMass,maxm,15,0.,15.,20,-1.,1.);
+      /*
+      hMassVsPtVsYRotSgn->Sumw2();
+      hMassVsPtVsYRotOfflineSgn->Sumw2();
+      hMassVsPtVsYRotBkg->Sumw2();
+      hMassVsPtVsYRotOfflineBkg->Sumw2();
+
+      hMassVsPtVsYRotSgn->SetMinimum(0);
+      hMassVsPtVsYRotOfflineSgn->SetMinimum(0);
+      hMassVsPtVsYRotBkg->SetMinimum(0);
+      hMassVsPtVsYRotOfflineBkg->SetMinimum(0);
+      */
+
+      fOutputPIDBachTR->Add(hMassVsPtVsYRotSgn);
+      fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineSgn);
+      fOutputPIDBachTR->Add(hMassVsPtVsYRotBkg);
+      fOutputPIDBachTR->Add(hMassVsPtVsYRotOfflineBkg);
+
+    }
 
     TH1F *hDeltaMass=new TH1F("hDeltaMass","",100,-0.4,0.4);
     TH1F *hDeltaMassOffline=new TH1F("hDeltaMassOffline","",100,-0.4,0.4);
-    TH1F *hDeltaMassSgn=new TH1F("hDeltaMassSgn","",100,-0.4,0.4);
-    TH1F *hDeltaMassOfflineSgn=new TH1F("hDeltaMassOfflineSgn","",100,-0.4,0.4);
-    TH1F *hDeltaMassBkg=new TH1F("hDeltaMassBkg","",100,-0.4,0.4);
-    TH1F *hDeltaMassOfflineBkg=new TH1F("hDeltaMassOfflineBkg","",100,-0.4,0.4);
+    /*
     hDeltaMass->Sumw2();
     hDeltaMassOffline->Sumw2();
-    hDeltaMassSgn->Sumw2();
-    hDeltaMassOfflineSgn->Sumw2();
-    hDeltaMassBkg->Sumw2();
-    hDeltaMassOfflineBkg->Sumw2();
 
     hDeltaMass->SetMinimum(0);
     hDeltaMassOffline->SetMinimum(0);
-    hDeltaMassSgn->SetMinimum(0);
-    hDeltaMassOfflineSgn->SetMinimum(0);
-    hDeltaMassBkg->SetMinimum(0);
-    hDeltaMassOfflineBkg->SetMinimum(0);
+    */
 
     fOutputPIDBachTR->Add(hDeltaMass);
     fOutputPIDBachTR->Add(hDeltaMassOffline);
-    fOutputPIDBachTR->Add(hDeltaMassSgn);
-    fOutputPIDBachTR->Add(hDeltaMassOfflineSgn);
-    fOutputPIDBachTR->Add(hDeltaMassBkg);
-    fOutputPIDBachTR->Add(hDeltaMassOfflineBkg);
+
+    if (fUseMCInfo) {
+
+      TH1F *hDeltaMassSgn=new TH1F("hDeltaMassSgn","",100,-0.4,0.4);
+      TH1F *hDeltaMassOfflineSgn=new TH1F("hDeltaMassOfflineSgn","",100,-0.4,0.4);
+      TH1F *hDeltaMassBkg=new TH1F("hDeltaMassBkg","",100,-0.4,0.4);
+      TH1F *hDeltaMassOfflineBkg=new TH1F("hDeltaMassOfflineBkg","",100,-0.4,0.4);
+      /*
+      hDeltaMassSgn->Sumw2();
+      hDeltaMassOfflineSgn->Sumw2();
+      hDeltaMassBkg->Sumw2();
+      hDeltaMassOfflineBkg->Sumw2();
+
+      hDeltaMassSgn->SetMinimum(0);
+      hDeltaMassOfflineSgn->SetMinimum(0);
+      hDeltaMassBkg->SetMinimum(0);
+      hDeltaMassOfflineBkg->SetMinimum(0);
+      */
+
+      fOutputPIDBachTR->Add(hDeltaMassSgn);
+      fOutputPIDBachTR->Add(hDeltaMassOfflineSgn);
+      fOutputPIDBachTR->Add(hDeltaMassBkg);
+      fOutputPIDBachTR->Add(hDeltaMassOfflineBkg);
+
+    }
 
     /*
     Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
     Double_t edgeLowSparseDMassRot[5]={fMinMass,-0.4,0.,-4.,0};
     Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
-    THnSparse *hDeltaMassFullAnalysis=new THnSparseF("hDeltaMassFullAnalysis","hDeltaMassFullAnalysis;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
-    THnSparse *hDeltaMassFullAnalysisOffline=new THnSparseF("fDeltaMassFullAnalysisOffline","hDeltaMassFullAnalysisOffline;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
-
-    THnSparse *hDeltaMassFullAnalysisSgn=new THnSparseF("hDeltaMassFullAnalysisSgn","hDeltaMassFullAnalysisSgn;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
-    THnSparse *hDeltaMassFullAnalysisOfflineSgn=new THnSparseF("fDeltaMassFullAnalysisOfflineSgn","hDeltaMassFullAnalysisOfflineSgn;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
-
-    THnSparse *hDeltaMassFullAnalysisBkg=new THnSparseF("hDeltaMassFullAnalysisBkg","hDeltaMassFullAnalysisBkg;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
-    THnSparse *hDeltaMassFullAnalysisOfflineBkg=new THnSparseF("fDeltaMassFullAnalysisOfflineBkg","hDeltaMassFullAnalysisOfflineBkg;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+    THnSparse *hDeltaMassFullAnalysis=new THnSparseF("hDeltaMassFullAnalysis","hDeltaMassFullAnalysis;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+    THnSparse *hDeltaMassFullAnalysisOffline=new THnSparseF("fDeltaMassFullAnalysisOffline","hDeltaMassFullAnalysisOffline;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
 
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysis);
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOffline);
+
+    if (fUseMCInfo) {
+
+    THnSparse *hDeltaMassFullAnalysisSgn=new THnSparseF("hDeltaMassFullAnalysisSgn","hDeltaMassFullAnalysisSgn;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+    THnSparse *hDeltaMassFullAnalysisOfflineSgn=new THnSparseF("fDeltaMassFullAnalysisOfflineSgn","hDeltaMassFullAnalysisOfflineSgn;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+
+    THnSparse *hDeltaMassFullAnalysisBkg=new THnSparseF("hDeltaMassFullAnalysisBkg","hDeltaMassFullAnalysisBkg;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+    THnSparse *hDeltaMassFullAnalysisOfflineBkg=new THnSparseF("fDeltaMassFullAnalysisOfflineBkg","hDeltaMassFullAnalysisOfflineBkg;inv mass (GeV/c);#Delta inv mass (GeV/c); p_{T}^{#Lambda_{c}} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
+
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysisSgn);
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineSgn);
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysisBkg);
     fOutputPIDBachTR->Add(hDeltaMassFullAnalysisOfflineBkg);
+
+    }
     */
+
   }
 
+  /*
+  fOutputAll->Print();
+  fOutputPIDBach->Print();
+  if (fTrackRotation) fOutputPIDBachTR->Print();
+  */
   return;
 }
 
@@ -1595,17 +2451,23 @@ Int_t AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC, In
 }
 
 //________________________________________________________________
-void AliAnalysisTaskSELc2V0bachelor::FillArmPodDistribution(AliAODv0 *vZero,
+void AliAnalysisTaskSELc2V0bachelor::FillArmPodDistribution(AliAODRecoDecay *vZero,
                                                            TString histoTitle,
-                                                           TList *histoList) {
+                                                           Bool_t isCandidateSelectedCuts,
+                                                           Bool_t isBachelorID) {
   //
   // This is to fill Armenteros Podolanski plots
   //
 
-  Double_t alpha = vZero->AlphaV0();
-  Double_t qT    = vZero->PtArmV0();
+  Double_t alpha = vZero->Alpha();//AlphaV0();
+  Double_t qT    = vZero->QtProng();//PtArmV0();
 
-  ((TH2F*)(histoList->FindObject(histoTitle)))->Fill(alpha,qT);
+  ((TH2F*)(fOutputAll->FindObject(histoTitle+"0")))->Fill(alpha,qT);
+  if (isCandidateSelectedCuts) {
+    ((TH2F*)(fOutputAll->FindObject(histoTitle)))->Fill(alpha,qT);
+    if (isBachelorID)
+      ((TH2F*)(fOutputPIDBach->FindObject(histoTitle)))->Fill(alpha,qT);
+  }
 
 }
 
@@ -1717,7 +2579,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
   Int_t mcLabel4 = -1;
   Int_t mcLabel5 = -1;
   Double_t ptCandByMC = 0.;//fmcPartCandidate->Pt();
-  Double_t yCandByMC  = 0.;//fmcPartCandidate->Y() ;
+  Double_t yCandByMC  = 0.;//fmcPartCandidate->Y();
   if (fUseMCInfo) {
     if (isLc) {
       Int_t pdgCand0 = 4122;
@@ -1727,7 +2589,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabelLc2pK0S);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
 
@@ -1741,7 +2603,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
 
@@ -1758,7 +2620,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel2);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
     if (mcLabel3!=-1) {
@@ -1766,7 +2628,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel3);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
 
@@ -1783,7 +2645,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel4);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
     if (mcLabel5!=-1) {
@@ -1791,7 +2653,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
       AliAODMCParticle *lambdaCpartMC = (AliAODMCParticle*)mcArray->At(mcLabel5);
       if (lambdaCpartMC) {
        ptCandByMC = lambdaCpartMC->Pt();
-       yCandByMC  = lambdaCpartMC->Y() ;
+       yCandByMC  = lambdaCpartMC->Y();
       }
     }
   }
@@ -1846,7 +2708,7 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
   }
 
   AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
-  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack(); 
+  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack();
 
   Int_t areV0daughtersSelected = (v0pos->TestFilterMask(BIT(4)))*1 + (!(v0pos->TestFilterMask(BIT(4))))*2;
   areV0daughtersSelected += (v0pos->GetLabel()<0)*4 + (v0pos->GetLabel()>=0)*8;
@@ -2460,49 +3322,144 @@ void  AliAnalysisTaskSELc2V0bachelor::DefineAnalysisHistograms() {
 }
 
 //________________________________________________________________________
-void  AliAnalysisTaskSELc2V0bachelor::FillAnalysisHistograms(AliAODRecoCascadeHF *part, Bool_t isBachelorID, TString appendthis) {
+void  AliAnalysisTaskSELc2V0bachelor::FillAnalysisHistograms(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TString appendthis) {
   //
   // This is to fill analysis histograms
   //
 
   TString fillthis="";
 
+  Bool_t isBachelorID = (((cutsAnal->IsSelected(part,AliRDHFCuts::kPID))&(AliRDHFCutsLctoV0::kLcToK0Spr))==(AliRDHFCutsLctoV0::kLcToK0Spr)); // ID x bachelor
+
+  Bool_t areCutsUsingPID = cutsAnal->GetIsUsePID();
+  cutsAnal->SetUsePID(kFALSE);
+
   Double_t invmassLc = part->InvMassLctoK0sP();
   Double_t lambdacpt = part->Pt();
 
   AliAODTrack *bachelor = (AliAODTrack*)part->GetBachelor();
-  Double_t momBach  = bachelor->P();
+  Double_t momBach = bachelor->P();
+  Double_t ptBach = bachelor->Pt();
 
-  AliAODv0 * v0part = (AliAODv0*)part->Getv0();
+  AliAODv0 *v0part = (AliAODv0*)part->Getv0();
   Double_t momK0S = v0part->P();
   Double_t ptK0S = v0part->Pt();
-  Double_t dcaV0ptp = v0part->GetDCA();
+  //Double_t dcaV0ptp = v0part->GetDCA();
   Double_t invmassK0S = v0part->MassK0Short();
 
+  AliAODTrack *v0pos = (AliAODTrack*)part->Getv0PositiveTrack();
+  Double_t ptV0pos = v0pos->Pt();
+  AliAODTrack *v0neg = (AliAODTrack*)part->Getv0NegativeTrack(); 
+  Double_t ptV0neg = v0neg->Pt();
+
   fillthis="histK0SMass"+appendthis;
   //    cout << fillthis << endl;
-  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassK0S,ptK0S);
-  if (isBachelorID)  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassK0S,ptK0S);
+  cutsAnal->SetExcludedCut(2);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassK0S,ptK0S);
+    if (isBachelorID)  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassK0S,ptK0S);
+  }
+  cutsAnal->SetExcludedCut(-1);
 
   fillthis="histpK0Svsp"+appendthis;
   //    cout << fillthis << endl;
-  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(momBach,momK0S);
-  if (isBachelorID)  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(momBach,momK0S);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(momBach,momK0S);
+    if (isBachelorID)  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(momBach,momK0S);
+  }
 
-  fillthis="histDCAtoPVvspK0S"+appendthis;
+  fillthis="histLcMassByK0S"+appendthis;
   //    cout << fillthis << endl;
-  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(momK0S,dcaV0ptp);
-  if (isBachelorID)  ((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(momK0S,dcaV0ptp);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
+  }
+
+
 
-  fillthis="histArmPodK0S"+appendthis;
+
+  fillthis="histptK0S"+appendthis;
   //    cout << fillthis << endl;
-  FillArmPodDistribution(v0part,fillthis,fOutputAll);
-  if (isBachelorID) FillArmPodDistribution(v0part,fillthis,fOutputPIDBach);
+  cutsAnal->SetExcludedCut(15);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptK0S);
+  }
 
-  fillthis="histLcMassByK0S"+appendthis;
+  fillthis="histptP"+appendthis;
   //    cout << fillthis << endl;
-  ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
-  if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(invmassLc,lambdacpt);
+  cutsAnal->SetExcludedCut(4);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptBach);
+  }
+
+  fillthis="histptPip"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(5);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0pos);
+  }
+
+  fillthis="histptPim"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(6);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,ptV0neg);
+  }
+
+  fillthis="histLambdaMass"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(13);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassLambda());
+  }
+
+  fillthis="histLambdaBarMass"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(13);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->MassAntiLambda());
+  }
+
+  fillthis="histGammaMass"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(14);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,v0part->InvMass2Prongs(0,1,11,11));
+  }
+
+  fillthis="histD0K0S"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(11);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(1));
+  }
+
+  fillthis="histD0P"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(10);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->Getd0Prong(0));
+  }
+
+  fillthis="histCosPAK0S"+appendthis;
+  //    cout << fillthis << endl;
+  cutsAnal->SetExcludedCut(9);
+  if ( ((cutsAnal->IsSelected(part,AliRDHFCuts::kCandidate))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+    ((TH2F*)(fOutputAll->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
+    if (isBachelorID)((TH2F*)(fOutputPIDBach->FindObject(fillthis)))->Fill(lambdacpt,part->CosV0PointingAngle());
+  }
+  cutsAnal->SetExcludedCut(-1);
+
+  cutsAnal->SetUsePID(areCutsUsingPID);
 
   return;
 }
@@ -2734,11 +3691,13 @@ Int_t AliAnalysisTaskSELc2V0bachelor::SearchForCommonMother(TClonesArray *mcArra
     lab = TMath::Abs(dgLabels[i]);
     if(lab<0) {
       AliDebug(2,Form("daughter with negative label %d",lab));
+      delete [] labelMother;
       return 0;
     }
     part = (AliAODMCParticle*)mcArray->At(lab);
     if(!part) { 
       AliDebug(2,"no MC particle");
+      delete [] labelMother;
       return 0;
     }
 
@@ -2769,7 +3728,7 @@ Int_t AliAnalysisTaskSELc2V0bachelor::SearchForCommonMother(TClonesArray *mcArra
     for (Int_t jj=0;jj<labelMother[i]->GetSize(); jj++)
       stringaCheck.Append(Form("%d, ",labelMother[i]->At(jj)));
   }
-  printf("%s \n",stringaCheck.Data());
+  AliDebug(2,Form("%s \n",stringaCheck.Data()));
   Int_t pdgToBeReturned=0;
 
   TString stringaCheck2;
@@ -2801,9 +3760,10 @@ Int_t AliAnalysisTaskSELc2V0bachelor::SearchForCommonMother(TClonesArray *mcArra
     }
   }
   stringaCheck2.Prepend(Form("Ecco quanto trovato: %d(%d) with %d daughters; ",absLabelMother,pdgToBeReturned,nDauCand));
-  printf("%s \n",stringaCheck2.Data());
+  AliDebug(2,Form("%s \n",stringaCheck2.Data()));
 
   delete [] labelMother;
+  delete pdgDg;
 
   return pdgToBeReturned;
 
@@ -2825,9 +3785,16 @@ void AliAnalysisTaskSELc2V0bachelor::TrackRotation(AliRDHFCutsLctoV0 * cuts, Ali
   Double_t mass=TMath::Sqrt(minv2);
   Double_t rapid = partCopy->Y(pdgD);
 
-  TString fillthis="hMassVsPtVsY"+appendthis;
+  TString fillthis;
+
   if ( ( ( (cuts->IsSelected(part,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) ) {
+    fillthis="hMassVsPtVsY"+appendthis;
+    //cout << fillthis << endl;
     ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
+
+    fillthis="phiVSthetaVSpt"+appendthis;
+    //cout << fillthis << endl;
+    ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,part->Phi(),part->Theta());
   }
 
   Int_t nRotated=0;
@@ -2848,27 +3815,99 @@ void AliAnalysisTaskSELc2V0bachelor::TrackRotation(AliRDHFCutsLctoV0 * cuts, Ali
     massRot=TMath::Sqrt(minv2);
     rapid = partCopy->Y(pdgD);
     //if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
-    if ( ( ( (cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) ) {
-
-      fillthis="histLcMassByK0S"+appendthis;
-      ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot,pt);
-
-      fillthis="hMassVsPtVsYRot"+appendthis;
-      ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
-      fillthis="hDeltaMass"+appendthis;
-      ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot-mass);
-      //if(fFullAnalysis){
-      //Double_t pointRot[5]={mass,massRot-mass,ptOrig,pt-ptOrig,angleProngXY};
-      //fillthis="hDeltaMassFullAnalysis"+appendthis;
-      //((THnSparse*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pointRot);
-      //}
-      nRotated++;
-      //}
-    }
+    if ( cuts->IsInFiducialAcceptance(pt,partCopy->Y(4122)) ) {
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+
+       fillthis="histLcMassByK0S"+appendthis;
+       //cout << fillthis << endl;
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot,pt);
+
+       fillthis="hMassVsPtVsYRot"+appendthis;
+       //cout << fillthis << endl;
+       ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(mass,pt,rapid);
+
+       fillthis="phiVSthetaVSptRot"+appendthis;
+       //cout << fillthis << endl;
+       ((TH3F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->Phi(),partCopy->Theta());
+
+       fillthis="hDeltaMass"+appendthis;
+       //cout << fillthis << endl;
+       ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(massRot-mass);
+       //if(fFullAnalysis){
+       //Double_t pointRot[5]={mass,massRot-mass,ptOrig,pt-ptOrig,angleProngXY};
+       //fillthis="hDeltaMassFullAnalysis"+appendthis;
+       ////cout << fillthis << endl;
+       //((THnSparse*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pointRot);
+       //}
+       nRotated++;
+       //}
+      }
+
+      // fill additional histos for track-rotated candidates
+      fillthis="histptK0S"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(15);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[1]*px[1]+py[1]*py[1]));
+      }
+
+      fillthis="histptP"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(4);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,TMath::Sqrt(px[0]*px[0]+py[0]*py[0]));
+      }
+
+      fillthis="histptPip"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(5);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0PositiveTrack())->Pt());
+      }
+
+      fillthis="histptPim"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(6);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0NegativeTrack())->Pt());
+      }
+
+      fillthis="histLambdaMass"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(13);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassLambda());
+      }
+
+      fillthis="histLambdaBarMass"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(13);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->MassAntiLambda());
+      }
+
+      fillthis="histGammaMass"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(14);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,(partCopy->Getv0())->InvMass2Prongs(0,1,11,11));
+      }
+
+      fillthis="histCosPAK0S"+appendthis;
+      //cout << fillthis << endl;
+      cuts->SetExcludedCut(9);
+      if ( ((cuts->IsSelected(partCopy,AliRDHFCuts::kAll))&(AliRDHFCutsLctoV0::kLcToK0Spr)) == (AliRDHFCutsLctoV0::kLcToK0Spr) ) {
+       ((TH2F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(pt,partCopy->CosV0PointingAngle());
+      }
+      cuts->SetExcludedCut(-1);
+
+    } // isInFiducialAcceptance
+
     px[0]=tmpx;
     py[0]=tmpy;
   }
   fillthis="hNormRotated"+appendthis;
+  //cout << fillthis << endl;
   ((TH1F*)(fOutputPIDBachTR->FindObject(fillthis)))->Fill(nRotated);
 
   delete partCopy;
index 13fdf31cd8782bf1485845809ae6dfc28eb9ffff..817c4021b63890630d80a821065c3e15c5ea02d2 100644 (file)
@@ -65,7 +65,7 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
   void SetAdditionalChecks(Bool_t additionalChecks) {fAdditionalChecks = additionalChecks;}
   Bool_t GetAdditionalChecks() const {return fAdditionalChecks;}
 
-  void FillArmPodDistribution(AliAODv0 *vZero, TString histoTitle, TList *histoList);
+  void FillArmPodDistribution(AliAODRecoDecay *vZero,TString histoTitle, Bool_t isCandidateSelectedCuts, Bool_t isBachelorID);
 
   void SetK0SAnalysis(Bool_t a) {fIsK0SAnalysis=a;}
   Bool_t GetK0SAnalysis() const {return fIsK0SAnalysis;}
@@ -75,6 +75,20 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
 
   Int_t MatchToMClabelC(AliAODRecoCascadeHF *candidate,TClonesArray *mcArray);
 
+
+  void SetNRotations(Int_t nRot=9) { fNRotations=nRot; }
+  Int_t GetNRotations() { return fNRotations; }
+
+  void SetPtMinToFillTheTree(Double_t pTmin=  0.) { fPtMinToFillTheTree=pTmin; }
+  void SetPtMaxToFillTheTree(Double_t pTmax=999.) { fPtMaxToFillTheTree=pTmax; }
+  Double_t GetPtMinToFillTheTree() { return fPtMinToFillTheTree; }
+  Double_t GetPtMaxToFillTheTree() { return fPtMaxToFillTheTree; }
+
+  void SetMinAngleForRot(Double_t min=5.*TMath::Pi()/6.) { fMinAngleForRot=min; }
+  void SetMaxAngleForRot(Double_t max=7.*TMath::Pi()/6.) { fMaxAngleForRot=max; }
+  Double_t GetMinAngleForRot() { return fMinAngleForRot; }
+  Double_t GetMaxAngleForRot() { return fMaxAngleForRot; }
+
  private:
   
   void CheckEventSelection(AliAODEvent *aodEvent);
@@ -92,7 +106,7 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
   void DefineGeneralHistograms();
   void DefineAnalysisHistograms();
   void DefineK0SHistos();
-  void FillAnalysisHistograms(AliAODRecoCascadeHF *part, Bool_t isBachelorID, TString appendthis);
+  void FillAnalysisHistograms(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TString appendthis);
   void TrackRotation(AliRDHFCutsLctoV0 *cutsAnal, AliAODRecoCascadeHF *part, TString appendthis);
 
   AliAnalysisTaskSELc2V0bachelor(const AliAnalysisTaskSELc2V0bachelor &source);
@@ -141,8 +155,10 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
   Double_t fMinMass;//=mLcPDG-0.250;
   Double_t fMaxMass;//=mLcPDG+0.250;
   Int_t fNRotations;//=9;
+  Double_t fPtMinToFillTheTree;//0.
+  Double_t fPtMaxToFillTheTree;//999.
 
-  ClassDef(AliAnalysisTaskSELc2V0bachelor,6); // class for Lc->p K0
+  ClassDef(AliAnalysisTaskSELc2V0bachelor,7); // class for Lc->p K0
 };
 
 #endif
index 98f731533e5fe244ac94e676bdbf04da85ae67f9..41ed717505c254377e9fbd9f5d3a69025659b29e 100644 (file)
@@ -188,7 +188,9 @@ AliAnalysisTaskSE(),
   fCurrentEvent(-1),
   fBField(0),
   fKeepingOnlyPYTHIABkg(kFALSE),
-  fHistoMCLcK0Sp(0x0)
+  fHistoMCLcK0SpGen(0x0),
+  fHistoMCLcK0SpGenAcc(0x0),
+  fHistoMCLcK0SpGenLimAcc(0x0)
 {
   //
   // Default ctor
@@ -309,7 +311,9 @@ AliAnalysisTaskSELc2V0bachelorTMVA::AliAnalysisTaskSELc2V0bachelorTMVA(const Cha
   fCurrentEvent(-1),
   fBField(0),
   fKeepingOnlyPYTHIABkg(kFALSE),
-  fHistoMCLcK0Sp(0x0)
+  fHistoMCLcK0SpGen(0x0),
+  fHistoMCLcK0SpGenAcc(0x0),
+  fHistoMCLcK0SpGenLimAcc(0x0)
 
 {
   //
@@ -419,7 +423,8 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::Terminate(Option_t*)
   }
 
   
-  AliDebug(2, Form("At MC level, %f Lc --> K0S + p were found", fHistoMCLcK0Sp->GetEntries()));
+  AliDebug(2, Form("At MC level, %f Lc --> K0S + p were found", fHistoMCLcK0SpGen->GetEntries()));
+  AliDebug(2, Form("At MC level, %f Lc --> K0S + p were found in the acceptance", fHistoMCLcK0SpGenAcc->GetEntries()));
 
   fOutputKF = dynamic_cast<TList*> (GetOutputData(6));
   if (!fOutputKF) {     
@@ -613,7 +618,9 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::UserCreateOutputObjects() {
 
   const Float_t ptbins[15] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 12., 17., 25., 35.};
 
-  fHistoMCLcK0Sp = new TH1F("fHistoMCLcK0Sp", "fHistoMCLcK0Sp", 14, ptbins);
+  fHistoMCLcK0SpGen = new TH1F("fHistoMCLcK0SpGen", "fHistoMCLcK0SpGen", 14, ptbins);
+  fHistoMCLcK0SpGenAcc = new TH1F("fHistoMCLcK0SpGenAcc", "fHistoMCLcK0SpGenAcc", 14, ptbins);
+  fHistoMCLcK0SpGenLimAcc = new TH1F("fHistoMCLcK0SpGenLimAcc", "fHistoMCLcK0SpGenLimAcc", 14, ptbins);
 
   fOutput->Add(fHistoEvents);
   fOutput->Add(fHistoLc);
@@ -624,7 +631,9 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::UserCreateOutputObjects() {
   fOutput->Add(fHistoCodesBkg);
   fOutput->Add(fHistoLcpKpiBeforeCuts);
   fOutput->Add(fHistoBackground);
-  fOutput->Add(fHistoMCLcK0Sp);
+  fOutput->Add(fHistoMCLcK0SpGen);
+  fOutput->Add(fHistoMCLcK0SpGenAcc);
+  fOutput->Add(fHistoMCLcK0SpGenLimAcc);
 
   PostData(1, fOutput);
   PostData(4, fVariablesTreeSgn);
@@ -875,7 +884,7 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::UserExec(Option_t *)
   AliAODMCHeader *mcHeader=0;
 
   if (fUseMCInfo) {
-    // MC array need for maching
+    // MC array need for matching
     mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
     if (!mcArray) {
       AliError("Could not find Monte-Carlo in AOD");
@@ -950,16 +959,20 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::FillMCHisto(TClonesArray *mcArray){
       AliDebug(2, Form("Step 1 ok: The MC particle has correct daughters!!"));
       AliAODMCParticle* daugh0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(labeldaugh0));
       AliAODMCParticle* daugh1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(labeldaugh1));
+      if(!daugh0 || !daugh1){
+       AliDebug(2,"Particle daughters not properly retrieved!");
+       return;
+      }
       Int_t pdgCodeDaugh0 = TMath::Abs(daugh0->GetPdgCode());
       Int_t pdgCodeDaugh1 = TMath::Abs(daugh1->GetPdgCode());
-      //      AliAODMCParticle* bachelorMC = daugh0;
+      AliAODMCParticle* bachelorMC = daugh0;
       AliAODMCParticle* v0MC = daugh1;
       AliDebug(2, Form("pdgCodeDaugh0 = %d, pdgCodeDaugh1 = %d", pdgCodeDaugh0, pdgCodeDaugh1));
       if ((pdgCodeDaugh0 == 311 && pdgCodeDaugh1 == 2212) || (pdgCodeDaugh0 == 2212 && pdgCodeDaugh1 == 311)){ 
        // we are in the case of Lc --> K0 + p; now we have to check if the K0 decays in K0S, and if this goes in pi+pi-
        /// first, we set the bachelor and the v0: above we assumed first proton and second V0, but we could have to change it:
        if (pdgCodeDaugh0 == 311 && pdgCodeDaugh1 == 2212) {
-         // bachelorMC = daugh1;
+         bachelorMC = daugh1;
          v0MC = daugh0;
        }
        AliDebug(2, Form("Number of Daughters of v0 = %d", v0MC->GetNDaughters()));
@@ -1002,7 +1015,13 @@ void AliAnalysisTaskSELc2V0bachelorTMVA::FillMCHisto(TClonesArray *mcArray){
                else { // Full chain: Lc --> K0 + p, K0 --> K0S, K0S --> pi+pi-
                  if (fAnalCuts->IsInFiducialAcceptance(mcPart->Pt(), mcPart->Y())) {
                    AliDebug(2, Form("----> Filling histo with pt = %f", mcPart->Pt()));
-                   fHistoMCLcK0Sp->Fill(mcPart->Pt());
+                   if(TMath::Abs(mcPart->Y()) < 0.5) fHistoMCLcK0SpGenLimAcc->Fill(mcPart->Pt());
+                   fHistoMCLcK0SpGen->Fill(mcPart->Pt());
+                   if(!(TMath::Abs(bachelorMC->Eta()) > 0.9 || bachelorMC->Pt() < 0.1 ||
+                        TMath::Abs(daughK0S0->Eta()) > 0.9 || daughK0S0->Pt() < 0.1 ||
+                        TMath::Abs(daughK0S1->Eta()) > 0.9 || daughK0S1->Pt() < 0.1)) {
+                     fHistoMCLcK0SpGenAcc->Fill(mcPart->Pt());
+                   }
                  }
                  else {
                    AliDebug(2, "not in fiducial acceptance! Skipping");
index 060730dc9cfcc8c3cc2cf90cac05d4b4d3a6c84d..c73a0e65493fb64ef5a937c5e645645e6a05e1db 100644 (file)
@@ -255,9 +255,11 @@ class AliAnalysisTaskSELc2V0bachelorTMVA : public AliAnalysisTaskSE
   Int_t fCurrentEvent;              // current event number - for debug purposes
   Double_t fBField;                   // magnetic field of current event
   Bool_t fKeepingOnlyPYTHIABkg;       // flag to allow to use only PYTHIA tracks for background
-  TH1F* fHistoMCLcK0Sp;               // histo with MC Lc --> K0S + p 
+  TH1F* fHistoMCLcK0SpGen;            // histo with MC Lc --> K0S + p
+  TH1F* fHistoMCLcK0SpGenAcc;         // histo with MC Lc --> K0S + p
+  TH1F* fHistoMCLcK0SpGenLimAcc;      // histo with MC Lc --> K0S + p
 
-  ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA, 5); // class for Lc->p K0
+  ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA, 6); // class for Lc->p K0
 };
 
 #endif
index 00996e1f9843c3267057ce46934177036c3126da..2832723aa26d40e20fa0310752b773fd0bbbba09 100644 (file)
@@ -134,7 +134,8 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF() :
   fIsPPbData(kFALSE),
   fUseAdditionalCuts(kFALSE),
   fUseCutsForTMVA(kFALSE),
-  fUseCascadeTaskForLctoV0bachelor(kFALSE)
+  fUseCascadeTaskForLctoV0bachelor(kFALSE),
+  fCutOnMomConservation(0.00001)
 {
   //
   //Default ctor
@@ -196,7 +197,8 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts
   fIsPPbData(kFALSE),
   fUseAdditionalCuts(kFALSE),
   fUseCutsForTMVA(kFALSE),
-  fUseCascadeTaskForLctoV0bachelor(kFALSE)
+  fUseCascadeTaskForLctoV0bachelor(kFALSE),
+  fCutOnMomConservation(0.00001)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
@@ -289,7 +291,8 @@ AliCFTaskVertexingHF::AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c) :
   fIsPPbData(c.fIsPPbData),
   fUseAdditionalCuts(c.fUseAdditionalCuts),
   fUseCutsForTMVA(c.fUseCutsForTMVA),
-  fUseCascadeTaskForLctoV0bachelor(c.fUseCascadeTaskForLctoV0bachelor)
+  fUseCascadeTaskForLctoV0bachelor(c.fUseCascadeTaskForLctoV0bachelor),
+  fCutOnMomConservation(c.fCutOnMomConservation)
 {
   //
   // Copy Constructor
@@ -651,6 +654,7 @@ void AliCFTaskVertexingHF::UserExec(Option_t *)
       ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughPositive(211);
       ((AliCFVertexingHFCascade*)cfVtxHF)->SetPDGneutrDaughNegative(211);
       ((AliCFVertexingHFCascade*)cfVtxHF)->SetPrimaryVertex(aodVtx);
+      ((AliCFVertexingHFCascade*)cfVtxHF)->SetCutOnMomConservation(fCutOnMomConservation);
       if (fUseAdditionalCuts) ((AliCFVertexingHFCascade*)cfVtxHF)->SetUseCutsForTMVA(fUseCutsForTMVA);
     }
     else {
index bc3e9b81748134479480eb496f025cf9f92f39d9..9f37e44c6e8ce3357f2348629bac7b8b1626a87f 100644 (file)
@@ -242,6 +242,9 @@ public:
        void SetUseCascadeTaskForLctoV0bachelor(Bool_t useCascadeTaskForLctoV0bachelor) {fUseCascadeTaskForLctoV0bachelor = useCascadeTaskForLctoV0bachelor;}
        Bool_t GetUseCascadeTaskForLctoV0bachelor() const {return fUseCascadeTaskForLctoV0bachelor;}
 
+       void SetCutOnMomConservation(Float_t cut) {fCutOnMomConservation = cut;}
+       Bool_t GetCutOnMomConservation() const {return fCutOnMomConservation;}
+
 protected:
        AliCFManager   *fCFManager;   //  pointer to the CF manager
        TH1I *fHistEventsProcessed;   //! simple histo for monitoring the number of events processed
@@ -299,8 +302,9 @@ protected:
        Bool_t fUseCutsForTMVA;     // flag to use additional cuts needed for Lc --> K0S + p, TMVA
                                    // these are the pre-selection cuts for the TMVA
        Bool_t fUseCascadeTaskForLctoV0bachelor;   // flag to define which task to use for Lc --> K0S+p
-   
-       ClassDef(AliCFTaskVertexingHF,22); // class for HF corrections as a function of many variables
+       Float_t fCutOnMomConservation; // cut on momentum conservation
+
+       ClassDef(AliCFTaskVertexingHF,23); // class for HF corrections as a function of many variables
 };
 
 #endif
index 8967385b854a5a449c096d9b7f262f4a126b97ce..75489e5d49dd0968dec22fa520dcb98df70edfc4 100644 (file)
@@ -47,7 +47,8 @@ AliCFVertexingHF(mcArray, originDselection),
   fPDGneutrDaughPositive(0),
   fPDGneutrDaughNegative(0),
   fPrimVtx(0x0),
-  fUseCutsForTMVA(kFALSE)
+  fUseCutsForTMVA(kFALSE),
+  fCutOnMomConservation(0.00001)
 {
   // standard constructor
 
@@ -502,9 +503,9 @@ Bool_t AliCFVertexingHFCascade::EvaluateIfCorrectNeutrDaugh(AliAODMCParticle* ne
   Double_t pzMother = neutralDaugh->Pz();
   AliDebug(3, Form("pxMother = %f, pyMother = %f, pzMother = %f", pxMother, pyMother, pzMother));
   AliDebug(3, Form("sumPxDau = %f, sumPyDau = %f, sumPzDau = %f", sumPxDau, sumPyDau, sumPzDau));
-  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
-     TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
-     TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
+  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>fCutOnMomConservation ||
+     TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>fCutOnMomConservation ||
+     TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>fCutOnMomConservation){
     AliDebug(2, "Momentum conservation violated, skipping!!");
     return isHadronic;  
   }
@@ -607,8 +608,11 @@ void AliCFVertexingHFCascade::SetAccCut()
       fPtAccCut[iP]=0.1;
       fEtaAccCut[iP]=0.9;
     }
-    fPtAccCut[2]=0.06;  // soft pion
-    fEtaAccCut[2]=0.9;  // soft pion
+
+    if (fPDGcascade != 4122){
+      fPtAccCut[2]=0.06;  // soft pion
+      fEtaAccCut[2]=0.9;  // soft pion
+    }
   }
   return;
 }
index f0bac2b51ef34e42cf80be66164842d9f66220b0..00f466fe829ed202aede61de63d7f0dfd7c8962d 100644 (file)
@@ -82,6 +82,9 @@ class AliCFVertexingHFCascade : public AliCFVertexingHF{
   void SetUseCutsForTMVA(Bool_t useCutsForTMVA) {fUseCutsForTMVA = useCutsForTMVA;}
   Bool_t GetUseCutsForTMVA() const {return fUseCutsForTMVA;}
 
+  void SetCutOnMomConservation(Float_t cut) {fCutOnMomConservation = cut;}
+  Bool_t GetCutOnMomConservation() const {return fCutOnMomConservation;}
+
  protected:
   
   
@@ -98,8 +101,9 @@ class AliCFVertexingHFCascade : public AliCFVertexingHF{
   AliAODVertex* fPrimVtx;        // primaryVertex
   Bool_t fUseCutsForTMVA;        // flag to decide whether to use or not the preselection
                                  // cuts of the TMVA when filling the CF
+  Float_t fCutOnMomConservation; // cut on momentum conservation
 
-  ClassDef(AliCFVertexingHFCascade, 3); // CF class for D* and other cascades
+  ClassDef(AliCFVertexingHFCascade,4); // CF class for D* and other cascades
   
 };
 
index a6a19d5c674c8cb86c98b5a2feb3ef947cc89eee..b896694770a5620ae627526da93177f221b98e4f 100644 (file)
@@ -52,7 +52,8 @@ AliRDHFCuts(name),
   fV0daughtersCuts(0),
   fV0Type(0),
   fHighPtCut(2.5),
-  fLowPtCut(1.0)
+  fLowPtCut(1.0),
+  fExcludedCut(-1)
 {
   //
   // Default Constructor
@@ -143,7 +144,8 @@ AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const AliRDHFCutsLctoV0 &source) :
   fV0daughtersCuts(0),
   fV0Type(source.fV0Type),
   fHighPtCut(source.fHighPtCut),
-  fLowPtCut(source.fLowPtCut)
+  fLowPtCut(source.fLowPtCut),
+  fExcludedCut(source.fExcludedCut)
   /*fV0channel(source.fV0channel)*/
 {
   //
@@ -360,6 +362,10 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
   }
 
   AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
+
+  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE  && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
+             (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
+
   AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
   if (!v0 || !bachelorTrack) {
     AliDebug(2,"No V0 or no bachelor for current cascade");
@@ -437,19 +443,19 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
     Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
 
     // cut on Lc mass with K0S+p hypothesis
-    if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) {
+    if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
       okLck0sp = kFALSE;
       AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
     }
 
     // cuts on the V0 mass: K0S case
-    if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)]) {
+    if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
       okK0spipi = kFALSE;
       AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
     }
 
     // cut on Lc mass with Lambda+pi hypothesis
-    if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)]) {
+    if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
       okLcLpi = kFALSE;
       okLcLBarpi = kFALSE;
       AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
@@ -457,38 +463,38 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
 
     // cuts on the V0 mass: Lambda/LambdaBar case
     //if ( !(bachelorTrack->Charge()==+1 && TMath::Abs(mlambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
-    if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] ) {
+    if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]  && fExcludedCut!=3) {
       okLppi = kFALSE;
       AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
     }
 
     //if ( !(bachelorTrack->Charge()==-1 && TMath::Abs(malambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
-    if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] ) {
+    if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]  && fExcludedCut!=3) {
       okLBarpip = kFALSE;
       AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
     }
 
     // cut on K0S invariant mass veto
-    if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)]) { // K0S invariant mass veto
+    if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
       AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
       //return 0;
       isNotK0S=kFALSE;
     }
 
     // cut on Lambda/LambdaBar invariant mass veto
-    if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) { // Lambda invariant mass veto
+    if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
       AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
       isNotLambda=kFALSE;
       //return 0;
     }
-    if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] ) { // LambdaBar invariant mass veto
+    if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
       AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
       isNotLambdaBar=kFALSE;
       //return 0;
     }
 
     // cut on gamma invariant mass veto
-    if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)]) { // K0S invariant mass veto
+    if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
       AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
       isNotGamma=kFALSE;
       //return 0;
@@ -501,51 +507,51 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
     if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
 
     // cuts on the minimum pt of the tracks
-    if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)]) {
+    if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
       AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
       return 0;
     }
-    if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)]) {
+    if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
       AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
       return 0;
     }
-    if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)]) {
+    if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
       AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
       return 0;
     }
 
     // cut on cascade dca (prong-to-prong)
-    if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] ) { // prong-to-prong cascade DCA
+    if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
       AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
       return 0;
     }
 
     // cut on V0 dca (prong-to-prong)
-    if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] ) { // prong-to-prong V0 DCA
+    if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
       AliDebug(4,Form(" V0 DCA don't pass the cut"));
       return 0;
     }
 
     // cut on V0 cosine of pointing angle wrt PV
-    if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(9,ptbin)]) { // cosine of V0 pointing angle wrt primary vertex
+    if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
       AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
       return 0;
     }
 
     // cut on bachelor transverse impact parameter wrt PV
-    if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)]) { // bachelor transverse impact parameter wrt PV
+    if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
       AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
       return 0;
     }
 
     // cut on V0 transverse impact parameter wrt PV
-    if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)]) { // V0 transverse impact parameter wrt PV
+    if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
       AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
       return 0;
     }
 
     // cut on V0 pT min
-    if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)]) { // V0 pT min
+    if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
       AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
       return 0;
     }
@@ -595,6 +601,10 @@ Int_t AliRDHFCutsLctoV0::IsSelectedPID(AliAODRecoDecayHF* obj) {
 
   AliAODRecoCascadeHF *objD = (AliAODRecoCascadeHF*)obj;
 
+  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(objD->Getv0());
+  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE  && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
+             (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
+
   AliAODTrack *bachelor = (AliAODTrack*)objD->GetBachelor();
   AliAODTrack *v0Pos = (AliAODTrack*)objD->Getv0PositiveTrack();
   AliAODTrack *v0Neg = (AliAODTrack*)objD->Getv0NegativeTrack();
@@ -814,6 +824,9 @@ Int_t AliRDHFCutsLctoV0::IsSelectedSingleCut(TObject* obj, Int_t selectionLevel,
   }
 
   AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
+  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE  && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
+             (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
+
   AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
   if (!v0 || !bachelorTrack) {
     AliDebug(2,"No V0 or no bachelor for current cascade");
@@ -1377,3 +1390,4 @@ Bool_t AliRDHFCutsLctoV0::AreLctoV0DaughtersSelected(AliAODRecoDecayHF *dd) cons
   return kTRUE;
 
 }
+
index 52db13b7f61416bef56d62b8b518804d06a76fb7..4c3925b7ba3684401be0986fb2e40c66d5ffc013 100644 (file)
@@ -67,6 +67,9 @@ class AliRDHFCutsLctoV0 : public AliRDHFCuts
   void SetLowPtCut(Float_t lowPtCut) {fLowPtCut=lowPtCut;};
   Float_t GetLowPtCut() const {return fLowPtCut;};
 
+  void SetExcludedCut(Int_t excludedCut) {fExcludedCut=excludedCut;}
+  Int_t GetExcludedCut(){return fExcludedCut;}
+
   virtual void SetStandardCutsPP2010();
   virtual void SetStandardCutsPbPb2010();
   virtual void SetStandardCutsPbPb2011();
@@ -90,10 +93,11 @@ class AliRDHFCutsLctoV0 : public AliRDHFCuts
   Float_t     fV0Type; // V0 type -- should be defined as in AliRDHFCuts.h
   Float_t fHighPtCut;  // high pT cut separation for proton identification
   Float_t fLowPtCut;   // low pT cut separation for proton identification
+  Int_t   fExcludedCut; // cut to be excluded (-1=none)
 
   //UShort_t fV0channel;
 
-  ClassDef(AliRDHFCutsLctoV0,5);  // class for cuts on AOD reconstructed Lc->V0+bachelor
+  ClassDef(AliRDHFCutsLctoV0,6);  // class for cuts on AOD reconstructed Lc->V0+bachelor
 };
 
 #endif
index 1d5e311b3e398daa66f183f5577bdaa2d5460427..fe68f6b3f206bcfe0d3c4fa5c15af41582b89652 100644 (file)
@@ -539,7 +539,6 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelorTMVA(const char* cutFile
   task->SetCFManager(man); //here is set the CF manager
   task->SetDecayChannel(22);
   task->SetUseCascadeTaskForLctoV0bachelor(kTRUE);
-  task->SetUseAdditionalCuts(kFALSE);
   task->SetUseAdditionalCuts(kTRUE);
   task->SetUseCutsForTMVA(kFALSE);
   task->SetUseFlatPtWeight(useFlatPtWeight); 
@@ -552,6 +551,7 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelorTMVA(const char* cutFile
   task->SetRejectCandidateIfNotFromQuark(kFALSE); // put to false if you want to keep HIJING D0!!
   task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
   //task->SetPtWeightsFromDataPbPb276overLHC12a17a();
+  task->SetCutOnMomConservation(0.0000005);
 
   if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
   if (isKeepDfromB && isKeepDfromBOnly) task->SetDselection(1);        
index 26411a3d86a4f067087d3807030c0ae4996a24b8..22c57ec46cbfe92f26dfa01ee476c291aceaad1a 100644 (file)
@@ -4,8 +4,12 @@ AliAnalysisTaskSELc2V0bachelor *AddTaskLc2V0bachelor(TString finname="Lc2V0bache
                                                     Bool_t writeVariableTree=kTRUE,
                                                     Int_t nTour=0,
                                                     Bool_t additionalChecks=kFALSE,
-                                                    Bool_t trackRotation=kFALSE)
-
+                                                    Bool_t trackRotation=kFALSE,
+                                                    Int_t nRot=9,
+                                                    Double_t pTmin=0.,
+                                                    Double_t pTmax=999.,
+                                                    Double_t minRotAngle=5.*TMath::Pi()/6.,
+                                                    Double_t maxRotAngle=7.*TMath::Pi()/6.)
 {
 
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -14,6 +18,9 @@ AliAnalysisTaskSELc2V0bachelor *AddTaskLc2V0bachelor(TString finname="Lc2V0bache
     return NULL;
   }  
   
+  if (writeVariableTree && trackRotation)
+    trackRotation=kFALSE;
+
   // cuts are stored in a TFile generated by makeTFile4CutsLc2V0bachelor.C in ./macros/
   // set there the cuts!!!!!
 
@@ -52,6 +59,11 @@ AliAnalysisTaskSELc2V0bachelor *AddTaskLc2V0bachelor(TString finname="Lc2V0bache
   task->SetMC(theMCon);
   task->SetK0SAnalysis(kTRUE);
   task->SetDebugLevel(0);
+  task->SetNRotations(nRot);
+  task->SetPtMinToFillTheTree(pTmin);
+  task->SetPtMaxToFillTheTree(pTmax);
+  task->SetMinAngleForRot(minRotAngle);
+  task->SetMaxAngleForRot(maxRotAngle);
   mgr->AddTask(task);
 
   // Create and connect containers for input/output  
index 34b513f9920679956ab8fab554a0a0ad97cd802f..4201d0905076cf2daf885435b45a37219fd57d3c 100644 (file)
@@ -274,7 +274,7 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
                                       // 2 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else (p>=2.5) {if (TOF) -2s<TOF<3s AND TPC@3s}
                                       // 3 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else if (2.5<=p<3) {if (TOF) -2s<TOF<3s AND TPC@3s} else (p>=3) {if (TOF) -2s<TOF<3s AND -3s<TPC<2s}
 
-  const Int_t nvars=14;
+  const Int_t nvars=14;//17-3
 
   const Int_t nptbins=9;
   Float_t* ptbins;
@@ -319,7 +319,7 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
     cutsMatrixLctoV0Stand[ic]=new Float_t[nptbins];
   for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
     cutsMatrixLctoV0Stand[0][ipt2] =0.0075;
-    cutsMatrixLctoV0Stand[1][ipt2] =0.0030;
+    cutsMatrixLctoV0Stand[1][ipt2] =0.0500;
     cutsMatrixLctoV0Stand[2][ipt2] =0.4;
     cutsMatrixLctoV0Stand[3][ipt2] =0.2;
     cutsMatrixLctoV0Stand[4][ipt2] =0.2;
@@ -332,16 +332,15 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
     cutsMatrixLctoV0Stand[11][ipt2] =0.005;
     cutsMatrixLctoV0Stand[12][ipt2] =0.100;
   }
-  cutsMatrixLctoV0Stand[0][13]=0.0; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[1][13]=0.6; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[2][13]=0.8; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[3][13]=0.8; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[4][13]=0.8; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[5][13]=1.0; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[6][13]=1.0; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[7][13]=1.0; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[8][13]=0.0; // pT min V0 track [GeV/c]
-  cutsMatrixLctoV0Stand[9][13]=0.0; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][0]=0.0; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][1]=0.6; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][2]=0.8; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][3]=0.8; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][4]=0.8; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][5]=1.0; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][6]=1.0; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][7]=1.0; // pT min V0 track [GeV/c]
+  cutsMatrixLctoV0Stand[13][8]=0.0; // pT min V0 track [GeV/c]
 
 
   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
@@ -431,7 +430,6 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
   tighterval[6][13]=1.0; // pT min V0 track [GeV/c]
   tighterval[7][13]=1.0; // pT min V0 track [GeV/c]
   tighterval[8][13]=0.0; // pT min V0 track [GeV/c]
-  tighterval[9][13]=0.0; // pT min V0 track [GeV/c]
 
   TString name=""; 
   Int_t arrdim=dim*nptbins;
index dbbc190480a8bf0175e1453b757861152a4b87f2..3a5948324b10f0ccbc51ee96725e5108b8a72664 100644 (file)
@@ -45,6 +45,7 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt() :
   fEmbCaloClustersCont(0),
   fRandTracksCont(0),
   fRandCaloClustersCont(0),
+  fHistRhovsCent(0),
   fHistRCPhiEta(0), 
   fHistRCPt(0),
   fHistRCPtExLJ(0),
@@ -114,6 +115,7 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt(const char *name) :
   fEmbCaloClustersCont(0),
   fRandTracksCont(0),
   fRandCaloClustersCont(0),
+  fHistRhovsCent(0),
   fHistRCPhiEta(0), 
   fHistRCPt(0),
   fHistRCPtExLJ(0),
@@ -219,6 +221,11 @@ void AliAnalysisTaskDeltaPt::UserCreateOutputObjects()
 
   AllocateHistogramArrays();
 
+  fHistRhovsCent = new TH2F("fHistRhovsCent", "fHistRhovsCent", 101, -1,  100, fNbins, 0, fMaxBinPt*2);
+  fHistRhovsCent->GetXaxis()->SetTitle("Centrality (%)");
+  fHistRhovsCent->GetYaxis()->SetTitle("#rho (GeV/c * rad^{-1})");
+  fOutput->Add(fHistRhovsCent);
+
   fJetsCont = GetJetContainer("Jets");
   fTracksCont = GetParticleContainer("Tracks");
   fCaloClustersCont = GetClusterContainer("CaloClusters");
@@ -432,6 +439,8 @@ Bool_t AliAnalysisTaskDeltaPt::FillHistograms()
 {
   // Fill histograms.
 
+  fHistRhovsCent->Fill(fCent, fRhoVal);
+
   // ************
   // Random cones
   // _________________________________
index 33502b197307b3e908c662f8b3f7c7687cbbd1bb..5172d15365f0df3e6c8270e3d57cbbee6e936980 100644 (file)
@@ -63,6 +63,9 @@ class AliAnalysisTaskDeltaPt : public AliAnalysisTaskEmcalJet {
   AliParticleContainer       *fRandTracksCont;             //!Randomized tracks
   AliClusterContainer        *fRandCaloClustersCont;       //!Randomized clusters
 
+  // General
+  TH2                        *fHistRhovsCent;              //!Rho vs. centrality
+
   // Random cones
   TH2                        *fHistRCPhiEta;               //!Phi-Eta distribution of random cones
   TH1                       **fHistRCPt;                   //!Random cone pt
index 587dbbb1b8716a902d34ed47fb364c81447c30ed..31655a5c949f34a30fc5af6a3f7e17d78bf22fe4 100644 (file)
@@ -697,14 +697,6 @@ Bool_t AliEmcalJetTask::DoInit()
     return 0;
   }
 
-  // add jets to event if not yet there
-  if (!(fEvent->FindListObject(fJetsName)))
-    fEvent->AddObject(fJets);
-  else {
-    AliError(Form("%s: Object with name %s already in event! Returning", GetName(), fJetsName.Data()));
-    return 0;
-  }
-
   if (!(fEvent->FindListObject(fJetsSubName)) && fJetsSub)
     fEvent->AddObject(fJetsSub);
 
@@ -752,6 +744,14 @@ Bool_t AliEmcalJetTask::DoInit()
       return 0;
     }
   }
+
+  // add jets to event if not yet there
+  if (!(fEvent->FindListObject(fJetsName)))
+    fEvent->AddObject(fJets);
+  else {
+    AliError(Form("%s: Object with name %s already in event! Returning", GetName(), fJetsName.Data()));
+    return 0;
+  }
   
   return 1;
 }
index cb56c9fca74058dfaa7b605127498e26b1660c1c..3394d7e0bba7ebb9cdf9e45771e2409b97b476be 100644 (file)
@@ -232,7 +232,7 @@ AliEmcalJet* AliJetContainer::GetJet(Int_t i) const {
 }
 
 //________________________________________________________________________
-AliEmcalJet* AliJetContainer::GetAcceptJet(Int_t i) const {
+AliEmcalJet* AliJetContainer::GetAcceptJet(Int_t i) {
 
   //Only return jet if is accepted
 
@@ -252,7 +252,7 @@ AliEmcalJet* AliJetContainer::GetJetWithLabel(Int_t lab) const {
 }
 
 //________________________________________________________________________
-AliEmcalJet* AliJetContainer::GetAcceptJetWithLabel(Int_t lab) const {
+AliEmcalJet* AliJetContainer::GetAcceptJetWithLabel(Int_t lab) {
 
   //Get particle with label lab in array
   
@@ -333,83 +333,107 @@ Bool_t AliJetContainer::AcceptBiasJet(AliEmcalJet *jet) const
   }
 
   return kTRUE;
-
-
 }
 
 //________________________________________________________________________
-Bool_t AliJetContainer::AcceptJet(AliEmcalJet *jet) const
+Bool_t AliJetContainer::AcceptJet(AliEmcalJet *jet)
 {   
-
    // Return true if jet is accepted.
 
+  fRejectionReason = 0;
+
   if (!jet) {
     AliDebug(11,"No jet found");
+    fRejectionReason |= kNullObject;
     return kFALSE;
   }
 
-  if (jet->TestBits(fJetBitMap) != (Int_t)fJetBitMap) {
-    AliDebug(11,"Cut rejecting jet: Bit map");
+  if (jet->Pt() <= fJetPtCut) {
+    AliDebug(11,Form("Cut rejecting jet: JetPtCut %.1f",fJetPtCut));
+    fRejectionReason |= kPtCut;
     return kFALSE;
   }
 
-  if (jet->Pt() <= fJetPtCut) {
-    AliDebug(11,"Cut rejecting jet: JetPtCut");
+  Double_t jetPhi = jet->Phi();
+  Double_t jetEta = jet->Eta();
+   
+  // if limits are given in (-pi, pi) range
+  if (fJetMinPhi < 0) jetPhi -= TMath::Pi() * 2;
+   
+  if (jetEta < fJetMinEta || jetEta > fJetMaxEta || jetPhi < fJetMinPhi || jetPhi > fJetMaxPhi) {
+    AliDebug(11,"Cut rejecting jet: Acceptance");
+    fRejectionReason |= kAcceptanceCut;
+    return kFALSE;
+  }
+
+  if (jet->TestBits(fJetBitMap) != (Int_t)fJetBitMap) {
+    AliDebug(11,"Cut rejecting jet: Bit map");
+    fRejectionReason |= kBitMapCut;
     return kFALSE;
   }
 
   if (jet->Area() <= fJetAreaCut)  {
     AliDebug(11,"Cut rejecting jet: Area");
+    fRejectionReason |= kAreaCut;
     return kFALSE;
   }
 
   if (jet->AreaEmc() < fAreaEmcCut) {
     AliDebug(11,"Cut rejecting jet: AreaEmc");
+    fRejectionReason |= kAreaEmcCut;
     return kFALSE;
   }
    
   if (fZLeadingChCut < 1 && GetZLeadingCharged(jet) > fZLeadingChCut) {
     AliDebug(11,"Cut rejecting jet: ZLeading");
+    fRejectionReason |= kZLeadingChCut;
     return kFALSE;
   }
    
   if (fZLeadingEmcCut < 1 && GetZLeadingEmc(jet) > fZLeadingEmcCut) {
     AliDebug(11,"Cut rejecting jet: ZLeadEmc");
+    fRejectionReason |= kZLeadingEmcCut;
     return kFALSE;
   }
 
   if (jet->NEF() < fNEFMinCut || jet->NEF() > fNEFMaxCut) {
     AliDebug(11,"Cut rejecting jet: NEF");
+    fRejectionReason |= kNEFCut;
     return kFALSE;
   }
    
   if (!AcceptBiasJet(jet)) {
     AliDebug(11,"Cut rejecting jet: Bias");
+    fRejectionReason |= kMinLeadPtCut;
+    return kFALSE;
+  }
+
+  if (jet->MaxTrackPt() > fMaxTrackPt) {
+    AliDebug(11,"Cut rejecting jet: MaxTrackPt");
+    fRejectionReason |= kMaxTrackPtCut;
     return kFALSE;
+
   }
 
-  if (jet->MaxTrackPt() > fMaxTrackPt || jet->MaxClusterPt() > fMaxClusterPt) {
-    AliDebug(11,"Cut rejecting jet: MaxTrClPt");
+  if (jet->MaxClusterPt() > fMaxClusterPt) {
+    AliDebug(11,"Cut rejecting jet: MaxClusPt");
+    fRejectionReason |= kMaxClusterPtCut;
     return kFALSE;
   }
    
   if (fFlavourSelection != 0 && !jet->TestFlavourTag(fFlavourSelection)) {
     AliDebug(11,"Cut rejecting jet: Flavour");
+    fRejectionReason |= kFlavourCut;
     return kFALSE;
   }
    
   if(fTagStatus>-1 && jet->GetTagStatus()!=fTagStatus) {
     AliDebug(11,"Cut rejecting jet: tag status");
+    fRejectionReason |= kTagStatus;
     return kFALSE;
   }
-   
-   Double_t jetPhi = jet->Phi();
-   Double_t jetEta = jet->Eta();
-   
-   if (fJetMinPhi < 0) // if limits are given in (-pi, pi) range
-      jetPhi -= TMath::Pi() * 2;
-   
-   return (Bool_t)(jetEta > fJetMinEta && jetEta < fJetMaxEta && jetPhi > fJetMinPhi && jetPhi < fJetMaxPhi);
+
+  return kTRUE;
 }
 
 //________________________________________________________________________
@@ -529,7 +553,6 @@ void AliJetContainer::SetJetEtaPhiEMCAL()
       SetJetPhiLimits(1.405+fJetRadius,3.135-fJetRadius);
     else
       SetJetPhiLimits(fGeom->GetArm1PhiMin() * TMath::DegToRad() + fJetRadius, fGeom->GetArm1PhiMax() * TMath::DegToRad() - fJetRadius);
-
   }
   else {
     AliWarning("Could not get instance of AliEMCALGeometry. Using manual settings for EMCAL year 2011!!");
index 62eb137a51e8cc7209b900a71bb49dc4aeccaca1..c7f08f289ef3d170fb076d13ce7663b439d11def 100644 (file)
@@ -76,13 +76,13 @@ class AliJetContainer : public AliEmcalContainer {
 
   AliEmcalJet                *GetLeadingJet(const char* opt="")          ;
   AliEmcalJet                *GetJet(Int_t i)                       const;
-  AliEmcalJet                *GetAcceptJet(Int_t i)                 const;
+  AliEmcalJet                *GetAcceptJet(Int_t i)                      ;
   AliEmcalJet                *GetJetWithLabel(Int_t lab)            const;
-  AliEmcalJet                *GetAcceptJetWithLabel(Int_t lab)      const;
+  AliEmcalJet                *GetAcceptJetWithLabel(Int_t lab)           ;
   AliEmcalJet                *GetNextAcceptJet(Int_t i=-1)               ;
   AliEmcalJet                *GetNextJet(Int_t i=-1)                     ;
   void                        GetMomentum(TLorentzVector &mom, Int_t i) const;
-  Bool_t                      AcceptJet(AliEmcalJet* jet)           const;
+  Bool_t                      AcceptJet(AliEmcalJet* jet)                ;
   Bool_t                      AcceptBiasJet(AliEmcalJet* jet)       const;
   Int_t                       GetFlavourCut()                       const    {return fFlavourSelection;}
   Int_t                       GetNJets()                            const    {return GetNEntries();}
@@ -108,6 +108,7 @@ class AliJetContainer : public AliEmcalContainer {
   Float_t                     GetJetEtaMax()                        const    {return fJetMaxEta;}
   Float_t                     GetJetPhiMin()                        const    {return fJetMinPhi;}
   Float_t                     GetJetPhiMax()                        const    {return fJetMaxPhi;}
+  Float_t                     GetJetPtCut()                         const    {return fJetPtCut;}
   void                        SetClassName(const char *clname);
   void                        SetArray(AliVEvent *event);
   AliParticleContainer       *GetParticleContainer()                         {return fParticleContainer;}
@@ -156,7 +157,7 @@ class AliJetContainer : public AliEmcalContainer {
   AliJetContainer(const AliJetContainer& obj); // copy constructor
   AliJetContainer& operator=(const AliJetContainer& other); // assignment
 
-  ClassDef(AliJetContainer,9);
+  ClassDef(AliJetContainer,10);
 
 };
 
index 31dea7c22fe7f0c6ccef465d7367fb6aa8520186..72bfedfd551d7f32f90ea4129f039db4e6f856ff 100644 (file)
@@ -27,11 +27,11 @@ class AliJetModelBaseTask : public AliAnalysisTaskSE {
   void                   SetEtaRange(Float_t min, Float_t max) { fEtaMin       = min;  fEtaMax = max; }
   void                   SetPhiRange(Float_t min, Float_t max) { fPhiMin       = min;  fPhiMax = max; }
   void                   SetPtRange(Float_t min, Float_t max)  { fPtMin        = min;  fPtMax  = max; }
-  void                   SetPtSpectrum(TH1 *f)                 { fPtSpectrum   = f;    }
+  void                   SetPtSpectrum(TH1F *f)                { fPtSpectrum   = f;    }
   void                   SetPtSpectrum(TF1 *f)                 { fPtSpectrum   = new TH1F("ptSpectrum","ptSpectrum",1000,f->GetXmin(),f->GetXmax()); 
                                                                  fPtSpectrum->Add(f); }
   void                   SetPtPhiEvPlDistribution(TF2 *f)      { fPtPhiEvPlDistribution   = f;    }
-  void                   SetDensitySpectrum(TH1 *f)            { fDensitySpectrum = f;    }
+  void                   SetDensitySpectrum(TH1F *f)           { fDensitySpectrum = f;    }
   void                   SetDensitySpectrum(TF1 *f)            { fDensitySpectrum = new TH1F("densitypectrum","densitypectrum",1000,f->GetXmin(),f->GetXmax()); 
                                                                  fDensitySpectrum->Add(f); }
   void                   SetDifferentialV2(TF1* f)             { fDifferentialV2 = f;  }
@@ -100,9 +100,9 @@ class AliJetModelBaseTask : public AliAnalysisTaskSE {
   Int_t                  fNCells;                 // how many cells are being processed
   Int_t                  fNTracks;                // how many tracks are being processed
   Int_t                  fMarkMC;                 // which MC label is to be used (default=100)
-  TH1                   *fPtSpectrum;             // pt spectrum to extract random pt values
+  TH1F                  *fPtSpectrum;             // pt spectrum to extract random pt values
   TF2                   *fPtPhiEvPlDistribution;  // pt vs. (phi-psi) distribution to extract random pt/phi values
-  TH1                   *fDensitySpectrum;        // particle density spectrum to extract random density values
+  TH1F                  *fDensitySpectrum;        // particle density spectrum to extract random density values
   TF1                   *fDifferentialV2;         // v2 as function of pt
   Bool_t                 fAddV2;                  // add v2 sampled from a tf1
   Bool_t                 fFlowFluctuations;       // introduce gaussian flow fluctuation 
@@ -131,6 +131,6 @@ class AliJetModelBaseTask : public AliAnalysisTaskSE {
   AliJetModelBaseTask(const AliJetModelBaseTask&);            // not implemented
   AliJetModelBaseTask &operator=(const AliJetModelBaseTask&); // not implemented
 
-  ClassDef(AliJetModelBaseTask, 11) // Jet modelling task
+  ClassDef(AliJetModelBaseTask, 12) // Jet modelling task
 };
 #endif
index 23cc9eaeff4f28972a77354b195ce958eae6aa90..b8731048df988fe2dc7cac64baeec3d584b56f62 100644 (file)
@@ -39,6 +39,8 @@ AliJetResponseMaker::AliJetResponseMaker() :
   fZAxis(0),
   fIsJet1Rho(kFALSE),
   fIsJet2Rho(kFALSE),
+  fHistRejectionReason1(0),
+  fHistRejectionReason2(0),
   fHistJets1(0),
   fHistJets2(0),
   fHistMatching(0),
@@ -118,6 +120,8 @@ AliJetResponseMaker::AliJetResponseMaker(const char *name) :
   fZAxis(0),
   fIsJet1Rho(kFALSE),
   fIsJet2Rho(kFALSE),
+  fHistRejectionReason1(0),
+  fHistRejectionReason2(0),
   fHistJets1(0),
   fHistJets2(0),
   fHistMatching(0),
@@ -854,6 +858,20 @@ void AliJetResponseMaker::UserCreateOutputObjects()
   if (jets2->GetRhoName().IsNull()) fIsJet2Rho = kFALSE;
   else fIsJet2Rho = kTRUE;
 
+  fHistRejectionReason1 = new TH2F("fHistRejectionReason1", "fHistRejectionReason1", 32, 0, 32, 100, 0, 250);
+  fHistRejectionReason1->GetXaxis()->SetTitle("Rejection reason");
+  fHistRejectionReason1->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
+  fHistRejectionReason1->GetZaxis()->SetTitle("counts");
+  SetRejectionReasonLabels(fHistRejectionReason1->GetXaxis());
+  fOutput->Add(fHistRejectionReason1);
+
+  fHistRejectionReason2 = new TH2F("fHistRejectionReason2", "fHistRejectionReason2", 32, 0, 32, 100, 0, 250);
+  fHistRejectionReason2->GetXaxis()->SetTitle("Rejection reason");
+  fHistRejectionReason2->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
+  fHistRejectionReason2->GetZaxis()->SetTitle("counts");
+  SetRejectionReasonLabels(fHistRejectionReason2->GetXaxis());
+  fOutput->Add(fHistRejectionReason2);
+
   if (fHistoType==0)
     AllocateTH2();
   else 
@@ -1617,12 +1635,16 @@ Bool_t AliJetResponseMaker::FillHistograms()
 
     AliDebug(2,Form("Processing jet (2) %d", jets2->GetCurrentID()));
 
+    if (jet2->Pt() < jets2->GetJetPtCut()) continue;
+
     Double_t ptLeading2 = jets2->GetLeadingHadronPt(jet2);
     Double_t corrpt2 = jet2->Pt() - jets2->GetRhoVal() * jet2->Area();
 
     if (jets2->AcceptJet(jet2))
       FillJetHisto(jet2->Phi(), jet2->Eta(), jet2->Pt(), jet2->Area(), jet2->NEF(), ptLeading2, 
                   corrpt2, jet2->MCPt(), 2);
+    else
+      fHistRejectionReason2->Fill(jets2->GetRejectionReasonBitPosition(), jet2->Pt());
 
     jet1 = jet2->MatchedJet();
 
@@ -1655,7 +1677,11 @@ Bool_t AliJetResponseMaker::FillHistograms()
   }
 
   jets1->ResetCurrentID();
-  while ((jet1 = jets1->GetNextAcceptJet())) {
+  while ((jet1 = jets1->GetNextJet())) {
+    if (!jets1->AcceptJet(jet1)) {
+      fHistRejectionReason1->Fill(jets1->GetRejectionReasonBitPosition(), jet1->Pt());
+      continue;
+    }
     if (jet1->MCPt() < fMinJetMCPt) continue;
     AliDebug(2,Form("Processing jet (1) %d", jets1->GetCurrentID()));
 
index 9325908b61c4017ce7016cfe00917e8a0c4096c2..031c77fe642a7795bc2ebafb45ddc7790e098c0c 100644 (file)
@@ -67,6 +67,9 @@ class AliJetResponseMaker : public AliAnalysisTaskEmcalJet {
   Bool_t                      fIsJet1Rho;                              //!whether the jet1 collection has to be average subtracted
   Bool_t                      fIsJet2Rho;                              //!whether the jet2 collection has to be average subtracted
 
+  TH2                        *fHistRejectionReason1;                   //!Rejection reason vs. jet pt
+  TH2                        *fHistRejectionReason2;                   //!Rejection reason vs. jet pt
+
   // THnSparse
   THnSparse                  *fHistJets1;                              //!jet1 THnSparse
   THnSparse                  *fHistJets2;                              //!jet2 THnSparse
index 511e31eb671d35bc9dc0133fc5e0a73ca1c34d01..719c33db5cd2af406cf2b9d020a0939ebf80b75b 100644 (file)
@@ -16,7 +16,6 @@
 // Analysis task for Dijet-hadron correlations
 //
 // Author: T.Kobayashi
-// I refer to macro written by S.Aiola.
 #include <TH1F.h>
 #include <TH2F.h>
 #include <TH3F.h>
@@ -78,200 +77,128 @@ const Double_t pi = TMath::Pi();
 ClassImp(AliAnalysisTaskDijetHadron)
 
 //________________________________________________________________________
-  AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron() : 
-    AliAnalysisTaskEmcalJet("AliAnalysisTaskDijetHadron", kTRUE),
-    fMCJetPtThreshold(1),
-    fMinRC2LJ(-1),
-    fRCperEvent(-1),
-    //fPtHardBinName(0x0),
-    //fPtHardBin(-1),
-    //fhPtHardBins(0x0),
-    fConeRadius(0.2),
-    fConeMinEta(-0.9),
-    fConeMaxEta(0.9),
-    fConeMinPhi(0),
-    fConeMaxPhi(TMath::Pi()*2),
-    fJetsCont(0),
-    fTracksCont(0),
-    fCaloClustersCont(0),
-    fMCJetsCont(0),
-    fMCTracksCont(0),
-    fMCCaloClustersCont(0),
-    fEmbJetsCont(0),
-    fEmbTracksCont(0),
-    fEmbCaloClustersCont(0),
-    //fRandTracksCont(0),
-    //fRandCaloClustersCont(0),
-    fHistRCPhiEta(0), 
-    fHistRCPt(0),
-    fHistRCPtExLJ(0),
-    fHistRCPtExPartialLJ(0), 
-    //fHistRCPtRand(0),
-    fHistRhoVSRCPt(0),
-    fHistDeltaPtRCvsEP(0),
-    fHistDeltaPtRCExLJ(0),
-    fHistDeltaPtRCExPartialLJ(0),
-    //fHistDeltaPtRCRand(0),
-    fHistEmbJetsPtArea(0),
-    fHistEmbJetsCorrPtArea(0),
-    fHistEmbPartPtvsJetPt(0),
-    fHistEmbPartPtvsJetCorrPt(0),
-    fHistJetPtvsJetCorrPt(0),
-    fHistDistLeadPart2JetAxis(0),
-    fHistEmbBkgArea(0),
-    fHistRhoVSEmbBkg(0),
-    fHistDeltaPtEmbArea(0),
-    fHistDeltaPtEmbvsEP(0),
-    fHistRCPtExLJVSDPhiLJ(0),
-    fHistRCPtExPartialLJVSDPhiLJ(0),
-    fHistEmbJetsPhiEta(0),
-    fHistLeadPartPhiEta(0),
-    fCent_V0(0),
-    fVertex_z_cut(0),
-    fJetBG_rho(0),
-    fJetBG_rho_Cent(0),
-    fTrackPt_PbPb(0),
-    fTrackPhi_PbPb(0),
-    fTrackEta_PbPb(0),
-    fTrack_Phi_Eta_PbPb(0),
-    fTrackPt_MC(0),
-    fTrackPhi_MC(0),
-    fTrackEta_MC(0),
-    fTrack_Phi_Eta_MC(0),
-    fTrackPt_EMB(0),
-    fTrackPhi_EMB(0),
-    fTrackEta_EMB(0),
-    fTrack_Phi_Eta_EMB(0),
-    fJetPt_PbPb(),
-    fJetPhi_PbPb(),
-    fJetEta_PbPb(),
-    fJet_Phi_Eta_PbPb(),
-    fJetPt_BG_PbPb(),
-    fJet1Pt_PbPb(),
-    fJet2Pt_PbPb(),
-    fJet1Pt_BG_PbPb(),
-    fJet2Pt_BG_PbPb(),
-    fJetDeltaPhi_PbPb(),
-    fJetDeltaEta_PbPb(),
-    fJetDeltaEP_PbPb(),
-    fJet1SelectPt_BG_PbPb(),
-    fJet2SelectPt_BG_PbPb(),
-    fAj_PbPb(),
-    fJetPt_MC(),
-    fJetPhi_MC(),
-    fJetEta_MC(),
-    fJet_Phi_Eta_MC(),
-    fJet1Pt_MC(),
-    fJet2Pt_MC(),
-    fJetDeltaPhi_MC(),
-    fJetDeltaEta_MC(),
-    fJetDeltaEP_MC(),
-    fAj_MC(),
-    fJetPt_EMB(),
-    fJetPhi_EMB(),
-    fJetEta_EMB(),
-    fJet_Phi_Eta_EMB(),
-    fJetPt_BG_EMB(),
-    fJetDeltaPt(),
-    fJet1Pt_EMB(),
-    fJet2Pt_EMB(),
-    fJet1Pt_BG_EMB(),
-    fJet2Pt_BG_EMB(),
-    fJet1DeltaPt(),
-    fJet2DeltaPt(),
-    fJetDeltaPhi_EMB(),
-    fJetDeltaEta_EMB(),
-    fJetDeltaEP_EMB(),
-    fJet1SelectPt_BG_EMB(),
-    fJet2SelectPt_BG_EMB(),
-    fJet1SelectDeltaPt(),
-    fJet2SelectDeltaPt(),
-    fAj_EMB(),
-    fHJetDeltaPhi_Aj0_PbPb(),
-    fHJetDeltaPhi_Aj1_PbPb(),
-    fHJetDeltaPhi_Aj2_PbPb(),
-    fHJetDeltaPhi_Aj3_PbPb(),
-    fHJetDeltaPhi_Aj4_PbPb(),
-    fHJetPt_Aj0_PbPb(),
-    fHJetPt_Aj1_PbPb(),
-    fHJetPt_Aj2_PbPb(),
-    fHJetPt_Aj3_PbPb(),
-    fHJetPt_Aj4_PbPb(),
-    fHJetDeltaPhi_Aj0_MC(),
-    fHJetDeltaPhi_Aj1_MC(),
-    fHJetDeltaPhi_Aj2_MC(),
-    fHJetDeltaPhi_Aj3_MC(),
-    fHJetDeltaPhi_Aj4_MC(),
-    fHJetPt_Aj0_MC(),
-    fHJetPt_Aj1_MC(),
-    fHJetPt_Aj2_MC(),
-    fHJetPt_Aj3_MC(),
-    fHJetPt_Aj4_MC(),
-    fHJetDeltaPhi_Aj0_EMB(),
-    fHJetDeltaPhi_Aj1_EMB(),
-    fHJetDeltaPhi_Aj2_EMB(),
-    fHJetDeltaPhi_Aj3_EMB(),
-    fHJetDeltaPhi_Aj4_EMB(),
-    fHJetPt_Aj0_EMB(),
-    fHJetPt_Aj1_EMB(),
-    fHJetPt_Aj2_EMB(),
-    fHJetPt_Aj3_EMB(),
-    fHJetPt_Aj4_EMB(),
-    fHJetDeltaPhiasEP_Aj0_PbPb(),
-    fHJetDeltaPhiasEP_Aj1_PbPb(),
-    fHJetDeltaPhiasEP_Aj2_PbPb(),
-    fHJetDeltaPhiasEP_Aj3_PbPb(),
-    fHJetDeltaPhiasEP_Aj4_PbPb(),
-    fHJetPtasEP_Aj0_PbPb(),
-    fHJetPtasEP_Aj1_PbPb(),
-    fHJetPtasEP_Aj2_PbPb(),
-    fHJetPtasEP_Aj3_PbPb(),
-    fHJetPtasEP_Aj4_PbPb(),
-    fHJetDeltaPhiasEP_Aj0_MC(),
-    fHJetDeltaPhiasEP_Aj1_MC(),
-    fHJetDeltaPhiasEP_Aj2_MC(),
-    fHJetDeltaPhiasEP_Aj3_MC(),
-    fHJetDeltaPhiasEP_Aj4_MC(),
-    fHJetPtasEP_Aj0_MC(),
-    fHJetPtasEP_Aj1_MC(),
-    fHJetPtasEP_Aj2_MC(),
-    fHJetPtasEP_Aj3_MC(),
-    fHJetPtasEP_Aj4_MC(),
-    fHJetDeltaPhiasEP_Aj0_EMB(),
-    fHJetDeltaPhiasEP_Aj1_EMB(),
-    fHJetDeltaPhiasEP_Aj2_EMB(),
-    fHJetDeltaPhiasEP_Aj3_EMB(),
-    fHJetDeltaPhiasEP_Aj4_EMB(),
-    fHJetPtasEP_Aj0_EMB(),
-    fHJetPtasEP_Aj1_EMB(),
-    fHJetPtasEP_Aj2_EMB(),
-    fHJetPtasEP_Aj3_EMB(),
-    fHJetPtasEP_Aj4_EMB(),
-    fEvent(0),
-    fCentrality(0)
-
+AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron() : 
+  AliAnalysisTaskEmcalJet("AliAnalysisTaskDijetHadron", kTRUE),
+  fMCJetPtThreshold(1),
+  fleadingHadronPtcut1(0.0),
+  fleadingHadronPtcut2(3.0),
+  fleadingHadronPtcut3(5.0),
+  fJet1Ptcut1(10.0),
+  fJet1Ptcut2(20.0),
+  fJet1Ptcut3(30.0),
+  fJet2Ptcut1(10.0),
+  fJet2Ptcut2(20.0),
+  fJet2Ptcut3(30.0),
+  fConeRadius(0.2),
+  fConeMinEta(-0.9),
+  fConeMaxEta(0.9),
+  fConeMinPhi(0),
+  fConeMaxPhi(TMath::Pi()*2),
+  fJetsCont(0),
+  fTracksCont(0),
+  fCaloClustersCont(0),
+  fMCJetsCont(0),
+  fMCTracksCont(0),
+  fMCCaloClustersCont(0),
+  fEmbJetsCont(0),
+  fEmbTracksCont(0),
+  fEmbCaloClustersCont(0),
+  fCent_V0(0),
+  fVertex_z_cut(0),
+  fJetBG_rho(0),
+  fJetBG_rho_Cent(0),
+  fTrackPt_PbPb(0),
+  fTrackPhi_PbPb(0),
+  fTrackEta_PbPb(0),
+  fTrack_Phi_Eta_PbPb(0),
+  fTrackPt_MC(0),
+  fTrackPhi_MC(0),
+  fTrackEta_MC(0),
+  fTrack_Phi_Eta_MC(0),
+  fTrackPt_EMB(0),
+  fTrackPhi_EMB(0),
+  fTrackEta_EMB(0),
+  fTrack_Phi_Eta_EMB(0),
+  fJetPt_PbPb(),
+  fJetPhi_PbPb(),
+  fJetEta_PbPb(),
+  fJet_Phi_Eta_PbPb(),
+  fJetPt_BG_PbPb(),
+  fJet1Pt_PbPb(),
+  fJet2Pt_PbPb(),
+  fJet1Pt_BG_PbPb(),
+  fJet2Pt_BG_PbPb(),
+  fJetDeltaPhi_PbPb(),
+  fJetDeltaEta_PbPb(),
+  fJetDeltaEP_PbPb(),
+  fJet1SelectPt_BG_PbPb(),
+  fJet2SelectPt_BG_PbPb(),
+  fAj_PbPb(),
+  fJetPt_MC(),
+  fJetPhi_MC(),
+  fJetEta_MC(),
+  fJet_Phi_Eta_MC(),
+  fJet1Pt_MC(),
+  fJet2Pt_MC(),
+  fJetDeltaPhi_MC(),
+  fJetDeltaEta_MC(),
+  fJetDeltaEP_MC(),
+  fAj_MC(),
+  fJetPt_EMB(),
+  fJetPhi_EMB(),
+  fJetEta_EMB(),
+  fJet_Phi_Eta_EMB(),
+  fJetPt_BG_EMB(),
+  fJetDeltaPt(),
+  fJet1Pt_EMB(),
+  fJet2Pt_EMB(),
+  fJet1Pt_BG_EMB(),
+  fJet2Pt_BG_EMB(),
+  fJet1DeltaPt(),
+  fJet2DeltaPt(),
+  fJetDeltaPhi_EMB(),
+  fJetDeltaEta_EMB(),
+  fJetDeltaEP_EMB(),
+  fJet1SelectPt_BG_EMB(),
+  fJet2SelectPt_BG_EMB(),
+  fJet1SelectDeltaPt(),
+  fJet2SelectDeltaPt(),
+  fAj_EMB(),
+  fHJetDeltaPhi_Aj0_PbPb(),
+  fHJetDeltaPhi_Aj1_PbPb(),
+  fHJetDeltaPhi_Aj2_PbPb(),
+  fHJetDeltaPhi_Aj3_PbPb(),
+  fHJetDeltaPhi_Aj4_PbPb(),
+  fHJetPt_Aj0_PbPb(),
+  fHJetPt_Aj1_PbPb(),
+  fHJetPt_Aj2_PbPb(),
+  fHJetPt_Aj3_PbPb(),
+  fHJetPt_Aj4_PbPb(),
+  fHJetDeltaPhi_Aj0_MC(),
+  fHJetDeltaPhi_Aj1_MC(),
+  fHJetDeltaPhi_Aj2_MC(),
+  fHJetDeltaPhi_Aj3_MC(),
+  fHJetDeltaPhi_Aj4_MC(),
+  fHJetPt_Aj0_MC(),
+  fHJetPt_Aj1_MC(),
+  fHJetPt_Aj2_MC(),
+  fHJetPt_Aj3_MC(),
+  fHJetPt_Aj4_MC(),
+  fHJetDeltaPhi_Aj0_EMB(),
+  fHJetDeltaPhi_Aj1_EMB(),
+  fHJetDeltaPhi_Aj2_EMB(),
+  fHJetDeltaPhi_Aj3_EMB(),
+  fHJetDeltaPhi_Aj4_EMB(),
+  fHJetPt_Aj0_EMB(),
+  fHJetPt_Aj1_EMB(),
+  fHJetPt_Aj2_EMB(),
+  fHJetPt_Aj3_EMB(),
+  fHJetPt_Aj4_EMB(),
+  fEvent(0),
+  fCentrality(99)
 {
   // Default constructor.
 
-  fHistRCPt = 0;
-  fHistRCPtExLJ = 0;
-  fHistRCPtExPartialLJ = 0;
-  //fHistRCPtRand = 0;
-  fHistRhoVSRCPt = 0;
-  fHistDeltaPtRCvsEP = 0;
-  fHistDeltaPtRCExLJ = 0;
-  fHistDeltaPtRCExPartialLJ = 0;
-  //fHistDeltaPtRCRand = 0;
-  fHistEmbJetsPtArea = 0;
-  fHistEmbJetsCorrPtArea = 0;
-  fHistEmbPartPtvsJetPt = 0;
-  fHistEmbPartPtvsJetCorrPt = 0;
-  fHistJetPtvsJetCorrPt = 0;
-  fHistDistLeadPart2JetAxis = 0;
-  fHistEmbBkgArea = 0;
-  fHistRhoVSEmbBkg = 0;
-  fHistDeltaPtEmbArea = 0;
-  fHistDeltaPtEmbvsEP = 0;
   fCent_V0 = 0;
   fVertex_z_cut = 0;
   fJetBG_rho = 0;
@@ -391,55 +318,6 @@ ClassImp(AliAnalysisTaskDijetHadron)
            fHJetPt_Aj2_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj3_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj4_EMB[i][j][k][l][m] = 0;
-
-         }
-       }
-      }
-    }
-  }
-
-
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    for (Int_t j = 0; j < 4; j++) {
-      for (Int_t k = 0; k < 4; k++) {
-       for (Int_t l = 0; l < 4; l++) {
-         for (Int_t m = 0; m < l+1; m++) {
-           fHJetDeltaPhiasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
          }
        }
       }
@@ -453,11 +331,15 @@ ClassImp(AliAnalysisTaskDijetHadron)
 AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),
   fMCJetPtThreshold(1),
-  fMinRC2LJ(-1),
-  fRCperEvent(-1),
-  //fPtHardBinName(0x0),
-  //fPtHardBin(-1),
-  //fhPtHardBins(0x0),
+  fleadingHadronPtcut1(0.0),
+  fleadingHadronPtcut2(3.0),
+  fleadingHadronPtcut3(5.0),
+  fJet1Ptcut1(10.0),
+  fJet1Ptcut2(20.0),
+  fJet1Ptcut3(30.0),
+  fJet2Ptcut1(10.0),
+  fJet2Ptcut2(20.0),
+  fJet2Ptcut3(30.0),
   fConeRadius(0.2),
   fConeMinEta(-0.9),
   fConeMaxEta(0.9),
@@ -472,32 +354,6 @@ AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron(const char *name) :
   fEmbJetsCont(0),
   fEmbTracksCont(0),
   fEmbCaloClustersCont(0),
-  //fRandTracksCont(0),
-  //fRandCaloClustersCont(0),
-  fHistRCPhiEta(0), 
-  fHistRCPt(0),
-  fHistRCPtExLJ(0),
-  fHistRCPtExPartialLJ(0), 
-  //fHistRCPtRand(0),
-  fHistRhoVSRCPt(0),
-  fHistDeltaPtRCvsEP(0),
-  fHistDeltaPtRCExLJ(0),
-  fHistDeltaPtRCExPartialLJ(0),
-  //fHistDeltaPtRCRand(0),
-  fHistEmbJetsPtArea(0),
-  fHistEmbJetsCorrPtArea(0),
-  fHistEmbPartPtvsJetPt(0),
-  fHistEmbPartPtvsJetCorrPt(0),
-  fHistJetPtvsJetCorrPt(0),
-  fHistDistLeadPart2JetAxis(0),
-  fHistEmbBkgArea(0),
-  fHistRhoVSEmbBkg(0),
-  fHistDeltaPtEmbArea(0),
-  fHistDeltaPtEmbvsEP(0),
-  fHistRCPtExLJVSDPhiLJ(0),
-  fHistRCPtExPartialLJVSDPhiLJ(0),
-  fHistEmbJetsPhiEta(0),
-  fHistLeadPartPhiEta(0),
   fCent_V0(0),
   fVertex_z_cut(0),
   fJetBG_rho(0),
@@ -589,60 +445,11 @@ AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron(const char *name) :
   fHJetPt_Aj2_EMB(),
   fHJetPt_Aj3_EMB(),
   fHJetPt_Aj4_EMB(),
-  fHJetDeltaPhiasEP_Aj0_PbPb(),
-  fHJetDeltaPhiasEP_Aj1_PbPb(),
-  fHJetDeltaPhiasEP_Aj2_PbPb(),
-  fHJetDeltaPhiasEP_Aj3_PbPb(),
-  fHJetDeltaPhiasEP_Aj4_PbPb(),
-  fHJetPtasEP_Aj0_PbPb(),
-  fHJetPtasEP_Aj1_PbPb(),
-  fHJetPtasEP_Aj2_PbPb(),
-  fHJetPtasEP_Aj3_PbPb(),
-  fHJetPtasEP_Aj4_PbPb(),
-  fHJetDeltaPhiasEP_Aj0_MC(),
-  fHJetDeltaPhiasEP_Aj1_MC(),
-  fHJetDeltaPhiasEP_Aj2_MC(),
-  fHJetDeltaPhiasEP_Aj3_MC(),
-  fHJetDeltaPhiasEP_Aj4_MC(),
-  fHJetPtasEP_Aj0_MC(),
-  fHJetPtasEP_Aj1_MC(),
-  fHJetPtasEP_Aj2_MC(),
-  fHJetPtasEP_Aj3_MC(),
-  fHJetPtasEP_Aj4_MC(),
-  fHJetDeltaPhiasEP_Aj0_EMB(),
-  fHJetDeltaPhiasEP_Aj1_EMB(),
-  fHJetDeltaPhiasEP_Aj2_EMB(),
-  fHJetDeltaPhiasEP_Aj3_EMB(),
-  fHJetDeltaPhiasEP_Aj4_EMB(),
-  fHJetPtasEP_Aj0_EMB(),
-  fHJetPtasEP_Aj1_EMB(),
-  fHJetPtasEP_Aj2_EMB(),
-  fHJetPtasEP_Aj3_EMB(),
-  fHJetPtasEP_Aj4_EMB(),
   fEvent(0),
-  fCentrality(0)
+  fCentrality(99)
 {
   // Standard constructor.
 
-  fHistRCPt = 0;
-  fHistRCPtExLJ = 0;
-  fHistRCPtExPartialLJ = 0;
-  //fHistRCPtRand = 0;
-  fHistRhoVSRCPt = 0;
-  fHistDeltaPtRCvsEP = 0;
-  fHistDeltaPtRCExLJ = 0;
-  fHistDeltaPtRCExPartialLJ = 0;
-  //fHistDeltaPtRCRand = 0;
-  fHistEmbJetsPtArea = 0;
-  fHistEmbJetsCorrPtArea = 0;
-  fHistEmbPartPtvsJetPt = 0;
-  fHistEmbPartPtvsJetCorrPt = 0;
-  fHistJetPtvsJetCorrPt = 0;
-  fHistDistLeadPart2JetAxis = 0;
-  fHistEmbBkgArea = 0;
-  fHistRhoVSEmbBkg = 0;
-  fHistDeltaPtEmbArea = 0;
-  fHistDeltaPtEmbvsEP = 0;
   fCent_V0 = 0;
   fVertex_z_cut = 0;
   fJetBG_rho = 0;
@@ -762,54 +569,6 @@ AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron(const char *name) :
            fHJetPt_Aj2_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj3_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj4_EMB[i][j][k][l][m] = 0;
-
-         }
-       }
-      }
-    }
-  }
-
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    for (Int_t j = 0; j < 4; j++) {
-      for (Int_t k = 0; k < 4; k++) {
-       for (Int_t l = 0; l < 4; l++) {
-         for (Int_t m = 0; m < l+1; m++) {
-           fHJetDeltaPhiasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
          }
        }
       }
@@ -822,25 +581,6 @@ AliAnalysisTaskDijetHadron::AliAnalysisTaskDijetHadron(const char *name) :
 //________________________________________________________________________
 void AliAnalysisTaskDijetHadron::AllocateHistogramArrays()
 {
-  fHistRCPt = new TH1*[fNcentBins];
-  fHistRCPtExLJ = new TH1*[fNcentBins];
-  fHistRCPtExPartialLJ = new TH1*[fNcentBins];
-  //fHistRCPtRand = new TH1*[fNcentBins];
-  fHistRhoVSRCPt = new TH2*[fNcentBins];
-  fHistDeltaPtRCvsEP = new TH2*[fNcentBins];
-  fHistDeltaPtRCExLJ = new TH1*[fNcentBins];
-  fHistDeltaPtRCExPartialLJ = new TH1*[fNcentBins];
-  //fHistDeltaPtRCRand = new TH1*[fNcentBins];
-  fHistEmbJetsPtArea = new TH3*[fNcentBins];
-  fHistEmbJetsCorrPtArea = new TH3*[fNcentBins];
-  fHistEmbPartPtvsJetPt = new TH2*[fNcentBins];
-  fHistEmbPartPtvsJetCorrPt = new TH2*[fNcentBins];
-  fHistJetPtvsJetCorrPt = new TH2*[fNcentBins];
-  fHistDistLeadPart2JetAxis = new TH1*[fNcentBins];
-  fHistEmbBkgArea = new TH2*[fNcentBins];
-  fHistRhoVSEmbBkg = new TH2*[fNcentBins];
-  fHistDeltaPtEmbArea = new TH2*[fNcentBins];
-  fHistDeltaPtEmbvsEP = new TH2*[fNcentBins];
   fTrackPt_PbPb = new TH1*[fNcentBins];
   fTrackPhi_PbPb = new TH1*[fNcentBins];
   fTrackEta_PbPb = new TH1*[fNcentBins];
@@ -855,25 +595,6 @@ void AliAnalysisTaskDijetHadron::AllocateHistogramArrays()
   fTrack_Phi_Eta_EMB = new TH2*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
-    fHistRCPt[i] = 0;
-    fHistRCPtExLJ[i] = 0;
-    fHistRCPtExPartialLJ[i] = 0;
-    //fHistRCPtRand[i] = 0;
-    fHistRhoVSRCPt[i] = 0;
-    fHistDeltaPtRCvsEP[i] = 0;
-    fHistDeltaPtRCExLJ[i] = 0;
-    fHistDeltaPtRCExPartialLJ[i] = 0;
-    //fHistDeltaPtRCRand[i] = 0;
-    fHistEmbJetsPtArea[i] = 0;
-    fHistEmbJetsCorrPtArea[i] = 0;
-    fHistEmbPartPtvsJetPt[i] = 0;
-    fHistEmbPartPtvsJetCorrPt[i] = 0;
-    fHistJetPtvsJetCorrPt[i] = 0;
-    fHistDistLeadPart2JetAxis[i] = 0;
-    fHistEmbBkgArea[i] = 0;
-    fHistRhoVSEmbBkg[i] = 0;
-    fHistDeltaPtEmbArea[i] = 0;
-    fHistDeltaPtEmbvsEP[i] = 0;
     fTrackPt_PbPb[i] = 0;
     fTrackPhi_PbPb[i] = 0;
     fTrackEta_PbPb[i] = 0;
@@ -967,7 +688,6 @@ void AliAnalysisTaskDijetHadron::AllocateHistogramArrays()
            fHJetPt_Aj3_PbPb[i][j][k][l][m] = 0;
            fHJetPt_Aj4_PbPb[i][j][k][l][m] = 0;
 
-
            fHJetDeltaPhi_Aj0_MC[i][j][k][l][m] = 0;
            fHJetDeltaPhi_Aj1_MC[i][j][k][l][m] = 0;
            fHJetDeltaPhi_Aj2_MC[i][j][k][l][m] = 0;
@@ -991,62 +711,12 @@ void AliAnalysisTaskDijetHadron::AllocateHistogramArrays()
            fHJetPt_Aj2_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj3_EMB[i][j][k][l][m] = 0;
            fHJetPt_Aj4_EMB[i][j][k][l][m] = 0;
-
          }
        }
       }
     }
   }
 
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    for (Int_t j = 0; j < 4; j++) {
-      for (Int_t k = 0; k < 4; k++) {
-       for (Int_t l = 0; l < 4; l++) {
-         for (Int_t m = 0; m < l+1; m++) {
-
-           fHJetDeltaPhiasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_PbPb[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_PbPb[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_MC[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_MC[i][j][k][l][m] = 0;
-
-           fHJetDeltaPhiasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetDeltaPhiasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
-           fHJetPtasEP_Aj0_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj1_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj2_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj3_EMB[i][j][k][l][m] = 0;
-           fHJetPtasEP_Aj4_EMB[i][j][k][l][m] = 0;
-
-         }
-       }
-      }
-    }
-  }
-
-
 }
 
 //________________________________________________________________________
@@ -1067,202 +737,8 @@ void AliAnalysisTaskDijetHadron::UserCreateOutputObjects()
   fEmbJetsCont = GetJetContainer("EmbJets");
   fEmbTracksCont = GetParticleContainer("EmbTracks");
   fEmbCaloClustersCont = GetClusterContainer("EmbCaloClusters");
-  //fRandTracksCont = GetParticleContainer("RandTracks");
-  //fRandCaloClustersCont = GetClusterContainer("RandCaloClusters");
-
-  if (fTracksCont || fCaloClustersCont) {
-    fHistRCPhiEta = new TH2F("fHistRCPhiEta","fHistRCPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
-    fHistRCPhiEta->GetXaxis()->SetTitle("#eta");
-    fHistRCPhiEta->GetYaxis()->SetTitle("#phi");
-    fOutput->Add(fHistRCPhiEta);
-
-    if (fJetsCont) {
-      fHistRCPtExLJVSDPhiLJ = new TH2F("fHistRCPtExLJVSDPhiLJ","fHistRCPtExLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
-      fHistRCPtExLJVSDPhiLJ->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
-      fHistRCPtExLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
-      fOutput->Add(fHistRCPtExLJVSDPhiLJ);
-
-      fHistRCPtExPartialLJVSDPhiLJ = new TH2F("fHistRCPtExPartialLJVSDPhiLJ","fHistRCPtExPartialLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
-      fHistRCPtExPartialLJVSDPhiLJ->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
-      fHistRCPtExPartialLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
-      fOutput->Add(fHistRCPtExPartialLJVSDPhiLJ);
-    }
-  }
-
-  if (fEmbJetsCont) {
-    fHistEmbJetsPhiEta = new TH2F("fHistEmbJetsPhiEta","fHistEmbJetsPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
-    fHistEmbJetsPhiEta->GetXaxis()->SetTitle("#eta");
-    fHistEmbJetsPhiEta->GetYaxis()->SetTitle("#phi");
-    fOutput->Add(fHistEmbJetsPhiEta);
-    
-    fHistLeadPartPhiEta = new TH2F("fHistLeadPartPhiEta","fHistLeadPartPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
-    fHistLeadPartPhiEta->GetXaxis()->SetTitle("#eta");
-    fHistLeadPartPhiEta->GetYaxis()->SetTitle("#phi");
-    fOutput->Add(fHistLeadPartPhiEta);
-  }
 
-  TString histname;
-
-  const Int_t nbinsZ = 12;
-  Double_t binsZ[nbinsZ+1] = {0,1,2,3,4,5,6,7,8,9,10,20,1000};
-
-  Double_t *binsPt       = GenerateFixedBinArray(fNbins, fMinBinPt, fMaxBinPt);
-  Double_t *binsCorrPt   = GenerateFixedBinArray(fNbins*2, -fMaxBinPt, fMaxBinPt);
-  Double_t *binsArea     = GenerateFixedBinArray(50, 0, 2);
-
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    if (fTracksCont || fCaloClustersCont) {
-      histname = "fHistRCPt_";
-      histname += i;
-      fHistRCPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-      fHistRCPt[i]->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
-      fHistRCPt[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistRCPt[i]);
-
-      histname = "fHistRhoVSRCPt_";
-      histname += i;
-      fHistRhoVSRCPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
-      fHistRhoVSRCPt[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
-      fHistRhoVSRCPt[i]->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
-      fOutput->Add(fHistRhoVSRCPt[i]);
-
-      histname = "fHistDeltaPtRCvsEP_";
-      histname += i;
-      fHistDeltaPtRCvsEP[i] = new TH2F(histname.Data(), histname.Data(), 101, 0, TMath::Pi()*1.01, fNbins * 2, -fMaxBinPt, fMaxBinPt);
-      fHistDeltaPtRCvsEP[i]->GetXaxis()->SetTitle("#phi_{RC} - #psi_{RP}");
-      fHistDeltaPtRCvsEP[i]->GetYaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-      fHistDeltaPtRCvsEP[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistDeltaPtRCvsEP[i]);
-      
-      if (fJetsCont) {
-       histname = "fHistRCPtExLJ_";
-       histname += i;
-       fHistRCPtExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-       fHistRCPtExLJ[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
-       fHistRCPtExLJ[i]->GetYaxis()->SetTitle("counts");
-       fOutput->Add(fHistRCPtExLJ[i]);
-
-       histname = "fHistDeltaPtRCExLJ_";
-       histname += i;
-       fHistDeltaPtRCExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-       fHistDeltaPtRCExLJ[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-       fHistDeltaPtRCExLJ[i]->GetYaxis()->SetTitle("counts");
-       fOutput->Add(fHistDeltaPtRCExLJ[i]);
-
-        histname = "fHistRCPtExPartialLJ_";
-        histname += i;
-        fHistRCPtExPartialLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-        fHistRCPtExPartialLJ[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
-        fHistRCPtExPartialLJ[i]->GetYaxis()->SetTitle("counts");
-        fOutput->Add(fHistRCPtExPartialLJ[i]);
-
-        histname = "fHistDeltaPtRCExPartialLJ_";
-        histname += i;
-        fHistDeltaPtRCExPartialLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-        fHistDeltaPtRCExPartialLJ[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-        fHistDeltaPtRCExPartialLJ[i]->GetYaxis()->SetTitle("counts");
-        fOutput->Add(fHistDeltaPtRCExPartialLJ[i]);
-      }
-    }
-
-    /*if (fRandTracksCont || fRandCaloClustersCont) {
-      histname = "fHistRCPtRand_";
-      histname += i;
-      fHistRCPtRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-      fHistRCPtRand[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
-      fHistRCPtRand[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistRCPtRand[i]);
-
-      histname = "fHistDeltaPtRCRand_";
-      histname += i;
-      fHistDeltaPtRCRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-      fHistDeltaPtRCRand[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-      fHistDeltaPtRCRand[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistDeltaPtRCRand[i]);
-      }*/
-
-    if (fEmbJetsCont) {
-      histname = "fHistEmbJetsPtArea_";
-      histname += i;
-      fHistEmbJetsPtArea[i] = new TH3F(histname.Data(), histname.Data(), 50, binsArea, fNbins, binsPt, nbinsZ, binsZ);
-      fHistEmbJetsPtArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbJetsPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,raw} (GeV/#it{c})");
-      fOutput->Add(fHistEmbJetsPtArea[i]);
-
-      histname = "fHistEmbJetsCorrPtArea_";
-      histname += i;
-      fHistEmbJetsCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(), 50, binsArea, fNbins * 2, binsCorrPt, nbinsZ, binsZ);
-      fHistEmbJetsCorrPtArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbJetsCorrPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,corr} (GeV/#it{c})");
-      fOutput->Add(fHistEmbJetsCorrPtArea[i]);
-
-      histname = "fHistEmbPartPtvsJetPt_";
-      histname += i;
-      fHistEmbPartPtvsJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
-      fHistEmbPartPtvsJetPt[i]->GetXaxis()->SetTitle("#sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
-      fHistEmbPartPtvsJetPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} (GeV/#it{c})");
-      fHistEmbPartPtvsJetPt[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistEmbPartPtvsJetPt[i]);
-
-      histname = "fHistEmbPartPtvsJetCorrPt_";
-      histname += i;
-      fHistEmbPartPtvsJetCorrPt[i] = new TH2F(histname.Data(), histname.Data(), 
-                                             fNbins, fMinBinPt, fMaxBinPt, fNbins*2, -fMaxBinPt, fMaxBinPt);
-      fHistEmbPartPtvsJetCorrPt[i]->GetXaxis()->SetTitle("#sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
-      fHistEmbPartPtvsJetCorrPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - A#rho (GeV/#it{c})");
-      fHistEmbPartPtvsJetCorrPt[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistEmbPartPtvsJetCorrPt[i]);
-
-      histname = "fHistJetPtvsJetCorrPt_";
-      histname += i;
-      fHistJetPtvsJetCorrPt[i] = new TH2F(histname.Data(), histname.Data(), 
-                                         fNbins, fMinBinPt, fMaxBinPt, fNbins*2, -fMaxBinPt, fMaxBinPt);
-      fHistJetPtvsJetCorrPt[i]->GetXaxis()->SetTitle("#it{p}_{T,jet}^{emb} (GeV/#it{c})");
-      fHistJetPtvsJetCorrPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - A#rho (GeV/#it{c})");
-      fHistJetPtvsJetCorrPt[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistJetPtvsJetCorrPt[i]);
-
-      histname = "fHistDistLeadPart2JetAxis_";
-      histname += i;
-      fHistDistLeadPart2JetAxis[i] = new TH1F(histname.Data(), histname.Data(), 50, 0, 0.5);
-      fHistDistLeadPart2JetAxis[i]->GetXaxis()->SetTitle("distance");
-      fHistDistLeadPart2JetAxis[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistDistLeadPart2JetAxis[i]);
-
-      histname = "fHistEmbBkgArea_";
-      histname += i;
-      fHistEmbBkgArea[i] = new TH2F(histname.Data(), histname.Data(), 50, 0, 2, fNbins, fMinBinPt, fMaxBinPt);
-      fHistEmbBkgArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbBkgArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
-      fOutput->Add(fHistEmbBkgArea[i]);
-
-      histname = "fHistRhoVSEmbBkg_";
-      histname += i;
-      fHistRhoVSEmbBkg[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
-      fHistRhoVSEmbBkg[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
-      fHistRhoVSEmbBkg[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
-      fOutput->Add(fHistRhoVSEmbBkg[i]);
-      
-      histname = "fHistDeltaPtEmbArea_";
-      histname += i;
-      fHistDeltaPtEmbArea[i] = new TH2F(histname.Data(), histname.Data(), 
-                                       50, 0, 2, fNbins * 2, -fMaxBinPt, fMaxBinPt);
-      fHistDeltaPtEmbArea[i]->GetXaxis()->SetTitle("area");
-      fHistDeltaPtEmbArea[i]->GetYaxis()->SetTitle("#delta#it{p}_{T}^{emb} (GeV/#it{c})");
-      fHistDeltaPtEmbArea[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistDeltaPtEmbArea[i]);
-
-      histname = "fHistDeltaPtEmbvsEP_";
-      histname += i;
-      fHistDeltaPtEmbvsEP[i] = new TH2F(histname.Data(), histname.Data(), 101, 0, TMath::Pi()*1.01, fNbins * 2, -fMaxBinPt, fMaxBinPt);
-      fHistDeltaPtEmbvsEP[i]->GetXaxis()->SetTitle("#phi_{jet} - #Psi_{EP}");
-      fHistDeltaPtEmbvsEP[i]->GetYaxis()->SetTitle("#delta#it{p}_{T}^{emb} (GeV/#it{c})");
-      fHistDeltaPtEmbvsEP[i]->GetZaxis()->SetTitle("counts");
-      fOutput->Add(fHistDeltaPtEmbvsEP[i]);
-    }
-  }
-
-  //User Task
+   //User Task
   fCent_V0  = new TH1F("fCent_V0", "Centrality (all) by V0M", 103,-2,101);
   fOutput->Add(fCent_V0);
   fVertex_z_cut = new TH1F("fVertex_z_cut", "SPD vertex z (cut)", 120,-30,30);
@@ -1271,8 +747,6 @@ void AliAnalysisTaskDijetHadron::UserCreateOutputObjects()
   fOutput->Add(fJetBG_rho);
   fJetBG_rho_Cent = new TH2F("fJetBG_rho_Cent","fJetBG_rho_Cent",100,0,100,300,0,300);
   fOutput->Add(fJetBG_rho_Cent);
-  //fhPtHardBins = new TH1F("fhPtHardBins","Number of events in each pT hard bin",11,0,11);
-  //fOutput->Add(fhPtHardBins);
 
   // Track histograms...
   for (Int_t i = 0; i < fNcentBins; i++) {
@@ -1501,98 +975,12 @@ void AliAnalysisTaskDijetHadron::UserCreateOutputObjects()
            fHJetPt_Aj4_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPt_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPt_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
            fOutput->Add(fHJetPt_Aj4_EMB[i][j][k][l][m]);
 
-
-         }
-       }
-      }
-    }
-  }
-
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    for (Int_t j = 0; j < 4; j++) {
-      for (Int_t k = 0; k < 4; k++) {
-       for (Int_t l = 0; l < 4; l++) {
-         for (Int_t m = 0; m < l+1; m++) {
-           // Jet-Hadron as EP Histgrams...
-           //PbPb
-           fHJetDeltaPhiasEP_Aj0_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj0_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj0_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj0_PbPb[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj1_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj1_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj1_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj1_PbPb[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj2_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj2_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj2_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj2_PbPb[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj3_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj3_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj3_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj3_PbPb[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj4_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj4_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj4_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj4_PbPb[i][j][k][l][m]);
-
-           fHJetPtasEP_Aj0_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj0_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj0_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj0_PbPb[i][j][k][l][m]);
-           fHJetPtasEP_Aj1_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj1_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj1_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj1_PbPb[i][j][k][l][m]);
-           fHJetPtasEP_Aj2_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj2_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj2_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj2_PbPb[i][j][k][l][m]);
-           fHJetPtasEP_Aj3_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj3_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj3_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj3_PbPb[i][j][k][l][m]);
-           fHJetPtasEP_Aj4_PbPb[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj4_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj4_PbPb[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj4_PbPb[i][j][k][l][m]);
-
-           //MC
-           fHJetDeltaPhiasEP_Aj0_MC[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj0_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj0_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj0_MC[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj1_MC[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj1_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj1_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj1_MC[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj2_MC[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj2_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj2_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj2_MC[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj3_MC[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj3_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj3_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj3_MC[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj4_MC[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj4_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj4_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj4_MC[i][j][k][l][m]);
-
-           fHJetPtasEP_Aj0_MC[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj0_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj0_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj0_MC[i][j][k][l][m]);
-           fHJetPtasEP_Aj1_MC[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj1_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj1_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj1_MC[i][j][k][l][m]);
-           fHJetPtasEP_Aj2_MC[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj2_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj2_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj2_MC[i][j][k][l][m]);
-           fHJetPtasEP_Aj3_MC[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj3_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj3_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj3_MC[i][j][k][l][m]);
-           fHJetPtasEP_Aj4_MC[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj4_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj4_MC[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj4_MC[i][j][k][l][m]);
-
-           //EMB
-           fHJetDeltaPhiasEP_Aj0_EMB[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj0_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj0_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj0_EMB[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj1_EMB[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj1_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj1_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj1_EMB[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj2_EMB[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj2_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj2_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj2_EMB[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj3_EMB[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj3_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj3_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj3_EMB[i][j][k][l][m]);
-           fHJetDeltaPhiasEP_Aj4_EMB[i][j][k][l][m] = new TH1F(Form("fHJetDeltaPhiasEP_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetDeltaPhiasEP_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),40,-1./2.*pi,3./2.*pi);
-           fOutput->Add(fHJetDeltaPhiasEP_Aj4_EMB[i][j][k][l][m]);
-
-           fHJetPtasEP_Aj0_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj0_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj0_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj0_EMB[i][j][k][l][m]);
-           fHJetPtasEP_Aj1_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj1_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj1_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj1_EMB[i][j][k][l][m]);
-           fHJetPtasEP_Aj2_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj2_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj2_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj2_EMB[i][j][k][l][m]);
-           fHJetPtasEP_Aj3_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj3_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj3_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj3_EMB[i][j][k][l][m]);
-           fHJetPtasEP_Aj4_EMB[i][j][k][l][m] = new TH1F(Form("fHJetPtasEP_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),Form("fHJetPtasEP_Aj4_EMB[%d][%d][%d][%d][%d]",i,j,k,l,m),360,0,120);
-           fOutput->Add(fHJetPtasEP_Aj4_EMB[i][j][k][l][m]);
          }
        }
       }
     }
   }
 
-
-  delete[] binsPt;
-  delete[] binsCorrPt;
-  delete[] binsArea;
-
   PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
 }
 
@@ -1617,20 +1005,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
 
   //Get Event
   fEvent = InputEvent();
-  if(fEvent){
-
-    /*if(!fPtHardBinName)
-      {
-      // Get embedded pt hard bin number
-      fPtHardBinName = static_cast<AliNamedString*>(fEvent->FindListObject("AODEmbeddingFile"));
-      if(!fPtHardBinName) cout << "no embedding file!" << endl;
-      }
-
-      TString fileName = fPtHardBinName->GetString();
-      fileName.Remove(0,50);
-      fileName.Remove(fileName.Index("/"));
-      fPtHardBin = fileName.Atoi();
-      fhPtHardBins->Fill(fPtHardBin);*/
+  if(fEvent && fAvoidTpcHole == 0){
 
     //trigger
     Int_t fTriggerType =-1;
@@ -1705,25 +1080,16 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
 
 
          //threshold
-         double Jet1_threshold[5]; double Jet2_threshold[5];
+         double Jet1_threshold[4]; double Jet2_threshold[4];
          Jet1_threshold[0]=0.0; Jet2_threshold[0]=0.0;
-         for(Int_t k=1;k<5;k++){
-           int dummy = k - 1;
-           Jet1_threshold[k]=Jet1_threshold[dummy]+10.0;       
-           Jet2_threshold[k]=Jet2_threshold[dummy]+10.0;       
-         }
+         Jet1_threshold[1]=fJet1Ptcut1; Jet2_threshold[1]=fJet2Ptcut1;
+         Jet1_threshold[2]=fJet1Ptcut2; Jet2_threshold[2]=fJet2Ptcut2;
+         Jet1_threshold[3]=fJet1Ptcut3; Jet2_threshold[3]=fJet2Ptcut3;
 
-         //Jet check
-         //Double_t jet_track[6][2][200];
-         //for(Int_t m=0;m<6;m++){
-         //for(Int_t i=0;i<2;i++){
-         //for(Int_t j=0;j<200;j++){
-         //jet_track[m][i][j]=-999.0;
-         //}
-         //}
-         //}
+         // ************
+         // PbPb
+         // _________________________________
 
-         //PbPb
          //Track histogram
          if (fTracksCont) {
            AliVTrack *track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle(0)); 
@@ -1743,19 +1109,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
            AliEmcalJet *Jet = fJetsCont->GetNextAcceptJet(0);
            while(Jet) {
 
-             if ((Jet->Eta() >  0.7) ||
-                 (Jet->Eta() < -0.7) ||
-                 (Jet->Phi() >  2*TMath::Pi()) ||
-                 (Jet->Phi() <  0.0)) continue; // acceptance eta range and etmin
-
              //leading track cut
-             Int_t leading_track_count[3]={0,0,0};
-             //Int_t leading_track_limit=0;
-             if(fJetsCont->GetLeadingHadronPt(Jet) > 0.) leading_track_count[0] += 1;
-             if(fJetsCont->GetLeadingHadronPt(Jet) > 5.) leading_track_count[1] += 1;
-             if(fJetsCont->GetLeadingHadronPt(Jet) > 10.) leading_track_count[2] += 1;
-             //if(fJetsCont->GetLeadingHadronPt(Jet) > 100.) leading_track_limit += 1;
-             //if(leading_track_limit > 0) continue;
+             Int_t leading_track_count[3]={0.,0.,0.};
+             if(fJetsCont->GetLeadingHadronPt(Jet) > fleadingHadronPtcut1) leading_track_count[0] += 1;
+             if(fJetsCont->GetLeadingHadronPt(Jet) > fleadingHadronPtcut2) leading_track_count[1] += 1;
+             if(fJetsCont->GetLeadingHadronPt(Jet) > fleadingHadronPtcut3) leading_track_count[2] += 1;
 
              for(int m=0;m<3;m++){
                c_jet1_PbPb[m]++; // jet count in acceptance.
@@ -1764,7 +1122,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                  fJetPhi_PbPb[fCentBin][m]->Fill(Jet->Phi());
                  fJetEta_PbPb[fCentBin][m]->Fill(Jet->Eta());
                  fJet_Phi_Eta_PbPb[fCentBin][m]->Fill(Jet->Phi(),Jet->Eta());
-                 fJetPt_BG_PbPb[fCentBin][m]->Fill(Jet->Pt() - Jet->Area() * fRhoVal);
+                 fJetPt_BG_PbPb[fCentBin][m]->Fill(Jet->Pt() - Jet->Area() * fJetsCont->GetRhoVal());
                }
              }
 
@@ -1772,7 +1130,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                if(c_jet1_PbPb[m] == 1)
                  {
                    if(leading_track_count[m] > 0){
-                     jet1_pt0[m] = Jet->Pt(); jet1_pt_BG0[m] = Jet->Pt() - Jet->Area() * fRhoVal; jet1_phi0[m] = Jet->Phi(); jet1_eta0[m] = Jet->Eta(); //Get Leading Jet(Jet1) value
+                     jet1_pt0[m] = Jet->Pt(); jet1_pt_BG0[m] = Jet->Pt() - Jet->Area() * fJetsCont->GetRhoVal(); jet1_phi0[m] = Jet->Phi(); jet1_eta0[m] = Jet->Eta(); //Get Leading Jet(Jet1) value
 
                      dEPJet0[m] = jet1_phi0[m] - fEPV0;
                      while (dEPJet0[m] < 0) dEPJet0[m] += TMath::Pi();
@@ -1784,7 +1142,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
 
                else if(c_jet1_PbPb[m] > 1 && c_jet2_PbPb[m] == 0  && leading_jet_count0[m] > 0 && leading_track_count[m] > 0)// sub leading
                  {
-                   jet2_pt0[m] = Jet->Pt(); jet2_pt_BG0[m] = Jet->Pt() - Jet->Area() * fRhoVal; jet2_phi0[m] = Jet->Phi(); jet2_eta0[m] = Jet->Eta(); //Get Sub Leading Jet(Jet2) value
+                   jet2_pt0[m] = Jet->Pt(); jet2_pt_BG0[m] = Jet->Pt() - Jet->Area() * fJetsCont->GetRhoVal(); jet2_phi0[m] = Jet->Phi(); jet2_eta0[m] = Jet->Eta(); //Get Sub Leading Jet(Jet2) value
                    Delta_phi0[m] = jet1_phi0[m] - jet2_phi0[m]; Aj0[m] = (jet1_pt_BG0[m] - jet2_pt_BG0[m]) / (jet1_pt_BG0[m] + jet2_pt_BG0[m]);
                    if     (Delta_phi0[m] < (-1./2*TMath::Pi()))Delta_phi0[m] = Delta_phi0[m] +2*TMath::Pi();
                    else if(Delta_phi0[m] > (3./2*TMath::Pi()))Delta_phi0[m] = Delta_phi0[m] -2*TMath::Pi();
@@ -1829,12 +1187,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
            }// jet while
 
            //jet-hadron
-           if (fTracksCont) {
-             for(int m=0;m<3;m++){
-               //if find sub leading
+           for(int m=0;m<3;m++){//leading track cut
+             if (fTracksCont) {//track cont
                int c_subleading_jet = 0;
                c_subleading_jet = subleading_jet_count0[m];
-               if(c_subleading_jet > 0){
+               if(c_subleading_jet > 0){//if find sub leading
 
                  AliVTrack *track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle(0));
                  while(track) {
@@ -1848,24 +1205,6 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                      if     (dphi < (-1./2.*TMath::Pi()))dphi = dphi +2*TMath::Pi();
                      else if(dphi > (3./2.*TMath::Pi()))dphi = dphi -2*TMath::Pi();
 
-                     //jet_track check
-                     /*Bool_t jet_switch=false;
-                       for(int i=0;i<200;i++){
-                       Float_t check_track1,check_track2;
-                       check_track1 = -999.0; check_track2 = -999.0;
-                       check_track1 = jet_track[m][0][i]; check_track2 = jet_track[m][1][i];
-                       if(check_track1 == phi){
-                       jet_switch=true;
-                       }
-                       if(check_track2 == phi){
-                       jet_switch=true;
-                       }
-                       }
-
-                       if(jet_switch==true){
-                       continue;
-                       }*/
-
                      //dphi cut
                      Bool_t dphi_cut[4];
                      //devide(jet side)
@@ -1972,93 +1311,20 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                        }
                      }//count1
 
-                     if(m==1){
-                       //hadron-dphi as dEPJet (jet leading track = 5GeV)
-                       for(int EPtri=0;EPtri<4;EPtri++){
-                         if(jet_dEP_switch[EPtri]){
-                           for(int pt_cut=0;pt_cut<4;pt_cut++){
-                             if(pt_switch[pt_cut]){
-                               for(int count1=0;count1<4;count1++){
-                                 if(jet_dphi_switch[0]){
-                                   for(int count2=0;count2<count1+1;count2++){
-                                     if(jet1_pt_BG0[m] > Jet1_threshold[count1] && jet2_pt_BG0[m] > Jet2_threshold[count2]){
-                                       fHJetDeltaPhiasEP_Aj0_PbPb[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-
-                                       if(Aj0[m] >= 0.0 && Aj0[m] < 0.2){
-                                         fHJetDeltaPhiasEP_Aj1_PbPb[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj0[m] >= 0.2 && Aj0[m] < 0.4){
-                                         fHJetDeltaPhiasEP_Aj2_PbPb[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj0[m] >= 0.4 && Aj0[m] < 0.6){
-                                         fHJetDeltaPhiasEP_Aj3_PbPb[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj0[m] >= 0.6 && Aj0[m] <= 0.8){
-                                         fHJetDeltaPhiasEP_Aj4_PbPb[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-                                     }
-
-
-                                   }//count2
-                                 }
-                               }//count1
-                             }//pt cut
-                           }//pt for
-                         }//dEP cut
-                       }//dEP for
-
-                       //hadron-pT as dEPJet (jet leading track = 5GeV)
-                       for(int EPtri=0;EPtri<4;EPtri++){
-                         if(jet_dEP_switch[EPtri]){
-                           for(int count1=0;count1<4;count1++){
-                             if(jet_dphi_switch[0]){
-                               for(int count2=0;count2<count1+1;count2++){
-                                 if(jet1_pt_BG0[m] > Jet1_threshold[count1] && jet2_pt_BG0[m] > Jet2_threshold[count2]){
-                                   for(int i=0;i<4;i++){
-                                     if(dphi_cut[i]){
-                                       fHJetPtasEP_Aj0_PbPb[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-
-                                       if(Aj0[m] >= 0.0 && Aj0[m] < 0.2){
-                                         fHJetPtasEP_Aj1_PbPb[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj0[m] >= 0.2 && Aj0[m] < 0.4){
-                                         fHJetPtasEP_Aj2_PbPb[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj0[m] >= 0.4 && Aj0[m] < 0.6){
-                                         fHJetPtasEP_Aj3_PbPb[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj0[m] >= 0.6 && Aj0[m] <= 0.8){
-                                         fHJetPtasEP_Aj4_PbPb[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-                                     }//dphi cut
-                                   }//dphi loop
-                                 }//jet pt cut
-
-                               }//count2
-                             }
-                           }//count1
-
-                         }//dEP cut
-                       }//dEP for
-                     }//jet leading track cut
-
                    }// if label
                    track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle());
                  }// track while
 
                }// if sub leading jet
-             }
-           }// tracks Cont
+             }// tracks Cont
+           }// jet leading track cut
 
          }// jetCont
 
-         //MC
+         // ************
+         // MC
+         // _________________________________
+
          //Track histogram
          if (fMCTracksCont) {
            AliVTrack *MCtrack = static_cast<AliVTrack*>(fMCTracksCont->GetNextAcceptParticle(0)); 
@@ -2078,19 +1344,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
            AliEmcalJet *MCJet = fMCJetsCont->GetNextAcceptJet(0);
            while(MCJet) {
 
-             if ((MCJet->Eta() >  0.7) ||
-                 (MCJet->Eta() < -0.7) ||
-                 (MCJet->Phi() >  2*TMath::Pi()) ||
-                 (MCJet->Phi() <  0.0)) continue; // acceptance eta range and etmin
-
              //leading track cut
-             Int_t leading_track_count[3]={0,0,0};
-             //Int_t leading_track_limit=0;
-             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > 0.) leading_track_count[0] += 1;
-             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > 5.) leading_track_count[1] += 1;
-             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > 10.) leading_track_count[2] += 1;
-             //if(fMCJetsCont->GetLeadingHadronPt(MCJet) > 100.) leading_track_limit += 1;
-             //if(leading_track_limit > 0) continue;
+             Int_t leading_track_count[3]={0.,0.,0.};
+             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > fleadingHadronPtcut1) leading_track_count[0] += 1;
+             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > fleadingHadronPtcut2) leading_track_count[1] += 1;
+             if(fMCJetsCont->GetLeadingHadronPt(MCJet) > fleadingHadronPtcut3) leading_track_count[2] += 1;
 
              for(int m=0;m<3;m++){
                c_jet1_MC[m]++; // jet count in acceptance.
@@ -2160,12 +1418,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
            }//while jet
 
            //jet-hadron
-           if (fMCTracksCont) {
-             for(int m=0;m<3;m++){
-               //if find sub leading
+           for(int m=0;m<3;m++){
+             if (fMCTracksCont) {//track cont
                int c_subleading_jet = 0;
                c_subleading_jet = subleading_jet_count1[m];
-               if(c_subleading_jet > 0){
+               if(c_subleading_jet > 0){//if find sub leading
 
                  AliVTrack *MCtrack = static_cast<AliVTrack*>(fMCTracksCont->GetNextAcceptParticle(0));
                  while(MCtrack) {
@@ -2179,24 +1436,6 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                      if     (dphi < (-1./2.*TMath::Pi()))dphi = dphi +2*TMath::Pi();
                      else if(dphi > (3./2.*TMath::Pi()))dphi = dphi -2*TMath::Pi();
 
-                     //jet_track check
-                     /*Bool_t jet_switch=false;
-                       for(int i=0;i<200;i++){
-                       Float_t check_track1,check_track2;
-                       check_track1 = -999.0; check_track2 = -999.0;
-                       check_track1 = jet_track[m][0][i]; check_track2 = jet_track[m][1][i];
-                       if(check_track1 == phi){
-                       jet_switch=true;
-                       }
-                       if(check_track2 == phi){
-                       jet_switch=true;
-                       }
-                       }
-
-                       if(jet_switch==true){
-                       continue;
-                       }*/
-
                      //dphi cut
                      Bool_t dphi_cut[4];
                      //devide(jet side)
@@ -2303,176 +1542,16 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                        }
                      }//count1
 
-                     if(m==1){
-                       //hadron-dphi as dEPJet (jet leading track = 5GeV)
-                       for(int EPtri=0;EPtri<4;EPtri++){
-                         if(jet_dEP_switch[EPtri]){
-                           for(int pt_cut=0;pt_cut<4;pt_cut++){
-                             if(pt_switch[pt_cut]){
-                               for(int count1=0;count1<4;count1++){
-                                 if(jet_dphi_switch[0]){
-                                   for(int count2=0;count2<count1+1;count2++){
-                                     if(jet1_pt1[m] > Jet1_threshold[count1] && jet2_pt1[m] > Jet2_threshold[count2]){
-                                       fHJetDeltaPhiasEP_Aj0_MC[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-
-                                       if(Aj1[m] >= 0.0 && Aj1[m] < 0.2){
-                                         fHJetDeltaPhiasEP_Aj1_MC[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj1[m] >= 0.2 && Aj1[m] < 0.4){
-                                         fHJetDeltaPhiasEP_Aj2_MC[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj1[m] >= 0.4 && Aj1[m] < 0.6){
-                                         fHJetDeltaPhiasEP_Aj3_MC[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-
-                                       if(Aj1[m] >= 0.6 && Aj1[m] <= 0.8){
-                                         fHJetDeltaPhiasEP_Aj4_MC[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                       }
-                                     }
-
-
-                                   }//count2
-                                 }
-                               }//count1
-                             }//pt cut
-                           }//pt for
-                         }//dEP cut
-                       }//dEP for
-
-                       //hadron-pT as dEPJet (jet leading track = 5GeV)
-                       for(int EPtri=0;EPtri<4;EPtri++){
-                         if(jet_dEP_switch[EPtri]){
-                           for(int count1=0;count1<4;count1++){
-                             if(jet_dphi_switch[0]){
-                               for(int count2=0;count2<count1+1;count2++){
-                                 if(jet1_pt1[m] > Jet1_threshold[count1] && jet2_pt1[m] > Jet2_threshold[count2]){
-                                   for(int i=0;i<4;i++){
-                                     if(dphi_cut[i]){
-                                       fHJetPtasEP_Aj0_MC[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-
-                                       if(Aj1[m] >= 0.0 && Aj1[m] < 0.2){
-                                         fHJetPtasEP_Aj1_MC[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj1[m] >= 0.2 && Aj1[m] < 0.4){
-                                         fHJetPtasEP_Aj2_MC[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj1[m] >= 0.4 && Aj1[m] < 0.6){
-                                         fHJetPtasEP_Aj3_MC[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-
-                                       if(Aj1[m] >= 0.6 && Aj1[m] <= 0.8){
-                                         fHJetPtasEP_Aj4_MC[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                       }
-                                     }//dphi cut
-                                   }//dphi loop
-                                 }//jet pt cut
-
-                               }//count2
-                             }
-                           }//count1
-                         }//dEP cut
-                       }//dEP for
-                     }//jet leading track cut
-
                    }// if label
                    MCtrack = static_cast<AliVTrack*>(fMCTracksCont->GetNextAcceptParticle());
                  }// track while
 
                }// if sub leading jet
-             }
-           }// tracks Cont
+             }// tracks Cont
+           }// jet leading track cut
 
          }//jet Cont
 
-         // ************
-         // Random cones
-         // _________________________________
-  
-         const Float_t rcArea = fConeRadius * fConeRadius * TMath::Pi();
-         Float_t RCpt = 0;
-         Float_t RCeta = 0;
-         Float_t RCphi = 0;
-  
-         if (fTracksCont || fCaloClustersCont) {
-    
-           for (Int_t i = 0; i < fRCperEvent; i++) {
-             // Simple random cones
-             RCpt = 0;
-             RCeta = 0;
-             RCphi = 0;
-             GetRandomCone(RCpt, RCeta, RCphi, fTracksCont, fCaloClustersCont, 0);
-             if (RCpt > 0) {
-               fHistRCPhiEta->Fill(RCeta, RCphi);
-               fHistRhoVSRCPt[fCentBin]->Fill(fRhoVal * rcArea, RCpt);
-       
-               fHistRCPt[fCentBin]->Fill(RCpt);
-
-               Double_t ep = RCphi - fEPV0;
-               while (ep < 0) ep += TMath::Pi();
-               while (ep >= TMath::Pi()) ep -= TMath::Pi();
-
-               fHistDeltaPtRCvsEP[fCentBin]->Fill(ep, RCpt - rcArea * fRhoVal);
-             }
-
-             if (fJetsCont) {
-
-               // Random cones far from leading jet
-               AliEmcalJet* jet = fJetsCont->GetLeadingJet("rho");
-       
-               RCpt = 0;
-               RCeta = 0;
-               RCphi = 0;
-               GetRandomCone(RCpt, RCeta, RCphi, fTracksCont, fCaloClustersCont, jet);
-               if (RCpt > 0) {
-                 if (jet) {
-                   Float_t dphi = RCphi - jet->Phi();
-                   if (dphi > 4.8) dphi -= TMath::Pi() * 2;
-                   if (dphi < -1.6) dphi += TMath::Pi() * 2; 
-                   fHistRCPtExLJVSDPhiLJ->Fill(RCpt, dphi);
-                 }
-                 fHistRCPtExLJ[fCentBin]->Fill(RCpt);
-                 fHistDeltaPtRCExLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
-               }
-
-               //partial exclusion
-               if(fBeamType == kpA) {
-
-                 RCpt = 0;
-                 RCeta = 0;
-                 RCphi = 0;
-                 GetRandomCone(RCpt, RCeta, RCphi, fTracksCont, fCaloClustersCont, jet, kTRUE);
-
-                 if (RCpt > 0) {
-                   if (jet) {
-                     Float_t dphi = RCphi - jet->Phi();
-                     if (dphi > 4.8) dphi -= TMath::Pi() * 2;
-                     if (dphi < -1.6) dphi += TMath::Pi() * 2;
-                     fHistRCPtExPartialLJVSDPhiLJ->Fill(RCpt, dphi);
-                   }
-                   fHistRCPtExPartialLJ[fCentBin]->Fill(RCpt);
-                   fHistDeltaPtRCExPartialLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
-                 }
-               }
-             }
-           }
-         }
-  
-         // Random cones with randomized particles
-         /*if (fRandTracksCont || fRandCaloClustersCont) {
-           RCpt = 0;
-           RCeta = 0;
-           RCphi = 0;
-           GetRandomCone(RCpt, RCeta, RCphi, fRandTracksCont, fRandCaloClustersCont, 0);
-           if (RCpt > 0) {
-           fHistRCPtRand[fCentBin]->Fill(RCpt);
-           fHistDeltaPtRCRand[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
-           }  
-           }*/
-
          // ************
          // Embedding
          // _________________________________
@@ -2495,44 +1574,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
     
            while (embJet != 0) {
 
-             if ((embJet->Eta() >  0.7) ||
-                 (embJet->Eta() < -0.7) ||
-                 (embJet->Phi() >  2*TMath::Pi()) ||
-                 (embJet->Phi() <  0.0)) continue; // acceptance eta range and etmin
-
-             TLorentzVector mom;
-             fEmbJetsCont->GetLeadingHadronMomentum(mom,embJet);
-      
-             Double_t distLeading2Jet = TMath::Sqrt((embJet->Eta() - mom.Eta()) * (embJet->Eta() - mom.Eta()) + (embJet->Phi() - mom.Phi()) * (embJet->Phi() - mom.Phi()));
-      
-             fHistEmbPartPtvsJetPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt());
-             fHistEmbPartPtvsJetCorrPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt() - embJet->Area() * fRhoVal);
-             fHistLeadPartPhiEta->Fill(mom.Eta(), mom.Phi());
-             fHistDistLeadPart2JetAxis[fCentBin]->Fill(distLeading2Jet);
-      
-             fHistEmbJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt(), mom.Pt());
-             fHistEmbJetsCorrPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - fRhoVal * embJet->Area(), mom.Pt());
-             fHistEmbJetsPhiEta->Fill(embJet->Eta(), embJet->Phi());
-             fHistJetPtvsJetCorrPt[fCentBin]->Fill(embJet->Pt(), embJet->Pt() - fRhoVal * embJet->Area());
-      
-             fHistEmbBkgArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->MCPt());
-             fHistRhoVSEmbBkg[fCentBin]->Fill(fRhoVal * embJet->Area(), embJet->Pt() - embJet->MCPt());
-             fHistDeltaPtEmbArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
-
-             Double_t ep = embJet->Phi() - fEPV0;
-             while (ep < 0) ep += TMath::Pi();
-             while (ep >= TMath::Pi()) ep -= TMath::Pi();
-
-             fHistDeltaPtEmbvsEP[fCentBin]->Fill(ep, embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
-
              //leading track cut
-             Int_t leading_track_count[3]={0,0,0};
-             //Int_t leading_track_limit=0;
-             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > 0.) leading_track_count[0] += 1;
-             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > 5.) leading_track_count[1] += 1;
-             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > 10.) leading_track_count[2] += 1;
-             //if(fEmbJetsCont->GetLeadingHadronPt(embJet) > 100.) leading_track_limit += 1;
-             //if(leading_track_limit > 0) continue;
+             Int_t leading_track_count[3]={0.,0.,0.};
+             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > fleadingHadronPtcut1) leading_track_count[0] += 1;
+             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > fleadingHadronPtcut2) leading_track_count[1] += 1;
+             if(fEmbJetsCont->GetLeadingHadronPt(embJet) > fleadingHadronPtcut3) leading_track_count[2] += 1;
 
              for(int m=0;m<3;m++){
                c_jet1_EMB[m]++; // jet count in acceptance.
@@ -2541,8 +1587,8 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                  fJetPhi_EMB[fCentBin][m]->Fill(embJet->Phi());
                  fJetEta_EMB[fCentBin][m]->Fill(embJet->Eta());
                  fJet_Phi_Eta_EMB[fCentBin][m]->Fill(embJet->Phi(),embJet->Eta());
-                 fJetPt_BG_EMB[fCentBin][m]->Fill(embJet->Pt() - embJet->Area() * fRhoVal);
-                 fJetDeltaPt[fCentBin][m]->Fill(embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
+                 fJetPt_BG_EMB[fCentBin][m]->Fill(embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal());
+                 fJetDeltaPt[fCentBin][m]->Fill(embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal() - embJet->MCPt());
                }
              }
 
@@ -2550,7 +1596,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                if(c_jet1_EMB[m] == 1)
                  {
                    if(leading_track_count[m] > 0){
-                     jet1_pt2[m] = embJet->Pt(); jet1_pt_BG2[m] = embJet->Pt() - embJet->Area() * fRhoVal; jet1_Deltapt[m] = embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt(); jet1_phi2[m] = embJet->Phi(); jet1_eta2[m] = embJet->Eta(); //Get Leading Jet(Jet1) value
+                     jet1_pt2[m] = embJet->Pt(); jet1_pt_BG2[m] = embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal(); jet1_Deltapt[m] = embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal() - embJet->MCPt(); jet1_phi2[m] = embJet->Phi(); jet1_eta2[m] = embJet->Eta(); //Get Leading Jet(Jet1) value
 
                      dEPJet2[m] = jet1_phi2[m] - fEPV0;
                      while (dEPJet2[m] < 0) dEPJet2[m] += TMath::Pi();
@@ -2562,7 +1608,7 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
 
                else if(c_jet1_EMB[m] > 1 && c_jet2_EMB[m] == 0  && leading_jet_count2[m] > 0 && leading_track_count[m] > 0)// sub leading
                  {
-                   jet2_pt2[m] = embJet->Pt(); jet2_pt_BG2[m] = embJet->Pt() - embJet->Area() * fRhoVal; jet2_Deltapt[m] = embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt(); jet2_phi2[m] = embJet->Phi(); jet2_eta2[m] = embJet->Eta(); //Get Sub Leading Jet(Jet2) value
+                   jet2_pt2[m] = embJet->Pt(); jet2_pt_BG2[m] = embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal(); jet2_Deltapt[m] = embJet->Pt() - embJet->Area() * fEmbJetsCont->GetRhoVal() - embJet->MCPt(); jet2_phi2[m] = embJet->Phi(); jet2_eta2[m] = embJet->Eta(); //Get Sub Leading Jet(Jet2) value
                    Delta_phi2[m] = jet1_phi2[m] - jet2_phi2[m]; Aj2[m] = (jet1_pt_BG2[m] - jet2_pt_BG2[m]) / (jet1_pt_BG2[m] + jet2_pt_BG2[m]);
                    if     (Delta_phi2[m] < (-1./2*TMath::Pi()))Delta_phi2[m] = Delta_phi2[m] +2*TMath::Pi();
                    else if(Delta_phi2[m] > (3./2*TMath::Pi()))Delta_phi2[m] = Delta_phi2[m] -2*TMath::Pi();
@@ -2612,12 +1658,11 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
 
 
            //jet-hadron
-           if (fEmbTracksCont) {
-             for(int m=0;m<3;m++){
-               //if find sub leading
+           for(int m=0;m<3;m++){
+             if (fEmbTracksCont) {//track cont
                int c_subleading_jet = 0;
                c_subleading_jet = subleading_jet_count2[m];
-               if(c_subleading_jet > 0){
+               if(c_subleading_jet > 0){//if find sub leading
 
                  AliVTrack *EMBtrack = static_cast<AliVTrack*>(fEmbTracksCont->GetNextAcceptParticle(0));
                  while(EMBtrack) {
@@ -2630,24 +1675,6 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                    if     (dphi < (-1./2.*TMath::Pi()))dphi = dphi +2*TMath::Pi();
                    else if(dphi > (3./2.*TMath::Pi()))dphi = dphi -2*TMath::Pi();
 
-                   //jet_track check
-                   /*Bool_t jet_switch=false;
-                     for(int i=0;i<200;i++){
-                     Float_t check_track1,check_track2;
-                     check_track1 = -999.0; check_track2 = -999.0;
-                     check_track1 = jet_track[m][0][i]; check_track2 = jet_track[m][1][i];
-                     if(check_track1 == phi){
-                     jet_switch=true;
-                     }
-                     if(check_track2 == phi){
-                     jet_switch=true;
-                     }
-                     }
-
-                     if(jet_switch==true){
-                     continue;
-                     }*/
-
                    //dphi cut
                    Bool_t dphi_cut[4];
                    //devide(jet side)
@@ -2754,87 +1781,12 @@ Bool_t AliAnalysisTaskDijetHadron::FillHistograms()
                      }
                    }//count1
 
-                   if(m==1){
-                     //hadron-dphi as dEPJet (jet leading track = 5GeV)
-                     for(int EPtri=0;EPtri<4;EPtri++){
-                       if(jet_dEP_switch[EPtri]){
-                         for(int pt_cut=0;pt_cut<4;pt_cut++){
-                           if(pt_switch[pt_cut]){
-                             for(int count1=0;count1<4;count1++){
-                               if(jet_dphi_switch[0]){
-                                 for(int count2=0;count2<count1+1;count2++){
-                                   if(jet1_pt_BG2[m] > Jet1_threshold[count1] && jet2_pt_BG2[m] > Jet2_threshold[count2]){
-                                     fHJetDeltaPhiasEP_Aj0_EMB[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-
-                                     if(Aj2[m] >= 0.0 && Aj2[m] < 0.2){
-                                       fHJetDeltaPhiasEP_Aj1_EMB[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                     }
-
-                                     if(Aj2[m] >= 0.2 && Aj2[m] < 0.4){
-                                       fHJetDeltaPhiasEP_Aj2_EMB[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                     }
-
-                                     if(Aj2[m] >= 0.4 && Aj2[m] < 0.6){
-                                       fHJetDeltaPhiasEP_Aj3_EMB[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                     }
-
-                                     if(Aj2[m] >= 0.6 && Aj2[m] <= 0.8){
-                                       fHJetDeltaPhiasEP_Aj4_EMB[fCentBin][EPtri][pt_cut][count1][count2]->Fill(dphi);
-                                     }
-                                   }
-
-
-                                 }//count2
-                               }
-                             }//count1
-                           }//pt cut
-                         }//pt for
-                       }//dEP cut
-                     }//dEP for
-
-                     //hadron-pT as dEPJet (jet lenading track = 5GeV)
-                     for(int EPtri=0;EPtri<4;EPtri++){
-                       if(jet_dEP_switch[EPtri]){
-                         for(int count1=0;count1<4;count1++){
-                           if(jet_dphi_switch[0]){
-                             for(int count2=0;count2<count1+1;count2++){
-                               if(jet1_pt_BG2[m] > Jet1_threshold[count1] && jet2_pt_BG2[m] > Jet2_threshold[count2]){
-                                 for(int i=0;i<4;i++){
-                                   if(dphi_cut[i]){
-                                     fHJetPtasEP_Aj0_EMB[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-
-                                     if(Aj2[m] >= 0.0 && Aj2[m] < 0.2){
-                                       fHJetPtasEP_Aj1_EMB[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                     }
-
-                                     if(Aj2[m] >= 0.2 && Aj2[m] < 0.4){
-                                       fHJetPtasEP_Aj2_EMB[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                     }
-
-                                     if(Aj2[m] >= 0.4 && Aj2[m] < 0.6){
-                                       fHJetPtasEP_Aj3_EMB[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                     }
-
-                                     if(Aj2[m] >= 0.6 && Aj2[m] <= 0.8){
-                                       fHJetPtasEP_Aj4_EMB[fCentBin][EPtri][i][count1][count2]->Fill(pt);
-                                     }
-                                   }//dphi cut
-                                 }//dphi loop
-                               }//jet pt cut
-
-                             }//count2
-                           }
-                         }//count1
-                       }//dEP cut
-                     }//dEP for
-                   }//jet leading track cut
-
                    EMBtrack = static_cast<AliVTrack*>(fEmbTracksCont->GetNextAcceptParticle());
                  }// track while
 
                }// if sub leading jet
-             }
-           }// tracks Cont
+             }// tracks Cont
+           }// jet leading track cut
 
          }// jet Cont
 
@@ -2860,109 +1812,6 @@ AliEmcalJet* AliAnalysisTaskDijetHadron::NextEmbeddedJet(Bool_t reset)
   return jet;
 }
 
-//________________________________________________________________________
-void AliAnalysisTaskDijetHadron::GetRandomCone(Float_t &pt, Float_t &eta, Float_t &phi,
-                                           AliParticleContainer* tracks, AliClusterContainer* clusters,
-                                           AliEmcalJet *jet, Bool_t bPartialExclusion) const
-{
-  // Get rigid cone.
-
-  eta = -999;
-  phi = -999;
-  pt = 0;
-
-  if (!tracks && !clusters)
-    return;
-
-  Float_t LJeta = 999;
-  Float_t LJphi = 999;
-
-  if (jet) {
-    LJeta = jet->Eta();
-    LJphi = jet->Phi();
-  }
-
-  Float_t maxEta = fConeMaxEta;
-  Float_t minEta = fConeMinEta;
-  Float_t maxPhi = fConeMaxPhi;
-  Float_t minPhi = fConeMinPhi;
-
-  if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
-  if (minPhi < 0) minPhi = 0;
-  
-  Float_t dLJ = 0;
-  Int_t repeats = 0;
-  Bool_t reject = kTRUE;
-  do {
-    eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
-    phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
-    dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
-
-    if(bPartialExclusion) {
-      reject = kFALSE;
-
-      TRandom3 rnd;
-      rnd.SetSeed(0);
-
-      Double_t ncoll = GetNColl();
-
-      Double_t prob = 0.;
-      if(ncoll>0)
-        prob = 1./ncoll;
-
-      if(rnd.Rndm()<=prob) reject = kTRUE; //reject cone
-    }
-
-    repeats++;
-  } while (dLJ < fMinRC2LJ && repeats < 999 && reject);
-
-  if (repeats == 999) {
-    AliWarning(Form("%s: Could not get random cone!", GetName()));
-    return;
-  }
-
-  if (clusters) {
-    AliVCluster* cluster = clusters->GetNextAcceptCluster(0);
-    while (cluster) {     
-      TLorentzVector nPart;
-      cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
-
-      Float_t cluseta = nPart.Eta();
-      Float_t clusphi = nPart.Phi();
-      
-      if (TMath::Abs(clusphi - phi) > TMath::Abs(clusphi - phi + 2 * TMath::Pi()))
-       clusphi += 2 * TMath::Pi();
-      if (TMath::Abs(clusphi - phi) > TMath::Abs(clusphi - phi - 2 * TMath::Pi()))
-       clusphi -= 2 * TMath::Pi();
-     
-      Float_t d = TMath::Sqrt((cluseta - eta) * (cluseta - eta) + (clusphi - phi) * (clusphi - phi));
-      if (d <= fConeRadius) 
-       pt += nPart.Pt();
-
-      cluster = clusters->GetNextAcceptCluster();
-    }
-  }
-
-  if (tracks) {
-    AliVParticle* track = tracks->GetNextAcceptParticle(0); 
-    while(track) { 
-      Float_t tracketa = track->Eta();
-      Float_t trackphi = track->Phi();
-      
-      if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
-       trackphi += 2 * TMath::Pi();
-      if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
-       trackphi -= 2 * TMath::Pi();
-      
-      Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
-      if (d <= fConeRadius)
-       pt += track->Pt();
-
-      track = tracks->GetNextAcceptParticle(); 
-    }
-  }
-}
-
 //________________________________________________________________________
 void AliAnalysisTaskDijetHadron::SetConeEtaPhiEMCAL()
 {
@@ -2992,29 +1841,9 @@ void AliAnalysisTaskDijetHadron::ExecOnce()
   if (fCaloClustersCont && fCaloClustersCont->GetArray() == 0) fCaloClustersCont = 0;
   if (fEmbTracksCont && fEmbTracksCont->GetArray() == 0) fEmbTracksCont = 0;
   if (fEmbCaloClustersCont && fEmbCaloClustersCont->GetArray() == 0) fEmbCaloClustersCont = 0;
-  //if (fRandTracksCont && fRandTracksCont->GetArray() == 0) fRandTracksCont = 0;
-  //if (fRandCaloClustersCont && fRandCaloClustersCont->GetArray() == 0) fRandCaloClustersCont = 0;
   if (fJetsCont && fJetsCont->GetArray() == 0) fJetsCont = 0;
   if (fMCJetsCont && fMCJetsCont->GetArray() == 0) fMCJetsCont = 0;
   if (fEmbJetsCont && fEmbJetsCont->GetArray() == 0) fEmbJetsCont = 0;
-
-  if (fRCperEvent < 0) {
-    Double_t area = (fConeMaxEta - fConeMinEta) * (fConeMaxPhi - fConeMinPhi);
-    Double_t rcArea = TMath::Pi() * fConeRadius * fConeRadius;
-    fRCperEvent = TMath::FloorNint(area / rcArea - 0.5);
-    if (fRCperEvent == 0)
-      fRCperEvent = 1;
-  }
-
-  if (fMinRC2LJ < 0)
-    fMinRC2LJ = fConeRadius * 1.5;
-
-  const Float_t maxDist = TMath::Max(fConeMaxPhi - fConeMinPhi, fConeMaxEta - fConeMinEta) / 2;
-  if (fMinRC2LJ > maxDist) {
-    AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
-                    "Will use fMinRC2LJ = %f", fMinRC2LJ, maxDist));
-    fMinRC2LJ = maxDist;
-  }
 }
 
 //________________________________________________________________________
@@ -3023,30 +1852,3 @@ Double_t AliAnalysisTaskDijetHadron::GetZ(const Double_t trkPx, const Double_t t
   return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/(jetPx*jetPx+jetPy*jetPy+jetPz*jetPz);
 }
 
-//________________________________________________________________________
-Double_t AliAnalysisTaskDijetHadron::GetNColl() const {
-  // Get NColl - returns value of corresponding bin
-  // only works for pA
-  // values taken from V0A slicing https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PACentStudies#Tables_with_centrality_bins_from
-
-  if(fBeamType == kpA) {
-
-    const Int_t nNCollBins = 7;
-
-    Double_t centMin[nNCollBins] = {0.,5.,10.,20.,40.,60.,80.};
-    Double_t centMax[nNCollBins] = {5.,10.,20.,40.,60.,80.,100.};
-
-    Double_t nColl[nNCollBins] = {14.7,13.,11.7,9.38,6.49,3.96,1.52};
-
-    for(Int_t i = 0; i<nNCollBins; i++) {
-      if(fCent>=centMin[i] && fCent<centMax[i])
-       return nColl[i];
-    }
-
-    return -1.;
-  }
-  else {
-    AliWarning(Form("%s: Only works for pA analysis. Returning -1",GetName()));
-    return -1.;
-  }
-}
index cab4f854a947635e9c861f52de29468bc94f855a..03815222f400a5308221642e83a95cd304b5e9bd 100644 (file)
@@ -43,10 +43,17 @@ class AliAnalysisTaskDijetHadron : public AliAnalysisTaskEmcalJet {
 
   void                        UserCreateOutputObjects();
 
-  void                        SetJetMinRC2LJ(Float_t d)                            { fMinRC2LJ                = d          ; }
-  void                        SetRCperEvent(Int_t n)                               { fRCperEvent              = n          ; }
   void                        SetMCJetPtThreshold(Double_t t)                      { fMCJetPtThreshold        = t          ; }
-  void                        SetConeRadius(Double_t r)                            { fConeRadius              = r          ; }
+  void                        SetLeadingHadronPtThreshold1(Double_t u1)            { fleadingHadronPtcut1     = u1         ; }
+  void                        SetLeadingHadronPtThreshold2(Double_t u2)            { fleadingHadronPtcut2     = u2         ; }
+  void                        SetLeadingHadronPtThreshold3(Double_t u3)            { fleadingHadronPtcut3     = u3         ; }
+  void                        SetJet1PtThreshold1(Double_t v1)                     { fJet1Ptcut1     = v1                  ; }
+  void                        SetJet1PtThreshold2(Double_t v2)                     { fJet1Ptcut2     = v2                  ; }
+  void                        SetJet1PtThreshold3(Double_t v3)                     { fJet1Ptcut3     = v3                  ; }
+  void                        SetJet2PtThreshold1(Double_t w1)                     { fJet2Ptcut1     = w1                  ; }
+  void                        SetJet2PtThreshold2(Double_t w2)                     { fJet2Ptcut2     = w2                  ; }
+  void                        SetJet2PtThreshold3(Double_t w3)                     { fJet2Ptcut3     = w3                  ; }
+  void                        SetConeRadius(Double_t r)                            { fConeRadius     = r                   ; }
   void                        SetConeEtaPhiEMCAL() ;
   void                        SetConeEtaPhiTPC()   ;
   void                        SetConeEtaLimits(Float_t min, Float_t max)           { fConeMinEta = min, fConeMaxEta = max  ; }
@@ -60,20 +67,23 @@ class AliAnalysisTaskDijetHadron : public AliAnalysisTaskEmcalJet {
   AliEmcalJet*                NextEmbeddedJet(Bool_t reset=kFALSE)                                                          ;
   void                        DoEmbTrackLoop()                                                                              ;
   void                        DoEmbClusterLoop()                                                                            ;
-  void                        GetRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliParticleContainer* tracks, AliClusterContainer* clusters,
-                                           AliEmcalJet *jet = 0, Bool_t bPartialExclusion = 0) const;
   Double_t                    GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz);
-  Double_t                    GetNColl() const;
-
 
   Double_t                    fMCJetPtThreshold;                               // threshold for MC jets
-  Float_t                     fMinRC2LJ;                                       // Minimum distance random cone to leading jet
-  Int_t                       fRCperEvent;                                     // No. of random cones per event
-  Double_t                    fConeRadius;                                     // Radius of the random cones
-  Float_t                     fConeMinEta;                                     // Minimum eta of the random cones
-  Float_t                     fConeMaxEta;                                     // Maximum eta of the random cones
-  Float_t                     fConeMinPhi;                                     // Minimum phi of the random cones
-  Float_t                     fConeMaxPhi;                                     // Maximum phi of the random cones
+  Double_t                    fleadingHadronPtcut1;                            // threshold for leading hadron pT NO1
+  Double_t                    fleadingHadronPtcut2;                            // threshold for leading hadron pT NO2
+  Double_t                    fleadingHadronPtcut3;                            // threshold for leading hadron pT NO3
+  Double_t                    fJet1Ptcut1;                                     // threshold for leading Jet pT NO1
+  Double_t                    fJet1Ptcut2;                                     // threshold for leading Jet pT NO2
+  Double_t                    fJet1Ptcut3;                                     // threshold for leading Jet pT NO3
+  Double_t                    fJet2Ptcut1;                                     // threshold for subleading Jet pT NO1
+  Double_t                    fJet2Ptcut2;                                     // threshold for subleading Jet pT NO2
+  Double_t                    fJet2Ptcut3;                                     // threshold for subleading Jet pT NO3
+  Double_t                    fConeRadius;                                     // Radius of the jet cones
+  Float_t                     fConeMinEta;                                     // Minimum eta of the jet cones
+  Float_t                     fConeMaxEta;                                     // Maximum eta of the jet cones
+  Float_t                     fConeMinPhi;                                     // Minimum phi of the jet cones
+  Float_t                     fConeMaxPhi;                                     // Maximum phi of the jet cones
 
   AliJetContainer            *fJetsCont;                                       //!PbPb Jets
   AliParticleContainer       *fTracksCont;                                     //!PbPb Tracks
@@ -84,36 +94,6 @@ class AliAnalysisTaskDijetHadron : public AliAnalysisTaskEmcalJet {
   AliJetContainer            *fEmbJetsCont;                                    //!EMB jets
   AliParticleContainer       *fEmbTracksCont;                                  //!EMB tracks
   AliClusterContainer        *fEmbCaloClustersCont;                            //!EMB clusters  
-  //AliParticleContainer       *fRandTracksCont;                               //!Randomized tracks
-  //AliClusterContainer        *fRandCaloClustersCont;                         //!Randomized clusters
-
-  // Random cones
-  TH2                        *fHistRCPhiEta;                                   //!Phi-Eta distribution of random cones
-  TH1                       **fHistRCPt;                                       //!Random cone pt
-  TH1                       **fHistRCPtExLJ;                                   //!Random cone pt, imposing min distance from leading jet
-  TH1                       **fHistRCPtExPartialLJ;                            //!Random cone pt, imposing min distance from leading jet with 1/ncoll probability
-  //TH1                       **fHistRCPtRand;                                 //!Random cone pt, randomized particles
-  TH2                       **fHistRhoVSRCPt;                                  //!Area(RC) * rho vs. Pt(RC)
-  TH2                       **fHistDeltaPtRCvsEP;                              //!deltaPt = Pt(RC) - A * rho vs. event plane
-  TH1                       **fHistDeltaPtRCExLJ;                              //!deltaPt = Pt(RC) - A * rho, imposing min distance from leading jet
-  TH1                       **fHistDeltaPtRCExPartialLJ;                       //!deltaPt = Pt(RC) - A * rho, imposing min distance from leading jet with 1/ncoll probability
-  //TH1                       **fHistDeltaPtRCRand;                            //!deltaPt = Pt(RC) - A * rho, randomzied particles
-
-  // Jet embedding
-  TH3                       **fHistEmbJetsPtArea;                              //!Pt vs. area of EMB jets
-  TH3                       **fHistEmbJetsCorrPtArea;                          //!Pt-rho*A vs. area of EMB jets
-  TH2                       **fHistEmbPartPtvsJetPt;                           //!MC jet pt total jet pt
-  TH2                       **fHistEmbPartPtvsJetCorrPt;                       //!MC jet pt total jet pt - rho*A
-  TH2                       **fHistJetPtvsJetCorrPt;                           //!Pt vs jet pt - rho*A
-  TH1                       **fHistDistLeadPart2JetAxis;                       //!Distance between leading particle and jet axis
-  TH2                       **fHistEmbBkgArea;                                 //!Pt(embjet) - Pt(embtrack) vs. area of EMB jets
-  TH2                       **fHistRhoVSEmbBkg;                                //!Area(embjet) * rho vs. Pt(embjet) - Pt(embtrack)
-  TH2                       **fHistDeltaPtEmbArea;                             //!deltaPt = Pt(embjet) - Area(embjet) * rho - Pt(embtrack) vs. Area(embjet)
-  TH2                       **fHistDeltaPtEmbvsEP;                             //!deltaPt = Pt(embjet) - Area(embjet) * rho - Pt(embtrack) vs. event plane
-  TH2                        *fHistRCPtExLJVSDPhiLJ;                           //!Random cone pt, imposing min distance from leading jet, vs. deltaPhi leading jet
-  TH2                        *fHistRCPtExPartialLJVSDPhiLJ;                    //!Random cone pt, imposing min distance from leading jet, vs. deltaPhi leading jet with 1/ncoll probability
-  TH2                        *fHistEmbJetsPhiEta;                              //!Phi-Eta distribution of EMB jets
-  TH2                        *fHistLeadPartPhiEta;                             //!Phi-Eta distribution of the leading particle of EMB jets
 
   //User Task
   TH1                        *fCent_V0;                                        //!Centrality
@@ -211,44 +191,9 @@ class AliAnalysisTaskDijetHadron : public AliAnalysisTaskEmcalJet {
   TH1                        *fHJetPt_Aj3_EMB[4][3][4][4][4];                  //!EMB, HjetPt, Aj3
   TH1                        *fHJetPt_Aj4_EMB[4][3][4][4][4];                  //!EMB, HjetPt, Aj4
 
-  TH1                        *fHJetDeltaPhiasEP_Aj0_PbPb[4][4][4][4][4];       //!PbPb, HjetDeltaPhi, asEP, no Aj cut
-  TH1                        *fHJetDeltaPhiasEP_Aj1_PbPb[4][4][4][4][4];       //!PbPb, HjetDeltaPhi, asEP, Aj1
-  TH1                        *fHJetDeltaPhiasEP_Aj2_PbPb[4][4][4][4][4];       //!PbPb, HjetDeltaPhi, asEP, Aj2
-  TH1                        *fHJetDeltaPhiasEP_Aj3_PbPb[4][4][4][4][4];       //!PbPb, HjetDeltaPhi, asEP, Aj3
-  TH1                        *fHJetDeltaPhiasEP_Aj4_PbPb[4][4][4][4][4];       //!PbPb, HjetDeltaPhi, asEP, Aj4
-  TH1                        *fHJetPtasEP_Aj0_PbPb[4][4][4][4][4];             //!PbPb, HjetPt, asEP, no Aj cut
-  TH1                        *fHJetPtasEP_Aj1_PbPb[4][4][4][4][4];             //!PbPb, HjetPt, asEP, Aj1
-  TH1                        *fHJetPtasEP_Aj2_PbPb[4][4][4][4][4];             //!PbPb, HjetPt, asEP, Aj2
-  TH1                        *fHJetPtasEP_Aj3_PbPb[4][4][4][4][4];             //!PbPb, HjetPt, asEP, Aj3
-  TH1                        *fHJetPtasEP_Aj4_PbPb[4][4][4][4][4];             //!PbPb, HjetPt, asEP, Aj4
-  TH1                        *fHJetDeltaPhiasEP_Aj0_MC[4][4][4][4][4];         //!MC, HjetDeltaPhi, asEP, no Aj cut
-  TH1                        *fHJetDeltaPhiasEP_Aj1_MC[4][4][4][4][4];         //!MC, HjetDeltaPhi, asEP, Aj1
-  TH1                        *fHJetDeltaPhiasEP_Aj2_MC[4][4][4][4][4];         //!MC, HjetDeltaPhi, asEP, Aj2
-  TH1                        *fHJetDeltaPhiasEP_Aj3_MC[4][4][4][4][4];         //!MC, HjetDeltaPhi, asEP, Aj3
-  TH1                        *fHJetDeltaPhiasEP_Aj4_MC[4][4][4][4][4];         //!MC, HjetDeltaPhi, asEP, Aj4
-  TH1                        *fHJetPtasEP_Aj0_MC[4][4][4][4][4];               //!MC, HjetPt, asEP, no Aj cut
-  TH1                        *fHJetPtasEP_Aj1_MC[4][4][4][4][4];               //!MC, HjetPt, asEP, Aj1
-  TH1                        *fHJetPtasEP_Aj2_MC[4][4][4][4][4];               //!MC, HjetPt, asEP, Aj2
-  TH1                        *fHJetPtasEP_Aj3_MC[4][4][4][4][4];               //!MC, HjetPt, asEP, Aj3
-  TH1                        *fHJetPtasEP_Aj4_MC[4][4][4][4][4];               //!MC, HjetPt, asEP, Aj4
-  TH1                        *fHJetDeltaPhiasEP_Aj0_EMB[4][4][4][4][4];        //!EMB, HjetDeltaPhi, asEP, no Aj cut
-  TH1                        *fHJetDeltaPhiasEP_Aj1_EMB[4][4][4][4][4];        //!EMB, HjetDeltaPhi, asEP, Aj1
-  TH1                        *fHJetDeltaPhiasEP_Aj2_EMB[4][4][4][4][4];        //!EMB, HjetDeltaPhi, asEP, Aj2
-  TH1                        *fHJetDeltaPhiasEP_Aj3_EMB[4][4][4][4][4];        //!EMB, HjetDeltaPhi, asEP, Aj3
-  TH1                        *fHJetDeltaPhiasEP_Aj4_EMB[4][4][4][4][4];        //!EMB, HjetDeltaPhi, asEP, Aj4
-  TH1                        *fHJetPtasEP_Aj0_EMB[4][4][4][4][4];              //!EMB, HjetPt, asEP, no Aj cut
-  TH1                        *fHJetPtasEP_Aj1_EMB[4][4][4][4][4];              //!EMB, HjetPt, asEP, Aj1
-  TH1                        *fHJetPtasEP_Aj2_EMB[4][4][4][4][4];              //!EMB, HjetPt, asEP, Aj2
-  TH1                        *fHJetPtasEP_Aj3_EMB[4][4][4][4][4];              //!EMB, HjetPt, asEP, Aj3
-  TH1                        *fHJetPtasEP_Aj4_EMB[4][4][4][4][4];              //!EMB, HjetPt, asEP, Aj4
-
-
  private:
   AliVEvent                  *fEvent;
   Double_t                    fCentrality;                                     //! V0M for current event
-  //AliNamedString             *fPtHardBinName;                                //!Pt hard bin param
-  //Int_t                       fPtHardBin;                                    //!        
-  //TH1F                        *fhPtHardBins;                                 //!
 
   AliAnalysisTaskDijetHadron(const AliAnalysisTaskDijetHadron&);                     // not implemented
   AliAnalysisTaskDijetHadron &operator=(const AliAnalysisTaskDijetHadron&);          // not implemented
index 1c2d886dbd3d7c0b25be241ea2afc7f8f257365c..63f5b1852694180f721d0e176730dfb4918733e2 100644 (file)
@@ -42,6 +42,9 @@
 
 #include "AliAnalysisTaskEmcalQGTagging.h"
 
+using std::cout;
+using std::endl;
+
 ClassImp(AliAnalysisTaskEmcalQGTagging)
 
 //________________________________________________________________________
index 00e685b83b86013a2562e52778093646f1eb627b..05e62169b705983e35908045bb0545d2c34b5164 100644 (file)
@@ -15,6 +15,7 @@
 #include "AliEmcalJet.h"
 #include "AliRhoParameter.h"
 #include "AliLog.h"
+#include "AliJetContainer.h"
 
 #include "AliAnalysisTaskSAJF.h"
 
@@ -24,6 +25,7 @@ ClassImp(AliAnalysisTaskSAJF)
 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() : 
   AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF", kTRUE),
   fHistoType(1),
+  fHistRejectionReason(0),
   fHistTracksJetPt(0),
   fHistClustersJetPt(0),
   fHistTracksPtDist(0),
@@ -54,6 +56,7 @@ AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() :
 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),
   fHistoType(1),
+  fHistRejectionReason(0),
   fHistTracksJetPt(0),
   fHistClustersJetPt(0),
   fHistTracksPtDist(0),
@@ -83,7 +86,7 @@ AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) :
 //________________________________________________________________________
 void AliAnalysisTaskSAJF::AllocateTHnSparse()
 {
-    TString title[20]= {""};
+  TString title[20]= {""};
   Int_t nbins[20]  = {0};
   Double_t min[20] = {0.};
   Double_t max[20] = {0.};
@@ -103,7 +106,7 @@ void AliAnalysisTaskSAJF::AllocateTHnSparse()
     dim++;
   }
 
-  title[dim] = "#eta";
+  title[dim] = "#eta_{jet}";
   nbins[dim] = 100;
   min[dim] = -1;
   max[dim] = 1;
@@ -339,6 +342,7 @@ void AliAnalysisTaskSAJF::UserCreateOutputObjects()
   fHistClustersJetPt = new TH2*[fNcentBins];
   fHistTracksPtDist = new TH2*[fNcentBins];
   fHistClustersPtDist = new TH2*[fNcentBins];
+  fHistRejectionReason = new TH2*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
     TString histname;
@@ -378,6 +382,15 @@ void AliAnalysisTaskSAJF::UserCreateOutputObjects()
       fHistClustersPtDist[i]->GetZaxis()->SetTitle("counts");
       fOutput->Add(fHistClustersPtDist[i]);
     }
+
+    histname = "fHistRejectionReason_";
+    histname += i;
+    fHistRejectionReason[i] = new TH2F(histname, histname, 32, 0, 32, 100, 0, 250);
+    fHistRejectionReason[i]->GetXaxis()->SetTitle("Rejection reason");
+    fHistRejectionReason[i]->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
+    fHistRejectionReason[i]->GetZaxis()->SetTitle("counts");
+    SetRejectionReasonLabels(fHistRejectionReason[i]->GetXaxis());
+    fOutput->Add(fHistRejectionReason[i]);
   }
 
   PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
@@ -389,22 +402,23 @@ Bool_t AliAnalysisTaskSAJF::FillHistograms()
 {
   // Fill histograms.
 
-  if (!fJets) {
-    AliError(Form("%s - Jet array not provided, returning...", GetName()));
-    return kFALSE;
-  }
+  AliJetContainer *jets = static_cast<AliJetContainer*>(fJetCollArray.At(0));
 
-  for (Int_t ij = 0; ij < fJets->GetEntriesFast(); ij++) {
-
-    AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(ij));
+  if (!jets) return kFALSE;
+  
+  AliEmcalJet* jet = 0;
 
+  jets->ResetCurrentID();
+  while ((jet = jets->GetNextJet())) {
     if (!jet) {
-      AliError(Form("Could not receive jet %d", ij));
+      AliError("Could not receive jet!");
       continue;
     }
 
-    if (!AcceptJet(jet))
+    if (!jets->AcceptJet(jet)) {
+      fHistRejectionReason[fCentBin]->Fill(jets->GetRejectionReasonBitPosition(), jet->Pt());
       continue;
+    }
 
     Float_t ptLeading = GetLeadingHadronPt(jet);
     Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
index eb6a18febddd3f9a6cfe0afa42857c47ff55b039..25e8c8e41a6d487762fa4643ed232ce259067743 100644 (file)
@@ -29,6 +29,7 @@ class AliAnalysisTaskSAJF : public AliAnalysisTaskEmcalJet {
 
   Int_t                       fHistoType;                      // histogram type (0=TH2, 1=THnSparse)
 
+  TH2                       **fHistRejectionReason;         //!Rejection reason vs. jet pt
   TH2                       **fHistTracksJetPt;             //!Track pt vs. jet pt
   TH2                       **fHistClustersJetPt;           //!Cluster pt vs. jet pt
   TH2                       **fHistTracksPtDist;            //!Track pt vs. distance form jet axis
index baf2f759f5757ac7f0fc7275b3667560b2ca6dd0..10568d782d5756e054d916191843ad9fea5ba717 100644 (file)
@@ -1,19 +1,30 @@
+// $Id$
+
 AliAnalysisTaskDijetHadron* AddTaskDijetHadron(
   const char *ntracks            = "Tracks",
   const char *nclusters          = "CaloClusters",
   const char *njets              = "Jets",
-  const char *nMCtracks            = "TracksMC",
-  const char *nMCclusters          = "CaloClustersMC",
-  const char *nMCjets              = "JetsMC",
+  const char *nMCtracks          = "TracksMC",
+  const char *nMCclusters        = "CaloClustersMC",
+  const char *nMCjets            = "JetsMC",
   const char *nembtracks         = "TracksEmbedded",
   const char *nembclusters       = "CaloClustersEmbedded",
   const char *nembjets           = "EmbJets",
   const char *nrandtracks        = "TracksRandomized",
   const char *nrandclusters      = "CaloClustersRandomized",
-  const char *nPbPbrho               = "Rho",
-  const char *nMCrho               = "RhoMC",
-  const char *nEMBrho               = "RhoEMB",
+  const char *nPbPbrho           = "Rho",
+  const char *nMCrho             = "RhoMC",
+  const char *nEMBrho            = "RhoEMB",
   Double_t    jetradius          = 0.2,
+  Double_t    leadinghadron1     = 0.0,
+  Double_t    leadinghadron2     = 3.0,
+  Double_t    leadinghadron3     = 5.0,
+  Double_t    jet1pt1            = 10.0,
+  Double_t    jet1pt2            = 20.0,
+  Double_t    jet1pt3            = 30.0,
+  Double_t    jet2pt1            = 10.0,
+  Double_t    jet2pt2            = 20.0,
+  Double_t    jet2pt3            = 30.0,
   Double_t    jetareacut         = 0.557,
   Double_t    trackptcut         = 0.15,
   Double_t    clusptcut          = 0.30,
@@ -26,7 +37,7 @@ AliAnalysisTaskDijetHadron* AddTaskDijetHadron(
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr)
   {
-    ::Error("AddTaskHJetCorr", "No analysis manager to connect to.");
+    ::Error("AddTaskDijetHadron", "No analysis manager to connect to.");
     return NULL;
   }  
   
@@ -34,7 +45,7 @@ AliAnalysisTaskDijetHadron* AddTaskDijetHadron(
   //==============================================================================
   if (!mgr->GetInputEventHandler())
   {
-    ::Error("AddTaskHJetCorr", "This task requires an input event handler");
+    ::Error("AddTaskDijetHadron", "This task requires an input event handler");
     return NULL;
   }
   
@@ -53,6 +64,15 @@ AliAnalysisTaskDijetHadron* AddTaskDijetHadron(
 
   AliAnalysisTaskDijetHadron* jetTask = new AliAnalysisTaskDijetHadron(name);
   jetTask->SetConeRadius(jetradius);
+  jetTask->SetLeadingHadronPtThreshold1(leadinghadron1);
+  jetTask->SetLeadingHadronPtThreshold2(leadinghadron2);
+  jetTask->SetLeadingHadronPtThreshold3(leadinghadron3);
+  jetTask->SetJet1PtThreshold1(jet1pt1);
+  jetTask->SetJet1PtThreshold2(jet1pt2);
+  jetTask->SetJet1PtThreshold3(jet1pt3);
+  jetTask->SetJet2PtThreshold1(jet2pt1);
+  jetTask->SetJet2PtThreshold2(jet2pt2);
+  jetTask->SetJet2PtThreshold3(jet2pt3);
   jetTask->SetRhoName(nPbPbrho,-1);
   if (strcmp(type,"TPC")==0) 
     jetTask->SetConeEtaPhiTPC();
@@ -122,18 +142,6 @@ AliAnalysisTaskDijetHadron* AddTaskDijetHadron(
     embJetCont->ConnectClusterContainer(embClusCont);
   }
 
-  /*AliParticleContainer *randPartCont = jetTask->AddParticleContainer(nrandtracks);
-  if (randPartCont) {
-    randPartCont->SetName("RandTracks");
-    randPartCont->SetParticlePtCut(trackptcut);
-  }
-
-  AliClusterContainer *randClusCont = jetTask->AddClusterContainer(nrandclusters);    
-  if (randClusCont) {
-    randClusCont->SetName("RandClusters");
-    randClusCont->SetClusPtCut(clusptcut);
-  }*/
-  
   //-------------------------------------------------------
   // Final settings, pass to manager and set the containers
   //-------------------------------------------------------
index 791a5edba96b7f577041b4a98b5bfbc52422434f..8169f21d57c8b9faf58c790d3f1442840f619148 100644 (file)
@@ -67,6 +67,9 @@
 #include "TGeoGlobalMagField.h"
 #include "AliMagF.h"
 
+using std::cout;
+using std::endl;
+
 ClassImp(AliAnalysisTaskEmcalJetHF)
 
 //________________________________________________________________________
index 481ec6198f89dfa71bc5f608754d7fadcbbbdb36..c5c61d4a5eb28d843b50f891361eeea85f39d9ab 100644 (file)
@@ -206,7 +206,7 @@ Bool_t ConfigD0
       out->AddAxis(ptID, 200, 0.0, 20.0);
       
       // axiz Z: pseudorapidity
-      if(sanityhistos==kTRUE) out->AddAxis(etaID, 100, -1, 1);
+      //if(sanityhistos==kTRUE) out->AddAxis(etaID, 100, -1, 1);
          
       
       if (!isPP)  {if(!centortracklets) out->AddAxis(centID, 100, 0.0, 100.0);
@@ -237,7 +237,7 @@ Bool_t ConfigD0
    // binnings
    out->AddAxis(imID, bins, min_inv_mass, max_inv_mass);
    out->AddAxis(ptID, 200, 0.0, 20.0);
-   out->AddAxis(etaID, 100, -1, 1);
+   //out->AddAxis(etaID, 100, -1, 1);
 
 
    if (!isPP)  {if(!centortracklets) out->AddAxis(centID, 100, 0.0, 100.0);
@@ -261,7 +261,7 @@ Bool_t ConfigD0
    // binnings
    out->AddAxis(imID, bins, min_inv_mass, max_inv_mass);
    out->AddAxis(ptID, 200, 0.0, 20.0);
-   out->AddAxis(etaID, 100, -1, 1);
+   //out->AddAxis(etaID, 100, -1, 1);
 
    if (!isPP)  {if(!centortracklets) out->AddAxis(centID, 100, 0.0, 100.0);
                        else out->AddAxis(trackletsID, 400, 0.0, 400.0);}
index 4793a8f3b7de3ec72714b83af5b713abe1323462..b06a4646abc0ef1dddde5eaf75aa832530f383e3 100644 (file)
@@ -36,13 +36,26 @@ Bool_t ConfigTPCanalysisKStar
   AliRsnCutSetDaughterParticle * cutSetPi;
   AliRsnCutSetDaughterParticle * cutSetK;
 
-  cutSetQ  = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0, aodFilterBit);
-  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCPbPb2010_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
-  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCPbPb2010_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+  //2010 cuts
+  //cutSetQ  = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0, aodFilterBit);
+  //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCPbPb2010_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
+  //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCPbPb2010_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+  
+  //2011 High-pT cuts
+  cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
+  cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
+  
+  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
+  cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
+  
+  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
+  cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
+
 
   Int_t iCutQ = task->AddTrackCuts(cutSetQ);
   Int_t iCutPi = task->AddTrackCuts(cutSetPi);
   Int_t iCutK = task->AddTrackCuts(cutSetK);
+
   
   if(enableMonitor){
     Printf("======== Monitoring cut AliRsnCutSetDaughterParticle enabled");
@@ -97,7 +110,7 @@ Bool_t ConfigTPCanalysisKStar
       out->AddAxis(resID, 200, -0.02, 0.02);
     
     // axis Y: transverse momentum
-    out->AddAxis(ptID, 200, 0.0, 20.0);
+    out->AddAxis(ptID, 300, 0.0, 30.0);
     
     // axis Z: centrality-multiplicity
     if (!isPP)
index 61a6b7e3e3da24a0949b52106315a6a300d5ca07..e856dd6f23389c3c2dba0b90436b071b9f09153c 100644 (file)
@@ -37,9 +37,21 @@ Bool_t ConfigTPCanalysisKStarMC
   AliRsnCutSetDaughterParticle * cutSetPi;
   AliRsnCutSetDaughterParticle * cutSetK;
 
-  cutSetQ  = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0, aodFilterBit);
-  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCpp2011_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
-  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCpp2011_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+  //2010 cuts 
+  //cutSetQ  = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0, aodFilterBit);
+  //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCpp2011_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
+  //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCpp2011_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+
+
+  //2011 High-pT cuts                      
+  cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
+  cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
+  cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
+  cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
+
+
 
   Int_t iCutQ = task->AddTrackCuts(cutSetQ);
   Int_t iCutPi = task->AddTrackCuts(cutSetPi);
@@ -99,7 +111,7 @@ Bool_t ConfigTPCanalysisKStarMC
     //out->AddAxis(resID, 200, -0.02, 0.02);
     
     // axis Y: transverse momentum
-    out->AddAxis(ptID, 200, 0.0, 20.0);
+    out->AddAxis(ptID, 300, 0.0, 30.0);
     
     // axis Z: centrality-multiplicity
     if (!isPP)
@@ -127,7 +139,7 @@ Bool_t ConfigTPCanalysisKStarMC
     outm->SetPairCuts(cutsPair);
     // binnings
     outm->AddAxis(imID, 90, 0.6, 1.5);
-    outm->AddAxis(ptID, 200, 0.0, 20.0);
+    outm->AddAxis(ptID, 300, 0.0, 30.0);
     if (!isPP){
     outm->AddAxis(centID, 100, 0.0, 100.0);
     }   else { 
index fb9b60ef22e2f5a0a37242fedbb6df5385264907..b66097382d4d2a274681458e21b4b5ec53632c04 100644 (file)
@@ -1155,16 +1155,21 @@ Double_t AlidNdPtAnalysisPbPbAOD::RotatePhi(Double_t phiTrack, Double_t phiEP)
   {
        return dPhi;
   }
-  if( (dPhi > TMath::Pi()) && (dPhi <= 3./2.*TMath::Pi()) )
+  if( dPhi > TMath::Pi() )
   {
-       dPhi = dPhi - TMath::Pi()/2.;
-       return dPhi;
-  }
-  if( (dPhi > 3./2.*TMath::Pi()) )
-  {
-       dPhi = dPhi - 3./2.*TMath::Pi();
+       dPhi = TMath::Pi()/2. - dPhi;
        return dPhi;
   }
+//   if( (dPhi > TMath::Pi()) && (dPhi <= 3./2.*TMath::Pi()) )
+//   {
+//     dPhi = dPhi - TMath::Pi()/2.;
+//     return dPhi;
+//   }
+//   if( (dPhi > 3./2.*TMath::Pi()) )
+//   {
+//     dPhi = dPhi - 3./2.*TMath::Pi();
+//     return dPhi;
+//   }
 //   if( dPhi < 0 )
 //   
 //   if ((dPhi >= -1./2. * TMath::Pi() ) && 
index a9feac7cecd765b2b72e72b84e207de8c8affc39..487514750102a58865551339713b580cc7365cd3 100644 (file)
@@ -194,11 +194,11 @@ void AliAnalysisTaskV2AllChAOD::UserCreateOutputObjects()
   
   if( fFillTHn ){ 
     //dimensions of THnSparse for Q vector checks
-    const Int_t nvarev=7;
-    //                                             cent         q-rec_perc        qvec-rec      q-gen_tracks   qvec-gen_vzero             Nch      qrec-qgen
-    Int_t    binsHistRealEv[nvarev] = {     fnCentBins,              100,        fnQvecBins,     fnQvecBins,       fnQvecBins,     fnNchBins,       40};
-    Double_t xminHistRealEv[nvarev] = {             0.,               0.,                0.,             0.,               0.,            0.,      -2.};
-    Double_t xmaxHistRealEv[nvarev] = {           100.,             100.,     fQvecUpperLim,  fQvecUpperLim,    fQvecUpperLim,         2000.,       2.};
+    const Int_t nvarev=6;
+    //                                             cent         q-rec_perc        qvec-rec      q-gen_tracks   qvec-gen_vzero          Nch
+    Int_t    binsHistRealEv[nvarev] = {     fnCentBins,              100,        fnQvecBins,     fnQvecBins,       fnQvecBins,     fnNchBins};
+    Double_t xminHistRealEv[nvarev] = {             0.,               0.,                0.,             0.,               0.,            0.};
+    Double_t xmaxHistRealEv[nvarev] = {           100.,             100.,     fQvecUpperLim,  fQvecUpperLim,    fQvecUpperLim,         2000.};
     
     THnSparseF* NSparseHistEv = new THnSparseF("NSparseHistEv","NSparseHistEv",nvarev,binsHistRealEv,xminHistRealEv,xmaxHistRealEv);
     NSparseHistEv->GetAxis(0)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
@@ -219,10 +219,6 @@ void AliAnalysisTaskV2AllChAOD::UserCreateOutputObjects()
     NSparseHistEv->GetAxis(5)->SetTitle("Ncharged");
     NSparseHistEv->GetAxis(5)->SetName("Nch");
     fOutput->Add(NSparseHistEv);
-    
-    NSparseHistEv->GetAxis(6)->SetTitle("#Delta q-vec");
-    NSparseHistEv->GetAxis(6)->SetName("Delta_qvec");
-    fOutput->Add(NSparseHistEv);
   }
   
   fCentrality = new TH1D("fCentrality", "centrality distribution; centrality", 200, 0., 100);
@@ -458,14 +454,11 @@ void AliAnalysisTaskV2AllChAOD::UserExec(Option_t *)
   if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
   
   //Get q-vector percentile.
-  Double_t QvecVZERO=fEventCuts->GetQvecPercentile(fVZEROside);
-  
-  Double_t QvecMC = fEventCuts->GetQvecPercentileMC(fVZEROside, fQgenType);
-
   Double_t Qvec=0.;
-  if(fIsMC && fQvecGen) Qvec = QvecMC;
-  else Qvec = QvecVZERO;
+  if(fIsMC && fQvecGen) Qvec = fEventCuts->GetQvecPercentileMC(fVZEROside, fQgenType);
+  else Qvec = fEventCuts->GetQvecPercentile(fVZEROside);
 
+  
   Double_t Cent=(fDoCentrSystCentrality)?1.01*fEventCuts->GetCent():fEventCuts->GetCent();
   fCentrality->Fill(Cent);
   
@@ -674,26 +667,24 @@ void AliAnalysisTaskV2AllChAOD::UserExec(Option_t *)
     
   if( fFillTHn ){ 
 
+    
+    Double_t varEv[6];
+    varEv[0]=Cent;
+    varEv[1]=(Double_t)Qvec; // qvec_rec_perc
+    
     Double_t qvzero = 0.;
     if(fVZEROside==0)qvzero=(Double_t)fEventCuts->GetqV0A();
     else if (fVZEROside==1)qvzero=(Double_t)fEventCuts->GetqV0C(); // qvec_rec
-    
-    Double_t varEv[7];
-    varEv[0]=Cent;
-    varEv[1]=(Double_t)QvecVZERO; // qvec_rec_perc
     varEv[2]=(Double_t)qvzero; // qvec from VZERO
     
     Double_t qgen_tracks = (Double_t)fEventCuts->CalculateQVectorMC(fVZEROside, 0);
     varEv[3]= (Double_t)qgen_tracks;
     
-    Double_t qgen_vzero = fEventCuts->CalculateQVectorMC(fVZEROside, 1);
+    Double_t qgen_vzero = (Double_t)fEventCuts->CalculateQVectorMC(fVZEROside, 1);
     varEv[4]= (Double_t)qgen_vzero;
     
     varEv[5]=(Double_t)fEventCuts->GetNch(); // Nch
     
-    Double_t delta_q = qgen_tracks - qgen_vzero;
-    varEv[6]=(Double_t)delta_q;
-    
     ((THnSparseF*)fOutput->FindObject("NSparseHistEv"))->Fill(varEv);//event loop
 
   }
@@ -757,9 +748,6 @@ void  AliAnalysisTaskV2AllChAOD::MCclosure(Double_t qvec){
             if (!(partMC->IsPhysicalPrimary()))
                 continue;
             
-            if (partMC->Charge() == 0)
-                continue;
-
            if(partMC->Eta()<fTrackCuts->GetEtaMin() || partMC->Eta()>fTrackCuts->GetEtaMax()) continue;
          
            //Printf("a particle");
index 8e4f57d04bf6a81d65b258f84e2d2066aad52cab..dc2ac10781d282abe9cf2ea38407fb8251867c26 100644 (file)
@@ -665,7 +665,7 @@ Double_t AliSpectraAODEventCuts::GetQvecPercentile(Int_t v0side){
   
   if(fQvecCalibType==1){
     if(fNch<0.) return -999.;
-    ic = GetNchBin();
+    ic = GetNchBin(fQvecIntegral);
   } else ic = (Int_t)fCent; //fQvecIntegral: 1% centrality bin
   
   TH1D *h1D = (TH1D*)fQvecIntegral->ProjectionY("h1D",ic+1,ic+1);
@@ -879,7 +879,7 @@ Double_t AliSpectraAODEventCuts::GetQvecPercentileMC(Int_t v0side, Int_t type=1)
   
   if(fQvecCalibType==1){
     if(fNch<0.) return -999.;
-    ic = GetNchBin();
+    ic = GetNchBin(fQgenIntegral);
   } else ic = (Int_t)fCent; //fQvecIntegral: 1% centrality bin
   
   TH1D *h1D = (TH1D*)fQgenIntegral->ProjectionY("h1Dgen",ic+1,ic+1);
@@ -927,13 +927,13 @@ Bool_t AliSpectraAODEventCuts::CheckSplineArray(TObjArray * splarr, Int_t n){
 }
 
 //______________________________________________________
-Int_t AliSpectraAODEventCuts::GetNchBin(){
+Int_t AliSpectraAODEventCuts::GetNchBin(TH2D * h){
   
-  Double_t xmax = fQvecIntegral->GetXaxis()->GetXmax();
+  Double_t xmax = h->GetXaxis()->GetXmax();
   
-  if(fNch>xmax) return fQvecIntegral->GetNbinsX();
+  if(fNch>xmax) return (Int_t)h->GetNbinsX();
   
-  return (fNch*fQvecIntegral->GetNbinsX())/fQvecIntegral->GetXaxis()->GetXmax();
+  return (fNch*h->GetNbinsX())/h->GetXaxis()->GetXmax();
   
 }
 
index f38ce2529857d0726713baa0787d6cf4de8907f5..007465f5a4261cdf3660e1df5ebf308f0f90f387 100644 (file)
@@ -171,7 +171,7 @@ class AliSpectraAODEventCuts : public TNamed
   Int_t GetNch() { return fNch; }
   
   void SetQVecCalibType(Int_t val) { fQvecCalibType=val; }  //0. centrality - 1. Nch
-  Int_t GetNchBin();
+  Int_t GetNchBin(TH2D * h);
   
   Double_t CalculateQVectorMC(Int_t v0side, Int_t type);
   Double_t GetQvecPercentileMC(Int_t v0side, Int_t type);
index dff3c542416990a4983a1d154d335080d629fcd1..757a78fd8bcce862da35bea7a8bc762f5f747a6f 100644 (file)
@@ -309,7 +309,9 @@ AliAnalysisTaskStrangenessVsMultiplicityMC::AliAnalysisTaskStrangenessVsMultipli
        fHistPtVsAmpV0MEq_GenXiMinus(0),
        fHistPtVsAmpV0MEq_GenXiPlus(0),
        fHistPtVsAmpV0MEq_GenOmegaMinus(0),
-       fHistPtVsAmpV0MEq_GenOmegaPlus(0)  
+       fHistPtVsAmpV0MEq_GenOmegaPlus(0),
+       fHistVZEROResponseStudy(0),
+  fHistVZEROResponseStudyTotal(0)
 
 //------------------------------------------------
 // Tree Variables 
@@ -530,7 +532,9 @@ AliAnalysisTaskStrangenessVsMultiplicityMC::AliAnalysisTaskStrangenessVsMultipli
        fHistPtVsAmpV0MEq_GenXiMinus(0),
        fHistPtVsAmpV0MEq_GenXiPlus(0),
        fHistPtVsAmpV0MEq_GenOmegaMinus(0),
-       fHistPtVsAmpV0MEq_GenOmegaPlus(0)
+       fHistPtVsAmpV0MEq_GenOmegaPlus(0),
+       fHistVZEROResponseStudy(0),
+  fHistVZEROResponseStudyTotal(0)
 {
 
   //Re-vertex: Will only apply for cascade candidates
@@ -1052,6 +1056,16 @@ void AliAnalysisTaskStrangenessVsMultiplicityMC::UserCreateOutputObjects()
     "fHistPtVsAmpV0MEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
     fListHist->Add(fHistPtVsAmpV0MEq_GenOmegaPlus); }  
 
+  if(! fHistVZEROResponseStudy ) {
+    fHistVZEROResponseStudy    = new TH2D( 
+    "fHistVZEROResponseStudy",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
+    fListHist->Add(fHistVZEROResponseStudy); }  
+    
+  if(! fHistVZEROResponseStudyTotal ) {
+    fHistVZEROResponseStudyTotal    = new TH2D( 
+    "fHistVZEROResponseStudyTotal",       "Generated;p_{T} (GeV/c); Mult",5000,0,500,lAmplitudeBins,0,lMaxAmplitude);   
+    fListHist->Add(fHistVZEROResponseStudyTotal); } 
+
    //List of Histograms: Normal
    PostData(1, fListHist);
 
@@ -1243,6 +1257,9 @@ void AliAnalysisTaskStrangenessVsMultiplicityMC::UserExec(Option_t *)
   Long_t lNchVZEROA = 0; 
   Long_t lNchVZEROC = 0; 
 
+  Float_t lPtOfParticleInsideVZEROA = -1; 
+  Float_t lPOfParticleInsideVZEROA = -1; 
+
   //----- Loop on Stack ----------------------------------------------------------------
   for (Int_t iCurrentLabelStack = 0;  iCurrentLabelStack < (lMCstack->GetNtrack()); iCurrentLabelStack++) 
   {// This is the begining of the loop on tracks
@@ -1259,9 +1276,11 @@ void AliAnalysisTaskStrangenessVsMultiplicityMC::UserExec(Option_t *)
       if( TMath::Abs(geta) < 0.5 ) lNchEta5++; 
       if( TMath::Abs(geta) < 0.8 ) lNchEta8++; 
       if( 2.8 < geta && geta < 5.1 ) lNchVZEROA++; 
+      if( 2.8 < geta && geta < 5.1 ) lPtOfParticleInsideVZEROA = particleOne->Pt(); 
+      if( 2.8 < geta && geta < 5.1 ) lPOfParticleInsideVZEROA = particleOne->P(); 
       if(-3.7 < geta && geta <-1.7 ) lNchVZEROC++; 
   }//End of loop on tracks
-
+  
   //Attribution 
   fTrueMultEta5 = lNchEta5; 
   fTrueMultEta8 = lNchEta8; 
@@ -1297,6 +1316,9 @@ void AliAnalysisTaskStrangenessVsMultiplicityMC::UserExec(Option_t *)
   fAmplitude_V0A = multV0ACorr; 
   fAmplitude_V0C = multV0CCorr; 
 
+  if( fTrueMultVZEROA == 1 ) fHistVZEROResponseStudy->Fill( lPtOfParticleInsideVZEROA , fAmplitude_V0A ); 
+  if( fTrueMultVZEROA == 1 ) fHistVZEROResponseStudyTotal->Fill( lPOfParticleInsideVZEROA , fAmplitude_V0A ); 
+
   // Equalized signals // From AliCentralitySelectionTask
   for(Int_t iCh = 4; iCh < 7; ++iCh) {
     Double_t mult = lESDevent->GetVZEROEqMultiplicity(iCh);
index d47e1911da4370e9e5b14159a794705661e68640..21d58b703b882ec02dec425deae780e4c1273f92 100644 (file)
@@ -350,6 +350,9 @@ class AliAnalysisTaskStrangenessVsMultiplicityMC : public AliAnalysisTaskSE {
   TH2D *fHistPtVsAmpV0MEq_GenXiPlus;       //! 
   TH2D *fHistPtVsAmpV0MEq_GenOmegaMinus;   //! 
   TH2D *fHistPtVsAmpV0MEq_GenOmegaPlus;    //!  
+  
+  TH2D *fHistVZEROResponseStudy; //! 
+  TH2D *fHistVZEROResponseStudyTotal; //! 
 
 
    AliAnalysisTaskStrangenessVsMultiplicityMC(const AliAnalysisTaskStrangenessVsMultiplicityMC&);            // not implemented
index 8bf5f145cb831cd69640a7ee5e7462cc541e2390..61a85c56c6361f48ac26c0a94deb7cd05d148873 100644 (file)
@@ -3594,7 +3594,7 @@ void AliAnalysisTaskLambdaOverK0sJets::V0Loop(V0LoopStep_t step, Bool_t isTrigge
     // *******************
     //   K0s selection
     // *******************
-    if (ctK && (TMath::Abs(rapK0s)<fYMax) && ( lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && ( massK0s > 0.3979 && massK0s < 0.5981 ) ) {
+    if (ctK && (TMath::Abs(rapK0s)<fYMax) && ( lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && ( massK0s > 0.3979 && massK0s < 0.5981 ) && lCheckMcK0Short ) {
       
       switch(step) {
       case kTriggerCheck: 
@@ -3759,7 +3759,7 @@ void AliAnalysisTaskLambdaOverK0sJets::V0Loop(V0LoopStep_t step, Bool_t isTrigge
     // *******************
     // Lambda selection
     // *******************
-    if ( ctL && (TMath::Abs(rapLambda)<fYMax) && (massLambda > 1.0649 && massLambda < 1.1651 ) && (TMath::Abs(nsigPosProton)<fNSigma) ){
+    if ( ctL && (TMath::Abs(rapLambda)<fYMax) && (massLambda > 1.0649 && massLambda < 1.1651 ) && (TMath::Abs(nsigPosProton)<fNSigma) && lCheckMcLambda ){
 
       switch(step) {
       case kTriggerCheck: 
@@ -3928,7 +3928,7 @@ void AliAnalysisTaskLambdaOverK0sJets::V0Loop(V0LoopStep_t step, Bool_t isTrigge
     // *******************
     // AntiLambda selection
     // *******************
-    if ( ctAL && (TMath::Abs(rapLambda)<fYMax)  && (massAntiLambda > 1.0649 && massAntiLambda < 1.1651 ) && (TMath::Abs(nsigNegProton)<fNSigma) ) {
+    if ( ctAL && (TMath::Abs(rapLambda)<fYMax)  && (massAntiLambda > 1.0649 && massAntiLambda < 1.1651 ) && (TMath::Abs(nsigNegProton)<fNSigma) && lCheckMcAntiLambda ) {
       
       switch(step) {
       case kTriggerCheck: 
index f19892cf333dafab3783f7533f33ab8e8d19639d..f7d426453330fb7d99b2ba92e5254e103cb51305 100644 (file)
@@ -258,6 +258,10 @@ install ( DIRECTORY macros
          DESTINATION PWGPP 
          PATTERN ".d"  EXCLUDE 
          PATTERN ".so" EXCLUDE)
+install ( DIRECTORY CalibMacros 
+         DESTINATION PWGPP 
+         PATTERN ".d"  EXCLUDE 
+         PATTERN ".so" EXCLUDE)
 install ( DIRECTORY PilotTrain
          DESTINATION PWGPP/ 
          PATTERN ".d"  EXCLUDE 
@@ -266,6 +270,9 @@ install ( FILES HMPID/AddTaskHmpidQA.C
          DESTINATION PWGPP/HMPID)
 install ( FILES T0/AddTaskT0QA.C
          DESTINATION PWGPP/T0)
+install ( FILES TOF/AddTaskTOFQA.C
+                TOF/AddTaskTOFqaID.C
+         DESTINATION PWGPP/TOF)
 install ( FILES TOF/AddTaskTOFQA.C
          DESTINATION PWGPP/TOF)
 install ( DIRECTORY TPC/macros
@@ -277,7 +284,8 @@ install ( FILES ZDC/AddTaskZDCQA.C
          DESTINATION PWGPP/ZDC)
 install ( FILES PilotTrain/AddTaskMuonQA.C
          DESTINATION PWGPP/PilotTrain/ )
-
+install ( FILES VZERO/AddTaskVZEROPbPb.C
+          DESTINATION PWGPP/VZERO/ )
 #
 # EOF
 #
index d7764a4ca7eb9d66ba05b314d208bcc628c9dfd1..1066c0613cbea4bc2d64f06ca5adc9779be63c82 100644 (file)
@@ -53,4 +53,5 @@ set ( EINCLUDE
   STEER/ESD
   STEER/STEERBase
   CORRFW
+  PWG/muon
   )
index 520aba0c16902b564f25fd6038d5eaf0bffdb394..491653877b6a9ec33a6f011b5fb22d1e0ca767e6 100644 (file)
@@ -12,7 +12,7 @@
 
 void printCalibStat(Int_t run, const char * fname,  TTreeSRedirector * pcstream);
 
-void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDBstorage="raw://")
+void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDBstorage="raw://", Int_t detectorBitsQualityFlag = -1)
 {
   //
   // extract OCDB entries for detectors participating in the calibration for the current run
@@ -78,9 +78,29 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     printf("Mag field is %f --> OFF\n", bz);
   }
 
+  // Quality flags
+  Bool_t TPC_qf = kTRUE;
+  Bool_t TOF_qf = kTRUE;
+  Bool_t TRD_qf = kTRUE;
+  Bool_t T0_qf  = kTRUE;
+  Bool_t SDD_qf = kTRUE;
+  Bool_t SPD_qf = kTRUE;
+
+  if (detectorBitsQualityFlag != -1){
+    TPC_qf = ((detectorBitsQualityFlag & AliDAQ::kTPC_QF) == AliDAQ::kTPC_QF)? kTRUE : kFALSE;
+    TOF_qf = ((detectorBitsQualityFlag & AliDAQ::kTOF_QF) == AliDAQ::kTOF_QF)? kTRUE : kFALSE;
+    TRD_qf = ((detectorBitsQualityFlag & AliDAQ::kTRD_QF) == AliDAQ::kTRD_QF)? kTRUE : kFALSE;
+    T0_qf  = ((detectorBitsQualityFlag & AliDAQ::kT0_QF)  == AliDAQ::kT0_QF)?  kTRUE : kFALSE;
+    SDD_qf = ((detectorBitsQualityFlag & AliDAQ::kSDD_QF) == AliDAQ::kSDD_QF)? kTRUE : kFALSE;
+    SPD_qf = ((detectorBitsQualityFlag & AliDAQ::kSPD_QF) == AliDAQ::kSPD_QF)? kTRUE : kFALSE;
+  }    
+
+  Printf("Quality flags: detectorBitsQualityFlag = %d, TPC = %d, TOF = %d, TRD = %d, T0 = %d, SDD = %d, SPD = %d", detectorBitsQualityFlag, (Int_t)TPC_qf, (Int_t)TOF_qf, (Int_t)TRD_qf, (Int_t)T0_qf, (Int_t)SDD_qf, (Int_t)SPD_qf);
+  return;
+
   // TPC part
   AliTPCPreprocessorOffline *procesTPC = 0;
-  if (detStr.Contains("TPC")){
+  if (detStr.Contains("TPC") && TPC_qf){
     Printf("\n******* Calibrating TPC *******");
     procesTPC = new AliTPCPreprocessorOffline;
     // switch on parameter validation
@@ -97,10 +117,13 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),targetOCDBstorage);
     procesTPC->CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating TPC: detStr = %s, TPC_qf = %d *******", detStr.Data(), (Int_t)TPC_qf);
+  }
 
   // TOF part
   AliTOFAnalysisTaskCalibPass0 *procesTOF=0;
-  if (detStr.Contains("TOF") && detStr.Contains("TPC")){
+  if (detStr.Contains("TOF") && detStr.Contains("TPC") && TOF_qf){
     procesTOF = new AliTOFAnalysisTaskCalibPass0;
     Printf("\n******* Calibrating TOF *******");
     if (isMagFieldON) procesTOF->ProcessOutput("CalibObjects.root", targetStorage);
@@ -108,10 +131,13 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
       printf("Not calibrating TOF in case of mag field OFF\n");
     }
   }
+  else {
+    Printf("\n******* NOT Calibrating TOF: detStr = %s, TOF_qf = %d *******", detStr.Data(), (Int_t)TOF_qf);
+  }
 
   // T0 part
   AliT0PreprocessorOffline *procesT0= 0;
-  if (detStr.Contains("T0")) {
+  if (detStr.Contains("T0") && T0_qf) {
     Printf("\n******* Calibrating T0 *******");
     // Make  calibration of channels offset
     procesT0 = new AliT0PreprocessorOffline;
@@ -120,10 +146,13 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     else 
       procesT0->Process("CalibObjects.root",runNumber, runNumber, targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating T0: detStr = %s, T0_qf = %d *******", detStr.Data(), (Int_t)T0_qf);
+  }
 
   //TRD part
   AliTRDPreprocessorOffline *procesTRD = 0;
-  if (detStr.Contains("TRD") && detStr.Contains("TPC")){
+  if (detStr.Contains("TRD") && detStr.Contains("TPC") && TRD_qf){
     Printf("\n******* Calibrating TRD *******");
     procesTRD = new  AliTRDPreprocessorOffline;
     if(isLHC10) procesTRD->SetSwitchOnChamberStatus(kFALSE);
@@ -146,14 +175,20 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
     procesTRD->Process("CalibObjects.root",runNumber,runNumber,targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating TRD: detStr = %s, TRD_qf = %d *******", detStr.Data(), (Int_t)TRD_qf);
+  }
   
   //Mean Vertex
   AliMeanVertexPreprocessorOffline * procesMeanVtx=0;
-  if (detStr.Contains("ITSSPD")) {
+  if (detStr.Contains("ITSSPD") && SPD_qf) {
     Printf("\n******* Calibrating MeanVertex *******");
     procesMeanVtx = new AliMeanVertexPreprocessorOffline;
     procesMeanVtx->ProcessOutput("CalibObjects.root", targetStorage, runNumber);
   }
+  else {
+    Printf("\n******* NOT Calibrating MeanVertex: detStr = %s, SPD_qf = %d *******", detStr.Data(), (Int_t)SPD_qf);
+  }
 
   //
   // Print calibration status into the stdout
index b94b657be355be220617684fb90f91c8dccacdf5..f4caa185efc8d9aa148ecb40ed14d83f9bd6cce9 100644 (file)
@@ -65,6 +65,9 @@ main()
   components="TOF MeanVertex T0 SDD TRD TPCCalib TPCCluster TPCAlign"
   #components="TOF MeanVertex T0 SDD TRD TPCCalib"
 
+  # take Data Quality Flags from JDL
+  detectorBitsQualityFlag=${ALIEN_JDL_RUNQUALITY--1}
+
   #################################################################
   echo "" | tee -a merge.log
   echo "$0 ${save_args[*]}" | tee -a merge.log
@@ -74,12 +77,13 @@ main()
   echo path = $path | tee -a merge.log
   echo run  = $run | tee -a merge.log
   echo ocdb = $ocdb | tee -a merge.log
-  echo defaultOCDB=$defaultOCDB | tee -a merge.log
+  echo defaultOCDB = $defaultOCDB | tee -a merge.log
   echo filesAreLocal = $filesAreLocal | tee -a merge.log
   echo cleanup = $cleanup | tee -a merge.log
-  echo fileAccessMethod=$fileAccessMethod | tee -a merge.log
+  echo fileAccessMethod = $fileAccessMethod | tee -a merge.log
   echo numberOfFilesInAbunch = $numberOfFilesInAbunch | tee -a merge.log
-  echo runParallel=$runParallel
+  echo runParallel = $runParallel
+  echo detectorBitsQualityFlag = $detectorBitsQualityFlag
   echo "***********************" | tee -a merge.log
 
   alienFileList="alien.list"
@@ -204,8 +208,8 @@ main()
   echo "***********************" 2>&1 | tee -a ocdb.log
   echo making ${det} OCDB 2>&1 | tee -a ocdb.log
   echo "***********************" 2>&1 | tee -a ocdb.log
-  echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
-  aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+  echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\", $detectorBitsQualityFlag)" 2>&1 | tee -a ocdb.log
+  aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\", $detectorBitsQualityFlag)" 2>&1 | tee -a ocdb.log
   mv syswatch.log syswatch_makeOCDB.log
 
   # summary
diff --git a/PWGPP/CalibMacros/CPass1/AddTOFAnalysisTaskCalibTree.C b/PWGPP/CalibMacros/CPass1/AddTOFAnalysisTaskCalibTree.C
new file mode 100644 (file)
index 0000000..1ca5f6e
--- /dev/null
@@ -0,0 +1,95 @@
+AliTOFAnalysisTaskCalibTree *AddTOFAnalysisTaskCalibTree() {
+
+  /* check analysis manager */
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddAnalysisTaskEventTime", "cannot get analysis manager");
+    return NULL;
+  }
+
+  /* check input event handler */
+  if (!mgr->GetInputEventHandler()) {
+    Error("AddAnalysisTaskEventTime", "cannot get input event handler");
+    return NULL;
+  }
+  
+  /* check input data type */
+  TString str = mgr->GetInputEventHandler()->GetDataType();
+  if (str.CompareTo("ESD")) {
+    Error("AddAnalysisTaskEventTime", "input data type is not \"ESD\"");
+    return NULL;
+  }
+
+  /* get common input data container */
+  AliAnalysisDataContainer *inputc = mgr->GetCommonInputContainer();
+  if (!inputc) {
+    Error("AddAnalysisTaskEventTime", "cannot get common input container");
+    return NULL;
+  }
+  
+  /* create output data container */
+  // setup output event handler
+  AliAnalysisDataContainer *coutput   = mgr->CreateContainer(Form("aodTree"), TTree::Class(), AliAnalysisManager::kOutputContainer, "TOFcalibTree.root"); // tree
+  if (!coutput) {
+    Error("AddTOFAnalysisTaskCalibTree", "cannot create output container");
+    return NULL;
+  }
+
+  /*  create task and connect input/output */
+  AliTOFAnalysisTaskCalibTree *task = new AliTOFAnalysisTaskCalibTree();
+  Printf("After initializing the TOF task: task = %p", task);
+  // adding the task
+  mgr->AddTask(task);
+
+  mgr->ConnectInput(task, 0, inputc);
+  mgr->ConnectOutput(task, 1, coutput);
+
+  // setup task 
+  task->SetEventSelectionFlag(kFALSE);
+  task->SetVertexSelectionFlag(kTRUE);
+  task->SetVertexCut(50.0);
+  task->SetDiscardPileupEventFlag(kFALSE);
+  task->SetPrimaryDCASelectionFlag(kFALSE);
+  task->SetCalibrateTOFsignal(kTRUE);
+  task->SetComputeT0TOF(kTRUE);
+  task->SetUseT0TOF(kFALSE);
+  task->SetUseLHCClockPhase(kFALSE);
+  //  task->SetSpecificStorageParOffline("alien://?folder=/alice/cern.ch/user/r/rpreghen/OCDB");
+  //  task->SetSpecificStorageRunParams("alien://?folder=/alice/cern.ch/user/r/rpreghen/OCDB");
+
+  // setup event cuts 
+  task->GetEventCuts()->SetAnalyzeMC(kFALSE);
+
+  // setup TOF calib 
+  task->GetTOFcalib()->SetRemoveMeanT0(kFALSE);
+  task->GetTOFcalib()->SetCalibrateTOFsignal(kTRUE);
+  task->GetTOFcalib()->SetCorrectTExp(kFALSE);
+
+  //setup resolution 
+  Double_t timeReso = 100.;
+
+  // setup TOF response 
+  //task->GetESDpid()->GetTOFResponse().SetTimeResolution(timeReso);
+
+  // setup TOF-T0 maker 
+  task->GetTOFT0maker()->SetTimeResolution(timeReso);
+
+  // setup track cuts 
+  AliESDtrackCuts *trackCuts = task->GetTrackCuts();
+  trackCuts->SetPtRange(0.15, 10.);
+  trackCuts->SetEtaRange(-1.0, 1.0);
+  trackCuts->SetRequireITSRefit(kTRUE);
+  trackCuts->SetMinNClustersITS(1);
+  //  trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  trackCuts->SetRequireTPCRefit(kTRUE);
+  trackCuts->SetMinNClustersTPC(70);
+  trackCuts->SetMaxChi2PerClusterTPC(4.);
+  trackCuts->SetAcceptKinkDaughters(kFALSE);
+  trackCuts->SetMaxDCAToVertexZ(3.2);
+  trackCuts->SetMaxDCAToVertexXY(2.4);
+  trackCuts->SetDCAToVertex2D(kTRUE);
+
+  /* return task */
+  return task;
+
+}
index 6586661c09777b7b4b3f4df1420c16649d1032ca..daaddb32c95d60eb6d5f911160ce550f758633aa 100644 (file)
@@ -12,7 +12,7 @@
 
 void printCalibStat(Int_t run, const char * fname,  TTreeSRedirector * pcstream);
 
-void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDBstorage="raw://")
+void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDBstorage="raw://", Int_t detectorBitsQualityFlag = -1)
 {
   //
   // extract OCDB entries for detectors participating in the calibration for the current run
@@ -78,9 +78,28 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     printf("Mag field is %f --> OFF\n", bz);
   }
 
+  // Quality flags
+  Bool_t TPC_qf = kTRUE;
+  Bool_t TOF_qf = kTRUE;
+  Bool_t TRD_qf = kTRUE;
+  Bool_t T0_qf  = kTRUE;
+  Bool_t SDD_qf = kTRUE;
+  Bool_t SPD_qf = kTRUE;
+
+  if (detectorBitsQualityFlag != -1){
+    TPC_qf = ((detectorBitsQualityFlag & AliDAQ::kTPC_QF) == AliDAQ::kTPC_QF)? kTRUE : kFALSE;
+    TOF_qf = ((detectorBitsQualityFlag & AliDAQ::kTOF_QF) == AliDAQ::kTOF_QF)? kTRUE : kFALSE;
+    TRD_qf = ((detectorBitsQualityFlag & AliDAQ::kTRD_QF) == AliDAQ::kTRD_QF)? kTRUE : kFALSE;
+    T0_qf  = ((detectorBitsQualityFlag & AliDAQ::kT0_QF)  == AliDAQ::kT0_QF)?  kTRUE : kFALSE;
+    SDD_qf = ((detectorBitsQualityFlag & AliDAQ::kSDD_QF) == AliDAQ::kSDD_QF)? kTRUE : kFALSE;
+    SPD_qf = ((detectorBitsQualityFlag & AliDAQ::kSPD_QF) == AliDAQ::kSPD_QF)? kTRUE : kFALSE;
+  }    
+
+  Printf("Quality flags: detectorBitsQualityFlag = %d, TPC = %d, TOF = %d, TRD = %d, T0 = %d, SDD = %d, SPD = %d", detectorBitsQualityFlag, (Int_t)TPC_qf, (Int_t)TOF_qf, (Int_t)TRD_qf, (Int_t)T0_qf, (Int_t)SDD_qf, (Int_t)SPD_qf);
+
   // TPC part
   AliTPCPreprocessorOffline *procesTPC = 0;
-  if (detStr.Contains("TPC")){
+  if (detStr.Contains("TPC") && TPC_qf){
     Printf("\n******* Calibrating TPC *******");
     Printf("TPC won't be calibrated at CPass1 for the time being... Doing nothing here");
     //procesTPC = new AliTPCPreprocessorOffline;
@@ -93,10 +112,13 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     // Make vdrift calibration
     //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating TPC: detStr = %s, TPC_qf = %d *******", detStr.Data(), (Int_t)TPC_qf);
+  }
 
   // TOF part
   AliTOFAnalysisTaskCalibPass0 *procesTOF=0;
-  if (detStr.Contains("TOF") && detStr.Contains("TPC")){
+  if (detStr.Contains("TOF") && detStr.Contains("TPC") && TOF_qf){
     procesTOF = new AliTOFAnalysisTaskCalibPass0;
     Printf("\n******* Calibrating TOF *******");
     if (isMagFieldON) procesTOF->ProcessOutput("CalibObjects.root", targetStorage);
@@ -104,20 +126,26 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
       printf("Not calibrating TOF in case of mag field OFF\n");
     }
   }
+  else {
+    Printf("\n******* NOT Calibrating TOF: detStr = %s, TOF_qf = %d *******", detStr.Data(), (Int_t)TOF_qf);
+  }
 
   // T0 part
   AliT0PreprocessorOffline *procesT0= 0;
-  if (detStr.Contains("T0")) {
+  if (detStr.Contains("T0") && T0_qf) {
     Printf("\n******* Calibrating T0 *******");
     procesT0 = new AliT0PreprocessorOffline;
     // Make  calibration of channels offset
     procesT0->setDArun(100000);
     procesT0->Process("CalibObjects.root",runNumber, runNumber, targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating T0: detStr = %s, T0_qf = %d *******", detStr.Data(), (Int_t)T0_qf);
+  }
 
   //TRD part
   AliTRDPreprocessorOffline *procesTRD = 0;
-  if (detStr.Contains("TRD") && detStr.Contains("TPC")){
+  if (detStr.Contains("TRD") && detStr.Contains("TPC") && TRD_qf){
     Printf("\n******* Calibrating TRD *******");
     procesTRD = new  AliTRDPreprocessorOffline;
     if(isLHC10) procesTRD->SetSwitchOnChamberStatus(kFALSE);
@@ -140,16 +168,22 @@ void makeOCDB(Int_t runNumber, TString  targetOCDBstorage="", TString sourceOCDB
     printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
     procesTRD->Process("CalibObjects.root",runNumber,runNumber,targetStorage);
   }
+  else {
+    Printf("\n******* NOT Calibrating TRD: detStr = %s, TRD_qf = %d *******", detStr.Data(), (Int_t)TRD_qf);
+  }
   
   // switched OFF at CPass1 in any case
   /*
   //Mean Vertex
   AliMeanVertexPreprocessorOffline * procesMeanVtx=0;
-  if (detStr.Contains("ITSSPD")) {
+  if (detStr.Contains("ITSSPD") && SPD_qf) {
     Printf("\n******* Calibrating MeanVertex *******");
     procesMeanVtx = new AliMeanVertexPreprocessorOffline;
     procesMeanVtx->ProcessOutput("CalibObjects.root", targetStorage, runNumber);
   }
+  else {
+    Printf("\n******* NOT Calibrating MeanVertex: detStr = %s, SPD_qf = %d *******", detStr.Data(), (Int_t)SPD_qf);
+  }
   */
 
   //
index 0d7e9e4702a577802b7b163a2cfca20c2291c680..7bf3a65ab73afd5f37dedc9f904c2ebd6c5200c8 100644 (file)
@@ -65,6 +65,9 @@ main()
   components="TOF MeanVertex T0 SDD TRD TPCCalib TPCCluster TPCAlign"
   #components="TOF MeanVertex T0 SDD TRD TPCCalib"
 
+  # take Data Quality Flags from JDL
+  detectorBitsQualityFlag=${ALIEN_JDL_RUNQUALITY--1}
+
   #################################################################
   echo "" | tee -a merge.log
   echo "$0 ${save_args[*]}" | tee -a merge.log
@@ -74,12 +77,13 @@ main()
   echo path = $path | tee -a merge.log
   echo run  = $run | tee -a merge.log
   echo ocdb = $ocdb | tee -a merge.log
-  echo defaultOCDB=$defaultOCDB | tee -a merge.log
+  echo defaultOCDB = $defaultOCDB | tee -a merge.log
   echo filesAreLocal = $filesAreLocal | tee -a merge.log
   echo cleanup = $cleanup | tee -a merge.log
-  echo fileAccessMethod=$fileAccessMethod | tee -a merge.log
+  echo fileAccessMethod = $fileAccessMethod | tee -a merge.log
   echo numberOfFilesInAbunch = $numberOfFilesInAbunch | tee -a merge.log
-  echo runParallel=$runParallel
+  echo runParallel = $runParallel
+  echo detectorBitsQualityFlag = $detectorBitsQualityFlag
   echo "***********************" | tee -a merge.log
 
   alienFileList="alien.list"
@@ -204,8 +208,8 @@ main()
   echo "***********************" 2>&1 | tee -a ocdb.log
   echo making ${det} OCDB 2>&1 | tee -a ocdb.log
   echo "***********************" 2>&1 | tee -a ocdb.log
-  echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
-  aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+  echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\", $detectorBitsQualityFlag)" 2>&1 | tee -a ocdb.log
+  aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\", $detectorBitsQualityFlag)" 2>&1 | tee -a ocdb.log
   mv syswatch.log syswatch_makeOCDB.log
 
   # summary
index 60f1e6d76053d66f529ea3d79b03ca5faaad5a70..534de3988f44b1837f26305540c86f18f880cbdd 100644 (file)
 
 #include "AliAnalysisTaskMuonFakes.h"
 
+using std::cout;
+using std::endl;
+using std::flush;
+
 ClassImp(AliAnalysisTaskMuonFakes)
 
 //________________________________________________________________________
index 98f086eb97a69ebce1781bb4a8d630a2be4e46bd..cf5df7d3bad944442ce84c33d22bb1f230287c1f 100644 (file)
@@ -155,6 +155,15 @@ TString GetFullPath ( TString filename )
   return fullPath;
 }
 
+//_____________________________________________________________________________
+TString GetBaseName ( TString filename )
+{
+  TString baseName = gSystem->BaseName(filename);
+  Int_t idx = baseName.Index("#");
+  if ( idx > 0 ) baseName.Remove(0,idx+1);
+  return baseName;
+}
+
 
 //_____________________________________________________________________________
 void CopyDir(TDirectory *source) {
@@ -198,7 +207,7 @@ Bool_t GetQAInfo ( const char* qaFileName, TString dirNames = "MUON_QA MTR_Chamb
 {
   LoadLibs();
 
-  TString outFilename = gSystem->BaseName(qaFileName);
+  TString outFilename = GetBaseName(qaFileName);
   TString inFullPath = GetFullPath(qaFileName);
   TString outFullPath = GetFullPath(outFilename);
   if ( inFullPath == outFullPath ) {
@@ -280,9 +289,9 @@ void AddTrigVars ( TString filename, TList &parList )
   Int_t nHistos = sizeof(hChNames)/sizeof(hChNames[0]);
   for ( Int_t ihisto=0; ihisto<nHistos; ihisto++ ) {
     TH1* histo = (TH1*)inList->FindObject(hChNames[ihisto].Data());
-    if ( ! histo ) continue;
     for ( Int_t ibin=1; ibin<=4; ibin++ ) {
-      AddTreeVariable(parList, Form("%s%i",hChNames[ihisto].Data(),ibin),'F',histo->GetBinContent(ibin));
+      Double_t currVal = ( histo ) ? histo->GetBinContent(ibin) : 0.;
+      AddTreeVariable(parList, Form("%s%i",hChNames[ihisto].Data(),ibin),'F',currVal);
     }
   }
   delete file;
@@ -294,9 +303,10 @@ void MakeTrend ( const char* qaFile, Int_t runNumber, UInt_t force = trigQA, UIn
   Bool_t isOk = GetQAInfo(qaFile);
   if ( ! isOk ) return;
 
-  terminateQA(gSystem->BaseName(qaFile),force,mask);
+  TString inFilename = GetBaseName(qaFile);
+
+  terminateQA(inFilename,force,mask);
 
-  TString inFilename = gSystem->BaseName(qaFile);
   TList parList;
   parList.SetOwner();
   AddTreeVariable(parList, "run", 'I', runNumber);
index 42e80bbb43a0064c22f8a902d732322524066aa3..4a7a69c494b0541c05a133118536812d7761c033 100755 (executable)
@@ -9,7 +9,7 @@
 runLevelQA()
 {
   #full path of QAresults.root is provided
-  qaFile=$1
+  local qaFile=$1
 
   # This is used only to extract the muon information
   ln -s $ALICE_ROOT/PWGPP/MUON/lite/LoadLibsForMuonQA.C
@@ -22,27 +22,38 @@ EOF
   rm LoadLibsForMuonQA.C
   rm MakeTrend.C
   rm *.d *.so
-
-  #should produce a file trending.root
-  #if not, a default one will be provided
 }
 
 periodLevelQA()
 {
   #path of the merged period trending.root is provided
-  trendingFile=$1
-
-  fileList="trendList.txt"
-  find -L . -name "QAresults.root" > $fileList
+  local trendingFile=$1
+
+  local fileList="trendList.txt"
+  local tmpFileList="tmp${fileList}"
+  local fileNames="QAresults.root QAresults_barrel.root QAresults_outer.root"
+  find -L . -name "QAresults*.root" > $fileList
+
+  # If no result is found, it means we have an archive as input
+  if [ ! -s $fileList ]; then
+    sFileList=$(find -L . -name "QA*archive.zip")
+    for ifile in $sFileList; do
+      for searchFile in $fileNames; do
+        if unzip -l ${ifile} | egrep "$searchFile" &>/dev/null; then
+          echo "${ifile}#${searchFile}" >> $fileList
+        fi
+      done
+    done
+  fi
 
   # Assume that "outputDir" is known from the steering runQA.sh
-  cfgFileDir="${outputDir}/configFiles"
-  cfgFileSuffix="${dataType}_${period}.txt"
+  local cfgFileDir="${outputDir}/configFiles"
+  local cfgFileSuffix="${dataType}_${period}.txt"
 
   #if run list is provided, filter the output limiting to this list
   # FIXME: the code is run in a temporary directory
   # where should we add this file?
-  runList="${cfgFileDir}/runList_${cfgFileSuffix}"
+  local runList="${cfgFileDir}/runList_${cfgFileSuffix}"
   if [ -e ${runList} ]; then
     sRunList=$(cat ${runList} | xargs)
     tmpFileList="tmp${fileList}"
@@ -60,7 +71,7 @@ periodLevelQA()
   #if trigger list is provided, filter the tracking output accordngly
   # FIXME: the code is run in a temporary directory
   # where should we add this file?
-  triggerList="$cfgFileDir/trigList_${cfgFileSuffix}"
+  local triggerList="$cfgFileDir/trigList_${cfgFileSuffix}"
   if [ -e ${triggerList} ]; then
     triggerList="\"${triggerList}\""
   else
@@ -69,9 +80,16 @@ periodLevelQA()
 
   ln -s $ALICE_ROOT/PWGPP/MUON/lite/LoadLibsForMuonQA.C
 
-  # First run tracker (we it merges the QAresults and we need it for
+  # First run tracker (it merges the QAresults and we need it for
   # scaler trending in trigger
-  mergedQAname="QAresults.root"
+  local mergedQAname="QAresults.root"
+  for ifile in $fileNames; do
+    hasFile=`grep -c "$ifile" $fileList`
+    if [ $hasFile -gt 0 ]; then
+      mergedQAname="$ifile"
+      break
+    fi
+  done
 
   ln -s $ALICE_ROOT/PWGPP/MUON/lite/PlotMuonQA.C
 aliroot -b <<EOF
@@ -82,7 +100,7 @@ EOF
   rm PlotMuonQA.C
 
   # Then run trigger
-  runScalers="kFALSE"
+  local runScalers="kFALSE"
   if [ "${dataType}" = "data" ]; then
     runScalers="kTRUE";
   fi
diff --git a/PWGPP/QA/detectorQAscripts/V0.sh b/PWGPP/QA/detectorQAscripts/V0.sh
new file mode 100755 (executable)
index 0000000..4a76b01
--- /dev/null
@@ -0,0 +1,18 @@
+
+
+runLevelQA()
+{
+       qaFile=$1
+       detectorQAcontainerName="VZERO"
+       cp $ALICE_ROOT/PWGPP/VZERO/trending/MakeTrendingV0QA.C .
+       aliroot -q -b -l .x "MakeTrendingV0QA.C(\"${qaFile}\",${runNumber},\"${ocdbStorage}\",kFALSE,KFALSE)"
+       #first booleen for Grid connection (true == connection in maketrending) and last boolen for print histo
+}
+
+periodLevelQA()
+{
+       trendingFile=$1
+       detectorQAcontainerName="VZERO"
+       cp $ALICE_ROOT/PWGPP/VZERO/trending/DrawTrendingV0QA.C .
+       aliroot -q -b -l .x "DrawTrendingV0QA.C(\"${trendingFile}\")"
+}
index 59f9ae820dc6f46ddc7d8ce5f11f40f2c3ab9e6a..b772077329d4e98f373742b3bcc040caf291577d 100644 (file)
@@ -9,6 +9,7 @@ alienFindCommand="alien_find /alice/data/2012/ OCDB/root_archive.zip"
 #this one skips the alienFindCommand and uses the existing localAlienDatabase.list file
 #useExistingAlienFileDatabase=1
 
+#use absolute paths! it affects the creation of the local file list
 localPathPrefix="/hera/alice/alien"
 
 logOutputPath="/hera/alice/aux/logs/alienSync/alienSync.2012.CalibObjects.root.logs"
index c83b81f2e5e1c41e7a87a5f24c7ab7da2d389d10..6e0da8a78177282ed512f8efbbefafead5c08f68 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash
+# process QA output into plots and trending
+# run without arguments for examples
+# origin: Mikolaj Krzewicki, mkrzewic@cern.ch
+#
 if [ ${BASH_VERSINFO} -lt 4 ]; then
   echo "bash version >= 4 needed, you have ${BASH_VERSION}, exiting..."
   exit 1
@@ -258,7 +262,7 @@ updateQA()
       #go to a temp dir to do the period level stuff in a completely clean dir
       tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
       echo
-      echo tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
+      echo tmpPeriodLevelQAdir="${tmpPeriodLevelQAdir}"
       if ! mkdir -p ${tmpPeriodLevelQAdir}; then continue; fi
       cd ${tmpPeriodLevelQAdir}
 
diff --git a/PWGPP/TOF/trending/localMergeFiles.C b/PWGPP/TOF/trending/localMergeFiles.C
new file mode 100644 (file)
index 0000000..cb6893a
--- /dev/null
@@ -0,0 +1,19 @@
+
+Int_t localMergeFiles(Char_t * outfile=NULL, Char_t * list=NULL)
+{
+  Int_t filesCounter=0;
+  TFileMerger merger ; 
+  if (!list) {
+    printf("Invalid list of files given as input: nothing done\n");
+    return 0;
+  }    
+  merger.OutputFile(outfile); 
+  TString infile ; 
+  FILE * files = fopen(list, "r") ; 
+  while ( infile.Gets(files) ){
+    if (merger.AddFile(infile)) filesCounter++;     
+  } 
+  printf("Number of files to be merged = %i\n",filesCounter);
+  merger.Merge();  
+  return 1; 
+}
diff --git a/PWGPP/VZERO/trending/DrawTrendingV0QA.C b/PWGPP/VZERO/trending/DrawTrendingV0QA.C
new file mode 100755 (executable)
index 0000000..b98891a
--- /dev/null
@@ -0,0 +1,246 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TError.h>
+#include <TROOT.h>
+#include <TKey.h>
+#include <TH2.h>
+#include <TF1.h>
+#include <TH1.h>
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TPad.h>
+#include <TStyle.h>
+#include <TGrid.h>
+#include <TGridResult.h>
+#include <TEnv.h>
+#include <TLegend.h>
+#include <TMath.h>
+#include <TSpectrum.h>
+#include <TTree.h>
+
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliGRPObject.h"
+#include "AliTriggerInput.h"
+#include "AliTriggerConfiguration.h"
+#endif
+
+Int_t DrawTrendingV0QA(TString mergedTrendFile ="trending.root")
+{
+       if(!mergedTrendFile)
+       {
+               printf("Cannot open merged trend file with V0 QA");
+               return 1;
+       }
+       char outfilename[200]="ProductionQA.hist.root";
+       TString plotDir(".");
+       
+       Int_t runNumber=0, NumberVoieOff=0, numberBadOffset=0;
+       TFile*fin=TFile::Open(mergedTrendFile.Data());
+       if(!fin)
+       {
+               Printf("ERROR: trending file not found. Exiting ...\n");
+               return -1;
+       }
+       TTree*ttree=(TTree*)fin->Get("trending");
+       if(!ttree)
+       {
+               printf("Invalid trending tree");
+               return 2;
+       }
+       Float_t TimesA=0.,TimesC=0., BB_BG=0.,BB_EE=0.,AdcA=0.;
+       Float_t AdcC=0.,MultA=0.,MultC=0.;
+       
+       
+       ttree->SetBranchAddress("run",&runNumber);
+       ttree->SetBranchAddress("TimesA",&TimesA);
+       ttree->SetBranchAddress("TimesC",&TimesC);
+       ttree->SetBranchAddress("BB_BG",&BB_BG);
+       ttree->SetBranchAddress("BB_EE",&BB_EE);
+       ttree->SetBranchAddress("AdcA" ,&AdcA );
+       ttree->SetBranchAddress("AdcC" ,&AdcC );
+       ttree->SetBranchAddress("MultA",&MultA);
+       ttree->SetBranchAddress("MultC",&MultC);
+       ttree->SetBranchAddress("NumberVoieOff",&NumberVoieOff);
+       ttree->SetBranchAddress("numberBadOffset",&numberBadOffset);
+       
+       Int_t nRuns=ttree->GetEntries();
+       TList list;
+       
+       TH1F * hTimeA = new TH1F("hTimeA","BB Leading time;;Time (ns)",nRuns,-0.5,nRuns-0.5);
+       TH1F * hTimeC = new TH1F("hTimeC","BB Leading time;;Time (ns)",nRuns,-0.5,nRuns-0.5);
+       TH1F * hBB_BG = new TH1F("hBB_BG","Trigger ratio",nRuns,-0.5,nRuns-0.5);
+       TH1F * hBB_EE = new TH1F("hBB_EE","Trigger ratio",nRuns,-0.5,nRuns-0.5);
+       TH1F * hAdcA = new TH1F("hAdcA","Average Charge",nRuns,-0.5,nRuns-0.5);
+       TH1F * hAdcC = new TH1F("hAdcC","Average Charge",nRuns,-0.5,nRuns-0.5);
+       TH1F * hMultA = new TH1F("hMultA","Average number of Fired cell",nRuns,-0.5,nRuns-0.5);
+       TH1F * hMultC = new TH1F("hMultC","Average number of Fired cell",nRuns,-0.5,nRuns-0.5);
+       TH1F * hNumberVoieOff=new TH1F("hNumberVoieOff","Number of chanel off",nRuns,-0.5,nRuns-0.5);
+       hNumberVoieOff->SetMaximum(70);
+       TH1F * hNumberBadOffset=new TH1F("hNumberBadOffset","Number of pdestal",nRuns,-0.5,nRuns-0.5);
+       hNumberBadOffset->SetMaximum(70);
+       
+       list.Add(hTimeA);
+       list.Add(hTimeC);
+       list.Add(hBB_BG);
+       list.Add(hBB_EE);
+       list.Add(hAdcA );
+       list.Add(hAdcC );
+       list.Add(hMultA);
+       list.Add(hMultC);
+       list.Add(hNumberVoieOff);
+       list.Add(hNumberBadOffset);
+       char runlabel[6];
+       
+       
+       for(Int_t irun=0;irun<nRuns;irun++)
+       {
+               ttree->GetEntry(irun);
+               sprintf(runlabel,"%i",runNumber);
+               
+               hTimeA->SetBinContent(irun+1,TimesA);
+               hTimeA->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hTimeC->SetBinContent(irun+1,TimesC);
+               hTimeC->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hBB_BG->SetBinContent(irun+1,BB_BG);
+               hBB_BG->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hBB_EE->SetBinContent(irun+1,BB_EE);
+               hBB_EE->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hAdcA->SetBinContent(irun+1,AdcA);
+               hAdcA ->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hAdcC->SetBinContent(irun+1,AdcC);
+               hAdcC ->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hMultA->SetBinContent(irun+1,MultA);
+               hMultA->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hMultC->SetBinContent(irun+1,MultC);
+               hMultC->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hNumberVoieOff->SetBinContent(irun+1,NumberVoieOff);
+               hNumberVoieOff->GetXaxis()->SetBinLabel(irun+1,runlabel);
+               
+               hNumberBadOffset->SetBinContent(irun+1,numberBadOffset);
+               hNumberBadOffset->GetXaxis()->SetBinLabel(irun+1,runlabel);
+       }
+       
+       TFile*fout=new TFile(outfilename,"recreate");
+       fout->cd();
+       list.Write();
+       fout->Close();
+       int maxRun =runNumber;
+       ttree->GetEntry(0);
+       int minRun = runNumber;
+       
+       gStyle->SetOptStat(0);
+       hTimeA->SetMarkerStyle(20);
+       hTimeA->SetMarkerColor(2);
+  
+       hTimeC->SetMarkerStyle(20);
+       hTimeC->SetMarkerColor(4);
+
+       
+       
+       
+       TCanvas * c = new TCanvas("c","Leading time versus run number");
+       hTimeA->GetYaxis()->SetRange(0,10);
+       hTimeA->Draw("P");
+       hTimeA->SetMinimum(TMath::Min(hTimeA->GetMinimum(),hTimeC->GetMinimum())-1.);
+       hTimeA->SetMaximum(TMath::Max(hTimeA->GetMaximum(),hTimeC->GetMaximum())+1.);
+  
+       hTimeC->GetYaxis()->SetRange(0,10);
+       hTimeC->Draw("Psame");
+       TLegend * lg = new TLegend(0.8,0.9,1,1);
+       lg->AddEntry(hTimeA,"V0A - 8 ns","p");
+       lg->AddEntry(hTimeC,"V0C","p");
+       lg->Draw("same");
+       float shiftA=8.0;
+       TPave * pavA = new TPave(-0.5,TMath::Max(hTimeA->GetMinimum(),1.5-shiftA),nRuns-0.5,TMath::Min(hTimeA->GetMaximum(),33.5-shiftA),0);
+       pavA->SetFillStyle(3004);
+       pavA->SetFillColor(2);
+       TPave * pavC = new TPave(-0.5,TMath::Max(hTimeC->GetMinimum(),0.5),nRuns-0.5,TMath::Min(hTimeC->GetMaximum(),25.5),0);
+       pavC->SetFillStyle(3005);
+       pavC->SetFillColor(4);
+  
+       pavA->Draw("same");
+       pavC->Draw("same");
+
+       
+       c->Print(Form("%s/QA_Resume_%d_%d.pdf(",plotDir.Data(),minRun,maxRun));
+       c->Write();
+  
+       TCanvas * c2 = new TCanvas("c2","Trigger ratios");
+       c2->SetGridy();
+  
+       hBB_BG->SetMarkerStyle(20);
+       hBB_BG->SetMarkerColor(2);
+       hBB_EE->SetMarkerStyle(20);
+       hBB_EE->SetMarkerColor(4);
+       
+       hBB_BG->Draw("P");
+       hBB_EE->Draw("Psame");
+       TLegend * lg2 = new TLegend(0.8,0.9,1,1);
+       lg2->AddEntry(hBB_BG,"BG / BB","p");
+       lg2->AddEntry(hBB_EE,"EE / BB","p");
+       lg2->Draw("same");
+       
+       c2->Print(Form("%s/QA_Resume_%d_%d.pdf",plotDir.Data(),minRun,maxRun));
+       c2->Write();
+       
+       
+       TCanvas * c3 = new TCanvas("c3","Average Charge");
+       c3->SetGridy();
+       
+       hAdcA->SetMarkerStyle(20);
+       hAdcA->SetMarkerColor(2);
+       hAdcC->SetMarkerStyle(20);
+       hAdcC->SetMarkerColor(4);
+       hAdcA->SetMinimum(0);
+       hAdcA->SetMaximum(100);
+       
+       hAdcA->Draw("P");
+       hAdcC->Draw("Psame");
+       TLegend * lg3 = new TLegend(0.8,0.9,1,1);
+       lg3->AddEntry(hAdcA,"V0A","p");
+       lg3->AddEntry(hAdcC,"V0C","p");
+       lg3->Draw("same");
+       
+       c3->Print(Form("%s/QA_Resume_%d_%d.pdf",plotDir.Data(),minRun,maxRun));
+       c3->Write();
+       
+  
+       TCanvas * c4 = new TCanvas("c4","Average number of cell");
+       c4->SetGridy();
+       
+       hMultA->SetMarkerStyle(20);
+       hMultA->SetMarkerColor(2);
+       hMultC->SetMarkerStyle(20);
+       hMultC->SetMarkerColor(4);
+       hMultA->SetMinimum(0);
+       hMultA->SetMaximum(32);
+       
+       hMultA->Draw("P");
+       hMultC->Draw("Psame");
+       TLegend * lg4 = new TLegend(0.8,0.9,1,1);
+       lg4->AddEntry(hMultA,"V0A","p");
+       lg4->AddEntry(hMultC,"V0C","p");
+       lg4->Draw("same");
+       
+       c4->Print(Form("%s/QA_Resume_%d_%d.pdf",plotDir.Data(),minRun,maxRun));
+       c4->Write();
+
+       TCanvas * c5 = new TCanvas("c5","");
+       c5->cd();
+       hNumberVoieOff->Draw();
+       TCanvas * c6 = new TCanvas("c6","");
+       c6->cd();
+       hNumberBadOffset->Draw();
+       c5->Print(Form("%s/QA_Resume_%d_%d.pdf",plotDir.Data(),minRun,maxRun));
+       c6->Print(Form("%s/QA_Resume_%d_%d.pdf)",plotDir.Data(),minRun,maxRun));
+       c5->Write();
+       return 0;
+}
diff --git a/PWGPP/VZERO/trending/MakeTrendingV0QA.C b/PWGPP/VZERO/trending/MakeTrendingV0QA.C
new file mode 100755 (executable)
index 0000000..065babd
--- /dev/null
@@ -0,0 +1,345 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TError.h>
+#include <TROOT.h>
+#include <TKey.h>
+#include <TH2.h>
+#include <TF1.h>
+#include <TH1.h>
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TPad.h>
+#include <TStyle.h>
+#include <TGrid.h>
+#include <TGridResult.h>
+#include <TEnv.h>
+#include <TLegend.h>
+#include <TMath.h>
+#include <TSpectrum.h>
+#include <TTree.h>
+
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliGRPObject.h"
+#include "AliTriggerInput.h"
+#include "AliTriggerConfiguration.h"
+#endif
+
+
+Int_t MakeTrendingV0QA(TString qafilename,Int_t runNumber,TString ocdbStorage = "raw://",Bool_t IsOnGrid = kFALSE,Bool_t canvasE = kFALSE)
+{
+       if (!qafilename) 
+       {
+               Printf("Error - Invalid input file");
+               return 1;
+       }
+       gStyle->SetPalette(1);
+       
+       TString treePostFileName=Form("trending_%i.root",runNumber);
+       if(IsOnGrid)
+               TGrid::Connect("alien://");
+       TFile*fin=TFile::Open(qafilename,"r");
+
+       if(!fin)
+       {
+               Printf("ERROR: QA output not found. Exiting ...\n");
+               return -1;
+       }
+       else
+       {
+               Printf("INFO: QA output file %s open. \n",fin->GetName());
+       }
+       AliCDBManager *man = AliCDBManager::Instance();
+       man->SetDefaultStorage(ocdbStorage);
+       man->SetRun(runNumber);
+       AliCDBEntry *entry2=0;
+       entry2 = man->Get("GRP/GRP/Data");
+       AliGRPObject* fGRPData=0;
+       if (entry2) 
+       {
+               printf("Found an AliGRPObject in GRP/GRP/Data, reading it\n");
+               fGRPData = dynamic_cast<AliGRPObject*>(entry2->GetObject()); 
+               entry2->SetOwner(0);
+       }
+       TString activeDetList(AliDAQ::ListOfTriggeredDetectors(fGRPData->GetDetectorMask()));
+       TString runType(fGRPData->GetRunType());
+       TString beamType(fGRPData->GetBeamType());
+       TString machineMode(fGRPData->GetMachineMode());
+       TString lhcState(fGRPData->GetLHCState());
+       printf("activeDetList %s\nrunType %s\nbeamType %s\nmachineMode %s\nlhcState %s\n",
+               activeDetList.Data(),runType.Data(),beamType.Data(),
+               machineMode.Data(),lhcState.Data());
+    
+       time_t duration = fGRPData->GetTimeEnd() - fGRPData->GetTimeStart();
+    
+       if(!activeDetList.Contains("VZERO"))
+       { 
+                       printf("RUN WITH VZERO NOT ACTIVE\n");
+               return 0;
+       }
+       if(!runType.Contains("PHYSICS"))
+       { 
+               printf("RUN NO PHYSICS\n");
+               return 0;
+       }
+       if(duration<120)
+       { 
+               printf("RUNS SHORTER THAN 2 MIN\n");
+               return 0;
+       }
+       Float_t TimesA=-9999.,TimesC=-9999., BB_BG=-9999.,BB_EE=-9999.,AdcA=-9999.;
+       Float_t AdcC=-9999.,MultA=-9999.,MultC=-9999.;
+       Int_t NumberVoieOff=0, numberBadOffset=0;
+       TTree *ttree=new TTree("trending","tree of trending variables");
+
+       ttree->Branch("run",&runNumber,"run/I");
+       ttree->Branch("TimesA",&TimesA,"BB Leading time;;Time (ns)/F");
+       ttree->Branch("TimesC",&TimesC,"BB Leading time;;Time (ns)/F");
+       ttree->Branch("BB_BG",&BB_BG,"Trigger ratio/F");
+       ttree->Branch("BB_EE",&BB_EE,"Trigger ratio/F");
+       ttree->Branch("AdcA" ,&AdcA ,"Average Charge/F");
+       ttree->Branch("AdcC" ,&AdcC ,"Average Charge/F");
+       ttree->Branch("MultA",&MultA,"Average number of Fired cell/F");
+       ttree->Branch("MultC",&MultC,"Average number of Fired cell/F");
+       ttree->Branch("NumberVoieOff",&NumberVoieOff,"Number of path off/I");
+       ttree->Branch("numberBadOffset",&numberBadOffset,"Number of bad offset /I");
+       
+       char v0QAdirName[20]="VZERO_Performance";
+       TDirectoryFile * v0QAdir=(TDirectoryFile*)fin->Get(v0QAdirName);
+       if(!v0QAdir)
+       {
+               printf("ERROR: VZERO QA directory not present in input file.\n");
+               return -1;
+       }
+       TList *list = (TList*)v0QAdir->Get("QAVZEROHists");
+       if(!list) 
+       {
+               cout << "ERROR: No list found" << endl;
+               return -1;
+       }
+       TH2F *hEvents = (TH2F*)list->FindObject("hEvents");
+       TH1F *hAdcNoTimeA = (TH1F*)list->FindObject("hAdcNoTimeA");
+       TH1F *hAdcWithTimeA = (TH1F*)list->FindObject("hAdcWithTimeA");
+       TH1F *hAdcNoTimeC = (TH1F*)list->FindObject("hAdcNoTimeC");
+       TH1F *hAdcWithTimeC = (TH1F*)list->FindObject("hAdcWithTimeC");
+       TH2F *hadcpmtwithtime = (TH2F*)list->FindObject("hadcpmtwithtime");     
+       TH1F *htimepmtA = (TH1F*)list->FindObject("htimepmtA");
+       TH1F *htimepmtC = (TH1F*)list->FindObject("htimepmtC");
+       TH1F *hwidthA = (TH1F*)list->FindObject("hwidthA");
+       TH1F *hwidthC = (TH1F*)list->FindObject("hwidthC");
+       TH1F *hV0ampl = (TH1F*)list->FindObject("hV0ampl");
+       TH2F *htimepmt = (TH2F*)list->FindObject("htimepmt");   
+       TH2F *hwidthpmt = (TH2F*)list->FindObject("hwidthpmt"); 
+       TH2F *hadcwidthA = (TH2F*)list->FindObject("hadcwidthA");       
+       TH2F *hadcwidthC = (TH2F*)list->FindObject("hadcwidthC");       
+       TH2F *hAdcTimeA = (TH2F*)list->FindObject("hAdcTimeA"); 
+       TH2F *hAdcTimeC = (TH2F*)list->FindObject("hAdcTimeC"); 
+       TH2F *htimecorr = (TH2F*)list->FindObject("htimecorr"); 
+       TH1F *hV0A = (TH1F*)list->FindObject("hV0a");
+       TH1F *hV0C = (TH1F*)list->FindObject("hV0c");
+       TH1F *hV0multA = (TH1F*)list->FindObject("hV0multA");
+       TH1F *hV0multC = (TH1F*)list->FindObject("hV0multC");
+       TH2F* hVtxXYBB  =(TH2F*) list->FindObject("fhVtxXYBB");
+       TH1F* hVtxZBB   =(TH1F*) list->FindObject("fhVtxZBB");
+       TH2F* hVtxXYBGA =(TH2F*) list->FindObject("fhVtxXYBGA");
+       TH1F* hVtxZBGA  =(TH1F*) list->FindObject("fhVtxZBGA");
+       TH2F* hVtxXYBGC =(TH2F*) list->FindObject("fhVtxXYBGC");
+       TH1F* hVtxZBGC  =(TH1F*) list->FindObject("fhVtxZBGC");
+       
+       float BB = hEvents->GetBinContent(2,2);
+       float EE = hEvents->GetBinContent(1,1);
+       float BGA = hEvents->GetBinContent(3,2);
+       float BGC = hEvents->GetBinContent(2,3);
+       
+       if(hAdcWithTimeA->GetEntries()==0)
+               return 0;
+       
+       {
+               TSpectrum s;
+               float shiftA = 8.;
+               Int_t nPeaksFound = s.Search(htimepmtA);
+               Float_t *peaks = s.GetPositionY();
+               Float_t *posiX = s.GetPositionX();
+               Float_t maxY = 0.;
+               Int_t index = -1;
+       
+               for(int i=0;i<nPeaksFound;i++) 
+               {
+                       if(peaks[i]>maxY && posiX[i]>0.) 
+                       {
+                               maxY = peaks[i];
+                               index = i;
+                       }       
+               }
+               Float_t maxX = (index >= 0) ? s.GetPositionX()[index] : -11111; 
+               
+               TF1 *fgaus = new TF1("gausbbbb","gaus",maxX-1.,maxX+1.);
+               htimepmtA->Fit(fgaus,"","",maxX-1.,maxX+1.);
+               TimesA=fgaus->GetParameter(1)-shiftA;
+               delete fgaus;
+       }
+       {
+               TSpectrum s;
+               Int_t nPeaksFound = s.Search(htimepmtC);
+               Float_t *peaks = s.GetPositionY();
+               Float_t maxY = 0.;
+               Int_t index = -1;
+               for(int i=0;i<nPeaksFound;i++) 
+               {
+                       if(peaks[i]>maxY) 
+                       {
+                       maxY = peaks[i];
+                       index = i;
+                       }
+               }       
+               Float_t maxX = (index >= 0) ? s.GetPositionX()[index] : -11111; 
+               TF1 *fgaus = new TF1("gausffff","gaus",maxX-1.,maxX+1.);
+               htimepmtC->Fit(fgaus,"","",maxX-1.,maxX+1.);
+               TimesC=fgaus->GetParameter(1);
+               delete fgaus;
+       }
+       if(BB) 
+       {
+               BB_BG=(BGA+BGC)/BB;
+               BB_EE=EE/BB;
+       }else
+       {
+               BB_BG=0;
+               BB_EE=0;
+       }
+       
+       MultA=hV0A->GetMean();
+       MultC=hV0C->GetMean();
+    
+       AdcA=hAdcWithTimeA->GetMean();
+       AdcC=hAdcWithTimeC->GetMean();
+       
+       double valBin=0;
+       TH1D*hadcXFull=hadcpmtwithtime->ProjectionX("hadcXFull",1,hadcpmtwithtime->GetYaxis()->GetLast());
+       TH1D*hadcX=hadcpmtwithtime->ProjectionX("hadcX",10,20);
+       for(Int_t i=0;i<64;i++)
+       {
+               valBin=hadcXFull->GetBinContent(i+1);
+               if(valBin==0)
+                       NumberVoieOff++;
+               valBin=hadcX->GetBinContent(i+1);
+               if(valBin==0)
+                       numberBadOffset++;
+       }
+               
+       TFile * trendFile = new TFile(treePostFileName.Data(),"recreate");
+       ttree->Fill();
+       trendFile->cd();
+       ttree->Write();
+       trendFile->Close();
+       
+       if(canvasE)
+       {
+       
+               TCanvas * cOut = new TCanvas("cOut",Form("Run %d",runNumber));
+               cOut->Divide(2,2);
+               cOut->cd(1); cOut->GetPad(1)->SetLogy();
+               hAdcNoTimeA->Draw("l");
+               hAdcWithTimeA->Draw("same"); hAdcWithTimeA->SetLineColor(2);
+    
+               cOut->cd(2); cOut->GetPad(2)->SetLogy();
+               hAdcNoTimeC->Draw("l");
+               hAdcWithTimeC->Draw("same"); hAdcWithTimeC->SetLineColor(2);
+       
+                       cOut->cd(3); cOut->GetPad(3)->SetLogz();
+               hadcpmtwithtime->Draw("colz");
+       
+               cOut->cd(4); cOut->GetPad(4)->SetLogz();
+               hEvents->Draw("colz text");
+       
+               cOut->Print(Form("QA_Run_%d.pdf(",runNumber));
+       
+       
+               cOut->cd(1); cOut->GetPad(1)->SetLogy();
+               htimepmtA->GetXaxis()->SetRangeUser(-25.,25.); htimepmtA->Draw();
+       
+               cOut->cd(2); cOut->GetPad(2)->SetLogy();
+               htimepmtC->GetXaxis()->SetRangeUser(-25.,25.); htimepmtC->Draw();
+       
+                       cOut->cd(3); cOut->GetPad(3)->SetLogy();cOut->GetPad(3)->SetLogz(0);
+               hwidthA->GetXaxis()->SetRangeUser(0.,50.); hwidthA->Draw();
+       
+               cOut->cd(4); cOut->GetPad(4)->SetLogy();cOut->GetPad(4)->SetLogz(0);
+               hwidthC->GetXaxis()->SetRangeUser(0.,50.); hwidthC->Draw();
+       
+               cOut->Print(Form("QA_Run_%d.pdf",runNumber));
+               
+       
+               cOut->cd(1); cOut->GetPad(1)->SetLogy(0);cOut->GetPad(1)->SetLogz();
+               htimepmt->Draw("colz");
+       
+               cOut->cd(2); cOut->GetPad(2)->SetLogy(0);cOut->GetPad(2)->SetLogz();
+               hwidthpmt->GetYaxis()->SetRangeUser(0.,50.); hwidthpmt->Draw("colz");
+               
+               cOut->cd(3); cOut->GetPad(3)->SetLogy(0);cOut->GetPad(3)->SetLogz();
+               hadcwidthA->GetYaxis()->SetRangeUser(0.,50.); hadcwidthA->Draw("colz");
+       
+               cOut->cd(4); cOut->GetPad(4)->SetLogy(0);cOut->GetPad(4)->SetLogz();
+               hadcwidthC->GetYaxis()->SetRangeUser(0.,50.); hadcwidthC->Draw("colz");
+       
+               cOut->Print(Form("QA_Run_%d.pdf",runNumber));
+               
+       
+               cOut->cd(1); cOut->GetPad(1)->SetLogy(0);cOut->GetPad(1)->SetLogz();
+               hAdcTimeA->Draw("colz");
+       
+               cOut->cd(2); cOut->GetPad(2)->SetLogy(0);cOut->GetPad(2)->SetLogz();
+               hAdcTimeC->Draw("colz");
+       
+               cOut->cd(3); cOut->GetPad(3)->SetLogy(); cOut->GetPad(3)->SetLogz(0);
+               hV0ampl->Draw();
+       
+               cOut->cd(4); cOut->GetPad(4)->SetLogy(0); cOut->GetPad(4)->SetLogz(0);
+               htimecorr->Draw("colz");
+       
+               cOut->Print(Form("QA_Run_%d.pdf",runNumber));
+       
+               
+       
+               cOut->cd(1);  cOut->GetPad(1)->SetLogy(1);cOut->GetPad(1)->SetLogz(0);
+               hV0A->GetXaxis()->SetRangeUser(0.,33.);hV0A->Draw();
+       
+               cOut->cd(2); cOut->GetPad(2)->SetLogy(1);cOut->GetPad(2)->SetLogz(0);
+               hV0C->GetXaxis()->SetRangeUser(0.,33.);hV0C->Draw();
+       
+               cOut->cd(3); cOut->GetPad(3)->SetLogy(); cOut->GetPad(3)->SetLogz(0);
+               hV0multA->Draw();
+               
+               cOut->cd(4); cOut->GetPad(4)->SetLogy(); cOut->GetPad(3)->SetLogz(0);
+               hV0multC->Draw();
+       
+               cOut->Print(Form("QA_Run_%d.pdf",runNumber));
+       
+               
+               cOut->Clear();
+               cOut->Divide(2,3);
+       
+               cOut->cd(1);  cOut->GetPad(1)->SetLogy(0);cOut->GetPad(1)->SetLogz(1);
+               hVtxXYBB->Draw("colz");
+       
+               cOut->cd(2); cOut->GetPad(2)->SetLogy(1);cOut->GetPad(2)->SetLogz(0);
+               hVtxZBB->Draw();
+       
+               cOut->cd(3); cOut->GetPad(3)->SetLogy(0); cOut->GetPad(3)->SetLogz(1);
+               hVtxXYBGA->Draw("colz");
+       
+               cOut->cd(4); cOut->GetPad(4)->SetLogy(); cOut->GetPad(3)->SetLogz(0);
+               hVtxZBGA->Draw();
+       
+               cOut->cd(5); cOut->GetPad(5)->SetLogy(0); cOut->GetPad(5)->SetLogz(1);
+               hVtxXYBGC->Draw("colz");
+       
+               cOut->cd(6); cOut->GetPad(6)->SetLogy(); cOut->GetPad(6)->SetLogz(0);
+               hVtxZBGC->Draw();
+               
+               cOut->Print(Form("QA_Run_%d.pdf)",runNumber));
+               delete cOut;
+                                       
+       }
+       delete v0QAdir;
+       return 0;
+}
index 2b427c624502051f39ea4b3103b69091684e9b4a..bc75069b3aacd8a4a16d9f14e0f90c4e3bc28ad0 100644 (file)
@@ -78,7 +78,7 @@ TString suftype      ="eps"                        : the suffix that deternmines
 Float_t jetR         = 0.2                         : the jetR. Default train value is 0.2, but can otherwise be found by opening the AnalysisResults.root file with the browser.
 Float_t minTrkPT     = 0.15                        : the lower Track momentum cut-off. Default train value is 0.15, but can otherwise be found by opening the AnalysisResults.root file with the browser.
 Float_t minClusterET = 0.3                         : the lower Cluster energy cut-off. Default train value is 0.3, but can otherwise be found by opening the AnalysisResults.root file with the browser.
-Int_t run            = 0                           : enables to add a run number to the plots. Not neccessary for general QA, and can be suppresed by giving the number 0.
+nt_t run            = 0                           : enables to add a run number to the plots. Not neccessary for general QA, and can be suppresed by giving the number 0.
 TString trigsuffix   = ""                          : leave empty to open the results of the JE_TriggerQAFullR020 wagon, but or use "EJE" or "EGA" to use the triggered results otherwise.
 const char* outfile  = "JETriggerQA_outfile.root"  : the path to the place to store the plots as root file. This is in addition to the image files made with in the 'suffix' format.
 
index 8c056fa6d26f8fec91d8263778d8079fea858953..0951ce2552fbdc892960e5e0e58a00ed95f018e9 100644 (file)
@@ -145,10 +145,10 @@ void CaloQA()
   ccalo->cd(2);
   //gPad->SetLogy();
   
-  TH1F* hRaw  = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open");
-  TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells");
-  TH1F* hTM   = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching");
-  TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID");
+  TH1F* hRaw  = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_0_Open");
+  TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_4_NCells");
+  TH1F* hTM   = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_7_Matching");
+  TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hPt_Cut_9_PID");
   
   hRaw->Sumw2();
   
@@ -637,9 +637,9 @@ void CorrelationQA()
   Float_t assocBins[] = {0.5,2.,5.,10.,20.};
   Int_t nAssocBins = 4;
   
-  TH1F * hLeading = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtLeading");
-  Int_t minClusterEBin = hLeading->FindBin(minClusterE);
-  Float_t nTrig = hLeading->Integral(minClusterE,100000);
+  TH1F * hTrigger = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtTrigger");
+  Int_t minClusterEBin = hTrigger->FindBin(minClusterE);
+  Float_t nTrig = hTrigger->Integral(minClusterE,100000);
   
   //Azimuthal correlation
   cCorrelation->cd(1);
@@ -754,9 +754,13 @@ void MCQA()
   if(!h2ClusterPho) return;
   
   
-  TH1F* hPrimPho = (TH1F*) GetHisto("QA_hGenMCAccE_Photon");
-  TH1F* hPrimPi0 = (TH1F*) GetHisto("QA_hGenMCAccE_Pi0");
-  TH1F* hPrimEta = (TH1F*) GetHisto("QA_hGenMCAccE_Eta");
+//  TH1F* hPrimPho = (TH1F*) GetHisto("QA_hGenMCAccE_Photon");
+//  TH1F* hPrimPi0 = (TH1F*) GetHisto("QA_hGenMCAccE_Pi0");
+//  TH1F* hPrimEta = (TH1F*) GetHisto("QA_hGenMCAccE_Eta");
+  
+  TH1F* hPrimPho = (TH1F*) GetHisto("AnaPhoton_hPtPrim_MCPhoton");
+  TH1F* hPrimPi0 = (TH1F*) GetHisto("AnaPi0_hPrimPi0Pt");
+  TH1F* hPrimEta = (TH1F*) GetHisto("AnaPi0_hPrimEtaPt");
   
   TCanvas * cmc = new TCanvas(Form("MCHisto_%s",histoTag.Data()),"",1000,1000);
   cmc->Divide(2,2);
@@ -773,7 +777,8 @@ void MCQA()
   hClusterPho->SetMarkerColor(1);
   hClusterPho->SetMarkerStyle(20);
   hClusterPho->SetAxisRange(0.,50.,"X");
-  hClusterPho->SetXTitle("E_{rec,gen} (GeV)");
+  //hClusterPho->SetXTitle("E_{rec,gen} (GeV)");
+  hClusterPho->SetXTitle("E_{rec}, p_{T,gen} (GeV)");
   hClusterPho->Draw("");
 
   hClusterPi0->Sumw2();
@@ -855,6 +860,10 @@ void MCQA()
   TH1F* hPrimPi0Phi = (TH1F*) h2PrimPi0Phi->ProjectionY("PrimPi0Phi",binMin,1000);
   TH1F* hPrimEtaPhi = (TH1F*) h2PrimEtaPhi->ProjectionY("PrimEtaPhi",binMin,1000);
 
+  hPrimPhoPhi->Sumw2();
+  hPrimPi0Phi->Sumw2();
+  hPrimEtaPhi->Sumw2();
+  
   hPrimPhoPhi->Scale(1./hPrimPhoPhi->Integral(0,1000));
   hPrimPi0Phi->Scale(1./hPrimPi0Phi->Integral(0,1000));
   hPrimEtaPhi->Scale(1./hPrimEtaPhi->Integral(0,1000));
@@ -874,12 +883,10 @@ void MCQA()
   hPrimPi0Phi->SetYTitle("1/total entries dN/d#phi");
   hPrimPi0Phi->SetTitle("Generated particles #phi for E > 3 GeV");
   hPrimPi0Phi->SetTitleOffset(1.6,"Y");
-  hPrimPi0Phi->Sumw2();
   hPrimPi0Phi->SetMarkerColor(4);
   hPrimPi0Phi->SetMarkerStyle(21);
   hPrimPi0Phi->Draw("");
   
-  hPrimPhoPhi->Sumw2();
   hPrimPhoPhi->SetMarkerColor(1);
   hPrimPhoPhi->SetMarkerStyle(20);
   Float_t scale = TMath::RadToDeg();
@@ -887,7 +894,6 @@ void MCQA()
   hPrimPhoPhi->Draw("same");
 
 
-  hPrimEtaPhi->Sumw2();
   hPrimEtaPhi->SetMarkerColor(2);
   hPrimEtaPhi->SetMarkerStyle(22);
   hPrimEtaPhi->Draw("same");
@@ -899,6 +905,10 @@ void MCQA()
   TH2F* h2PrimPi0Eta = (TH2F*) GetHisto("AnaPi0_hPrimPi0Rapidity");
   TH2F* h2PrimEtaEta = (TH2F*) GetHisto("AnaPi0_hPrimEtaRapidity");
   
+  h2PrimPhoEta->Sumw2();
+  h2PrimEtaEta->Sumw2();
+  h2PrimPi0Eta->Sumw2();
+
   Int_t binMin = hPrimPho->FindBin(3);
   
   TH1F* hPrimPhoEta = (TH1F*) h2PrimPhoEta->ProjectionY("PrimPhoEta",binMin,1000);
@@ -924,18 +934,15 @@ void MCQA()
   hPrimPi0Eta->SetYTitle("1/total entries dN/d#eta");
   hPrimPi0Eta->SetTitle("Generated particles #eta for E > 3 GeV");
   hPrimPi0Eta->SetTitleOffset(1.6,"Y");
-  hPrimPi0Eta->Sumw2();
   hPrimPi0Eta->SetMarkerColor(4);
   hPrimPi0Eta->SetMarkerStyle(21);
   hPrimPi0Eta->Draw("");
   
-  hPrimPhoEta->Sumw2();
   hPrimPhoEta->SetMarkerColor(1);
   hPrimPhoEta->SetMarkerStyle(20);
   Float_t scale = TMath::RadToDeg();
   hPrimPhoEta->Draw("same");
   
-  hPrimEtaEta->Sumw2();
   hPrimEtaEta->SetMarkerColor(2);
   hPrimEtaEta->SetMarkerStyle(22);
   hPrimEtaEta->Draw("same");
diff --git a/PWGPP/analysisQA/processFemtoQA.C b/PWGPP/analysisQA/processFemtoQA.C
new file mode 100644 (file)
index 0000000..860c57f
--- /dev/null
@@ -0,0 +1,120 @@
+/***************************************************************
+ processFemtoQA.C
+ Post Processing of Femto QA task in Analysis QA train
+ Author: Maciej Szymanski, maszyman@cern.ch
+***************************************************************/
+
+enum collidingSystem {
+  PbPb,
+  pPb,
+  pp
+};
+
+Double_t calculateNormalizationFactor(TH1D *num,TH1D *den, Double_t qlo=0.3,Double_t qhi=0.4)
+{
+  Double_t binlo = num->GetXaxis()->FindFixBin(qlo);
+  Double_t binhi = num->GetXaxis()->FindFixBin(qhi);
+  Double_t integralNum = num->Integral(binlo, binhi);
+  Double_t integralDen = den->Integral(binlo, binhi);
+  return integralDen / integralNum;
+}
+
+void processFemtoQA(const char *filePath = "AnalysisResults.root",
+                    const char *listname = "femtolist",
+                    const char *suffix = "png",
+                    enum collidingSystem system = PbPb) {
+
+  TFile *_file = new TFile(filePath,"read");
+  TList* _femtolist = (TList*)_file->Get(Form("PWG2FEMTO/%s",listname));
+
+  // 1D pion correlation function low kT
+  TH1D* numCFlowkT = (TH1D*)_femtolist->FindObject("NumcqinvpimtpcM0kT0");
+  TH1D* denCFlowkT = (TH1D*)_femtolist->FindObject("DencqinvpimtpcM0kT0");
+  Double_t norm = calculateNormalizationFactor(numCFlowkT,denCFlowkT,0.4,0.45 );
+  numCFlowkT->Divide(denCFlowkT);
+  numCFlowkT->Scale(norm);
+  numCFlowkT->SetXTitle("q_{inv} (GeV/c)");
+  numCFlowkT->SetYTitle("C(q_{inv})");
+  numCFlowkT->GetXaxis()->SetRangeUser(0,0.5);
+  numCFlowkT->GetYaxis()->SetRangeUser(0.5,2.5);
+
+  // 1D pion correlation function high kT
+  TH1D* numCFhighkT = (TH1D*)_femtolist->FindObject("NumcqinvpimtpcM0kT3");
+  TH1D* denCFhighkt = (TH1D*)_femtolist->FindObject("DencqinvpimtpcM0kT3");
+  Double_t norm = calculateNormalizationFactor(numCFhighkT,denCFhighkt,0.4,0.45 );
+  numCFhighkT->Divide(denCFhighkt);
+  numCFhighkT->Scale(norm);
+  numCFhighkT->SetXTitle("q_{inv} (GeV/c)");
+  numCFhighkT->SetYTitle("C(q_{inv})");
+  numCFhighkT->SetTitle(Form());
+  numCFhighkT->GetXaxis()->SetRangeUser(0,0.5);
+  numCFhighkT->GetYaxis()->SetRangeUser(0.5,2.5);
+
+  // delta eta - delta phi* low kT
+  TH2D* numPhiEtalowkT = (TH2D*)_femtolist->FindObject("NumRadDPhistarEtapimtpcM0kT0");
+  TH2D* denPhiEtalowkT = (TH2D*)_femtolist->FindObject("DenRadDPhistarEtapimtpcM0kT0");
+  numPhiEtalowkT->Divide(denPhiEtalowkT);
+  numPhiEtalowkT->SetXTitle("#Delta #phi*");
+  numPhiEtalowkT->SetYTitle("#Delta #eta");
+  numPhiEtalowkT->SetTitle(Form());
+
+  // delta eta - delta phi* high kT
+  TH2D* numPhiEtahighkT = (TH2D*)_femtolist->FindObject("NumRadDPhistarEtapimtpcM0kT3");
+  TH2D* denPhiEtahighkt = (TH2D*)_femtolist->FindObject("DenRadDPhistarEtapimtpcM0kT3");
+  numPhiEtahighkT->Divide(denPhiEtahighkt);
+  numPhiEtahighkT->SetXTitle("#Delta #phi*");
+  numPhiEtahighkT->SetYTitle("#Delta #eta");
+  numPhiEtahighkT->SetTitle(Form());
+
+  // qinv vs. separation at TPC entrance low kT
+  TH2D* numQinvEtpclowkT = (TH2D*)_femtolist->FindObject("NumDTPCPhistarEtapimtpcM0kT0");
+  TH2D* denQinvEtpclowkT = (TH2D*)_femtolist->FindObject("DenDTPCPhistarEtapimtpcM0kT0");
+  numQinvEtpclowkT->Divide(denQinvEtpclowkT);
+  numQinvEtpclowkT->SetXTitle("q_{inv} (GeV/c)");
+  numQinvEtpclowkT->SetYTitle("separation at TPC entrance");
+  numQinvEtpclowkT->SetTitle(Form());
+
+  // qinv vs. separation at TPC entrance high kT
+  TH2D* numQinvEtpchighkT = (TH2D*)_femtolist->FindObject("NumDTPCPhistarEtapimtpcM0kT3");
+  TH2D* denQinvEtpchighkt = (TH2D*)_femtolist->FindObject("DenDTPCPhistarEtapimtpcM0kT3");
+  numQinvEtpchighkT->Divide(denQinvEtpchighkt);
+  numQinvEtpchighkT->SetXTitle("q_{inv} (GeV/c)");
+  numQinvEtpchighkT->SetYTitle("separation at TPC entrance");
+  numQinvEtpchighkT->SetTitle(Form());
+
+  if ( system == PbPb ) {
+    numCFlowkT->SetTitle("#pi^{-}#pi^{-} 0-10%, 0.2 < k_{T} < 0.3 GeV/c");
+    numCFhighkT->SetTitle("#pi^{-}#pi^{-} 0-10%, 0.6 < k_{T} < 0.7 GeV/c");
+  }
+  else if ( system == pPb ) {
+    numCFlowkT->SetTitle("#pi^{-}#pi^{-} 0-20%, 0.2 < k_{T} < 0.3 GeV/c");
+    numCFhighkT->SetTitle("#pi^{-}#pi^{-} 0-20%, 0.6 < k_{T} < 0.7 GeV/c");
+  }
+  else if ( system == pp ) {
+    numCFlowkT->SetTitle("#pi^{-}#pi^{-} N_{ch} 50-150, 0.2 < k_{T} < 0.3 GeV/c");
+    numCFhighkT->SetTitle("#pi^{-}#pi^{-} N_{ch} 50-150, 0.6 < k_{T} < 0.7 GeV/c");
+  }
+
+  gStyle->SetOptStat(0);
+  TCanvas* _can = new TCanvas("Femto QA","Femto QA");
+  _can->Divide(2,3);
+  _can->cd(1);
+  numCFlowkT->Draw();
+  _can->cd(2);
+  numCFhighkT->Draw();
+  _can->cd(3);
+  numPhiEtalowkT->Draw("colz");
+  _can->cd(4);
+  numPhiEtahighkT->Draw("colz");
+  _can->cd(5);
+  numQinvEtpclowkT->Draw("colz");
+  _can->cd(6);
+  numQinvEtpchighkT->Draw("colz");
+
+  _can->SaveAs(Form("fig_cf_FemtoQA.%s",suffix));
+
+  _file->Close();
+
+  delete _file;
+  delete _can;
+}
index 7109c73c00f34c2f879fe5c46250a37bb1fdfcc8..c31254a4fc828ab223623e1fea37762b8aa3299f 100644 (file)
@@ -554,6 +554,10 @@ void AliAnalysisTaskK0sBayes::Analyze(AliAODEvent* aodEvent)
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
   AliPIDResponse *PIDResponse=inputHandler->GetPIDResponse();
 
+  PIDResponse->SetTOFResponse(aodEvent,AliPIDResponse::kTOF_T0);
+
+  PIDResponse->GetTOFResponse().SetTOFtailAllPara(-3,1.1);
+
   fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
 
   Double_t probP[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
index 1e343a674bf327c12511b660c79b0e977adf9ef7..152189090f0c19e1a928b1b69a2e3cd03714f773 100644 (file)
@@ -557,6 +557,8 @@ void AliAnalysisTaskLambdaBayes::Analyze(AliAODEvent* aodEvent)
   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
   AliPIDResponse *PIDResponse=inputHandler->GetPIDResponse();
+  PIDResponse->SetTOFResponse(aodEvent,AliPIDResponse::kTOF_T0);
+  PIDResponse->GetTOFResponse().SetTOFtailAllPara(-3,1.1);
 
 //   PIDResponse->GetTOFResponse().SetTrackParameter(0,0.);
 //   PIDResponse->GetTOFResponse().SetTrackParameter(1,0.);
index 8b355a2fb777fc4188c9922548da0163fe8dbfd7..aee5234a90d5776c9d28ae2a169c3cea195b59b8 100644 (file)
@@ -528,6 +528,8 @@ void AliAnalysisTaskPhiBayes::Analyze(AliAODEvent* aodEvent)
   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
   AliPIDResponse *PIDResponse=inputHandler->GetPIDResponse();
+  PIDResponse->SetTOFResponse(aodEvent,AliPIDResponse::kTOF_T0);
+  PIDResponse->GetTOFResponse().SetTOFtailAllPara(-3,1.1);
 
 //   PIDResponse->GetTOFResponse().SetTrackParameter(0,0.);
 //   PIDResponse->GetTOFResponse().SetTrackParameter(1,0.);
index 8b221d917751d06c23c7e1d3a860f312f7b320be..7e2d667e705c3c9dcd3596c718d17b678a25dedd 100644 (file)
@@ -296,14 +296,15 @@ void doeffKa(Int_t pos,Float_t prob,Float_t etaminkp,Float_t etamaxkp){
     expt[i] = (-ptmin+ptmax)/2;
     eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS);
 
-    b[i][0] = b[i][0]-b2[i][0]*weightS;
+    //    b[i][0] = b[i][0]-b2[i][0]*weightS;
 
-    if(b[i][0] < 0.5) b[i][0] = 0.5;
-    if(b2[i][0] < 0.5) b2[i][0] = 0.5;
+    //    if(b[i][0] < 0.5) b[i][0] = 0.5;
+    //    if(b2[i][0] < 0.5) b2[i][0] = 0.5;
 
 
-    efferr[i] = TMath::Abs(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
-    efferr[i] = TMath::Sqrt(efferr[i]);
+    //    efferr[i] = TMath::Abs(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
+    //    efferr[i] = TMath::Sqrt(efferr[i]);
+    efferr[i] = 1./(b[i][0]-b2[i][0]*weightS)/(b[i][0]-b2[i][0]*weightS)*TMath::Sqrt(b[i][0]*b[i][0]*b2[i][1]*b2[i][1] + b2[i][0]*b2[i][0]*b[i][1]*b[i][1]);
 
     if(TMath::Abs(efferr[i]) > 1)efferr[i]=1;
   }
index f70d6ad23e7ef608cefe89a753bfea4b6a8a6e88..15ebc02eb6df6bee6e050087ef83a31e195cb666 100644 (file)
@@ -284,9 +284,11 @@ void doeffPi(Int_t pos,Float_t prob,Float_t etaminkp,Float_t etamaxkp){
     expt[i] = (-ptmin+ptmax)/2;
     eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS);
 
-    b[i][0] = b[i][0]-b2[i][0]*weightS;
+    //    b[i][0] = b[i][0]-b2[i][0]*weightS;
 
-    efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
+    //    efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
+
+    efferr[i] = 1./(b[i][0]-b2[i][0]*weightS)/(b[i][0]-b2[i][0]*weightS)*TMath::Sqrt(b[i][0]*b[i][0]*b2[i][1]*b2[i][1] + b2[i][0]*b2[i][0]*b[i][1]*b[i][1]);
 
     if(TMath::Abs(efferr[i]) > 1)efferr[i]=1;
   }
index bbd89376e7013da56ac4b9103e384e63484876d6..a4c61a2ba71f578beb3fdbdcfcf25e64947dbf80 100644 (file)
@@ -283,9 +283,11 @@ void doeffPr(Int_t pos,Float_t prob,Float_t etaminkp,Float_t etamaxkp){
     expt[i] = (-ptmin+ptmax)/2;
     eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS);
 
-    b[i][0] = b[i][0]-b2[i][0]*weightS;
+    //    b[i][0] = b[i][0]-b2[i][0]*weightS;
 
-    efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
+    //    efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));
+
+    efferr[i] = 1./(b[i][0]-b2[i][0]*weightS)/(b[i][0]-b2[i][0]*weightS)*TMath::Sqrt(b[i][0]*b[i][0]*b2[i][1]*b2[i][1] + b2[i][0]*b2[i][0]*b[i][1]*b[i][1]);
 
     if(TMath::Abs(efferr[i]) > 1)efferr[i]=1;
   }
diff --git a/PWGUD/DIFFRACTIVE/QA/AddTaskCPQA.C b/PWGUD/DIFFRACTIVE/QA/AddTaskCPQA.C
new file mode 100755 (executable)
index 0000000..bc0f782
--- /dev/null
@@ -0,0 +1,74 @@
+void AddTaskCPQA(Bool_t useMC = kFALSE, Bool_t useTender = kFALSE) {
+
+   Printf("adding task QA for central production\n");
+
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if(!mgr){
+      ::Error("AddTaskCPQA", "No analysis manager to connect to.");
+      return NULL;
+   }
+
+   if(!mgr->GetInputEventHandler()){
+      ::Error("AddTaskCPQA", "This task requires an input event handler.");
+      return NULL;
+   }
+
+   
+  
+  AliAnalysisTaskCPQA *task = new AliAnalysisTaskCPQA("QADiffractive");
+  task->UseMC(useMC);
+   
+
+if(useTender) {
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
+  gROOT->LoadMacro("AddTaskTender.C");
+  AliAnalysisTask* tender=0x0;
+if(!useMC)
+    {
+        tender = AddTaskTender(kTRUE);
+      // tender->SetDebugLevel(10);
+    }
+  else
+    {
+      tender = AddTaskTender(kFALSE);
+      // tender->SetDebugLevel(10);
+    }
+ }
+
+
+ if(!useMC && 0)
+   {
+    
+     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+
+    AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(useMC);
+    physSelTask->GetPhysicsSelection()->SetUseBXNumbers(kFALSE);
+
+    if(!useMC){
+      
+    gROOT->LoadMacro("ConfigurePhysSelection.C");
+    AliOADBPhysicsSelection * oadb =  ConfigurePhysSelection(runNb);
+
+    AliOADBFillingScheme * fsDefault = 0;
+
+    physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadb,fsDefault);
+  
+      // task->SelectCollisionCandidates(AliVEvent::kUserDefined);
+    }
+       task->SelectCollisionCandidates(AliVEvent::kMB);
+   }
+
+ TString basefilename = AliAnalysisManager::GetCommonFileName();
+
+   AliAnalysisDataContainer *output = mgr->CreateContainer("UDQAClist", TList::Class(), AliAnalysisManager::kOutputContainer, basefilename.Data());
+
+  // add our task to the manager
+  mgr->AddTask(task);
+
+  // finaly connect input and output
+  mgr->ConnectInput(task, 0,  mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(task, 1, output);
+
+
+   return;
+ }
diff --git a/PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.cxx b/PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.cxx
new file mode 100755 (executable)
index 0000000..05dc2b1
--- /dev/null
@@ -0,0 +1,306 @@
+// QA task for central production study
+// author: Martin Poghosyan
+
+#include <TList.h>
+#include <TTree.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TH3F.h>
+
+
+#include "AliVEvent.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliHeader.h"
+#include "AliESDInputHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliMultiplicity.h"
+#include "AliTriggerAnalysis.h"
+#include "AliESDVertex.h"
+#include "AliESDtrackCuts.h"
+
+#include "AliAnalysisTaskCPQA.h"
+
+
+ClassImp(AliAnalysisTaskCPQA)
+
+//________________________________________________________________________
+  AliAnalysisTaskCPQA::AliAnalysisTaskCPQA(const char *name)
+  : AliAnalysisTaskSE(name),
+  fUseMC(kFALSE),
+  fESD(0),
+  fOutputList(0),
+  fhEvent(0),
+  fTriggerAnalysis(0)
+
+{
+  for(Int_t i = 0; i<4; i++)
+    {
+      fhV0A[i]=0;
+      fhV0C[i]=0;
+      fhV0online[i]=0;
+      fhV0offline[i]=0;
+      fhSPDFiredChip[i]=0;
+      fhSPDFastOrChip[i]=0;
+      fhReferenceMultiplicity[i]=0;
+      fhVtxTrack[i]=0;
+    }
+
+  fEtaMaxM = 2;
+  fEtaMaxD = 0.9;
+  fVtxZmax = 10;
+
+  DefineOutput(1, TList::Class());
+}
+
+AliAnalysisTaskCPQA::~AliAnalysisTaskCPQA() 
+{
+   if (fOutputList && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
+    printf("Deleteing output\n");
+
+    if(fOutputList){
+      delete fOutputList;
+      fOutputList = 0;
+    }
+
+        if(fTriggerAnalysis)
+          delete fTriggerAnalysis;
+
+   }
+}
+
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCPQA::UserCreateOutputObjects()
+{
+  fTriggerAnalysis = new AliTriggerAnalysis();
+  if (fUseMC) fTriggerAnalysis->SetAnalyzeMC(1);
+
+  // Create histograms
+  // Called once
+
+  fOutputList = new TList();
+  fOutputList->SetOwner();
+
+
+  fhEvent = new TH1F("hEvent","hEvent",100, -0.5, 99.5); 
+  fOutputList->Add(fhEvent);
+
+  for(Int_t i = 0; i<4; i++)
+    {
+      fhV0A[i] = Hist2D(Form("hV0A_%d",i), 5, -1.5, 3.5, 5, -1.5, 3.5,"V0A_{online}","V0A_{offline}"); fOutputList->Add(fhV0A[i]);
+      fhV0C[i] = Hist2D(Form("hV0C_%d",i), 5, -1.5, 3.5, 5, -1.5, 3.5,"V0C_{online}","V0C_{offline}"); fOutputList->Add(fhV0C[i]);
+      fhV0online[i]  = Hist2D(Form("hV0online_%d",i) , 5, -1.5, 3.5, 5, -1.5, 3.5,"V0C_{online}","V0A_{online}"); fOutputList->Add(fhV0online[i]);
+      fhV0offline[i] = Hist2D(Form("hV0offline_%d",i), 5, -1.5, 3.5, 5, -1.5, 3.5,"V0C_{offline}","V0A_{offline}"); fOutputList->Add(fhV0offline[i]);
+      fhSPDFiredChip[i] = Hist1D(Form("fhSPDFiredChip_%d",i), 1200, -0.5, 1199.5); fOutputList->Add(fhSPDFiredChip[i]);
+      fhSPDFastOrChip[i] = Hist1D(Form("fhSPDFastOrChip_%d",i), 1200, -0.5, 1199.5); fOutputList->Add(fhSPDFastOrChip[i]);
+      fhReferenceMultiplicity[i] = Hist1D(Form("fhReferenceMultiplicity_%d",i), 50, -10.5, 39.5);  fOutputList->Add(fhReferenceMultiplicity[i]);
+      fhVtxTrack[i] = Hist3D(Form("fhVtxTrack_%d",i), 100, -1, 1, 100, -1, 1, 1000, -30, 30, "x_{vtx}", "y_{vtx}", "z_{vtx}"); fOutputList->Add(fhVtxTrack[i]);
+   }
+
+  PostData(1, fOutputList);
+
+}
+
+
+
+TH1F* AliAnalysisTaskCPQA::Hist1D(const char* name, Int_t nBins, Double_t xMin, Double_t xMax,  const char* xLabel, Int_t color, Int_t lst, const char* yLabel)
+{
+// create a 1D histogram
+
+  TH1F* res = new TH1F(name, name, nBins, xMin, xMax);
+  if (xLabel) res->GetXaxis()->SetTitle(xLabel);
+  if (yLabel) res->GetYaxis()->SetTitle(yLabel);
+  res->SetLineColor(color);
+  res->SetMarkerColor(color);
+  res->SetLineStyle(lst);
+  return res;
+}
+
+
+TH2F *AliAnalysisTaskCPQA::Hist2D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, const char* xLabel, const char* yLabel, Int_t color)
+{
+// create a 2D histogram
+
+  TH2F *res = new TH2F(name, name, nBinsx, xMin, xMax, nBinsy, yMin, yMax);
+  if (xLabel) res->GetXaxis()->SetTitle(xLabel);
+  if (yLabel) res->GetYaxis()->SetTitle(yLabel);
+  //  res->SetMarkerStyle(kFullCircle);
+  //  res->SetOption("E");
+  res->SetLineColor(color);
+  //  fOutputList->Add(res);
+  return res;
+}
+
+  TH3F *AliAnalysisTaskCPQA::Hist3D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax,  Int_t nBinsz, Double_t zMin, Double_t zMax, const char* xLabel, const char* yLabel, const char *zLabel)
+{
+// create a 3D histogram
+
+  TH3F *res = new TH3F(name, name, nBinsx, xMin, xMax, nBinsy, yMin, yMax, nBinsz, zMin, zMax);
+  if (xLabel) res->GetXaxis()->SetTitle(xLabel);
+  if (yLabel) res->GetYaxis()->SetTitle(yLabel);
+  if (zLabel) res->GetZaxis()->SetTitle(zLabel);
+  //  res->SetMarkerStyle(kFullCircle);
+  //  res->SetOption("E");
+  //  res->SetLineColor(color);
+  //  fOutputList->Add(res);
+  return res;
+}
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCPQA::UserExec(Option_t *)
+{
+  // Main loop
+  // Called for each event
+
+  //    return;
+  AliVEvent *event = InputEvent();
+  if (!event) {
+     Error("UserExec", "Could not retrieve event");
+     return;
+  }
+
+  fESD = dynamic_cast<AliESDEvent*> (InputEvent());
+  if (fESD) {
+    LoopESD();
+      if (fUseMC)
+         LoopESDMC();
+  }
+
+
+
+  PostData(1, fOutputList);
+}      
+
+//________________________________________________________________________
+void AliAnalysisTaskCPQA::Terminate(Option_t*)
+{
+}
+
+
+void AliAnalysisTaskCPQA::LoopESDMC()
+{
+  // Main loop
+  // Called for each event
+  /*
+
+  Int_t indexD1 = 1;
+  Int_t indexD2 = 2;
+
+
+  AliMCEvent *mcEvent = (AliMCEvent*) MCEvent();
+  if (!mcEvent) {
+    Error("LoopESDMC", "Could not retrieve MC event");
+    return;
+  }
+
+
+  AliHeader* header = mcEvent->Header();
+  if (!header)
+    {
+          AliDebug(AliLog::kError, "Header not available");
+          return;
+    }
+
+  AliGenEventHeader* genHeader = header->GenEventHeader();
+  if(!genHeader)
+    {
+      AliDebug(AliLog::kError, "GenHeader not available");
+      return;
+    }
+
+*/  
+
+}
+
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCPQA::LoopESD()
+{
+   Int_t TrType = 0;
+   Bool_t fkIsPhysSel = kFALSE;
+
+  fhEvent->Fill(0);
+
+  if(!fUseMC)
+    {
+      TrType = -1;
+      if(fESD->IsTriggerClassFired("CINT1-B-NOPF-ALLNOTRD"))        TrType=0;
+      else if(fESD->IsTriggerClassFired("CINT1-AC-NOPF-ALLNOTRD"))  TrType=1;
+      else if(fESD->IsTriggerClassFired("CINT1-E-NOPF-ALLNOTRD"))   TrType=3;
+
+      else if(fESD->IsTriggerClassFired("CINT1-B-NOPF-FASTNOTRD"))  TrType=0;
+      else if(fESD->IsTriggerClassFired("CINT1-AC-NOPF-FASTNOTRD")) TrType=1;
+      else if(fESD->IsTriggerClassFired("CINT1-E-NOPF-FASTNOTRD"))  TrType=3;
+
+      else if(fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL"))  TrType=0;
+      else if(fESD->IsTriggerClassFired("CINT1A-ABCE-NOPF-ALL"))  TrType=1;
+      else if(fESD->IsTriggerClassFired("CINT1C-ABCE-NOPF-ALL"))  TrType=2;
+      else if(fESD->IsTriggerClassFired("CINT1-E-NOPF-ALL"))      TrType=3;
+
+      UInt_t mask =  ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+      fkIsPhysSel=(mask & AliVEvent::kMB) ? 1 : 0; // check if minimum bias trigger class fired
+
+      if(!fkIsPhysSel) return;
+      printf("TrType = %d\n",TrType);
+      if(TrType==-1) return;
+    }
+
+  fhEvent->Fill(1);
+
+
+  Int_t V0Aonline  = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide, kTRUE) ;
+  Int_t V0Conline  = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kTRUE) ;
+  Int_t V0Aoffline = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide, kFALSE) ;
+  Int_t V0Coffline = fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kFALSE) ;
+
+
+  fhV0A[TrType]->Fill(V0Aonline, V0Aoffline);
+  fhV0C[TrType]->Fill(V0Conline, V0Coffline);
+  fhV0online[TrType]->Fill(V0Conline, V0Aonline);
+  fhV0offline[TrType]->Fill(V0Coffline, V0Aoffline);
+
+
+  if(V0Aoffline!=0 || V0Coffline!=0) 
+    {
+      return;
+    }
+  fhEvent->Fill(2);
+
+  const AliMultiplicity *mult = fESD->GetMultiplicity();
+  for (Int_t i=0; i<1200; i++)
+    {
+      if(mult->TestFiredChipMap(i)) fhSPDFiredChip[TrType]->Fill(i);
+      if(mult->TestFastOrFiredChips(i)) fhSPDFastOrChip[TrType]->Fill(i);
+    }
+
+
+  fhReferenceMultiplicity[TrType]->Fill(AliESDtrackCuts::GetReferenceMultiplicity(fESD,AliESDtrackCuts::kTrackletsITSTPC,1.2));
+
+
+  const AliESDVertex *primaryTrackVtx = fESD->GetPrimaryVertexTracks();
+  if (!primaryTrackVtx->GetStatus() && !primaryTrackVtx->GetStatus() )
+    {
+      return;
+    }
+
+  fhEvent->Fill(3);
+
+  fhVtxTrack[TrType]->Fill(primaryTrackVtx->GetX(), primaryTrackVtx->GetY(), primaryTrackVtx->GetZ());
+
+
+
+  return;
+}   
+
diff --git a/PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.h b/PWGUD/DIFFRACTIVE/QA/AliAnalysisTaskCPQA.h
new file mode 100755 (executable)
index 0000000..2b9fdf3
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIANALYSISTASKCPQA_H
+#define ALIANALYSISTASKCPQA_H
+
+class TList;
+class TH1F;
+class TH2F;
+class TH3F;
+class AliTriggerAnalysis;
+
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskCPQA : public AliAnalysisTaskSE {
+ public:
+
+  AliAnalysisTaskCPQA(const char *name="<default name>");
+  virtual ~AliAnalysisTaskCPQA() ;// { /*if (fOutputList) delete fOutputList;*/}
+  
+  virtual void   UserCreateOutputObjects();
+  virtual void   UserExec(Option_t* option);
+  virtual void   Terminate(Option_t *);
+
+  void LoopESD();
+  void LoopESDMC();
+
+  
+  void UseMC(Bool_t useMC=kTRUE) { fUseMC = useMC;}
+  
+ private:
+  Bool_t       fUseMC;
+  AliESDEvent *fESD; // esd event
+  TList              *fOutputList; // output list
+
+  TH1F *fhEvent;//!
+
+
+  Double_t fEtaMaxM;
+  Double_t fEtaMaxD;
+  Double_t fVtxZmax;
+
+  TH2F *fhV0A[4];//!
+  TH2F *fhV0C[4];//!
+  TH2F *fhV0online[4];//!
+  TH2F *fhV0offline[4];//!
+  TH1F *fhSPDFiredChip[4];//!
+  TH1F *fhSPDFastOrChip[4];//!
+  TH1F *fhReferenceMultiplicity[4];//!
+  TH3F *fhVtxTrack[4];//!
+
+  AliTriggerAnalysis * fTriggerAnalysis; // trigger analysis object, to get the offline triggers
+
+  TH1F* Hist1D(const char* name, Int_t nBins, Double_t xMin, Double_t xMax,  const char* xLabel="", Int_t color=1, Int_t ls=1, const char* yLabel="");
+  TH2F *Hist2D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, const char* xLabel="", const char* yLabel="", Int_t color=1);
+  TH3F *Hist3D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax,  Int_t nBinsz, Double_t zMin, Double_t zMax, const char* xLabel="", const char* yLabel="", const char *zLabel="");
+
+  // public:
+  //  AliAnalysisTaskCPQA(const AliAnalysisTaskCPQA&); // not implemented
+  //  AliAnalysisTaskCPQA& operator=(const AliAnalysisTaskCPQA&); // not implemented
+  
+  ClassDef(AliAnalysisTaskCPQA, 1);// example of analysis
+};
+
+#endif
index 0c3a42694bd2e3969fefd53927481fe49ebba73f..4a32c7409c526346f5da07d9eae5eb639b3edcce 100644 (file)
@@ -142,6 +142,7 @@ void AliAnalysisTaskUpcPsi2s::Init()
        fVtxPos[i] = -666; 
        fVtxErr[i] = -666;
        fKfVtxPos[i] = -666;
+       fSpdVtxPos[i] = -666;
        }
 
 }//Init
@@ -225,6 +226,7 @@ void AliAnalysisTaskUpcPsi2s::UserCreateOutputObjects()
   fJPsiTree ->Branch("fVtxNDF", &fVtxNDF, "fVtxNDF/D");
   
   fJPsiTree ->Branch("fKfVtxPos", &fKfVtxPos[0], "fKfVtxPos[3]/D");
+  fJPsiTree ->Branch("fSpdVtxPos", &fSpdVtxPos[0], "fSpdVtxPos[3]/D");
   
   fJPsiTree ->Branch("fZDCAenergy", &fZDCAenergy, "fZDCAenergy/D");
   fJPsiTree ->Branch("fZDCCenergy", &fZDCCenergy, "fZDCCenergy/D");
@@ -281,6 +283,7 @@ void AliAnalysisTaskUpcPsi2s::UserCreateOutputObjects()
   fPsi2sTree ->Branch("fVtxNDF", &fVtxNDF, "fVtxNDF/D");
   
   fPsi2sTree ->Branch("fKfVtxPos", &fKfVtxPos[0], "fKfVtxPos[3]/D");
+  fPsi2sTree ->Branch("fSpdVtxPos", &fSpdVtxPos[0], "fSpdVtxPos[3]/D");
   
   fPsi2sTree ->Branch("fZDCAenergy", &fZDCAenergy, "fZDCAenergy/D");
   fPsi2sTree ->Branch("fZDCCenergy", &fZDCCenergy, "fZDCCenergy/D");
@@ -832,6 +835,14 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
   fVtxErr[2] = CovMatx[2];
   fVtxChi2 = fAODVertex->GetChi2();
   fVtxNDF = fAODVertex->GetNDF();
+  
+  //SPD primary vertex
+  AliAODVertex *fSPDVertex = aod->GetPrimaryVertexSPD();
+  if(fSPDVertex){
+       fSpdVtxPos[0] = fSPDVertex->GetX();
+       fSpdVtxPos[1] = fSPDVertex->GetY();
+       fSpdVtxPos[2] = fSPDVertex->GetZ();
+       }
 
   //Tracklets
   fNtracklets = aod->GetTracklets()->GetNumberOfTracklets();
@@ -1404,6 +1415,14 @@ void AliAnalysisTaskUpcPsi2s::RunESDtree()
   fVtxErr[2] = CovMatx[2];
   fVtxChi2 = fESDVertex->GetChi2();
   fVtxNDF = fESDVertex->GetNDF();
+    
+  //SPD primary vertex
+  AliESDVertex *fSPDVertex = (AliESDVertex*) esd->GetPrimaryVertexSPD();
+  if(fSPDVertex){
+       fSpdVtxPos[0] = fSPDVertex->GetX();
+       fSpdVtxPos[1] = fSPDVertex->GetY();
+       fSpdVtxPos[2] = fSPDVertex->GetZ();
+       }
 
   //Tracklets
   fNtracklets = esd->GetMultiplicity()->GetNumberOfTracklets();
index 55893976ab541f6d7b03292330081377f15056dd..634129365916f4a1dc1ea360948e65e357f05acf 100644 (file)
@@ -82,6 +82,7 @@ class AliAnalysisTaskUpcPsi2s : public AliAnalysisTaskSE {
   Double_t fVtxErr[3];
   Double_t fVtxChi2,fVtxNDF;
   Double_t fKfVtxPos[3];
+  Double_t fSpdVtxPos[3];
   UShort_t fBCrossNum, fNtracklets, fNLooseTracks;
   //vzero, zdc
   Double_t fZDCAenergy, fZDCCenergy;
index 9a8a52875b8f6350d3e40194c8461ace6ce320be..06ff91ce7a15db6cb496b4ed8737233ff587fe2b 100644 (file)
@@ -499,13 +499,23 @@ void AliDecayerPythia::ForceDecay()
        ForceParticleDecay(  443,11,2); // jpsi     
        break;
     case kGammaEM:
-       ForceParticleDecay(  111,22,1); // pi^0     
-       ForceParticleDecay(  221,22,1); // eta     
-       ForceParticleDecay(  113,22,1); // rho     
-       ForceParticleDecay(  223,22,1); // omega     
-       ForceParticleDecay(  331,22,1); // etaprime     
-       ForceParticleDecay(  333,22,1); // phi     
-       ForceParticleDecay(  443,22,1); // jpsi     
+       ForceParticleDecay(  111,       22,     1); // pi^0     
+       ForceParticleDecay(  221,       22,     1); // eta     
+       ForceParticleDecay(  113,       22,     1); // rho     
+       ForceParticleDecay(  223,       22,     1); // omega     
+       ForceParticleDecay(  331,       22,     1); // etaprime     
+       ForceParticleDecay(  333,       22,     1); // phi     
+       ForceParticleDecay(  443,       22,     1); // jpsi     
+       ForceParticleDecay(  3212,      22,     1);     // Sigma 0
+       ForceParticleDecay(  310,       22,     1);     // K0s
+       ForceParticleDecay(  2224,      22,     1);     // Delta++
+       ForceParticleDecay(  2214,      22,     1);     // Delta+
+       ForceParticleDecay(  1114,      22,     1);     // Delta-
+       ForceParticleDecay(  2114,      22,     1);     // Delta0
+       ForceParticleDecay(  213,       22,     1);     // rho+ 
+       ForceParticleDecay(  -213,      22,     1);     // rho- 
+       ForceParticleDecay(  313,       22,     1);     // K0star 
+       
        break;
     case kBeautyUpgrade:
         ForceBeautyUpgrade();
index 5e4e1bb23781118d417b2527ffd142f1ef8e449d..cf1e2c15c5653fdf6fd3202fe092a9f5c98de4ff 100644 (file)
@@ -32,6 +32,7 @@
 #include <TDataMember.h>
 #include <TList.h>
 #include <TMethodCall.h>
+#include <TDataType.h>
 
 #include "AliLog.h"
 #include "AliRawEventHeaderBase.h"
@@ -384,7 +385,8 @@ UInt_t AliRawEventHeaderBase::Get(const char *datamember) const
     return 0;
   }
 
-  if (strcmp(member->GetTypeName(),"UInt_t") != 0) {
+  TDataType * dataType = member->GetDataType();
+  if (!dataType || dataType->GetType() != kUInt_t) {
     AliFatal(Form("Member %s is not of type UInt_t!",buf));
     return 0;
   }
@@ -417,7 +419,8 @@ const UInt_t* AliRawEventHeaderBase::GetP(const char *datamember) const
   //    return 0;
   //  }
 
-  if (strcmp(member->GetTypeName(),"UInt_t") != 0) {
+  TDataType * dataType = member->GetDataType();
+  if (!dataType || dataType->GetType() != kUInt_t) {
     AliFatal(Form("Member %s is not of type UInt_t*!",buf));
     return 0;
   }
index 9df44b55b2a30d46afa3be3663e6927820d95d9a..effd34af411c98b0f638a1291714805d57add487 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliRawReaderDate.h"
-#ifdef ALI_DATE
 #include "event.h"
-#endif
 
 ClassImp(AliRawReaderDate)
 
 
-AliRawReaderDate::AliRawReaderDate(
-#ifdef ALI_DATE
-                                  void* event, Bool_t owner
-#else
-                                  void* /* event */, Bool_t owner
-#endif
-                                  ) :
+AliRawReaderDate::AliRawReaderDate(void* event, Bool_t owner) :
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -49,21 +41,10 @@ AliRawReaderDate::AliRawReaderDate(
 {
 // create an object to read digits from the given date event
 
-#ifdef ALI_DATE
   fEvent = (eventHeaderStruct*) event;
-#else
-  Fatal("AliRawReaderDate", "this class was compiled without DATE");
-#endif
 }
 
-AliRawReaderDate::AliRawReaderDate(
-#ifdef ALI_DATE
-                                  const char* fileName, Int_t eventNumber
-#else
-                                  const char* /*fileName*/, 
-                                  Int_t /*eventNumber*/
-#endif
-                                  ) :
+AliRawReaderDate::AliRawReaderDate(const char* fileName, Int_t eventNumber) :
   fFile(NULL),
   fEvent(NULL),
   fSubEvent(NULL),
@@ -74,7 +55,6 @@ AliRawReaderDate::AliRawReaderDate(
 {
 // create an object to read digits from the given date event
 
-#ifdef ALI_DATE
   fFile = fopen(fileName, "rb");
   if (!fFile) {
     Error("AliRawReaderDate", "could not open file %s", fileName);
@@ -97,46 +77,16 @@ AliRawReaderDate::AliRawReaderDate(
     eventNumber--;
   }
 
-#else
-  Fatal("AliRawReaderDate", "this class was compiled without DATE");
-#endif
-}
-
-AliRawReaderDate::AliRawReaderDate(const AliRawReaderDate& rawReader) :
-  AliRawReader(rawReader),
-  fFile(rawReader.fFile),
-  fEvent(rawReader.fEvent),
-  fSubEvent(rawReader.fSubEvent),
-  fEquipment(rawReader.fEquipment),
-  fPosition(rawReader.fPosition),
-  fEnd(rawReader.fEnd),
-  fOwner(rawReader.fOwner)
-
-{
-// copy constructor
-
-  Fatal("AliRawReaderDate", "copy constructor not implemented");
-}
-
-AliRawReaderDate& AliRawReaderDate::operator = (const AliRawReaderDate& 
-                                               /*rawReader*/)
-{
-// assignment operator
-
-  Fatal("operator =", "assignment operator not implemented");
-  return *this;
 }
 
 AliRawReaderDate::~AliRawReaderDate()
 {
 // destructor
 
-#ifdef ALI_DATE
   if (fEvent && fOwner) delete[] fEvent;
   if (fFile) {
     fclose(fFile);
   }
-#endif
 }
 
 
@@ -144,195 +94,131 @@ UInt_t AliRawReaderDate::GetType() const
 {
 // get the type from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return 0;
   return fEvent->eventType;
-#else
-  return 0;
-#endif
 }
 
 UInt_t AliRawReaderDate::GetRunNumber() const
 {
 // get the run number from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return 0;
   return fEvent->eventRunNb;
-#else
-  return 0;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetEventId() const
 {
 // get the event id from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return NULL;
   return fEvent->eventId;
-#else
-  return NULL;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetTriggerPattern() const
 {
 // get the trigger pattern from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return NULL;
   return fEvent->eventTriggerPattern;
-#else
-  return NULL;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetDetectorPattern() const
 {
 // get the detector pattern from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return NULL;
   return fEvent->eventDetectorPattern;
-#else
-  return NULL;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetAttributes() const
 {
 // get the type attributes from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return NULL;
   return fEvent->eventTypeAttribute;
-#else
-  return NULL;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetSubEventAttributes() const
 {
 // get the type attributes from the sub event header
 
-#ifdef ALI_DATE
   if (!fSubEvent) return NULL;
   return fSubEvent->eventTypeAttribute;
-#else
-  return NULL;
-#endif
 }
 
 UInt_t AliRawReaderDate::GetLDCId() const
 {
 // get the LDC Id from the event header
 
-#ifdef ALI_DATE
   if (!fSubEvent) return 0;
   return fSubEvent->eventLdcId;
-#else
-  return 0;
-#endif
 }
 
 UInt_t AliRawReaderDate::GetGDCId() const
 {
 // get the GDC Id from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return 0;
   return fEvent->eventGdcId;
-#else
-  return 0;
-#endif
 }
 
 UInt_t AliRawReaderDate::GetTimestamp() const
 {
 // get the timestamp from the event header
 
-#ifdef ALI_DATE
   if (!fEvent) return 0;
   return fEvent->eventTimestamp;
-#else
-  return 0;
-#endif
 }
 
 Int_t AliRawReaderDate::GetEquipmentSize() const
 {
 // get the size of the equipment (including the header)
 
-#ifdef ALI_DATE
   if (!fEquipment) return 0;
   if (fSubEvent->eventVersion <= 0x00030001) {
     return fEquipment->equipmentSize + sizeof(equipmentHeaderStruct);
   } else {
     return fEquipment->equipmentSize;
   }
-#else
-  return 0;
-#endif
 }
 
 Int_t AliRawReaderDate::GetEquipmentType() const
 {
 // get the type from the equipment header
 
-#ifdef ALI_DATE
   if (!fEquipment) return -1;
   return fEquipment->equipmentType;
-#else
-  return 0;
-#endif
 }
 
 Int_t AliRawReaderDate::GetEquipmentId() const
 {
 // get the ID from the equipment header
 
-#ifdef ALI_DATE
   if (!fEquipment) return -1;
   return fEquipment->equipmentId;
-#else
-  return 0;
-#endif
 }
 
 const UInt_t* AliRawReaderDate::GetEquipmentAttributes() const
 {
 // get the attributes from the equipment header
 
-#ifdef ALI_DATE
   if (!fEquipment) return NULL;
   return fEquipment->equipmentTypeAttribute;
-#else
-  return 0;
-#endif
 }
 
 Int_t AliRawReaderDate::GetEquipmentElementSize() const
 {
 // get the basic element size from the equipment header
 
-#ifdef ALI_DATE
   if (!fEquipment) return 0;
   return fEquipment->equipmentBasicElementSize;
-#else
-  return 0;
-#endif
 }
 
 Int_t AliRawReaderDate::GetEquipmentHeaderSize() const
 {
   // Get the equipment header size
   // 28 bytes by default
-#ifdef ALI_DATE
   return sizeof(equipmentHeaderStruct);
-#else
-  return 0;
-#endif
 }
 
 Bool_t AliRawReaderDate::ReadHeader()
@@ -342,7 +228,6 @@ Bool_t AliRawReaderDate::ReadHeader()
 
   fErrorCode = 0;
 
-#ifdef ALI_DATE
   fHeader = NULL;
   if (!fEvent) return kFALSE;
   // check whether there are sub events
@@ -414,7 +299,7 @@ Bool_t AliRawReaderDate::ReadHeader()
       // check that there are enough bytes left for the data header
       if (fPosition + sizeof(AliRawDataHeader) > fEnd) {
        Error("ReadHeader", "could not read data header data!");
-       Warning("ReadHeader", "skipping %d bytes\n"
+       Warning("ReadHeader", "skipping %ld bytes\n"
                " run: %d  event: %d %d  LDC: %d  GDC: %d\n", 
                fEnd - fPosition, fSubEvent->eventRunNb, 
                fSubEvent->eventId[0], fSubEvent->eventId[1],
@@ -436,7 +321,7 @@ Bool_t AliRawReaderDate::ReadHeader()
          if ((fHeader->fSize != 0xFFFFFFFF) &&
              (fEquipment->equipmentId != 4352))
            Warning("ReadHeader",
-                   "raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+                   "raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !",
                    fHeader->fSize, fEnd - fPosition);
          fHeader->fSize = fEnd - fPosition;
        }
@@ -448,7 +333,7 @@ Bool_t AliRawReaderDate::ReadHeader()
          if ((fHeaderV3->fSize != 0xFFFFFFFF) &&
              (fEquipment->equipmentId != 4352))
            Warning("ReadHeader",
-                   "raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+                   "raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !",
                    fHeaderV3->fSize, fEnd - fPosition);
          fHeaderV3->fSize = fEnd - fPosition;
        }
@@ -463,7 +348,7 @@ Bool_t AliRawReaderDate::ReadHeader()
       // check consistency of data size in the header and in the sub event
       if (fPosition + fCount > fEnd) {
        Error("ReadHeader", "size in data header exceeds event size!");
-       Warning("ReadHeader", "skipping %d bytes\n"
+       Warning("ReadHeader", "skipping %ld bytes\n"
                " run: %d  event: %d %d  LDC: %d  GDC: %d\n", 
                fEnd - fPosition, fSubEvent->eventRunNb, 
                fSubEvent->eventId[0], fSubEvent->eventId[1],
@@ -480,7 +365,7 @@ Bool_t AliRawReaderDate::ReadHeader()
       // check consistency of data size in the header and in the sub event
       if (fPosition + fCount > fEnd) {
        Error("ReadHeader", "size in data header exceeds event size!");
-       Warning("ReadHeader", "skipping %d bytes\n"
+       Warning("ReadHeader", "skipping %ld bytes\n"
                " run: %d  event: %d %d  LDC: %d  GDC: %d\n", 
                fEnd - fPosition, fSubEvent->eventRunNb, 
                fSubEvent->eventId[0], fSubEvent->eventId[1],
@@ -498,9 +383,6 @@ Bool_t AliRawReaderDate::ReadHeader()
   } while (!fEquipment || !IsSelected());
 
   return kTRUE;
-#else
-  return kFALSE;
-#endif
 }
 
 Bool_t AliRawReaderDate::ReadNextData(UChar_t*& data)
@@ -540,10 +422,8 @@ Bool_t AliRawReaderDate::Reset()
 {
 // reset the current position to the beginning of the event
 
-#ifdef ALI_DATE
   fSubEvent = NULL;
   fEquipment = NULL;
-#endif
   fCount = 0;
   fPosition = fEnd = NULL;
   fHeader=NULL;
@@ -556,7 +436,6 @@ Bool_t AliRawReaderDate::NextEvent()
 {
 // go to the next event in the date file
 
-#ifdef ALI_DATE
   if (!fFile) {
     if (fEventNumber < 0 && fEvent) {
       fEventNumber++;
@@ -590,7 +469,6 @@ Bool_t AliRawReaderDate::NextEvent()
   };
 
   fEvent = NULL;
-#endif
 
   return kFALSE;
 }
@@ -611,7 +489,6 @@ Int_t AliRawReaderDate::CheckData() const
 {
 // check the consistency of the data
 
-#ifdef ALI_DATE
   if (!fEvent) return 0;
   // check whether there are sub events
   if (fEvent->eventSize <= fEvent->eventHeadSize) return 0;
@@ -665,7 +542,7 @@ Int_t AliRawReaderDate::CheckData() const
       if ((position + header->fSize) != end) {
        if (header->fSize != 0xFFFFFFFF)
          Warning("ReadHeader",
-                 "raw data size found in the header is wrong (%d != %d)! Using the equipment size instead !",
+                 "raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !",
                  header->fSize, end - position);
        header->fSize = end - position;
        result |= kErrSize;
@@ -674,7 +551,6 @@ Int_t AliRawReaderDate::CheckData() const
     position = end;
   };
 
-#endif
   return 0;
 }
 
@@ -686,7 +562,6 @@ AliRawReader* AliRawReaderDate::CloneSingleEvent() const
   // access to the current raw data within
   // several threads (online event display/reco)
 
-#ifdef ALI_DATE
   if (fEvent) {
     UInt_t evSize = fEvent->eventSize;
     if (evSize) {
@@ -695,8 +570,5 @@ AliRawReader* AliRawReaderDate::CloneSingleEvent() const
       return new AliRawReaderDate((void *)newEvent,kTRUE);
     }
   }
-#else
-  Fatal("AliRawReaderDate", "this class was compiled without DATE");
-#endif
   return NULL;
 }
index 060929ddc274106488eb840ec44e0927c6b7e78f..0913037df85ff6edd85737467f83303e223b1ce5 100644 (file)
@@ -66,8 +66,8 @@ class AliRawReaderDate: public AliRawReader {
     Bool_t           fOwner;        // is raw-reader owner of the raw event or not
 
   private:
-    AliRawReaderDate(const AliRawReaderDate& rawReader);
-    AliRawReaderDate& operator = (const AliRawReaderDate& rawReader);
+    AliRawReaderDate(const AliRawReaderDate& rawReader); // Not implemented
+    AliRawReaderDate& operator = (const AliRawReaderDate& rawReader); // Not implemented
 
     ClassDef(AliRawReaderDate, 0) // class for reading raw digits from a root file
 };
index 69715eb8b6b190334e04c3fe30272a23555b79ee..59678d1ae5e273683b091804af0e25ae34b529f4 100644 (file)
@@ -11,8 +11,9 @@
    V01.01 25/10/2005  RD  Support added for timestamp
    V01.02  4/04/2006  RD  Support for CDH
    V01.03 24/05/2006  RD  Added "Direct disk access" option
+   V01.04 15/10/2010  RD  Added possibility to set the run number
 */
-#define VID "1.03"
+#define VID "1.04"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -1492,12 +1493,13 @@ Either work in Collider mode or set the trigger unavailable status bit in the CD
          }
          if ( softwareTriggerIndicator ) {
            switch ((cdh->cdhL1TriggerMessage >> 2) & 0xF) {
-           case 0xD:
            case 0xC:
            case 0xB:
            case 0xA:
            case 0x9:
              break;
+           case 0xD:
+             /* L1SwC bit = on, Clt bit = off, RoC[4..1] = 0xD --> SYNC */ 
            case 0xF:
              /* L1SwC bit = on, Clt bit = off, RoC[4..1] = 0xF --> END_OF_DATA */ 
            case 0xE:
@@ -1509,7 +1511,7 @@ Either work in Collider mode or set the trigger unavailable status bit in the CD
              /*  L1SwC bit = on, Clt bit = off, RoC[4] = 0
                  --> DETECTOR_SOFTWARE_TRIGGER_EVENT */
              fprintf( stderr,
-                      "%s: CDH trigger SOD/EOD/SST/DST (unsupported) \
+                      "%s: CDH trigger SOD/EOD/SST/DST/SYNC (unsupported) \
 L1TriggerMessage:0x%x ALICETrigger:%s\n",
                       myName,
                       cdh->cdhL1TriggerMessage,
@@ -1583,11 +1585,11 @@ RoiHigh/Low reference:0x%x-%x current:0x%x-%x\n",
        if ( cdh->cdhMBZ0 != 0
             || cdh->cdhMBZ1 != 0
             || cdh->cdhMBZ2 != 0
-            ) {
+            || cdh->cdhMBZ4 != 0 ) {
          fprintf( stderr,
-                  "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x\n",
+                  "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x MBZ4:0x%x\n",
                   myName,
-                  cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2 );
+                  cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2, cdh->cdhMBZ4 );
          exit( 1 );
        }
       }
@@ -1603,11 +1605,23 @@ RoiHigh/Low reference:0x%x-%x current:0x%x-%x\n",
        }
       }
       for ( trig = 0; trig != 18; trig++ ) {
-       if ( (cdh->cdhTriggerClassesHigh & (1<<trig)) != 0 ) {
+       if ( (cdh->cdhTriggerClassesMiddleLow & (1<<trig)) != 0 ) {
          SET_TRIGGER_IN_PATTERN( ldc->header.eventTriggerPattern,
                                  32+trig );
        }
       }
+      for ( trig = 0; trig != 32; trig++ ) {
+       if ( (cdh->cdhTriggerClassesMiddleHigh & (1<<trig)) != 0 ) {
+         SET_TRIGGER_IN_PATTERN( ldc->header.eventTriggerPattern,
+                                 18+32+trig );
+       }
+      }
+      for ( trig = 0; trig != 18; trig++ ) {
+       if ( (cdh->cdhTriggerClassesHigh & (1<<trig)) != 0 ) {
+         SET_TRIGGER_IN_PATTERN( ldc->header.eventTriggerPattern,
+                                 32+18+32+trig );
+       }
+      }
       if ( gotAliceTrigger )
        VALIDATE_TRIGGER_PATTERN( ldc->header.eventTriggerPattern );
     }
index a9351b18caf377a6cfb4fff54b940f137ca8a75a..0fd2e78b4aadd171bcc8465d10260c16b2d4521f 100644 (file)
@@ -27,13 +27,11 @@ ClassImp(AliGenStarLight);
 
 AliGenStarLight::AliGenStarLight()
   : AliGenMC()
-  , fTrials(0)
   , fSLgenerator(NULL) {
 }
 //----------------------------------------------------------------------
 AliGenStarLight::AliGenStarLight(Int_t npart)
   : AliGenMC(npart)
-  , fTrials(0)
   , fSLgenerator(new TStarLight("TStarLight",
                                "StarLight UPC Event Generator",
                                ""))  // no config file name  
@@ -77,11 +75,10 @@ void AliGenStarLight::Generate() {
     vpos[3] = fTime;
   }
 
-  Int_t   nt(0);  // number of tracks
-  Float_t weight(1);
+  Int_t   nt(0);     // number of tracks
   Bool_t  genOK(kFALSE);  
   // generate events until all constraints are fulfilled
-  for (fTrials=0; !genOK && fTrials < 100*1000; ++fTrials) {
+  for (Int_t trials=0; !genOK && trials < 100*1000; ++trials) {
     fSLgenerator->GenerateEvent();
     fSLgenerator->BoostEvent();
     fSLgenerator->ImportParticles(&fParticles, "ALL");
@@ -109,19 +106,21 @@ void AliGenStarLight::Generate() {
        AliFatal("NULL == part");
        return;
       }
-      Int_t   iparent(-1);
-      Float_t polar[3] = { 0, 0, 0 };
+      const Int_t   iparent(-1);
+      const Float_t polar[3] = { 0, 0, 0 };
+      const Float_t weight(trials+1);
       PushTrack(fTrackIt, iparent, part->GetPdgCode(), 
                part->Px(), part->Py(), part->Pz(), part->Energy(),
                vpos[0],    vpos[1],    vpos[2],    vpos[3],
                polar[0],   polar[1],   polar[2], 
                kPPrimary, nt, weight, part->GetStatusCode());
-      AliInfo(Form("fTrials=%d nt=%d fTrackIt=%d statusCode=%d",
-                  fTrials, nt, fTrackIt, part->GetStatusCode()));
+      AliInfo(Form("weight=%.0f nt=%d fTrackIt=%d statusCode=%d",
+                  weight, nt, fTrackIt, part->GetStatusCode()));
       part->Print();
       KeepTrack(nt);
       ++fNprimaries;
     }
+    fParticles.Clear();
   }
   if (kFALSE == genOK)
     AliFatal("Maximum number of trials reached");
index fa1873adf42bae828063ad1a320749a2586f86be..249a62e347bdf506c35f02b265ca740b6a8ddb1f 100644 (file)
@@ -42,10 +42,9 @@ public:
   AliGenStarLight(const AliGenStarLight &p);
   AliGenStarLight& operator=(const AliGenStarLight &p);
 
-  Int_t                       fTrials;          //  Number of times the STARlight generate has been called to get one event to pass trigger/cuts.
   TStarLight                 *fSLgenerator;     //! Pointer to StarLight Generator.
 
-  ClassDef(AliGenStarLight,2); // STARlight parameterisation generator
+  ClassDef(AliGenStarLight,3); // STARlight parameterisation generator
 } ;
 
 #endif
index 68a34a7fc95a6b592edc26ced286ef04ca742f05..7acf8581468acb3d25a4aa813cd2a70efd92de4b 100644 (file)
@@ -4,14 +4,4 @@
 #pragma link off all functions;
 #pragma link C++ class TStarLight+;
 #pragma link C++ class AliGenStarLight+;
-/* #pragma link C++ class AliGenStarLightEventHeader+; */
-/* #pragma link C++ class parameterbase+; */
-/* #pragma link C++ class parameter<unsigned int,1>+; */
-/* #pragma link C++ class parameter<double,1>+; */
-/* #pragma link C++ class parameter<bool,1>+; */
-/* #pragma link C++ class parameter<unsigned int,0>+; */
-/* #pragma link C++ class parameter<string,0>+; */
-/* #pragma link C++ class parameter<bool,0>+; */
-/* //#pragma link C++ class inputParser+; */
-/* #pragma link C++ class inputParameters+; */
 #endif
index 98b25459d37e0a7d5f795e303bd85aa20a6955d9..6852a19bb5e1fbe639096c14bbf5638d2753f538 100644 (file)
@@ -80,3 +80,6 @@ endif( ALICE_TARGET STREQUAL "macosxicc")
 string(REPLACE "-Weffc++" "" PACKCXXFLAGS ${CXXFLAGS})
 
 string(REPLACE "-Weffc++" "" PACKDCXXFLAGS ${CXXFLAGSNO})
+
+string(REPLACE "-Wshadow" "-Wno-shadow" PACKCXXFLAGS ${PACKCXXFLAGS})
+string(REPLACE "-Wshadow" "-Wno-shadow" PACKDCXXFLAGS ${PACKDCXXFLAGS})
index b66349c179cb1ae94f30261e49a4c50a70b1d26f..62f48487568353de99cac0f323be887d0280aa6d 100644 (file)
@@ -20,9 +20,9 @@
 ###########################################################################
 #
 # File and Version Information:
-# $Rev:: 165                         $: revision of last commit
-# $Author:: odjuvsla                 $: author of last commit
-# $Date:: 2013-10-06 16:18:10 +0200 #$: date of last commit
+# $Rev:: 186                         $: revision of last commit
+# $Author:: jnystrand                $: author of last commit
+# $Date:: 2014-09-12 02:39:02 +0200 #$: date of last commit
 #
 # Description:
 #      Starlight build file
@@ -49,12 +49,9 @@ set (Starlight_VERSION_MINOR_MINOR 0)
 project(starlight)
 find_package (Threads)
 
-
 # load some common cmake macros
 # set path, where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
-
-message(STATUS "Using cmake module path '${CMAKE_MODULE_PATH}'")
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
 message(STATUS "Using cmake module path '${CMAKE_MODULE_PATH}'")
 include(CommonMacros)
 
@@ -74,7 +71,7 @@ option (CPP11 "Enable compilation with C++11 features" OFF)
 
 # define build types
 # set a default build type for single-configuration CMake generators, if no build type is set.
-set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
+set(CMAKE_BUILD_TYPE Debug)
 if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
   message(STATUS "No build type was specified. Setting build type to 'Release'.")
   set(CMAKE_BUILD_TYPE Release)
@@ -94,14 +91,14 @@ if (CMAKE_COMPILER_IS_GNUCC)
     endif()
   else()
     message(STATUS "GCC_VERSION<4.6")
-    set(CMAKE_CXX_FLAGS "-Wall -Wextra ")
+    set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror")
     if(CPP11)
       message(WARNING "C++11 feautures not supported for your compiler")
     endif()
   endif()
 else()
   message(STATUS "Not GCC")
-  set(CMAKE_CXX_FLAGS "-Wall -Wextra")
+  set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror")
   if(CPP11)
     message(WARNING "C++11 feautures not supported for your compiler")
   endif()
@@ -219,21 +216,8 @@ if(ENABLE_DPMJET)
    else(DPMJET_FOUND)
       option (ENABLE_DPMJET  "Enable compilation against DPMJet" OFF)
    endif(DPMJET_FOUND)
-endif(ENABLE_DPMJET)
-
-# setup TStarLight
-option (ENABLE_TSTARLIGHT "Enable ROOT interface for Starlight" OFF)
-if(ENABLE_TSTARLIGHT)  
-  find_package(ROOT REQUIRED)
-  set(TSTARLIGHT_DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/TStarLight_dict.cxx)  # set dictionary path
-  root_generate_dictionary(
-    "${TSTARLIGHT_DICTIONARY}"                                  # path to dictionary to generate
-    "${CMAKE_SOURCE_DIR}/TStarLight;${CMAKE_SOURCE_DIR}/include;${ROOT_INCLUDE_DIR};"     # list of includes
-    "${CMAKE_SOURCE_DIR}/TStarLight/TStarLight.h"               # list of classes to process
-    "${CMAKE_SOURCE_DIR}/TStarLight/TStarLightLinkDef.h"        # ROOT linkDef file
-    )  
-  set(SOURCES_SL TStarLight/TStarLight.cxx ${TSTARLIGHT_DICTIONARY})  # append dictionary to sources  
-endif(ENABLE_TSTARLIGHT)
+ endif(ENABLE_DPMJET)
+
 
 # set include directories
 set(INCLUDE_DIRECTORIES
@@ -241,11 +225,6 @@ set(INCLUDE_DIRECTORIES
        ${PROJECT_BINARY_DIR}
 #      ${PYTHIA8_INCLUDE_DIR}
        )
-
-if(ENABLE_TSTARLIGHT)  
-  set(INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIR} ${INCLUDE_DIRECTORIES})
-endif(ENABLE_TSTARLIGHT)
-
 include_directories(${INCLUDE_DIRECTORIES})
 
 # Set our source files, include the generated dictionary
@@ -260,7 +239,6 @@ set(SOURCES
   src/nucleus.cpp
   src/eventchannel.cpp
   src/gammaavm.cpp
-  src/psifamily.cpp
   src/gammagammasingle.cpp
   src/photonNucleusCrossSection.cpp
   src/wideResonanceCrossSection.cpp
@@ -309,15 +287,6 @@ endif()
 # add Starlight library to the build system
 set(THIS_LIB "Starlib")
 add_library(${THIS_LIB} STATIC ${SOURCES})
-
-if(ENABLE_TSTARLIGHT)
-  ## build shared starlight library
-  set(THIS_LIB "StarLight")
-  add_library(${THIS_LIB} SHARED ${SOURCES})
-  include_directories(${INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/TStarLight ${ROOT_INCLUDE_DIR})
-  add_library(TStarLight SHARED ${SOURCES_SL})
-endif(ENABLE_TSTARLIGHT)
-
 #make_shared_library("${THIS_LIB}" "${SOURCES}"
 #      "${PYTHIA8_LIBRARY}"
 #      "${LHAPDF_LIBRARIES}"
@@ -329,6 +298,7 @@ if(ENABLE_DPMJET)
   message(STATUS "DPMJet objects: ${DPMJET_OBJECTS}")
   add_library(${DPMJET_LIB} STATIC dpmjet/dpmjetint.f ${DPMJET_OBJECTS})
   set(optionalLibs ${optionalLibs} ${DPMJET_LIB})
+
 endif()
 
 if(ENABLE_PYTHIA6)
index d07c2f59db88c4682190f160e8d0072fef0b7a65..c0d98cf78fd2946063b55644b00c5c4a42ff0349 100644 (file)
@@ -484,30 +484,6 @@ src/nucleus.cpp.s:
        $(MAKE) -f CMakeFiles/Starlight.dir/build.make CMakeFiles/Starlight.dir/src/nucleus.cpp.s
 .PHONY : src/nucleus.cpp.s
 
-src/psifamily.o: src/psifamily.cpp.o
-.PHONY : src/psifamily.o
-
-# target to build an object file
-src/psifamily.cpp.o:
-       $(MAKE) -f CMakeFiles/Starlight.dir/build.make CMakeFiles/Starlight.dir/src/psifamily.cpp.o
-.PHONY : src/psifamily.cpp.o
-
-src/psifamily.i: src/psifamily.cpp.i
-.PHONY : src/psifamily.i
-
-# target to preprocess a source file
-src/psifamily.cpp.i:
-       $(MAKE) -f CMakeFiles/Starlight.dir/build.make CMakeFiles/Starlight.dir/src/psifamily.cpp.i
-.PHONY : src/psifamily.cpp.i
-
-src/psifamily.s: src/psifamily.cpp.s
-.PHONY : src/psifamily.s
-
-# target to generate assembly for a file
-src/psifamily.cpp.s:
-       $(MAKE) -f CMakeFiles/Starlight.dir/build.make CMakeFiles/Starlight.dir/src/psifamily.cpp.s
-.PHONY : src/psifamily.cpp.s
-
 src/randomgenerator.o: src/randomgenerator.cpp.o
 .PHONY : src/randomgenerator.o
 
index 8edd7311a8cb03574f58402c4fbeebff79320231..3fbd227cd220adf5781ea60409b29dad3f3ba681 100644 (file)
@@ -49,8 +49,6 @@ N_EVENTS = 10    #Number of events produced
 PROD_PID = 443013   #Channel of interest (in PDG notation); currently supported        options listed below
 RND_SEED = 34533    #Random number seed
 
-OUTPUT_FORMAT = 2    #Form of the output (not considered at this state)
-
 BREAKUP_MODE = 5     #Controls the nuclear breakup
                     # Note that this option only works for lead or gold; it should work at any energy
                     # 1 = hard sphere nuclei (b>2R)
@@ -65,11 +63,10 @@ BREAKUP_MODE = 5     #Controls the nuclear breakup
 
 INTERFERENCE = 0     #Interference (0 = off, 1 = on)
 IF_STRENGTH = 1.     #% of intefernce (0.0 - 0.1)
-COHERENT = 1         #Coherent=1,Incoherent=0 production for assym collisions
-INCO_FACTOR = 1.     #percentage of incoherence
-BFORD = 9.5          #Deuteron slope parameter (dsig/dt = exp(BFORD*t))
 INT_PT_MAX = 0.24    #Maximum pt considered, when interference is turned on
 INT_PT_N_BINS =120   #Number of pt bins when interference is turned on
+COHERENT = 1         #Coherent=1,Incoherent=0 production for assym collisions
+INCO_FACTOR = 1.     #percentage of incoherence
 
 
 ----------------------------------------------------------------------------
@@ -123,8 +120,3 @@ fixed types for class Particle
 
 - changed PID of the charged KAON to 321 and neutral kaon to 310 .. it should work now for phi -> kk 
 
-- incoherent formfactor was hardcoded for dAu events, it should now accept coherent too.
-- Had hardcoded narrow and wide resonances for VMs. The user can again select gg_or_gp (2 or 3)
-except for the psi family.  This is still always narrow.
-- Changed the spin dependence for VMs going to ee/mumu(gammaavectormeson::gettheta).  It was only for psi and now upsilon will follow too
-inretrospect, i should probably have done this first and merge psifamily back into gammaavm.cpp
index ce4b1af504a25a2830894b49dd7c9b8b041172ce..104ff8f9e61ecbb877b878effbe65d3190e42b13 100644 (file)
@@ -59,6 +59,7 @@ void testsl() {
       p->Momentum(v[i]);
 //       isOK = TMath::Abs(v[i].Rapidity()) <= 0.9;
     }
+    tca.Clear();
     if (!isOK) continue;
     Printf("counter, %d", counter, isOK);
     ++counter;
index 65abf93d2ec21638d84837c7d24bd108fcb0a1fc..a4ad985fd804f486bc1895df3538196a0c37622b 100644 (file)
@@ -167,11 +167,6 @@ else()
     ROOT_MINOR_VERSION "${ROOT_VERSION}")
   string(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1"
     ROOT_PATCH_VERSION "${ROOT_VERSION}")
-
-  set(ROOT_FIND_VERSION_MAJOR ${ROOT_MAJOR_VERSION})
-  set(ROOT_FIND_VERSION_MINOR ${ROOT_MINOR_VERSION})
-  set(ROOT_FIND_VERSION_PATCH ${ROOT_PATCH_VERSION})
-
   # make sure minor version is specified
   if(ROOT_FIND_VERSION AND NOT ROOT_FIND_VERSION_MINOR)
     message(FATAL_ERROR "When requesting a specific version of ROOT, you must provide at least the major and minor version numbers, e.g., 5.22")
index 366a227c717af9709fcd3676b53843fb701ff691..94fe197d367991b275686b6118e0a22c05c6ca89 100644 (file)
@@ -1,3 +1,7 @@
+# This file is a template for J/psi production in Pb-Pb collisions at the LHC.
+#
+# to use, rename this file slight.in
+#
 BEAM_1_Z = 82    #Z of projectile
 BEAM_1_A = 208   #A of projectile
 BEAM_2_Z = 82   #Z of target
@@ -17,17 +21,15 @@ ETA_MIN = -10 #Minimum pseudorapidity
 ETA_MAX = 10 #Maximum pseudorapidity
 PROD_MODE = 2     #gg or gP switch (1 = 2-photon, 2 = coherent vector meson (narrow), 3 = coherent vector meson (wide), 4 = incoherent vector meson)
 N_EVENTS = 1000   #Number of events
-PROD_PID = 443013   #Channel of interest
+PROD_PID = 443013   #Channel of interest; this is j/psi --> mu+ mu-
 RND_SEED = 5574533 #Random number seed
-OUTPUT_FORMAT = 2     #Form of the output
-BREAKUP_MODE = 5     #Controls the nuclear breakup
+BREAKUP_MODE = 5     #Controls the nuclear breakup; a 5 here makes no requirement on the breakup of the ions
 INTERFERENCE = 0     #Interference (0 = off, 1 = on)
 IF_STRENGTH = 1.    #% of intefernce (0.0 - 0.1)
-COHERENT = 1     #Coherent=1,Incoherent=0
-INCO_FACTOR = 1.    #percentage of incoherence
-BFORD = 9.5
 INT_PT_MAX = 0.24  #Maximum pt considered, when interference is turned on
 INT_PT_N_BINS =120   #Number of pt bins when interference is turned on
+COHERENT = 1     #Coherent=1,Incoherent=0
+INCO_FACTOR = 1.    #percentage of incoherence
 XSEC_METHOD = 1 # Set to 0 to use old method for calculating gamma-gamma luminosity
 N_THREADS = 1 # Number of threads used for calculating luminosity (when using the new method)
 PYTHIA_FULL_EVENTRECORD = 0 # Write full pythia information to output (vertex, parents, daughter etc).
index fc0ec98d13218e24cd1320460d3000049253763b..6264915189d4a55b142f024dc57b5b6f93e84a8b 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 181                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-12 00:37:55 +0200 #$: date of last commit
 //
 // Description:
 //
@@ -78,6 +78,7 @@ public:
         _parameters.add(this);
     }
     virtual ~parameterbase() {}
+
     virtual std::string validationkey() = 0;
 
     template<typename T>
@@ -107,17 +108,9 @@ class parameter : public parameterbase
 public:
 
     // Constructor
-    parameter(const std::string& name_,
-             T value_,
-             bool required_ = true) 
-      :parameterbase()
-      ,_name(name_)
-      , _value(value_)
-      , _validate(validate)
-      , _required(required_) {}
-
-      virtual ~parameter() {}
+    parameter(const std::string &name, T value, bool required = true) :parameterbase(),_name(name), _value(value), _validate(validate), _required(required) {}
 
+    virtual ~parameter() {}
 //     T operator()() const {
 //         return _value;
 //     }
@@ -135,7 +128,7 @@ public:
     
     void setValue(T v) { _value = v; }
     
-    void setName(std::string name_) { _name = name_; }
+    void setName(std::string name) { _name = name; }
     
     void setRequired(bool r) { _required = r; }
     
@@ -187,12 +180,11 @@ class inputParameters {
 private:
        // inputParameters is now a singleton
        friend class Singleton<inputParameters>;
-public:
        inputParameters();
-private:
-       ~inputParameters();
 public:
 
+       ~inputParameters();
+
        bool init();
        bool configureFromFile(const std::string &configFileName = "./config/slight.in");
 
@@ -231,16 +223,6 @@ public:
        std::string  pythiaParams          () const { return _pythiaParams.value();           }  ///< returns parameters to be passed to pythia
        bool         pythiaFullEventRecord () const { return _pythiaFullEventRecord.value();  }  ///< returns if the full pythia event record should be printed
        int          xsecCalcMethod        () const { return _xsecCalcMethod.value();         }  ///< returns the method used for the x-sec calculation
-       int          nThreads              () const { return _nThreads.value();               }  ///< returns the number of threads in case method 1 is used for the x-sec calc
-       unsigned int nBinsQKniehl          () const { return _nBinsQKniehl.value();           }  ///< Number of bins in Q used for the transformation to the impact paramter space of the Kniehl function
-        unsigned int nBinsEKniehl          () const { return _nBinsEKniehl.value();           }  ///< Number of bins in photon energy used for the Kniehl function
-        unsigned int nBinsBKniehl          () const { return _nBinsBKniehl.value();           }  ///< Number of bins in impact parameter used for the Kniehl function
-        double       qMaxKniehl            () const { return _qMaxKniehl.value();             }  ///< Max value of Q used for the Kniehl funcion
-        double       eGammaMinKniehl       () const { return _eGammaMinKniehl.value();        }  ///< Min value of gamma energy used for the Kniehl funcion
-        double       eGammaMaxKniehl       () const { return _eGammaMaxKniehl.value();        }  ///< Max value of gamma energy used for the Kniehl funcion
-        double       bMinKniehl            () const { return _bMinKniehl.value();             }  ///< Min value of impact parameter used for the Kniehl funcion
-        double       bMaxKniehl            () const { return _bMaxKniehl.value();             }  ///< Max value of impact parameter used for the Kniehl funcion
-        
        starlightConstants::particleTypeEnum    prodParticleType     () const { return _particleType;    }  ///< returns type of produced particle
        starlightConstants::decayTypeEnum       prodParticleDecayType() const { return _decayType;       }  ///< returns decay type of produced particle
        starlightConstants::interactionTypeEnum interactionType      () const { return _interactionType; }  ///< returns interaction type
@@ -283,15 +265,6 @@ public:
        void setPythiaParams          (std::string v)  {  _pythiaParams = v;           }  ///< returns parameters to be passed to pythia
        void setPythiaFullEventRecord (bool v)  {  _pythiaFullEventRecord = v;  }  ///< returns if the full pythia event record should be prvoided
        void setXsecCalcMethod        (int v)  {  _xsecCalcMethod = v;         }  ///< returns the method used for the x-sec calculation
-       void setNThreads              (int v)  {  _nThreads = v;               }  ///< returns the number of threads in case method 1 is used for the x-sec calc
-       void setNBinsQKniehl          (unsigned int v)  {  _nBinsQKniehl = v;           }  ///< Number of bins in Q used for the transformation to the impact paramter space of the Kniehl function
-        void setNBinsEKniehl          (unsigned int v)  {  _nBinsEKniehl = v;           }  ///< Number of bins in photon energy used for the Kniehl function
-        void setNBinsBKniehl          (unsigned int v)  {  _nBinsBKniehl = v;           }  ///< Number of bins in impact parameter used for the Kniehl function
-        void setQMaxKniehl            (double v)  {  _qMaxKniehl = v;             }  ///< Max value of Q used for the Kniehl funcion
-        void setEGammaMinKniehl       (double v)  {  _eGammaMinKniehl = v;        }  ///< Min value of gamma energy used for the Kniehl funcion
-        void setEGammaMaxKniehl       (double v)  {  _eGammaMaxKniehl = v;        }  ///< Max value of gamma energy used for the Kniehl funcion
-        void setBMinKniehl            (double v)  {  _bMinKniehl = v;             }  ///< Min value of impact parameter used for the Kniehl funcion
-        void setBMaxKniehl            (double v)  {  _bMaxKniehl = v;             }  ///< Max value of impact parameter used for the Kniehl funcion
         
        void setProdParticleType      (starlightConstants::particleTypeEnum v)   { _particleType = v;    }  ///< returns type of produced particle
        void setProdParticleDecayType (starlightConstants::decayTypeEnum v)        { _decayType = v;       }  ///< returns decay type of produced particle
@@ -301,7 +274,7 @@ public:
        // double slopeParameter();
        void setProtonEnergy        (double v)  { _protonEnergy = v; }
        
-/*     template<typename T> */
+       //      template<typename T>
        inline bool setParameter(std::string expression);
        
        std::ostream& print(std::ostream& out) const;  ///< prints parameter summary
@@ -368,31 +341,21 @@ private:
        parameter<double, VALIDITY_CHECK>          _maxGammaEnergy;          ///< maximum gamma energy in case of photo nuclear processes [GeV]
        parameter<std::string,NO_VALIDITY_CHECK>   _pythiaParams;            ///< semi-colon separated parameters to pass to pythia, e.g. "mstj(1)=0;paru(13)=0.1" 
        parameter<bool, NO_VALIDITY_CHECK>         _pythiaFullEventRecord;   ///< if the full pythia event record should be in the output
-       parameter<unsigned int, VALIDITY_CHECK>    _xsecCalcMethod;          ///< Select x-sec calc method. (0 is standard starlight method, 1 must be used for assym. collisions (e.g. p-A), but is slow)
-       parameter<unsigned int, NO_VALIDITY_CHECK> _nThreads;                ///< Number of threads used in the case of using method 1 for calculating the x-sections
-        parameter<unsigned int, VALIDITY_CHECK>    _nBinsQKniehl;            ///< Number of bins in Q used for the transformation to the impact paramter space of the Kniehl function
-        parameter<unsigned int, VALIDITY_CHECK>    _nBinsEKniehl;            ///< Number of bins in photon energy used for the Kniehl function
-        parameter<unsigned int, VALIDITY_CHECK>    _nBinsBKniehl;            ///< Number of bins in impact parameter used for the Kniehl function
-        parameter<double, VALIDITY_CHECK>          _qMaxKniehl;              ///< Max value of Q used for the Kniehl funcion
-        parameter<double, VALIDITY_CHECK>          _eGammaMinKniehl;         ///< Min value of gamma energy used for the Kniehl funcion
-        parameter<double, VALIDITY_CHECK>          _eGammaMaxKniehl;         ///< Max value of gamma energy used for the Kniehl funcion
-        parameter<double, VALIDITY_CHECK>          _bMinKniehl;              ///< Min value of impact parameter used for the Kniehl funcion
-        parameter<double, VALIDITY_CHECK>          _bMaxKniehl;              ///< Max value of impact parameter used for the Kniehl funcion
-        
-       
+       parameter<unsigned int, VALIDITY_CHECK>    _xsecCalcMethod;          ///< Select x-sec calc method. (0 is standard starlight method, 1 must be used for assym. collisions (e.g. p-A), but is slow)      
+
        starlightConstants::particleTypeEnum       _particleType;
        starlightConstants::decayTypeEnum          _decayType;
        starlightConstants::interactionTypeEnum    _interactionType;
 
        double                         _beamLorentzGamma;                    ///< Lorentz gamma factor of the beams in CMS frame, not an input parameter
        
-       inputParser _ip; //!
+       inputParser _ip;
        
 };
 
 #define inputParametersInstance Singleton<inputParameters>::instance()
 
-/* template<typename T> */
+//template<typename T>
 inline 
 bool inputParameters::setParameter(std::string expression)
 {
index 7c06da4377a25406cbeb6c6d5c612ecc03469b6e..eb18f63131b59ca03742697bf43d38dce94fb266 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 156                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:17:52 +0200 #$: date of last commit
+// $Rev:: 177                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-11 20:56:53 +0200 #$: date of last commit
 //
 // Description:
 //
@@ -34,7 +34,7 @@
 #ifndef RANDOMGENERATOR_H
 #define RANDOMGENERATOR_H
 #include "singleton.h"
-#include "slmutex.h"
+//#include "slmutex.h"
 
 
 class randomGenerator
@@ -48,7 +48,7 @@ class randomGenerator
        unsigned int _Mt[624];
        int _count624;
        
-       MutexPosix _mutex;
+       //      MutexPosix _mutex;
        
        randomGenerator(){}
        randomGenerator(const randomGenerator &);
index 55cda2399649eb476c195d295e0aa7bd521bb82e..b95284d6499c675ca8d7ee455a8987a9a8d39725 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 179                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-11 20:58:05 +0200 #$: date of last commit
 //
 // Description:
 //    Added incoherent t2-> pt2 selection.  Following pp selection scheme
@@ -572,7 +572,11 @@ double Gammaavectormeson::pTgamma(double E)
     ereds = (E/_VMgamma_em)*(E/_VMgamma_em);
     //sqrt(3)*E/gamma_em is p_t where the distribution is a maximum
     Cm = sqrt(3.)*E/_VMgamma_em;
-
+    // If E is very small, the drawing of a pT below is extremely slow. 
+    // ==> Set pT = sqrt(3.)*E/_VMgamma_em for very small E. 
+    // Should have no observable consequences (JN, SRK 11-Sep-2014)
+    if( E < 0.0005 )return Cm; 
     //the amplitude of the p_t spectrum at the maximum
 
     if( _bbs.beam1().A()==1 && _bbs.beam2().A() != 1){ 
index 803d936f4353f397c3480dc8d9bd0fdb36dc18f5..cdcb458130a36a58b0d8e720bfd2af35045da134 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 184                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-12 00:59:43 +0200 #$: date of last commit
 //
 // Description:
 //    Nystrand 220710
@@ -823,6 +823,9 @@ double Gammagammaleptonpair::getMass()
     case starlightConstants::TAUON:
        leptonmass=starlightConstants::tauMass;
        break;
+    case starlightConstants::TAUONDECAY:
+       leptonmass=starlightConstants::tauMass;
+       break;
     default:
        cout<<"Not a recognized lepton, Gammagammaleptonpair::getmass(), mass = 0."<<endl;
     }
index 472735847fe9e7cc147700f002d34423470dedd9..f4fe3eade7a056e7a81051aae3ca99a118604410 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 182                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-12 00:58:56 +0200 #$: date of last commit
 //
 // Description:
 //
@@ -88,16 +88,7 @@ inputParameters::inputParameters()
          _maxGammaEnergy        ("MAX_GAMMA_ENERGY",0, NOT_REQUIRED),
          _pythiaParams          ("PYTHIA_PARAMS","", NOT_REQUIRED),
          _pythiaFullEventRecord ("PYTHIA_FULL_EVENTRECORD",false, NOT_REQUIRED),
-         _xsecCalcMethod        ("XSEC_METHOD",0, NOT_REQUIRED),
-         _nThreads              ("N_THREADS",1, NOT_REQUIRED),
-          _nBinsQKniehl          ("N_BINS_Q_KNIEHL", 0, NOT_REQUIRED),
-          _nBinsEKniehl          ("N_BINS_E_KNIEHL", 0, NOT_REQUIRED),
-          _nBinsBKniehl          ("N_BINS_B_KNIEHL", 0, NOT_REQUIRED),
-          _qMaxKniehl            ("Q_MAX_KNIEHL", 0, NOT_REQUIRED),
-          _eGammaMinKniehl       ("E_GAMMA_MIN_KNIEHL", 0, NOT_REQUIRED),
-          _eGammaMaxKniehl       ("E_GAMMA_MAX_KNIEHL", 0, NOT_REQUIRED),
-          _bMinKniehl            ("B_MIN_KNIEHL", 0, NOT_REQUIRED),
-          _bMaxKniehl            ("B_MAX_KNIEHL", 0, NOT_REQUIRED) 
+         _xsecCalcMethod        ("XSEC_METHOD",0, NOT_REQUIRED)
 {
   // All parameters must be initialised in initialisation list! 
   // If not: error: 'parameter<T, validate>::parameter() [with T = unsigned int, bool validate = true]' is private
@@ -143,15 +134,6 @@ inputParameters::inputParameters()
        _ip.addParameter(_pythiaParams);
        _ip.addParameter(_pythiaFullEventRecord);
        _ip.addParameter(_xsecCalcMethod);
-       _ip.addParameter(_nThreads);
-       _ip.addParameter(_nBinsBKniehl);
-       _ip.addParameter(_nBinsQKniehl);
-       _ip.addParameter(_nBinsEKniehl);
-       _ip.addParameter(_qMaxKniehl);
-       _ip.addParameter(_eGammaMaxKniehl);
-       _ip.addParameter(_eGammaMinKniehl);
-       _ip.addParameter(_bMaxKniehl);
-       _ip.addParameter(_bMinKniehl);
 }
 
 
@@ -257,6 +239,11 @@ inputParameters::configureFromFile(const std::string &configFileName)
                _decayType    = LEPTONPAIR;
                defaultMinW   = 2 * tauMass;
                break;
+       case 10015:  // tau+tau- pair
+               _particleType = TAUONDECAY;
+               _decayType    = LEPTONPAIR;
+               defaultMinW   = 2 * tauMass;
+               break;
 //     case 24:  // W+W- pair
 //             _particleType = W;
 //             _decayType    = WW;
index 51ad33d854aed80de410c15e0ddab8cd3830ab9b..b444d61a8b5c5819fb80dbe26756db022c1315d9 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 156                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:17:52 +0200 #$: date of last commit
+// $Rev:: 178                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-11 20:57:13 +0200 #$: date of last commit
 //
 // Description:
 //
@@ -91,7 +91,7 @@ void randomGenerator::SetSeed(unsigned int seed)
 // with many zero in the bit pattern (like 2**28).
 // see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html
 
-  Lockguard<MutexPosix> guard(&_mutex);
+  // Lockguard<MutexPosix> guard(&_mutex);
   
   _count624 = 624;
   int i,j;
@@ -112,7 +112,7 @@ double randomGenerator::Rndom(int)
 //  Produces uniformly-distributed floating points in ]0,1]
 //  Method: Mersenne Twistor
 
-   Lockguard<MutexPosix> guard(&_mutex);
+  // Lockguard<MutexPosix> guard(&_mutex);
    
    unsigned int y;
 
index 8d42db2a59c365489daeee61f5bc2b1a00a2d945..d4bb03e3167f6527bfa296f8871c2b50224c064f 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 185                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-09-12 02:38:41 +0200 #$: date of last commit
 //
 // Description:
 //
@@ -55,7 +55,6 @@
 #include "gammagammaleptonpair.h"
 #include "gammagammasingle.h"
 #include "gammaavm.h"
-#include "psifamily.h"
 #include "twophotonluminosity.h"
 #include "gammaaluminosity.h"
 #include "incoherentPhotonNucleusLuminosity.h"
@@ -265,6 +264,7 @@ starlight::createEventChannel()
        case ELECTRON:
        case MUON:
        case TAUON:
+        case TAUONDECAY:
                {
                        _eventChannel = new Gammagammaleptonpair(*_beamSystem);
                        if (_eventChannel)
index c3b83f925ef48e019fa980e4108775125b4c44c2..4ad4a700bc00875464824b2ecb06ed4f81e48b52 100755 (executable)
@@ -1,9 +1,12 @@
+// this macro runs analyze.cxx, which takes as input an Ascii starlight output
+// file, slight.out, and creates a standard set of histograms, which are stored
+// in histograms.root
 
-#include "analyse.cxx"
+#include "analyze.cxx"
 
 
 void ana()
 {
-  Analyse a("slight.out", 20);
+  Analyze a("slight.out", 20);
   a.doAnalysis();
 }
index 795dbe23b26c535b4df5e9f93ef6a41ebcc2695e..52d00309831f6504d91e1ad1594deebd775bb388 100644 (file)
@@ -1,3 +1,19 @@
+// This macro reads a starlight output file (default name slight.out) and creates a root file 
+// with  TLorentzVectors for the parent and a TClonesArray of TLorentzVectors for the daughter 
+// particles.  The output is stored in a root file (default name starlight.root) with one branch 
+// labeled "parent" and the other labeled "daughters". Any number of daughter tracks can be 
+// accomodated.  Daughter species currently accomodated are:  electrons, muons, charged or neutral 
+// pions, charged or neutral kaons, and protons.  
+//
+// To use this macro, open root and then 
+// type .x convertStarlightAsciiToTree.C("inputfilename", "outputfilename")
+// 
+// The root file produced can be examined in a root TBrowser.
+//
+// A macro to read this root file and make some standard plots is also provided.  This macro is 
+// called AnalyzeTree.cxx; it can be compiled and run with the anaTree.C macro by opening root 
+// and typing .x anaTree.C()
+
 #include <iostream>
 #include <fstream>
 #include <sstream>
 using namespace std;
 
 
-void readStarlightAscii(const char* inFileName  = "slight.out",
+void convertStarlightAsciiToTree(const char* inFileName  = "slight.out",
                         const char* outFileName = "starlight.root")
 {
-       const double daughterMass = 0.13957018; // charged pion [GeV]
 
        // create output tree
        TFile* outFile = new TFile(outFileName, "RECREATE");
@@ -24,7 +39,7 @@ void readStarlightAscii(const char* inFileName  = "slight.out",
        }
        TTree*          outTree           = new TTree("starlightTree", "starlightTree");
        TLorentzVector* parentParticle    = new TLorentzVector();
-       TClonesArray*   daughterParticles = new TClonesArray("TLorentzVector");
+       TClonesArray*   daughterParticles = new TClonesArray("TLorentzVector");
        outTree->Branch("parent",    "TLorentzVector", &parentParticle,    32000, -1);
        outTree->Branch("daughters", "TClonesArray",   &daughterParticles, 32000, -1);
 
@@ -65,12 +80,13 @@ void readStarlightAscii(const char* inFileName  = "slight.out",
                        lineStream.str(line);
                        assert(lineStream >> label >> particleCode >> momentum[0] >> momentum[1] >> momentum[2]);
                        assert(label == "TRACK:");
+                       Double_t daughterMass = IDtoMass(particleCode);
+                       if (daughterMass < 0) {break;}
                        const double E = sqrt(  momentum[0] * momentum[0] + momentum[1] * momentum[1]
                                              + momentum[2] * momentum[2] + daughterMass * daughterMass);
                        new ( (*daughterParticles)[i] ) TLorentzVector(momentum[0], momentum[1], momentum[2], E);
                        *parentParticle += *(static_cast<TLorentzVector*>(daughterParticles->At(i)));
                }
-
                daughterParticles->Compress();
                outTree->Fill();
        }
@@ -81,3 +97,21 @@ void readStarlightAscii(const char* inFileName  = "slight.out",
                delete outFile;
        }
 }
+
+       double IDtoMass(int particleCode){
+               double mass;
+               if (particleCode == 2 || particleCode==3) {mass = 0.0051099907;} // electron
+               else if (particleCode == 5 || particleCode==6) {mass = 0.105658389;} // muon
+               else if (particleCode == 8 || particleCode==9)  {mass = 0.13956995;} // charged pion
+               else if (particleCode == 7) {mass = 0.1345766;} // neutral pion
+               else if (particleCode == 11|| particleCode==12) {mass = 0.493677;} // charged kaon
+               else if (particleCode == 10 || particleCode == 16)  {mass = 0.497614;} // neutral kaon
+               else if (particleCode == 14)    {mass = 0.93827231;} // proton
+               else {
+                       cout << "unknown daughter particle (ID = " << particleCode << "), please modify code to accomodate" << endl;
+                       mass = -1.0;
+//                     exit(0); 
+                    } 
+
+               return mass;
+       }
index 1634f243f15d077169637def732b5832e546e761..a694f272917e1e6da8787429baba7ef06ec01a5d 100644 (file)
@@ -229,7 +229,7 @@ void Config()
     gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
     gener->SetVertexSmear(kPerEvent); 
     gener->SetTrackingFlag(1);
-//     gener->SetYRange(-0.9, 0.9);
+    gener->SetYRange(-0.9, 0.9);
     gener->Init();
   }
 
index ee58cd57560abf741db4da1a9bc58fd852908f7a..8f996d4ecb22477b941196286893eb64c176b3a6 100644 (file)
@@ -40,8 +40,8 @@ AliAODZDC::AliAODZDC() :
   fImpactParamSideC(0),
   fZDCTDCSum(0),        
   fZDCTDCDifference(0),
-  fZNCTDC(0),
-  fZNATDC(0)
+  fZNCTDC(-999.),
+  fZNATDC(-999.)
 {
 // Default constructor
   for(Int_t i=0; i<5; i++){
index 47006e13677f4bc3da7d78b75c2b5525105aee1d..d4faa97a099c2230a9512f9cea0a516dc5c762ad 100644 (file)
@@ -77,18 +77,18 @@ public:
   Float_t GetZDCTDCCorrected(Int_t i, Int_t j) const 
   {
     if(AliESDZDC::kCorrectedTDCFilled && (fZDCTDCData[i][j]!=0)) return fZDCTDCCorrected[i][j];
-          else return 0.;
+          else return 999.;
   }
   
   Float_t GetZNTDCSum(Int_t ihit) const 
   {
     if(ihit<4 && AliESDZDC::kCorrectedTDCFilled && (fZDCTDCData[10][ihit]!=0) && (fZDCTDCData[12][ihit]!=0)) return (Float_t) (fZDCTDCCorrected[10][ihit]+fZDCTDCCorrected[12][ihit]);
-    else return 0.;
+    else return 999.;
   }
   Float_t GetZNTDCDiff(Int_t ihit) const 
   {
     if(ihit<4 && AliESDZDC::kCorrectedTDCFilled &&  (fZDCTDCData[10][ihit]!=0) && (fZDCTDCData[12][ihit]!=0)) return (Float_t) (fZDCTDCCorrected[12][ihit]-fZDCTDCCorrected[10][ihit]);
-    else return 0.;
+    else return 999.;
   }
   
   virtual Float_t GetZDCTimeSum() const 
index 1eae5c7d2a9bf9f1f017d0928d83e9be57fea6c3..5faaa96152d18f0ff0805dd2fbab9ea89f577835 100644 (file)
@@ -4212,6 +4212,7 @@ Bool_t AliReconstruction::GetEventInfo()
   UChar_t clustmask = 0;
   TString trclasses;
   ULong64_t trmask = fEventInfo.GetTriggerMask();
+  ULong64_t trmaskNext50 = fEventInfo.GetTriggerMaskNext50();
   const TObjArray& classesArray = config->GetClasses();
   Int_t nclasses = classesArray.GetEntriesFast();
   for( Int_t iclass=0; iclass < nclasses; iclass++ ) {
@@ -4226,6 +4227,13 @@ Bool_t AliReconstruction::GetEventInfo()
        trclasses += " ";
        clustmask |= trclass->GetCluster()->GetClusterMask();
       }
+      if (trmaskNext50 & (1ull << trindex)) {
+       trclasses += " ";
+       trclasses += trclass->GetName();
+       trclasses += " ";
+       clustmask |= trclass->GetCluster()->GetClusterMask();
+      }
+
     }
   }
   fEventInfo.SetTriggerClasses(trclasses);
@@ -4261,6 +4269,7 @@ Bool_t AliReconstruction::GetEventInfo()
   // Set the information in ESD
   if (fesd) {
     fesd->SetTriggerMask(trmask);
+    fesd->SetTriggerMaskNext50(trmaskNext50);
     fesd->SetTriggerCluster(clustmask);
   }
 
index f172f75ba6520b5b527b140b6182853c28e58b10..22cc3743c304f7c5d1c95d4e7f7b185ca05233ce 100644 (file)
@@ -137,9 +137,9 @@ UInt_t AliPIDCombined::ComputeProbabilities(const AliVTrack *track, const AliPID
        for (Int_t i=0;i<fSelectedSpecies;i++){
          p[i] *= detProb[i];
          if(detBit == AliPIDResponse::kDetTOF){
-           Float_t pt = track->Pt();
-           Float_t mismPropagationFactor[] = {1.,1.,1.,float(1 + TMath::Exp(1 - 1.12*pt)),
-                                              float(1 + 1./(4.71114 - 5.72372*pt + 2.94715*pt*pt)),1.,1.,1.,1.,1.}; // correction for kaons and protons which has to be alligned with the one in AliPIDResponse
+           Double_t pt = track->Pt();
+           Double_t mismPropagationFactor[] = {1.,1.,1.,1. + TMath::Exp(1. - 1.12*pt),
+                                               1. + 1./(4.71114 - 5.72372*pt + 2.94715*pt*pt),1.,1.,1.,1.,1.}; // correction for kaons and protons which has to be alligned with the one in AliPIDResponse
            pMismTOF[i] *= fTOFmismProb*mismPropagationFactor[i];
          }
          else pMismTOF[i] *= detProb[i];
index 2306c06983705734da9ee887d9c569d21a244a49..cddeeadbe9b3ab1e83832d31b98174d4d32f3268 100644 (file)
@@ -2417,7 +2417,7 @@ AliPIDResponse::EDetPidStatus AliPIDResponse::GetComputeTOFProbability  (const A
     mismPropagationFactor[4] = 1 + 1./(4.71114 - 5.72372*pt + 2.94715*pt*pt);// it has to be alligned with the one in AliPIDCombined
     
   Int_t nTOFcluster = 0;
-  if(track->GetTOFHeader() && track->GetTOFHeader()->GetTriggerMask()){ // N TOF clusters available
+  if(track->GetTOFHeader() && track->GetTOFHeader()->GetTriggerMask() && track->GetTOFHeader()->GetNumberOfTOFclusters() > -1){ // N TOF clusters available
     nTOFcluster = track->GetTOFHeader()->GetNumberOfTOFclusters();
     if(fIsMC) nTOFcluster = Int_t(nTOFcluster * 1.5); // +50% in MC
   }
@@ -2447,6 +2447,8 @@ AliPIDResponse::EDetPidStatus AliPIDResponse::GetComputeTOFProbability  (const A
       break;
     }
     
+    if(nTOFcluster < 0) nTOFcluster = 10;
+
     
     fgTOFmismatchProb=fTOFResponse.GetMismatchProbability(track->GetTOFsignal(),track->Eta()) * nTOFcluster *6E-6 * (1 + 2.90505e-01/pt/pt); // mism weight * tof occupancy (including matching window factor) * pt dependence
     
index da46aa702842bdfaa7b8ee9b167983c0a045a718..4ce8f1755dbbc3d09380517e7475b8f5af28044d 100644 (file)
@@ -106,6 +106,21 @@ void AliTOFPIDResponse::SetTOFtail(Float_t tail){
     fTOFtailResponse->SetParameter(3,tail);
   }
 }
+void AliTOFPIDResponse::SetTOFtailAllPara(Float_t mean,Float_t tail){
+  if(!fTOFtailResponse){
+    fTOFtailResponse = new TF1("fTOFtail","[0]*TMath::Exp(-(x-[1])*(x-[1])/2/[2]/[2])* (x < [1]+[3]*[2]) + (x > [1]+[3]*[2])*[0]*TMath::Exp(-(x-[1]-[3]*[2]*0.5)*[3]/[2] * 0.0111)*0.018",-1000,1000);
+    fTOFtailResponse->SetParameter(0,1);
+    fTOFtailResponse->SetParameter(1,mean);
+    fTOFtailResponse->SetParameter(2,1);
+    fTOFtailResponse->SetParameter(3,tail);
+    fTOFtailResponse->SetNpx(10000);
+  }
+  else{
+    fTOFtailResponse->SetParameter(1,mean);
+    fTOFtailResponse->SetParameter(3,tail);
+  }  
+}
+
 //_________________________________________________________________________
 Double_t 
 AliTOFPIDResponse::GetMismatchProbability(Double_t time,Double_t eta) const {
index c4b0dcd308d1aa8c05eb7b1f93d6e832c1bbf32c..4c2a4b2bfd3f78381e11ca30548dfd6c1f725899 100644 (file)
@@ -69,6 +69,7 @@ public:
 
   Float_t GetTOFtail() {if(fTOFtailResponse) return fTOFtailResponse->GetParameter(3);else return -1;};
   void    SetTOFtail(Float_t tail);
+  void    SetTOFtailAllPara(Float_t mean,Float_t tail);
 
  private:
   Double_t fSigma;        // intrinsic TOF resolution
index 7416193711662435448c1f29f169091702dcd37b..d3abac4f99b49375b85e506c32ab25fbb72f938c 100644 (file)
@@ -29,13 +29,23 @@ AliTOFAnalysisTaskCalibTree *AddTOFAnalysisTaskCalibTree()
   }
   
   // setup output event handler
-  AliAODHandler *outputh = (AliAODHandler *)mgr->GetOutputEventHandler();
-  outputh->SetCreateNonStandardAOD();
-  outputh->SetOutputFileName("TOFcalibTree.root");
+
+  // old way: expecting to use AOD tree
+  // AliAODHandler *outputh = (AliAODHandler *)mgr->GetOutputEventHandler();
+  // outputh->SetCreateNonStandardAOD();
+  // outputh->SetOutputFileName("TOFcalibTree.root");
+
+  // new way:
+  AliAnalysisDataContainer *coutput   = mgr->CreateContainer(Form("aodTree"), TTree::Class(), AliAnalysisManager::kOutputContainer, "TOFcalibTree.root"); // tree
+  if (!coutput) {
+    Error("AddTOFAnalysisTaskCalibTree", "cannot create output container");
+    return NULL;
+  }
 
   //  create task and connect input/output 
   AliTOFAnalysisTaskCalibTree *task = new AliTOFAnalysisTaskCalibTree();
   mgr->ConnectInput(task, 0, inputc);
+  mgr->ConnectOutput(task, 1, coutput);
 
   // setup task 
   task->SetEventSelectionFlag(kFALSE);
index e8c72246591c8161d6f87809716333cc80f2929a..9f44d8939b3cd0910a938606f55f74f95841904e 100644 (file)
@@ -48,13 +48,16 @@ AliAnalysisTaskSE(name),
   fTimeResolution(80.),
   fTOFcalib(new AliTOFcalib()),             
   fTOFT0maker(new AliTOFT0maker(fESDpid, fTOFcalib)),         
-  fTOFT0v1(new AliTOFT0v1(fESDpid))             
+  fTOFT0v1(new AliTOFT0v1(fESDpid)),
+  fOutputTree(0x0)             
 
 {
   /* 
    * default constructor 
    */
 
+  DefineOutput(1, TTree::Class());  
+
 }
 
 //_______________________________________________________
@@ -70,6 +73,10 @@ AliTOFAnalysisTaskCalibTree::~AliTOFAnalysisTaskCalibTree()
   delete fTOFcalib;
   delete fTOFT0maker;
   delete fTOFT0v1;
+  if (fOutputTree) {
+    delete fOutputTree;
+    fOutputTree = 0x0;
+  }
 
 }
 
@@ -82,18 +89,22 @@ AliTOFAnalysisTaskCalibTree::UserCreateOutputObjects()
    * user create output objects
    */
 
+  fOutputTree = new TTree("aodTree", "Tree with TOF calib output"); 
+
   /* setup output tree */
-  OutputTree()->Branch("run", &fRunNumber, "run/I");
-  OutputTree()->Branch("timestamp", &ftimestamp, "timestamp/i");
-  OutputTree()->Branch("timezero", &ftimezero, "timezero/F");
-  OutputTree()->Branch("vertex", &fVertexZ, "vertex/F");
-  OutputTree()->Branch("nhits", &fnhits, "nhits/I");
-  OutputTree()->Branch("momentum", &fmomentum, "momentum[nhits]/F");
-  OutputTree()->Branch("length", &flength, "length[nhits]/F");
-  OutputTree()->Branch("index", &findex, "index[nhits]/I");
-  OutputTree()->Branch("time", &ftime, "time[nhits]/F");
-  OutputTree()->Branch("tot", &ftot, "tot[nhits]/F");
-  OutputTree()->Branch("texp", &ftexp, "texp[nhits]/F");
+  fOutputTree->Branch("run", &fRunNumber, "run/I");
+  fOutputTree->Branch("timestamp", &ftimestamp, "timestamp/i");
+  fOutputTree->Branch("timezero", &ftimezero, "timezero/F");
+  fOutputTree->Branch("vertex", &fVertexZ, "vertex/F");
+  fOutputTree->Branch("nhits", &fnhits, "nhits/I");
+  fOutputTree->Branch("momentum", &fmomentum, "momentum[nhits]/F");
+  fOutputTree->Branch("length", &flength, "length[nhits]/F");
+  fOutputTree->Branch("index", &findex, "index[nhits]/I");
+  fOutputTree->Branch("time", &ftime, "time[nhits]/F");
+  fOutputTree->Branch("tot", &ftot, "tot[nhits]/F");
+  fOutputTree->Branch("texp", &ftexp, "texp[nhits]/F");
+
+  PostData(1, fOutputTree);
 
 }
 
@@ -171,7 +182,9 @@ void AliTOFAnalysisTaskCalibTree::UserExec(Option_t *option) {
 
   // check number of hits and set fill output tree
   if (fnhits > 0)
-    ((AliAODHandler*)(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()))->SetFillAOD(kTRUE);
+    fOutputTree->Fill();
+
+  PostData(1, fOutputTree);
 
 }
 
@@ -179,7 +192,7 @@ void AliTOFAnalysisTaskCalibTree::UserExec(Option_t *option) {
 
 Bool_t AliTOFAnalysisTaskCalibTree::InitRun() {
 
-  //
+  //¯
   // init run
   //
   
@@ -249,8 +262,10 @@ Bool_t AliTOFAnalysisTaskCalibTree::InitEvent() {
   fElapsedTime = fESDEvent->GetTimeStamp() - fStartTime;
 
   // event selection
-  fIsCollisionCandidate = fEventCuts->IsCollisionCandidate(fESDEvent);
-  if (fEventSelectionFlag && !fIsCollisionCandidate) return kFALSE;
+  if (fEventSelectionFlag){
+    fIsCollisionCandidate = fEventCuts->IsCollisionCandidate(fESDEvent);
+    if (!fIsCollisionCandidate) return kFALSE;
+  }
 
   // vertex selection
   fVertex = fESDEvent->GetPrimaryVertexTracks();
index 0dd93c1051da1fd3cdf261ccc22afce77e600d70..c0e5c2e6309951b43c138ebdc486b943a09f60ca 100644 (file)
@@ -124,7 +124,9 @@ public AliAnalysisTaskSE
   Float_t ftot[MAXHITS];
   Float_t ftexp[MAXHITS];
 
-  ClassDef(AliTOFAnalysisTaskCalibTree, 1);
+  TTree* fOutputTree;                 // output tree
+
+  ClassDef(AliTOFAnalysisTaskCalibTree, 2);
 };
 
 #endif /* ALIANALYSISTASKTOFCOMPACTCALIB_H */
index ecf85d76809c02a7655e9e3defdfff3f59ea0a8d..8674dc13581d64bdea7fbe0e38ba52b3b0b58ead 100644 (file)
@@ -144,3 +144,5 @@ set ( EXPORT
   AliTRDtrackGTU.h
   AliTRDtrackletGTU.h
    )
+install (FILES AliTRDgeometry.h
+  DESTINATION TRD)
index 4abae07cc196ff5b5bb8bfe804513559eb9984fa..1253dc0d9d7d1b12145a84a633d7347381e83e82 100644 (file)
@@ -511,7 +511,7 @@ void AliVZERODigitizer::WriteDigits(AliLoader *loader)
   loader->MakeDigitsContainer();
   TTree* treeD  = loader->TreeD();
   DigitsArray();
-  treeD->Branch("VZERODigit", &fDigits); 
+  treeD->Branch("VZERODigit", "TClonesArray", &fDigits); 
   
   Short_t *chargeADC = new Short_t[kNClocks];
   for (Int_t i=0; i<64; i++) {      
@@ -541,7 +541,7 @@ void AliVZERODigitizer::WriteSDigits(AliLoader *loader)
   loader->MakeSDigitsContainer();
   TTree* treeS  = loader->TreeS();
   SDigitsArray();
-  treeS->Branch("VZEROSDigit", &fDigits); 
+  treeS->Branch("VZEROSDigit", "TClonesArray", &fDigits); 
   
   for (Int_t ipmt = 0; ipmt < 64; ++ipmt) {
     AddSDigit(ipmt,fNBins[ipmt],fTime[ipmt],fLabels[ipmt]);
index 2229a47593f1bcfb5df56e18852b3f49ff221ebe..838903c4fd41077724810d0e81f9016339a35847 100644 (file)
@@ -769,7 +769,7 @@ Int_t AliZDCDigitizer::Pedestal(Int_t Det, Int_t Quad, Int_t Res) const
 {
   // Returns a pedestal for detector det, PM quad, channel with res.
   //
-  Float_t pedValue;
+  Float_t pedValue=0.;
   // Normal run
   if(fIsCalibration == 0){
     Int_t index=0, kNch=24;
@@ -782,13 +782,18 @@ Int_t AliZDCDigitizer::Pedestal(Int_t Det, Int_t Quad, Int_t Res) const
     }
     else index = (Det-1)/3+22+kNch*Res; // Reference PMs
     //
-    Float_t meanPed = fPedData->GetMeanPed(index);
-    Float_t pedWidth = fPedData->GetMeanPedWidth(index);
-    pedValue = gRandom->Gaus(meanPed,pedWidth);
-    //
-    /*printf("\t  AliZDCDigitizer::Pedestal -> det %d quad %d res %d - Ped[%d] = %d\n",
-       Det, Quad, Res, index,(Int_t) pedValue); // Chiara debugging!
-    */
+    if(fPedData){
+      Float_t meanPed = fPedData->GetMeanPed(index);
+      Float_t pedWidth = fPedData->GetMeanPedWidth(index);
+      pedValue = gRandom->Gaus(meanPed,pedWidth);
+      //
+      /*printf("\t  AliZDCDigitizer::Pedestal -> det %d quad %d res %d - Ped[%d] = %d\n",
+       Det, Quad, Res, index,(Int_t) pedValue); // Chiara debugging!
+      */
+    }
+    else{
+      printf("  AliZDCDigitizer::Pedestal -> No valid pedestal calibration object loaded!\n\n");
+    }
   }
   // To create calibration object
   else{
@@ -829,14 +834,13 @@ AliZDCPedestals* AliZDCDigitizer::GetPedData() const
 {
 
   // Getting pedestal calibration object for ZDC set
-
+  AliZDCPedestals *calibdata = 0x0;
   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Calib/Pedestals");
   if(!entry) AliFatal("No calibration data loaded!");  
   else{
-    AliZDCPedestals *calibdata = dynamic_cast<AliZDCPedestals*>  (entry->GetObject());
+    calibdata = dynamic_cast<AliZDCPedestals*>  (entry->GetObject());
     if(!calibdata)  AliFatal("Wrong calibration object in calibration  file!");
-
-    return calibdata;
   }
+  return calibdata;
 }
 
index 79f854354b708ff77af94cdaf4af381a3901be12..e87b0d563c662d198f818523df4d35b223322cec 100644 (file)
@@ -87,12 +87,13 @@ AliZDCPedestals* AliZDCQADataMakerRec::GetPedCalibData() const
 {
 
   // Retrieving pedestal calibration object from OCDB
+  AliZDCPedestals *calibdata = 0x0;
   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Calib/Pedestals");
   if(!entry) AliWarning("No calibration data loaded!");  
-
-  AliZDCPedestals *calibdata = (AliZDCPedestals*)  (entry->GetObject());
-  if(!calibdata) AliFatal("Wrong calibration object in calibration  file!");
-
+  else{
+    calibdata = (AliZDCPedestals*)  (entry->GetObject());
+    if(!calibdata) AliFatal("Wrong calibration object in calibration  file!");
+  }
   return calibdata;
 
 }
@@ -408,7 +409,13 @@ void AliZDCQADataMakerRec::MakeRaws(AliRawReader *rawReader)
     // Parameters for mean value pedestal subtraction
     int const kNch = 24;
     Float_t meanPed[2*kNch];    
-    for(Int_t jj=0; jj<2*kNch; jj++) meanPed[jj] = fPedCalibData->GetMeanPed(jj);
+    for(Int_t jj=0; jj<2*kNch; jj++){
+      if(fPedCalibData) meanPed[jj] = fPedCalibData->GetMeanPed(jj);
+      else{
+        meanPed[jj] = 0.;
+       printf("  AliZDCQADataMakerRec::MakeRaws -> No valid pedestal object loaded!\n\n");
+      }
+    }
     
     Float_t zncSignal=0., znaSignal=0., zpcSignal=0., zpaSignal=0.;
     Float_t zncSumQ=0., znaSumQ=0., zpcSumQ=0., zpaSumQ=0.;
index f332132a0008689837e2ca475f33ff14daf81ea9..bbcb7b199287b0f47f5a4a43700424fec573ee14 100644 (file)
@@ -253,14 +253,17 @@ void AliZDCRawStream::ReadChMap()
   AliDebug(2,"\t Reading ZDC ADC mapping from OCDB\n");
   AliZDCChMap * chMap = GetChMap();
   //chMap->Print("");
-  for(Int_t i=0; i<kNch; i++){
-    fMapADC[i][0] = chMap->GetADCModule(i);
-    fMapADC[i][1] = chMap->GetADCChannel(i);
-    fMapADC[i][2] = chMap->GetADCSignalCode(i);
-    fMapADC[i][3] = chMap->GetDetector(i);
-    fMapADC[i][4] = chMap->GetSector(i);
+  if(chMap){
+    for(Int_t i=0; i<kNch; i++){
+      fMapADC[i][0] = chMap->GetADCModule(i);
+      fMapADC[i][1] = chMap->GetADCChannel(i);
+      fMapADC[i][2] = chMap->GetADCSignalCode(i);
+      fMapADC[i][3] = chMap->GetDetector(i);
+      fMapADC[i][4] = chMap->GetSector(i);
+    }
+    fIsMapRead = kTRUE;
   }
-  fIsMapRead = kTRUE;
+  else printf("  AliZDCRawStream::ReadChMap -> No valid object fr mapping loaded!!!\n\n");
 }
 
 //_____________________________________________________________________________
@@ -994,14 +997,13 @@ AliZDCChMap* AliZDCRawStream::GetChMap() const
 {
 
   // Getting calibration object for ZDC
-
+  AliZDCChMap *calibdata = 0x0;
   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Calib/ChMap");
   if(!entry) AliFatal("No calibration data loaded!");  
   else{
-   
-    AliZDCChMap *calibdata = dynamic_cast<AliZDCChMap*> (entry->GetObject());
+    calibdata = dynamic_cast<AliZDCChMap*> (entry->GetObject());
     if(!calibdata) AliFatal("Wrong calibration object in calibration  file!");
-
-    return calibdata;
   }
+
+  return calibdata;
 }
index a156861562459edad91560a25e48ca86ff135a76..b95c7651e195c613bd55dec6ddd22a8982f4c951 100644 (file)
@@ -220,11 +220,8 @@ void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) co
 
   // loop over digits
   Float_t tZN1Corr[10], tZP1Corr[10], tZN2Corr[10], tZP2Corr[10]; 
-  Float_t dZEM1Corr[2], dZEM2Corr[2], sPMRef1[2], sPMRef2[2]; 
-  for(Int_t i=0; i<10; i++){
-     tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;
-     if(i<2) dZEM1Corr[i] = dZEM2Corr[i] = sPMRef1[i] = sPMRef2[i] = 0.;
-  }  
+  for(Int_t i=0; i<10; i++) tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;  
+  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[2]={0,0}, sPMRef2[2]={0,0}; 
   
   Int_t digNentries = digitsTree->GetEntries();
   Float_t ootDigi[kNch]; Int_t i=0;
@@ -375,11 +372,8 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
   }
   
   Float_t tZN1Corr[10], tZP1Corr[10], tZN2Corr[10], tZP2Corr[10]; 
-  Float_t dZEM1Corr[2], dZEM2Corr[2], sPMRef1[2], sPMRef2[2]; 
-  for(Int_t i=0; i<10; i++){
-     tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;
-     if(i<2) dZEM1Corr[i] = dZEM2Corr[i] = sPMRef1[i] = sPMRef2[i] = 0.;
-  }  
+  for(Int_t i=0; i<10; i++) tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;
+  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[2]={0,0}, sPMRef2[2]={0,0}; 
 
   Bool_t isScalerOn=kFALSE;
   Int_t jsc=0, itdc=0, iprevtdc=-1, ihittdc=0;
@@ -479,7 +473,7 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
          pedindex = (det-1)/3 + 22;
          if(det == 1){
            if(gain==0) sPMRef1[0] += (Float_t) (rawData.GetADCValue()-meanPed[pedindex]);
-        else sPMRef1[1] += (Float_t) (rawData.GetADCValue()-meanPed[pedindex+kNch]);
+          else sPMRef1[1] += (Float_t) (rawData.GetADCValue()-meanPed[pedindex+kNch]);
          }
          else if(det == 4){
            if(gain==0) sPMRef2[0] += (Float_t) (rawData.GetADCValue()-meanPed[pedindex]);
@@ -636,7 +630,7 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
     dZEM2Corr[1] = adcZEMlg[1] - (corrCoeff1[11+kNch]*adcZEMootlg[1]+corrCoeff0[11+kNch]);
     // *************************************************************************
   }
-  else if(fPedSubMode==0 && fRecoMode==1){
+  /*else if(fPedSubMode==0 && fRecoMode==1){
     //  **** p-p data taking 2011 -> temporary patch to overcome DA problem ****
     //
     dZEM1Corr[0] = adcZEM[0]   - meanPed[10];
@@ -644,7 +638,7 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
     dZEM2Corr[0] = adcZEM[1]   - meanPed[11];
     dZEM2Corr[1] = adcZEMlg[1] - meanPed[11+kNch];
         // *************************************************************************
-  }
+  }*/
     
   if(fRecoMode==1) // p-p data
     ReconstructEventpp(clustersTree, tZN1Corr, tZP1Corr, tZN2Corr, tZP2Corr, 
index 1f79e4fd955c3faf5496e9f2fa25c006ecff6852..b17adb88604a3b119ccd42f122dbd5961c62b2fb 100644 (file)
@@ -91,8 +91,8 @@ UInt_t AliZDCTriggerProcessor::ProcessEvent()
 Bool_t AliZDCTriggerProcessor::MBTrigger()
 {
   // is the processed event a MB A-A event?
-  
-  Float_t mbTrheshold = fTriggerParam->GetADCMBThreshold();
+  Float_t mbTrheshold = 0.;
+  if(fTriggerParam) mbTrheshold = fTriggerParam->GetADCMBThreshold();
   // check whether ZDC signal > mbTrheshold
   if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > mbTrheshold)
        return kTRUE;
@@ -105,8 +105,14 @@ Bool_t AliZDCTriggerProcessor::CentralTrigger()
 {
   // is the processed event a central A-A event?
   
-  Float_t zemThr = fTriggerParam->GetADCZDCCentralityThr();
-  const Float_t* centralWin = fTriggerParam->GetADCCentralWindow();
+  Float_t zemThr = 0;
+  Float_t centralWin[2] = {0,0};
+  if(fTriggerParam){
+    zemThr = fTriggerParam->GetADCZDCCentralityThr();
+    const Float_t* cWin = fTriggerParam->GetADCCentralWindow();
+    centralWin[0] = cWin[0];
+    centralWin[1] = cWin[1];
+  }
   // 
   if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > centralWin[0]
      && 
@@ -122,8 +128,14 @@ Bool_t AliZDCTriggerProcessor::SemicentralTrigger()
 {
   // is the processed event a semicentral A-A event?
   
-  Float_t zemThr =  fTriggerParam->GetADCZDCCentralityThr();
-  const Float_t* semicentralWin =   fTriggerParam->GetADCSemicentralWindow();
+  Float_t zemThr = 0;  
+  Float_t semicentralWin[2] = {0,0};
+  if(fTriggerParam){
+    zemThr  =  fTriggerParam->GetADCZDCCentralityThr();
+    const Float_t* cWin =   fTriggerParam->GetADCSemicentralWindow();
+    semicentralWin[0] = cWin[0];
+    semicentralWin[1] = cWin[1];
+  }
   //
   if((fSignal[0]+fSignal[1]+fSignal[3]+fSignal[4]) > semicentralWin[0]
      && 
@@ -139,7 +151,14 @@ Bool_t AliZDCTriggerProcessor::EMDTrigger()
 {
   // is the processed an EMD event?
   
-  const Float_t* emdWin =   fTriggerParam->GetADCEMDWindow();
+  Float_t emdWin[4] = {0,0,0,0};
+  if(fTriggerParam){
+    const Float_t* eWin =   fTriggerParam->GetADCEMDWindow();
+    emdWin[0] = eWin[0];
+    emdWin[1] = eWin[1];
+    emdWin[2] = eWin[2];
+    emdWin[3] = eWin[3];
+  }
   // check whether ZNA AND ZNC signals fall into the 
   // 2 distinct windows defined for EMD trigger
   if(fSignal[0] > emdWin[0] && fSignal[0] < emdWin[1]
@@ -153,12 +172,13 @@ Bool_t AliZDCTriggerProcessor::EMDTrigger()
 AliZDCTriggerParameters* AliZDCTriggerProcessor::GetTriggerParamFromOCDB() const
 {
   // retrieving trigger parameter configuration form OCDB
+  AliZDCTriggerParameters *trigParam = 0x0;
   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Trigger/");
   if(!entry) AliFatal("No calibration data loaded!");  
   else{
-    AliZDCTriggerParameters *trigParam = dynamic_cast<AliZDCTriggerParameters*>  (entry->GetObject());
+    trigParam = dynamic_cast<AliZDCTriggerParameters*>  (entry->GetObject());
     if(!trigParam)  AliFatal("Wrong calibration object in calibration  file!");
-
-    return trigParam;
   }
+
+  return trigParam;
 }
index 8fb14ed78f66d692153f63da7400b02aa60bad44..83782ad40a27ec70f37d850a23e8bd753f6d18cf 100644 (file)
@@ -9,5 +9,15 @@ file(GLOB PACKAGES CMake*.pkg)
 
 ALICE_BuildModule()
 
-install ( FILES "SpectatorSignal.root" "GlauberMCDist.root" 
-         DESTINATION ZDC )
+install ( FILES 
+  GlauberMCDist.root
+  GlauberMCHistos.root
+  PMTGainsdata.txt
+  SpectatorSignal.root
+  ZNASignal.root
+  ZNCSignal.root
+  ZNsignalntu.root
+  ZPASignal.root
+  ZPCSignal.root
+  ZPsignalntu.root
+  DESTINATION ZDC )
index f6c24a416dac87325adaeee6e727d0fc7e89bd0a..f7260607bd986c3bc1c42fb01b90504269110d5e 100644 (file)
@@ -96,7 +96,7 @@ set ( SOFLAGS  "-m64 -dynamiclib -undefined dynamic_lookup -single_module")
 
 set ( ALLIB )
 
-set ( SYSLIBS  "-L/usr/X11R6/lib -lX11")
+#set ( SYSLIBS  "-L/usr/X11R6/lib -lX11")
 
 set ( EXEFLAGS  "-bind_at_load")