coverity fixes
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Apr 2013 07:18:12 +0000 (07:18 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Apr 2013 07:18:12 +0000 (07:18 +0000)
PWGJE/AliAnalysisTaskFragmentationFunction.cxx
PWGJE/AliFragmentationFunctionCorrections.cxx
PWGJE/AliFragmentationFunctionCorrections.h

index 1b3346e..b67d9e2 100644 (file)
-// *************************************************************************\r
-// *                                                                       *\r
-// * Task for Fragmentation Function Analysis in PWG4 Jet Task Force Train *\r
-// *                                                                       *\r
-// *************************************************************************\r
-\r
-\r
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- *                                                                        *\r
- * Author: The ALICE Off-line Project.                                    *\r
- * Contributors are mentioned in the code where appropriate.              *\r
- *                                                                        *\r
- * Permission to use, copy, modify and distribute this software and its   *\r
- * documentation strictly for non-commercial purposes is hereby granted   *\r
- * without fee, provided that the above copyright notice appears in all   *\r
- * copies and that both the copyright notice and this permission notice   *\r
- * appear in the supporting documentation. The authors make no claims     *\r
- * about the suitability of this software for any purpose. It is          *\r
- * provided "as is" without express or implied warranty.                  *\r
- **************************************************************************/\r
-\r
-/* $Id: */\r
-\r
-#include "TList.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TString.h"\r
-#include "THnSparse.h"\r
-#include "TProfile.h"\r
-#include "TFile.h"\r
-#include "TKey.h"\r
-#include "TRandom3.h"\r
-#include "TAxis.h"\r
-\r
-#include "AliAODInputHandler.h" \r
-#include "AliAODHandler.h" \r
-#include "AliESDEvent.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAODJet.h"\r
-#include "AliAODJetEventBackground.h"\r
-#include "AliGenPythiaEventHeader.h"\r
-#include "AliGenHijingEventHeader.h"\r
-#include "AliInputEventHandler.h"\r
-\r
-#include "AliAnalysisHelperJetTasks.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliVParticle.h"\r
-#include "AliVEvent.h"\r
-\r
-#include "AliAnalysisTaskFragmentationFunction.h"\r
-\r
-ClassImp(AliAnalysisTaskFragmentationFunction)\r
-\r
-//____________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()\r
-   : AliAnalysisTaskSE()\r
-   ,fESD(0)\r
-   ,fAOD(0)\r
-   ,fAODJets(0)  \r
-   ,fAODExtension(0)\r
-   ,fNonStdFile("")\r
-   ,fBranchRecJets("jets")\r
-   ,fBranchRecBckgClusters("")\r
-   ,fBranchGenJets("")\r
-   ,fBranchEmbeddedJets("")\r
-   ,fTrackTypeGen(0)\r
-   ,fJetTypeGen(0)\r
-   ,fJetTypeRecEff(0)\r
-   ,fUseAODInputJets(kTRUE)\r
-   ,fFilterMask(0)\r
-   ,fUsePhysicsSelection(kTRUE)\r
-   ,fEvtSelectionMask(0)\r
-   ,fEventClass(0)\r
-   ,fMaxVertexZ(10)\r
-   ,fTrackPtCut(0)\r
-   ,fTrackEtaMin(0)\r
-   ,fTrackEtaMax(0)\r
-   ,fTrackPhiMin(0)\r
-   ,fTrackPhiMax(0)\r
-   ,fUseExtraTracks(0)\r
-   ,fUseExtraTracksBgr(0)\r
-   ,fCutFractionPtEmbedded(0)\r
-   ,fUseEmbeddedJetAxis(0)\r
-   ,fUseEmbeddedJetPt(0)\r
-   ,fJetPtCut(0)\r
-   ,fJetEtaMin(0)\r
-   ,fJetEtaMax(0)\r
-   ,fJetPhiMin(0)\r
-   ,fJetPhiMax(0)\r
-   ,fFFRadius(0)\r
-   ,fFFMinLTrackPt(-1)\r
-   ,fFFMaxTrackPt(-1)\r
-   ,fFFMinnTracks(0)\r
-   ,fFFBckgRadius(0)\r
-   ,fBckgMode(0)\r
-   ,fQAMode(0)\r
-   ,fFFMode(0)\r
-   ,fEffMode(0)\r
-   ,fJSMode(0)\r
-   ,fAvgTrials(0)\r
-   ,fTracksRecCuts(0)\r
-   ,fTracksGen(0)\r
-   ,fTracksAODMCCharged(0)\r
-   ,fTracksAODMCChargedSecNS(0)\r
-   ,fTracksAODMCChargedSecS(0)\r
-   ,fTracksRecQualityCuts(0)\r
-   ,fJetsRec(0)\r
-   ,fJetsRecCuts(0)\r
-   ,fJetsGen(0)\r
-   ,fJetsRecEff(0)\r
-   ,fJetsEmbedded(0)\r
-   ,fBckgJetsRec(0)\r
-   ,fBckgJetsRecCuts(0)\r
-   ,fBckgJetsGen(0)\r
-   ,fQATrackHistosRecCuts(0)\r
-   ,fQATrackHistosGen(0)\r
-   ,fQAJetHistosRec(0)\r
-   ,fQAJetHistosRecCuts(0)\r
-   ,fQAJetHistosRecCutsLeading(0)\r
-   ,fQAJetHistosGen(0)\r
-   ,fQAJetHistosGenLeading(0)\r
-   ,fQAJetHistosRecEffLeading(0)\r
-   ,fFFHistosRecCuts(0)\r
-   ,fFFHistosGen(0)\r
-   ,fQATrackHighPtThreshold(0)\r
-   ,fFFNBinsJetPt(0)    \r
-   ,fFFJetPtMin(0) \r
-   ,fFFJetPtMax(0)\r
-   ,fFFNBinsPt(0)      \r
-   ,fFFPtMin(0)        \r
-   ,fFFPtMax(0)        \r
-   ,fFFNBinsXi(0)      \r
-   ,fFFXiMin(0)        \r
-   ,fFFXiMax(0)        \r
-   ,fFFNBinsZ(0)       \r
-   ,fFFZMin(0)         \r
-   ,fFFZMax(0)\r
-   ,fQAJetNBinsPt(0)   \r
-   ,fQAJetPtMin(0)     \r
-   ,fQAJetPtMax(0)     \r
-   ,fQAJetNBinsEta(0)  \r
-   ,fQAJetEtaMin(0)    \r
-   ,fQAJetEtaMax(0)    \r
-   ,fQAJetNBinsPhi(0)  \r
-   ,fQAJetPhiMin(0)    \r
-   ,fQAJetPhiMax(0)    \r
-   ,fQATrackNBinsPt(0) \r
-   ,fQATrackPtMin(0)   \r
-   ,fQATrackPtMax(0)   \r
-   ,fQATrackNBinsEta(0)\r
-   ,fQATrackEtaMin(0)  \r
-   ,fQATrackEtaMax(0)  \r
-   ,fQATrackNBinsPhi(0)\r
-   ,fQATrackPhiMin(0)  \r
-   ,fQATrackPhiMax(0)\r
-   ,fCommonHistList(0)\r
-   ,fh1EvtSelection(0)\r
-   ,fh1VertexNContributors(0)\r
-   ,fh1VertexZ(0)\r
-   ,fh1EvtMult(0)\r
-   ,fh1EvtCent(0)\r
-   ,fh1Xsec(0)\r
-   ,fh1Trials(0)\r
-   ,fh1PtHard(0)\r
-   ,fh1PtHardTrials(0)\r
-   ,fh1nRecJetsCuts(0)\r
-   ,fh1nGenJets(0)\r
-   ,fh1nRecEffJets(0)\r
-   ,fh1nEmbeddedJets(0)\r
-   ,fh1nRecBckgJetsCuts(0)\r
-   ,fh1nGenBckgJets(0)\r
-   ,fh2PtRecVsGenPrim(0)\r
-   ,fh2PtRecVsGenSec(0)\r
-   ,fQATrackHistosRecEffGen(0)  \r
-   ,fQATrackHistosRecEffRec(0)\r
-   ,fQATrackHistosSecRecNS(0)   \r
-   ,fQATrackHistosSecRecS(0)   \r
-   ,fQATrackHistosSecRecSsc(0)   \r
-   ,fFFHistosRecEffRec(0)\r
-   ,fFFHistosSecRecNS(0)\r
-   ,fFFHistosSecRecS(0)\r
-   ,fFFHistosSecRecSsc(0)\r
-   // Background \r
-   ,fh1BckgMult0(0)\r
-   ,fh1BckgMult1(0)\r
-   ,fh1BckgMult2(0)\r
-   ,fh1BckgMult3(0)\r
-   ,fh1BckgMult4(0)\r
-   ,fh1FractionPtEmbedded(0)\r
-   ,fh1IndexEmbedded(0)\r
-   ,fh2DeltaPtVsJetPtEmbedded(0)\r
-   ,fh2DeltaPtVsRecJetPtEmbedded(0)\r
-   ,fh1DeltaREmbedded(0)\r
-   ,fQABckgHisto0RecCuts(0)  \r
-   ,fQABckgHisto0Gen(0)      \r
-   ,fQABckgHisto1RecCuts(0)  \r
-   ,fQABckgHisto1Gen(0)      \r
-   ,fQABckgHisto2RecCuts(0)  \r
-   ,fQABckgHisto2Gen(0)\r
-   ,fQABckgHisto3RecCuts(0)\r
-   ,fQABckgHisto3Gen(0)\r
-   ,fQABckgHisto4RecCuts(0)\r
-   ,fQABckgHisto4Gen(0)\r
-   ,fFFBckgHisto0RecCuts(0)\r
-   ,fFFBckgHisto0Gen(0)       \r
-   ,fFFBckgHisto1RecCuts(0)\r
-   ,fFFBckgHisto1Gen(0)       \r
-   ,fFFBckgHisto2RecCuts(0)\r
-   ,fFFBckgHisto2Gen(0)       \r
-   ,fFFBckgHisto3RecCuts(0)\r
-   ,fFFBckgHisto3Gen(0)       \r
-   ,fFFBckgHisto4RecCuts(0)\r
-   ,fFFBckgHisto4Gen(0)       \r
-   ,fFFBckgHisto0RecEffRec(0)\r
-   ,fFFBckgHisto0SecRecNS(0)  \r
-   ,fFFBckgHisto0SecRecS(0)   \r
-   ,fFFBckgHisto0SecRecSsc(0)\r
-    // jet shape   \r
-   ,fProNtracksLeadingJet(0)\r
-   ,fProDelR80pcPt(0)\r
-   ,fProNtracksLeadingJetGen(0)\r
-   ,fProDelR80pcPtGen(0)\r
-   ,fProNtracksLeadingJetBgrPerp2(0)\r
-   ,fProNtracksLeadingJetRecPrim(0)  \r
-   ,fProDelR80pcPtRecPrim(0)\r
-   ,fProNtracksLeadingJetRecSecNS(0) \r
-   ,fProNtracksLeadingJetRecSecS(0)  \r
-   ,fProNtracksLeadingJetRecSecSsc(0)\r
-\r
-   ,fRandom(0)\r
-{\r
-   // default constructor\r
-  fBckgType[0] = 0;\r
-  fBckgType[1] = 0;\r
-  fBckgType[2] = 0;\r
-  fBckgType[3] = 0;\r
-  fBckgType[4] = 0;\r
-\r
-  for(Int_t ii=0; ii<5; ii++){\r
-    fProDelRPtSum[ii]          = 0;\r
-    fProDelRPtSumGen[ii]       = 0;\r
-    fProDelRPtSumBgrPerp2[ii]  = 0;\r
-    fProDelRPtSumRecPrim[ii]   = 0;\r
-    fProDelRPtSumRecSecNS[ii]  = 0;\r
-    fProDelRPtSumRecSecS[ii]   = 0;\r
-    fProDelRPtSumRecSecSsc[ii] = 0;\r
-  }\r
-}\r
-\r
-//_______________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char *name) \r
-  : AliAnalysisTaskSE(name)\r
-  ,fESD(0)\r
-  ,fAOD(0)\r
-  ,fAODJets(0)  \r
-  ,fAODExtension(0)\r
-  ,fNonStdFile("")\r
-  ,fBranchRecJets("jets")\r
-  ,fBranchRecBckgClusters("")\r
-  ,fBranchGenJets("")\r
-  ,fBranchEmbeddedJets("")\r
-  ,fTrackTypeGen(0)\r
-  ,fJetTypeGen(0)\r
-  ,fJetTypeRecEff(0)\r
-  ,fUseAODInputJets(kTRUE)\r
-  ,fFilterMask(0)\r
-  ,fUsePhysicsSelection(kTRUE)\r
-  ,fEvtSelectionMask(0)\r
-  ,fEventClass(0)\r
-  ,fMaxVertexZ(10)\r
-  ,fTrackPtCut(0)\r
-  ,fTrackEtaMin(0)\r
-  ,fTrackEtaMax(0)\r
-  ,fTrackPhiMin(0)\r
-  ,fTrackPhiMax(0)\r
-  ,fUseExtraTracks(0)\r
-  ,fUseExtraTracksBgr(0)\r
-  ,fCutFractionPtEmbedded(0)\r
-  ,fUseEmbeddedJetAxis(0)\r
-  ,fUseEmbeddedJetPt(0)  \r
-  ,fJetPtCut(0)\r
-  ,fJetEtaMin(0)\r
-  ,fJetEtaMax(0)\r
-  ,fJetPhiMin(0)\r
-  ,fJetPhiMax(0)\r
-  ,fFFRadius(0)\r
-  ,fFFMinLTrackPt(-1)\r
-  ,fFFMaxTrackPt(-1)\r
-  ,fFFMinnTracks(0)\r
-  ,fFFBckgRadius(0)\r
-  ,fBckgMode(0)\r
-  ,fQAMode(0)\r
-  ,fFFMode(0)\r
-  ,fEffMode(0)\r
-  ,fJSMode(0)\r
-  ,fAvgTrials(0)\r
-  ,fTracksRecCuts(0)\r
-  ,fTracksGen(0)\r
-  ,fTracksAODMCCharged(0)\r
-  ,fTracksAODMCChargedSecNS(0)\r
-  ,fTracksAODMCChargedSecS(0)\r
-  ,fTracksRecQualityCuts(0)\r
-  ,fJetsRec(0)\r
-  ,fJetsRecCuts(0)\r
-  ,fJetsGen(0)\r
-  ,fJetsRecEff(0)\r
-  ,fJetsEmbedded(0)\r
-  ,fBckgJetsRec(0)\r
-  ,fBckgJetsRecCuts(0)\r
-  ,fBckgJetsGen(0)\r
-  ,fQATrackHistosRecCuts(0)\r
-  ,fQATrackHistosGen(0)\r
-  ,fQAJetHistosRec(0)\r
-  ,fQAJetHistosRecCuts(0)\r
-  ,fQAJetHistosRecCutsLeading(0)\r
-  ,fQAJetHistosGen(0)\r
-  ,fQAJetHistosGenLeading(0)\r
-  ,fQAJetHistosRecEffLeading(0)\r
-  ,fFFHistosRecCuts(0)\r
-  ,fFFHistosGen(0)\r
-  ,fQATrackHighPtThreshold(0) \r
-  ,fFFNBinsJetPt(0)    \r
-  ,fFFJetPtMin(0) \r
-  ,fFFJetPtMax(0)\r
-  ,fFFNBinsPt(0)      \r
-  ,fFFPtMin(0)        \r
-  ,fFFPtMax(0)        \r
-  ,fFFNBinsXi(0)      \r
-  ,fFFXiMin(0)        \r
-  ,fFFXiMax(0)        \r
-  ,fFFNBinsZ(0)       \r
-  ,fFFZMin(0)         \r
-  ,fFFZMax(0)         \r
-  ,fQAJetNBinsPt(0)   \r
-  ,fQAJetPtMin(0)     \r
-  ,fQAJetPtMax(0)     \r
-  ,fQAJetNBinsEta(0)  \r
-  ,fQAJetEtaMin(0)    \r
-  ,fQAJetEtaMax(0)    \r
-  ,fQAJetNBinsPhi(0)  \r
-  ,fQAJetPhiMin(0)    \r
-  ,fQAJetPhiMax(0)    \r
-  ,fQATrackNBinsPt(0) \r
-  ,fQATrackPtMin(0)   \r
-  ,fQATrackPtMax(0)   \r
-  ,fQATrackNBinsEta(0)\r
-  ,fQATrackEtaMin(0)  \r
-  ,fQATrackEtaMax(0)  \r
-  ,fQATrackNBinsPhi(0)\r
-  ,fQATrackPhiMin(0)  \r
-  ,fQATrackPhiMax(0)  \r
-  ,fCommonHistList(0)\r
-  ,fh1EvtSelection(0)\r
-  ,fh1VertexNContributors(0)\r
-  ,fh1VertexZ(0)\r
-  ,fh1EvtMult(0)\r
-  ,fh1EvtCent(0)\r
-  ,fh1Xsec(0)\r
-  ,fh1Trials(0)\r
-  ,fh1PtHard(0)\r
-  ,fh1PtHardTrials(0)\r
-  ,fh1nRecJetsCuts(0)\r
-  ,fh1nGenJets(0)\r
-  ,fh1nRecEffJets(0)\r
-  ,fh1nEmbeddedJets(0)\r
-  ,fh1nRecBckgJetsCuts(0)\r
-  ,fh1nGenBckgJets(0)\r
-  ,fh2PtRecVsGenPrim(0)\r
-  ,fh2PtRecVsGenSec(0)\r
-  ,fQATrackHistosRecEffGen(0)  \r
-  ,fQATrackHistosRecEffRec(0)\r
-  ,fQATrackHistosSecRecNS(0) \r
-  ,fQATrackHistosSecRecS(0) \r
-  ,fQATrackHistosSecRecSsc(0) \r
-  ,fFFHistosRecEffRec(0)\r
-  ,fFFHistosSecRecNS(0)\r
-  ,fFFHistosSecRecS(0)\r
-  ,fFFHistosSecRecSsc(0)\r
-  // Background\r
-  ,fh1BckgMult0(0)\r
-  ,fh1BckgMult1(0)\r
-  ,fh1BckgMult2(0)\r
-  ,fh1BckgMult3(0)\r
-  ,fh1BckgMult4(0)\r
-  ,fh1FractionPtEmbedded(0)\r
-  ,fh1IndexEmbedded(0)\r
-  ,fh2DeltaPtVsJetPtEmbedded(0)\r
-  ,fh2DeltaPtVsRecJetPtEmbedded(0)\r
-  ,fh1DeltaREmbedded(0)\r
-  ,fQABckgHisto0RecCuts(0)  \r
-  ,fQABckgHisto0Gen(0)      \r
-  ,fQABckgHisto1RecCuts(0)  \r
-  ,fQABckgHisto1Gen(0)      \r
-  ,fQABckgHisto2RecCuts(0)  \r
-  ,fQABckgHisto2Gen(0) \r
-  ,fQABckgHisto3RecCuts(0)  \r
-  ,fQABckgHisto3Gen(0)\r
-  ,fQABckgHisto4RecCuts(0)  \r
-  ,fQABckgHisto4Gen(0)\r
-  ,fFFBckgHisto0RecCuts(0)\r
-  ,fFFBckgHisto0Gen(0)       \r
-  ,fFFBckgHisto1RecCuts(0)\r
-  ,fFFBckgHisto1Gen(0)       \r
-  ,fFFBckgHisto2RecCuts(0)\r
-  ,fFFBckgHisto2Gen(0)       \r
-  ,fFFBckgHisto3RecCuts(0)\r
-  ,fFFBckgHisto3Gen(0)       \r
-  ,fFFBckgHisto4RecCuts(0)\r
-  ,fFFBckgHisto4Gen(0)       \r
-  ,fFFBckgHisto0RecEffRec(0)\r
-  ,fFFBckgHisto0SecRecNS(0)  \r
-  ,fFFBckgHisto0SecRecS(0)   \r
-  ,fFFBckgHisto0SecRecSsc(0) \r
-  // jet shape   \r
-  ,fProNtracksLeadingJet(0)\r
-  ,fProDelR80pcPt(0)\r
-  ,fProNtracksLeadingJetGen(0)\r
-  ,fProDelR80pcPtGen(0)\r
-  ,fProNtracksLeadingJetBgrPerp2(0)\r
-  ,fProNtracksLeadingJetRecPrim(0)\r
-  ,fProDelR80pcPtRecPrim(0)\r
-  ,fProNtracksLeadingJetRecSecNS(0) \r
-  ,fProNtracksLeadingJetRecSecS(0)  \r
-  ,fProNtracksLeadingJetRecSecSsc(0)\r
-  ,fRandom(0)\r
-{\r
-  // constructor\r
-  fBckgType[0] = 0;\r
-  fBckgType[1] = 0;\r
-  fBckgType[2] = 0;\r
-  fBckgType[3] = 0;\r
-  fBckgType[4] = 0;\r
\r
-  for(Int_t ii=0; ii<5; ii++){\r
-    fProDelRPtSum[ii]          = 0;\r
-    fProDelRPtSumGen[ii]       = 0;\r
-    fProDelRPtSumBgrPerp2[ii]  = 0;\r
-    fProDelRPtSumRecPrim[ii]   = 0;\r
-    fProDelRPtSumRecSecNS[ii]  = 0;\r
-    fProDelRPtSumRecSecS[ii]   = 0;\r
-    fProDelRPtSumRecSecSsc[ii] = 0;\r
-  }\r
-  \r
-  DefineOutput(1,TList::Class());\r
-}\r
-\r
-//__________________________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const  AliAnalysisTaskFragmentationFunction &copy)\r
-  : AliAnalysisTaskSE()\r
-  ,fESD(copy.fESD)\r
-  ,fAOD(copy.fAOD)\r
-  ,fAODJets(copy.fAODJets)  \r
-  ,fAODExtension(copy.fAODExtension)\r
-  ,fNonStdFile(copy.fNonStdFile)\r
-  ,fBranchRecJets(copy.fBranchRecJets)\r
-  ,fBranchRecBckgClusters(copy.fBranchRecBckgClusters)\r
-  ,fBranchGenJets(copy.fBranchGenJets)\r
-  ,fBranchEmbeddedJets(copy.fBranchEmbeddedJets)\r
-  ,fTrackTypeGen(copy.fTrackTypeGen)\r
-  ,fJetTypeGen(copy.fJetTypeGen)\r
-  ,fJetTypeRecEff(copy.fJetTypeRecEff)\r
-  ,fUseAODInputJets(copy.fUseAODInputJets)\r
-  ,fFilterMask(copy.fFilterMask)\r
-  ,fUsePhysicsSelection(copy.fUsePhysicsSelection)\r
-  ,fEvtSelectionMask(copy.fEvtSelectionMask)\r
-  ,fEventClass(copy.fEventClass)\r
-  ,fMaxVertexZ(copy.fMaxVertexZ)\r
-  ,fTrackPtCut(copy.fTrackPtCut)\r
-  ,fTrackEtaMin(copy.fTrackEtaMin)\r
-  ,fTrackEtaMax(copy.fTrackEtaMax)\r
-  ,fTrackPhiMin(copy.fTrackPhiMin)\r
-  ,fTrackPhiMax(copy.fTrackPhiMax)\r
-  ,fUseExtraTracks(copy.fUseExtraTracks)\r
-  ,fUseExtraTracksBgr(copy.fUseExtraTracksBgr)\r
-  ,fCutFractionPtEmbedded(copy.fCutFractionPtEmbedded)\r
-  ,fUseEmbeddedJetAxis(copy.fUseEmbeddedJetAxis)\r
-  ,fUseEmbeddedJetPt(copy.fUseEmbeddedJetPt)\r
-  ,fJetPtCut(copy.fJetPtCut)\r
-  ,fJetEtaMin(copy.fJetEtaMin)\r
-  ,fJetEtaMax(copy.fJetEtaMax)\r
-  ,fJetPhiMin(copy.fJetPhiMin)\r
-  ,fJetPhiMax(copy.fJetPhiMax)\r
-  ,fFFRadius(copy.fFFRadius)\r
-  ,fFFMinLTrackPt(copy.fFFMinLTrackPt)\r
-  ,fFFMaxTrackPt(copy.fFFMaxTrackPt)\r
-  ,fFFMinnTracks(copy.fFFMinnTracks)\r
-  ,fFFBckgRadius(copy.fFFBckgRadius)\r
-  ,fBckgMode(copy.fBckgMode)\r
-  ,fQAMode(copy.fQAMode)\r
-  ,fFFMode(copy.fFFMode)\r
-  ,fEffMode(copy.fEffMode)\r
-  ,fJSMode(copy.fJSMode)\r
-  ,fAvgTrials(copy.fAvgTrials)\r
-  ,fTracksRecCuts(copy.fTracksRecCuts)\r
-  ,fTracksGen(copy.fTracksGen)\r
-  ,fTracksAODMCCharged(copy.fTracksAODMCCharged)\r
-  ,fTracksAODMCChargedSecNS(copy.fTracksAODMCChargedSecNS)\r
-  ,fTracksAODMCChargedSecS(copy.fTracksAODMCChargedSecS)\r
-  ,fTracksRecQualityCuts(copy.fTracksRecQualityCuts)\r
-  ,fJetsRec(copy.fJetsRec)\r
-  ,fJetsRecCuts(copy.fJetsRecCuts)\r
-  ,fJetsGen(copy.fJetsGen)\r
-  ,fJetsRecEff(copy.fJetsRecEff)\r
-  ,fJetsEmbedded(copy.fJetsEmbedded)\r
-  ,fBckgJetsRec(copy.fBckgJetsRec)\r
-  ,fBckgJetsRecCuts(copy.fBckgJetsRecCuts)\r
-  ,fBckgJetsGen(copy.fBckgJetsGen)\r
-  ,fQATrackHistosRecCuts(copy.fQATrackHistosRecCuts)\r
-  ,fQATrackHistosGen(copy.fQATrackHistosGen)\r
-  ,fQAJetHistosRec(copy.fQAJetHistosRec)\r
-  ,fQAJetHistosRecCuts(copy.fQAJetHistosRecCuts)\r
-  ,fQAJetHistosRecCutsLeading(copy.fQAJetHistosRecCutsLeading)\r
-  ,fQAJetHistosGen(copy.fQAJetHistosGen)\r
-  ,fQAJetHistosGenLeading(copy.fQAJetHistosGenLeading)\r
-  ,fQAJetHistosRecEffLeading(copy.fQAJetHistosRecEffLeading)\r
-  ,fFFHistosRecCuts(copy.fFFHistosRecCuts)\r
-  ,fFFHistosGen(copy.fFFHistosGen)\r
-  ,fQATrackHighPtThreshold(copy.fQATrackHighPtThreshold) \r
-  ,fFFNBinsJetPt(copy.fFFNBinsJetPt)    \r
-  ,fFFJetPtMin(copy.fFFJetPtMin) \r
-  ,fFFJetPtMax(copy.fFFJetPtMax)\r
-  ,fFFNBinsPt(copy.fFFNBinsPt)      \r
-  ,fFFPtMin(copy.fFFPtMin)        \r
-  ,fFFPtMax(copy.fFFPtMax)        \r
-  ,fFFNBinsXi(copy.fFFNBinsXi)      \r
-  ,fFFXiMin(copy.fFFXiMin)        \r
-  ,fFFXiMax(copy.fFFXiMax)        \r
-  ,fFFNBinsZ(copy.fFFNBinsZ)       \r
-  ,fFFZMin(copy.fFFZMin)         \r
-  ,fFFZMax(copy.fFFZMax)         \r
-  ,fQAJetNBinsPt(copy.fQAJetNBinsPt)   \r
-  ,fQAJetPtMin(copy.fQAJetPtMin)     \r
-  ,fQAJetPtMax(copy.fQAJetPtMax)     \r
-  ,fQAJetNBinsEta(copy.fQAJetNBinsEta)  \r
-  ,fQAJetEtaMin(copy.fQAJetEtaMin)    \r
-  ,fQAJetEtaMax(copy.fQAJetEtaMax)    \r
-  ,fQAJetNBinsPhi(copy.fQAJetNBinsPhi)  \r
-  ,fQAJetPhiMin(copy.fQAJetPhiMin)    \r
-  ,fQAJetPhiMax(copy.fQAJetPhiMax)    \r
-  ,fQATrackNBinsPt(copy.fQATrackNBinsPt) \r
-  ,fQATrackPtMin(copy.fQATrackPtMin)   \r
-  ,fQATrackPtMax(copy.fQATrackPtMax)   \r
-  ,fQATrackNBinsEta(copy.fQATrackNBinsEta)\r
-  ,fQATrackEtaMin(copy.fQATrackEtaMin)  \r
-  ,fQATrackEtaMax(copy.fQATrackEtaMax)  \r
-  ,fQATrackNBinsPhi(copy.fQATrackNBinsPhi)\r
-  ,fQATrackPhiMin(copy.fQATrackPhiMin)  \r
-  ,fQATrackPhiMax(copy.fQATrackPhiMax)\r
-  ,fCommonHistList(copy.fCommonHistList)\r
-  ,fh1EvtSelection(copy.fh1EvtSelection)\r
-  ,fh1VertexNContributors(copy.fh1VertexNContributors)\r
-  ,fh1VertexZ(copy.fh1VertexZ)\r
-  ,fh1EvtMult(copy.fh1EvtMult)\r
-  ,fh1EvtCent(copy.fh1EvtCent)\r
-  ,fh1Xsec(copy.fh1Xsec)\r
-  ,fh1Trials(copy.fh1Trials)\r
-  ,fh1PtHard(copy.fh1PtHard)  \r
-  ,fh1PtHardTrials(copy.fh1PtHardTrials)  \r
-  ,fh1nRecJetsCuts(copy.fh1nRecJetsCuts)\r
-  ,fh1nGenJets(copy.fh1nGenJets)\r
-  ,fh1nRecEffJets(copy.fh1nRecEffJets)\r
-  ,fh1nEmbeddedJets(copy.fh1nEmbeddedJets)\r
-  ,fh1nRecBckgJetsCuts(copy.fh1nRecBckgJetsCuts)\r
-  ,fh1nGenBckgJets(copy.fh1nGenBckgJets)\r
-  ,fh2PtRecVsGenPrim(copy.fh2PtRecVsGenPrim)\r
-  ,fh2PtRecVsGenSec(copy.fh2PtRecVsGenSec)\r
-  ,fQATrackHistosRecEffGen(copy.fQATrackHistosRecEffGen)  \r
-  ,fQATrackHistosRecEffRec(copy.fQATrackHistosRecEffRec)  \r
-  ,fQATrackHistosSecRecNS(copy.fQATrackHistosSecRecNS)  \r
-  ,fQATrackHistosSecRecS(copy.fQATrackHistosSecRecS)  \r
-  ,fQATrackHistosSecRecSsc(copy.fQATrackHistosSecRecSsc)  \r
-  ,fFFHistosRecEffRec(copy.fFFHistosRecEffRec)  \r
-  ,fFFHistosSecRecNS(copy.fFFHistosSecRecNS)   \r
-  ,fFFHistosSecRecS(copy.fFFHistosSecRecS)   \r
-  ,fFFHistosSecRecSsc(copy.fFFHistosSecRecSsc)   \r
-  // Background\r
-  ,fh1BckgMult0(copy.fh1BckgMult0)\r
-  ,fh1BckgMult1(copy.fh1BckgMult1)\r
-  ,fh1BckgMult2(copy.fh1BckgMult2)\r
-  ,fh1BckgMult3(copy.fh1BckgMult3)\r
-  ,fh1BckgMult4(copy.fh1BckgMult4)\r
-  ,fh1FractionPtEmbedded(copy.fh1FractionPtEmbedded)\r
-  ,fh1IndexEmbedded(copy.fh1IndexEmbedded)\r
-  ,fh2DeltaPtVsJetPtEmbedded(copy.fh2DeltaPtVsJetPtEmbedded)\r
-  ,fh2DeltaPtVsRecJetPtEmbedded(copy.fh2DeltaPtVsRecJetPtEmbedded)\r
-  ,fh1DeltaREmbedded(copy.fh1DeltaREmbedded)\r
-  ,fQABckgHisto0RecCuts(copy.fQABckgHisto0RecCuts)  \r
-  ,fQABckgHisto0Gen(copy.fQABckgHisto0Gen)      \r
-  ,fQABckgHisto1RecCuts(copy.fQABckgHisto1RecCuts)  \r
-  ,fQABckgHisto1Gen(copy.fQABckgHisto1Gen)      \r
-  ,fQABckgHisto2RecCuts(copy.fQABckgHisto2RecCuts)  \r
-  ,fQABckgHisto2Gen(copy.fQABckgHisto2Gen)\r
-  ,fQABckgHisto3RecCuts(copy.fQABckgHisto3RecCuts)  \r
-  ,fQABckgHisto3Gen(copy.fQABckgHisto3Gen)     \r
-  ,fQABckgHisto4RecCuts(copy.fQABckgHisto4RecCuts)  \r
-  ,fQABckgHisto4Gen(copy.fQABckgHisto4Gen)     \r
-  ,fFFBckgHisto0RecCuts(copy.fFFBckgHisto0RecCuts)\r
-  ,fFFBckgHisto0Gen(copy.fFFBckgHisto0Gen)       \r
-  ,fFFBckgHisto1RecCuts(copy.fFFBckgHisto1RecCuts)\r
-  ,fFFBckgHisto1Gen(copy.fFFBckgHisto1Gen)       \r
-  ,fFFBckgHisto2RecCuts(copy.fFFBckgHisto2RecCuts)\r
-  ,fFFBckgHisto2Gen(copy.fFFBckgHisto2Gen)       \r
-  ,fFFBckgHisto3RecCuts(copy.fFFBckgHisto3RecCuts)\r
-  ,fFFBckgHisto3Gen(copy.fFFBckgHisto3Gen)       \r
-  ,fFFBckgHisto4RecCuts(copy.fFFBckgHisto4RecCuts)\r
-  ,fFFBckgHisto4Gen(copy.fFFBckgHisto4Gen)       \r
-  ,fFFBckgHisto0RecEffRec(copy.fFFBckgHisto0RecEffRec)\r
-  ,fFFBckgHisto0SecRecNS(copy.fFFBckgHisto0SecRecNS)  \r
-  ,fFFBckgHisto0SecRecS(copy.fFFBckgHisto0SecRecS)   \r
-  ,fFFBckgHisto0SecRecSsc(copy.fFFBckgHisto0SecRecSsc) \r
-  // jet shape   \r
-  ,fProNtracksLeadingJet(copy.fProNtracksLeadingJet)                \r
-  ,fProDelR80pcPt(copy.fProDelR80pcPt)                       \r
-  ,fProNtracksLeadingJetGen(copy.fProNtracksLeadingJetGen)             \r
-  ,fProDelR80pcPtGen(copy.fProDelR80pcPtGen)                    \r
-  ,fProNtracksLeadingJetBgrPerp2(copy.fProNtracksLeadingJetBgrPerp2)        \r
-  ,fProNtracksLeadingJetRecPrim(copy.fProNtracksLeadingJetRecPrim)  \r
-  ,fProDelR80pcPtRecPrim(copy.fProDelR80pcPtRecPrim)\r
-  ,fProNtracksLeadingJetRecSecNS(copy.fProNtracksLeadingJetRecSecNS) \r
-  ,fProNtracksLeadingJetRecSecS(copy.fProNtracksLeadingJetRecSecS)  \r
-  ,fProNtracksLeadingJetRecSecSsc(copy.fProNtracksLeadingJetRecSecSsc)\r
-  ,fRandom(copy.fRandom)\r
-{\r
-  // copy constructor\r
-  fBckgType[0] = copy.fBckgType[0];\r
-  fBckgType[1] = copy.fBckgType[1];\r
-  fBckgType[2] = copy.fBckgType[2];\r
-  fBckgType[3] = copy.fBckgType[3];\r
-  fBckgType[4] = copy.fBckgType[4];\r
-\r
-\r
-  for(Int_t ii=0; ii<5; ii++){\r
-    fProDelRPtSum[ii]          = copy.fProDelRPtSum[ii];\r
-    fProDelRPtSumGen[ii]       = copy.fProDelRPtSumGen[ii];\r
-    fProDelRPtSumBgrPerp2[ii]  = copy.fProDelRPtSumBgrPerp2[ii];\r
-    fProDelRPtSumRecPrim[ii]   = copy.fProDelRPtSumRecPrim[ii];\r
-    fProDelRPtSumRecSecNS[ii]  = copy.fProDelRPtSumRecSecNS[ii];\r
-    fProDelRPtSumRecSecS[ii]   = copy.fProDelRPtSumRecSecS[ii];\r
-    fProDelRPtSumRecSecSsc[ii] = copy.fProDelRPtSumRecSecSsc[ii];\r
-  }\r
-}\r
-\r
-// _________________________________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::operator=(const AliAnalysisTaskFragmentationFunction& o)\r
-{\r
-  // assignment\r
-  \r
-  if(this!=&o){\r
-\r
-    AliAnalysisTaskSE::operator=(o);\r
-    fESD                           = o.fESD;\r
-    fAOD                           = o.fAOD;\r
-    fAODJets                       = o.fAODJets;  \r
-    fAODExtension                  = o.fAODExtension;\r
-    fNonStdFile                    = o.fNonStdFile;\r
-    fBranchRecJets                 = o.fBranchRecJets;\r
-    fBranchRecBckgClusters         = o.fBranchRecBckgClusters;\r
-    fBranchGenJets                 = o.fBranchGenJets;\r
-    fBranchEmbeddedJets            = o.fBranchEmbeddedJets;\r
-    fTrackTypeGen                  = o.fTrackTypeGen;\r
-    fJetTypeGen                    = o.fJetTypeGen;\r
-    fJetTypeRecEff                 = o.fJetTypeRecEff;\r
-    fUseAODInputJets               = o.fUseAODInputJets;\r
-    fFilterMask                    = o.fFilterMask;\r
-    fUsePhysicsSelection           = o.fUsePhysicsSelection;\r
-    fEvtSelectionMask              = o.fEvtSelectionMask;\r
-    fEventClass                    = o.fEventClass;\r
-    fMaxVertexZ                    = o.fMaxVertexZ;\r
-    fTrackPtCut                    = o.fTrackPtCut;\r
-    fTrackEtaMin                   = o.fTrackEtaMin;\r
-    fTrackEtaMax                   = o.fTrackEtaMax;\r
-    fTrackPhiMin                   = o.fTrackPhiMin;\r
-    fTrackPhiMax                   = o.fTrackPhiMax;\r
-    fUseExtraTracks                = o.fUseExtraTracks;\r
-    fUseExtraTracksBgr             = o.fUseExtraTracksBgr;\r
-    fCutFractionPtEmbedded         = o.fCutFractionPtEmbedded;\r
-    fUseEmbeddedJetAxis            = o.fUseEmbeddedJetAxis;\r
-    fUseEmbeddedJetPt              = o.fUseEmbeddedJetPt;\r
-    fJetPtCut                      = o.fJetPtCut;\r
-    fJetEtaMin                     = o.fJetEtaMin;\r
-    fJetEtaMax                     = o.fJetEtaMax;\r
-    fJetPhiMin                     = o.fJetPhiMin;\r
-    fJetPhiMax                     = o.fJetPhiMin;\r
-    fFFRadius                      = o.fFFRadius;\r
-    fFFMinLTrackPt                 = o.fFFMinLTrackPt;\r
-    fFFMaxTrackPt                  = o.fFFMaxTrackPt;\r
-    fFFMinnTracks                  = o.fFFMinnTracks;\r
-    fFFBckgRadius                  = o.fFFBckgRadius;\r
-    fBckgMode                      = o.fBckgMode;\r
-    fQAMode                        = o.fQAMode;\r
-    fFFMode                        = o.fFFMode;\r
-    fEffMode                       = o.fEffMode;\r
-    fJSMode                        = o.fJSMode;\r
-    fBckgType[0]                   = o.fBckgType[0];\r
-    fBckgType[1]                   = o.fBckgType[1];\r
-    fBckgType[2]                   = o.fBckgType[2];\r
-    fBckgType[3]                   = o.fBckgType[3];\r
-    fBckgType[4]                   = o.fBckgType[4];\r
-    fAvgTrials                     = o.fAvgTrials;\r
-    fTracksRecCuts                 = o.fTracksRecCuts;\r
-    fTracksGen                     = o.fTracksGen;\r
-    fTracksAODMCCharged            = o.fTracksAODMCCharged;\r
-    fTracksAODMCChargedSecNS       = o.fTracksAODMCChargedSecNS;\r
-    fTracksAODMCChargedSecS        = o.fTracksAODMCChargedSecS;\r
-    fTracksRecQualityCuts          = o.fTracksRecQualityCuts;\r
-    fJetsRec                       = o.fJetsRec;\r
-    fJetsRecCuts                   = o.fJetsRecCuts;\r
-    fJetsGen                       = o.fJetsGen;\r
-    fJetsRecEff                    = o.fJetsRecEff;\r
-    fJetsEmbedded                  = o.fJetsEmbedded;\r
-    fBckgJetsRec                   = o.fBckgJetsRec;\r
-    fBckgJetsRecCuts               = o.fBckgJetsRecCuts;\r
-    fBckgJetsGen                   = o.fBckgJetsGen;\r
-    fQATrackHistosRecCuts          = o.fQATrackHistosRecCuts;\r
-    fQATrackHistosGen              = o.fQATrackHistosGen;\r
-    fQAJetHistosRec                = o.fQAJetHistosRec;\r
-    fQAJetHistosRecCuts            = o.fQAJetHistosRecCuts;\r
-    fQAJetHistosRecCutsLeading     = o.fQAJetHistosRecCutsLeading;\r
-    fQAJetHistosGen                = o.fQAJetHistosGen;\r
-    fQAJetHistosGenLeading         = o.fQAJetHistosGenLeading;\r
-    fQAJetHistosRecEffLeading      = o.fQAJetHistosRecEffLeading;\r
-    fFFHistosRecCuts               = o.fFFHistosRecCuts;\r
-    fFFHistosGen                   = o.fFFHistosGen;\r
-    fQATrackHighPtThreshold        = o.fQATrackHighPtThreshold; \r
-    fFFNBinsJetPt                  = o.fFFNBinsJetPt;    \r
-    fFFJetPtMin                    = o.fFFJetPtMin; \r
-    fFFJetPtMax                    = o.fFFJetPtMax;\r
-    fFFNBinsPt                     = o.fFFNBinsPt;      \r
-    fFFPtMin                       = o.fFFPtMin;        \r
-    fFFPtMax                       = o.fFFPtMax;        \r
-    fFFNBinsXi                     = o.fFFNBinsXi;      \r
-    fFFXiMin                       = o.fFFXiMin;        \r
-    fFFXiMax                       = o.fFFXiMax;        \r
-    fFFNBinsZ                      = o.fFFNBinsZ;       \r
-    fFFZMin                        = o.fFFZMin;         \r
-    fFFZMax                        = o.fFFZMax;         \r
-    fQAJetNBinsPt                  = o.fQAJetNBinsPt;   \r
-    fQAJetPtMin                    = o.fQAJetPtMin;     \r
-    fQAJetPtMax                    = o.fQAJetPtMax;     \r
-    fQAJetNBinsEta                 = o.fQAJetNBinsEta;  \r
-    fQAJetEtaMin                   = o.fQAJetEtaMin;    \r
-    fQAJetEtaMax                   = o.fQAJetEtaMax;    \r
-    fQAJetNBinsPhi                 = o.fQAJetNBinsPhi;  \r
-    fQAJetPhiMin                   = o.fQAJetPhiMin;    \r
-    fQAJetPhiMax                   = o.fQAJetPhiMax;    \r
-    fQATrackNBinsPt                = o.fQATrackNBinsPt; \r
-    fQATrackPtMin                  = o.fQATrackPtMin;   \r
-    fQATrackPtMax                  = o.fQATrackPtMax;   \r
-    fQATrackNBinsEta               = o.fQATrackNBinsEta;\r
-    fQATrackEtaMin                 = o.fQATrackEtaMin;  \r
-    fQATrackEtaMax                 = o.fQATrackEtaMax;  \r
-    fQATrackNBinsPhi               = o.fQATrackNBinsPhi;\r
-    fQATrackPhiMin                 = o.fQATrackPhiMin;  \r
-    fQATrackPhiMax                 = o.fQATrackPhiMax;  \r
-    fCommonHistList                = o.fCommonHistList;\r
-    fh1EvtSelection                = o.fh1EvtSelection;\r
-    fh1VertexNContributors         = o.fh1VertexNContributors;\r
-    fh1VertexZ                     = o.fh1VertexZ;\r
-    fh1EvtMult                     = o.fh1EvtMult;\r
-    fh1EvtCent                     = o.fh1EvtCent;\r
-    fh1Xsec                        = o.fh1Xsec;\r
-    fh1Trials                      = o.fh1Trials;\r
-    fh1PtHard                      = o.fh1PtHard;\r
-    fh1PtHardTrials                = o.fh1PtHardTrials;\r
-    fh1nRecJetsCuts                = o.fh1nRecJetsCuts;\r
-    fh1nGenJets                    = o.fh1nGenJets; \r
-    fh1nRecEffJets                 = o.fh1nRecEffJets;\r
-    fh1nEmbeddedJets               = o.fh1nEmbeddedJets;\r
-    fh2PtRecVsGenPrim              = o.fh2PtRecVsGenPrim;\r
-    fh2PtRecVsGenSec               = o.fh2PtRecVsGenSec; \r
-    fQATrackHistosRecEffGen        = o.fQATrackHistosRecEffGen;  \r
-    fQATrackHistosRecEffRec        = o.fQATrackHistosRecEffRec;  \r
-    fQATrackHistosSecRecNS         = o.fQATrackHistosSecRecNS;  \r
-    fQATrackHistosSecRecS          = o.fQATrackHistosSecRecS;  \r
-    fQATrackHistosSecRecSsc        = o.fQATrackHistosSecRecSsc;  \r
-    fFFHistosRecEffRec             = o.fFFHistosRecEffRec;  \r
-    fFFHistosSecRecNS              = o.fFFHistosSecRecNS;   \r
-    fFFHistosSecRecS               = o.fFFHistosSecRecS;   \r
-    fFFHistosSecRecSsc             = o.fFFHistosSecRecSsc;   \r
-    // Background\r
-    fh1BckgMult0                   = o.fh1BckgMult0;\r
-    fh1BckgMult1                   = o.fh1BckgMult1;\r
-    fh1BckgMult2                   = o.fh1BckgMult2;\r
-    fh1BckgMult3                   = o.fh1BckgMult3;\r
-    fh1BckgMult4                   = o.fh1BckgMult4;\r
-    fh1FractionPtEmbedded          = o.fh1FractionPtEmbedded;\r
-    fh1IndexEmbedded               = o.fh1IndexEmbedded;\r
-    fh2DeltaPtVsJetPtEmbedded      = o.fh2DeltaPtVsJetPtEmbedded;\r
-    fh2DeltaPtVsRecJetPtEmbedded   = o.fh2DeltaPtVsRecJetPtEmbedded;\r
-    fh1DeltaREmbedded              = o.fh1DeltaREmbedded;\r
-    fQABckgHisto0RecCuts           = o.fQABckgHisto0RecCuts;  \r
-    fQABckgHisto0Gen               = o.fQABckgHisto0Gen;      \r
-    fQABckgHisto1RecCuts           = o.fQABckgHisto1RecCuts;  \r
-    fQABckgHisto1Gen               = o.fQABckgHisto1Gen;      \r
-    fQABckgHisto2RecCuts           = o.fQABckgHisto2RecCuts;  \r
-    fQABckgHisto2Gen               = o.fQABckgHisto2Gen;  \r
-    fQABckgHisto3RecCuts           = o.fQABckgHisto3RecCuts;  \r
-    fQABckgHisto3Gen               = o.fQABckgHisto3Gen;  \r
-    fQABckgHisto4RecCuts           = o.fQABckgHisto4RecCuts;  \r
-    fQABckgHisto4Gen               = o.fQABckgHisto4Gen;  \r
-    fFFBckgHisto0RecCuts           = o.fFFBckgHisto0RecCuts;\r
-    fFFBckgHisto0Gen               = o.fFFBckgHisto0Gen;       \r
-    fFFBckgHisto1RecCuts           = o.fFFBckgHisto1RecCuts;\r
-    fFFBckgHisto1Gen               = o.fFFBckgHisto1Gen;       \r
-    fFFBckgHisto2RecCuts           = o.fFFBckgHisto2RecCuts;\r
-    fFFBckgHisto2Gen               = o.fFFBckgHisto2Gen;       \r
-    fFFBckgHisto3RecCuts           = o.fFFBckgHisto3RecCuts;\r
-    fFFBckgHisto3Gen               = o.fFFBckgHisto3Gen;       \r
-    fFFBckgHisto4RecCuts           = o.fFFBckgHisto4RecCuts;\r
-    fFFBckgHisto4Gen               = o.fFFBckgHisto4Gen;       \r
-    fFFBckgHisto0RecEffRec         = o.fFFBckgHisto0RecEffRec;\r
-    fFFBckgHisto0SecRecNS          = o.fFFBckgHisto0SecRecNS;  \r
-    fFFBckgHisto0SecRecS           = o.fFFBckgHisto0SecRecS;  \r
-    fFFBckgHisto0SecRecSsc         = o.fFFBckgHisto0SecRecSsc; \r
-    fProNtracksLeadingJet          = o.fProNtracksLeadingJet;\r
-    fProDelR80pcPt                 = o.fProDelR80pcPt;                       \r
-    fProNtracksLeadingJetGen       = o.fProNtracksLeadingJetGen;             \r
-    fProDelR80pcPtGen              = o.fProDelR80pcPtGen;                    \r
-    fProNtracksLeadingJetBgrPerp2  = o.fProNtracksLeadingJetBgrPerp2;        \r
-    fProNtracksLeadingJetRecPrim   = o.fProNtracksLeadingJetRecPrim;  \r
-    fProDelR80pcPtRecPrim          = o.fProDelR80pcPtRecPrim;\r
-    fProNtracksLeadingJetRecSecNS  = o.fProNtracksLeadingJetRecSecNS; \r
-    fProNtracksLeadingJetRecSecS   = o.fProNtracksLeadingJetRecSecS;  \r
-    fProNtracksLeadingJetRecSecSsc = o.fProNtracksLeadingJetRecSecSsc;\r
-    fRandom                        = o.fRandom;\r
-\r
-    for(Int_t ii=0; ii<5; ii++){\r
-      fProDelRPtSum[ii]           = o.fProDelRPtSum[ii];\r
-      fProDelRPtSumGen[ii]        = o.fProDelRPtSumGen[ii];\r
-      fProDelRPtSumBgrPerp2[ii]   = o.fProDelRPtSumBgrPerp2[ii];\r
-      fProDelRPtSumRecPrim[ii]    = o.fProDelRPtSumRecPrim[ii];\r
-      fProDelRPtSumRecSecNS[ii]   = o.fProDelRPtSumRecSecNS[ii];\r
-      fProDelRPtSumRecSecS[ii]    = o.fProDelRPtSumRecSecS[ii];\r
-      fProDelRPtSumRecSecSsc[ii]  = o.fProDelRPtSumRecSecSsc[ii];\r
-    }\r
-  }\r
-  \r
-  return *this;\r
-}\r
-\r
-//___________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::~AliAnalysisTaskFragmentationFunction()\r
-{\r
-  // destructor\r
-  \r
-  if(fTracksRecCuts)           delete fTracksRecCuts;\r
-  if(fTracksGen)               delete fTracksGen;\r
-  if(fTracksAODMCCharged)      delete fTracksAODMCCharged;  \r
-  if(fTracksAODMCChargedSecNS) delete fTracksAODMCChargedSecNS;  \r
-  if(fTracksAODMCChargedSecS)  delete fTracksAODMCChargedSecS;  \r
-  if(fTracksRecQualityCuts)    delete fTracksRecQualityCuts; \r
-  if(fJetsRec)                 delete fJetsRec;\r
-  if(fJetsRecCuts)             delete fJetsRecCuts;\r
-  if(fJetsGen)                 delete fJetsGen;\r
-  if(fJetsRecEff)              delete fJetsRecEff;\r
-  if(fJetsEmbedded)            delete fJetsEmbedded;\r
-\r
-  if(fBckgMode && \r
-     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||\r
-      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){\r
-\r
-    if(fBckgJetsRec)          delete fBckgJetsRec;\r
-    if(fBckgJetsRecCuts)      delete fBckgJetsRecCuts;\r
-    if(fBckgJetsGen)          delete fBckgJetsGen;\r
-  }\r
-  if(fRandom)               delete fRandom;\r
-}\r
-\r
-//______________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const char* name, \r
-                                                        Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  \r
-                                                        Int_t nPt, Float_t ptMin, Float_t ptMax,\r
-                                                        Int_t nXi, Float_t xiMin, Float_t xiMax,\r
-                                                        Int_t nZ , Float_t zMin , Float_t zMax)\r
-  : TObject()\r
-  ,fNBinsJetPt(nJetPt)\r
-  ,fJetPtMin(jetPtMin)\r
-  ,fJetPtMax(jetPtMax)\r
-  ,fNBinsPt(nPt) \r
-  ,fPtMin(ptMin)   \r
-  ,fPtMax(ptMax)   \r
-  ,fNBinsXi(nXi) \r
-  ,fXiMin(xiMin)   \r
-  ,fXiMax(xiMax)   \r
-  ,fNBinsZ(nZ)  \r
-  ,fZMin(zMin)    \r
-  ,fZMax(zMax)\r
-  ,fh2TrackPt(0)\r
-  ,fh2Xi(0)\r
-  ,fh2Z(0)\r
-  ,fh1JetPt(0)\r
-  ,fNameFF(name)\r
-{\r
-  // default constructor\r
-\r
-}\r
-\r
-//___________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const AliFragFuncHistos& copy)\r
-  : TObject()\r
-  ,fNBinsJetPt(copy.fNBinsJetPt)\r
-  ,fJetPtMin(copy.fJetPtMin)\r
-  ,fJetPtMax(copy.fJetPtMax)\r
-  ,fNBinsPt(copy.fNBinsPt) \r
-  ,fPtMin(copy.fPtMin)   \r
-  ,fPtMax(copy.fPtMax)   \r
-  ,fNBinsXi(copy.fNBinsXi) \r
-  ,fXiMin(copy.fXiMin)   \r
-  ,fXiMax(copy.fXiMax)   \r
-  ,fNBinsZ(copy.fNBinsZ)  \r
-  ,fZMin(copy.fZMin)    \r
-  ,fZMax(copy.fZMax)\r
-  ,fh2TrackPt(copy.fh2TrackPt)\r
-  ,fh2Xi(copy.fh2Xi)\r
-  ,fh2Z(copy.fh2Z)\r
-  ,fh1JetPt(copy.fh1JetPt)\r
-  ,fNameFF(copy.fNameFF)\r
-{\r
-  // copy constructor\r
-}\r
-\r
-//_______________________________________________________________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& o)\r
-{\r
-  // assignment\r
-  \r
-  if(this!=&o){\r
-    TObject::operator=(o);\r
-    fNBinsJetPt = o.fNBinsJetPt;\r
-    fJetPtMin   = o.fJetPtMin;\r
-    fJetPtMax   = o.fJetPtMax;\r
-    fNBinsPt    = o.fNBinsPt; \r
-    fPtMin      = o.fPtMin;   \r
-    fPtMax      = o.fPtMax;   \r
-    fNBinsXi    = o.fNBinsXi; \r
-    fXiMin      = o.fXiMin;   \r
-    fXiMax      = o.fXiMax;   \r
-    fNBinsZ     = o.fNBinsZ;  \r
-    fZMin       = o.fZMin;    \r
-    fZMax       = o.fZMax;    \r
-    fh2TrackPt  = o.fh2TrackPt;\r
-    fh2Xi       = o.fh2Xi;\r
-    fh2Z        = o.fh2Z;\r
-    fh1JetPt    = o.fh1JetPt;\r
-    fNameFF     = o.fNameFF;\r
-  }\r
-    \r
-  return *this;\r
-}\r
-\r
-//_________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::~AliFragFuncHistos()\r
-{\r
-  // destructor \r
-\r
-  if(fh1JetPt)   delete fh1JetPt;\r
-  if(fh2TrackPt) delete fh2TrackPt;\r
-  if(fh2Xi)      delete fh2Xi;\r
-  if(fh2Z)       delete fh2Z;\r
-}\r
-\r
-//_________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::DefineHistos()\r
-{\r
-  // book FF histos\r
-\r
-  fh1JetPt   = new TH1F(Form("fh1FFJetPt%s", fNameFF.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);\r
-  fh2TrackPt = new TH2F(Form("fh2FFTrackPt%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsPt, fPtMin, fPtMax);\r
-  fh2Z       = new TH2F(Form("fh2FFZ%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsZ, fZMin, fZMax);\r
-  fh2Xi      = new TH2F(Form("fh2FFXi%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsXi, fXiMin, fXiMax);\r
-\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{T} [GeV/c]", "entries"); \r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPt,"jet p_{T} [GeV/c]","p_{T} [GeV/c]","entries");\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi,"jet p_{T} [GeV/c]","#xi", "entries");\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z,"jet p_{T} [GeV/c]","z","entries");\r
-}\r
-\r
-//_______________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::FillFF(Float_t trackPt, Float_t jetPt, Bool_t incrementJetPt, Float_t norm, \r
-                                                                       Bool_t scaleStrangeness, Float_t scaleFacStrangeness)\r
-{\r
-  // fill FF\r
-\r
-  if(incrementJetPt && norm) fh1JetPt->Fill(jetPt,1/norm);\r
-  else if(incrementJetPt) fh1JetPt->Fill(jetPt);\r
-\r
- // Added for proper normalization of FF background estimation\r
-  // when zero track are found in the background region\r
-  if((int)trackPt==-1) return;\r
\r
-  if(norm)fh2TrackPt->Fill(jetPt,trackPt,1/norm);\r
-  else if(scaleStrangeness) fh2TrackPt->Fill(jetPt,trackPt,scaleFacStrangeness);\r
-  else fh2TrackPt->Fill(jetPt,trackPt);\r
\r
-  Double_t z = 0.;\r
-  if(jetPt>0) z = trackPt / jetPt;\r
-  Double_t xi = 0;\r
-  if(z>0) xi = TMath::Log(1/z);\r
-  \r
-  if(trackPt>(1-1e-06)*jetPt && trackPt<(1+1e-06)*jetPt){ // case z=1 : move entry to last histo bin <1\r
-    z  = 1-1e-06;\r
-    xi = 1e-06;\r
-  }\r
-\r
-\r
-  if(norm){\r
-    fh2Xi->Fill(jetPt,xi,1/norm);\r
-    fh2Z->Fill(jetPt,z,1/norm);\r
-  }\r
-  else if(scaleStrangeness){\r
-    fh2Xi->Fill(jetPt,xi,scaleFacStrangeness);\r
-    fh2Z->Fill(jetPt,z,scaleFacStrangeness);\r
-  }\r
-  else {\r
-    fh2Xi->Fill(jetPt,xi);\r
-    fh2Z->Fill(jetPt,z);\r
-  }\r
-}\r
-\r
-//_________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AddToOutput(TList* list) const\r
-{\r
-  // add histos to list\r
-\r
-  list->Add(fh1JetPt);\r
-  \r
-  list->Add(fh2TrackPt);\r
-  list->Add(fh2Xi);\r
-  list->Add(fh2Z);\r
-}\r
-\r
-//_________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const char* name,\r
-                                                              Int_t nPt,   Float_t ptMin,   Float_t ptMax,\r
-                                                              Int_t nEta,  Float_t etaMin,  Float_t etaMax,\r
-                                                              Int_t nPhi,  Float_t phiMin,  Float_t phiMax)\r
-  : TObject()\r
-  ,fNBinsPt(nPt)\r
-  ,fPtMin(ptMin)\r
-  ,fPtMax(ptMax)\r
-  ,fNBinsEta(nEta)\r
-  ,fEtaMin(etaMin)\r
-  ,fEtaMax(etaMax)\r
-  ,fNBinsPhi(nPhi)\r
-  ,fPhiMin(phiMin)\r
-  ,fPhiMax(phiMax)\r
-  ,fh2EtaPhi(0)\r
-  ,fh1Pt(0)\r
-  ,fNameQAJ(name)\r
-{\r
-  // default constructor\r
-}\r
-\r
-//____________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const AliFragFuncQAJetHistos& copy)\r
-  : TObject()\r
-  ,fNBinsPt(copy.fNBinsPt)\r
-  ,fPtMin(copy.fPtMin)\r
-  ,fPtMax(copy.fPtMax)\r
-  ,fNBinsEta(copy.fNBinsEta)\r
-  ,fEtaMin(copy.fEtaMin)\r
-  ,fEtaMax(copy.fEtaMax)\r
-  ,fNBinsPhi(copy.fNBinsPhi)\r
-  ,fPhiMin(copy.fPhiMin)\r
-  ,fPhiMax(copy.fPhiMax)\r
-  ,fh2EtaPhi(copy.fh2EtaPhi)\r
-  ,fh1Pt(copy.fh1Pt)\r
-  ,fNameQAJ(copy.fNameQAJ)\r
-{\r
-  // copy constructor\r
-}\r
-\r
-//________________________________________________________________________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& o)\r
-{\r
-  // assignment\r
-  \r
-  if(this!=&o){\r
-    TObject::operator=(o);\r
-    fNBinsPt  = o.fNBinsPt;\r
-    fPtMin    = o.fPtMin;\r
-    fPtMax    = o.fPtMax;\r
-    fNBinsEta = o.fNBinsEta;\r
-    fEtaMin   = o.fEtaMin;\r
-    fEtaMax   = o.fEtaMax;\r
-    fNBinsPhi = o.fNBinsPhi;\r
-    fPhiMin   = o.fPhiMin;\r
-    fPhiMax   = o.fPhiMax;\r
-    fh2EtaPhi = o.fh2EtaPhi;\r
-    fh1Pt     = o.fh1Pt;\r
-    fNameQAJ  = o.fNameQAJ;\r
-  }\r
-  \r
-  return *this;\r
-}\r
-\r
-//______________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::~AliFragFuncQAJetHistos()\r
-{\r
-  // destructor \r
-  \r
-  if(fh2EtaPhi) delete fh2EtaPhi;\r
-  if(fh1Pt)     delete fh1Pt;\r
-}\r
-\r
-//____________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::DefineHistos()\r
-{\r
-  // book jet QA histos\r
-\r
-  fh2EtaPhi  = new TH2F(Form("fh2JetQAEtaPhi%s", fNameQAJ.Data()), Form("%s: #eta - #phi distribution", fNameQAJ.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
-  fh1Pt      = new TH1F(Form("fh1JetQAPt%s", fNameQAJ.Data()), Form("%s: p_{T} distribution", fNameQAJ.Data()), fNBinsPt, fPtMin, fPtMax);\r
-       \r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); \r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");\r
-}\r
-\r
-//____________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::FillJetQA(Float_t eta, Float_t phi, Float_t pt)\r
-{\r
-  // fill jet QA histos \r
-\r
-  fh2EtaPhi->Fill( eta, phi);\r
-  fh1Pt->Fill( pt );\r
-}\r
-\r
-//____________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AddToOutput(TList* list) const \r
-{\r
-  // add histos to list\r
-\r
-  list->Add(fh2EtaPhi);\r
-  list->Add(fh1Pt);\r
-}\r
-\r
-//___________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const char* name,\r
-                                                                  Int_t nPt, Float_t ptMin, Float_t ptMax,\r
-                                                                  Int_t nEta, Float_t etaMin, Float_t etaMax,\r
-                                                                  Int_t nPhi, Float_t phiMin, Float_t phiMax,\r
-                                                                  Float_t ptThresh) \r
-  : TObject()\r
-  ,fNBinsPt(nPt)\r
-  ,fPtMin(ptMin)\r
-  ,fPtMax(ptMax)\r
-  ,fNBinsEta(nEta)\r
-  ,fEtaMin(etaMin)\r
-  ,fEtaMax(etaMax)\r
-  ,fNBinsPhi(nPhi)\r
-  ,fPhiMin(phiMin)\r
-  ,fPhiMax(phiMax)\r
-  ,fHighPtThreshold(ptThresh)\r
-  ,fh2EtaPhi(0)\r
-  ,fh1Pt(0)\r
-  ,fh2HighPtEtaPhi(0)\r
-  ,fh2PhiPt(0)\r
-  ,fNameQAT(name)\r
-{\r
-  // default constructor\r
-}\r
-\r
-//__________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const AliFragFuncQATrackHistos& copy)\r
-  : TObject()\r
-  ,fNBinsPt(copy.fNBinsPt)\r
-  ,fPtMin(copy.fPtMin)\r
-  ,fPtMax(copy.fPtMax)\r
-  ,fNBinsEta(copy.fNBinsEta)\r
-  ,fEtaMin(copy.fEtaMin)\r
-  ,fEtaMax(copy.fEtaMax)\r
-  ,fNBinsPhi(copy.fNBinsPhi)\r
-  ,fPhiMin(copy.fPhiMin)\r
-  ,fPhiMax(copy.fPhiMax)\r
-  ,fHighPtThreshold(copy.fHighPtThreshold)\r
-  ,fh2EtaPhi(copy.fh2EtaPhi)\r
-  ,fh1Pt(copy.fh1Pt)\r
-  ,fh2HighPtEtaPhi(copy.fh2HighPtEtaPhi)\r
-  ,fh2PhiPt(copy.fh2PhiPt)\r
-  ,fNameQAT(copy.fNameQAT)\r
-{\r
-  // copy constructor\r
-}\r
-\r
-// _____________________________________________________________________________________________________________________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& o)\r
-{\r
-  // assignment\r
-  \r
-  if(this!=&o){\r
-    TObject::operator=(o);\r
-    fNBinsPt         = o.fNBinsPt;\r
-    fPtMin           = o.fPtMin;\r
-    fPtMax           = o.fPtMax;\r
-    fNBinsEta        = o.fNBinsEta;\r
-    fEtaMin          = o.fEtaMin;\r
-    fEtaMax          = o.fEtaMax;\r
-    fNBinsPhi        = o.fNBinsPhi;\r
-    fPhiMin          = o.fPhiMin;\r
-    fPhiMax          = o.fPhiMax;\r
-    fHighPtThreshold = o.fHighPtThreshold;\r
-    fh2EtaPhi        = o.fh2EtaPhi;\r
-    fh1Pt            = o.fh1Pt;\r
-    fh2HighPtEtaPhi  = o.fh2HighPtEtaPhi;\r
-    fh2PhiPt         = o.fh2PhiPt;\r
-    fNameQAT         = o.fNameQAT;\r
-  }\r
-  \r
-  return *this;\r
-}\r
-\r
-//___________________________________________________________________\r
-AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::~AliFragFuncQATrackHistos()\r
-{\r
-  // destructor \r
-  \r
-  if(fh2EtaPhi)       delete fh2EtaPhi;\r
-  if(fh2HighPtEtaPhi) delete fh2HighPtEtaPhi;\r
-  if(fh1Pt)           delete fh1Pt;\r
-  if(fh2PhiPt)        delete fh2PhiPt;\r
-}\r
-\r
-//______________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::DefineHistos()\r
-{\r
-  // book track QA histos\r
-\r
-  fh2EtaPhi       = new TH2F(Form("fh2TrackQAEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
-  fh2HighPtEtaPhi = new TH2F(Form("fh2TrackQAHighPtEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution for high-p_{T}", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
-  fh1Pt           = new TH1F(Form("fh1TrackQAPt%s", fNameQAT.Data()), Form("%s: p_{T} distribution", fNameQAT.Data()), fNBinsPt, fPtMin, fPtMax);\r
-    fh2PhiPt        = new TH2F(Form("fh2TrackQAPhiPt%s", fNameQAT.Data()), Form("%s: #phi - p_{T} distribution", fNameQAT.Data()), fNBinsPhi, fPhiMin, fPhiMax, fNBinsPt, fPtMin, fPtMax);\r
-\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); \r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2HighPtEtaPhi, "#eta", "#phi");\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");\r
-  AliAnalysisTaskFragmentationFunction::SetProperties(fh2PhiPt, "#phi", "p_{T} [GeV/c]"); \r
-}\r
-\r
-//________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::FillTrackQA(Float_t eta, Float_t phi, Float_t pt, Bool_t weightPt, Float_t norm, \r
-                                                                                   Bool_t scaleStrangeness, Float_t scaleFacStrangeness)\r
-{\r
-  // fill track QA histos\r
-  Float_t weight = 1.;\r
-  if(weightPt) weight = pt;  \r
-  fh2EtaPhi->Fill( eta, phi, weight);\r
-  if(scaleStrangeness) fh2EtaPhi->Fill( eta, phi, scaleFacStrangeness);\r
-  if(pt > fHighPtThreshold) fh2HighPtEtaPhi->Fill( eta, phi, weight);\r
-  if(pt > fHighPtThreshold && scaleStrangeness) fh2HighPtEtaPhi->Fill( eta, phi, weight);\r
-  if(norm) fh1Pt->Fill( pt, 1/norm );\r
-  else if(scaleStrangeness) fh1Pt->Fill(pt,scaleFacStrangeness); \r
-  else  fh1Pt->Fill( pt );\r
-\r
-  if(scaleFacStrangeness) fh2PhiPt->Fill(phi, pt, scaleFacStrangeness);\r
-  else fh2PhiPt->Fill(phi, pt);\r
-}\r
-\r
-//______________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AddToOutput(TList* list) const\r
-{\r
-  // add histos to list\r
-\r
-  list->Add(fh2EtaPhi);\r
-  list->Add(fh2HighPtEtaPhi);\r
-  list->Add(fh1Pt);\r
-  list->Add(fh2PhiPt);\r
-}\r
-\r
-//_________________________________________________________________________________\r
-Bool_t AliAnalysisTaskFragmentationFunction::Notify()\r
-{\r
-  //\r
-  // Implemented Notify() to read the cross sections\r
-  // and number of trials from pyxsec.root\r
-  // (taken from AliAnalysisTaskJetSpectrum2)\r
-  // \r
-  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();\r
-  Float_t xsection = 0;\r
-  Float_t ftrials  = 1;\r
-\r
-  fAvgTrials = 1;\r
-  if(tree){\r
-    TFile *curfile = tree->GetCurrentFile();\r
-    if (!curfile) {\r
-      Error("Notify","No current file");\r
-      return kFALSE;\r
-    }\r
-    if(!fh1Xsec||!fh1Trials){\r
-      Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);\r
-      return kFALSE;\r
-    }\r
-    AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);\r
-    fh1Xsec->Fill("<#sigma>",xsection);\r
-    // construct a poor man average trials \r
-    Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();\r
-    if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;\r
-  }\r
-\r
-  // Set seed for backg study\r
-  fRandom = new TRandom3();\r
-  fRandom->SetSeed(0);\r
-\r
-  return kTRUE;\r
-}\r
-\r
-//__________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()\r
-{\r
-  // create output objects\r
-\r
-  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()");\r
\r
-  // create list of tracks and jets \r
-\r
-  fTracksRecCuts = new TList();\r
-  fTracksRecCuts->SetOwner(kFALSE);  \r
-\r
-  fTracksGen = new TList();\r
-  fTracksGen->SetOwner(kFALSE);\r
-\r
-  fTracksAODMCCharged = new TList();\r
-  fTracksAODMCCharged->SetOwner(kFALSE);\r
-    \r
-  fTracksAODMCChargedSecNS = new TList();\r
-  fTracksAODMCChargedSecNS->SetOwner(kFALSE);\r
-\r
-  fTracksAODMCChargedSecS = new TList();\r
-  fTracksAODMCChargedSecS->SetOwner(kFALSE);\r
-\r
-  fTracksRecQualityCuts = new TList(); \r
-  fTracksRecQualityCuts->SetOwner(kFALSE);\r
-\r
-  fJetsRec = new TList();\r
-  fJetsRec->SetOwner(kFALSE);\r
-\r
-  fJetsRecCuts = new TList();\r
-  fJetsRecCuts->SetOwner(kFALSE);\r
-\r
-  fJetsGen = new TList();\r
-  fJetsGen->SetOwner(kFALSE);\r
-\r
-  fJetsRecEff = new TList();\r
-  fJetsRecEff->SetOwner(kFALSE);\r
-\r
-  fJetsEmbedded = new TList();\r
-  fJetsEmbedded->SetOwner(kFALSE);\r
-\r
-\r
-  if(fBckgMode && \r
-     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters ||  fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||\r
-      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){\r
-    \r
-    fBckgJetsRec = new TList();\r
-    fBckgJetsRec->SetOwner(kFALSE);\r
-\r
-    fBckgJetsRecCuts = new TList();\r
-    fBckgJetsRecCuts->SetOwner(kFALSE);\r
-\r
-    fBckgJetsGen = new TList();\r
-    fBckgJetsGen->SetOwner(kFALSE);\r
-  }\r
-\r
-  //\r
-  // Create histograms / output container\r
-  //\r
-\r
-  OpenFile(1);\r
-  fCommonHistList = new TList();\r
-  fCommonHistList->SetOwner(kTRUE);\r
-\r
-  Bool_t oldStatus = TH1::AddDirectoryStatus();\r
-  TH1::AddDirectory(kFALSE);\r
-  \r
-  \r
-  // Histograms        \r
-  fh1EvtSelection            = new TH1F("fh1EvtSelection", "Event Selection", 6, -0.5, 5.5);\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(2,"event selection: rejected");\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(3,"event class: rejected");\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(4,"vertex Ncontr: rejected");\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(5,"vertex z: rejected");\r
-  fh1EvtSelection->GetXaxis()->SetBinLabel(6,"vertex type: rejected");\r
-  \r
-  fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 2500,-.5, 2499.5);\r
-  fh1VertexZ                 = new TH1F("fh1VertexZ", "Vertex z distribution", 30, -15., 15.);\r
-  fh1EvtMult                = new TH1F("fh1EvtMult","Event multiplicity, track pT cut > 150 MeV/c, |#eta| < 0.9",120,0.,12000.);\r
-  fh1EvtCent                = new TH1F("fh1EvtCent","centrality",100,0.,100.);\r
-\r
-  fh1Xsec                    = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);\r
-  fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");\r
-  fh1Trials                  = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1);\r
-  fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");\r
-  fh1PtHard                  = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);\r
-  fh1PtHardTrials            = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);\r
-\r
-  fh1nRecJetsCuts            = new TH1F("fh1nRecJetsCuts","reconstructed jets per event",10,-0.5,9.5);\r
-  fh1nGenJets                = new TH1F("fh1nGenJets","generated jets per event",10,-0.5,9.5);\r
-  fh1nRecEffJets             = new TH1F("fh1nRecEffJets","reconstruction effiency: jets per event",10,-0.5,9.5);\r
-  fh1nEmbeddedJets           = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);\r
-\r
-  fh2PtRecVsGenPrim          = new TH2F("fh2PtRecVsGenPrim","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);\r
-  fh2PtRecVsGenSec           = new TH2F("fh2PtRecVsGenSec","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);\r
-  \r
-  // embedding\r
-  if(fBranchEmbeddedJets.Length()){\r
-    fh1FractionPtEmbedded         = new TH1F("fh1FractionPtEmbedded","",200,0,2);\r
-    fh1IndexEmbedded              = new TH1F("fh1IndexEmbedded","",11,-1,10);\r
-    fh2DeltaPtVsJetPtEmbedded     = new TH2F("fh2DeltaPtVsJetPtEmbedded","",250,0,250,200,-100,100);\r
-    fh2DeltaPtVsRecJetPtEmbedded  = new TH2F("fh2DeltaPtVsRecJetPtEmbedded","",250,0,250,200,-100,100);\r
-    fh1DeltaREmbedded             = new TH1F("fh1DeltaREmbedded","",50,0,0.5);\r
-    fh1nEmbeddedJets              = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);\r
-  }\r
-\r
-\r
-  if(fQAMode){\r
-    if(fQAMode&1){ // track QA\r
-       fQATrackHistosRecCuts      = new AliFragFuncQATrackHistos("RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                               fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                               fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                               fQATrackHighPtThreshold);\r
-      fQATrackHistosGen          = new AliFragFuncQATrackHistos("Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                               fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                               fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                               fQATrackHighPtThreshold);\r
-    }\r
-\r
-    if(fQAMode&2){ // jet QA\r
-      fQAJetHistosRec            = new AliFragFuncQAJetHistos("Rec", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
-                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
-      fQAJetHistosRecCuts        = new AliFragFuncQAJetHistos("RecCuts", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
-                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
-      fQAJetHistosRecCutsLeading = new AliFragFuncQAJetHistos("RecCutsLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
-                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
-      fQAJetHistosGen            = new AliFragFuncQAJetHistos("Gen", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
-                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
-      fQAJetHistosGenLeading     = new AliFragFuncQAJetHistos("GenLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
-                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);  \r
-      if(fEffMode) fQAJetHistosRecEffLeading  = new AliFragFuncQAJetHistos("RecEffLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, \r
-                                                                          fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
-    }\r
-  } // end: QA\r
-\r
-  if(fFFMode){\r
-    \r
-    fFFHistosRecCuts                = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                    fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                    fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                    fFFNBinsZ , fFFZMin , fFFZMax );\r
-\r
-    fFFHistosGen            = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                    fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                    fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                    fFFNBinsZ , fFFZMin , fFFZMax);\r
-  } // end: FF\r
-  \r
-  // efficiency\r
-\r
-  if(fEffMode){\r
-    if(fQAMode&1){\r
-      fQATrackHistosRecEffGen = new AliFragFuncQATrackHistos("RecEffGen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                            fQATrackHighPtThreshold);\r
-      \r
-      fQATrackHistosRecEffRec = new AliFragFuncQATrackHistos("RecEffRec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                            fQATrackHighPtThreshold);\r
-\r
-      fQATrackHistosSecRecNS   = new AliFragFuncQATrackHistos("SecRecNS", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                            fQATrackHighPtThreshold);\r
-\r
-      fQATrackHistosSecRecS    = new AliFragFuncQATrackHistos("SecRecS", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                            fQATrackHighPtThreshold);\r
-\r
-      fQATrackHistosSecRecSsc = new AliFragFuncQATrackHistos("SecRecSsc", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                              fQATrackHighPtThreshold);\r
-\r
-    }\r
-    if(fFFMode){\r
-      fFFHistosRecEffRec      = new AliFragFuncHistos("RecEffRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-\r
-      fFFHistosSecRecNS       = new AliFragFuncHistos("SecRecNS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-      \r
-      fFFHistosSecRecS        = new AliFragFuncHistos("SecRecS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-      \r
-      fFFHistosSecRecSsc      = new AliFragFuncHistos("SecRecSsc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-      \r
-    }\r
-  } // end: efficiency\r
-\r
-  // Background\r
-  if(fBckgMode){\r
-    if(fBckgType[0]==kBckgNone){\r
-      AliError("no bgr method selected !");\r
-    }  \r
-    \r
-    TString title[5];\r
-    for(Int_t i=0; i<5; i++){\r
-      if(fBckgType[i]==kBckgPerp) title[i]="Perp";\r
-      else if(fBckgType[i]==kBckgPerp2) title[i]="Perp2";\r
-      else if(fBckgType[i]==kBckgPerp2Area) title[i]="Perp2Area";\r
-      else if(fBckgType[i]==kBckgPerpWindow) title[i]="PerpW";\r
-      else if(fBckgType[i]==kBckgASide) title[i]="ASide";\r
-      else if(fBckgType[i]==kBckgASideWindow) title[i]="ASideW";\r
-      else if(fBckgType[i]==kBckgOutLJ) title[i]="OutLeadingJet";\r
-      else if(fBckgType[i]==kBckgOut2J) title[i]="Out2Jets";\r
-      else if(fBckgType[i]==kBckgOut3J) title[i]="Out3Jets";\r
-      else if(fBckgType[i]==kBckgOutAJ) title[i]="AllJets";\r
-      else if(fBckgType[i]==kBckgOutLJStat) title[i]="OutLeadingJetStat";\r
-      else if(fBckgType[i]==kBckgOut2JStat) title[i]="Out2JetsStat";\r
-      else if(fBckgType[i]==kBckgOut3JStat) title[i]="Out3JetsStat";\r
-      else if(fBckgType[i]==kBckgOutAJStat) title[i]="AllJetsStat";\r
-      else if(fBckgType[i]==kBckgClustersOutLeading) title[i]="OutClusters";\r
-      else if(fBckgType[i]==kBckgClusters) title[i]="MedianClusters";\r
-      else if(fBckgType[i]==kBckgNone)  title[i]="";\r
-      else printf("Please chose background method number %d!",i);\r
-    }\r
-\r
-\r
-    if(fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters || \r
-       fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-       fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading){\r
-      \r
-      fh1nRecBckgJetsCuts        = new TH1F("fh1nRecBckgJetsCuts","reconstructed background jets per event",10,-0.5,9.5);\r
-      fh1nGenBckgJets            = new TH1F("fh1nGenBckgJets","generated background jets per event",10,-0.5,9.5);\r
-    }\r
-\r
-\r
-    fh1BckgMult0 = new TH1F("fh1BckgMult0","bckg mult "+title[0],500,0,500);\r
-    if(fBckgType[1] != kBckgNone) fh1BckgMult1 = new TH1F("fh1BckgMult1","bckg mult "+title[1],500,0,500);\r
-    if(fBckgType[2] != kBckgNone) fh1BckgMult2 = new TH1F("fh1BckgMult2","bckg mult "+title[2],500,0,500);\r
-    if(fBckgType[3] != kBckgNone) fh1BckgMult3 = new TH1F("fh1BckgMult3","bckg mult "+title[3],500,0,500);\r
-    if(fBckgType[4] != kBckgNone) fh1BckgMult4 = new TH1F("fh1BckgMult4","bckg mult "+title[4],500,0,500);\r
-    \r
-    \r
-    if(fQAMode&1){\r
-      fQABckgHisto0RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[0]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                              fQATrackHighPtThreshold);\r
-      fQABckgHisto0Gen          = new AliFragFuncQATrackHistos("Bckg"+title[0]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                              fQATrackHighPtThreshold);\r
-      \r
-      if(fBckgType[1] != kBckgNone){\r
-       fQABckgHisto1RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[1]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-       fQABckgHisto1Gen          = new AliFragFuncQATrackHistos("Bckg"+title[1]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-      }\r
-      if(fBckgType[2] != kBckgNone){\r
-       fQABckgHisto2RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[2]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-       fQABckgHisto2Gen          = new AliFragFuncQATrackHistos("Bckg"+title[2]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-      }\r
-      if(fBckgType[3] != kBckgNone){\r
-       fQABckgHisto3RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[3]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-       fQABckgHisto3Gen          = new AliFragFuncQATrackHistos("Bckg"+title[3]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-      }\r
-      if(fBckgType[4] != kBckgNone){\r
-       fQABckgHisto4RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[4]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-       fQABckgHisto4Gen          = new AliFragFuncQATrackHistos("Bckg"+title[4]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, \r
-                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
-                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, \r
-                                                                fQATrackHighPtThreshold);\r
-      }\r
-    } // end: background QA\r
-    \r
-    if(fFFMode){\r
-      fFFBckgHisto0RecCuts    = new AliFragFuncHistos("Bckg"+title[0]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-      \r
-      fFFBckgHisto0Gen        = new AliFragFuncHistos("Bckg"+title[0]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                     fFFNBinsZ , fFFZMin , fFFZMax);\r
-     \r
-      if(fBckgType[1] != kBckgNone){\r
-       fFFBckgHisto1RecCuts    = new AliFragFuncHistos("Bckg"+title[1]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-       fFFBckgHisto1Gen        = new AliFragFuncHistos("Bckg"+title[1]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-      }\r
-      if(fBckgType[2] != kBckgNone){      \r
-       fFFBckgHisto2RecCuts    = new AliFragFuncHistos("Bckg"+title[2]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto2Gen        = new AliFragFuncHistos("Bckg"+title[2]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-      }\r
-      if(fBckgType[3] != kBckgNone){\r
-       fFFBckgHisto3RecCuts    = new AliFragFuncHistos("Bckg"+title[3]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto3Gen        = new AliFragFuncHistos("Bckg"+title[3]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-      }\r
-      if(fBckgType[4] != kBckgNone){\r
-       fFFBckgHisto4RecCuts    = new AliFragFuncHistos("Bckg"+title[4]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto4Gen        = new AliFragFuncHistos("Bckg"+title[4]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                       fFFNBinsZ , fFFZMin , fFFZMax);\r
-      }\r
-      if(fEffMode){    \r
-       fFFBckgHisto0RecEffRec      = new AliFragFuncHistos("Bckg"+title[0]+"RecEffRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto0SecRecNS       = new AliFragFuncHistos("Bckg"+title[0]+"SecRecNS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto0SecRecS        = new AliFragFuncHistos("Bckg"+title[0]+"SecRecS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
-       \r
-       fFFBckgHisto0SecRecSsc      = new AliFragFuncHistos("Bckg"+title[0]+"SecRecSsc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, \r
-                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, \r
-                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
-                                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
-\r
-      }\r
-    } // end: background FF\r
-\r
-\r
-  } // end: background\r
-  \r
\r
-  // ____________ define histograms ____________________\r
-  \r
-  if(fQAMode){\r
-    if(fQAMode&1){ // track QA\r
-      fQATrackHistosRecCuts->DefineHistos();\r
-      fQATrackHistosGen->DefineHistos();\r
-    }\r
-\r
-    if(fQAMode&2){ // jet QA\r
-      fQAJetHistosRec->DefineHistos();\r
-      fQAJetHistosRecCuts->DefineHistos();\r
-      fQAJetHistosRecCutsLeading->DefineHistos();\r
-      fQAJetHistosGen->DefineHistos();\r
-      fQAJetHistosGenLeading->DefineHistos();\r
-      if(fEffMode) fQAJetHistosRecEffLeading->DefineHistos();\r
-    }\r
-  }\r
-  \r
-  if(fFFMode){\r
-    fFFHistosRecCuts->DefineHistos();\r
-    fFFHistosGen->DefineHistos();\r
-  }\r
-  \r
-  if(fEffMode){\r
-    if(fQAMode&1){\r
-      fQATrackHistosRecEffGen->DefineHistos();\r
-      fQATrackHistosRecEffRec->DefineHistos(); \r
-      fQATrackHistosSecRecNS->DefineHistos(); \r
-      fQATrackHistosSecRecS->DefineHistos(); \r
-      fQATrackHistosSecRecSsc->DefineHistos(); \r
-    }\r
-    if(fFFMode){\r
-      fFFHistosRecEffRec->DefineHistos();\r
-      fFFHistosSecRecNS->DefineHistos();\r
-      fFFHistosSecRecS->DefineHistos();\r
-      fFFHistosSecRecSsc->DefineHistos();\r
-    }\r
-  } // end: efficiency\r
-\r
-  // Background\r
-  if(fBckgMode){\r
-    if(fFFMode){\r
-      fFFBckgHisto0RecCuts->DefineHistos();\r
-      fFFBckgHisto0Gen->DefineHistos();      \r
-      if(fBckgType[1] != kBckgNone) fFFBckgHisto1RecCuts->DefineHistos();\r
-      if(fBckgType[1] != kBckgNone) fFFBckgHisto1Gen->DefineHistos();\r
-      if(fBckgType[2] != kBckgNone) fFFBckgHisto2RecCuts->DefineHistos();\r
-      if(fBckgType[2] != kBckgNone) fFFBckgHisto2Gen->DefineHistos();\r
-      if(fBckgType[3] != kBckgNone) fFFBckgHisto3RecCuts->DefineHistos();\r
-      if(fBckgType[3] != kBckgNone) fFFBckgHisto3Gen->DefineHistos();\r
-      if(fBckgType[4] != kBckgNone) fFFBckgHisto4RecCuts->DefineHistos();\r
-      if(fBckgType[4] != kBckgNone) fFFBckgHisto4Gen->DefineHistos();\r
-\r
-     if(fEffMode){\r
-       fFFBckgHisto0RecEffRec->DefineHistos(); \r
-       fFFBckgHisto0SecRecNS->DefineHistos();\r
-        fFFBckgHisto0SecRecS->DefineHistos();\r
-        fFFBckgHisto0SecRecSsc->DefineHistos();\r
-      }\r
-    }\r
-\r
-    if(fQAMode&1){\r
-      fQABckgHisto0RecCuts->DefineHistos();\r
-      fQABckgHisto0Gen->DefineHistos();\r
-      if(fBckgType[1] != kBckgNone) fQABckgHisto1RecCuts->DefineHistos();\r
-      if(fBckgType[1] != kBckgNone) fQABckgHisto1Gen->DefineHistos();\r
-      if(fBckgType[2] != kBckgNone) fQABckgHisto2RecCuts->DefineHistos();\r
-      if(fBckgType[2] != kBckgNone) fQABckgHisto2Gen->DefineHistos();\r
-      if(fBckgType[3] != kBckgNone) fQABckgHisto3RecCuts->DefineHistos();\r
-      if(fBckgType[3] != kBckgNone) fQABckgHisto3Gen->DefineHistos();\r
-      if(fBckgType[4] != kBckgNone) fQABckgHisto4RecCuts->DefineHistos();\r
-      if(fBckgType[4] != kBckgNone) fQABckgHisto4Gen->DefineHistos();\r
-    }\r
-  } // end: background\r
-  \r
-\r
-  Bool_t genJets    = (fJetTypeGen != kJetsUndef) ? kTRUE : kFALSE;\r
-  Bool_t genTracks  = (fTrackTypeGen != kTrackUndef) ? kTRUE : kFALSE;\r
-  Bool_t recJetsEff = (fJetTypeRecEff != kJetsUndef) ? kTRUE : kFALSE;\r
-\r
-  fCommonHistList->Add(fh1EvtSelection);\r
-  fCommonHistList->Add(fh1EvtMult);\r
-  fCommonHistList->Add(fh1EvtCent);\r
-  fCommonHistList->Add(fh1VertexNContributors);\r
-  fCommonHistList->Add(fh1VertexZ);    \r
-  fCommonHistList->Add(fh1nRecJetsCuts);\r
-  fCommonHistList->Add(fh1Xsec);\r
-  fCommonHistList->Add(fh1Trials);\r
-  fCommonHistList->Add(fh1PtHard);\r
-  fCommonHistList->Add(fh1PtHardTrials);\r
\r
-  if(genJets) fCommonHistList->Add(fh1nGenJets);\r
-\r
-  // FF histograms\r
-  if(fFFMode){\r
-    fFFHistosRecCuts->AddToOutput(fCommonHistList);\r
-    if(genJets && genTracks){\r
-      fFFHistosGen->AddToOutput(fCommonHistList);\r
-    }\r
-  }\r
-\r
-  // Background\r
-  if(fBckgMode){\r
-    if(fFFMode){\r
-      fFFBckgHisto0RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[1] != kBckgNone) fFFBckgHisto1RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[2] != kBckgNone) fFFBckgHisto2RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[3] != kBckgNone) fFFBckgHisto3RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[4] != kBckgNone) fFFBckgHisto4RecCuts->AddToOutput(fCommonHistList);\r
-\r
-      if(genJets && genTracks){\r
-       fFFBckgHisto0Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[1] != kBckgNone) fFFBckgHisto1Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[2] != kBckgNone) fFFBckgHisto2Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[3] != kBckgNone) fFFBckgHisto3Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[4] != kBckgNone) fFFBckgHisto4Gen->AddToOutput(fCommonHistList);\r
-      }\r
-\r
-      if(fEffMode){\r
-        fFFBckgHisto0RecEffRec->AddToOutput(fCommonHistList);\r
-       fFFBckgHisto0SecRecNS->AddToOutput(fCommonHistList);\r
-        fFFBckgHisto0SecRecS->AddToOutput(fCommonHistList);\r
-        fFFBckgHisto0SecRecSsc->AddToOutput(fCommonHistList);\r
-      }\r
-    }\r
-\r
-    if(fQAMode&1){\r
-      fQABckgHisto0RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[1] != kBckgNone) fQABckgHisto1RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[2] != kBckgNone) fQABckgHisto2RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[3] != kBckgNone) fQABckgHisto3RecCuts->AddToOutput(fCommonHistList);\r
-      if(fBckgType[4] != kBckgNone) fQABckgHisto4RecCuts->AddToOutput(fCommonHistList);\r
-      if(genJets && genTracks){\r
-       fQABckgHisto0Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[1] != kBckgNone) fQABckgHisto1Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[2] != kBckgNone) fQABckgHisto2Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[3] != kBckgNone) fQABckgHisto3Gen->AddToOutput(fCommonHistList);\r
-       if(fBckgType[4] != kBckgNone) fQABckgHisto4Gen->AddToOutput(fCommonHistList);\r
-      }\r
-    }\r
-    \r
-    if(fh1BckgMult0) fCommonHistList->Add(fh1BckgMult0);\r
-    if(fBckgType[1] != kBckgNone)  fCommonHistList->Add(fh1BckgMult1);\r
-    if(fBckgType[2] != kBckgNone)  fCommonHistList->Add(fh1BckgMult2);\r
-    if(fBckgType[3] != kBckgNone)  fCommonHistList->Add(fh1BckgMult3);\r
-    if(fBckgType[4] != kBckgNone)  fCommonHistList->Add(fh1BckgMult4);\r
-  }\r
-  \r
-\r
-  if(fBranchEmbeddedJets.Length()){ \r
-    fCommonHistList->Add(fh1FractionPtEmbedded);\r
-    fCommonHistList->Add(fh1IndexEmbedded);\r
-    fCommonHistList->Add(fh2DeltaPtVsJetPtEmbedded);      \r
-    fCommonHistList->Add(fh2DeltaPtVsRecJetPtEmbedded);      \r
-    fCommonHistList->Add(fh1DeltaREmbedded);\r
-    fCommonHistList->Add(fh1nEmbeddedJets);  \r
-  }\r
-\r
-\r
-  // QA  \r
-  if(fQAMode){\r
-    if(fQAMode&1){ // track QA\r
-      fQATrackHistosRecCuts->AddToOutput(fCommonHistList);\r
-      if(genTracks) fQATrackHistosGen->AddToOutput(fCommonHistList);\r
-    }\r
-\r
-    if(fQAMode&2){ // jet QA\r
-      fQAJetHistosRec->AddToOutput(fCommonHistList);\r
-      fQAJetHistosRecCuts->AddToOutput(fCommonHistList);\r
-      fQAJetHistosRecCutsLeading->AddToOutput(fCommonHistList);\r
-      if(recJetsEff && fEffMode) fQAJetHistosRecEffLeading->AddToOutput(fCommonHistList); \r
-      if(genJets){\r
-       fQAJetHistosGen->AddToOutput(fCommonHistList);\r
-       fQAJetHistosGenLeading->AddToOutput(fCommonHistList);\r
-      }\r
-    }\r
-  }\r
-\r
-  if(fBckgMode && \r
-     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||\r
-      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)) {\r
-    fCommonHistList->Add(fh1nRecBckgJetsCuts);\r
-    if(genJets) fCommonHistList->Add(fh1nGenBckgJets);\r
-  }\r
-    \r
-   \r
-  if(fEffMode && recJetsEff && genTracks){\r
-    if(fQAMode&1){\r
-      fQATrackHistosRecEffGen->AddToOutput(fCommonHistList);\r
-      fQATrackHistosRecEffRec->AddToOutput(fCommonHistList);\r
-      fQATrackHistosSecRecNS->AddToOutput(fCommonHistList);\r
-      fQATrackHistosSecRecS->AddToOutput(fCommonHistList);\r
-      fQATrackHistosSecRecSsc->AddToOutput(fCommonHistList);\r
-    }\r
-    if(fFFMode){\r
-      fFFHistosRecEffRec->AddToOutput(fCommonHistList);\r
-      fFFHistosSecRecNS->AddToOutput(fCommonHistList);\r
-      fFFHistosSecRecS->AddToOutput(fCommonHistList);\r
-      fFFHistosSecRecSsc->AddToOutput(fCommonHistList);\r
-    }\r
-    fCommonHistList->Add(fh1nRecEffJets);\r
-    fCommonHistList->Add(fh2PtRecVsGenPrim); \r
-    fCommonHistList->Add(fh2PtRecVsGenSec); \r
-  }\r
-  \r
-  // jet shape \r
-  if(fJSMode){\r
-\r
-    fProNtracksLeadingJet          = new TProfile("AvgNoOfTracksLeadingJet","AvgNoOfTracksLeadingJet",100,0,250,0,50); \r
-    fProDelR80pcPt                 = new TProfile("AvgdelR80pcPt","AvgdelR80pcPt",100,0,250,0,1); \r
-\r
-    if(genJets && genTracks){\r
-      fProNtracksLeadingJetGen       = new TProfile("AvgNoOfTracksLeadingJetGen","AvgNoOfTracksLeadingJetGen",100,0,250,0,50); \r
-      fProDelR80pcPtGen              = new TProfile("AvgdelR80pcPtGen","AvgdelR80pcPtGen",100,0,250,0,1); \r
-    }\r
-\r
-    if(fBckgMode)\r
-      fProNtracksLeadingJetBgrPerp2  = new TProfile("AvgNoOfTracksLeadingJetBgrPerp2","AvgNoOfTracksLeadingJetBgrPerp2",100,0,250,0,50); \r
-    \r
-    if(fEffMode){\r
-      fProNtracksLeadingJetRecPrim   = new TProfile("AvgNoOfTracksLeadingJetRecPrim","AvgNoOfTracksLeadingJetRecPrim",100,0,250,0,50); \r
-      fProDelR80pcPtRecPrim          = new TProfile("AvgdelR80pcPtRecPrim","AvgdelR80pcPtRecPrim",100,0,250,0,1); \r
-      fProNtracksLeadingJetRecSecNS  = new TProfile("AvgNoOfTracksLeadingJetRecSecNS","AvgNoOfTracksLeadingJetRecSecNS",100,0,250,0,50); \r
-      fProNtracksLeadingJetRecSecS   = new TProfile("AvgNoOfTracksLeadingJetRecSecS","AvgNoOfTracksLeadingJetRecSecS",100,0,250,0,50); \r
-      fProNtracksLeadingJetRecSecSsc = new TProfile("AvgNoOfTracksLeadingJetRecSecSsc","AvgNoOfTracksLeadingJetRecSecSsc",100,0,250,0,50); \r
-    }\r
-\r
-    TString strTitJS;  \r
-    for(Int_t ii=0; ii<5; ii++){\r
-      if(ii==0)strTitJS = "_JetPt20to30";\r
-      if(ii==1)strTitJS = "_JetPt30to40";\r
-      if(ii==2)strTitJS = "_JetPt40to60";\r
-      if(ii==3)strTitJS = "_JetPt60to80";\r
-      if(ii==4)strTitJS = "_JetPt80to100";\r
-      \r
-      fProDelRPtSum[ii]            = new TProfile(Form("AvgPtSumDelR%s",strTitJS.Data()),Form("AvgPtSumDelR%s",strTitJS.Data()),100,0,1,0,250);\r
-      if(genJets && genTracks) \r
-       fProDelRPtSumGen[ii]       = new TProfile(Form("AvgPtSumDelRGen%s",strTitJS.Data()),Form("AvgPtSumDelRGen%s",strTitJS.Data()),100,0,1,0,250);\r
-      if(fBckgMode) \r
-       fProDelRPtSumBgrPerp2[ii]  = new TProfile(Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),100,0,1,0,250);\r
-      if(fEffMode){\r
-       fProDelRPtSumRecPrim[ii]   = new TProfile(Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),100,0,1,0,250);\r
-       fProDelRPtSumRecSecNS[ii]  = new TProfile(Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),100,0,1,0,250);\r
-       fProDelRPtSumRecSecS[ii]   = new TProfile(Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),100,0,1,0,250);\r
-       fProDelRPtSumRecSecSsc[ii] = new TProfile(Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),100,0,1,0,250);\r
-      }\r
-    }\r
-    \r
-    fCommonHistList->Add(fProNtracksLeadingJet);\r
-    fCommonHistList->Add(fProDelR80pcPt);\r
-    for(int ii=0; ii<5; ii++) fCommonHistList->Add(fProDelRPtSum[ii]);\r
-\r
-    if(genJets && genTracks){\r
-      fCommonHistList->Add(fProNtracksLeadingJetGen);\r
-      fCommonHistList->Add(fProDelR80pcPtGen);\r
-      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumGen[ii]);\r
-    }\r
-    \r
-    if(fBckgMode){ \r
-      fCommonHistList->Add(fProNtracksLeadingJetBgrPerp2);\r
-      for(Int_t ii=0; ii<5; ii++) fCommonHistList->Add(fProDelRPtSumBgrPerp2[ii]);\r
-    }\r
-\r
-    if(fEffMode){\r
-      fCommonHistList->Add(fProNtracksLeadingJetRecPrim);\r
-      fCommonHistList->Add(fProDelR80pcPtRecPrim);\r
-      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecPrim[ii]);\r
-      \r
-      fCommonHistList->Add(fProNtracksLeadingJetRecSecNS);\r
-      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecNS[ii]);\r
-\r
-      fCommonHistList->Add(fProNtracksLeadingJetRecSecS);\r
-      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecS[ii]);\r
-      \r
-      fCommonHistList->Add(fProNtracksLeadingJetRecSecSsc);\r
-      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecSsc[ii]);\r
-    }\r
-  }\r
-\r
-  // =========== Switch on Sumw2 for all histos ===========\r
-  for (Int_t i=0; i<fCommonHistList->GetEntries(); ++i){\r
-    TH1 *h1 = dynamic_cast<TH1*>(fCommonHistList->At(i));\r
-    if (h1) h1->Sumw2();\r
-    else{\r
-      THnSparse *hnSparse = dynamic_cast<THnSparse*>(fCommonHistList->At(i));\r
-      if(hnSparse) hnSparse->Sumw2();\r
-    }\r
-  }\r
-  \r
-  TH1::AddDirectory(oldStatus);\r
-\r
-  PostData(1, fCommonHistList);\r
-}\r
-\r
-//_______________________________________________\r
-void AliAnalysisTaskFragmentationFunction::Init()\r
-{\r
-  // Initialization\r
-  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::Init()");\r
-\r
-}\r
-\r
-//_____________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *) \r
-{\r
-  // Main loop\r
-  // Called for each event\r
-  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserExec()");\r
-  \r
-  \r
-  if(fDebug > 1) Printf("Analysis event #%5d", (Int_t) fEntry);\r
-\r
-  // Trigger selection\r
-  AliInputEventHandler* inputHandler = (AliInputEventHandler*)\r
-    ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());\r
-  \r
-  if(!(inputHandler->IsEventSelected() & fEvtSelectionMask)){\r
-    fh1EvtSelection->Fill(1.);\r
-    if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");\r
-    PostData(1, fCommonHistList);\r
-    return;\r
-  }\r
-  \r
-  fESD = dynamic_cast<AliESDEvent*>(InputEvent());\r
-  if(!fESD){\r
-    if(fDebug>3) Printf("%s:%d ESDEvent not found in the input", (char*)__FILE__,__LINE__);\r
-  }\r
-  \r
-  fMCEvent = MCEvent();\r
-  if(!fMCEvent){\r
-    if(fDebug>3) Printf("%s:%d MCEvent not found in the input", (char*)__FILE__,__LINE__);\r
-  }\r
-  \r
-  // get AOD event from input/ouput\r
-  TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
-  if( handler && handler->InheritsFrom("AliAODInputHandler") ) {\r
-    fAOD  =  ((AliAODInputHandler*)handler)->GetEvent();\r
-    if(fUseAODInputJets) fAODJets = fAOD;\r
-    if (fDebug > 1)  Printf("%s:%d AOD event from input", (char*)__FILE__,__LINE__);\r
-  }\r
-  else {\r
-    handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();\r
-    if( handler && handler->InheritsFrom("AliAODHandler") ) {\r
-      fAOD = ((AliAODHandler*)handler)->GetAOD();\r
-      fAODJets = fAOD;\r
-      if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);\r
-    }\r
-  }\r
-  \r
-  if(!fAODJets && !fUseAODInputJets){ // case we have AOD in input & output and want jets from output\r
-    TObject* outHandler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();\r
-    if( outHandler && outHandler->InheritsFrom("AliAODHandler") ) {\r
-      fAODJets = ((AliAODHandler*)outHandler)->GetAOD();\r
-      if (fDebug > 1)  Printf("%s:%d jets from output AOD", (char*)__FILE__,__LINE__);\r
-    }\r
-  }\r
-  \r
-  if(fNonStdFile.Length()!=0){\r
-    // case we have an AOD extension - fetch the jets from the extended output\r
-    \r
-    AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());\r
-    fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);    \r
-    if(!fAODExtension){\r
-      if(fDebug>1)Printf("AODExtension not found for %s",fNonStdFile.Data());\r
-    }\r
-  }\r
-  \r
-  if(!fAOD){\r
-    Printf("%s:%d AODEvent not found", (char*)__FILE__,__LINE__);\r
-    return;\r
-  }\r
-  if(!fAODJets){\r
-    Printf("%s:%d AODEvent with jet branch not found", (char*)__FILE__,__LINE__);\r
-    return;\r
-  }\r
-\r
-  \r
-  // event selection **************************************************\r
-  // *** event class ***\r
-  Double_t centPercent = -1;\r
-  if(fEventClass>0){\r
-    Int_t cl = 0;\r
-    if(handler->InheritsFrom("AliAODInputHandler")){ \r
-      // since it is not supported by the helper task define own classes\r
-      centPercent = fAOD->GetHeader()->GetCentrality();\r
-      cl = 1;\r
-      if(centPercent>10) cl = 2;\r
-      if(centPercent>30) cl = 3;\r
-      if(centPercent>50) cl = 4;\r
-    }\r
-    else {\r
-      cl = AliAnalysisHelperJetTasks::EventClass();\r
-      if(fESD) centPercent = fESD->GetCentrality()->GetCentralityPercentile("V0M"); // retrieve value 'by hand'\r
-    }\r
-    \r
-    if(cl!=fEventClass){\r
-      // event not in selected event class, reject event\r
-      if (fDebug > 1) Printf("%s:%d event not in selected event class: event REJECTED ...",(char*)__FILE__,__LINE__);\r
-      fh1EvtSelection->Fill(2.);\r
-      PostData(1, fCommonHistList);\r
-      return;\r
-    }\r
-  }\r
-\r
-  // *** vertex cut ***\r
-  AliAODVertex* primVtx = fAOD->GetPrimaryVertex();\r
-  Int_t nTracksPrim = primVtx->GetNContributors();\r
-  fh1VertexNContributors->Fill(nTracksPrim);\r
-  \r
-  \r
-  if (fDebug > 1) Printf("%s:%d primary vertex selection: %d", (char*)__FILE__,__LINE__,nTracksPrim);\r
-  if(!nTracksPrim){\r
-    if (fDebug > 1) Printf("%s:%d primary vertex selection: event REJECTED...",(char*)__FILE__,__LINE__); \r
-    fh1EvtSelection->Fill(3.);\r
-    PostData(1, fCommonHistList);\r
-    return;\r
-  }\r
-  \r
-  fh1VertexZ->Fill(primVtx->GetZ());\r
-  \r
-  if(TMath::Abs(primVtx->GetZ())>fMaxVertexZ){\r
-    if (fDebug > 1) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); \r
-    fh1EvtSelection->Fill(4.);\r
-    PostData(1, fCommonHistList);\r
-    return; \r
-  }\r
-  \r
-  TString primVtxName(primVtx->GetName());\r
-\r
-  if(primVtxName.CompareTo("TPCVertex",TString::kIgnoreCase) == 1){\r
-    if (fDebug > 1) Printf("%s:%d primary vertex selection: TPC vertex, event REJECTED...",(char*)__FILE__,__LINE__);\r
-    fh1EvtSelection->Fill(5.);\r
-    PostData(1, fCommonHistList);\r
-    return;\r
-  }\r
-\r
-  if (fDebug > 1) Printf("%s:%d event ACCEPTED ...",(char*)__FILE__,__LINE__); \r
-  fh1EvtSelection->Fill(0.);\r
-  fh1EvtCent->Fill(centPercent);\r
-\r
-\r
-  //___ get MC information __________________________________________________________________\r
-\r
-  fh1Trials->Fill("#sum{ntrials}",fAvgTrials); \r
-\r
-  Double_t ptHard = 0.;\r
-  Double_t nTrials = 1; // trials for MC trigger weight for real data\r
-\r
-  if(fMCEvent){\r
-    AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();\r
-    \r
-    if(genHeader){\r
-      \r
-      AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);\r
-      AliGenHijingEventHeader*  hijingGenHeader = 0x0;\r
-      \r
-      if(pythiaGenHeader){\r
-       if(fDebug>3) Printf("%s:%d pythiaGenHeader found", (char*)__FILE__,__LINE__);\r
-       nTrials = pythiaGenHeader->Trials();\r
-       ptHard  = pythiaGenHeader->GetPtHard();\r
-       \r
-       fh1PtHard->Fill(ptHard);\r
-       fh1PtHardTrials->Fill(ptHard,nTrials);\r
-       \r
-      } else { // no pythia, hijing?\r
-       \r
-       if(fDebug>3) Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);\r
-       \r
-       hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);\r
-       if(!hijingGenHeader){\r
-         Printf("%s:%d no pythiaGenHeader or hjingGenHeader found", (char*)__FILE__,__LINE__);\r
-       } else {\r
-         if(fDebug>3) Printf("%s:%d hijingGenHeader found", (char*)__FILE__,__LINE__);\r
-       }\r
-      }\r
-      \r
-      //fh1Trials->Fill("#sum{ntrials}",fAvgTrials); \r
-    }\r
-  }\r
-  \r
-  //___ fetch jets __________________________________________________________________________\r
-  \r
-  Int_t nJ = GetListOfJets(fJetsRec, kJetsRec);\r
-  Int_t nRecJets = 0;\r
-  if(nJ>=0) nRecJets = fJetsRec->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected Rec jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);\r
-  if(nJ != nRecJets) Printf("%s:%d Mismatch Selected Rec Jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);\r
-  \r
-  Int_t nJCuts = GetListOfJets(fJetsRecCuts, kJetsRecAcceptance);\r
-  Int_t nRecJetsCuts = 0;\r
-  if(nJCuts>=0) nRecJetsCuts = fJetsRecCuts->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);\r
-  if(nRecJetsCuts != nJCuts) Printf("%s:%d Mismatch selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);\r
-  fh1nRecJetsCuts->Fill(nRecJetsCuts);\r
-\r
-  if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() \r
-\r
-  Int_t nJGen  = GetListOfJets(fJetsGen, fJetTypeGen);\r
-  Int_t nGenJets = 0;\r
-  if(nJGen>=0) nGenJets = fJetsGen->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);\r
-  \r
-  if(nJGen != nGenJets) Printf("%s:%d Mismatch selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);\r
-  fh1nGenJets->Fill(nGenJets);\r
-  \r
-  \r
-  if(fJetTypeRecEff==kJetsKine || fJetTypeRecEff == kJetsKineAcceptance) fJetsRecEff->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() \r
-  Int_t nJRecEff  = GetListOfJets(fJetsRecEff, fJetTypeRecEff);\r
-  Int_t nRecEffJets = 0;\r
-  if(nJRecEff>=0) nRecEffJets = fJetsRecEff->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected RecEff jets: %d %d",(char*)__FILE__,__LINE__,nJRecEff,nRecEffJets);\r
-  if(nJRecEff != nRecEffJets) Printf("%s:%d Mismatch selected RecEff jets: %d %d",(char*)__FILE__,__LINE__,nJRecEff,nRecEffJets);\r
-  fh1nRecEffJets->Fill(nRecEffJets);\r
-  \r
-  \r
-  Int_t nEmbeddedJets =  0; \r
-  TArrayI iEmbeddedMatchIndex; \r
-  TArrayF fEmbeddedPtFraction; \r
-  \r
-\r
-  if(fBranchEmbeddedJets.Length()){ \r
-    Int_t nJEmbedded = GetListOfJets(fJetsEmbedded, kJetsEmbedded);\r
-    if(nJEmbedded>=0) nEmbeddedJets = fJetsEmbedded->GetEntries();\r
-    if(fDebug>2)Printf("%s:%d Selected Embedded jets: %d %d",(char*)__FILE__,__LINE__,nJEmbedded,nEmbeddedJets);\r
-    if(nJEmbedded != nEmbeddedJets) Printf("%s:%d Mismatch Selected Embedded Jets: %d %d",(char*)__FILE__,__LINE__,nJEmbedded,nEmbeddedJets);\r
-    fh1nEmbeddedJets->Fill(nEmbeddedJets);\r
-    \r
-    Float_t maxDist = 0.3;\r
-\r
-    iEmbeddedMatchIndex.Set(nEmbeddedJets); \r
-    fEmbeddedPtFraction.Set(nEmbeddedJets); \r
-    \r
-    iEmbeddedMatchIndex.Reset(-1);\r
-    fEmbeddedPtFraction.Reset(0);\r
-    \r
-    AliAnalysisHelperJetTasks::GetJetMatching(fJetsEmbedded, nEmbeddedJets, \r
-                                             fJetsRecCuts, nRecJetsCuts, \r
-                                             iEmbeddedMatchIndex, fEmbeddedPtFraction,\r
-                                             fDebug, maxDist);\r
-    \r
-  }\r
-  \r
-  //____ fetch background clusters ___________________________________________________\r
-  if(fBckgMode && \r
-     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||\r
-      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){\r
-\r
-    Int_t nBJ = GetListOfBckgJets(fBckgJetsRec, kJetsRec);\r
-    Int_t nRecBckgJets = 0;\r
-    if(nBJ>=0) nRecBckgJets = fBckgJetsRec->GetEntries();\r
-    if(fDebug>2)Printf("%s:%d Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);\r
-    if(nBJ != nRecBckgJets) Printf("%s:%d Mismatch Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);\r
-\r
-    Int_t nBJCuts = GetListOfBckgJets(fBckgJetsRecCuts, kJetsRecAcceptance);\r
-    Int_t nRecBckgJetsCuts = 0;\r
-    if(nBJCuts>=0) nRecBckgJetsCuts = fBckgJetsRecCuts->GetEntries();\r
-    if(fDebug>2)Printf("%s:%d Selected Rec background jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);\r
-    if(nRecBckgJetsCuts != nBJCuts) Printf("%s:%d Mismatch selected Rec background jets after cuts: %d %d",(char*)__FILE__,__LINE__,nBJCuts,nRecBckgJetsCuts);\r
-    fh1nRecBckgJetsCuts->Fill(nRecBckgJetsCuts);\r
-    \r
-    if(0){ // protection OB - not yet implemented \r
-      if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fBckgJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear()\r
-      Int_t nBJGen  = GetListOfBckgJets(fBckgJetsGen, fJetTypeGen);\r
-      Int_t nGenBckgJets = 0;\r
-      if(nBJGen>=0) nGenBckgJets = fBckgJetsGen->GetEntries();\r
-      if(fDebug>2)Printf("%s:%d Selected Gen background jets: %d %d",(char*)__FILE__,__LINE__,nBJGen,nGenBckgJets);\r
-      if(nBJGen != nGenBckgJets) Printf("%s:%d Mismatch selected Gen background jets: %d %d",(char*)__FILE__,__LINE__,nBJGen,nGenBckgJets);\r
-      fh1nGenBckgJets->Fill(nGenBckgJets);\r
-    }\r
-  }\r
-\r
-\r
-  //____ fetch particles __________________________________________________________\r
-  \r
-  Int_t nTCuts;\r
-  if(fUseExtraTracks ==  1)      nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODExtraCuts);\r
-  else if(fUseExtraTracks == -1) nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODExtraonlyCuts);\r
-  else                           nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODCuts);\r
-  \r
-  Int_t nRecPartCuts = 0;\r
-  if(nTCuts>=0) nRecPartCuts = fTracksRecCuts->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);\r
-  if(nRecPartCuts != nTCuts) Printf("%s:%d Mismatch selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);\r
-  fh1EvtMult->Fill(nRecPartCuts);\r
-\r
-\r
-  Int_t nTGen = GetListOfTracks(fTracksGen,fTrackTypeGen);\r
-  Int_t nGenPart = 0;\r
-  if(nTGen>=0) nGenPart = fTracksGen->GetEntries();\r
-  if(fDebug>2)Printf("%s:%d Selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);\r
-  if(nGenPart != nTGen) Printf("%s:%d Mismatch selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);\r
-  \r
-  \r
-  //____ analysis, fill histos ___________________________________________________\r
-  \r
-  if(fQAMode){\r
-    // loop over tracks\r
-    if(fQAMode&1){\r
-      for(Int_t it=0; it<nRecPartCuts; ++it){\r
-       AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRecCuts->At(it));\r
-       if(part)fQATrackHistosRecCuts->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt() );\r
-      }      \r
-      for(Int_t it=0; it<nGenPart; ++it){\r
-       AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksGen->At(it));\r
-       if(part)fQATrackHistosGen->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
-      }\r
-    }\r
-    \r
-    // loop over jets\r
-    if(fQAMode&2){\r
-      for(Int_t ij=0; ij<nRecJets; ++ij){\r
-       AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRec->At(ij));\r
-       if(jet)fQAJetHistosRec->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
-      }\r
-    }\r
-  }\r
-  \r
-  if(fQAMode || fFFMode){\r
-    for(Int_t ij=0; ij<nRecJetsCuts; ++ij){\r
-      \r
-      AliAODJet* jet = (AliAODJet*)(fJetsRecCuts->At(ij));\r
-      if(fQAMode&2) fQAJetHistosRecCuts->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
-      \r
-      if(ij==0){ // leading jet\r
-       \r
-       if(fQAMode&2) fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );\r
-\r
-       Double_t ptFractionEmbedded = 0; \r
-       AliAODJet* embeddedJet = 0; \r
-\r
-       if(fBranchEmbeddedJets.Length()){ // find embedded jet\r
-\r
-         Int_t indexEmbedded = -1;\r
-         for(Int_t i=0; i<nEmbeddedJets; i++){\r
-           if(iEmbeddedMatchIndex[i] == ij){\r
-             indexEmbedded      = i;\r
-             ptFractionEmbedded = fEmbeddedPtFraction[i];\r
-           }\r
-         }\r
-\r
-         fh1IndexEmbedded->Fill(indexEmbedded);\r
-         fh1FractionPtEmbedded->Fill(ptFractionEmbedded);\r
-         \r
-         if(indexEmbedded>-1){ \r
-           \r
-           embeddedJet = dynamic_cast<AliAODJet*>(fJetsEmbedded->At(indexEmbedded));\r
-           if(!embeddedJet) continue;\r
-\r
-           Double_t deltaPt = jet->Pt() - embeddedJet->Pt();\r
-           Double_t deltaR  = jet->DeltaR((AliVParticle*) (embeddedJet)); \r
-           \r
-           fh2DeltaPtVsJetPtEmbedded->Fill(embeddedJet->Pt(),deltaPt);\r
-           fh2DeltaPtVsRecJetPtEmbedded->Fill(jet->Pt(),deltaPt);\r
-           fh1DeltaREmbedded->Fill(deltaR);\r
-         }\r
-       }\r
-\r
-       // get tracks in jet\r
-       TList* jettracklist = new TList();\r
-       Double_t sumPt      = 0.;\r
-       Bool_t isBadJet     = kFALSE;\r
-\r
-       if(GetFFRadius()<=0){\r
-         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);\r
-       } else {\r
-         if(fUseEmbeddedJetAxis){\r
-           if(embeddedJet) GetJetTracksPointing(fTracksRecCuts, jettracklist, embeddedJet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);\r
-         }\r
-         else              GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);\r
-       }\r
-       \r
-       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;\r
-       \r
-       if(isBadJet) continue; \r
-\r
-       if(ptFractionEmbedded>=fCutFractionPtEmbedded){ // if no embedding: ptFraction = cutFraction = 0\r
-         \r
-         for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
-\r
-           AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));\r
-           if(!trackVP)continue;\r
-\r
-            AliAODTrack * aodtrack  = dynamic_cast<AliAODTrack*>(jettracklist->At(it));\r
-            if(!aodtrack) continue;\r
-\r
-           TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-           \r
-           Float_t jetPt   = jet->Pt();\r
-           if(fUseEmbeddedJetPt){\r
-             if(embeddedJet) jetPt = embeddedJet->Pt();\r
-             else jetPt = 0;\r
-           }\r
-           Float_t trackPt = trackV->Pt();\r
-\r
-\r
-           Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-           \r
-           if(fFFMode) fFFHistosRecCuts->FillFF(trackPt, jetPt, incrementJetPt);\r
-\r
-           delete trackV;\r
-         }\r
-         \r
-         // background ff\r
-         if(fBckgMode){\r
-           if(fBckgType[0]!=kBckgNone)\r
-             FillBckgHistos(fBckgType[0], fTracksRecCuts, fJetsRecCuts, jet,  \r
-                            fFFBckgHisto0RecCuts,fQABckgHisto0RecCuts, fh1BckgMult0);\r
-           if(fBckgType[1]!=kBckgNone)\r
-             FillBckgHistos(fBckgType[1], fTracksRecCuts, fJetsRecCuts, jet,\r
-                            fFFBckgHisto1RecCuts,fQABckgHisto1RecCuts, fh1BckgMult1);\r
-           if(fBckgType[2]!=kBckgNone)\r
-             FillBckgHistos(fBckgType[2], fTracksRecCuts, fJetsRecCuts, jet, \r
-                            fFFBckgHisto2RecCuts,fQABckgHisto2RecCuts, fh1BckgMult1);\r
-           if(fBckgType[3]!=kBckgNone)\r
-             FillBckgHistos(fBckgType[3], fTracksRecCuts, fJetsRecCuts, jet, \r
-                            fFFBckgHisto3RecCuts,fQABckgHisto3RecCuts, fh1BckgMult2);\r
-           if(fBckgType[4]!=kBckgNone)\r
-             FillBckgHistos(fBckgType[4], fTracksRecCuts, fJetsRecCuts, jet, \r
-                            fFFBckgHisto4RecCuts,fQABckgHisto4RecCuts, fh1BckgMult3);\r
-         } // end if(fBckgMode)\r
-        \r
-\r
-         if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJet, fProDelRPtSum, fProDelR80pcPt);\r
-          \r
-         delete jettracklist;  \r
-\r
-       } // end: cut embedded ratio\r
-      } // end: leading jet\r
-    } // end: rec. jets after cuts\r
-    \r
-    // generated jets\r
-    for(Int_t ij=0; ij<nGenJets; ++ij){\r
-      \r
-      AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));\r
-      if(!jet)continue;\r
-      if(fQAMode&2) fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
-      \r
-      if(ij==0){ // leading jet\r
-       \r
-       if(fQAMode&2) fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
-\r
-       TList* jettracklist = new TList();\r
-       Double_t sumPt      = 0.;\r
-       Bool_t isBadJet     = kFALSE;\r
-       \r
-       if(GetFFRadius()<=0){\r
-         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);\r
-       } else {\r
-         GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);\r
-       }\r
-       \r
-       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;;\r
-       if(isBadJet) continue; \r
-\r
-       for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
-         \r
-         AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));\r
-         if(!trackVP)continue;\r
-         TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-         \r
-         Float_t jetPt   = jet->Pt();\r
-         Float_t trackPt = trackV->Pt();\r
-         \r
-         Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-         \r
-         if(fFFMode) fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt );\r
-         \r
-         delete trackV;\r
-       }\r
-\r
-       if(fBckgMode){\r
-         if(fBckgType[0]!=kBckgNone)\r
-           FillBckgHistos(fBckgType[0], fTracksGen, fJetsGen, jet,\r
-                          fFFBckgHisto0Gen, fQABckgHisto0Gen);\r
-         if(fBckgType[1]!=kBckgNone)\r
-           FillBckgHistos(fBckgType[1], fTracksGen, fJetsGen, jet,\r
-                          fFFBckgHisto1Gen, fQABckgHisto1Gen);\r
-         if(fBckgType[2]!=kBckgNone)\r
-           FillBckgHistos(fBckgType[2], fTracksGen, fJetsGen, jet,\r
-                          fFFBckgHisto2Gen, fQABckgHisto2Gen);\r
-         if(fBckgType[3]!=kBckgNone)\r
-           FillBckgHistos(fBckgType[3], fTracksGen, fJetsGen, jet,\r
-                          fFFBckgHisto3Gen, fQABckgHisto3Gen);\r
-         if(fBckgType[4]!=kBckgNone)\r
-           FillBckgHistos(fBckgType[4], fTracksGen, fJetsGen, jet,\r
-                          fFFBckgHisto4Gen, fQABckgHisto4Gen);\r
-       } // end if(fBckgMode)\r
-       \r
-\r
-       if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJetGen, fProDelRPtSumGen, fProDelR80pcPtGen);\r
-\r
-       delete jettracklist;\r
-      }\r
-    }\r
-  } // end: QA, FF and intra-jet\r
-\r
-      \r
-  // ____ efficiency _______________________________\r
-\r
-  if(fEffMode && (fJetTypeRecEff != kJetsUndef)){\r
-\r
-    // arrays holding for each generated particle the reconstructed AOD track index & isPrimary flag, are initialized in AssociateGenRec(...) function\r
-    TArrayI indexAODTr; \r
-    TArrayS isGenPrim; \r
-\r
-    // array holding for each reconstructed AOD track generated particle index, initialized in AssociateGenRec(...) function\r
-    TArrayI indexMCTr; \r
-\r
-    // ... and another set for secondaries from strange/non strange mothers (secondary MC tracks are stored in different lists)\r
-    TArrayI indexAODTrSecNS; \r
-    TArrayS isGenSecNS; \r
-    TArrayI indexMCTrSecNS; \r
-   \r
-    TArrayI indexAODTrSecS; \r
-    TArrayS isGenSecS; \r
-    TArrayI indexMCTrSecS; \r
-\r
-    Int_t  nTracksAODMCCharged = GetListOfTracks(fTracksAODMCCharged, kTrackAODMCCharged);\r
-    if(fDebug>2)Printf("%s:%d selected AODMC tracks: %d ",(char*)__FILE__,__LINE__,nTracksAODMCCharged);\r
-  \r
-    Int_t  nTracksAODMCChargedSecNS = GetListOfTracks(fTracksAODMCChargedSecNS, kTrackAODMCChargedSecNS);\r
-    if(fDebug>2)Printf("%s:%d selected AODMC secondary tracks NS: %d ",(char*)__FILE__,__LINE__,nTracksAODMCChargedSecNS);\r
-  \r
-    Int_t  nTracksAODMCChargedSecS = GetListOfTracks(fTracksAODMCChargedSecS, kTrackAODMCChargedSecS);\r
-    if(fDebug>2)Printf("%s:%d selected AODMC secondary tracks S: %d ",(char*)__FILE__,__LINE__,nTracksAODMCChargedSecS);\r
-\r
-    Int_t  nTracksRecQualityCuts = GetListOfTracks(fTracksRecQualityCuts, kTrackAODQualityCuts);\r
-    if(fDebug>2)Printf("%s:%d selected rec tracks quality after cuts, full acceptance/pt : %d ",(char*)__FILE__,__LINE__,nTracksRecQualityCuts);\r
-  \r
-    // associate gen and rec tracks, store indices in TArrays \r
-    AssociateGenRec(fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,indexMCTr,isGenPrim,fh2PtRecVsGenPrim); \r
-    AssociateGenRec(fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,indexMCTrSecNS,isGenSecNS,fh2PtRecVsGenSec);\r
-    AssociateGenRec(fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,indexMCTrSecS,isGenSecS,fh2PtRecVsGenSec);\r
-  \r
-    // single track eff\r
-    if(fQAMode&1) FillSingleTrackHistosRecGen(fQATrackHistosRecEffGen,fQATrackHistosRecEffRec,fTracksAODMCCharged,indexAODTr,isGenPrim);\r
-\r
-    // secondaries\r
-    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecNS,fTracksAODMCChargedSecNS,indexAODTrSecNS,isGenSecNS);\r
-    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecS,fTracksAODMCChargedSecS,indexAODTrSecS,isGenSecS);\r
-    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecSsc,fTracksAODMCChargedSecS,indexAODTrSecS,isGenSecS,kTRUE);\r
-\r
-\r
-    // jet track eff    \r
-    Double_t sumPtGenLeadingJetRecEff = 0;\r
-    Double_t sumPtGenLeadingJetSec    = 0;\r
-    Double_t sumPtRecLeadingJetRecEff = 0;\r
-    \r
-    for(Int_t ij=0; ij<nRecEffJets; ++ij){ // jet loop \r
-    \r
-      AliAODJet* jet = (AliAODJet*)(fJetsRecEff->At(ij));\r
-\r
-      Bool_t isBadJetGenPrim = kFALSE;\r
-      Bool_t isBadJetGenSec  = kFALSE;\r
-      Bool_t isBadJetRec     = kFALSE;\r
-    \r
-\r
-      if(ij==0){ // leading jet\r
-       \r
-       // for efficiency: gen tracks from pointing with gen/rec jet\r
-       TList* jettracklistGenPrim = new TList();\r
-       \r
-       // if radius<0 -> trackRefs: collect gen tracks in wide radius + fill FF recEff rec histos with tracks contained in track refs\r
-        // note : FF recEff gen histos will be somewhat useless in this approach\r
-\r
-       if(GetFFRadius() >0)\r
-         GetJetTracksPointing(fTracksAODMCCharged, jettracklistGenPrim, jet, GetFFRadius(), sumPtGenLeadingJetRecEff, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetGenPrim); \r
-       else\r
-         GetJetTracksPointing(fTracksAODMCCharged, jettracklistGenPrim, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetRecEff, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetGenPrim); \r
-\r
-       TList* jettracklistGenSecNS = new TList();\r
-       if(GetFFRadius() >0)\r
-         GetJetTracksPointing(fTracksAODMCChargedSecNS, jettracklistGenSecNS, jet, GetFFRadius(), sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); \r
-        else\r
-         GetJetTracksPointing(fTracksAODMCChargedSecNS, jettracklistGenSecNS, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); \r
-\r
-       TList* jettracklistGenSecS = new TList();\r
-       if(GetFFRadius() >0)\r
-         GetJetTracksPointing(fTracksAODMCChargedSecS, jettracklistGenSecS, jet, GetFFRadius(), sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); \r
-        else\r
-         GetJetTracksPointing(fTracksAODMCChargedSecS, jettracklistGenSecS, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); \r
-\r
-\r
-       // bin efficiency in jet pt bins using rec tracks  \r
-       TList* jettracklistRec = new TList();\r
-       if(GetFFRadius() >0) GetJetTracksPointing(fTracksRecCuts,jettracklistRec, jet, GetFFRadius(), sumPtRecLeadingJetRecEff, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetRec); \r
-       else                 GetJetTracksTrackrefs(jettracklistRec, jet, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetRec); \r
-       \r
-\r
-       Double_t jetEta   = jet->Eta();\r
-       Double_t jetPhi   = TVector2::Phi_0_2pi(jet->Phi());\r
-       \r
-       if(GetFFMinNTracks()>0 && jettracklistGenPrim->GetSize()<=GetFFMinNTracks())   isBadJetGenPrim = kTRUE;\r
-       if(GetFFMinNTracks()>0 && jettracklistGenSecNS->GetSize()<=GetFFMinNTracks())  isBadJetGenSec  = kTRUE;\r
-       if(GetFFMinNTracks()>0 && jettracklistRec->GetSize()<=GetFFMinNTracks())       isBadJetRec     = kTRUE;\r
-\r
-       if(isBadJetRec) continue;\r
-\r
-       if(fQAMode&2) fQAJetHistosRecEffLeading->FillJetQA( jetEta, jetPhi, sumPtGenLeadingJetRecEff ); \r
-       \r
-       if(fFFMode){\r
-         \r
-         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosRecEffRec,jet,\r
-                                                   jettracklistGenPrim,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim, \r
-                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecPrim,fProDelRPtSumRecPrim,fProDelR80pcPtRecPrim); \r
-         \r
-          else                FillJetTrackHistosRec(fFFHistosRecEffRec,jet,\r
-                                                   jettracklistGenPrim,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim,\r
-                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecPrim,fProDelRPtSumRecPrim,fProDelR80pcPtRecPrim); \r
-         \r
-\r
-         // secondaries: use jet pt from primaries \r
-         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecNS,jet,\r
-                                                   jettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts, indexAODTrSecNS,isGenSecNS,\r
-                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecSecNS,fProDelRPtSumRecSecNS); \r
-         \r
-         else                FillJetTrackHistosRec(fFFHistosSecRecNS,jet,\r
-                                                   jettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,isGenSecNS,\r
-                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecSecNS,fProDelRPtSumRecSecNS);  \r
-         \r
-         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecS,jet,\r
-                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,\r
-                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecSecS,fProDelRPtSumRecSecS); \r
-\r
-         else                FillJetTrackHistosRec(fFFHistosSecRecS,jet,\r
-                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,\r
-                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecSecS,fProDelRPtSumRecSecS);  \r
-         \r
-         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecSsc,jet,\r
-                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,\r
-                                                   0,kTRUE,fJSMode,fProNtracksLeadingJetRecSecSsc,fProDelRPtSumRecSecSsc); \r
-         \r
-         else                FillJetTrackHistosRec(fFFHistosSecRecSsc,jet,\r
-                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,\r
-                                                   jettracklistRec,kTRUE,fJSMode,fProNtracksLeadingJetRecSecSsc,fProDelRPtSumRecSecSsc);\r
-        }\r
-       \r
-       delete jettracklistGenPrim;\r
-       delete jettracklistGenSecNS;\r
-       delete jettracklistGenSecS;\r
-       delete jettracklistRec;\r
-      \r
-      \r
-        if(fBckgMode && fFFMode){ \r
-\r
-         TList* perpjettracklistGen  = new TList();\r
-         TList* perpjettracklistGen1 = new TList();\r
-         TList* perpjettracklistGen2 = new TList();\r
-\r
-         Double_t sumPtGenPerp  = 0.;\r
-         Double_t sumPtGenPerp1 = 0.;\r
-         Double_t sumPtGenPerp2 = 0.;\r
-         GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp1); \r
-         GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp2); \r
-\r
-         perpjettracklistGen->AddAll(perpjettracklistGen1);\r
-         perpjettracklistGen->AddAll(perpjettracklistGen2);\r
-         sumPtGenPerp = 0.5*(sumPtGenPerp1+sumPtGenPerp2);\r
-\r
-         TList* perpjettracklistGenSecNS  = new TList();\r
-         TList* perpjettracklistGenSecNS1 = new TList();\r
-         TList* perpjettracklistGenSecNS2 = new TList();\r
-\r
-          Double_t sumPtGenPerpNS;\r
-          Double_t sumPtGenPerpNS1;\r
-          Double_t sumPtGenPerpNS2;\r
-          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS1); \r
-          GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS2); \r
-\r
-         perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS1);\r
-         perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS2);\r
-         sumPtGenPerpNS = 0.5*(sumPtGenPerpNS1+sumPtGenPerpNS2);\r
-\r
-\r
-         TList* perpjettracklistGenSecS  = new TList();\r
-         TList* perpjettracklistGenSecS1 = new TList();\r
-         TList* perpjettracklistGenSecS2 = new TList();\r
-\r
-          Double_t sumPtGenPerpS;\r
-          Double_t sumPtGenPerpS1;\r
-          Double_t sumPtGenPerpS2;\r
-          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS1); \r
-          GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS2); \r
-\r
-         perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS1);\r
-         perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS2);\r
-         sumPtGenPerpS = 0.5*(sumPtGenPerpS1+sumPtGenPerpS2);\r
-\r
-\r
-          if(perpjettracklistGen->GetSize() != perpjettracklistGen1->GetSize() + perpjettracklistGen2->GetSize()){\r
-           cout<<" ERROR: perpjettracklistGen size "<<perpjettracklistGen->GetSize()<<" perp1 "<<perpjettracklistGen1->GetSize()\r
-               <<" perp2 "<<perpjettracklistGen2->GetSize()<<endl;\r
-            exit(0); \r
-          }\r
-\r
-          if(perpjettracklistGenSecNS->GetSize() != perpjettracklistGenSecNS1->GetSize() + perpjettracklistGenSecNS2->GetSize()){\r
-           cout<<" ERROR: perpjettracklistGenSecNS size "<<perpjettracklistGenSecNS->GetSize()<<" perp1 "<<perpjettracklistGenSecNS1->GetSize()\r
-               <<" perp2 "<<perpjettracklistGenSecNS2->GetSize()<<endl;\r
-            exit(0); \r
-          }\r
-\r
-          if(perpjettracklistGenSecS->GetSize() != perpjettracklistGenSecS1->GetSize() + perpjettracklistGenSecS2->GetSize()){\r
-           cout<<" ERROR: perpjettracklistGenSecS size "<<perpjettracklistGenSecS->GetSize()<<" perp1 "<<perpjettracklistGenSecS1->GetSize()\r
-               <<" perp2 "<<perpjettracklistGenSecS2->GetSize()<<endl;\r
-            exit(0); \r
-          }\r
-\r
-\r
-         FillJetTrackHistosRec(fFFBckgHisto0RecEffRec,jet,\r
-                               perpjettracklistGen,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim); \r
-         \r
-         FillJetTrackHistosRec(fFFBckgHisto0SecRecNS,jet,\r
-                               perpjettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,isGenSecNS); \r
-         \r
-         FillJetTrackHistosRec(fFFBckgHisto0SecRecS,jet,\r
-                               perpjettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS); \r
-         \r
-         FillJetTrackHistosRec(fFFBckgHisto0SecRecSsc,jet,\r
-                               perpjettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,0,kTRUE); \r
-         \r
-         \r
-         delete perpjettracklistGen;\r
-         delete perpjettracklistGen1;\r
-         delete perpjettracklistGen2;\r
-\r
-         delete perpjettracklistGenSecNS;\r
-         delete perpjettracklistGenSecNS1;\r
-         delete perpjettracklistGenSecNS2;\r
-\r
-         delete perpjettracklistGenSecS;\r
-         delete perpjettracklistGenSecS1;\r
-         delete perpjettracklistGenSecS2;\r
-         \r
-       }\r
-      }\r
-    }\r
-  }\r
-  \r
-  //___________________\r
-  \r
-  fTracksRecCuts->Clear();\r
-  fTracksGen->Clear();\r
-  fTracksAODMCCharged->Clear();\r
-  fTracksAODMCChargedSecNS->Clear();\r
-  fTracksAODMCChargedSecS->Clear();\r
-  fTracksRecQualityCuts->Clear();\r
-\r
-  fJetsRec->Clear();\r
-  fJetsRecCuts->Clear();\r
-  fJetsGen->Clear();\r
-  fJetsRecEff->Clear();\r
-  fJetsEmbedded->Clear();\r
-\r
-\r
-  if(fBckgMode && \r
-     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||\r
-      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || \r
-      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){\r
-    \r
-    fBckgJetsRec->Clear();\r
-    fBckgJetsRecCuts->Clear();\r
-    fBckgJetsGen->Clear();\r
-  }\r
-\r
-  \r
-  //Post output data.\r
-  PostData(1, fCommonHistList);\r
-}\r
-\r
-//______________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::Terminate(Option_t *) \r
-{\r
-  // terminated\r
-\r
-  if(fDebug > 1) printf("AliAnalysisTaskFragmentationFunction::Terminate() \n");\r
-}  \r
-\r
-//_________________________________________________________________________________\r
-Int_t AliAnalysisTaskFragmentationFunction::GetListOfTracks(TList *list, Int_t type)\r
-{\r
-  // fill list of tracks selected according to type\r
-\r
-  if(fDebug > 2) Printf("%s:%d Selecting tracks with %d", (char*)__FILE__,__LINE__,type);\r
-  \r
-  if(!list){\r
-    if(fDebug>1) Printf("%s:%d no input list", (char*)__FILE__,__LINE__);\r
-    return -1;\r
-  }\r
-\r
-  if(!fAOD) return -1;\r
-\r
-  if(!fAOD->GetTracks()) return 0;\r
-\r
-  if(type==kTrackUndef) return 0;\r
-  \r
-  Int_t iCount = 0;\r
-\r
-  if(type==kTrackAODExtraCuts || type==kTrackAODExtraonlyCuts || type==kTrackAODExtra || type==kTrackAODExtraonly){\r
-    \r
-    TClonesArray *aodExtraTracks = dynamic_cast<TClonesArray*>(fAOD->FindListObject("aodExtraTracks"));\r
-    if(!aodExtraTracks)return iCount;\r
-    for(int it =0; it<aodExtraTracks->GetEntries(); it++) {\r
-      AliVParticle *track = dynamic_cast<AliVParticle*> ((*aodExtraTracks)[it]);\r
-      if (!track) continue;\r
-      \r
-      AliAODTrack *tr = dynamic_cast<AliAODTrack*> (track);\r
-      if(!tr)continue;\r
-\r
-      if(type==kTrackAODExtraCuts || type==kTrackAODExtraonlyCuts){\r
-\r
-       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;\r
-       \r
-       if(tr->Eta() < fTrackEtaMin || tr->Eta() > fTrackEtaMax) continue;\r
-       if(tr->Phi() < fTrackPhiMin || tr->Phi() > fTrackPhiMax) continue;\r
-       if(tr->Pt()  < fTrackPtCut) continue;\r
-      }    \r
-\r
-      list->Add(tr);\r
-      iCount++;\r
-    }\r
-  }\r
-\r
-  if(type==kTrackAODCuts || type==kTrackAODQualityCuts || type==kTrackAOD || type==kTrackAODExtraCuts || type==kTrackAODExtra){\r
-\r
-    // all rec. tracks, esd filter mask, eta range\r
-    \r
-    for(Int_t it=0; it<fAOD->GetNumberOfTracks(); ++it){\r
-      AliAODTrack *tr = fAOD->GetTrack(it);\r
-      \r
-      if(type == kTrackAODCuts || type==kTrackAODQualityCuts || type==kTrackAODExtraCuts){\r
-\r
-       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;\r
-       if(type == kTrackAODCuts){\r
-         if(tr->Eta() < fTrackEtaMin || tr->Eta() > fTrackEtaMax) continue;\r
-         if(tr->Phi() < fTrackPhiMin || tr->Phi() > fTrackPhiMax) continue;\r
-         if(tr->Pt()  < fTrackPtCut) continue;\r
-       }\r
-      }\r
-      list->Add(tr);\r
-      iCount++;\r
-    }\r
-  }\r
-  else if (type==kTrackKineAll || type==kTrackKineCharged || type==kTrackKineChargedAcceptance){\r
-    // kine particles, all or rather charged\r
-    if(!fMCEvent) return iCount;\r
-    \r
-    for(Int_t it=0; it<fMCEvent->GetNumberOfTracks(); ++it){\r
-      AliMCParticle* part = (AliMCParticle*) fMCEvent->GetTrack(it);\r
-      \r
-      if(type == kTrackKineCharged || type == kTrackKineChargedAcceptance){\r
-       if(part->Charge()==0) continue;\r
-       \r
-       if(type == kTrackKineChargedAcceptance && \r
-          (       part->Eta() < fTrackEtaMin\r
-               || part->Eta() > fTrackEtaMax\r
-               || part->Phi() < fTrackPhiMin\r
-               || part->Phi() > fTrackPhiMax \r
-               || part->Pt()  < fTrackPtCut)) continue;\r
-      }\r
-      \r
-      list->Add(part);\r
-      iCount++;\r
-    }\r
-  }\r
-  else if (type==kTrackAODMCCharged || type==kTrackAODMCAll || type==kTrackAODMCChargedAcceptance || type==kTrackAODMCChargedSecNS || type==kTrackAODMCChargedSecS)  {\r
-    // MC particles (from AOD), physical primaries, all or rather charged or rather charged within acceptance\r
-    if(!fAOD) return -1;\r
-    \r
-    TClonesArray *tca = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
-    if(!tca)return iCount;\r
-    \r
-    for(int it=0; it<tca->GetEntriesFast(); ++it){\r
-      AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));\r
-      if(!part)continue;\r
-      if(type != kTrackAODMCChargedSecNS && type != kTrackAODMCChargedSecS  && !part->IsPhysicalPrimary())continue;\r
-      if((type == kTrackAODMCChargedSecNS || type == kTrackAODMCChargedSecS) && part->IsPhysicalPrimary())continue;\r
-\r
-      if (type==kTrackAODMCCharged || type==kTrackAODMCChargedAcceptance || type==kTrackAODMCChargedSecNS || type==kTrackAODMCChargedSecS){\r
-       if(part->Charge()==0) continue;\r
-\r
-       if(type==kTrackAODMCChargedSecNS || type==kTrackAODMCChargedSecS){\r
-         Bool_t isFromStrange = kFALSE;\r
-         Int_t iMother = part->GetMother();\r
-         if(iMother >= 0){\r
-           AliAODMCParticle *partM = dynamic_cast<AliAODMCParticle*>(tca->At(iMother));\r
-           Int_t codeM = -1;\r
-           if(partM) codeM = TMath::Abs(partM->GetPdgCode());\r
-           Int_t mfl = Int_t (codeM/ TMath::Power(10, Int_t(TMath::Log10(codeM))));\r
-           if  (mfl == 3 && codeM != 3) isFromStrange = kTRUE;\r
-           \r
-\r
-           // if(mfl ==3){\r
-           //   cout<<" mfl "<<mfl<<" codeM "<<partM->GetPdgCode()<<" code this track "<<part->GetPdgCode()<<endl; \r
-           //   cout<<" index this track "<<it<<" index daughter 0 "<<partM->GetDaughter(0)<<" 1 "<<partM->GetDaughter(1)<<endl; \r
-           // }\r
-\r
-           if(type==kTrackAODMCChargedSecNS && isFromStrange) continue;\r
-           if(type==kTrackAODMCChargedSecS  && !isFromStrange) continue;\r
-         }\r
-       }\r
-\r
-       if(type==kTrackAODMCChargedAcceptance && \r
-          (     part->Eta() > fTrackEtaMax\r
-             || part->Eta() < fTrackEtaMin\r
-             || part->Phi() > fTrackPhiMax\r
-             || part->Phi() < fTrackPhiMin\r
-             || part->Pt()  < fTrackPtCut)) continue;\r
-      }\r
-      \r
-      list->Add(part);\r
-      iCount++;\r
-    }\r
-  }\r
-  \r
-  list->Sort();\r
-  return iCount;\r
-  \r
-}\r
-// _______________________________________________________________________________\r
-Int_t AliAnalysisTaskFragmentationFunction::GetListOfJets(TList *list, Int_t type)\r
-{\r
-  // fill list of jets selected according to type\r
-\r
-  if(!list){\r
-    if(fDebug>1) Printf("%s:%d no input list", (char*)__FILE__,__LINE__);\r
-    return -1;\r
-  }\r
-\r
-  if(type == kJetsRec || type == kJetsRecAcceptance){ // reconstructed jets\r
-\r
-    if(fBranchRecJets.Length()==0){\r
-      Printf("%s:%d no rec jet branch specified", (char*)__FILE__,__LINE__);\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-\r
-    TClonesArray *aodRecJets = 0; \r
-    if(fBranchRecJets.Length())      aodRecJets = dynamic_cast<TClonesArray*>(fAODJets->FindListObject(fBranchRecJets.Data()));\r
-    if(!aodRecJets)                  aodRecJets = dynamic_cast<TClonesArray*>(fAODJets->GetList()->FindObject(fBranchRecJets.Data()));\r
-    if(fAODExtension&&!aodRecJets)   aodRecJets = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fBranchRecJets.Data()));\r
-\r
-    if(!aodRecJets){\r
-      if(fBranchRecJets.Length()) Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fBranchRecJets.Data());\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-\r
-    // Reorder jet pt and fill new temporary AliAODJet objects\r
-    Int_t nRecJets = 0;\r
-    \r
-    for(Int_t ij=0; ij<aodRecJets->GetEntries(); ++ij){\r
-\r
-      AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodRecJets->At(ij));\r
-      if(!tmp) continue;\r
-\r
-      if( tmp->Pt() < fJetPtCut ) continue;\r
-      if( type == kJetsRecAcceptance &&\r
-         (    tmp->Eta() < fJetEtaMin\r
-           || tmp->Eta() > fJetEtaMax\r
-           || tmp->Phi() < fJetPhiMin\r
-           || tmp->Phi() > fJetPhiMax )) continue;\r
-\r
\r
-      list->Add(tmp);\r
-      nRecJets++; \r
-    }\r
-    \r
-    list->Sort();\r
-    \r
-    return nRecJets;\r
-  }\r
-  else if(type == kJetsKine || type == kJetsKineAcceptance){\r
-    \r
-    // generated jets\r
-    Int_t nGenJets = 0;\r
-    \r
-    if(!fMCEvent){\r
-      if(fDebug>1) Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__);\r
-      return 0;\r
-    }\r
-   \r
-    AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();\r
-    AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);\r
-    AliGenHijingEventHeader*  hijingGenHeader = 0x0;\r
-\r
-    if(!pythiaGenHeader){\r
-      hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);\r
-      \r
-      if(!hijingGenHeader){\r
-         Printf("%s:%d no pythiaGenHeader or hijingGenHeader found", (char*)__FILE__,__LINE__);\r
-         return 0;\r
-      }else{\r
-         TLorentzVector mom[4];\r
-         AliAODJet* jet[4];\r
-         hijingGenHeader->GetJets(mom[0], mom[1], mom[2], mom[3]);\r
-\r
-         for(Int_t i=0; i<2; ++i){\r
-           if(!mom[i].Pt()) continue;\r
-            jet[i] = new AliAODJet(mom[i]);\r
-\r
-            if( type == kJetsKineAcceptance &&\r
-                (    jet[i]->Eta() < fJetEtaMin\r
-                  || jet[i]->Eta() > fJetEtaMax\r
-                  || jet[i]->Phi() < fJetPhiMin\r
-                  || jet[i]->Phi() > fJetPhiMax )) continue;\r
-\r
-           list->Add(jet[i]);\r
-           nGenJets++;\r
-        }\r
-        list->Sort();\r
-         return nGenJets;\r
-      }\r
-    }\r
-    \r
-    // fetch the pythia generated jets\r
-    for(int ip=0; ip<pythiaGenHeader->NTriggerJets(); ++ip){\r
-      \r
-      Float_t p[4];\r
-      AliAODJet *jet = new AliAODJet();\r
-      pythiaGenHeader->TriggerJet(ip, p);\r
-      jet->SetPxPyPzE(p[0], p[1], p[2], p[3]);\r
-\r
-      if( type == kJetsKineAcceptance &&\r
-          (    jet->Eta() < fJetEtaMin\r
-            || jet->Eta() > fJetEtaMax\r
-            || jet->Phi() < fJetPhiMin\r
-            || jet->Phi() > fJetPhiMax )) continue;\r
-      \r
-       list->Add(jet);\r
-       nGenJets++;\r
-    }\r
-    list->Sort();\r
-    return nGenJets;\r
-  }\r
-  else if(type == kJetsGen || type == kJetsGenAcceptance ){\r
-\r
-    if(fBranchGenJets.Length()==0){\r
-      if(fDebug>1) Printf("%s:%d no gen jet branch specified", (char*)__FILE__,__LINE__);\r
-      return 0;\r
-    }\r
-    \r
-    TClonesArray *aodGenJets = 0;\r
-    if(fBranchGenJets.Length()) aodGenJets = dynamic_cast<TClonesArray*>(fAODJets->FindListObject(fBranchGenJets.Data()));\r
-    if(!aodGenJets)             aodGenJets = dynamic_cast<TClonesArray*>(fAODJets->GetList()->FindObject(fBranchGenJets.Data()));\r
-    if(fAODExtension&&!aodGenJets)   aodGenJets = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fBranchGenJets.Data()));\r
-\r
-    if(!aodGenJets){\r
-      if(fDebug>0){\r
-       if(fBranchGenJets.Length()) Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGenJets.Data());\r
-      }\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-\r
-    Int_t nGenJets = 0;\r
-    \r
-    for(Int_t ig=0; ig<aodGenJets->GetEntries(); ++ig){\r
-         \r
-      AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodGenJets->At(ig));\r
-      if(!tmp) continue;\r
-         \r
-      if( tmp->Pt() < fJetPtCut ) continue;\r
-      if( type == kJetsGenAcceptance &&\r
-         (    tmp->Eta() < fJetEtaMin\r
-           || tmp->Eta() > fJetEtaMax\r
-           || tmp->Phi() < fJetPhiMin\r
-           || tmp->Phi() > fJetPhiMax )) continue;\r
-      \r
-       list->Add(tmp);\r
-       nGenJets++;\r
-    }\r
-    list->Sort();\r
-    return nGenJets;\r
-  } \r
-  else if(type == kJetsEmbedded){ // embedded jets\r
-\r
-    if(fBranchEmbeddedJets.Length()==0){\r
-      Printf("%s:%d no embedded jet branch specified", (char*)__FILE__,__LINE__);\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-\r
-    TClonesArray *aodEmbeddedJets = 0; \r
-    if(fBranchEmbeddedJets.Length())      aodEmbeddedJets = dynamic_cast<TClonesArray*>(fAODJets->FindListObject(fBranchEmbeddedJets.Data()));\r
-    if(!aodEmbeddedJets)                  aodEmbeddedJets = dynamic_cast<TClonesArray*>(fAODJets->GetList()->FindObject(fBranchEmbeddedJets.Data()));\r
-    if(fAODExtension&&!aodEmbeddedJets)   aodEmbeddedJets = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fBranchEmbeddedJets.Data()));\r
-\r
-    if(!aodEmbeddedJets){\r
-      if(fBranchEmbeddedJets.Length()) Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fBranchEmbeddedJets.Data());\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-\r
-    // Reorder jet pt and fill new temporary AliAODJet objects\r
-    Int_t nEmbeddedJets = 0;\r
-    \r
-    for(Int_t ij=0; ij<aodEmbeddedJets->GetEntries(); ++ij){\r
-\r
-      AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodEmbeddedJets->At(ij));\r
-      if(!tmp) continue;\r
-\r
-      if( tmp->Pt() < fJetPtCut ) continue;\r
-      if(    tmp->Eta() < fJetEtaMin\r
-         || tmp->Eta() > fJetEtaMax\r
-         || tmp->Phi() < fJetPhiMin\r
-          || tmp->Phi() > fJetPhiMax ) continue;\r
-      \r
-      list->Add(tmp);\r
-      nEmbeddedJets++;\r
-    }\r
-    \r
-    list->Sort();\r
-    \r
-    return nEmbeddedJets;\r
-  }\r
-  else{\r
-    if(fDebug>0)Printf("%s:%d no such type %d",(char*)__FILE__,__LINE__,type);\r
-    return 0;\r
-  }\r
-}\r
-\r
-// ___________________________________________________________________________________\r
-Int_t AliAnalysisTaskFragmentationFunction::GetListOfBckgJets(TList *list, Int_t type)  \r
-{\r
-  // fill list of bgr clusters selected according to type\r
-\r
-  if(type == kJetsRec || type == kJetsRecAcceptance){ // reconstructed jets\r
-\r
-    if(fBranchRecBckgClusters.Length()==0){ \r
-      Printf("%s:%d no rec jet branch specified", (char*)__FILE__,__LINE__);\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-    \r
-    TClonesArray *aodRecJets = 0; \r
-    if(fBranchRecBckgClusters.Length()) aodRecJets = dynamic_cast<TClonesArray*>(fAODJets->FindListObject(fBranchRecBckgClusters.Data()));\r
-    if(!aodRecJets)                     aodRecJets = dynamic_cast<TClonesArray*>(fAODJets->GetList()->FindObject(fBranchRecBckgClusters.Data()));\r
-    if(fAODExtension&&!aodRecJets)      aodRecJets = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fBranchRecBckgClusters.Data()));    \r
-\r
-    if(!aodRecJets){\r
-      if(fBranchRecBckgClusters.Length()) Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fBranchRecBckgClusters.Data());\r
-      if(fDebug>1)fAOD->Print();\r
-      return 0;\r
-    }\r
-    \r
-    // Reorder jet pt and fill new temporary AliAODJet objects\r
-    Int_t nRecJets = 0;\r
-    \r
-    for(Int_t ij=0; ij<aodRecJets->GetEntries(); ++ij){\r
-      \r
-      AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodRecJets->At(ij));\r
-      if(!tmp) continue;\r
-\r
-      // if( tmp->Pt() < fJetPtCut ) continue; // no pt cut on bckg clusters !\r
-      if( type == kJetsRecAcceptance &&\r
-                 (    tmp->Eta() < fJetEtaMin\r
-              || tmp->Eta() > fJetEtaMax\r
-              || tmp->Phi() < fJetPhiMin\r
-              || tmp->Phi() > fJetPhiMax )) continue;\r
-            \r
-      list->Add(tmp);\r
-       \r
-      nRecJets++;\r
-      \r
-    }\r
-    \r
-    list->Sort();\r
-    \r
-    return nRecJets;\r
-  }\r
-\r
-  //  /*\r
-  // MC clusters still Under construction\r
-  //  */\r
-\r
-  return 0;\r
-} \r
-\r
-// _________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::SetProperties(THnSparse* h,const Int_t dim, const char** labels)\r
-{\r
-  // Set properties of THnSparse \r
-\r
-  for(Int_t i=0; i<dim; i++){\r
-    h->GetAxis(i)->SetTitle(labels[i]);\r
-    h->GetAxis(i)->SetTitleColor(1);\r
-  }\r
-}\r
-\r
-// __________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, const char* y)\r
-{\r
-  //Set properties of histos (x and y title)\r
-\r
-  h->SetXTitle(x);\r
-  h->SetYTitle(y);\r
-  h->GetXaxis()->SetTitleColor(1);\r
-  h->GetYaxis()->SetTitleColor(1);\r
-}\r
-\r
-// _________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, const char* y, const char* z)\r
-{\r
-  //Set properties of histos (x,y and z title)\r
-\r
-  h->SetXTitle(x);\r
-  h->SetYTitle(y);\r
-  h->SetZTitle(z);\r
-  h->GetXaxis()->SetTitleColor(1);\r
-  h->GetYaxis()->SetTitleColor(1);\r
-  h->GetZaxis()->SetTitleColor(1);\r
-}\r
-\r
-// ________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist, TList* outputlist, const AliAODJet* jet, \r
-                                                                  const Double_t radius, Double_t& sumPt, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)\r
-{\r
-  // fill list of tracks in cone around jet axis  \r
-\r
-  sumPt = 0;\r
-  Bool_t isBadMaxPt = kFALSE;\r
-  Bool_t isBadMinPt = kTRUE;\r
-\r
-  Double_t jetMom[3];\r
-  jet->PxPyPz(jetMom);\r
-  TVector3 jet3mom(jetMom);\r
-\r
-  for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++){\r
-\r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
-    if(!track)continue;\r
-    Double_t trackMom[3];\r
-    track->PxPyPz(trackMom);\r
-    TVector3 track3mom(trackMom);\r
-\r
-    Double_t dR = jet3mom.DeltaR(track3mom);\r
-\r
-    if(dR<radius){\r
-\r
-      outputlist->Add(track);\r
-      \r
-      sumPt += track->Pt();\r
-\r
-      if(maxPt>0  && track->Pt()>maxPt)  isBadMaxPt = kTRUE;\r
-      if(minPtL>0 && track->Pt()>minPtL) isBadMinPt = kFALSE;\r
-    }\r
-  }\r
-  \r
-  isBadPt = kFALSE; \r
-  if(minPtL>0 && isBadMinPt) isBadPt = kTRUE;  \r
-  if(maxPt>0  && isBadMaxPt) isBadPt = kTRUE;  \r
-  \r
-  outputlist->Sort();\r
-}\r
-\r
-// _________________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, const AliAODJet* jet, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)\r
-{\r
-  // list of jet tracks from trackrefs\r
-  \r
-  Int_t nTracks = jet->GetRefTracks()->GetEntriesFast();\r
-\r
-  Bool_t isBadMaxPt = kFALSE;\r
-  Bool_t isBadMinPt = kTRUE;\r
-\r
-  for(Int_t itrack=0; itrack<nTracks; itrack++) {\r
-    \r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(jet->GetRefTracks()->At(itrack));\r
-    if(!track){\r
-      AliError("expected ref track not found ");\r
-      continue;\r
-    }\r
-    \r
-    if(track->Pt()  < fTrackPtCut) continue; // track refs may contain low pt cut (bug in AliFastJetInput) \r
-    if(maxPt>0 && track->Pt()>maxPt)   isBadMaxPt = kTRUE;\r
-    if(minPtL>0 && track->Pt()>minPtL) isBadMinPt = kFALSE;\r
-\r
-    list->Add(track);\r
-  }\r
-  \r
-  isBadPt = kFALSE; \r
-  if(minPtL>0 && isBadMinPt) isBadPt = kTRUE;  \r
-  if(maxPt>0 && isBadMaxPt)  isBadPt = kTRUE;  \r
-\r
-  list->Sort();\r
-}\r
-\r
-// _ ________________________________________________________________________________________________________________________________\r
-void  AliAnalysisTaskFragmentationFunction::AssociateGenRec(TList* tracksAODMCCharged,TList* tracksRec, TArrayI& indexAODTr,TArrayI& indexMCTr,\r
-                                                           TArrayS& isRefGen,TH2F* fh2PtRecVsGen)\r
-{\r
-  // associate generated and reconstructed tracks, fill TArrays of list indices\r
-\r
-  Int_t nTracksRec  = tracksRec->GetSize();\r
-  Int_t nTracksGen  = tracksAODMCCharged->GetSize();\r
-  TClonesArray *tca = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
-\r
-\r
-  if(!nTracksGen) return;\r
-  if(!tca)        return;\r
-  \r
-  // set size\r
-  indexAODTr.Set(nTracksGen);\r
-  indexMCTr.Set(nTracksRec);\r
-  isRefGen.Set(nTracksGen);\r
-\r
-  indexAODTr.Reset(-1);\r
-  indexMCTr.Reset(-1);\r
-  isRefGen.Reset(0);\r
-\r
-  // loop over reconstructed tracks, get generated track \r
-\r
-  for(Int_t iRec=0; iRec<nTracksRec; iRec++){ \r
-      \r
-    AliAODTrack* rectrack = dynamic_cast<AliAODTrack*>(tracksRec->At(iRec)); \r
-    if(!rectrack)continue;\r
-    Int_t label = TMath::Abs(rectrack->GetLabel());\r
-\r
-    // find MC track in our list\r
-    AliAODMCParticle* gentrack = dynamic_cast<AliAODMCParticle*> (tca->At(label));\r
-   \r
-    Int_t listIndex = -1;\r
-    if(gentrack) listIndex = tracksAODMCCharged->IndexOf(gentrack);\r
-\r
-    if(listIndex>=0){\r
-\r
-      indexAODTr[listIndex] = iRec;\r
-      indexMCTr[iRec]       = listIndex;\r
-    }\r
-  }\r
-\r
-\r
-  // define reference sample of primaries/secondaries (for reconstruction efficiency / contamination)\r
-\r
-  for(Int_t iGen=0; iGen<nTracksGen; iGen++){\r
-\r
-    AliAODMCParticle* gentrack =  dynamic_cast<AliAODMCParticle*> (tracksAODMCCharged->At(iGen));\r
-    if(!gentrack)continue;\r
-    Int_t pdg = gentrack->GetPdgCode();    \r
-\r
-    // 211 - pi, 2212 - proton, 321 - Kaon, 11 - electron, 13 - muon\r
-    if(TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || \r
-       TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13){\r
-      \r
-      isRefGen[iGen] = kTRUE;\r
-\r
-      Int_t iRec = indexAODTr[iGen]; // can be -1 if no good reconstructed track \r
-\r
-      if(iRec>=0){\r
-       Float_t genPt = gentrack->Pt();\r
-       AliAODTrack* vt = dynamic_cast<AliAODTrack*>(tracksRec->At(iRec)); \r
-       if(vt){\r
-         Float_t recPt = vt->Pt();\r
-         fh2PtRecVsGen->Fill(genPt,recPt);\r
-       }\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-// _____________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::FillSingleTrackHistosRecGen(AliFragFuncQATrackHistos* trackQAGen, AliFragFuncQATrackHistos* trackQARec, TList* tracksGen, \r
-                                                                      const TArrayI& indexAODTr, const TArrayS& isRefGen, const Bool_t scaleStrangeness){\r
-\r
-  // fill QA for single track reconstruction efficiency\r
-  \r
-  Int_t nTracksGen  = tracksGen->GetSize();\r
-\r
-  if(!nTracksGen) return;\r
-\r
-  for(Int_t iGen=0; iGen<nTracksGen; iGen++){\r
-\r
-    if(isRefGen[iGen] != 1) continue; // select primaries\r
-\r
-    AliAODMCParticle* gentrack =  dynamic_cast<AliAODMCParticle*> (tracksGen->At(iGen));\r
-    if(!gentrack) continue;\r
-    Double_t ptGen  = gentrack->Pt();\r
-    Double_t etaGen = gentrack->Eta();\r
-    Double_t phiGen = TVector2::Phi_0_2pi(gentrack->Phi());\r
-\r
-    // apply same acc & pt cuts as for FF \r
-\r
-    if(etaGen < fTrackEtaMin || etaGen > fTrackEtaMax) continue;\r
-    if(phiGen < fTrackPhiMin || phiGen > fTrackPhiMax) continue;\r
-    if(ptGen  < fTrackPtCut) continue;\r
-\r
-    if(trackQAGen) trackQAGen->FillTrackQA(etaGen, phiGen, ptGen);\r
-\r
-    Int_t iRec = indexAODTr[iGen]; // can be -1 if no good reconstructed track \r
-\r
-    if(iRec>=0 && trackQARec){\r
-      if(scaleStrangeness){ \r
-       Double_t weight = GetMCStrangenessFactor(ptGen);\r
-       trackQARec->FillTrackQA(etaGen, phiGen, ptGen, kFALSE, 0, kTRUE, weight);\r
-      }\r
-      else trackQARec->FillTrackQA(etaGen, phiGen, ptGen);\r
-    }\r
-  }\r
-}\r
-\r
-// ______________________________________________________________________________________________________________________________________________________\r
-\r
-void  AliAnalysisTaskFragmentationFunction::FillJetTrackHistosRec(AliFragFuncHistos* ffhistRec, AliAODJet* jet, \r
-                                                                 TList* jetTrackList, const TList* tracksGen, const TList* tracksRec, const TArrayI& indexAODTr,\r
-                                                                 const TArrayS& isRefGen, TList* jetTrackListTR, const Bool_t scaleStrangeness,\r
-                                                                 Bool_t fillJS, TProfile* hProNtracksLeadingJet, TProfile** hProDelRPtSum, TProfile* hProDelR80pcPt)\r
-{\r
-  // fill objects for jet track reconstruction efficiency or secondaries contamination \r
-  // arguments histGen/histRec can be of different type: AliFragFuncHistos*, AliFragFuncIntraJetHistos*, ...\r
-  // jetTrackListTR pointer: track refs if not NULL  \r
-  \r
-\r
-  // ensure proper normalization, even for secondaries\r
-  Double_t jetPtRec = jet->Pt();\r
-  ffhistRec->FillFF(-1, jetPtRec, kTRUE);\r
-\r
-  Int_t nTracksJet = jetTrackList->GetSize(); // list with AODMC tracks\r
-  if(nTracksJet == 0) return; \r
-  \r
-  TList* listRecTracks = new TList(); \r
-  listRecTracks->Clear();\r
-  \r
-  for(Int_t iTr=0; iTr<nTracksJet; iTr++){ // jet tracks loop\r
-    \r
-    AliAODMCParticle* gentrack =  dynamic_cast<AliAODMCParticle*> (jetTrackList->At(iTr));\r
-    if(!gentrack)continue;\r
-    // find jet track in gen tracks list\r
-    Int_t iGen = tracksGen->IndexOf(gentrack); \r
-    \r
-    if(iGen<0){\r
-      if(fDebug>0) Printf("%s:%d gen jet track not found ",(char*)__FILE__,__LINE__);\r
-      continue;\r
-    }\r
-    \r
-    if(isRefGen[iGen] != 1) continue; // select primaries\r
-    \r
-    Double_t ptGen  = gentrack->Pt();\r
-    Double_t etaGen = gentrack->Eta();\r
-    Double_t phiGen = TVector2::Phi_0_2pi(gentrack->Phi());\r
-\r
-    // gen level acc & pt cuts - skip in case of track refs  \r
-    if(!jetTrackListTR && (etaGen < fTrackEtaMin || etaGen > fTrackEtaMax)) continue;\r
-    if(!jetTrackListTR && (phiGen < fTrackPhiMin || phiGen > fTrackPhiMax)) continue;\r
-    if(!jetTrackListTR &&  ptGen  < fTrackPtCut) continue;\r
-   \r
-\r
-    Double_t ptRec = -1;       \r
-\r
-    Int_t iRec   = indexAODTr[iGen]; // can be -1 if no good reconstructed track \r
-    Bool_t isRec = (iRec>=0) ? kTRUE : kFALSE; \r
-\r
-    Bool_t isJetTrack = kFALSE;\r
-    if(!jetTrackListTR) isJetTrack = kTRUE; // skip trackRefs check for tracks in ideal cone \r
-\r
-    if(isRec){\r
-      \r
-      AliAODTrack* rectrack = dynamic_cast<AliAODTrack*> (tracksRec->At(iRec));\r
-      ptRec = rectrack->Pt();  \r
-      \r
-      if(jetTrackListTR){ \r
-        Int_t iRecTR = jetTrackListTR->IndexOf(rectrack); \r
-        if(iRecTR >=0 ) isJetTrack = kTRUE; // rec tracks assigned to jet \r
-      }\r
-    \r
-      if(isJetTrack){\r
-       \r
-       Double_t trackPt = ptRec;\r
-       Bool_t incrementJetPt = kFALSE; \r
-       \r
-       if(scaleStrangeness){\r
-         Double_t weight = GetMCStrangenessFactor(ptGen);        \r
-         ffhistRec->FillFF( trackPt, jetPtRec, incrementJetPt, 0, kTRUE, weight );\r
-       }\r
-       else{\r
-         ffhistRec->FillFF( trackPt, jetPtRec, incrementJetPt );\r
-       }\r
-\r
-       listRecTracks->Add(rectrack);\r
-       \r
-      }\r
-    }\r
-  }\r
-\r
-\r
-  if(fillJS) FillJetShape(jet,listRecTracks,hProNtracksLeadingJet, hProDelRPtSum, hProDelR80pcPt,0,0,scaleStrangeness); \r
-\r
-  delete listRecTracks;\r
-\r
-}\r
-\r
-// _____________________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetTracksTiltedwrpJetAxis(Float_t alpha, TList* inputlist, TList* outputlist, const AliAODJet* jet, Double_t radius,Double_t& sumPt)\r
-{\r
-  // List of tracks in cone perpendicular to the jet azimuthal direction\r
-\r
-  Double_t jetMom[3];\r
-  jet->PxPyPz(jetMom);\r
-\r
-  TVector3 jet3mom(jetMom);\r
-  // Rotate phi and keep eta unchanged\r
-  Double_t etaTilted = jet3mom.Eta();\r
-  Double_t phiTilted = TVector2::Phi_0_2pi(jet3mom.Phi()) + alpha;\r
-  if(phiTilted > 2*TMath::Pi()) phiTilted = phiTilted - 2*TMath::Pi();\r
-\r
-  for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++){\r
-\r
-    // embedded tracks\r
-    if( fUseExtraTracksBgr != 1){\r
-      if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (inputlist->At(itrack))){\r
-       if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-      }\r
-    }\r
-    \r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
-    if(!track)continue;\r
-    Double_t trackMom[3];\r
-    track->PxPyPz(trackMom);\r
-    TVector3 track3mom(trackMom);\r
-\r
-    Double_t deta = track3mom.Eta() - etaTilted;\r
-    Double_t dphi = TMath::Abs(track3mom.Phi() - phiTilted);\r
-    if (dphi > TMath::Pi()) dphi = 2. * TMath::Pi() - dphi;\r
-    Double_t dR = TMath::Sqrt(deta * deta + dphi * dphi);\r
-\r
-\r
-    if(dR<=radius){ \r
-      outputlist->Add(track);\r
-      sumPt += track->Pt();\r
-    }\r
-  }\r
-\r
-}\r
-\r
-// ________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetTracksTiltedwrpJetAxisWindow(Float_t alpha, TList* inputlist, TList* outputlist, const AliAODJet* jet, Double_t radius,Double_t& sumPt,Double_t &normFactor)\r
-{\r
-  // List of tracks in cone perpendicular to the jet azimuthal direction\r
-\r
-  Double_t jetMom[3];\r
-  jet->PxPyPz(jetMom);\r
-\r
-  TVector3 jet3mom(jetMom);\r
-  // Rotate phi and keep eta unchanged\r
-  Double_t etaTilted = jet3mom.Eta();\r
-  Double_t phiTilted = TVector2::Phi_0_2pi(jet3mom.Phi()) + alpha;\r
-  if(phiTilted > 2*TMath::Pi()) phiTilted = phiTilted - 2*TMath::Pi();\r
-\r
-  for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++)\r
-    {\r
-\r
-      // embedded tracks\r
-      if( fUseExtraTracksBgr != 1){\r
-       if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (inputlist->At(itrack))){\r
-         if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-         if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       }\r
-      }\r
-      \r
-      AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
-      if(!track)continue;\r
-      Float_t trackEta = track->Eta();\r
-      Float_t trackPhi = track->Phi();\r
-\r
-      if( ( phiTilted-radius >= 0 ) && ( phiTilted+radius <= 2*TMath::Pi()))\r
-       {\r
-         if((trackPhi<=phiTilted+radius) && \r
-            (trackPhi>=phiTilted-radius) &&\r
-            (trackEta<=fTrackEtaMax)&&(trackEta>=fTrackEtaMin)) // 0.9 and - 0.9\r
-           {\r
-             outputlist->Add(track);\r
-             sumPt += track->Pt();\r
-           }\r
-       }\r
-      else if( phiTilted-radius < 0 ) \r
-       {\r
-         if((( trackPhi < phiTilted+radius ) ||\r
-             ( trackPhi > 2*TMath::Pi()-(radius-phiTilted) )) &&\r
-            (( trackEta <= fTrackEtaMax ) && ( trackEta >= fTrackEtaMin ))) \r
-           {\r
-             outputlist->Add(track);\r
-             sumPt += track->Pt();\r
-           }\r
-       }\r
-      else if( phiTilted+radius > 2*TMath::Pi() )\r
-       {\r
-         if((( trackPhi > phiTilted-radius ) ||\r
-              ( trackPhi < phiTilted+radius-2*TMath::Pi() )) &&\r
-            (( trackEta <= fTrackEtaMax ) && ( trackEta >= fTrackEtaMin ))) \r
-           {\r
-             outputlist->Add(track);\r
-             sumPt += track->Pt();\r
-           }\r
-       }\r
-    }\r
-\r
-  // Jet area - Temporarily added should be modified with the proper jet area value\r
-  Float_t areaJet = CalcJetArea(etaTilted,radius);\r
-  Float_t areaTilted = 2*radius*(fTrackEtaMax-fTrackEtaMin);\r
-\r
-  normFactor = (Float_t) 1. / (areaJet / areaTilted);\r
-\r
-}\r
-\r
-\r
-// ________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetTracksOutOfNJets(Int_t nCases, TList* inputlist, TList* outputlist, TList* jetlist, Double_t& sumPt)\r
-{\r
-  // List of tracks outside cone around N jet axis  \r
-  // Particles taken randomly\r
-\r
-  sumPt = 0;\r
-  //  Int_t   nj  = jetlist->GetSize();\r
-  Float_t rc  = TMath::Abs(GetFFRadius());\r
-  Float_t rcl = GetFFBckgRadius();\r
-\r
-  // Estimate jet and background areas\r
-  Float_t* areaJet = new Float_t[nCases];\r
-  memset(areaJet, 0, sizeof(Float_t) * nCases);\r
-  Float_t* areaJetLarge = new Float_t[nCases];\r
-  memset(areaJetLarge, 0, sizeof(Float_t) * nCases);\r
-  Float_t areaFull = (fTrackEtaMax-fTrackEtaMin)*(fTrackPhiMax-fTrackPhiMin);\r
-  Float_t areaOut = areaFull;\r
-\r
-  //estimate jets and background areas\r
-  Int_t nOut = 0;\r
-  Int_t ijet = 0;\r
-  TList* templist = new TList();\r
-  TClonesArray *vect3Jet = new TClonesArray("TVector3",nCases);\r
-\r
-  for(Int_t ij=0; ij<nCases; ++ij) \r
-    {\r
-      // Get jet information\r
-      AliAODJet* jet = dynamic_cast<AliAODJet*>(jetlist->At(ij));\r
-      if(!jet)continue;\r
-      TVector3 jet3mom;\r
-      jet3mom.SetPtEtaPhi(jet->Pt(),jet->Eta(),jet->Phi());\r
-      new((*vect3Jet)[ijet]) TVector3((TVector3)jet3mom);\r
-      Float_t etaJet = (Float_t)((TVector3*) vect3Jet->At(ij))->Eta();\r
-      \r
-      // Jet area\r
-      areaJet[ij] = CalcJetArea(etaJet,rc);\r
-      \r
-      // Area jet larger angle\r
-      areaJetLarge[ij] = CalcJetArea(etaJet,rcl);\r
-\r
-      // Outside jet area\r
-      areaOut = areaOut - areaJetLarge[ij];\r
-      ijet++;\r
-    }\r
-\r
-  // List of all tracks outside jet areas\r
-  for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++){\r
-    \r
-    // embedded tracks\r
-    if( fUseExtraTracksBgr != 1){\r
-      if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (inputlist->At(itrack))){\r
-       if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-      }\r
-    }\r
-\r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
-\r
-    if(!track)continue;\r
-    Double_t trackMom[3];\r
-    track->PxPyPz(trackMom);\r
-    TVector3 track3mom(trackMom);\r
-    \r
-    Double_t *dR = new Double_t[nCases];\r
-    for(Int_t ij=0; ij<nCases; ij++)\r
-      dR[ij] = (Double_t)((TVector3*) vect3Jet->At(ij))->DeltaR(track3mom);\r
-\r
-    if((nCases==1 && (dR[0]>rcl)) ||\r
-       (nCases==2 && (dR[0]>rcl && dR[1]>rcl)) ||\r
-       (nCases==3 && (dR[0]>rcl && dR[1]>rcl && dR[2]>rcl)))\r
-      {\r
-       templist->Add(track);\r
-       nOut++;\r
-      }\r
-    delete [] dR;\r
-  }\r
-\r
-  // Take tracks randomly\r
-  Int_t nScaled = (Int_t) (nOut * areaJet[0] / areaOut + 0.5);\r
-  TArrayI* ar = new TArrayI(nOut);\r
-\r
-  for(Int_t init=0; init<nOut; init++)\r
-    (*ar)[init] = init;\r
-\r
-  Int_t *randIndex = new Int_t[nScaled];\r
-  for(Int_t init2=0; init2<nScaled; init2++)\r
-    randIndex[init2] = -1;\r
-\r
-  // Select nScaled different random numbers in nOut\r
-  for(Int_t i=0; i<nScaled; i++)\r
-    {\r
-      Int_t* tmpArr = new Int_t[nOut-i];\r
-      Int_t temp = fRandom->Integer(nOut-i);\r
-      for(Int_t ind = 0; ind< ar->GetSize()-1; ind++)\r
-        {\r
-          if(ind<temp) tmpArr[ind] = (*ar)[ind];\r
-          else tmpArr[ind] = (*ar)[ind+1];\r
-        }\r
-      randIndex[i] = (*ar)[temp];\r
-\r
-      ar->Set(nOut-i-1,tmpArr);\r
-\r
-      delete [] tmpArr;\r
-\r
-    }\r
-\r
-  for(Int_t ipart=0; ipart<nScaled; ipart++)\r
-    {\r
-      AliVParticle* track = (AliVParticle*)(templist->At(randIndex[ipart]));\r
-      outputlist->Add(track);\r
-      sumPt += track->Pt();\r
-    }\r
-\r
-  outputlist->Sort();\r
-\r
-  delete vect3Jet;\r
-  delete templist;\r
-  delete [] areaJetLarge;\r
-  delete [] areaJet;\r
-  delete ar;\r
-  delete [] randIndex;\r
-\r
-}\r
-\r
-// ________________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetTracksOutOfNJetsStat(Int_t nCases, TList* inputlist, TList* outputlist, TList* jetlist, Double_t& sumPt, Double_t &normFactor)\r
-{\r
-  // List of tracks outside cone around N jet axis  \r
-  // All particles taken + final scaling factor \r
-\r
-  sumPt = 0;\r
-  Float_t rc  = TMath::Abs(GetFFRadius());\r
-  Float_t rcl = GetFFBckgRadius();\r
-\r
-  // Estimate jet and background areas\r
-  Float_t* areaJet = new Float_t[nCases];\r
-  memset(areaJet, 0, sizeof(Float_t) * nCases);\r
-  Float_t* areaJetLarge = new Float_t[nCases];\r
-  memset(areaJetLarge, 0, sizeof(Float_t) * nCases);\r
-  Float_t areaFull = (fTrackEtaMax-fTrackEtaMin)*(fTrackPhiMax-fTrackPhiMin);\r
-  Float_t areaOut = areaFull;\r
-\r
-  //estimate jets and background areas\r
-  Int_t nOut = 0;\r
-  Int_t ijet = 0;\r
-  TClonesArray *vect3Jet = new TClonesArray("TVector3",nCases);\r
-\r
-  for(Int_t ij=0; ij<nCases; ++ij) \r
-    {\r
-      // Get jet information\r
-      AliAODJet* jet = dynamic_cast<AliAODJet*>(jetlist->At(ij));\r
-      if(!jet)continue;\r
-      TVector3 jet3mom;\r
-      jet3mom.SetPtEtaPhi(jet->Pt(),jet->Eta(),jet->Phi());\r
-      new((*vect3Jet)[ijet]) TVector3((TVector3)jet3mom);\r
-      Float_t etaJet = (Float_t)((TVector3*) vect3Jet->At(ij))->Eta();\r
-\r
-      // Jet area\r
-      areaJet[ij] = CalcJetArea(etaJet,rc);\r
-\r
-      // Area jet larger angle\r
-      areaJetLarge[ij] = CalcJetArea(etaJet,rcl);\r
-\r
-      // Outside jets area\r
-      areaOut = areaOut - areaJetLarge[ij];\r
-      ijet++;\r
-    }\r
-\r
-  for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++){\r
-    \r
-    // embedded tracks\r
-    if( fUseExtraTracksBgr != 1){\r
-      if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (inputlist->At(itrack))){\r
-       if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-      }\r
-    }\r
-\r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
-    if(!track)continue;\r
-    Double_t trackMom[3];\r
-    track->PxPyPz(trackMom);\r
-    TVector3 track3mom(trackMom);\r
-    \r
-    Double_t *dR = new Double_t[nCases];\r
-    for(Int_t ij=0; ij<nCases; ij++)\r
-       dR[ij] = (Double_t)((TVector3*) vect3Jet->At(ij))->DeltaR(track3mom);\r
-\r
-    if((nCases==0) ||\r
-       (nCases==1 && (dR[0]>rcl)) ||\r
-       (nCases==2 && (dR[0]>rcl && dR[1]>rcl)) ||\r
-       (nCases==3 && (dR[0]>rcl && dR[1]>rcl && dR[2]>rcl)))\r
-      {\r
-       outputlist->Add(track);\r
-       sumPt += track->Pt();\r
-       nOut++;\r
-      }\r
-    delete [] dR;\r
-  }\r
-\r
-  if(nCases==0) areaJet[0] = TMath::Pi()*rc*rc;\r
-  normFactor = (Float_t) 1./(areaJet[0] / areaOut); \r
-\r
-  outputlist->Sort();\r
-\r
-  delete vect3Jet;\r
-  delete [] areaJetLarge;\r
-  delete [] areaJet;\r
-\r
-}\r
-\r
-// ______________________________________________________________________________________________________________________________________________________\r
-Float_t AliAnalysisTaskFragmentationFunction::CalcJetArea(const Float_t etaJet, const Float_t rc) const\r
-{\r
-  // calculate area of jet with eta etaJet and radius rc\r
-\r
-  Float_t detamax = etaJet + rc;\r
-  Float_t detamin = etaJet - rc;\r
-  Float_t accmax = 0.0; Float_t accmin = 0.0;\r
-  if(detamax > fTrackEtaMax){ // sector outside etamax\r
-    Float_t h = fTrackEtaMax - etaJet;\r
-    accmax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h);\r
-  }\r
-  if(detamin < fTrackEtaMin){ // sector outside etamin\r
-    Float_t h = fTrackEtaMax + etaJet;\r
-    accmin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h);\r
-  }\r
-  Float_t areaJet = rc*rc*TMath::Pi() - accmax - accmin;\r
-  \r
-  return areaJet;\r
-\r
-}\r
-\r
-// ___________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetClusterTracksOutOf1Jet(AliAODJet* jet, TList* outputlist, Double_t &normFactor)\r
-{\r
-  // fill tracks from bckgCluster branch in list, \r
-  // for all clusters outside jet cone \r
-  // sum up total area of clusters\r
-\r
-  Double_t rc  = GetFFRadius();\r
-  Double_t rcl = GetFFBckgRadius();\r
-    \r
-  Double_t areaTotal   = 0;\r
-  Double_t sumPtTotal  = 0;\r
-\r
-  for(Int_t ij=0; ij<fBckgJetsRec->GetEntries(); ++ij){\r
-      \r
-    AliAODJet* bgrCluster = (AliAODJet*)(fBckgJetsRec->At(ij)); // not 'recCuts': use all clusters in full eta range\r
-    \r
-    Double_t dR = jet->DeltaR(bgrCluster);  \r
-        \r
-    if(dR<rcl) continue;\r
-        \r
-    Double_t clusterPt = bgrCluster->Pt();\r
-    Double_t area      = bgrCluster->EffectiveAreaCharged();\r
-    areaTotal  += area;\r
-    sumPtTotal += clusterPt;\r
-    \r
-    Int_t nTracksJet = bgrCluster->GetRefTracks()->GetEntries();\r
-\r
-    for(Int_t it = 0; it<nTracksJet; it++){\r
-       \r
-      // embedded tracks - note: using ref tracks here, fBranchRecBckgClusters has to be consistent\r
-      if( fUseExtraTracksBgr != 1){\r
-       if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (bgrCluster->GetTrack(it))){\r
-         if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-         if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       }\r
-      }\r
-\r
-      AliVParticle*   track = dynamic_cast<AliVParticle*>(bgrCluster->GetTrack(it));\r
-      if(!track) continue;\r
-       \r
-      Float_t trackPt  = track->Pt();\r
-      Float_t trackEta = track->Eta();\r
-      Float_t trackPhi = TVector2::Phi_0_2pi(track->Phi());\r
-       \r
-      if(trackEta < fTrackEtaMin || trackEta > fTrackEtaMax) continue;\r
-      if(trackPhi < fTrackPhiMin || trackPhi > fTrackPhiMax) continue;\r
-      if(trackPt  < fTrackPtCut) continue;\r
-       \r
-      outputlist->Add(track);\r
-    }\r
-  }\r
-    \r
-  Double_t areaJet = TMath::Pi()*rc*rc;\r
-  if(areaTotal) normFactor = (Float_t) 1./(areaJet / areaTotal); \r
-\r
-  outputlist->Sort();\r
-}    \r
-\r
-// _______________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputlist, Double_t &normFactor)\r
-{\r
-  // fill tracks from bckgCluster branch, \r
-  // using cluster with median density (odd number of clusters) \r
-  // or picking randomly one of the two closest to median (even number)\r
-  \r
-  normFactor = 0;\r
-\r
-  Int_t nBckgClusters = fBckgJetsRec->GetEntries(); // not 'recCuts': use all clusters in full eta range\r
-\r
-  if(nBckgClusters<3) return; // need at least 3 clusters (skipping 2 highest)\r
-\r
-  Double_t* bgrDensity = new Double_t[nBckgClusters];\r
-  Int_t*    indices    = new Int_t[nBckgClusters];\r
-    \r
-  for(Int_t ij=0; ij<nBckgClusters; ++ij){\r
-      \r
-    AliAODJet* bgrCluster = (AliAODJet*)(fBckgJetsRec->At(ij));\r
-    Double_t clusterPt    = bgrCluster->Pt();\r
-    Double_t area         = bgrCluster->EffectiveAreaCharged();\r
-      \r
-    Double_t density = 0;\r
-    if(area>0) density = clusterPt/area;\r
-\r
-    bgrDensity[ij] = density;\r
-    indices[ij]    = ij;\r
-  }\r
-   \r
-  TMath::Sort(nBckgClusters, bgrDensity, indices); \r
-  \r
-  // get median cluster\r
-\r
-  AliAODJet* medianCluster = 0;\r
-  Double_t   medianDensity = 0;\r
-\r
-  if(TMath::Odd(nBckgClusters)){\r
-    \r
-    Int_t medianIndex = indices[(Int_t) (0.5*(nBckgClusters-1))];\r
-    medianCluster = (AliAODJet*)(fBckgJetsRec->At(medianIndex));\r
-    \r
-    Double_t clusterPt = medianCluster->Pt();\r
-    Double_t area      = medianCluster->EffectiveAreaCharged();\r
-    \r
-    if(area>0) medianDensity = clusterPt/area;\r
-  }\r
-  else{\r
-\r
-    Int_t medianIndex1 = indices[(Int_t) (0.5*nBckgClusters-1)];\r
-    Int_t medianIndex2 = indices[(Int_t) (0.5*nBckgClusters)];\r
-\r
-    AliAODJet* medianCluster1 = (AliAODJet*)(fBckgJetsRec->At(medianIndex1));\r
-    AliAODJet* medianCluster2 = (AliAODJet*)(fBckgJetsRec->At(medianIndex2));\r
-    \r
-    Double_t density1 = 0;\r
-    Double_t clusterPt1 = medianCluster1->Pt();\r
-    Double_t area1      = medianCluster1->EffectiveAreaCharged();\r
-    if(area1>0) density1 = clusterPt1/area1;\r
-    \r
-    Double_t density2 = 0;\r
-    Double_t clusterPt2 = medianCluster2->Pt();\r
-    Double_t area2      = medianCluster2->EffectiveAreaCharged();\r
-    if(area2>0) density2 = clusterPt2/area2;\r
-    \r
-    medianDensity = 0.5*(density1+density2);\r
-    \r
-    medianCluster = ( (fRandom->Rndm()>0.5) ? medianCluster1 : medianCluster2 );  // select one randomly to avoid adding areas\r
-  }\r
-    \r
-  Int_t nTracksJet = medianCluster->GetRefTracks()->GetEntries();\r
-\r
-  for(Int_t it = 0; it<nTracksJet; it++){\r
-       \r
-    // embedded tracks - note: using ref tracks here, fBranchRecBckgClusters has to be consistent\r
-    if( fUseExtraTracksBgr != 1){\r
-      if(AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*> (medianCluster->GetTrack(it))){\r
-       if(fUseExtraTracksBgr == 0  &&  ((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-       if(fUseExtraTracksBgr == -1 && !((trackAOD->GetFlags() & AliESDtrack::kEmbedded)>0)) continue; \r
-      }\r
-    }\r
-\r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(medianCluster->GetTrack(it));\r
-    if(!track) continue;\r
-       \r
-    Float_t trackPt  = track->Pt();\r
-    Float_t trackEta = track->Eta();\r
-    Float_t trackPhi = TVector2::Phi_0_2pi(track->Phi());\r
-    \r
-    if(trackEta < fTrackEtaMin || trackEta > fTrackEtaMax) continue;\r
-    if(trackPhi < fTrackPhiMin || trackPhi > fTrackPhiMax) continue;\r
-    if(trackPt  < fTrackPtCut) continue;\r
-       \r
-    outputlist->Add(track);\r
-  }    \r
-    \r
-  Double_t areaMedian = medianCluster->EffectiveAreaCharged();\r
-  Double_t areaJet = TMath::Pi()*GetFFRadius()*GetFFRadius();\r
-  \r
-  if(areaMedian) normFactor = (Float_t) 1./(areaJet / areaMedian); \r
-  \r
-  outputlist->Sort();\r
-\r
-  delete[] bgrDensity;\r
-  delete[] indices; \r
-}    \r
-\r
-// ______________________________________________________________________________________________________________________________________________________\r
-void AliAnalysisTaskFragmentationFunction::FillBckgHistos(Int_t type, TList* inputtracklist, TList* inputjetlist, AliAODJet* jet, \r
-                                                            AliFragFuncHistos* ffbckghistocuts, AliFragFuncQATrackHistos* qabckghistocuts, TH1F* fh1Mult){\r
-\r
-  // List of tracks outside jets for background study\r
-  TList* tracklistout2jets     = new TList();\r
-  TList* tracklistout3jets     = new TList();\r
-  TList* tracklistout2jetsStat = new TList();\r
-  TList* tracklistout3jetsStat = new TList();\r
-  Double_t sumPtOut2Jets       = 0.;\r
-  Double_t sumPtOut3Jets       = 0.;\r
-  Double_t sumPtOut2JetsStat   = 0.;\r
-  Double_t sumPtOut3JetsStat   = 0.;\r
-  Double_t normFactor2Jets     = 0.;\r
-  Double_t normFactor3Jets     = 0.;\r
-\r
-  Int_t nRecJetsCuts = inputjetlist->GetEntries(); \r
-\r
-  if(nRecJetsCuts>1) {\r
-    GetTracksOutOfNJets(2,inputtracklist, tracklistout2jets, inputjetlist, sumPtOut2Jets);\r
-    GetTracksOutOfNJetsStat(2,inputtracklist, tracklistout2jetsStat, inputjetlist,sumPtOut2JetsStat, normFactor2Jets);\r
-\r
-  }\r
-  if(nRecJetsCuts>2) {\r
-    GetTracksOutOfNJets(3,inputtracklist, tracklistout3jets, inputjetlist, sumPtOut3Jets);\r
-    GetTracksOutOfNJetsStat(3,inputtracklist, tracklistout3jetsStat, inputjetlist, sumPtOut3JetsStat, normFactor3Jets);\r
-  }\r
-\r
-  if(type==kBckgOutLJ || type==kBckgOutAJ)\r
-    {\r
-      TList* tracklistoutleading   = new TList();\r
-      Double_t sumPtOutLeading     = 0.; \r
-      GetTracksOutOfNJets(1,inputtracklist, tracklistoutleading, inputjetlist, sumPtOutLeading);\r
-      if(type==kBckgOutLJ && fh1Mult) fh1Mult->Fill(tracklistoutleading->GetSize());\r
-      \r
-      for(Int_t it=0; it<tracklistoutleading->GetSize(); ++it){\r
-\r
-       AliVParticle* trackVP   = (AliVParticle*)(tracklistoutleading->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       \r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-       if(type==kBckgOutLJ)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt);\r
-           \r
-           // Fill track QA for background\r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt);\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==1 && type==kBckgOutAJ)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );\r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistoutleading->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOutLJ)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==1 && type==kBckgOutAJ)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-      }\r
-      delete tracklistoutleading;\r
-    }\r
-  if(type==kBckgOutLJStat || type==kBckgOutAJStat)\r
-    { \r
-      TList* tracklistoutleadingStat   = new TList();\r
-      Double_t sumPtOutLeadingStat = 0.; \r
-      Double_t normFactorLeading   = 0.;\r
-\r
-      GetTracksOutOfNJetsStat(1,inputtracklist, tracklistoutleadingStat, inputjetlist, sumPtOutLeadingStat, normFactorLeading);\r
-      if(type==kBckgOutLJStat && fh1Mult) fh1Mult->Fill(tracklistoutleadingStat->GetSize());\r
-\r
-      for(Int_t it=0; it<tracklistoutleadingStat->GetSize(); ++it){\r
-\r
-       AliVParticle* trackVP   = dynamic_cast<AliVParticle*>(tracklistoutleadingStat->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-       \r
-       // Stat plots\r
-       if(type==kBckgOutLJStat)\r
-         {\r
-           if(fFFMode)ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorLeading);\r
-\r
-           // Fill track QA for background\r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt); // OB added bgr QA\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==1 && type==kBckgOutAJStat)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorLeading);\r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt ); // OB added bgr QA \r
-\r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistoutleadingStat->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOutLJStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactorLeading);\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==1 && type==kBckgOutLJStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactorLeading);\r
-          }\r
-      }\r
-\r
-      delete tracklistoutleadingStat;\r
-    }\r
-\r
-  if(type==kBckgPerp || type==kBckgPerp2 || type==kBckgPerp2Area)\r
-    {\r
-      Double_t sumPtPerp1 = 0.;\r
-      Double_t sumPtPerp2 = 0.;\r
-      TList* tracklistperp  = new TList();\r
-      TList* tracklistperp1 = new TList();\r
-      TList* tracklistperp2 = new TList();\r
-\r
-      Double_t norm = 1;\r
-      if(type == kBckgPerp2)     norm = 2; // in FillFF() scaleFac = 1/norm = 0.5 - account for double area; \r
-      if(type == kBckgPerp2Area) norm = 2*TMath::Pi()*TMath::Abs(GetFFRadius())*TMath::Abs(GetFFRadius()) / jet->EffectiveAreaCharged(); // in FillFF() scaleFac = 1/norm; \r
-\r
-      GetTracksTiltedwrpJetAxis(TMath::Pi()/2., inputtracklist,tracklistperp1,jet,TMath::Abs(GetFFRadius()),sumPtPerp1);\r
-      if(type==kBckgPerp2 || type==kBckgPerp2Area) GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2., inputtracklist,tracklistperp2,jet,TMath::Abs(GetFFRadius()),sumPtPerp2);\r
-\r
-      tracklistperp->AddAll(tracklistperp1);\r
-      tracklistperp->AddAll(tracklistperp2);\r
-\r
-      if(tracklistperp->GetSize() != tracklistperp1->GetSize() + tracklistperp2->GetSize()){\r
-       cout<<" ERROR: tracklistperp size "<<tracklistperp->GetSize()<<" perp1 "<<tracklistperp1->GetSize()<<" perp2 "<<tracklistperp2->GetSize()<<endl;\r
-        exit(0); \r
-      }\r
-\r
-      if(fh1Mult) fh1Mult->Fill(tracklistperp->GetSize());\r
-      \r
-      for(Int_t it=0; it<tracklistperp->GetSize(); ++it){\r
-       \r
-       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistperp->At(it));\r
-       if(!trackVP)continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       \r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-       \r
-       if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, norm );\r
-\r
-       // Fill track QA for background\r
-       if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt);\r
-       \r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistperp->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-      }\r
-\r
-\r
-      if(fJSMode){\r
-        // fill for tracklistperp1/2 separately, divide norm by 2\r
-       if(type==kBckgPerp){ \r
-         FillJetShape(jet, tracklistperp, fProNtracksLeadingJetBgrPerp2, fProDelRPtSumBgrPerp2, 0, TMath::Pi()/2., 0., kFALSE); \r
-        }\r
-       if(type==kBckgPerp2){\r
-          FillJetShape(jet, tracklistperp1, fProNtracksLeadingJetBgrPerp2, fProDelRPtSumBgrPerp2, 0,    TMath::Pi()/2., 0., kFALSE);\r
-          FillJetShape(jet, tracklistperp2, fProNtracksLeadingJetBgrPerp2, fProDelRPtSumBgrPerp2, 0, -1*TMath::Pi()/2., 0., kFALSE);\r
-        }\r
-       if(type==kBckgPerp2Area){ // divide norm by 2: listperp1/2 filled separately\r
-         FillJetShape(jet, tracklistperp1, fProNtracksLeadingJetBgrPerp2, fProDelRPtSumBgrPerp2, 0,    TMath::Pi()/2., 0.5*norm, kFALSE);\r
-         FillJetShape(jet, tracklistperp2, fProNtracksLeadingJetBgrPerp2, fProDelRPtSumBgrPerp2, 0, -1*TMath::Pi()/2., 0.5*norm, kFALSE);\r
-        }\r
-      }\r
-      \r
-      delete tracklistperp;\r
-      delete tracklistperp1;\r
-      delete tracklistperp2;\r
-    }\r
-\r
- if(type==kBckgASide)\r
-    {\r
-      Double_t sumPtASide = 0.;\r
-      TList* tracklistaside = new TList();\r
-      GetTracksTiltedwrpJetAxis(TMath::Pi(),inputtracklist,tracklistaside,jet,TMath::Abs(GetFFRadius()),sumPtASide);\r
-      if(fh1Mult) fh1Mult->Fill(tracklistaside->GetSize());\r
-\r
-      for(Int_t it=0; it<tracklistaside->GetSize(); ++it){\r
-       \r
-        AliVParticle*   trackVP = (AliVParticle*)(tracklistaside->At(it));\r
-       if(!trackVP) continue;\r
-        TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-\r
-        Float_t jetPt   = jet->Pt();\r
-        Float_t trackPt = trackV->Pt();\r
-\r
-        Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-        if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );\r
-\r
-        // Fill track QA for background\r
-        if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt);\r
-\r
-        delete trackV;\r
-      }\r
-      if(tracklistaside->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-      }\r
-\r
-      delete tracklistaside;\r
-    }\r
-\r
-  if(type==kBckgASideWindow)\r
-    {\r
-      Double_t normFactorASide = 0.;\r
-      Double_t sumPtASideW = 0.;\r
-      TList* tracklistasidew = new TList();\r
-      GetTracksTiltedwrpJetAxisWindow(TMath::Pi(),inputtracklist,tracklistasidew,jet,TMath::Abs(GetFFRadius()),sumPtASideW,normFactorASide);\r
-      if(fh1Mult) fh1Mult->Fill(tracklistasidew->GetSize());\r
-\r
-      for(Int_t it=0; it<tracklistasidew->GetSize(); ++it){\r
-\r
-        AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistasidew->At(it));\r
-       if(!trackVP) continue;\r
-        TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-\r
-        Float_t jetPt   = jet->Pt();\r
-        Float_t trackPt = trackV->Pt();\r
-        Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-        if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorASide);\r
-\r
-        // Fill track QA for background\r
-        if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt, kFALSE, normFactorASide);\r
-\r
-        delete trackV;\r
-      }\r
-      if(tracklistasidew->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactorASide);\r
-      }\r
-\r
-      delete tracklistasidew;\r
-    }\r
-\r
-  if(type==kBckgPerpWindow)\r
-    {\r
-      Double_t normFactorPerp = 0.;\r
-      Double_t sumPtPerpW = 0.;\r
-      TList* tracklistperpw = new TList();\r
-      GetTracksTiltedwrpJetAxisWindow(TMath::Pi()/2.,inputtracklist,tracklistperpw,jet,TMath::Abs(GetFFRadius()),sumPtPerpW,normFactorPerp);\r
-      if(fh1Mult) fh1Mult->Fill(tracklistperpw->GetSize());\r
-\r
-      for(Int_t it=0; it<tracklistperpw->GetSize(); ++it){\r
-       \r
-        AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistperpw->At(it));\r
-       if(!trackVP) continue;\r
-        TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-\r
-        Float_t jetPt   = jet->Pt();\r
-        Float_t trackPt = trackV->Pt();\r
-        Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-        if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorPerp);\r
-\r
-        // Fill track QA for background\r
-        if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt, kFALSE, normFactorPerp);\r
-\r
-        delete trackV;\r
-      }\r
-      if(tracklistperpw->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactorPerp);\r
-      }\r
-\r
-      delete tracklistperpw;\r
-    }\r
-\r
-\r
-  if(type==kBckgOut2J || type==kBckgOutAJ)\r
-    {\r
-      if(type==kBckgOut2J && fh1Mult) fh1Mult->Fill(tracklistout2jets->GetSize());\r
-      for(Int_t it=0; it<tracklistout2jets->GetSize(); ++it){\r
-\r
-       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistout2jets->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       \r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-       if(type==kBckgOut2J)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );          \r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt);\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==2 && type==kBckgOutAJ)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );\r
-           \r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistout2jets->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOut2J)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==2 && type==kBckgOutAJ)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-      }\r
-    }\r
-  \r
-  if(type==kBckgOut2JStat || type==kBckgOutAJStat)\r
-    {\r
-      for(Int_t it=0; it<tracklistout2jetsStat->GetSize(); ++it){\r
-       \r
-       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistout2jetsStat->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-       \r
-       if(type==kBckgOut2JStat)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactor2Jets);\r
-           \r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt ); // OB added bgr QA\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==2 && type==kBckgOutAJStat)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactor2Jets);\r
-            \r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt ); // OB added bgr QA \r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistout2jetsStat->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOut2JStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactor2Jets);\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==2 && type==kBckgOutAJStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactor2Jets);\r
-          }\r
-      }\r
-      \r
-    }\r
-\r
-  if(type==kBckgOut3J || type==kBckgOutAJ)\r
-    {\r
-      if(type==kBckgOut3J && fh1Mult) fh1Mult->Fill(tracklistout3jets->GetSize());\r
-      \r
-      for(Int_t it=0; it<tracklistout3jets->GetSize(); ++it){\r
-       \r
-       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistout3jets->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       \r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-       \r
-       if(type==kBckgOut3J)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );\r
-    \r
-           qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt);\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==3 && type==kBckgOutAJ)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt );\r
-    \r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistout3jets->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOut3J)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==3 && type==kBckgOutAJ)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt );\r
-          }\r
-      }\r
-    }\r
-\r
-  if(type==kBckgOut3JStat || type==kBckgOutAJStat)\r
-    {\r
-      for(Int_t it=0; it<tracklistout3jetsStat->GetSize(); ++it){\r
-       \r
-       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistout3jetsStat->At(it));\r
-       if(!trackVP) continue;\r
-       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-       \r
-       Float_t jetPt   = jet->Pt();\r
-       Float_t trackPt = trackV->Pt();\r
-       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-\r
-       if(type==kBckgOut3JStat)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactor3Jets);\r
-                   \r
-           //if(fQAMode&1)     qabckghistocuts->FillTrackQA( trackEta, TVector2::Phi_0_2pi(trackPhi), trackPt);\r
-         }\r
-\r
-       // All cases included\r
-       if(nRecJetsCuts==3 && type==kBckgOutAJStat)\r
-         {\r
-           if(fFFMode) ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactor3Jets );\r
-           \r
-           if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt );\r
-\r
-         }\r
-       delete trackV;\r
-      }\r
-      // Increment jet pt with one entry in case #tracks outside jets = 0\r
-      if(tracklistout3jetsStat->GetSize()==0) {\r
-         Float_t jetPt = jet->Pt();\r
-         Bool_t incrementJetPt = kTRUE;\r
-         if(type==kBckgOut3JStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactor3Jets);\r
-          }\r
-        // All cases included\r
-        if(nRecJetsCuts==3 && type==kBckgOutAJStat)\r
-          {\r
-            if(fFFMode) ffbckghistocuts->FillFF( -1., jetPt, incrementJetPt, normFactor3Jets);\r
-          }\r
-      }\r
-\r
-    }\r
-\r
-  if(type==kBckgClustersOutLeading){ // clusters bgr: all tracks in clusters out of leading jet\r
-    \r
-    TList* tracklistClustersOutLeading = new TList();\r
-    Double_t normFactorClusters = 0;\r
-    Float_t jetPt   = jet->Pt();\r
-    \r
-    GetClusterTracksOutOf1Jet(jet, tracklistClustersOutLeading, normFactorClusters);\r
-    if(fh1Mult) fh1Mult->Fill(tracklistClustersOutLeading->GetSize());\r
-    \r
-    for(Int_t it=0; it<tracklistClustersOutLeading->GetSize(); ++it){\r
-      \r
-      AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistClustersOutLeading->At(it));\r
-      if(!trackVP) continue;\r
-      TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-      \r
-      Float_t trackPt = trackVP->Pt();\r
-      \r
-      Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-      \r
-      if(fFFMode)   ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorClusters );\r
-      if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt ); \r
-\r
-      delete trackV;\r
-    }\r
-    \r
-    delete tracklistClustersOutLeading;\r
-    \r
-  }\r
-  \r
-  if(type == kBckgClusters){ // clusters bgr: all tracks in 'median cluster' \r
-    \r
-    TList* tracklistClustersMedian = new TList();\r
-    Double_t normFactorClusters = 0;\r
-    Float_t jetPt = jet->Pt();\r
-    \r
-    GetClusterTracksMedian(tracklistClustersMedian, normFactorClusters); \r
-    if(fh1Mult) fh1Mult->Fill(tracklistClustersMedian->GetSize());\r
-\r
-    for(Int_t it=0; it<tracklistClustersMedian->GetSize(); ++it){\r
-      \r
-      AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(tracklistClustersMedian->At(it));\r
-      if(!trackVP) continue;\r
-      TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());\r
-      \r
-      Float_t trackPt = trackVP->Pt();\r
-      \r
-      Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
-      \r
-      if(fFFMode)   ffbckghistocuts->FillFF( trackPt, jetPt, incrementJetPt, normFactorClusters );\r
-      if(fQAMode&1) qabckghistocuts->FillTrackQA( trackV->Eta(), TVector2::Phi_0_2pi(trackV->Phi()), trackPt );\r
-      \r
-      delete trackV;\r
-    }\r
-    \r
-    delete tracklistClustersMedian;\r
-  }\r
-  \r
-  delete tracklistout2jets;\r
-  delete tracklistout3jets;\r
-  delete tracklistout2jetsStat;\r
-  delete tracklistout3jetsStat;  \r
-}\r
-\r
-// -----------------------------------------------------------------\r
-\r
-Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Double_t pt)\r
-{\r
-  // factor strangeness data/MC as function of pt from UE analysis (Sara Vallero)\r
-\r
-  Double_t alpha = 1;\r
-\r
-  if(0.150<pt && pt<0.200) alpha = 3.639;\r
-  if(0.200<pt && pt<0.250) alpha = 2.097;\r
-  if(0.250<pt && pt<0.300) alpha = 1.930;\r
-  if(0.300<pt && pt<0.350) alpha = 1.932;\r
-  if(0.350<pt && pt<0.400) alpha = 1.943;\r
-  if(0.400<pt && pt<0.450) alpha = 1.993;\r
-  if(0.450<pt && pt<0.500) alpha = 1.989;\r
-  if(0.500<pt && pt<0.600) alpha = 1.963;\r
-  if(0.600<pt && pt<0.700) alpha = 1.917;\r
-  if(0.700<pt && pt<0.800) alpha = 1.861;\r
-  if(0.800<pt && pt<0.900) alpha = 1.820;\r
-  if(0.900<pt && pt<1.000) alpha = 1.741;\r
-  if(1.000<pt && pt<1.500) alpha = 0.878;\r
-\r
-  return alpha;\r
-}\r
-\r
-// ---------------------------------------------------------------------------------------------------------------------------------\r
-void  AliAnalysisTaskFragmentationFunction::FillJetShape(AliAODJet* jet, TList* list,  \r
-                                                        TProfile* hProNtracksLeadingJet, TProfile** hProDelRPtSum, TProfile* hProDelR80pcPt, \r
-                                                        Double_t dPhiUE, Double_t normUE, Bool_t scaleStrangeness){\r
-  \r
-  const Int_t   kNbinsR    = 50; \r
-  const Float_t kBinWidthR = 0.02;\r
-  \r
-  Int_t nJetTracks = list->GetEntries();\r
-  \r
-  Float_t PtSumA[kNbinsR]     = {0.0};\r
-  Float_t PtWeightsA[kNbinsR] = {0.0};\r
-  Float_t nTracksA[kNbinsR]   = {0.0};\r
-  \r
-  Float_t *delRA     = new Float_t[nJetTracks];\r
-  Float_t *trackPtA  = new Float_t[nJetTracks];\r
-  Int_t   *index     = new Int_t[nJetTracks];\r
-  \r
-  for(Int_t i=0; i<nJetTracks; i++){\r
-    delRA[i]    = 0;\r
-    trackPtA[i] = 0;\r
-    index[i]    = 0;\r
-  }\r
-  \r
-  Double_t jetMom[3];\r
-  jet->PxPyPz(jetMom);\r
-  TVector3 jet3mom(jetMom);\r
-  \r
-  if(TMath::Abs(dPhiUE)>0){\r
-    Double_t phiTilted = jet3mom.Phi();\r
-    phiTilted += dPhiUE;\r
-    phiTilted = TVector2::Phi_0_2pi(phiTilted);\r
-    jet3mom.SetPhi(phiTilted);\r
-  }\r
-  \r
-  Double_t jetPt = jet->Pt();\r
-  Double_t sumWeights = 0;\r
-  \r
-  for (Int_t j =0; j<nJetTracks; j++){\r
-  \r
-    AliVParticle* track = dynamic_cast<AliVParticle*>(list->At(j));\r
-    if(!track)continue;\r
-    \r
-    Double_t trackMom[3];\r
-    track->PxPyPz(trackMom);\r
-    TVector3 track3mom(trackMom);\r
-    \r
-    Double_t dR = jet3mom.DeltaR(track3mom);\r
-\r
-    delRA[j]    = dR;\r
-    trackPtA[j] = track->Pt();\r
-    \r
-    Double_t weight = GetMCStrangenessFactor(track->Pt()); // more correctly should be gen pt\r
-    sumWeights += weight;\r
-\r
-    for(Int_t ibin=1; ibin<=kNbinsR; ibin++){\r
-      Float_t xlow = kBinWidthR*(ibin-1);\r
-      Float_t xup  = kBinWidthR*ibin;\r
-      if(xlow <= dR && dR < xup){\r
-       PtSumA[ibin-1]     += track->Pt();\r
-       PtWeightsA[ibin-1] += weight; \r
-       nTracksA[ibin-1]   += 1; \r
-      }\r
-    }\r
-  } // track loop\r
-  \r
-  Float_t jetPtMin=0;\r
-  Float_t jetPtMax=0;\r
-  \r
-  for(Int_t ibin=0; ibin<kNbinsR; ibin++){\r
-    Float_t fR =  kBinWidthR*(ibin+0.5);\r
-    \r
-    for(Int_t k=0; k<5; k++){\r
-      if(k==0){jetPtMin=20.0;jetPtMax=30.0;}\r
-      if(k==1){jetPtMin=30.0;jetPtMax=40.0;}\r
-      if(k==2){jetPtMin=40.0;jetPtMax=60.0;}\r
-      if(k==3){jetPtMin=60.0;jetPtMax=80.0;}\r
-      if(k==4){jetPtMin=80.0;jetPtMax=100.0;}\r
-      if(jetPt>jetPtMin && jetPt<jetPtMax){\r
-       \r
-       if(scaleStrangeness){\r
-         if(nTracksA[ibin]) hProDelRPtSum[k]->Fill(fR,PtSumA[ibin],PtWeightsA[ibin]/nTracksA[ibin]);\r
-         else               hProDelRPtSum[k]->Fill(fR,PtSumA[ibin],0);\r
-       }\r
-       else                 hProDelRPtSum[k]->Fill(fR,PtSumA[ibin]);\r
-      }\r
-    }\r
-  }\r
-  \r
-  if(scaleStrangeness) hProNtracksLeadingJet->Fill(jetPt,sumWeights);\r
-  else                 hProNtracksLeadingJet->Fill(jetPt,nJetTracks);\r
-  \r
-  if(normUE)           hProNtracksLeadingJet->Fill(jetPt,nJetTracks/normUE);\r
-  \r
-  if(hProDelR80pcPt){\r
-    \r
-    Float_t PtSum = 0;\r
-    Float_t delRPtSum80pc = 0;\r
-    \r
-    TMath::Sort(nJetTracks,delRA,index,0);\r
-    \r
-    for(Int_t ii=0; ii<nJetTracks; ii++){\r
-      \r
-      if(scaleStrangeness){ \r
-        Double_t weight = GetMCStrangenessFactor(trackPtA[index[ii]]); // more correctly should be gen pt\r
-       PtSum += weight*trackPtA[index[ii]];  \r
-      }\r
-      else PtSum += trackPtA[index[ii]];\r
-      \r
-\r
-      if(PtSum/jetPt >= 0.8000){\r
-       delRPtSum80pc = delRA[index[ii]];\r
-       break;\r
-      }\r
-    } \r
-    hProDelR80pcPt->Fill(jetPt,delRPtSum80pc);\r
-  }\r
-  \r
-  delete[] delRA;\r
-  delete[] trackPtA;\r
-  delete[] index;\r
-}\r
+// *************************************************************************
+// *                                                                       *
+// * Task for Fragmentation Function Analysis in PWG4 Jet Task Force Train *
+// *                                                                       *
+// *************************************************************************
+
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: */
+
+#include "TList.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TString.h"
+#include "THnSparse.h"
+#include "TProfile.h"
+#include "TFile.h"
+#include "TKey.h"
+#include "TRandom3.h"
+#include "TAxis.h"
+
+#include "AliAODInputHandler.h" 
+#include "AliAODHandler.h" 
+#include "AliESDEvent.h"
+#include "AliAODMCParticle.h"
+#include "AliAODJet.h"
+#include "AliAODJetEventBackground.h"
+#include "AliGenPythiaEventHeader.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliInputEventHandler.h"
+
+#include "AliAnalysisHelperJetTasks.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliVParticle.h"
+#include "AliVEvent.h"
+
+#include "AliAnalysisTaskFragmentationFunction.h"
+
+ClassImp(AliAnalysisTaskFragmentationFunction)
+
+//____________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()
+   : AliAnalysisTaskSE()
+   ,fESD(0)
+   ,fAOD(0)
+   ,fAODJets(0)  
+   ,fAODExtension(0)
+   ,fNonStdFile("")
+   ,fBranchRecJets("jets")
+   ,fBranchRecBckgClusters("")
+   ,fBranchGenJets("")
+   ,fBranchEmbeddedJets("")
+   ,fTrackTypeGen(0)
+   ,fJetTypeGen(0)
+   ,fJetTypeRecEff(0)
+   ,fUseAODInputJets(kTRUE)
+   ,fFilterMask(0)
+   ,fUsePhysicsSelection(kTRUE)
+   ,fEvtSelectionMask(0)
+   ,fEventClass(0)
+   ,fMaxVertexZ(10)
+   ,fTrackPtCut(0)
+   ,fTrackEtaMin(0)
+   ,fTrackEtaMax(0)
+   ,fTrackPhiMin(0)
+   ,fTrackPhiMax(0)
+   ,fUseExtraTracks(0)
+   ,fUseExtraTracksBgr(0)
+   ,fCutFractionPtEmbedded(0)
+   ,fUseEmbeddedJetAxis(0)
+   ,fUseEmbeddedJetPt(0)
+   ,fJetPtCut(0)
+   ,fJetEtaMin(0)
+   ,fJetEtaMax(0)
+   ,fJetPhiMin(0)
+   ,fJetPhiMax(0)
+   ,fFFRadius(0)
+   ,fFFMinLTrackPt(-1)
+   ,fFFMaxTrackPt(-1)
+   ,fFFMinnTracks(0)
+   ,fFFBckgRadius(0)
+   ,fBckgMode(0)
+   ,fQAMode(0)
+   ,fFFMode(0)
+   ,fEffMode(0)
+   ,fJSMode(0)
+   ,fAvgTrials(0)
+   ,fTracksRecCuts(0)
+   ,fTracksGen(0)
+   ,fTracksAODMCCharged(0)
+   ,fTracksAODMCChargedSecNS(0)
+   ,fTracksAODMCChargedSecS(0)
+   ,fTracksRecQualityCuts(0)
+   ,fJetsRec(0)
+   ,fJetsRecCuts(0)
+   ,fJetsGen(0)
+   ,fJetsRecEff(0)
+   ,fJetsEmbedded(0)
+   ,fBckgJetsRec(0)
+   ,fBckgJetsRecCuts(0)
+   ,fBckgJetsGen(0)
+   ,fQATrackHistosRecCuts(0)
+   ,fQATrackHistosGen(0)
+   ,fQAJetHistosRec(0)
+   ,fQAJetHistosRecCuts(0)
+   ,fQAJetHistosRecCutsLeading(0)
+   ,fQAJetHistosGen(0)
+   ,fQAJetHistosGenLeading(0)
+   ,fQAJetHistosRecEffLeading(0)
+   ,fFFHistosRecCuts(0)
+   ,fFFHistosGen(0)
+   ,fQATrackHighPtThreshold(0)
+   ,fFFNBinsJetPt(0)    
+   ,fFFJetPtMin(0) 
+   ,fFFJetPtMax(0)
+   ,fFFNBinsPt(0)      
+   ,fFFPtMin(0)        
+   ,fFFPtMax(0)        
+   ,fFFNBinsXi(0)      
+   ,fFFXiMin(0)        
+   ,fFFXiMax(0)        
+   ,fFFNBinsZ(0)       
+   ,fFFZMin(0)         
+   ,fFFZMax(0)
+   ,fQAJetNBinsPt(0)   
+   ,fQAJetPtMin(0)     
+   ,fQAJetPtMax(0)     
+   ,fQAJetNBinsEta(0)  
+   ,fQAJetEtaMin(0)    
+   ,fQAJetEtaMax(0)    
+   ,fQAJetNBinsPhi(0)  
+   ,fQAJetPhiMin(0)    
+   ,fQAJetPhiMax(0)    
+   ,fQATrackNBinsPt(0) 
+   ,fQATrackPtMin(0)   
+   ,fQATrackPtMax(0)   
+   ,fQATrackNBinsEta(0)
+   ,fQATrackEtaMin(0)  
+   ,fQATrackEtaMax(0)  
+   ,fQATrackNBinsPhi(0)
+   ,fQATrackPhiMin(0)  
+   ,fQATrackPhiMax(0)
+   ,fCommonHistList(0)
+   ,fh1EvtSelection(0)
+   ,fh1VertexNContributors(0)
+   ,fh1VertexZ(0)
+   ,fh1EvtMult(0)
+   ,fh1EvtCent(0)
+   ,fh1Xsec(0)
+   ,fh1Trials(0)
+   ,fh1PtHard(0)
+   ,fh1PtHardTrials(0)
+   ,fh1nRecJetsCuts(0)
+   ,fh1nGenJets(0)
+   ,fh1nRecEffJets(0)
+   ,fh1nEmbeddedJets(0)
+   ,fh1nRecBckgJetsCuts(0)
+   ,fh1nGenBckgJets(0)
+   ,fh2PtRecVsGenPrim(0)
+   ,fh2PtRecVsGenSec(0)
+   ,fQATrackHistosRecEffGen(0)  
+   ,fQATrackHistosRecEffRec(0)
+   ,fQATrackHistosSecRecNS(0)   
+   ,fQATrackHistosSecRecS(0)   
+   ,fQATrackHistosSecRecSsc(0)   
+   ,fFFHistosRecEffRec(0)
+   ,fFFHistosSecRecNS(0)
+   ,fFFHistosSecRecS(0)
+   ,fFFHistosSecRecSsc(0)
+   // Background 
+   ,fh1BckgMult0(0)
+   ,fh1BckgMult1(0)
+   ,fh1BckgMult2(0)
+   ,fh1BckgMult3(0)
+   ,fh1BckgMult4(0)
+   ,fh1FractionPtEmbedded(0)
+   ,fh1IndexEmbedded(0)
+   ,fh2DeltaPtVsJetPtEmbedded(0)
+   ,fh2DeltaPtVsRecJetPtEmbedded(0)
+   ,fh1DeltaREmbedded(0)
+   ,fQABckgHisto0RecCuts(0)  
+   ,fQABckgHisto0Gen(0)      
+   ,fQABckgHisto1RecCuts(0)  
+   ,fQABckgHisto1Gen(0)      
+   ,fQABckgHisto2RecCuts(0)  
+   ,fQABckgHisto2Gen(0)
+   ,fQABckgHisto3RecCuts(0)
+   ,fQABckgHisto3Gen(0)
+   ,fQABckgHisto4RecCuts(0)
+   ,fQABckgHisto4Gen(0)
+   ,fFFBckgHisto0RecCuts(0)
+   ,fFFBckgHisto0Gen(0)       
+   ,fFFBckgHisto1RecCuts(0)
+   ,fFFBckgHisto1Gen(0)       
+   ,fFFBckgHisto2RecCuts(0)
+   ,fFFBckgHisto2Gen(0)       
+   ,fFFBckgHisto3RecCuts(0)
+   ,fFFBckgHisto3Gen(0)       
+   ,fFFBckgHisto4RecCuts(0)
+   ,fFFBckgHisto4Gen(0)       
+   ,fFFBckgHisto0RecEffRec(0)
+   ,fFFBckgHisto0SecRecNS(0)  
+   ,fFFBckgHisto0SecRecS(0)   
+   ,fFFBckgHisto0SecRecSsc(0)
+    // jet shape   
+   ,fProNtracksLeadingJet(0)
+   ,fProDelR80pcPt(0)
+   ,fProNtracksLeadingJetGen(0)
+   ,fProDelR80pcPtGen(0)
+   ,fProNtracksLeadingJetBgrPerp2(0)
+   ,fProNtracksLeadingJetRecPrim(0)  
+   ,fProDelR80pcPtRecPrim(0)
+   ,fProNtracksLeadingJetRecSecNS(0) 
+   ,fProNtracksLeadingJetRecSecS(0)  
+   ,fProNtracksLeadingJetRecSecSsc(0)
+
+   ,fRandom(0)
+{
+   // default constructor
+  fBckgType[0] = 0;
+  fBckgType[1] = 0;
+  fBckgType[2] = 0;
+  fBckgType[3] = 0;
+  fBckgType[4] = 0;
+
+  for(Int_t ii=0; ii<5; ii++){
+    fProDelRPtSum[ii]          = 0;
+    fProDelRPtSumGen[ii]       = 0;
+    fProDelRPtSumBgrPerp2[ii]  = 0;
+    fProDelRPtSumRecPrim[ii]   = 0;
+    fProDelRPtSumRecSecNS[ii]  = 0;
+    fProDelRPtSumRecSecS[ii]   = 0;
+    fProDelRPtSumRecSecSsc[ii] = 0;
+  }
+}
+
+//_______________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char *name) 
+  : AliAnalysisTaskSE(name)
+  ,fESD(0)
+  ,fAOD(0)
+  ,fAODJets(0)  
+  ,fAODExtension(0)
+  ,fNonStdFile("")
+  ,fBranchRecJets("jets")
+  ,fBranchRecBckgClusters("")
+  ,fBranchGenJets("")
+  ,fBranchEmbeddedJets("")
+  ,fTrackTypeGen(0)
+  ,fJetTypeGen(0)
+  ,fJetTypeRecEff(0)
+  ,fUseAODInputJets(kTRUE)
+  ,fFilterMask(0)
+  ,fUsePhysicsSelection(kTRUE)
+  ,fEvtSelectionMask(0)
+  ,fEventClass(0)
+  ,fMaxVertexZ(10)
+  ,fTrackPtCut(0)
+  ,fTrackEtaMin(0)
+  ,fTrackEtaMax(0)
+  ,fTrackPhiMin(0)
+  ,fTrackPhiMax(0)
+  ,fUseExtraTracks(0)
+  ,fUseExtraTracksBgr(0)
+  ,fCutFractionPtEmbedded(0)
+  ,fUseEmbeddedJetAxis(0)
+  ,fUseEmbeddedJetPt(0)  
+  ,fJetPtCut(0)
+  ,fJetEtaMin(0)
+  ,fJetEtaMax(0)
+  ,fJetPhiMin(0)
+  ,fJetPhiMax(0)
+  ,fFFRadius(0)
+  ,fFFMinLTrackPt(-1)
+  ,fFFMaxTrackPt(-1)
+  ,fFFMinnTracks(0)
+  ,fFFBckgRadius(0)
+  ,fBckgMode(0)
+  ,fQAMode(0)
+  ,fFFMode(0)
+  ,fEffMode(0)
+  ,fJSMode(0)
+  ,fAvgTrials(0)
+  ,fTracksRecCuts(0)
+  ,fTracksGen(0)
+  ,fTracksAODMCCharged(0)
+  ,fTracksAODMCChargedSecNS(0)
+  ,fTracksAODMCChargedSecS(0)
+  ,fTracksRecQualityCuts(0)
+  ,fJetsRec(0)
+  ,fJetsRecCuts(0)
+  ,fJetsGen(0)
+  ,fJetsRecEff(0)
+  ,fJetsEmbedded(0)
+  ,fBckgJetsRec(0)
+  ,fBckgJetsRecCuts(0)
+  ,fBckgJetsGen(0)
+  ,fQATrackHistosRecCuts(0)
+  ,fQATrackHistosGen(0)
+  ,fQAJetHistosRec(0)
+  ,fQAJetHistosRecCuts(0)
+  ,fQAJetHistosRecCutsLeading(0)
+  ,fQAJetHistosGen(0)
+  ,fQAJetHistosGenLeading(0)
+  ,fQAJetHistosRecEffLeading(0)
+  ,fFFHistosRecCuts(0)
+  ,fFFHistosGen(0)
+  ,fQATrackHighPtThreshold(0) 
+  ,fFFNBinsJetPt(0)    
+  ,fFFJetPtMin(0) 
+  ,fFFJetPtMax(0)
+  ,fFFNBinsPt(0)      
+  ,fFFPtMin(0)        
+  ,fFFPtMax(0)        
+  ,fFFNBinsXi(0)      
+  ,fFFXiMin(0)        
+  ,fFFXiMax(0)        
+  ,fFFNBinsZ(0)       
+  ,fFFZMin(0)         
+  ,fFFZMax(0)         
+  ,fQAJetNBinsPt(0)   
+  ,fQAJetPtMin(0)     
+  ,fQAJetPtMax(0)     
+  ,fQAJetNBinsEta(0)  
+  ,fQAJetEtaMin(0)    
+  ,fQAJetEtaMax(0)    
+  ,fQAJetNBinsPhi(0)  
+  ,fQAJetPhiMin(0)    
+  ,fQAJetPhiMax(0)    
+  ,fQATrackNBinsPt(0) 
+  ,fQATrackPtMin(0)   
+  ,fQATrackPtMax(0)   
+  ,fQATrackNBinsEta(0)
+  ,fQATrackEtaMin(0)  
+  ,fQATrackEtaMax(0)  
+  ,fQATrackNBinsPhi(0)
+  ,fQATrackPhiMin(0)  
+  ,fQATrackPhiMax(0)  
+  ,fCommonHistList(0)
+  ,fh1EvtSelection(0)
+  ,fh1VertexNContributors(0)
+  ,fh1VertexZ(0)
+  ,fh1EvtMult(0)
+  ,fh1EvtCent(0)
+  ,fh1Xsec(0)
+  ,fh1Trials(0)
+  ,fh1PtHard(0)
+  ,fh1PtHardTrials(0)
+  ,fh1nRecJetsCuts(0)
+  ,fh1nGenJets(0)
+  ,fh1nRecEffJets(0)
+  ,fh1nEmbeddedJets(0)
+  ,fh1nRecBckgJetsCuts(0)
+  ,fh1nGenBckgJets(0)
+  ,fh2PtRecVsGenPrim(0)
+  ,fh2PtRecVsGenSec(0)
+  ,fQATrackHistosRecEffGen(0)  
+  ,fQATrackHistosRecEffRec(0)
+  ,fQATrackHistosSecRecNS(0) 
+  ,fQATrackHistosSecRecS(0) 
+  ,fQATrackHistosSecRecSsc(0) 
+  ,fFFHistosRecEffRec(0)
+  ,fFFHistosSecRecNS(0)
+  ,fFFHistosSecRecS(0)
+  ,fFFHistosSecRecSsc(0)
+  // Background
+  ,fh1BckgMult0(0)
+  ,fh1BckgMult1(0)
+  ,fh1BckgMult2(0)
+  ,fh1BckgMult3(0)
+  ,fh1BckgMult4(0)
+  ,fh1FractionPtEmbedded(0)
+  ,fh1IndexEmbedded(0)
+  ,fh2DeltaPtVsJetPtEmbedded(0)
+  ,fh2DeltaPtVsRecJetPtEmbedded(0)
+  ,fh1DeltaREmbedded(0)
+  ,fQABckgHisto0RecCuts(0)  
+  ,fQABckgHisto0Gen(0)      
+  ,fQABckgHisto1RecCuts(0)  
+  ,fQABckgHisto1Gen(0)      
+  ,fQABckgHisto2RecCuts(0)  
+  ,fQABckgHisto2Gen(0) 
+  ,fQABckgHisto3RecCuts(0)  
+  ,fQABckgHisto3Gen(0)
+  ,fQABckgHisto4RecCuts(0)  
+  ,fQABckgHisto4Gen(0)
+  ,fFFBckgHisto0RecCuts(0)
+  ,fFFBckgHisto0Gen(0)       
+  ,fFFBckgHisto1RecCuts(0)
+  ,fFFBckgHisto1Gen(0)       
+  ,fFFBckgHisto2RecCuts(0)
+  ,fFFBckgHisto2Gen(0)       
+  ,fFFBckgHisto3RecCuts(0)
+  ,fFFBckgHisto3Gen(0)       
+  ,fFFBckgHisto4RecCuts(0)
+  ,fFFBckgHisto4Gen(0)       
+  ,fFFBckgHisto0RecEffRec(0)
+  ,fFFBckgHisto0SecRecNS(0)  
+  ,fFFBckgHisto0SecRecS(0)   
+  ,fFFBckgHisto0SecRecSsc(0) 
+  // jet shape   
+  ,fProNtracksLeadingJet(0)
+  ,fProDelR80pcPt(0)
+  ,fProNtracksLeadingJetGen(0)
+  ,fProDelR80pcPtGen(0)
+  ,fProNtracksLeadingJetBgrPerp2(0)
+  ,fProNtracksLeadingJetRecPrim(0)
+  ,fProDelR80pcPtRecPrim(0)
+  ,fProNtracksLeadingJetRecSecNS(0) 
+  ,fProNtracksLeadingJetRecSecS(0)  
+  ,fProNtracksLeadingJetRecSecSsc(0)
+  ,fRandom(0)
+{
+  // constructor
+  fBckgType[0] = 0;
+  fBckgType[1] = 0;
+  fBckgType[2] = 0;
+  fBckgType[3] = 0;
+  fBckgType[4] = 0;
+  for(Int_t ii=0; ii<5; ii++){
+    fProDelRPtSum[ii]          = 0;
+    fProDelRPtSumGen[ii]       = 0;
+    fProDelRPtSumBgrPerp2[ii]  = 0;
+    fProDelRPtSumRecPrim[ii]   = 0;
+    fProDelRPtSumRecSecNS[ii]  = 0;
+    fProDelRPtSumRecSecS[ii]   = 0;
+    fProDelRPtSumRecSecSsc[ii] = 0;
+  }
+  
+  DefineOutput(1,TList::Class());
+}
+
+//__________________________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const  AliAnalysisTaskFragmentationFunction &copy)
+  : AliAnalysisTaskSE()
+  ,fESD(copy.fESD)
+  ,fAOD(copy.fAOD)
+  ,fAODJets(copy.fAODJets)  
+  ,fAODExtension(copy.fAODExtension)
+  ,fNonStdFile(copy.fNonStdFile)
+  ,fBranchRecJets(copy.fBranchRecJets)
+  ,fBranchRecBckgClusters(copy.fBranchRecBckgClusters)
+  ,fBranchGenJets(copy.fBranchGenJets)
+  ,fBranchEmbeddedJets(copy.fBranchEmbeddedJets)
+  ,fTrackTypeGen(copy.fTrackTypeGen)
+  ,fJetTypeGen(copy.fJetTypeGen)
+  ,fJetTypeRecEff(copy.fJetTypeRecEff)
+  ,fUseAODInputJets(copy.fUseAODInputJets)
+  ,fFilterMask(copy.fFilterMask)
+  ,fUsePhysicsSelection(copy.fUsePhysicsSelection)
+  ,fEvtSelectionMask(copy.fEvtSelectionMask)
+  ,fEventClass(copy.fEventClass)
+  ,fMaxVertexZ(copy.fMaxVertexZ)
+  ,fTrackPtCut(copy.fTrackPtCut)
+  ,fTrackEtaMin(copy.fTrackEtaMin)
+  ,fTrackEtaMax(copy.fTrackEtaMax)
+  ,fTrackPhiMin(copy.fTrackPhiMin)
+  ,fTrackPhiMax(copy.fTrackPhiMax)
+  ,fUseExtraTracks(copy.fUseExtraTracks)
+  ,fUseExtraTracksBgr(copy.fUseExtraTracksBgr)
+  ,fCutFractionPtEmbedded(copy.fCutFractionPtEmbedded)
+  ,fUseEmbeddedJetAxis(copy.fUseEmbeddedJetAxis)
+  ,fUseEmbeddedJetPt(copy.fUseEmbeddedJetPt)
+  ,fJetPtCut(copy.fJetPtCut)
+  ,fJetEtaMin(copy.fJetEtaMin)
+  ,fJetEtaMax(copy.fJetEtaMax)
+  ,fJetPhiMin(copy.fJetPhiMin)
+  ,fJetPhiMax(copy.fJetPhiMax)
+  ,fFFRadius(copy.fFFRadius)
+  ,fFFMinLTrackPt(copy.fFFMinLTrackPt)
+  ,fFFMaxTrackPt(copy.fFFMaxTrackPt)
+  ,fFFMinnTracks(copy.fFFMinnTracks)
+  ,fFFBckgRadius(copy.fFFBckgRadius)
+  ,fBckgMode(copy.fBckgMode)
+  ,fQAMode(copy.fQAMode)
+  ,fFFMode(copy.fFFMode)
+  ,fEffMode(copy.fEffMode)
+  ,fJSMode(copy.fJSMode)
+  ,fAvgTrials(copy.fAvgTrials)
+  ,fTracksRecCuts(copy.fTracksRecCuts)
+  ,fTracksGen(copy.fTracksGen)
+  ,fTracksAODMCCharged(copy.fTracksAODMCCharged)
+  ,fTracksAODMCChargedSecNS(copy.fTracksAODMCChargedSecNS)
+  ,fTracksAODMCChargedSecS(copy.fTracksAODMCChargedSecS)
+  ,fTracksRecQualityCuts(copy.fTracksRecQualityCuts)
+  ,fJetsRec(copy.fJetsRec)
+  ,fJetsRecCuts(copy.fJetsRecCuts)
+  ,fJetsGen(copy.fJetsGen)
+  ,fJetsRecEff(copy.fJetsRecEff)
+  ,fJetsEmbedded(copy.fJetsEmbedded)
+  ,fBckgJetsRec(copy.fBckgJetsRec)
+  ,fBckgJetsRecCuts(copy.fBckgJetsRecCuts)
+  ,fBckgJetsGen(copy.fBckgJetsGen)
+  ,fQATrackHistosRecCuts(copy.fQATrackHistosRecCuts)
+  ,fQATrackHistosGen(copy.fQATrackHistosGen)
+  ,fQAJetHistosRec(copy.fQAJetHistosRec)
+  ,fQAJetHistosRecCuts(copy.fQAJetHistosRecCuts)
+  ,fQAJetHistosRecCutsLeading(copy.fQAJetHistosRecCutsLeading)
+  ,fQAJetHistosGen(copy.fQAJetHistosGen)
+  ,fQAJetHistosGenLeading(copy.fQAJetHistosGenLeading)
+  ,fQAJetHistosRecEffLeading(copy.fQAJetHistosRecEffLeading)
+  ,fFFHistosRecCuts(copy.fFFHistosRecCuts)
+  ,fFFHistosGen(copy.fFFHistosGen)
+  ,fQATrackHighPtThreshold(copy.fQATrackHighPtThreshold) 
+  ,fFFNBinsJetPt(copy.fFFNBinsJetPt)    
+  ,fFFJetPtMin(copy.fFFJetPtMin) 
+  ,fFFJetPtMax(copy.fFFJetPtMax)
+  ,fFFNBinsPt(copy.fFFNBinsPt)      
+  ,fFFPtMin(copy.fFFPtMin)        
+  ,fFFPtMax(copy.fFFPtMax)        
+  ,fFFNBinsXi(copy.fFFNBinsXi)      
+  ,fFFXiMin(copy.fFFXiMin)        
+  ,fFFXiMax(copy.fFFXiMax)        
+  ,fFFNBinsZ(copy.fFFNBinsZ)       
+  ,fFFZMin(copy.fFFZMin)         
+  ,fFFZMax(copy.fFFZMax)         
+  ,fQAJetNBinsPt(copy.fQAJetNBinsPt)   
+  ,fQAJetPtMin(copy.fQAJetPtMin)     
+  ,fQAJetPtMax(copy.fQAJetPtMax)     
+  ,fQAJetNBinsEta(copy.fQAJetNBinsEta)  
+  ,fQAJetEtaMin(copy.fQAJetEtaMin)    
+  ,fQAJetEtaMax(copy.fQAJetEtaMax)    
+  ,fQAJetNBinsPhi(copy.fQAJetNBinsPhi)  
+  ,fQAJetPhiMin(copy.fQAJetPhiMin)    
+  ,fQAJetPhiMax(copy.fQAJetPhiMax)    
+  ,fQATrackNBinsPt(copy.fQATrackNBinsPt) 
+  ,fQATrackPtMin(copy.fQATrackPtMin)   
+  ,fQATrackPtMax(copy.fQATrackPtMax)   
+  ,fQATrackNBinsEta(copy.fQATrackNBinsEta)
+  ,fQATrackEtaMin(copy.fQATrackEtaMin)  
+  ,fQATrackEtaMax(copy.fQATrackEtaMax)  
+  ,fQATrackNBinsPhi(copy.fQATrackNBinsPhi)
+  ,fQATrackPhiMin(copy.fQATrackPhiMin)  
+  ,fQATrackPhiMax(copy.fQATrackPhiMax)
+  ,fCommonHistList(copy.fCommonHistList)
+  ,fh1EvtSelection(copy.fh1EvtSelection)
+  ,fh1VertexNContributors(copy.fh1VertexNContributors)
+  ,fh1VertexZ(copy.fh1VertexZ)
+  ,fh1EvtMult(copy.fh1EvtMult)
+  ,fh1EvtCent(copy.fh1EvtCent)
+  ,fh1Xsec(copy.fh1Xsec)
+  ,fh1Trials(copy.fh1Trials)
+  ,fh1PtHard(copy.fh1PtHard)  
+  ,fh1PtHardTrials(copy.fh1PtHardTrials)  
+  ,fh1nRecJetsCuts(copy.fh1nRecJetsCuts)
+  ,fh1nGenJets(copy.fh1nGenJets)
+  ,fh1nRecEffJets(copy.fh1nRecEffJets)
+  ,fh1nEmbeddedJets(copy.fh1nEmbeddedJets)
+  ,fh1nRecBckgJetsCuts(copy.fh1nRecBckgJetsCuts)
+  ,fh1nGenBckgJets(copy.fh1nGenBckgJets)
+  ,fh2PtRecVsGenPrim(copy.fh2PtRecVsGenPrim)
+  ,fh2PtRecVsGenSec(copy.fh2PtRecVsGenSec)
+  ,fQATrackHistosRecEffGen(copy.fQATrackHistosRecEffGen)  
+  ,fQATrackHistosRecEffRec(copy.fQATrackHistosRecEffRec)  
+  ,fQATrackHistosSecRecNS(copy.fQATrackHistosSecRecNS)  
+  ,fQATrackHistosSecRecS(copy.fQATrackHistosSecRecS)  
+  ,fQATrackHistosSecRecSsc(copy.fQATrackHistosSecRecSsc)  
+  ,fFFHistosRecEffRec(copy.fFFHistosRecEffRec)  
+  ,fFFHistosSecRecNS(copy.fFFHistosSecRecNS)   
+  ,fFFHistosSecRecS(copy.fFFHistosSecRecS)   
+  ,fFFHistosSecRecSsc(copy.fFFHistosSecRecSsc)   
+  // Background
+  ,fh1BckgMult0(copy.fh1BckgMult0)
+  ,fh1BckgMult1(copy.fh1BckgMult1)
+  ,fh1BckgMult2(copy.fh1BckgMult2)
+  ,fh1BckgMult3(copy.fh1BckgMult3)
+  ,fh1BckgMult4(copy.fh1BckgMult4)
+  ,fh1FractionPtEmbedded(copy.fh1FractionPtEmbedded)
+  ,fh1IndexEmbedded(copy.fh1IndexEmbedded)
+  ,fh2DeltaPtVsJetPtEmbedded(copy.fh2DeltaPtVsJetPtEmbedded)
+  ,fh2DeltaPtVsRecJetPtEmbedded(copy.fh2DeltaPtVsRecJetPtEmbedded)
+  ,fh1DeltaREmbedded(copy.fh1DeltaREmbedded)
+  ,fQABckgHisto0RecCuts(copy.fQABckgHisto0RecCuts)  
+  ,fQABckgHisto0Gen(copy.fQABckgHisto0Gen)      
+  ,fQABckgHisto1RecCuts(copy.fQABckgHisto1RecCuts)  
+  ,fQABckgHisto1Gen(copy.fQABckgHisto1Gen)      
+  ,fQABckgHisto2RecCuts(copy.fQABckgHisto2RecCuts)  
+  ,fQABckgHisto2Gen(copy.fQABckgHisto2Gen)
+  ,fQABckgHisto3RecCuts(copy.fQABckgHisto3RecCuts)  
+  ,fQABckgHisto3Gen(copy.fQABckgHisto3Gen)     
+  ,fQABckgHisto4RecCuts(copy.fQABckgHisto4RecCuts)  
+  ,fQABckgHisto4Gen(copy.fQABckgHisto4Gen)     
+  ,fFFBckgHisto0RecCuts(copy.fFFBckgHisto0RecCuts)
+  ,fFFBckgHisto0Gen(copy.fFFBckgHisto0Gen)       
+  ,fFFBckgHisto1RecCuts(copy.fFFBckgHisto1RecCuts)
+  ,fFFBckgHisto1Gen(copy.fFFBckgHisto1Gen)       
+  ,fFFBckgHisto2RecCuts(copy.fFFBckgHisto2RecCuts)
+  ,fFFBckgHisto2Gen(copy.fFFBckgHisto2Gen)       
+  ,fFFBckgHisto3RecCuts(copy.fFFBckgHisto3RecCuts)
+  ,fFFBckgHisto3Gen(copy.fFFBckgHisto3Gen)       
+  ,fFFBckgHisto4RecCuts(copy.fFFBckgHisto4RecCuts)
+  ,fFFBckgHisto4Gen(copy.fFFBckgHisto4Gen)       
+  ,fFFBckgHisto0RecEffRec(copy.fFFBckgHisto0RecEffRec)
+  ,fFFBckgHisto0SecRecNS(copy.fFFBckgHisto0SecRecNS)  
+  ,fFFBckgHisto0SecRecS(copy.fFFBckgHisto0SecRecS)   
+  ,fFFBckgHisto0SecRecSsc(copy.fFFBckgHisto0SecRecSsc) 
+  // jet shape   
+  ,fProNtracksLeadingJet(copy.fProNtracksLeadingJet)                
+  ,fProDelR80pcPt(copy.fProDelR80pcPt)                       
+  ,fProNtracksLeadingJetGen(copy.fProNtracksLeadingJetGen)             
+  ,fProDelR80pcPtGen(copy.fProDelR80pcPtGen)                    
+  ,fProNtracksLeadingJetBgrPerp2(copy.fProNtracksLeadingJetBgrPerp2)        
+  ,fProNtracksLeadingJetRecPrim(copy.fProNtracksLeadingJetRecPrim)  
+  ,fProDelR80pcPtRecPrim(copy.fProDelR80pcPtRecPrim)
+  ,fProNtracksLeadingJetRecSecNS(copy.fProNtracksLeadingJetRecSecNS) 
+  ,fProNtracksLeadingJetRecSecS(copy.fProNtracksLeadingJetRecSecS)  
+  ,fProNtracksLeadingJetRecSecSsc(copy.fProNtracksLeadingJetRecSecSsc)
+  ,fRandom(copy.fRandom)
+{
+  // copy constructor
+  fBckgType[0] = copy.fBckgType[0];
+  fBckgType[1] = copy.fBckgType[1];
+  fBckgType[2] = copy.fBckgType[2];
+  fBckgType[3] = copy.fBckgType[3];
+  fBckgType[4] = copy.fBckgType[4];
+
+
+  for(Int_t ii=0; ii<5; ii++){
+    fProDelRPtSum[ii]          = copy.fProDelRPtSum[ii];
+    fProDelRPtSumGen[ii]       = copy.fProDelRPtSumGen[ii];
+    fProDelRPtSumBgrPerp2[ii]  = copy.fProDelRPtSumBgrPerp2[ii];
+    fProDelRPtSumRecPrim[ii]   = copy.fProDelRPtSumRecPrim[ii];
+    fProDelRPtSumRecSecNS[ii]  = copy.fProDelRPtSumRecSecNS[ii];
+    fProDelRPtSumRecSecS[ii]   = copy.fProDelRPtSumRecSecS[ii];
+    fProDelRPtSumRecSecSsc[ii] = copy.fProDelRPtSumRecSecSsc[ii];
+  }
+}
+
+// _________________________________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::operator=(const AliAnalysisTaskFragmentationFunction& o)
+{
+  // assignment
+  
+  if(this!=&o){
+
+    AliAnalysisTaskSE::operator=(o);
+    fESD                           = o.fESD;
+    fAOD                           = o.fAOD;
+    fAODJets                       = o.fAODJets;  
+    fAODExtension                  = o.fAODExtension;
+    fNonStdFile                    = o.fNonStdFile;
+    fBranchRecJets                 = o.fBranchRecJets;
+    fBranchRecBckgClusters         = o.fBranchRecBckgClusters;
+    fBranchGenJets                 = o.fBranchGenJets;
+    fBranchEmbeddedJets            = o.fBranchEmbeddedJets;
+    fTrackTypeGen                  = o.fTrackTypeGen;
+    fJetTypeGen                    = o.fJetTypeGen;
+    fJetTypeRecEff                 = o.fJetTypeRecEff;
+    fUseAODInputJets               = o.fUseAODInputJets;
+    fFilterMask                    = o.fFilterMask;
+    fUsePhysicsSelection           = o.fUsePhysicsSelection;
+    fEvtSelectionMask              = o.fEvtSelectionMask;
+    fEventClass                    = o.fEventClass;
+    fMaxVertexZ                    = o.fMaxVertexZ;
+    fTrackPtCut                    = o.fTrackPtCut;
+    fTrackEtaMin                   = o.fTrackEtaMin;
+    fTrackEtaMax                   = o.fTrackEtaMax;
+    fTrackPhiMin                   = o.fTrackPhiMin;
+    fTrackPhiMax                   = o.fTrackPhiMax;
+    fUseExtraTracks                = o.fUseExtraTracks;
+    fUseExtraTracksBgr             = o.fUseExtraTracksBgr;
+    fCutFractionPtEmbedded         = o.fCutFractionPtEmbedded;
+    fUseEmbeddedJetAxis            = o.fUseEmbeddedJetAxis;
+    fUseEmbeddedJetPt              = o.fUseEmbeddedJetPt;
+    fJetPtCut                      = o.fJetPtCut;
+    fJetEtaMin                     = o.fJetEtaMin;
+    fJetEtaMax                     = o.fJetEtaMax;
+    fJetPhiMin                     = o.fJetPhiMin;
+    fJetPhiMax                     = o.fJetPhiMin;
+    fFFRadius                      = o.fFFRadius;
+    fFFMinLTrackPt                 = o.fFFMinLTrackPt;
+    fFFMaxTrackPt                  = o.fFFMaxTrackPt;
+    fFFMinnTracks                  = o.fFFMinnTracks;
+    fFFBckgRadius                  = o.fFFBckgRadius;
+    fBckgMode                      = o.fBckgMode;
+    fQAMode                        = o.fQAMode;
+    fFFMode                        = o.fFFMode;
+    fEffMode                       = o.fEffMode;
+    fJSMode                        = o.fJSMode;
+    fBckgType[0]                   = o.fBckgType[0];
+    fBckgType[1]                   = o.fBckgType[1];
+    fBckgType[2]                   = o.fBckgType[2];
+    fBckgType[3]                   = o.fBckgType[3];
+    fBckgType[4]                   = o.fBckgType[4];
+    fAvgTrials                     = o.fAvgTrials;
+    fTracksRecCuts                 = o.fTracksRecCuts;
+    fTracksGen                     = o.fTracksGen;
+    fTracksAODMCCharged            = o.fTracksAODMCCharged;
+    fTracksAODMCChargedSecNS       = o.fTracksAODMCChargedSecNS;
+    fTracksAODMCChargedSecS        = o.fTracksAODMCChargedSecS;
+    fTracksRecQualityCuts          = o.fTracksRecQualityCuts;
+    fJetsRec                       = o.fJetsRec;
+    fJetsRecCuts                   = o.fJetsRecCuts;
+    fJetsGen                       = o.fJetsGen;
+    fJetsRecEff                    = o.fJetsRecEff;
+    fJetsEmbedded                  = o.fJetsEmbedded;
+    fBckgJetsRec                   = o.fBckgJetsRec;
+    fBckgJetsRecCuts               = o.fBckgJetsRecCuts;
+    fBckgJetsGen                   = o.fBckgJetsGen;
+    fQATrackHistosRecCuts          = o.fQATrackHistosRecCuts;
+    fQATrackHistosGen              = o.fQATrackHistosGen;
+    fQAJetHistosRec                = o.fQAJetHistosRec;
+    fQAJetHistosRecCuts            = o.fQAJetHistosRecCuts;
+    fQAJetHistosRecCutsLeading     = o.fQAJetHistosRecCutsLeading;
+    fQAJetHistosGen                = o.fQAJetHistosGen;
+    fQAJetHistosGenLeading         = o.fQAJetHistosGenLeading;
+    fQAJetHistosRecEffLeading      = o.fQAJetHistosRecEffLeading;
+    fFFHistosRecCuts               = o.fFFHistosRecCuts;
+    fFFHistosGen                   = o.fFFHistosGen;
+    fQATrackHighPtThreshold        = o.fQATrackHighPtThreshold; 
+    fFFNBinsJetPt                  = o.fFFNBinsJetPt;    
+    fFFJetPtMin                    = o.fFFJetPtMin; 
+    fFFJetPtMax                    = o.fFFJetPtMax;
+    fFFNBinsPt                     = o.fFFNBinsPt;      
+    fFFPtMin                       = o.fFFPtMin;        
+    fFFPtMax                       = o.fFFPtMax;        
+    fFFNBinsXi                     = o.fFFNBinsXi;      
+    fFFXiMin                       = o.fFFXiMin;        
+    fFFXiMax                       = o.fFFXiMax;        
+    fFFNBinsZ                      = o.fFFNBinsZ;       
+    fFFZMin                        = o.fFFZMin;         
+    fFFZMax                        = o.fFFZMax;         
+    fQAJetNBinsPt                  = o.fQAJetNBinsPt;   
+    fQAJetPtMin                    = o.fQAJetPtMin;     
+    fQAJetPtMax                    = o.fQAJetPtMax;     
+    fQAJetNBinsEta                 = o.fQAJetNBinsEta;  
+    fQAJetEtaMin                   = o.fQAJetEtaMin;    
+    fQAJetEtaMax                   = o.fQAJetEtaMax;    
+    fQAJetNBinsPhi                 = o.fQAJetNBinsPhi;  
+    fQAJetPhiMin                   = o.fQAJetPhiMin;    
+    fQAJetPhiMax                   = o.fQAJetPhiMax;    
+    fQATrackNBinsPt                = o.fQATrackNBinsPt; 
+    fQATrackPtMin                  = o.fQATrackPtMin;   
+    fQATrackPtMax                  = o.fQATrackPtMax;   
+    fQATrackNBinsEta               = o.fQATrackNBinsEta;
+    fQATrackEtaMin                 = o.fQATrackEtaMin;  
+    fQATrackEtaMax                 = o.fQATrackEtaMax;  
+    fQATrackNBinsPhi               = o.fQATrackNBinsPhi;
+    fQATrackPhiMin                 = o.fQATrackPhiMin;  
+    fQATrackPhiMax                 = o.fQATrackPhiMax;  
+    fCommonHistList                = o.fCommonHistList;
+    fh1EvtSelection                = o.fh1EvtSelection;
+    fh1VertexNContributors         = o.fh1VertexNContributors;
+    fh1VertexZ                     = o.fh1VertexZ;
+    fh1EvtMult                     = o.fh1EvtMult;
+    fh1EvtCent                     = o.fh1EvtCent;
+    fh1Xsec                        = o.fh1Xsec;
+    fh1Trials                      = o.fh1Trials;
+    fh1PtHard                      = o.fh1PtHard;
+    fh1PtHardTrials                = o.fh1PtHardTrials;
+    fh1nRecJetsCuts                = o.fh1nRecJetsCuts;
+    fh1nGenJets                    = o.fh1nGenJets; 
+    fh1nRecEffJets                 = o.fh1nRecEffJets;
+    fh1nEmbeddedJets               = o.fh1nEmbeddedJets;
+    fh2PtRecVsGenPrim              = o.fh2PtRecVsGenPrim;
+    fh2PtRecVsGenSec               = o.fh2PtRecVsGenSec; 
+    fQATrackHistosRecEffGen        = o.fQATrackHistosRecEffGen;  
+    fQATrackHistosRecEffRec        = o.fQATrackHistosRecEffRec;  
+    fQATrackHistosSecRecNS         = o.fQATrackHistosSecRecNS;  
+    fQATrackHistosSecRecS          = o.fQATrackHistosSecRecS;  
+    fQATrackHistosSecRecSsc        = o.fQATrackHistosSecRecSsc;  
+    fFFHistosRecEffRec             = o.fFFHistosRecEffRec;  
+    fFFHistosSecRecNS              = o.fFFHistosSecRecNS;   
+    fFFHistosSecRecS               = o.fFFHistosSecRecS;   
+    fFFHistosSecRecSsc             = o.fFFHistosSecRecSsc;   
+    // Background
+    fh1BckgMult0                   = o.fh1BckgMult0;
+    fh1BckgMult1                   = o.fh1BckgMult1;
+    fh1BckgMult2                   = o.fh1BckgMult2;
+    fh1BckgMult3                   = o.fh1BckgMult3;
+    fh1BckgMult4                   = o.fh1BckgMult4;
+    fh1FractionPtEmbedded          = o.fh1FractionPtEmbedded;
+    fh1IndexEmbedded               = o.fh1IndexEmbedded;
+    fh2DeltaPtVsJetPtEmbedded      = o.fh2DeltaPtVsJetPtEmbedded;
+    fh2DeltaPtVsRecJetPtEmbedded   = o.fh2DeltaPtVsRecJetPtEmbedded;
+    fh1DeltaREmbedded              = o.fh1DeltaREmbedded;
+    fQABckgHisto0RecCuts           = o.fQABckgHisto0RecCuts;  
+    fQABckgHisto0Gen               = o.fQABckgHisto0Gen;      
+    fQABckgHisto1RecCuts           = o.fQABckgHisto1RecCuts;  
+    fQABckgHisto1Gen               = o.fQABckgHisto1Gen;      
+    fQABckgHisto2RecCuts           = o.fQABckgHisto2RecCuts;  
+    fQABckgHisto2Gen               = o.fQABckgHisto2Gen;  
+    fQABckgHisto3RecCuts           = o.fQABckgHisto3RecCuts;  
+    fQABckgHisto3Gen               = o.fQABckgHisto3Gen;  
+    fQABckgHisto4RecCuts           = o.fQABckgHisto4RecCuts;  
+    fQABckgHisto4Gen               = o.fQABckgHisto4Gen;  
+    fFFBckgHisto0RecCuts           = o.fFFBckgHisto0RecCuts;
+    fFFBckgHisto0Gen               = o.fFFBckgHisto0Gen;       
+    fFFBckgHisto1RecCuts           = o.fFFBckgHisto1RecCuts;
+    fFFBckgHisto1Gen               = o.fFFBckgHisto1Gen;       
+    fFFBckgHisto2RecCuts           = o.fFFBckgHisto2RecCuts;
+    fFFBckgHisto2Gen               = o.fFFBckgHisto2Gen;       
+    fFFBckgHisto3RecCuts           = o.fFFBckgHisto3RecCuts;
+    fFFBckgHisto3Gen               = o.fFFBckgHisto3Gen;       
+    fFFBckgHisto4RecCuts           = o.fFFBckgHisto4RecCuts;
+    fFFBckgHisto4Gen               = o.fFFBckgHisto4Gen;       
+    fFFBckgHisto0RecEffRec         = o.fFFBckgHisto0RecEffRec;
+    fFFBckgHisto0SecRecNS          = o.fFFBckgHisto0SecRecNS;  
+    fFFBckgHisto0SecRecS           = o.fFFBckgHisto0SecRecS;  
+    fFFBckgHisto0SecRecSsc         = o.fFFBckgHisto0SecRecSsc; 
+    fProNtracksLeadingJet          = o.fProNtracksLeadingJet;
+    fProDelR80pcPt                 = o.fProDelR80pcPt;                       
+    fProNtracksLeadingJetGen       = o.fProNtracksLeadingJetGen;             
+    fProDelR80pcPtGen              = o.fProDelR80pcPtGen;                    
+    fProNtracksLeadingJetBgrPerp2  = o.fProNtracksLeadingJetBgrPerp2;        
+    fProNtracksLeadingJetRecPrim   = o.fProNtracksLeadingJetRecPrim;  
+    fProDelR80pcPtRecPrim          = o.fProDelR80pcPtRecPrim;
+    fProNtracksLeadingJetRecSecNS  = o.fProNtracksLeadingJetRecSecNS; 
+    fProNtracksLeadingJetRecSecS   = o.fProNtracksLeadingJetRecSecS;  
+    fProNtracksLeadingJetRecSecSsc = o.fProNtracksLeadingJetRecSecSsc;
+    fRandom                        = o.fRandom;
+
+    for(Int_t ii=0; ii<5; ii++){
+      fProDelRPtSum[ii]           = o.fProDelRPtSum[ii];
+      fProDelRPtSumGen[ii]        = o.fProDelRPtSumGen[ii];
+      fProDelRPtSumBgrPerp2[ii]   = o.fProDelRPtSumBgrPerp2[ii];
+      fProDelRPtSumRecPrim[ii]    = o.fProDelRPtSumRecPrim[ii];
+      fProDelRPtSumRecSecNS[ii]   = o.fProDelRPtSumRecSecNS[ii];
+      fProDelRPtSumRecSecS[ii]    = o.fProDelRPtSumRecSecS[ii];
+      fProDelRPtSumRecSecSsc[ii]  = o.fProDelRPtSumRecSecSsc[ii];
+    }
+  }
+  
+  return *this;
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::~AliAnalysisTaskFragmentationFunction()
+{
+  // destructor
+  
+  if(fTracksRecCuts)           delete fTracksRecCuts;
+  if(fTracksGen)               delete fTracksGen;
+  if(fTracksAODMCCharged)      delete fTracksAODMCCharged;  
+  if(fTracksAODMCChargedSecNS) delete fTracksAODMCChargedSecNS;  
+  if(fTracksAODMCChargedSecS)  delete fTracksAODMCChargedSecS;  
+  if(fTracksRecQualityCuts)    delete fTracksRecQualityCuts; 
+  if(fJetsRec)                 delete fJetsRec;
+  if(fJetsRecCuts)             delete fJetsRecCuts;
+  if(fJetsGen)                 delete fJetsGen;
+  if(fJetsRecEff)              delete fJetsRecEff;
+  if(fJetsEmbedded)            delete fJetsEmbedded;
+
+  if(fBckgMode && 
+     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
+      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
+
+    if(fBckgJetsRec)          delete fBckgJetsRec;
+    if(fBckgJetsRecCuts)      delete fBckgJetsRecCuts;
+    if(fBckgJetsGen)          delete fBckgJetsGen;
+  }
+  if(fRandom)               delete fRandom;
+}
+
+//______________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const char* name, 
+                                                        Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
+                                                        Int_t nPt, Float_t ptMin, Float_t ptMax,
+                                                        Int_t nXi, Float_t xiMin, Float_t xiMax,
+                                                        Int_t nZ , Float_t zMin , Float_t zMax)
+  : TObject()
+  ,fNBinsJetPt(nJetPt)
+  ,fJetPtMin(jetPtMin)
+  ,fJetPtMax(jetPtMax)
+  ,fNBinsPt(nPt) 
+  ,fPtMin(ptMin)   
+  ,fPtMax(ptMax)   
+  ,fNBinsXi(nXi) 
+  ,fXiMin(xiMin)   
+  ,fXiMax(xiMax)   
+  ,fNBinsZ(nZ)  
+  ,fZMin(zMin)    
+  ,fZMax(zMax)
+  ,fh2TrackPt(0)
+  ,fh2Xi(0)
+  ,fh2Z(0)
+  ,fh1JetPt(0)
+  ,fNameFF(name)
+{
+  // default constructor
+
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const AliFragFuncHistos& copy)
+  : TObject()
+  ,fNBinsJetPt(copy.fNBinsJetPt)
+  ,fJetPtMin(copy.fJetPtMin)
+  ,fJetPtMax(copy.fJetPtMax)
+  ,fNBinsPt(copy.fNBinsPt) 
+  ,fPtMin(copy.fPtMin)   
+  ,fPtMax(copy.fPtMax)   
+  ,fNBinsXi(copy.fNBinsXi) 
+  ,fXiMin(copy.fXiMin)   
+  ,fXiMax(copy.fXiMax)   
+  ,fNBinsZ(copy.fNBinsZ)  
+  ,fZMin(copy.fZMin)    
+  ,fZMax(copy.fZMax)
+  ,fh2TrackPt(copy.fh2TrackPt)
+  ,fh2Xi(copy.fh2Xi)
+  ,fh2Z(copy.fh2Z)
+  ,fh1JetPt(copy.fh1JetPt)
+  ,fNameFF(copy.fNameFF)
+{
+  // copy constructor
+}
+
+//_______________________________________________________________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& o)
+{
+  // assignment
+  
+  if(this!=&o){
+    TObject::operator=(o);
+    fNBinsJetPt = o.fNBinsJetPt;
+    fJetPtMin   = o.fJetPtMin;
+    fJetPtMax   = o.fJetPtMax;
+    fNBinsPt    = o.fNBinsPt; 
+    fPtMin      = o.fPtMin;   
+    fPtMax      = o.fPtMax;   
+    fNBinsXi    = o.fNBinsXi; 
+    fXiMin      = o.fXiMin;   
+    fXiMax      = o.fXiMax;   
+    fNBinsZ     = o.fNBinsZ;  
+    fZMin       = o.fZMin;    
+    fZMax       = o.fZMax;    
+    fh2TrackPt  = o.fh2TrackPt;
+    fh2Xi       = o.fh2Xi;
+    fh2Z        = o.fh2Z;
+    fh1JetPt    = o.fh1JetPt;
+    fNameFF     = o.fNameFF;
+  }
+    
+  return *this;
+}
+
+//_________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::~AliFragFuncHistos()
+{
+  // destructor 
+
+  if(fh1JetPt)   delete fh1JetPt;
+  if(fh2TrackPt) delete fh2TrackPt;
+  if(fh2Xi)      delete fh2Xi;
+  if(fh2Z)       delete fh2Z;
+}
+
+//_________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::DefineHistos()
+{
+  // book FF histos
+
+  fh1JetPt   = new TH1F(Form("fh1FFJetPt%s", fNameFF.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);
+  fh2TrackPt = new TH2F(Form("fh2FFTrackPt%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsPt, fPtMin, fPtMax);
+  fh2Z       = new TH2F(Form("fh2FFZ%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsZ, fZMin, fZMax);
+  fh2Xi      = new TH2F(Form("fh2FFXi%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsXi, fXiMin, fXiMax);
+
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{T} [GeV/c]", "entries"); 
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPt,"jet p_{T} [GeV/c]","p_{T} [GeV/c]","entries");
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi,"jet p_{T} [GeV/c]","#xi", "entries");
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z,"jet p_{T} [GeV/c]","z","entries");
+}
+
+//_______________________________________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::FillFF(Float_t trackPt, Float_t jetPt, Bool_t incrementJetPt, Float_t norm, 
+                                                                       Bool_t scaleStrangeness, Float_t scaleFacStrangeness)
+{
+  // fill FF
+
+  if(incrementJetPt && norm) fh1JetPt->Fill(jetPt,1/norm);
+  else if(incrementJetPt) fh1JetPt->Fill(jetPt);
+
+ // Added for proper normalization of FF background estimation
+  // when zero track are found in the background region
+  if((int)trackPt==-1) return;
+  if(norm)fh2TrackPt->Fill(jetPt,trackPt,1/norm);
+  else if(scaleStrangeness) fh2TrackPt->Fill(jetPt,trackPt,scaleFacStrangeness);
+  else fh2TrackPt->Fill(jetPt,trackPt);
+  Double_t z = 0.;
+  if(jetPt>0) z = trackPt / jetPt;
+  Double_t xi = 0;
+  if(z>0) xi = TMath::Log(1/z);
+  
+  if(trackPt>(1-1e-06)*jetPt && trackPt<(1+1e-06)*jetPt){ // case z=1 : move entry to last histo bin <1
+    z  = 1-1e-06;
+    xi = 1e-06;
+  }
+
+
+  if(norm){
+    fh2Xi->Fill(jetPt,xi,1/norm);
+    fh2Z->Fill(jetPt,z,1/norm);
+  }
+  else if(scaleStrangeness){
+    fh2Xi->Fill(jetPt,xi,scaleFacStrangeness);
+    fh2Z->Fill(jetPt,z,scaleFacStrangeness);
+  }
+  else {
+    fh2Xi->Fill(jetPt,xi);
+    fh2Z->Fill(jetPt,z);
+  }
+}
+
+//_________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AddToOutput(TList* list) const
+{
+  // add histos to list
+
+  list->Add(fh1JetPt);
+  
+  list->Add(fh2TrackPt);
+  list->Add(fh2Xi);
+  list->Add(fh2Z);
+}
+
+//_________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const char* name,
+                                                              Int_t nPt,   Float_t ptMin,   Float_t ptMax,
+                                                              Int_t nEta,  Float_t etaMin,  Float_t etaMax,
+                                                              Int_t nPhi,  Float_t phiMin,  Float_t phiMax)
+  : TObject()
+  ,fNBinsPt(nPt)
+  ,fPtMin(ptMin)
+  ,fPtMax(ptMax)
+  ,fNBinsEta(nEta)
+  ,fEtaMin(etaMin)
+  ,fEtaMax(etaMax)
+  ,fNBinsPhi(nPhi)
+  ,fPhiMin(phiMin)
+  ,fPhiMax(phiMax)
+  ,fh2EtaPhi(0)
+  ,fh1Pt(0)
+  ,fNameQAJ(name)
+{
+  // default constructor
+}
+
+//____________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const AliFragFuncQAJetHistos& copy)
+  : TObject()
+  ,fNBinsPt(copy.fNBinsPt)
+  ,fPtMin(copy.fPtMin)
+  ,fPtMax(copy.fPtMax)
+  ,fNBinsEta(copy.fNBinsEta)
+  ,fEtaMin(copy.fEtaMin)
+  ,fEtaMax(copy.fEtaMax)
+  ,fNBinsPhi(copy.fNBinsPhi)
+  ,fPhiMin(copy.fPhiMin)
+  ,fPhiMax(copy.fPhiMax)
+  ,fh2EtaPhi(copy.fh2EtaPhi)
+  ,fh1Pt(copy.fh1Pt)
+  ,fNameQAJ(copy.fNameQAJ)
+{
+  // copy constructor
+}
+
+//________________________________________________________________________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& o)
+{
+  // assignment
+  
+  if(this!=&o){
+    TObject::operator=(o);
+    fNBinsPt  = o.fNBinsPt;
+    fPtMin    = o.fPtMin;
+    fPtMax    = o.fPtMax;
+    fNBinsEta = o.fNBinsEta;
+    fEtaMin   = o.fEtaMin;
+    fEtaMax   = o.fEtaMax;
+    fNBinsPhi = o.fNBinsPhi;
+    fPhiMin   = o.fPhiMin;
+    fPhiMax   = o.fPhiMax;
+    fh2EtaPhi = o.fh2EtaPhi;
+    fh1Pt     = o.fh1Pt;
+    fNameQAJ  = o.fNameQAJ;
+  }
+  
+  return *this;
+}
+
+//______________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::~AliFragFuncQAJetHistos()
+{
+  // destructor 
+  
+  if(fh2EtaPhi) delete fh2EtaPhi;
+  if(fh1Pt)     delete fh1Pt;
+}
+
+//____________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::DefineHistos()
+{
+  // book jet QA histos
+
+  fh2EtaPhi  = new TH2F(Form("fh2JetQAEtaPhi%s", fNameQAJ.Data()), Form("%s: #eta - #phi distribution", fNameQAJ.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
+  fh1Pt      = new TH1F(Form("fh1JetQAPt%s", fNameQAJ.Data()), Form("%s: p_{T} distribution", fNameQAJ.Data()), fNBinsPt, fPtMin, fPtMax);
+       
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); 
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");
+}
+
+//____________________________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::FillJetQA(Float_t eta, Float_t phi, Float_t pt)
+{
+  // fill jet QA histos 
+
+  fh2EtaPhi->Fill( eta, phi);
+  fh1Pt->Fill( pt );
+}
+
+//____________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AddToOutput(TList* list) const 
+{
+  // add histos to list
+
+  list->Add(fh2EtaPhi);
+  list->Add(fh1Pt);
+}
+
+//___________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const char* name,
+                                                                  Int_t nPt, Float_t ptMin, Float_t ptMax,
+                                                                  Int_t nEta, Float_t etaMin, Float_t etaMax,
+                                                                  Int_t nPhi, Float_t phiMin, Float_t phiMax,
+                                                                  Float_t ptThresh) 
+  : TObject()
+  ,fNBinsPt(nPt)
+  ,fPtMin(ptMin)
+  ,fPtMax(ptMax)
+  ,fNBinsEta(nEta)
+  ,fEtaMin(etaMin)
+  ,fEtaMax(etaMax)
+  ,fNBinsPhi(nPhi)
+  ,fPhiMin(phiMin)
+  ,fPhiMax(phiMax)
+  ,fHighPtThreshold(ptThresh)
+  ,fh2EtaPhi(0)
+  ,fh1Pt(0)
+  ,fh2HighPtEtaPhi(0)
+  ,fh2PhiPt(0)
+  ,fNameQAT(name)
+{
+  // default constructor
+}
+
+//__________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const AliFragFuncQATrackHistos& copy)
+  : TObject()
+  ,fNBinsPt(copy.fNBinsPt)
+  ,fPtMin(copy.fPtMin)
+  ,fPtMax(copy.fPtMax)
+  ,fNBinsEta(copy.fNBinsEta)
+  ,fEtaMin(copy.fEtaMin)
+  ,fEtaMax(copy.fEtaMax)
+  ,fNBinsPhi(copy.fNBinsPhi)
+  ,fPhiMin(copy.fPhiMin)
+  ,fPhiMax(copy.fPhiMax)
+  ,fHighPtThreshold(copy.fHighPtThreshold)
+  ,fh2EtaPhi(copy.fh2EtaPhi)
+  ,fh1Pt(copy.fh1Pt)
+  ,fh2HighPtEtaPhi(copy.fh2HighPtEtaPhi)
+  ,fh2PhiPt(copy.fh2PhiPt)
+  ,fNameQAT(copy.fNameQAT)
+{
+  // copy constructor
+}
+
+// _____________________________________________________________________________________________________________________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& o)
+{
+  // assignment
+  
+  if(this!=&o){
+    TObject::operator=(o);
+    fNBinsPt         = o.fNBinsPt;
+    fPtMin           = o.fPtMin;
+    fPtMax           = o.fPtMax;
+    fNBinsEta        = o.fNBinsEta;
+    fEtaMin          = o.fEtaMin;
+    fEtaMax          = o.fEtaMax;
+    fNBinsPhi        = o.fNBinsPhi;
+    fPhiMin          = o.fPhiMin;
+    fPhiMax          = o.fPhiMax;
+    fHighPtThreshold = o.fHighPtThreshold;
+    fh2EtaPhi        = o.fh2EtaPhi;
+    fh1Pt            = o.fh1Pt;
+    fh2HighPtEtaPhi  = o.fh2HighPtEtaPhi;
+    fh2PhiPt         = o.fh2PhiPt;
+    fNameQAT         = o.fNameQAT;
+  }
+  
+  return *this;
+}
+
+//___________________________________________________________________
+AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::~AliFragFuncQATrackHistos()
+{
+  // destructor 
+  
+  if(fh2EtaPhi)       delete fh2EtaPhi;
+  if(fh2HighPtEtaPhi) delete fh2HighPtEtaPhi;
+  if(fh1Pt)           delete fh1Pt;
+  if(fh2PhiPt)        delete fh2PhiPt;
+}
+
+//______________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::DefineHistos()
+{
+  // book track QA histos
+
+  fh2EtaPhi       = new TH2F(Form("fh2TrackQAEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
+  fh2HighPtEtaPhi = new TH2F(Form("fh2TrackQAHighPtEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution for high-p_{T}", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
+  fh1Pt           = new TH1F(Form("fh1TrackQAPt%s", fNameQAT.Data()), Form("%s: p_{T} distribution", fNameQAT.Data()), fNBinsPt, fPtMin, fPtMax);
+    fh2PhiPt        = new TH2F(Form("fh2TrackQAPhiPt%s", fNameQAT.Data()), Form("%s: #phi - p_{T} distribution", fNameQAT.Data()), fNBinsPhi, fPhiMin, fPhiMax, fNBinsPt, fPtMin, fPtMax);
+
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); 
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2HighPtEtaPhi, "#eta", "#phi");
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");
+  AliAnalysisTaskFragmentationFunction::SetProperties(fh2PhiPt, "#phi", "p_{T} [GeV/c]"); 
+}
+
+//________________________________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::FillTrackQA(Float_t eta, Float_t phi, Float_t pt, Bool_t weightPt, Float_t norm, 
+                                                                                   Bool_t scaleStrangeness, Float_t scaleFacStrangeness)
+{
+  // fill track QA histos
+  Float_t weight = 1.;
+  if(weightPt) weight = pt;  
+  fh2EtaPhi->Fill( eta, phi, weight);
+  if(scaleStrangeness) fh2EtaPhi->Fill( eta, phi, scaleFacStrangeness);
+  if(pt > fHighPtThreshold) fh2HighPtEtaPhi->Fill( eta, phi, weight);
+  if(pt > fHighPtThreshold && scaleStrangeness) fh2HighPtEtaPhi->Fill( eta, phi, weight);
+  if(norm) fh1Pt->Fill( pt, 1/norm );
+  else if(scaleStrangeness) fh1Pt->Fill(pt,scaleFacStrangeness); 
+  else  fh1Pt->Fill( pt );
+
+  if(scaleFacStrangeness) fh2PhiPt->Fill(phi, pt, scaleFacStrangeness);
+  else fh2PhiPt->Fill(phi, pt);
+}
+
+//______________________________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AddToOutput(TList* list) const
+{
+  // add histos to list
+
+  list->Add(fh2EtaPhi);
+  list->Add(fh2HighPtEtaPhi);
+  list->Add(fh1Pt);
+  list->Add(fh2PhiPt);
+}
+
+//_________________________________________________________________________________
+Bool_t AliAnalysisTaskFragmentationFunction::Notify()
+{
+  //
+  // Implemented Notify() to read the cross sections
+  // and number of trials from pyxsec.root
+  // (taken from AliAnalysisTaskJetSpectrum2)
+  // 
+  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
+  Float_t xsection = 0;
+  Float_t ftrials  = 1;
+
+  fAvgTrials = 1;
+  if(tree){
+    TFile *curfile = tree->GetCurrentFile();
+    if (!curfile) {
+      Error("Notify","No current file");
+      return kFALSE;
+    }
+    if(!fh1Xsec||!fh1Trials){
+      Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
+      return kFALSE;
+    }
+    AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
+    fh1Xsec->Fill("<#sigma>",xsection);
+    // construct a poor man average trials 
+    Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
+    if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
+  }
+
+  // Set seed for backg study
+  fRandom = new TRandom3();
+  fRandom->SetSeed(0);
+
+  return kTRUE;
+}
+
+//__________________________________________________________________
+void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
+{
+  // create output objects
+
+  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()");
+  // create list of tracks and jets 
+
+  fTracksRecCuts = new TList();
+  fTracksRecCuts->SetOwner(kFALSE);  
+
+  fTracksGen = new TList();
+  fTracksGen->SetOwner(kFALSE);
+
+  fTracksAODMCCharged = new TList();
+  fTracksAODMCCharged->SetOwner(kFALSE);
+    
+  fTracksAODMCChargedSecNS = new TList();
+  fTracksAODMCChargedSecNS->SetOwner(kFALSE);
+
+  fTracksAODMCChargedSecS = new TList();
+  fTracksAODMCChargedSecS->SetOwner(kFALSE);
+
+  fTracksRecQualityCuts = new TList(); 
+  fTracksRecQualityCuts->SetOwner(kFALSE);
+
+  fJetsRec = new TList();
+  fJetsRec->SetOwner(kFALSE);
+
+  fJetsRecCuts = new TList();
+  fJetsRecCuts->SetOwner(kFALSE);
+
+  fJetsGen = new TList();
+  fJetsGen->SetOwner(kFALSE);
+
+  fJetsRecEff = new TList();
+  fJetsRecEff->SetOwner(kFALSE);
+
+  fJetsEmbedded = new TList();
+  fJetsEmbedded->SetOwner(kFALSE);
+
+
+  if(fBckgMode && 
+     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters ||  fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
+      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
+    
+    fBckgJetsRec = new TList();
+    fBckgJetsRec->SetOwner(kFALSE);
+
+    fBckgJetsRecCuts = new TList();
+    fBckgJetsRecCuts->SetOwner(kFALSE);
+
+    fBckgJetsGen = new TList();
+    fBckgJetsGen->SetOwner(kFALSE);
+  }
+
+  //
+  // Create histograms / output container
+  //
+
+  OpenFile(1);
+  fCommonHistList = new TList();
+  fCommonHistList->SetOwner(kTRUE);
+
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+  
+  
+  // Histograms        
+  fh1EvtSelection            = new TH1F("fh1EvtSelection", "Event Selection", 6, -0.5, 5.5);
+  fh1EvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
+  fh1EvtSelection->GetXaxis()->SetBinLabel(2,"event selection: rejected");
+  fh1EvtSelection->GetXaxis()->SetBinLabel(3,"event class: rejected");
+  fh1EvtSelection->GetXaxis()->SetBinLabel(4,"vertex Ncontr: rejected");
+  fh1EvtSelection->GetXaxis()->SetBinLabel(5,"vertex z: rejected");
+  fh1EvtSelection->GetXaxis()->SetBinLabel(6,"vertex type: rejected");
+  
+  fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 2500,-.5, 2499.5);
+  fh1VertexZ                 = new TH1F("fh1VertexZ", "Vertex z distribution", 30, -15., 15.);
+  fh1EvtMult                = new TH1F("fh1EvtMult","Event multiplicity, track pT cut > 150 MeV/c, |#eta| < 0.9",120,0.,12000.);
+  fh1EvtCent                = new TH1F("fh1EvtCent","centrality",100,0.,100.);
+
+  fh1Xsec                    = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
+  fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
+  fh1Trials                  = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1);
+  fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
+  fh1PtHard                  = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
+  fh1PtHardTrials            = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
+
+  fh1nRecJetsCuts            = new TH1F("fh1nRecJetsCuts","reconstructed jets per event",10,-0.5,9.5);
+  fh1nGenJets                = new TH1F("fh1nGenJets","generated jets per event",10,-0.5,9.5);
+  fh1nRecEffJets             = new TH1F("fh1nRecEffJets","reconstruction effiency: jets per event",10,-0.5,9.5);
+  fh1nEmbeddedJets           = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);
+
+  fh2PtRecVsGenPrim          = new TH2F("fh2PtRecVsGenPrim","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);
+  fh2PtRecVsGenSec           = new TH2F("fh2PtRecVsGenSec","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);
+  
+  // embedding
+  if(fBranchEmbeddedJets.Length()){
+    fh1FractionPtEmbedded         = new TH1F("fh1FractionPtEmbedded","",200,0,2);
+    fh1IndexEmbedded              = new TH1F("fh1IndexEmbedded","",11,-1,10);
+    fh2DeltaPtVsJetPtEmbedded     = new TH2F("fh2DeltaPtVsJetPtEmbedded","",250,0,250,200,-100,100);
+    fh2DeltaPtVsRecJetPtEmbedded  = new TH2F("fh2DeltaPtVsRecJetPtEmbedded","",250,0,250,200,-100,100);
+    fh1DeltaREmbedded             = new TH1F("fh1DeltaREmbedded","",50,0,0.5);
+    fh1nEmbeddedJets              = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);
+  }
+
+
+  if(fQAMode){
+    if(fQAMode&1){ // track QA
+       fQATrackHistosRecCuts      = new AliFragFuncQATrackHistos("RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                               fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                               fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                               fQATrackHighPtThreshold);
+      fQATrackHistosGen          = new AliFragFuncQATrackHistos("Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                               fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                               fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                               fQATrackHighPtThreshold);
+    }
+
+    if(fQAMode&2){ // jet QA
+      fQAJetHistosRec            = new AliFragFuncQAJetHistos("Rec", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
+                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
+      fQAJetHistosRecCuts        = new AliFragFuncQAJetHistos("RecCuts", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
+                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
+      fQAJetHistosRecCutsLeading = new AliFragFuncQAJetHistos("RecCutsLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
+                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
+      fQAJetHistosGen            = new AliFragFuncQAJetHistos("Gen", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
+                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
+      fQAJetHistosGenLeading     = new AliFragFuncQAJetHistos("GenLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                             fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
+                                                             fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);  
+      if(fEffMode) fQAJetHistosRecEffLeading  = new AliFragFuncQAJetHistos("RecEffLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
+                                                                          fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
+    }
+  } // end: QA
+
+  if(fFFMode){
+    
+    fFFHistosRecCuts                = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                    fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                    fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                    fFFNBinsZ , fFFZMin , fFFZMax );
+
+    fFFHistosGen            = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                    fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                    fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                    fFFNBinsZ , fFFZMin , fFFZMax);
+  } // end: FF
+  
+  // efficiency
+
+  if(fEffMode){
+    if(fQAMode&1){
+      fQATrackHistosRecEffGen = new AliFragFuncQATrackHistos("RecEffGen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                            fQATrackHighPtThreshold);
+      
+      fQATrackHistosRecEffRec = new AliFragFuncQATrackHistos("RecEffRec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                            fQATrackHighPtThreshold);
+
+      fQATrackHistosSecRecNS   = new AliFragFuncQATrackHistos("SecRecNS", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                            fQATrackHighPtThreshold);
+
+      fQATrackHistosSecRecS    = new AliFragFuncQATrackHistos("SecRecS", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                            fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                            fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                            fQATrackHighPtThreshold);
+
+      fQATrackHistosSecRecSsc = new AliFragFuncQATrackHistos("SecRecSsc", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                              fQATrackHighPtThreshold);
+
+    }
+    if(fFFMode){
+      fFFHistosRecEffRec      = new AliFragFuncHistos("RecEffRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+
+      fFFHistosSecRecNS       = new AliFragFuncHistos("SecRecNS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+      
+      fFFHistosSecRecS        = new AliFragFuncHistos("SecRecS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+      
+      fFFHistosSecRecSsc      = new AliFragFuncHistos("SecRecSsc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+      
+    }
+  } // end: efficiency
+
+  // Background
+  if(fBckgMode){
+    if(fBckgType[0]==kBckgNone){
+      AliError("no bgr method selected !");
+    }  
+    
+    TString title[5];
+    for(Int_t i=0; i<5; i++){
+      if(fBckgType[i]==kBckgPerp) title[i]="Perp";
+      else if(fBckgType[i]==kBckgPerp2) title[i]="Perp2";
+      else if(fBckgType[i]==kBckgPerp2Area) title[i]="Perp2Area";
+      else if(fBckgType[i]==kBckgPerpWindow) title[i]="PerpW";
+      else if(fBckgType[i]==kBckgASide) title[i]="ASide";
+      else if(fBckgType[i]==kBckgASideWindow) title[i]="ASideW";
+      else if(fBckgType[i]==kBckgOutLJ) title[i]="OutLeadingJet";
+      else if(fBckgType[i]==kBckgOut2J) title[i]="Out2Jets";
+      else if(fBckgType[i]==kBckgOut3J) title[i]="Out3Jets";
+      else if(fBckgType[i]==kBckgOutAJ) title[i]="AllJets";
+      else if(fBckgType[i]==kBckgOutLJStat) title[i]="OutLeadingJetStat";
+      else if(fBckgType[i]==kBckgOut2JStat) title[i]="Out2JetsStat";
+      else if(fBckgType[i]==kBckgOut3JStat) title[i]="Out3JetsStat";
+      else if(fBckgType[i]==kBckgOutAJStat) title[i]="AllJetsStat";
+      else if(fBckgType[i]==kBckgClustersOutLeading) title[i]="OutClusters";
+      else if(fBckgType[i]==kBckgClusters) title[i]="MedianClusters";
+      else if(fBckgType[i]==kBckgNone)  title[i]="";
+      else printf("Please chose background method number %d!",i);
+    }
+
+
+    if(fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters || 
+       fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+       fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading){
+      
+      fh1nRecBckgJetsCuts        = new TH1F("fh1nRecBckgJetsCuts","reconstructed background jets per event",10,-0.5,9.5);
+      fh1nGenBckgJets            = new TH1F("fh1nGenBckgJets","generated background jets per event",10,-0.5,9.5);
+    }
+
+
+    fh1BckgMult0 = new TH1F("fh1BckgMult0","bckg mult "+title[0],500,0,500);
+    if(fBckgType[1] != kBckgNone) fh1BckgMult1 = new TH1F("fh1BckgMult1","bckg mult "+title[1],500,0,500);
+    if(fBckgType[2] != kBckgNone) fh1BckgMult2 = new TH1F("fh1BckgMult2","bckg mult "+title[2],500,0,500);
+    if(fBckgType[3] != kBckgNone) fh1BckgMult3 = new TH1F("fh1BckgMult3","bckg mult "+title[3],500,0,500);
+    if(fBckgType[4] != kBckgNone) fh1BckgMult4 = new TH1F("fh1BckgMult4","bckg mult "+title[4],500,0,500);
+    
+    
+    if(fQAMode&1){
+      fQABckgHisto0RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[0]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                              fQATrackHighPtThreshold);
+      fQABckgHisto0Gen          = new AliFragFuncQATrackHistos("Bckg"+title[0]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                              fQATrackHighPtThreshold);
+      
+      if(fBckgType[1] != kBckgNone){
+       fQABckgHisto1RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[1]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+       fQABckgHisto1Gen          = new AliFragFuncQATrackHistos("Bckg"+title[1]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+      }
+      if(fBckgType[2] != kBckgNone){
+       fQABckgHisto2RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[2]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+       fQABckgHisto2Gen          = new AliFragFuncQATrackHistos("Bckg"+title[2]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+      }
+      if(fBckgType[3] != kBckgNone){
+       fQABckgHisto3RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[3]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+       fQABckgHisto3Gen          = new AliFragFuncQATrackHistos("Bckg"+title[3]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+      }
+      if(fBckgType[4] != kBckgNone){
+       fQABckgHisto4RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[4]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+       fQABckgHisto4Gen          = new AliFragFuncQATrackHistos("Bckg"+title[4]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
+                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
+                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
+                                                                fQATrackHighPtThreshold);
+      }
+    } // end: background QA
+    
+    if(fFFMode){
+      fFFBckgHisto0RecCuts    = new AliFragFuncHistos("Bckg"+title[0]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+      
+      fFFBckgHisto0Gen        = new AliFragFuncHistos("Bckg"+title[0]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+     
+      if(fBckgType[1] != kBckgNone){
+       fFFBckgHisto1RecCuts    = new AliFragFuncHistos("Bckg"+title[1]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+       fFFBckgHisto1Gen        = new AliFragFuncHistos("Bckg"+title[1]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+      }
+      if(fBckgType[2] != kBckgNone){      
+       fFFBckgHisto2RecCuts    = new AliFragFuncHistos("Bckg"+title[2]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto2Gen        = new AliFragFuncHistos("Bckg"+title[2]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+      }
+      if(fBckgType[3] != kBckgNone){
+       fFFBckgHisto3RecCuts    = new AliFragFuncHistos("Bckg"+title[3]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto3Gen        = new AliFragFuncHistos("Bckg"+title[3]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+      }
+      if(fBckgType[4] != kBckgNone){
+       fFFBckgHisto4RecCuts    = new AliFragFuncHistos("Bckg"+title[4]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto4Gen        = new AliFragFuncHistos("Bckg"+title[4]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                       fFFNBinsZ , fFFZMin , fFFZMax);
+      }
+      if(fEffMode){    
+       fFFBckgHisto0RecEffRec      = new AliFragFuncHistos("Bckg"+title[0]+"RecEffRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                           fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto0SecRecNS       = new AliFragFuncHistos("Bckg"+title[0]+"SecRecNS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                           fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto0SecRecS        = new AliFragFuncHistos("Bckg"+title[0]+"SecRecS", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                           fFFNBinsZ , fFFZMin , fFFZMax);
+       
+       fFFBckgHisto0SecRecSsc      = new AliFragFuncHistos("Bckg"+title[0]+"SecRecSsc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                           fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                           fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                           fFFNBinsZ , fFFZMin , fFFZMax);
+
+      }
+    } // end: background FF
+
+
+  } // end: background
+  
+  // ____________ define histograms ____________________
+  
+  if(fQAMode){
+    if(fQAMode&1){ // track QA
+      fQATrackHistosRecCuts->DefineHistos();
+      fQATrackHistosGen->DefineHistos();
+    }
+
+    if(fQAMode&2){ // jet QA
+      fQAJetHistosRec->DefineHistos();
+      fQAJetHistosRecCuts->DefineHistos();
+      fQAJetHistosRecCutsLeading->DefineHistos();
+      fQAJetHistosGen->DefineHistos();
+      fQAJetHistosGenLeading->DefineHistos();
+      if(fEffMode) fQAJetHistosRecEffLeading->DefineHistos();
+    }
+  }
+  
+  if(fFFMode){
+    fFFHistosRecCuts->DefineHistos();
+    fFFHistosGen->DefineHistos();
+  }
+  
+  if(fEffMode){
+    if(fQAMode&1){
+      fQATrackHistosRecEffGen->DefineHistos();
+      fQATrackHistosRecEffRec->DefineHistos(); 
+      fQATrackHistosSecRecNS->DefineHistos(); 
+      fQATrackHistosSecRecS->DefineHistos(); 
+      fQATrackHistosSecRecSsc->DefineHistos(); 
+    }
+    if(fFFMode){
+      fFFHistosRecEffRec->DefineHistos();
+      fFFHistosSecRecNS->DefineHistos();
+      fFFHistosSecRecS->DefineHistos();
+      fFFHistosSecRecSsc->DefineHistos();
+    }
+  } // end: efficiency
+
+  // Background
+  if(fBckgMode){
+    if(fFFMode){
+      fFFBckgHisto0RecCuts->DefineHistos();
+      fFFBckgHisto0Gen->DefineHistos();      
+      if(fBckgType[1] != kBckgNone) fFFBckgHisto1RecCuts->DefineHistos();
+      if(fBckgType[1] != kBckgNone) fFFBckgHisto1Gen->DefineHistos();
+      if(fBckgType[2] != kBckgNone) fFFBckgHisto2RecCuts->DefineHistos();
+      if(fBckgType[2] != kBckgNone) fFFBckgHisto2Gen->DefineHistos();
+      if(fBckgType[3] != kBckgNone) fFFBckgHisto3RecCuts->DefineHistos();
+      if(fBckgType[3] != kBckgNone) fFFBckgHisto3Gen->DefineHistos();
+      if(fBckgType[4] != kBckgNone) fFFBckgHisto4RecCuts->DefineHistos();
+      if(fBckgType[4] != kBckgNone) fFFBckgHisto4Gen->DefineHistos();
+
+     if(fEffMode){
+       fFFBckgHisto0RecEffRec->DefineHistos(); 
+       fFFBckgHisto0SecRecNS->DefineHistos();
+        fFFBckgHisto0SecRecS->DefineHistos();
+        fFFBckgHisto0SecRecSsc->DefineHistos();
+      }
+    }
+
+    if(fQAMode&1){
+      fQABckgHisto0RecCuts->DefineHistos();
+      fQABckgHisto0Gen->DefineHistos();
+      if(fBckgType[1] != kBckgNone) fQABckgHisto1RecCuts->DefineHistos();
+      if(fBckgType[1] != kBckgNone) fQABckgHisto1Gen->DefineHistos();
+      if(fBckgType[2] != kBckgNone) fQABckgHisto2RecCuts->DefineHistos();
+      if(fBckgType[2] != kBckgNone) fQABckgHisto2Gen->DefineHistos();
+      if(fBckgType[3] != kBckgNone) fQABckgHisto3RecCuts->DefineHistos();
+      if(fBckgType[3] != kBckgNone) fQABckgHisto3Gen->DefineHistos();
+      if(fBckgType[4] != kBckgNone) fQABckgHisto4RecCuts->DefineHistos();
+      if(fBckgType[4] != kBckgNone) fQABckgHisto4Gen->DefineHistos();
+    }
+  } // end: background
+  
+
+  Bool_t genJets    = (fJetTypeGen != kJetsUndef) ? kTRUE : kFALSE;
+  Bool_t genTracks  = (fTrackTypeGen != kTrackUndef) ? kTRUE : kFALSE;
+  Bool_t recJetsEff = (fJetTypeRecEff != kJetsUndef) ? kTRUE : kFALSE;
+
+  fCommonHistList->Add(fh1EvtSelection);
+  fCommonHistList->Add(fh1EvtMult);
+  fCommonHistList->Add(fh1EvtCent);
+  fCommonHistList->Add(fh1VertexNContributors);
+  fCommonHistList->Add(fh1VertexZ);    
+  fCommonHistList->Add(fh1nRecJetsCuts);
+  fCommonHistList->Add(fh1Xsec);
+  fCommonHistList->Add(fh1Trials);
+  fCommonHistList->Add(fh1PtHard);
+  fCommonHistList->Add(fh1PtHardTrials);
+  if(genJets) fCommonHistList->Add(fh1nGenJets);
+
+  // FF histograms
+  if(fFFMode){
+    fFFHistosRecCuts->AddToOutput(fCommonHistList);
+    if(genJets && genTracks){
+      fFFHistosGen->AddToOutput(fCommonHistList);
+    }
+  }
+
+  // Background
+  if(fBckgMode){
+    if(fFFMode){
+      fFFBckgHisto0RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[1] != kBckgNone) fFFBckgHisto1RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[2] != kBckgNone) fFFBckgHisto2RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[3] != kBckgNone) fFFBckgHisto3RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[4] != kBckgNone) fFFBckgHisto4RecCuts->AddToOutput(fCommonHistList);
+
+      if(genJets && genTracks){
+       fFFBckgHisto0Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[1] != kBckgNone) fFFBckgHisto1Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[2] != kBckgNone) fFFBckgHisto2Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[3] != kBckgNone) fFFBckgHisto3Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[4] != kBckgNone) fFFBckgHisto4Gen->AddToOutput(fCommonHistList);
+      }
+
+      if(fEffMode){
+        fFFBckgHisto0RecEffRec->AddToOutput(fCommonHistList);
+       fFFBckgHisto0SecRecNS->AddToOutput(fCommonHistList);
+        fFFBckgHisto0SecRecS->AddToOutput(fCommonHistList);
+        fFFBckgHisto0SecRecSsc->AddToOutput(fCommonHistList);
+      }
+    }
+
+    if(fQAMode&1){
+      fQABckgHisto0RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[1] != kBckgNone) fQABckgHisto1RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[2] != kBckgNone) fQABckgHisto2RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[3] != kBckgNone) fQABckgHisto3RecCuts->AddToOutput(fCommonHistList);
+      if(fBckgType[4] != kBckgNone) fQABckgHisto4RecCuts->AddToOutput(fCommonHistList);
+      if(genJets && genTracks){
+       fQABckgHisto0Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[1] != kBckgNone) fQABckgHisto1Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[2] != kBckgNone) fQABckgHisto2Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[3] != kBckgNone) fQABckgHisto3Gen->AddToOutput(fCommonHistList);
+       if(fBckgType[4] != kBckgNone) fQABckgHisto4Gen->AddToOutput(fCommonHistList);
+      }
+    }
+    
+    if(fh1BckgMult0) fCommonHistList->Add(fh1BckgMult0);
+    if(fBckgType[1] != kBckgNone)  fCommonHistList->Add(fh1BckgMult1);
+    if(fBckgType[2] != kBckgNone)  fCommonHistList->Add(fh1BckgMult2);
+    if(fBckgType[3] != kBckgNone)  fCommonHistList->Add(fh1BckgMult3);
+    if(fBckgType[4] != kBckgNone)  fCommonHistList->Add(fh1BckgMult4);
+  }
+  
+
+  if(fBranchEmbeddedJets.Length()){ 
+    fCommonHistList->Add(fh1FractionPtEmbedded);
+    fCommonHistList->Add(fh1IndexEmbedded);
+    fCommonHistList->Add(fh2DeltaPtVsJetPtEmbedded);      
+    fCommonHistList->Add(fh2DeltaPtVsRecJetPtEmbedded);      
+    fCommonHistList->Add(fh1DeltaREmbedded);
+    fCommonHistList->Add(fh1nEmbeddedJets);  
+  }
+
+
+  // QA  
+  if(fQAMode){
+    if(fQAMode&1){ // track QA
+      fQATrackHistosRecCuts->AddToOutput(fCommonHistList);
+      if(genTracks) fQATrackHistosGen->AddToOutput(fCommonHistList);
+    }
+
+    if(fQAMode&2){ // jet QA
+      fQAJetHistosRec->AddToOutput(fCommonHistList);
+      fQAJetHistosRecCuts->AddToOutput(fCommonHistList);
+      fQAJetHistosRecCutsLeading->AddToOutput(fCommonHistList);
+      if(recJetsEff && fEffMode) fQAJetHistosRecEffLeading->AddToOutput(fCommonHistList); 
+      if(genJets){
+       fQAJetHistosGen->AddToOutput(fCommonHistList);
+       fQAJetHistosGenLeading->AddToOutput(fCommonHistList);
+      }
+    }
+  }
+
+  if(fBckgMode && 
+     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
+      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)) {
+    fCommonHistList->Add(fh1nRecBckgJetsCuts);
+    if(genJets) fCommonHistList->Add(fh1nGenBckgJets);
+  }
+    
+   
+  if(fEffMode && recJetsEff && genTracks){
+    if(fQAMode&1){
+      fQATrackHistosRecEffGen->AddToOutput(fCommonHistList);
+      fQATrackHistosRecEffRec->AddToOutput(fCommonHistList);
+      fQATrackHistosSecRecNS->AddToOutput(fCommonHistList);
+      fQATrackHistosSecRecS->AddToOutput(fCommonHistList);
+      fQATrackHistosSecRecSsc->AddToOutput(fCommonHistList);
+    }
+    if(fFFMode){
+      fFFHistosRecEffRec->AddToOutput(fCommonHistList);
+      fFFHistosSecRecNS->AddToOutput(fCommonHistList);
+      fFFHistosSecRecS->AddToOutput(fCommonHistList);
+      fFFHistosSecRecSsc->AddToOutput(fCommonHistList);
+    }
+    fCommonHistList->Add(fh1nRecEffJets);
+    fCommonHistList->Add(fh2PtRecVsGenPrim); 
+    fCommonHistList->Add(fh2PtRecVsGenSec); 
+  }
+  
+  // jet shape 
+  if(fJSMode){
+
+    fProNtracksLeadingJet          = new TProfile("AvgNoOfTracksLeadingJet","AvgNoOfTracksLeadingJet",100,0,250,0,50); 
+    fProDelR80pcPt                 = new TProfile("AvgdelR80pcPt","AvgdelR80pcPt",100,0,250,0,1); 
+
+    if(genJets && genTracks){
+      fProNtracksLeadingJetGen       = new TProfile("AvgNoOfTracksLeadingJetGen","AvgNoOfTracksLeadingJetGen",100,0,250,0,50); 
+      fProDelR80pcPtGen              = new TProfile("AvgdelR80pcPtGen","AvgdelR80pcPtGen",100,0,250,0,1); 
+    }
+
+    if(fBckgMode)
+      fProNtracksLeadingJetBgrPerp2  = new TProfile("AvgNoOfTracksLeadingJetBgrPerp2","AvgNoOfTracksLeadingJetBgrPerp2",100,0,250,0,50); 
+    
+    if(fEffMode){
+      fProNtracksLeadingJetRecPrim   = new TProfile("AvgNoOfTracksLeadingJetRecPrim","AvgNoOfTracksLeadingJetRecPrim",100,0,250,0,50); 
+      fProDelR80pcPtRecPrim          = new TProfile("AvgdelR80pcPtRecPrim","AvgdelR80pcPtRecPrim",100,0,250,0,1); 
+      fProNtracksLeadingJetRecSecNS  = new TProfile("AvgNoOfTracksLeadingJetRecSecNS","AvgNoOfTracksLeadingJetRecSecNS",100,0,250,0,50); 
+      fProNtracksLeadingJetRecSecS   = new TProfile("AvgNoOfTracksLeadingJetRecSecS","AvgNoOfTracksLeadingJetRecSecS",100,0,250,0,50); 
+      fProNtracksLeadingJetRecSecSsc = new TProfile("AvgNoOfTracksLeadingJetRecSecSsc","AvgNoOfTracksLeadingJetRecSecSsc",100,0,250,0,50); 
+    }
+
+    TString strTitJS;  
+    for(Int_t ii=0; ii<5; ii++){
+      if(ii==0)strTitJS = "_JetPt20to30";
+      if(ii==1)strTitJS = "_JetPt30to40";
+      if(ii==2)strTitJS = "_JetPt40to60";
+      if(ii==3)strTitJS = "_JetPt60to80";
+      if(ii==4)strTitJS = "_JetPt80to100";
+      
+      fProDelRPtSum[ii]            = new TProfile(Form("AvgPtSumDelR%s",strTitJS.Data()),Form("AvgPtSumDelR%s",strTitJS.Data()),100,0,1,0,250);
+      if(genJets && genTracks) 
+       fProDelRPtSumGen[ii]       = new TProfile(Form("AvgPtSumDelRGen%s",strTitJS.Data()),Form("AvgPtSumDelRGen%s",strTitJS.Data()),100,0,1,0,250);
+      if(fBckgMode) 
+       fProDelRPtSumBgrPerp2[ii]  = new TProfile(Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),100,0,1,0,250);
+      if(fEffMode){
+       fProDelRPtSumRecPrim[ii]   = new TProfile(Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumRecSecNS[ii]  = new TProfile(Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumRecSecS[ii]   = new TProfile(Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumRecSecSsc[ii] = new TProfile(Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),100,0,1,0,250);
+      }
+    }
+    
+    fCommonHistList->Add(fProNtracksLeadingJet);
+    fCommonHistList->Add(fProDelR80pcPt);
+    for(int ii=0; ii<5; ii++) fCommonHistList->Add(fProDelRPtSum[ii]);
+
+    if(genJets && genTracks){
+      fCommonHistList->Add(fProNtracksLeadingJetGen);
+      fCommonHistList->Add(fProDelR80pcPtGen);
+      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumGen[ii]);
+    }
+    
+    if(fBckgMode){ 
+      fCommonHistList->Add(fProNtracksLeadingJetBgrPerp2);
+      for(Int_t ii=0; ii<5; ii++) fCommonHistList->Add(fProDelRPtSumBgrPerp2[ii]);
+    }
+
+    if(fEffMode){
+      fCommonHistList->Add(fProNtracksLeadingJetRecPrim);
+      fCommonHistList->Add(fProDelR80pcPtRecPrim);
+      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecPrim[ii]);
+      
+      fCommonHistList->Add(fProNtracksLeadingJetRecSecNS);
+      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecNS[ii]);
+
+      fCommonHistList->Add(fProNtracksLeadingJetRecSecS);
+      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecS[ii]);
+      
+      fCommonHistList->Add(fProNtracksLeadingJetRecSecSsc);
+      for(Int_t ii=0; ii<5; ii++)  fCommonHistList->Add(fProDelRPtSumRecSecSsc[ii]);
+    }
+  }
+
+  // =========== Switch on Sumw2 for all histos ===========
+  for (Int_t i=0; i<fCommonHistList->GetEntries(); ++i){
+    TH1 *h1 = dynamic_cast<TH1*>(fCommonHistList->At(i));
+    if (h1) h1->Sumw2();
+    else{
+      THnSparse *hnSparse = dynamic_cast<THnSparse*>(fCommonHistList->At(i));
+      if(hnSparse) hnSparse->Sumw2();
+    }
+  }
+  
+  TH1::AddDirectory(oldStatus);
+
+  PostData(1, fCommonHistList);
+}
+
+//_______________________________________________
+void AliAnalysisTaskFragmentationFunction::Init()
+{
+  // Initialization
+  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::Init()");
+
+}
+
+//_____________________________________________________________
+void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+  if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserExec()");
+  
+  
+  if(fDebug > 1) Printf("Analysis event #%5d", (Int_t) fEntry);
+
+  // Trigger selection
+  AliInputEventHandler* inputHandler = (AliInputEventHandler*)
+    ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+  
+  if(!(inputHandler->IsEventSelected() & fEvtSelectionMask)){
+    fh1EvtSelection->Fill(1.);
+    if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");
+    PostData(1, fCommonHistList);
+    return;
+  }
+  
+  fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+  if(!fESD){
+    if(fDebug>3) Printf("%s:%d ESDEvent not found in the input", (char*)__FILE__,__LINE__);
+  }
+  
+  fMCEvent = MCEvent();
+  if(!fMCEvent){
+    if(fDebug>3) Printf("%s:%d MCEvent not found in the input", (char*)__FILE__,__LINE__);
+  }
+  
+  // get AOD event from input/ouput
+  TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+  if( handler && handler->InheritsFrom("AliAODInputHandler") ) {
+    fAOD  =  ((AliAODInputHandler*)handler)->GetEvent();
+    if(fUseAODInputJets) fAODJets = fAOD;
+    if (fDebug > 1)  Printf("%s:%d AOD event from input", (char*)__FILE__,__LINE__);
+  }
+  else {
+    handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
+    if( handler && handler->InheritsFrom("AliAODHandler") ) {
+      fAOD = ((AliAODHandler*)handler)->GetAOD();
+      fAODJets = fAOD;
+      if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);
+    }
+  }
+  
+  if(!fAODJets && !fUseAODInputJets){ // case we have AOD in input & output and want jets from output
+    TObject* outHandler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
+    if( outHandler && outHandler->InheritsFrom("AliAODHandler") ) {
+      fAODJets = ((AliAODHandler*)outHandler)->GetAOD();
+      if (fDebug > 1)  Printf("%s:%d jets from output AOD", (char*)__FILE__,__LINE__);
+    }
+  }
+  
+  if(fNonStdFile.Length()!=0){
+    // case we have an AOD extension - fetch the jets from the extended output
+    
+    AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
+    fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);    
+    if(!fAODExtension){
+      if(fDebug>1)Printf("AODExtension not found for %s",fNonStdFile.Data());
+    }
+  }
+  
+  if(!fAOD){
+    Printf("%s:%d AODEvent not found", (char*)__FILE__,__LINE__);
+    return;
+  }
+  if(!fAODJets){
+    Printf("%s:%d AODEvent with jet branch not found", (char*)__FILE__,__LINE__);
+    return;
+  }
+
+  
+  // event selection **************************************************
+  // *** event class ***
+  Double_t centPercent = -1;
+  if(fEventClass>0){
+    Int_t cl = 0;
+    if(handler->InheritsFrom("AliAODInputHandler")){ 
+      // since it is not supported by the helper task define own classes
+      centPercent = fAOD->GetHeader()->GetCentrality();
+      cl = 1;
+      if(centPercent>10) cl = 2;
+      if(centPercent>30) cl = 3;
+      if(centPercent>50) cl = 4;
+    }
+    else {
+      cl = AliAnalysisHelperJetTasks::EventClass();
+      if(fESD) centPercent = fESD->GetCentrality()->GetCentralityPercentile("V0M"); // retrieve value 'by hand'
+    }
+    
+    if(cl!=fEventClass){
+      // event not in selected event class, reject event
+      if (fDebug > 1) Printf("%s:%d event not in selected event class: event REJECTED ...",(char*)__FILE__,__LINE__);
+      fh1EvtSelection->Fill(2.);
+      PostData(1, fCommonHistList);
+      return;
+    }
+  }
+
+  // *** vertex cut ***
+  AliAODVertex* primVtx = fAOD->GetPrimaryVertex();
+  Int_t nTracksPrim = primVtx->GetNContributors();
+  fh1VertexNContributors->Fill(nTracksPrim);
+  
+  
+  if (fDebug > 1) Printf("%s:%d primary vertex selection: %d", (char*)__FILE__,__LINE__,nTracksPrim);
+  if(!nTracksPrim){
+    if (fDebug > 1) Printf("%s:%d primary vertex selection: event REJECTED...",(char*)__FILE__,__LINE__); 
+    fh1EvtSelection->Fill(3.);
+    PostData(1, fCommonHistList);
+    return;
+  }
+  
+  fh1VertexZ->Fill(primVtx->GetZ());
+  
+  if(TMath::Abs(primVtx->GetZ())>fMaxVertexZ){
+    if (fDebug > 1) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); 
+    fh1EvtSelection->Fill(4.);
+    PostData(1, fCommonHistList);
+    return; 
+  }
+  
+  TString primVtxName(primVtx->GetName());
+
+  if(primVtxName.CompareTo("TPCVertex",TString::kIgnoreCase) == 1){
+    if (fDebug > 1) Printf("%s:%d primary vertex selection: TPC vertex, event REJECTED...",(char*)__FILE__,__LINE__);
+    fh1EvtSelection->Fill(5.);
+    PostData(1, fCommonHistList);
+    return;
+  }
+
+  if (fDebug > 1) Printf("%s:%d event ACCEPTED ...",(char*)__FILE__,__LINE__); 
+  fh1EvtSelection->Fill(0.);
+  fh1EvtCent->Fill(centPercent);
+
+
+  //___ get MC information __________________________________________________________________
+
+  fh1Trials->Fill("#sum{ntrials}",fAvgTrials); 
+
+  Double_t ptHard = 0.;
+  Double_t nTrials = 1; // trials for MC trigger weight for real data
+
+  if(fMCEvent){
+    AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();
+    
+    if(genHeader){
+      
+      AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
+      AliGenHijingEventHeader*  hijingGenHeader = 0x0;
+      
+      if(pythiaGenHeader){
+       if(fDebug>3) Printf("%s:%d pythiaGenHeader found", (char*)__FILE__,__LINE__);
+       nTrials = pythiaGenHeader->Trials();
+       ptHard  = pythiaGenHeader->GetPtHard();
+       
+       fh1PtHard->Fill(ptHard);
+       fh1PtHardTrials->Fill(ptHard,nTrials);
+       
+      } else { // no pythia, hijing?
+       
+       if(fDebug>3) Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);
+       
+       hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);
+       if(!hijingGenHeader){
+         Printf("%s:%d no pythiaGenHeader or hjingGenHeader found", (char*)__FILE__,__LINE__);
+       } else {
+         if(fDebug>3) Printf("%s:%d hijingGenHeader found", (char*)__FILE__,__LINE__);
+       }
+      }
+      
+      //fh1Trials->Fill("#sum{ntrials}",fAvgTrials); 
+    }
+  }
+  
+  //___ fetch jets __________________________________________________________________________
+  
+  Int_t nJ = GetListOfJets(fJetsRec, kJetsRec);
+  Int_t nRecJets = 0;
+  if(nJ>=0) nRecJets = fJetsRec->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected Rec jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);
+  if(nJ != nRecJets) Printf("%s:%d Mismatch Selected Rec Jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);
+  
+  Int_t nJCuts = GetListOfJets(fJetsRecCuts, kJetsRecAcceptance);
+  Int_t nRecJetsCuts = 0;
+  if(nJCuts>=0) nRecJetsCuts = fJetsRecCuts->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);
+  if(nRecJetsCuts != nJCuts) Printf("%s:%d Mismatch selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);
+  fh1nRecJetsCuts->Fill(nRecJetsCuts);
+
+  if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() 
+
+  Int_t nJGen  = GetListOfJets(fJetsGen, fJetTypeGen);
+  Int_t nGenJets = 0;
+  if(nJGen>=0) nGenJets = fJetsGen->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);
+  
+  if(nJGen != nGenJets) Printf("%s:%d Mismatch selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);
+  fh1nGenJets->Fill(nGenJets);
+  
+  
+  if(fJetTypeRecEff==kJetsKine || fJetTypeRecEff == kJetsKineAcceptance) fJetsRecEff->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() 
+  Int_t nJRecEff  = GetListOfJets(fJetsRecEff, fJetTypeRecEff);
+  Int_t nRecEffJets = 0;
+  if(nJRecEff>=0) nRecEffJets = fJetsRecEff->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected RecEff jets: %d %d",(char*)__FILE__,__LINE__,nJRecEff,nRecEffJets);
+  if(nJRecEff != nRecEffJets) Printf("%s:%d Mismatch selected RecEff jets: %d %d",(char*)__FILE__,__LINE__,nJRecEff,nRecEffJets);
+  fh1nRecEffJets->Fill(nRecEffJets);
+  
+  
+  Int_t nEmbeddedJets =  0; 
+  TArrayI iEmbeddedMatchIndex; 
+  TArrayF fEmbeddedPtFraction; 
+  
+
+  if(fBranchEmbeddedJets.Length()){ 
+    Int_t nJEmbedded = GetListOfJets(fJetsEmbedded, kJetsEmbedded);
+    if(nJEmbedded>=0) nEmbeddedJets = fJetsEmbedded->GetEntries();
+    if(fDebug>2)Printf("%s:%d Selected Embedded jets: %d %d",(char*)__FILE__,__LINE__,nJEmbedded,nEmbeddedJets);
+    if(nJEmbedded != nEmbeddedJets) Printf("%s:%d Mismatch Selected Embedded Jets: %d %d",(char*)__FILE__,__LINE__,nJEmbedded,nEmbeddedJets);
+    fh1nEmbeddedJets->Fill(nEmbeddedJets);
+    
+    Float_t maxDist = 0.3;
+
+    iEmbeddedMatchIndex.Set(nEmbeddedJets); 
+    fEmbeddedPtFraction.Set(nEmbeddedJets); 
+    
+    iEmbeddedMatchIndex.Reset(-1);
+    fEmbeddedPtFraction.Reset(0);
+    
+    AliAnalysisHelperJetTasks::GetJetMatching(fJetsEmbedded, nEmbeddedJets, 
+                                             fJetsRecCuts, nRecJetsCuts, 
+                                             iEmbeddedMatchIndex, fEmbeddedPtFraction,
+                                             fDebug, maxDist);
+    
+  }
+  
+  //____ fetch background clusters ___________________________________________________
+  if(fBckgMode && 
+     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
+      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
+
+    Int_t nBJ = GetListOfBckgJets(fBckgJetsRec, kJetsRec);
+    Int_t nRecBckgJets = 0;
+    if(nBJ>=0) nRecBckgJets = fBckgJetsRec->GetEntries();
+    if(fDebug>2)Printf("%s:%d Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);
+    if(nBJ != nRecBckgJets) Printf("%s:%d Mismatch Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);
+
+    Int_t nBJCuts = GetListOfBckgJets(fBckgJetsRecCuts, kJetsRecAcceptance);
+    Int_t nRecBckgJetsCuts = 0;
+    if(nBJCuts>=0) nRecBckgJetsCuts = fBckgJetsRecCuts->GetEntries();
+    if(fDebug>2)Printf("%s:%d Selected Rec background jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);
+    if(nRecBckgJetsCuts != nBJCuts) Printf("%s:%d Mismatch selected Rec background jets after cuts: %d %d",(char*)__FILE__,__LINE__,nBJCuts,nRecBckgJetsCuts);
+    fh1nRecBckgJetsCuts->Fill(nRecBckgJetsCuts);
+    
+    if(0){ // protection OB - not yet implemented 
+      if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fBckgJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear()
+      Int_t nBJGen  = GetListOfBckgJets(fBckgJetsGen, fJetTypeGen);
+      Int_t nGenBckgJets = 0;
+      if(nBJGen>=0) nGenBckgJets = fBckgJetsGen->GetEntries();
+      if(fDebug>2)Printf("%s:%d Selected Gen background jets: %d %d",(char*)__FILE__,__LINE__,nBJGen,nGenBckgJets);
+      if(nBJGen != nGenBckgJets) Printf("%s:%d Mismatch selected Gen background jets: %d %d",(char*)__FILE__,__LINE__,nBJGen,nGenBckgJets);
+      fh1nGenBckgJets->Fill(nGenBckgJets);
+    }
+  }
+
+
+  //____ fetch particles __________________________________________________________
+  
+  Int_t nTCuts;
+  if(fUseExtraTracks ==  1)      nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODExtraCuts);
+  else if(fUseExtraTracks == -1) nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODExtraonlyCuts);
+  else                           nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODCuts);
+  
+  Int_t nRecPartCuts = 0;
+  if(nTCuts>=0) nRecPartCuts = fTracksRecCuts->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);
+  if(nRecPartCuts != nTCuts) Printf("%s:%d Mismatch selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);
+  fh1EvtMult->Fill(nRecPartCuts);
+
+
+  Int_t nTGen = GetListOfTracks(fTracksGen,fTrackTypeGen);
+  Int_t nGenPart = 0;
+  if(nTGen>=0) nGenPart = fTracksGen->GetEntries();
+  if(fDebug>2)Printf("%s:%d Selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);
+  if(nGenPart != nTGen) Printf("%s:%d Mismatch selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);
+  
+  
+  //____ analysis, fill histos ___________________________________________________
+  
+  if(fQAMode){
+    // loop over tracks
+    if(fQAMode&1){
+      for(Int_t it=0; it<nRecPartCuts; ++it){
+       AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRecCuts->At(it));
+       if(part)fQATrackHistosRecCuts->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt() );
+      }      
+      for(Int_t it=0; it<nGenPart; ++it){
+       AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksGen->At(it));
+       if(part)fQATrackHistosGen->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());
+      }
+    }
+    
+    // loop over jets
+    if(fQAMode&2){
+      for(Int_t ij=0; ij<nRecJets; ++ij){
+       AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRec->At(ij));
+       if(jet)fQAJetHistosRec->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
+      }
+    }
+  }
+  
+  if(fQAMode || fFFMode){
+    for(Int_t ij=0; ij<nRecJetsCuts; ++ij){
+      
+      AliAODJet* jet = (AliAODJet*)(fJetsRecCuts->At(ij));
+      if(fQAMode&2) fQAJetHistosRecCuts->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
+      
+      if(ij==0){ // leading jet
+       
+       if(fQAMode&2) fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );
+
+       Double_t ptFractionEmbedded = 0; 
+       AliAODJet* embeddedJet = 0; 
+
+       if(fBranchEmbeddedJets.Length()){ // find embedded jet
+
+         Int_t indexEmbedded = -1;
+         for(Int_t i=0; i<nEmbeddedJets; i++){
+           if(iEmbeddedMatchIndex[i] == ij){
+             indexEmbedded      = i;
+             ptFractionEmbedded = fEmbeddedPtFraction[i];
+           }
+         }
+
+         fh1IndexEmbedded->Fill(indexEmbedded);
+         fh1FractionPtEmbedded->Fill(ptFractionEmbedded);
+         
+         if(indexEmbedded>-1){ 
+           
+           embeddedJet = dynamic_cast<AliAODJet*>(fJetsEmbedded->At(indexEmbedded));
+           if(!embeddedJet) continue;
+
+           Double_t deltaPt = jet->Pt() - embeddedJet->Pt();
+           Double_t deltaR  = jet->DeltaR((AliVParticle*) (embeddedJet)); 
+           
+           fh2DeltaPtVsJetPtEmbedded->Fill(embeddedJet->Pt(),deltaPt);
+           fh2DeltaPtVsRecJetPtEmbedded->Fill(jet->Pt(),deltaPt);
+           fh1DeltaREmbedded->Fill(deltaR);
+         }
+       }
+
+       // get tracks in jet
+       TList* jettracklist = new TList();
+       Double_t sumPt      = 0.;
+       Bool_t isBadJet     = kFALSE;
+
+       if(GetFFRadius()<=0){
+         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+       } else {
+         if(fUseEmbeddedJetAxis){
+           if(embeddedJet) GetJetTracksPointing(fTracksRecCuts, jettracklist, embeddedJet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+         }
+         else              GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+       }
+       
+       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;
+       
+       if(isBadJet) continue; 
+
+       if(ptFractionEmbedded>=fCutFractionPtEmbedded){ // if no embedding: ptFraction = cutFraction = 0
+         
+         for(Int_t it=0; it<jettracklist->GetSize(); ++it){
+
+           AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));
+           if(!trackVP)continue;
+
+            AliAODTrack * aodtrack  = dynamic_cast<AliAODTrack*>(jettracklist->At(it));
+            if(!aodtrack) continue;
+
+           TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());
+           
+           Float_t jetPt   = jet->Pt();
+           if(fUseEmbeddedJetPt){
+             if(embeddedJet) jetPt = embeddedJet->Pt();
+             else jetPt = 0;
+           }
+           Float_t trackPt = trackV->Pt();
+
+
+           Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
+           
+           if(fFFMode) fFFHistosRecCuts->FillFF(trackPt, jetPt, incrementJetPt);
+
+           delete trackV;
+         }
+         
+         // background ff
+         if(fBckgMode){
+           if(fBckgType[0]!=kBckgNone)
+             FillBckgHistos(fBckgType[0], fTracksRecCuts, fJetsRecCuts, jet,  
+                            fFFBckgHisto0RecCuts,fQABckgHisto0RecCuts, fh1BckgMult0);
+           if(fBckgType[1]!=kBckgNone)
+             FillBckgHistos(fBckgType[1], fTracksRecCuts, fJetsRecCuts, jet,
+                            fFFBckgHisto1RecCuts,fQABckgHisto1RecCuts, fh1BckgMult1);
+           if(fBckgType[2]!=kBckgNone)
+             FillBckgHistos(fBckgType[2], fTracksRecCuts, fJetsRecCuts, jet, 
+                            fFFBckgHisto2RecCuts,fQABckgHisto2RecCuts, fh1BckgMult2);
+           if(fBckgType[3]!=kBckgNone)
+             FillBckgHistos(fBckgType[3], fTracksRecCuts, fJetsRecCuts, jet, 
+                            fFFBckgHisto3RecCuts,fQABckgHisto3RecCuts, fh1BckgMult3);
+           if(fBckgType[4]!=kBckgNone)
+             FillBckgHistos(fBckgType[4], fTracksRecCuts, fJetsRecCuts, jet, 
+                            fFFBckgHisto4RecCuts,fQABckgHisto4RecCuts, fh1BckgMult4);
+         } // end if(fBckgMode)
+        
+
+         if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJet, fProDelRPtSum, fProDelR80pcPt);
+          
+         delete jettracklist;  
+
+       } // end: cut embedded ratio
+      } // end: leading jet
+    } // end: rec. jets after cuts
+    
+    // generated jets
+    for(Int_t ij=0; ij<nGenJets; ++ij){
+      
+      AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));
+      if(!jet)continue;
+      if(fQAMode&2) fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
+      
+      if(ij==0){ // leading jet
+       
+       if(fQAMode&2) fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
+
+       TList* jettracklist = new TList();
+       Double_t sumPt      = 0.;
+       Bool_t isBadJet     = kFALSE;
+       
+       if(GetFFRadius()<=0){
+         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+       } else {
+         GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+       }
+       
+       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;;
+       if(isBadJet) continue; 
+
+       for(Int_t it=0; it<jettracklist->GetSize(); ++it){
+         
+         AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));
+         if(!trackVP)continue;
+         TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());
+         
+         Float_t jetPt   = jet->Pt();
+         Float_t trackPt = trackV->Pt();
+         
+         Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
+         
+         if(fFFMode) fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt );
+         
+         delete trackV;
+       }
+
+       if(fBckgMode){
+         if(fBckgType[0]!=kBckgNone)
+           FillBckgHistos(fBckgType[0], fTracksGen, fJetsGen, jet,
+                          fFFBckgHisto0Gen, fQABckgHisto0Gen);
+         if(fBckgType[1]!=kBckgNone)
+           FillBckgHistos(fBckgType[1], fTracksGen, fJetsGen, jet,
+                          fFFBckgHisto1Gen, fQABckgHisto1Gen);
+         if(fBckgType[2]!=kBckgNone)
+           FillBckgHistos(fBckgType[2], fTracksGen, fJetsGen, jet,
+                          fFFBckgHisto2Gen, fQABckgHisto2Gen);
+         if(fBckgType[3]!=kBckgNone)
+           FillBckgHistos(fBckgType[3], fTracksGen, fJetsGen, jet,
+                          fFFBckgHisto3Gen, fQABckgHisto3Gen);
+         if(fBckgType[4]!=kBckgNone)
+           FillBckgHistos(fBckgType[4], fTracksGen, fJetsGen, jet,
+                          fFFBckgHisto4Gen, fQABckgHisto4Gen);
+       } // end if(fBckgMode)
+       
+
+       if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJetGen, fProDelRPtSumGen, fProDelR80pcPtGen);
+
+       delete jettracklist;
+      }
+    }
+  } // end: QA, FF and intra-jet
+
+      
+  // ____ efficiency _______________________________
+
+  if(fEffMode && (fJetTypeRecEff != kJetsUndef)){
+
+    // arrays holding for each generated particle the reconstructed AOD track index & isPrimary flag, are initialized in AssociateGenRec(...) function
+    TArrayI indexAODTr; 
+    TArrayS isGenPrim; 
+
+    // array holding for each reconstructed AOD track generated particle index, initialized in AssociateGenRec(...) function
+    TArrayI indexMCTr; 
+
+    // ... and another set for secondaries from strange/non strange mothers (secondary MC tracks are stored in different lists)
+    TArrayI indexAODTrSecNS; 
+    TArrayS isGenSecNS; 
+    TArrayI indexMCTrSecNS; 
+   
+    TArrayI indexAODTrSecS; 
+    TArrayS isGenSecS; 
+    TArrayI indexMCTrSecS; 
+
+    Int_t  nTracksAODMCCharged = GetListOfTracks(fTracksAODMCCharged, kTrackAODMCCharged);
+    if(fDebug>2)Printf("%s:%d selected AODMC tracks: %d ",(char*)__FILE__,__LINE__,nTracksAODMCCharged);
+  
+    Int_t  nTracksAODMCChargedSecNS = GetListOfTracks(fTracksAODMCChargedSecNS, kTrackAODMCChargedSecNS);
+    if(fDebug>2)Printf("%s:%d selected AODMC secondary tracks NS: %d ",(char*)__FILE__,__LINE__,nTracksAODMCChargedSecNS);
+  
+    Int_t  nTracksAODMCChargedSecS = GetListOfTracks(fTracksAODMCChargedSecS, kTrackAODMCChargedSecS);
+    if(fDebug>2)Printf("%s:%d selected AODMC secondary tracks S: %d ",(char*)__FILE__,__LINE__,nTracksAODMCChargedSecS);
+
+    Int_t  nTracksRecQualityCuts = GetListOfTracks(fTracksRecQualityCuts, kTrackAODQualityCuts);
+    if(fDebug>2)Printf("%s:%d selected rec tracks quality after cuts, full acceptance/pt : %d ",(char*)__FILE__,__LINE__,nTracksRecQualityCuts);
+  
+    // associate gen and rec tracks, store indices in TArrays 
+    AssociateGenRec(fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,indexMCTr,isGenPrim,fh2PtRecVsGenPrim); 
+    AssociateGenRec(fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,indexMCTrSecNS,isGenSecNS,fh2PtRecVsGenSec);
+    AssociateGenRec(fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,indexMCTrSecS,isGenSecS,fh2PtRecVsGenSec);
+  
+    // single track eff
+    if(fQAMode&1) FillSingleTrackHistosRecGen(fQATrackHistosRecEffGen,fQATrackHistosRecEffRec,fTracksAODMCCharged,indexAODTr,isGenPrim);
+
+    // secondaries
+    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecNS,fTracksAODMCChargedSecNS,indexAODTrSecNS,isGenSecNS);
+    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecS,fTracksAODMCChargedSecS,indexAODTrSecS,isGenSecS);
+    if(fQAMode&1) FillSingleTrackHistosRecGen(0x0,fQATrackHistosSecRecSsc,fTracksAODMCChargedSecS,indexAODTrSecS,isGenSecS,kTRUE);
+
+
+    // jet track eff    
+    Double_t sumPtGenLeadingJetRecEff = 0;
+    Double_t sumPtGenLeadingJetSec    = 0;
+    Double_t sumPtRecLeadingJetRecEff = 0;
+    
+    for(Int_t ij=0; ij<nRecEffJets; ++ij){ // jet loop 
+    
+      AliAODJet* jet = (AliAODJet*)(fJetsRecEff->At(ij));
+
+      Bool_t isBadJetGenPrim = kFALSE;
+      Bool_t isBadJetGenSec  = kFALSE;
+      Bool_t isBadJetRec     = kFALSE;
+    
+
+      if(ij==0){ // leading jet
+       
+       // for efficiency: gen tracks from pointing with gen/rec jet
+       TList* jettracklistGenPrim = new TList();
+       
+       // if radius<0 -> trackRefs: collect gen tracks in wide radius + fill FF recEff rec histos with tracks contained in track refs
+        // note : FF recEff gen histos will be somewhat useless in this approach
+
+       if(GetFFRadius() >0)
+         GetJetTracksPointing(fTracksAODMCCharged, jettracklistGenPrim, jet, GetFFRadius(), sumPtGenLeadingJetRecEff, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetGenPrim); 
+       else
+         GetJetTracksPointing(fTracksAODMCCharged, jettracklistGenPrim, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetRecEff, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetGenPrim); 
+
+       TList* jettracklistGenSecNS = new TList();
+       if(GetFFRadius() >0)
+         GetJetTracksPointing(fTracksAODMCChargedSecNS, jettracklistGenSecNS, jet, GetFFRadius(), sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); 
+        else
+         GetJetTracksPointing(fTracksAODMCChargedSecNS, jettracklistGenSecNS, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); 
+
+       TList* jettracklistGenSecS = new TList();
+       if(GetFFRadius() >0)
+         GetJetTracksPointing(fTracksAODMCChargedSecS, jettracklistGenSecS, jet, GetFFRadius(), sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); 
+        else
+         GetJetTracksPointing(fTracksAODMCChargedSecS, jettracklistGenSecS, jet, TMath::Abs(GetFFRadius())+0.2, sumPtGenLeadingJetSec, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetGenSec); 
+
+
+       // bin efficiency in jet pt bins using rec tracks  
+       TList* jettracklistRec = new TList();
+       if(GetFFRadius() >0) GetJetTracksPointing(fTracksRecCuts,jettracklistRec, jet, GetFFRadius(), sumPtRecLeadingJetRecEff, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetRec); 
+       else                 GetJetTracksTrackrefs(jettracklistRec, jet, GetFFMinLTrackPt() , GetFFMaxTrackPt(), isBadJetRec); 
+       
+
+       Double_t jetEta   = jet->Eta();
+       Double_t jetPhi   = TVector2::Phi_0_2pi(jet->Phi());
+       
+       if(GetFFMinNTracks()>0 && jettracklistGenPrim->GetSize()<=GetFFMinNTracks())   isBadJetGenPrim = kTRUE;
+       if(GetFFMinNTracks()>0 && jettracklistGenSecNS->GetSize()<=GetFFMinNTracks())  isBadJetGenSec  = kTRUE;
+       if(GetFFMinNTracks()>0 && jettracklistRec->GetSize()<=GetFFMinNTracks())       isBadJetRec     = kTRUE;
+
+       if(isBadJetRec) continue;
+
+       if(fQAMode&2) fQAJetHistosRecEffLeading->FillJetQA( jetEta, jetPhi, sumPtGenLeadingJetRecEff ); 
+       
+       if(fFFMode){
+         
+         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosRecEffRec,jet,
+                                                   jettracklistGenPrim,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim, 
+                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecPrim,fProDelRPtSumRecPrim,fProDelR80pcPtRecPrim); 
+         
+          else                FillJetTrackHistosRec(fFFHistosRecEffRec,jet,
+                                                   jettracklistGenPrim,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim,
+                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecPrim,fProDelRPtSumRecPrim,fProDelR80pcPtRecPrim); 
+         
+
+         // secondaries: use jet pt from primaries 
+         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecNS,jet,
+                                                   jettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts, indexAODTrSecNS,isGenSecNS,
+                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecSecNS,fProDelRPtSumRecSecNS); 
+         
+         else                FillJetTrackHistosRec(fFFHistosSecRecNS,jet,
+                                                   jettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,isGenSecNS,
+                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecSecNS,fProDelRPtSumRecSecNS);  
+         
+         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecS,jet,
+                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,
+                                                   0,kFALSE,fJSMode,fProNtracksLeadingJetRecSecS,fProDelRPtSumRecSecS); 
+
+         else                FillJetTrackHistosRec(fFFHistosSecRecS,jet,
+                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,
+                                                   jettracklistRec,kFALSE,fJSMode,fProNtracksLeadingJetRecSecS,fProDelRPtSumRecSecS);  
+         
+         if(GetFFRadius()>0) FillJetTrackHistosRec(fFFHistosSecRecSsc,jet,
+                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,
+                                                   0,kTRUE,fJSMode,fProNtracksLeadingJetRecSecSsc,fProDelRPtSumRecSecSsc); 
+         
+         else                FillJetTrackHistosRec(fFFHistosSecRecSsc,jet,
+                                                   jettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,
+                                                   jettracklistRec,kTRUE,fJSMode,fProNtracksLeadingJetRecSecSsc,fProDelRPtSumRecSecSsc);
+        }
+       
+       delete jettracklistGenPrim;
+       delete jettracklistGenSecNS;
+       delete jettracklistGenSecS;
+       delete jettracklistRec;
+      
+      
+        if(fBckgMode && fFFMode){ 
+
+         TList* perpjettracklistGen  = new TList();
+         TList* perpjettracklistGen1 = new TList();
+         TList* perpjettracklistGen2 = new TList();
+
+         Double_t sumPtGenPerp  = 0.;
+         Double_t sumPtGenPerp1 = 0.;
+         Double_t sumPtGenPerp2 = 0.;
+         GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp1); 
+         GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp2); 
+
+         perpjettracklistGen->AddAll(perpjettracklistGen1);
+         perpjettracklistGen->AddAll(perpjettracklistGen2);
+         sumPtGenPerp = 0.5*(sumPtGenPerp1+sumPtGenPerp2);
+
+         TList* perpjettracklistGenSecNS  = new TList();
+         TList* perpjettracklistGenSecNS1 = new TList();
+         TList* perpjettracklistGenSecNS2 = new TList();
+
+          Double_t sumPtGenPerpNS;
+          Double_t sumPtGenPerpNS1;
+          Double_t sumPtGenPerpNS2;
+          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS1); 
+          GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS2); 
+
+         perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS1);
+         perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS2);
+         sumPtGenPerpNS = 0.5*(sumPtGenPerpNS1+sumPtGenPerpNS2);
+
+
+         TList* perpjettracklistGenSecS  = new TList();
+         TList* perpjettracklistGenSecS1 = new TList();
+         TList* perpjettracklistGenSecS2 = new TList();
+
+          Double_t sumPtGenPerpS;
+          Double_t sumPtGenPerpS1;
+          Double_t sumPtGenPerpS2;
+          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS1); 
+          GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS2); 
+
+         perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS1);
+         perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS2);
+         sumPtGenPerpS = 0.5*(sumPtGenPerpS1+sumPtGenPerpS2);
+
+
+          if(perpjettracklistGen->GetSize() != perpjettracklistGen1->GetSize() + perpjettracklistGen2->GetSize()){
+           cout<<" ERROR: perpjettracklistGen size "<<perpjettracklistGen->GetSize()<<" perp1 "<<perpjettracklistGen1->GetSize()
+               <<" perp2 "<<perpjettracklistGen2->GetSize()<<endl;
+            exit(0); 
+          }
+
+          if(perpjettracklistGenSecNS->GetSize() != perpjettracklistGenSecNS1->GetSize() + perpjettracklistGenSecNS2->GetSize()){
+           cout<<" ERROR: perpjettracklistGenSecNS size "<<perpjettracklistGenSecNS->GetSize()<<" perp1 "<<perpjettracklistGenSecNS1->GetSize()
+               <<" perp2 "<<perpjettracklistGenSecNS2->GetSize()<<endl;
+            exit(0); 
+          }
+
+          if(perpjettracklistGenSecS->GetSize() != perpjettracklistGenSecS1->GetSize() + perpjettracklistGenSecS2->GetSize()){
+           cout<<" ERROR: perpjettracklistGenSecS size "<<perpjettracklistGenSecS->GetSize()<<" perp1 "<<perpjettracklistGenSecS1->GetSize()
+               <<" perp2 "<<perpjettracklistGenSecS2->GetSize()<<endl;
+            exit(0); 
+          }
+
+
+         FillJetTrackHistosRec(fFFBckgHisto0RecEffRec,jet,
+                               perpjettracklistGen,fTracksAODMCCharged,fTracksRecQualityCuts,indexAODTr,isGenPrim); 
+         
+         FillJetTrackHistosRec(fFFBckgHisto0SecRecNS,jet,
+                               perpjettracklistGenSecNS,fTracksAODMCChargedSecNS,fTracksRecQualityCuts,indexAODTrSecNS,isGenSecNS); 
+         
+         FillJetTrackHistosRec(fFFBckgHisto0SecRecS,jet,
+                               perpjettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS); 
+         
+         FillJetTrackHistosRec(fFFBckgHisto0SecRecSsc,jet,
+                               perpjettracklistGenSecS,fTracksAODMCChargedSecS,fTracksRecQualityCuts,indexAODTrSecS,isGenSecS,0,kTRUE); 
+         
+         
+         delete perpjettracklistGen;
+         delete perpjettracklistGen1;
+         delete perpjettracklistGen2;
+
+         delete perpjettracklistGenSecNS;
+         delete perpjettracklistGenSecNS1;
+         delete perpjettracklistGenSecNS2;
+
+         delete perpjettracklistGenSecS;
+         delete perpjettracklistGenSecS1;
+         delete perpjettracklistGenSecS2;
+         
+       }
+      }
+    }
+  }
+  
+  //___________________
+  
+  fTracksRecCuts->Clear();
+  fTracksGen->Clear();
+  fTracksAODMCCharged->Clear();
+  fTracksAODMCChargedSecNS->Clear();
+  fTracksAODMCChargedSecS->Clear();
+  fTracksRecQualityCuts->Clear();
+
+  fJetsRec->Clear();
+  fJetsRecCuts->Clear();
+  fJetsGen->Clear();
+  fJetsRecEff->Clear();
+  fJetsEmbedded->Clear();
+
+
+  if(fBckgMode && 
+     (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
+      fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
+      fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
+    
+    fBckgJetsRec->Clear();
+    fBckgJetsRecCuts->Clear();
+    fBckgJetsGen->Clear();
+  }
+
+  
+  //Post output data.
+  PostData(1, fCommonHistList);
+}
+
+//______________________________________________________________
+void AliAnalysisTaskFragmentationFunction::Terminate(Option_t *) 
+{
+  // terminated
+
+  if(fDebug > 1) printf("AliAnalysisTaskFragmentationFunction::Terminate() \n");
+}  
+
+//_________________________________________________________________________________
+Int_t AliAnalysisTaskFragmentationFunction::GetListOfTracks(TList *list, Int_t type)
+{
+  // fill list of tracks selected according to type
+
+  if(fDebug > 2) Printf("%s:%d Selecting tracks with %d", (char*)__FILE__,__LINE__,type);
+  
+  if(!list){
+    if(fDebug>1) Printf("%s:%d no input list", (char*)__FILE__,__LINE__);
+    return -1;
+  }
+
+  if(!fAOD) return -1;
+
+  if(!fAOD->GetTracks()) return 0;
+
+  if(type==kTrackUndef) return 0;
+  
+  Int_t iCount = 0;
+
+  if(type==kTrackAODExtraCuts || type==kTrackAODExtraonlyCuts || type==kTrackAODExtra || type==kTrackAODExtraonly){
+    
+    TClonesArray *aodExtraTracks = dynamic_cast<TClonesArray*>(fAOD->FindListObject("aodExtraTracks"));
+    if(!aodExtraTracks)return iCount;
+    for(int it =0; it<aodExtraTracks->GetEntries(); it++) {
+      AliVParticle *track = dynamic_cast<AliVParticle*> ((*aodExtraTracks)[it]);
+      if (!track) continue;
+      
+      AliAODTrack *tr = dynamic_cast<AliAODTrack*> (track);
+      if(!tr)continue;
+
+      if(type==kTrackAODExtraCuts || type==kTrackAODExtraonlyCuts){
+
+       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;
+       
+       if(tr->Eta() < fTrackEtaMin || tr->Eta() > fTrackEtaMax) continue;
+       if(tr->Phi() < fTrackPhiMin || tr->Phi() > fTrackPhiMax) continue;
+       if(tr->Pt()  < fTrackPtCut) continue;
+      }    
+
+      list->Add(tr);
+      iCount++;
+    }
+  }
+
+  if(type==kTrackAODCuts || type==kTrackAODQualityCuts || type==kTrackAOD || type==kTrackAODExtraCuts || type==kTrackAODExtra){
+
+    // all rec. tracks, esd filter mask, eta range
+    
+    for(Int_t it=0; it<fAOD->GetNumberOfTracks(); ++it){
+      AliAODTrack *tr = fAOD->GetTrack(it);
+      
+      if(type == kTrackAODCuts || type==kTrackAODQualityCuts || type==kTrackAODExtraCuts){
+
+       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;
+       if(type == kTrackAODCuts){
+         if(tr->Eta() < fTrackEtaMin || tr->Eta() > fTrackEtaMax) continue;
+         if(tr->Phi() < fTrackPhiMin || tr->Phi() > fTrackPhiMax) continue;
+         if(tr->Pt()  < fTrackPtCut) continue;
+       }
+      }
+      list->Add(tr);
+      iCount++;
+    }
+  }
+  else if (type==kTrackKineAll || type==kTrackKineCharged || type==kTrackKineChargedAcceptance){
+    // kine particles, all or rather charged
+    if(!fMCEvent) return iCount;
+    
+    for(Int_t it=0; it<fMCEvent->GetNumberOfTracks(); ++it){
+      AliMCParticle* part = (AliMCParticle*) fMCEvent->GetTrack(it);
+      
+      if(type == kTrackKineCharged || type == kTrackKineChargedAcceptance){
+       if(part->Charge()==0) continue;
+       
+       if(type == kTrackKineChargedAcceptance && 
+          (       part->Eta() < fTrackEtaMin
+               || part->Eta() > fTrackEtaMax
+               || part->Phi() < fTrackPhiMin
+               || part->Phi() > fTrackPhiMax 
+               || part->Pt()  < fTrackPtCut)) continue;
+      }
+      
+      list->Add(part);
+      iCount++;
+    }
+  }
+  else if (type==kTrackAODMCCharged || type==kTrackAODMCAll || type==kTrackAODMCChargedAcceptance || type==kTrackAODMCChargedSecNS || type==kTrackAODMCChargedSecS)  {
+    // MC particles (from AOD), physical primaries, all or rather charged or rather charged within acceptance
+    if(!fAOD) return -1;
+    
+    TClonesArray *tca = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
+    if(!tca)retur