Rewritten Task for Fragmentation Function, added to compilation of JetTasks module now
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Jul 2010 15:50:00 +0000 (15:50 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Jul 2010 15:50:00 +0000 (15:50 +0000)
PWG4/JetTasks/AliAnalysisTaskFragmentationFunction.cxx
PWG4/PWG4JetTasksLinkDef.h
PWG4/libPWG4JetTasks.pkg
PWG4/macros/AddTaskFragmentationFunction.C

index 75eb5fa8b585084368300fc2cbc14c2ca189e12d..746900cc1e3c668619098ec7b0b140fd4e308ffd 100644 (file)
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-#include <Riostream.h>
-
-#include <TFile.h>
-#include <TClonesArray.h>
-#include <TLorentzVector.h>
-#include <TProfile.h>
-#include <TList.h>
-#include <TH1.h>
-#include <TH1F.h>
-#include <TH2F.h>
-#include <TH3F.h>
-
-#include "AliAnalysisTaskFragmentationFunction.h"
-#include "AliAnalysisManager.h"
-#include "AliInputEventHandler.h"
-#include "AliAODHandler.h"
-#include "AliAODTrack.h"
-#include "AliJetHeader.h"
-#include "AliAODEvent.h"
-#include "AliAODJet.h"
-#include "AliAODDiJet.h"
-#include "AliGenPythiaEventHeader.h"
-#include "AliAnalysisHelperJetTasks.h"
-#include "AliMCEvent.h"
-#include "AliMCParticle.h"
-#include "AliAODMCParticle.h"
-
-ClassImp(AliAnalysisTaskFragmentationFunction)
-
-//#######################################################################
-AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction():
-  AliAnalysisTaskSE(),
-  fJetHeaderRec(0x0),
-  fJetHeaderGen(0x0),
-  fAOD(0x0),
-  fBranchRec(""),
-  fBranchGen(""),
-  fUseAODInput(kFALSE),
-  fUseAODJetInput(kFALSE),
-  fUseAODTrackInput(kFALSE),
-  fUseAODMCInput(kFALSE),
-  fUseGlobalSelection(kFALSE),
-  fUseExternalWeightOnly(kFALSE),
-  fLimitGenJetEta(kFALSE),
-  fFilterMask(0),
-  fAnalysisType(0),
-  fTrackTypeRec(kTrackUndef),  
-  fTrackTypeGen(kTrackUndef),
-  fAvgTrials(1.),
-  fExternalWeight(1.),    
-  fRecEtaWindow(0.5),
-  fR(0.),
-  fdRdNdxi(0.7),
-  fPartPtCut(0.),
-  fEfactor(1.),
-  fNff(5),
-  fNim(5),
-  fList(0x0),
-  fGlobVar(1),
-  // Number of energy bins
-  fnEBin(6),         
-  fEmin(10.),
-  fEmax(70.),
-  fnEInterval(6),
-  // Number of radius bins
-  fnRBin(10),        
-  fRmin(0.1),
-  fRmax(1.),   
-  fnRInterval(9),
-  // eta histograms
-  fnEtaHBin(50),
-  fEtaHBinMin(-0.9),
-  fEtaHBinMax(0.9),
-  // phi histograms
-  fnPhiHBin(60),
-  fPhiHBinMin(0.),
-  fPhiHBinMax(2*TMath::Pi()),
-  // pt histograms
-  fnPtHBin(300),
-  fPtHBinMin(0.),
-  fPtHBinMax(300.),
-  // E histograms
-  fnEHBin(300),
-  fEHBinMin(0.),
-  fEHBinMax(300.),
-  // Xi histograms
-  fnXiHBin(27),
-  fXiHBinMin(0.),
-  fXiHBinMax(9.),
-  // Pthad histograms
-  fnPthadHBin(60),
-  fPthadHBinMin(0.),
-  fPthadHBinMax(30.),
-  // z histograms
-  fnZHBin(30), 
-  fZHBinMin(0.),
-  fZHBinMax(1.),
-  // theta histograms
-  fnThetaHBin(200),
-  fThetaHBinMin(-0.5),
-  fThetaHBinMax(1.5),
-  fnCosThetaHBin(100),
-  fcosThetaHBinMin(0.),
-  fcosThetaHBinMax(1.),
-  // kT histograms
-  fnkTHBin(25), 
-  fkTHBinMin(0.),
-  fkTHBinMax(5.),
-  // kT histograms
-  fnRHBin(10),
-  fRHBinMin(0),
-  fRHBinMax(1),
-  // pt trig
-  fnPtTrigBin(10),
-  //Histograms
-  fEtaMonoJet1H(0x0),
-  fPhiMonoJet1H(0x0),
-  fPtMonoJet1H(0x0),
-  fEMonoJet1H(0x0),
-  fdNdXiMonoJet1H(0x0),
-  fdNdPtMonoJet1H(0x0),
-  fdNdZMonoJet1H(0x0),
-  fdNdThetaMonoJet1H(0x0),
-  fdNdcosThetaMonoJet1H(0x0),
-  fdNdkTMonoJet1H(0x0),
-  fdNdpTvsZMonoJet1H(0x0),
-  fShapeMonoJet1H(0x0),
-  fNMonoJet1sH(0x0),
-  fThetaPtPartMonoJet1H(0x0),
-  fcosThetaPtPartMonoJet1H(0x0),
-  fkTPtPartMonoJet1H(0x0),
-  fThetaPtJetMonoJet1H(0x0),
-  fcosThetaPtJetMonoJet1H(0x0),
-  fkTPtJetMonoJet1H(0x0),
-  fpTPtJetMonoJet1H(0x0),
-  farrayEmin(0x0),
-  farrayEmax(0x0),
-  farrayRadii(0x0),
-  farrayPtTrigmin(0x0),
-  farrayPtTrigmax(0x0),
-  // Track control plots
-  fptAllTracks(0x0),
-  fetaAllTracks(0x0),
-  fphiAllTracks(0x0),
-  fetaphiptAllTracks(0x0),
-  fetaphiAllTracks(0x0),
-  fptAllTracksCut(0x0),
-  fetaAllTracksCut(0x0),
-  fphiAllTracksCut(0x0),
-  fetaphiptAllTracksCut(0x0),
-  fetaphiAllTracksCut(0x0),
-  fptTracks(0x0),
-  fetaTracks(0x0),
-  fphiTracks(0x0),
-  fdetaTracks(0x0),
-  fdphiTracks(0x0),
-  fetaphiptTracks(0x0),
-  fetaphiTracks(0x0),
-  fdetadphiTracks(0x0),
-  fptTracksCut(0x0),
-  fetaTracksCut(0x0),
-  fphiTracksCut(0x0),
-  fdetaTracksCut(0x0),
-  fdphiTracksCut(0x0),
-  fetaphiptTracksCut(0x0),
-  fetaphiTracksCut(0x0),
-  fdetadphiTracksCut(0x0),
-  fNPtTrig(0x0),
-  fNPtTrigCut(0x0),
-  fvertexXY(0x0),
-  fvertexZ(0x0),
-  fEvtMult(0x0),
-  fEvtMultvsJetPt(0x0),
-  fPtvsEtaJet(0x0),
-  fNpvsEtaJet(0x0),
-  fNpevtvsEtaJet(0x0),
-  fPtvsPtJet(0x0),
-  fNpvsPtJet(0x0),
-  fNpevtvsPtJet(0x0),
-  fPtvsPtJet1D(0x0),
-  fNpvsPtJet1D(0x0),
-  fNpevtvsPtJet1D(0x0),
-  fptLeadingJet(0x0),
-  fetaLeadingJet(0x0),
-  fphiLeadingJet(0x0),
-  fptJet(0x0),
-  fetaJet(0x0),
-  fphiJet(0x0),
-  fHistList(0x0),
-  fNBadRuns(0),
-  fNBadRunsH(0x0)
- {
-  //
-  // Default constructor
-  //
-  /*
-  for(int i = 0;i < kMaxStep*2;++i){
-    fhnJetContainer[i] = 0;
-  }
-  */
-//   for(int ij  = 0;ij<kMaxJets;++ij){
-//     fh1E[ij] = fh1PtRecIn[ij] = fh1PtRecOut[ij] = fh1PtGenIn[ij] = fh1PtGenOut[ij] = 0;
-//     fh1Eta[ij] = fh1Phi[ij] = 0;
-//   }
-}
-
-
-//#######################################################################
-AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char* name):
-  AliAnalysisTaskSE(name),
-  fJetHeaderRec(0x0),
-  fJetHeaderGen(0x0),
-  fAOD(0x0),
-  fBranchRec(""),
-  fBranchGen(""),
-  fUseAODInput(kFALSE),
-  fUseAODJetInput(kFALSE),
-  fUseAODTrackInput(kFALSE),
-  fUseAODMCInput(kFALSE),
-  fUseGlobalSelection(kFALSE),
-  fUseExternalWeightOnly(kFALSE),
-  fLimitGenJetEta(kFALSE),
-  fFilterMask(0),
-  fAnalysisType(0),
-  fTrackTypeRec(kTrackUndef), 
-  fTrackTypeGen(kTrackUndef),
-  fAvgTrials(1.),
-  fExternalWeight(1.),    
-  fRecEtaWindow(0.5),
-  fR(0.),
-  fdRdNdxi(0.7),
-  fPartPtCut(0.),
-  fEfactor(1.),
-  fNff(5),
-  fNim(5),
-  fList(0x0),
-  fGlobVar(1),
-  fCDFCut(1),
-  // Number of energy bins
-  fnEBin(6),         
-  fEmin(10.),
-  fEmax(70.),
-  fnEInterval(6),
-  // Number of radius bins
-  fnRBin(10),        
-  fRmin(0.1),
-  fRmax(1.),   
-  fnRInterval(9),
-  // eta histograms
-  fnEtaHBin(50),
-  fEtaHBinMin(-0.9),
-  fEtaHBinMax(0.9),
-  // phi histograms
-  fnPhiHBin(60),
-  fPhiHBinMin(0.),
-  fPhiHBinMax(2*TMath::Pi()),
-  // pt histograms
-  fnPtHBin(300),
-  fPtHBinMin(0.),
-  fPtHBinMax(300.),
-  // E histograms
-  fnEHBin(300),
-  fEHBinMin(0.),
-  fEHBinMax(300.),
-  // Xi histograms
-  fnXiHBin(27),
-  fXiHBinMin(0.),
-  fXiHBinMax(9.),
-  // Pthad histograms
-  fnPthadHBin(60),
-  fPthadHBinMin(0.),
-  fPthadHBinMax(30.),
-  // z histograms
-  fnZHBin(30),
-  fZHBinMin(0.),
-  fZHBinMax(1.),
-  fnPtTrigBin(10),
-  // theta histograms
-  fnThetaHBin(200),
-  fThetaHBinMin(-0.5),
-  fThetaHBinMax(1.5),
-  fnCosThetaHBin(100),
-  fcosThetaHBinMin(0.),
-  fcosThetaHBinMax(1.),
-  // kT histograms
-  fnkTHBin(25),
-  fkTHBinMin(0.),
-  fkTHBinMax(5.),
-  // kT histograms
-  fnRHBin(10),
-  fRHBinMin(0.),
-  fRHBinMax(1.),
-  //Histograms
-  fEtaMonoJet1H(0x0),
-  fPhiMonoJet1H(0x0),
-  fPtMonoJet1H(0x0),
-  fEMonoJet1H(0x0),
-  fdNdXiMonoJet1H(0x0),
-  fdNdPtMonoJet1H(0x0),
-  fdNdZMonoJet1H(0x0),
-  fdNdThetaMonoJet1H(0x0),
-  fdNdcosThetaMonoJet1H(0x0),
-  fdNdkTMonoJet1H(0x0),
-  fdNdpTvsZMonoJet1H(0x0),
-  fShapeMonoJet1H(0x0),
-  fNMonoJet1sH(0x0),
-  fThetaPtPartMonoJet1H(0x0),
-  fcosThetaPtPartMonoJet1H(0x0),
-  fkTPtPartMonoJet1H(0x0),
-  fThetaPtJetMonoJet1H(0x0),
-  fcosThetaPtJetMonoJet1H(0x0),
-  fkTPtJetMonoJet1H(0x0),
-  fpTPtJetMonoJet1H(0x0),
-  farrayEmin(0x0),
-  farrayEmax(0x0),
-  farrayRadii(0x0),
-  farrayPtTrigmin(0x0),
-  farrayPtTrigmax(0x0),
-  // Track control plots
-  fptAllTracks(0x0),
-  fetaAllTracks(0x0),
-  fphiAllTracks(0x0),
-  fetaphiptAllTracks(0x0),
-  fetaphiAllTracks(0x0),
-  fptAllTracksCut(0x0),
-  fetaAllTracksCut(0x0),
-  fphiAllTracksCut(0x0),
-  fetaphiptAllTracksCut(0x0),
-  fetaphiAllTracksCut(0x0),
-  fptTracks(0x0),
-  fetaTracks(0x0),
-  fphiTracks(0x0),
-  fdetaTracks(0x0),
-  fdphiTracks(0x0),
-  fetaphiptTracks(0x0),
-  fetaphiTracks(0x0),
-  fdetadphiTracks(0x0),
-  fptTracksCut(0x0),
-  fetaTracksCut(0x0),
-  fphiTracksCut(0x0),
-  fdetaTracksCut(0x0),
-  fdphiTracksCut(0x0),
-  fetaphiptTracksCut(0x0),
-  fetaphiTracksCut(0x0),
-  fdetadphiTracksCut(0x0),
-  fNPtTrig(0x0),
-  fNPtTrigCut(0x0),
-  fvertexXY(0x0),
-  fvertexZ(0x0),
-  fEvtMult(0x0),
-  fEvtMultvsJetPt(0x0),
-  fPtvsEtaJet(0x0),
-  fNpvsEtaJet(0x0),
-  fNpevtvsEtaJet(0x0),
-  fPtvsPtJet(0x0),
-  fNpvsPtJet(0x0),
-  fNpevtvsPtJet(0x0),
-  fPtvsPtJet1D(0x0),
-  fNpvsPtJet1D(0x0),
-  fNpevtvsPtJet1D(0x0),
-  fptLeadingJet(0x0),
-  fetaLeadingJet(0x0),
-  fphiLeadingJet(0x0),
-  fptJet(0x0),
-  fetaJet(0x0),
-  fphiJet(0x0),
-  fHistList(0x0),
-  fNBadRuns(0),
-  fNBadRunsH(0x0)
-{
-  //
-  // Default constructor
-  //
-  /*
-  for(int i = 0;i < kMaxStep*2;++i){
-    fhnJetContainer[i] = 0;
-  } 
-  */
-//   for(int ij  = 0;ij<kMaxJets;++ij){
-//     fh1E[ij] = fh1PtRecIn[ij] = fh1PtRecOut[ij] = fh1PtGenIn[ij] = fh1PtGenOut[ij] = 0;
-//     fh1Eta[ij] = fh1Phi[ij] = 0;
-//   }
-  
-  DefineOutput(1, TList::Class());  
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-Bool_t AliAnalysisTaskFragmentationFunction::Notify()
-{
-  //
-  // Implemented Notify() to read the cross sections
-  // and number of trials from pyxsec.root
-  // 
-
-//   TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
-//   UInt_t ntrials  = 0;
-//   Float_t ftrials  = 0;
-//   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;
-//     }
-
-//     TString fileName(curfile->GetName());
-//     if(fileName.Contains("AliESDs.root")){
-//         fileName.ReplaceAll("AliESDs.root", "pyxsec.root");
-//     }
-//     else if(fileName.Contains("AliAOD.root")){
-//         fileName.ReplaceAll("AliAOD.root", "pyxsec.root");
-//     }
-//     else if(fileName.Contains("AliAODs.root")){
-//         fileName.ReplaceAll("AliAODs.root", "");
-//     }
-//     else if(fileName.Contains("galice.root")){
-//         // for running with galice and kinematics alone...                      
-//         fileName.ReplaceAll("galice.root", "pyxsec.root");
-//     }
-//     TFile *fxsec = TFile::Open(fileName.Data());
-//     if(!fxsec){
-//       Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,fileName.Data());
-//       // no a severe condition
-//       return kTRUE;
-//     }
-//     TTree *xtree = (TTree*)fxsec->Get("Xsection");
-//     if(!xtree){
-//       Printf("%s:%d tree not found in the pyxsec.root",(char*)__FILE__,__LINE__);
-//     }
-//     xtree->SetBranchAddress("xsection",&fXsection);
-//     xtree->SetBranchAddress("ntrials",&ntrials);
-//     ftrials = ntrials;
-//     xtree->GetEntry(0);
-
-//     fh1Xsec->Fill("<#sigma>",fXsection);
-//     fh1Trials->Fill("#sum{ntrials}",ftrials);
-
-//   }
-
-  return kTRUE;
-
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
-{
-  //
-  // Create the output container
-  //
-
-  //**** Connect the AOD
-  if(fUseAODInput) // Use AODs as input not ESDs
-  { 
-    fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
-    if(!fAOD)
-    {
-      Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput);
-      return;
-    }
-
-    // fetch the header
-    fJetHeaderRec = dynamic_cast<AliJetHeader*>(fInputHandler->GetTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data())));
-    if(!fJetHeaderRec)
-    {
-      Printf("%s:%d Jet Header not found in the Input",(char*)__FILE__,__LINE__);
-    }
-  }
-
-
-  else // Use the AOD on the flight 
-  {
-    //  assume that the AOD is in the general output...
-    fAOD  = AODEvent();
-    if(!fAOD)
-    {
-      Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__);
-      return;
-    }
-
-    //    ((TList*)OutputTree()->GetUserInfo())->Dump();
-    fJetHeaderRec = dynamic_cast<AliJetHeader*>(OutputTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data())));    
-    if(!fJetHeaderRec)
-    {
-      Printf("%s:%d Jet Header not found in the Output",(char*)__FILE__,__LINE__);
-    }
-    else
-    {
-      if(fDebug>10)fJetHeaderRec->Dump();
-    }
-  }
-
-////////////////////////////
-
-  if (fDebug > 1) printf("AnalysisTaskJetSpectrum::UserCreateOutputObjects() \n");
-
-  OpenFile(1);
-  if(!fHistList)fHistList = new TList();
-  fHistList->SetOwner(kTRUE);
-  Bool_t oldStatus = TH1::AddDirectoryStatus();
-  TH1::AddDirectory(kFALSE);
-
-//////////////////////////////////////////////////
-//////////// HISTOGRAM DECLARATION ///////////////
-//////////////////////////////////////////////////
-
-  DefineJetH();
-
-//////////////////////////////////////////////////
-////////////// HISTOGRAM SAVING //////////////////
-//////////////////////////////////////////////////
-
-  for (Int_t i3 = 0; i3 < fnEBin; i3++)
-  {
-    fHistList->Add(fEtaMonoJet1H[i3]);
-    fHistList->Add(fPhiMonoJet1H[i3]);
-    fHistList->Add(fPtMonoJet1H[i3]);
-    fHistList->Add(fEMonoJet1H[i3]);
-   
-    for(Int_t i4 = 0; i4 < fnRBin; i4++)
-    {
-      fHistList->Add(fdNdXiMonoJet1H[i3][i4]);
-      fHistList->Add(fdNdPtMonoJet1H[i3][i4]);
-      fHistList->Add(fdNdZMonoJet1H[i3][i4]);
-      fHistList->Add(fNMonoJet1sH[i3][i4]);
-    }
-  }
-  // Theta, kT particles/jet
-  for (Int_t i3 = 0; i3 < fnEBin; i3++)
-  {
-    for(Int_t i4 = 0; i4 < fnRBin; i4++)
-    {
-      fHistList->Add(fdNdThetaMonoJet1H[i3][i4]);
-      fHistList->Add(fdNdcosThetaMonoJet1H[i3][i4]);
-      fHistList->Add(fdNdkTMonoJet1H[i3][i4]);
-      fHistList->Add(fdNdpTvsZMonoJet1H[i3][i4]);
-      fHistList->Add(fShapeMonoJet1H[i3][i4]);
-         
-      fHistList->Add(fThetaPtPartMonoJet1H[i3][i4]);
-      fHistList->Add(fcosThetaPtPartMonoJet1H[i3][i4]);
-      fHistList->Add(fkTPtPartMonoJet1H[i3][i4]);
-      fHistList->Add(fThetaPtJetMonoJet1H[i3][i4]);
-      fHistList->Add(fcosThetaPtJetMonoJet1H[i3][i4]);
-      fHistList->Add(fkTPtJetMonoJet1H[i3][i4]);
-      fHistList->Add(fpTPtJetMonoJet1H[i3][i4]);
-    }
-  }
-  
-  // Track QA - Correlations
-  for (Int_t iPtBin=0; iPtBin<fnPtTrigBin; iPtBin++)
-    {
-      fHistList->Add(fptTracks[iPtBin]);
-      fHistList->Add(fetaTracks[iPtBin]);
-      fHistList->Add(fphiTracks[iPtBin]);
-      fHistList->Add(fdetaTracks[iPtBin]);
-      fHistList->Add(fdphiTracks[iPtBin]);
-      fHistList->Add(fetaphiptTracks[iPtBin]);
-      fHistList->Add(fetaphiTracks[iPtBin]);
-      fHistList->Add(fdetadphiTracks[iPtBin]);
-      fHistList->Add(fptTracksCut[iPtBin]);
-      fHistList->Add(fetaTracksCut[iPtBin]);
-      fHistList->Add(fphiTracksCut[iPtBin]);
-      fHistList->Add(fdetaTracksCut[iPtBin]);
-      fHistList->Add(fdphiTracksCut[iPtBin]);
-      fHistList->Add(fetaphiptTracksCut[iPtBin]);
-      fHistList->Add(fetaphiTracksCut[iPtBin]);
-      fHistList->Add(fdetadphiTracksCut[iPtBin]);
-      fHistList->Add(fNPtTrig[iPtBin]);
-      fHistList->Add(fNPtTrigCut[iPtBin]);
-    }
-
-  // Track QA 
-  fHistList->Add(fptAllTracks);
-  fHistList->Add(fetaAllTracks);
-  fHistList->Add(fphiAllTracks);
-  fHistList->Add(fetaphiptAllTracks);
-  fHistList->Add(fetaphiAllTracks);
-  fHistList->Add(fptAllTracksCut);
-  fHistList->Add(fetaAllTracksCut);
-  fHistList->Add(fphiAllTracksCut);
-  fHistList->Add(fetaphiptAllTracksCut);
-  fHistList->Add(fetaphiAllTracksCut);
-
-  // Event caracterisation QA
-  fHistList->Add(fvertexXY);
-  fHistList->Add(fvertexZ);
-  fHistList->Add(fEvtMult);
-  fHistList->Add(fEvtMultvsJetPt);
-  fHistList->Add(fPtvsEtaJet);
-  fHistList->Add(fNpvsEtaJet);
-  fHistList->Add(fNpevtvsEtaJet);
-  fHistList->Add(fPtvsPtJet);
-  fHistList->Add(fNpvsPtJet);
-  fHistList->Add(fNpevtvsPtJet);
-  fHistList->Add(fPtvsPtJet1D);
-  fHistList->Add(fNpvsPtJet1D);
-  fHistList->Add(fNpevtvsPtJet1D);
-  fHistList->Add(fptLeadingJet);
-  fHistList->Add(fetaLeadingJet);
-  fHistList->Add(fphiLeadingJet);
-  fHistList->Add(fptJet);
-  fHistList->Add(fetaJet);
-  fHistList->Add(fphiJet);
-  fHistList->Add(fNBadRunsH);
-
-//////////////////////////////////////////////////
-///////// END OF HISTOGRAM DECLARATION ///////////
-//////////////////////////////////////////////////
-
-  // =========== Switch on Sumw2 for all histos ===========
-  for (Int_t i=0; i<fHistList->GetEntries(); ++i) 
-  {
-    TH1 *h1 = dynamic_cast<TH1*>(fHistList->At(i));
-    if (h1)
-    {
-      // Printf("%s ",h1->GetName());
-      h1->Sumw2();
-      continue;
-    }
-  }
-  
-  TH1::AddDirectory(oldStatus);
-  
-  /*
-    if (fDebug > 1) printf("AnalysisTaskDiJets::CreateOutPutData() \n");
-    fDiJets = new TClonesArray("AliAODDiJet", 0);
-    fDiJets->SetName("Dijets");
-    AddAODBranch("TClonesArray", &fDiJets);
-  */
-  
-  
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::Init()
-{
-  //
-  // Initialization
-  //
-
-  Printf(">>> AnalysisTaskFragmentationFunction::Init() debug level %d\n",fDebug);
-  if (fDebug > 1) printf("AnalysisTaskDiJets::Init() \n");
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::UserExec(Option_t */*option*/) 
-{
-  //
-  // Execute analysis for current event
-  //
-
-  //****
-  //**** Check of input data
-  //****
-
-  printf("Analysing event # %5d\n", (Int_t) fEntry);
-  if (fDebug > 1)printf("Analysing event # %5d\n", (Int_t) fEntry);
-  
-  AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
-  if(!aodH)
-  {
-    Printf("%s:%d no output aodHandler found Jet",(char*)__FILE__,__LINE__);
-    return;
-  }
-  
-  TClonesArray *aodRecJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchRec.Data()));
-  if(!aodRecJets)
-  {
-    Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data());
-    return;
-  }
-  if (fDebug > 10) Printf("%s:%d",(char*)__FILE__,__LINE__);
-  
-  //****
-  //**** Check of primary vertex
-  //****
-  AliAODVertex * pvtx = dynamic_cast<AliAODVertex*>(fAOD->GetPrimaryVertex());
-  if( (!pvtx) ||
-      (pvtx->GetZ()<-10. || pvtx->GetZ()>10.) ||
-      (pvtx->GetNContributors()<0) )
-    { 
-       fNBadRuns++;
-       fNBadRunsH->Fill(0.5);
-       return;
-    }
-
-  //****
-  //**** Check number of tracks 
-  //****
-  TClonesArray* tracks = dynamic_cast<TClonesArray*>(fAOD->GetTracks());
-
-  //****
-  //**** Declaration of arrays and variables 
-  //****
-  // We use static array, not to fragment the memory
-  AliAODJet recJets[kMaxJets];
-  Int_t nRecJets       = 0;
-  Int_t nTracks = 0;
-
-//////////////////////////////////////////////////
-///////// Get the reconstructed jets /////////////
-//////////////////////////////////////////////////
-
-  nRecJets = aodRecJets->GetEntries();
-  nRecJets = TMath::Min(nRecJets,kMaxJets);
-  nTracks  = fAOD->GetNumberOfTracks();
-    
-  for(int ir = 0;ir < nRecJets;++ir)
-  {
-    AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodRecJets->At(ir));
-    if(!tmp)continue;
-    recJets[ir] = *tmp;
-    cout << "recJets[" << ir << "].Eta(): " << recJets[ir].Eta() << ", recJets[" << ir <<"].Phi(): " << recJets[ir].Phi() << ", recJets[" << ir << "].E(): " << recJets[ir].E() << endl;
-  }
-  if(nRecJets>1) {
-    Float_t detaJ = recJets[0].Eta() - recJets[1].Eta();
-    Float_t dphiJ = recJets[0].Phi() - recJets[1].Phi();
-    Float_t detJ = recJets[0].Pt() - recJets[1].Pt();
-    cout << "detaJ: " << detaJ << ", dphiJ: " << dphiJ << ", detJ: " << detJ << endl;
-  }
-
-  // Get vertex information
-  fvertexXY->Fill(pvtx->GetX(),pvtx->GetY());
-  fvertexZ->Fill(pvtx->GetZ());
-
-  //////////////////////////////////////////////////
-  ////////////// TRACK QUALITY ASSURANCE ///////////           TO BE OPTIMISED!!
-  //////////////////////////////////////////////////
-  Int_t evtMult = 0;
-  for(Int_t it=0; it<nTracks; it++)
-  {
-    AliAODTrack* aodTrack = (AliAODTrack*)tracks->At(it);
-    Float_t etaT = aodTrack->Eta();
-    Float_t phiT = aodTrack->Phi();
-    Float_t ptT = aodTrack->Pt(); 
-    phiT = ((phiT < 0) ? phiT + 2 * TMath::Pi() : phiT);
-    //    cout << "etaT: " << etaT << ", phiT: " << phiT << endl;
-    fptAllTracks->Fill(ptT);
-    fetaAllTracks->Fill(etaT);
-    fphiAllTracks->Fill(phiT);
-    fetaphiptAllTracks->Fill(etaT,phiT,ptT);
-    fetaphiAllTracks->Fill(etaT,phiT,1);
-    UInt_t status = aodTrack->GetStatus();
-
-    for(Int_t i=0; i<fnPtTrigBin; i++)
-    {
-      if(ptT>=farrayPtTrigmin[i] && ptT<farrayPtTrigmax[i])
-      {
-       fptTracks[i]->Fill(ptT);
-       fetaTracks[i]->Fill(etaT);
-       fphiTracks[i]->Fill(phiT);
-       fNPtTrig[i]->Fill(0.5);
-       // Compute deta/dphi
-       Float_t etaT2 = 0.; 
-       Float_t phiT2 = 0.;
-       Float_t ptT2 = 0.;
-       Float_t detaT = 0.;
-       Float_t dphiT = 0.;
-       for(Int_t it2 = 0; it2< nTracks; it2++)
-       {
-          AliAODTrack* aodTrack2 = (AliAODTrack*)tracks->At(it2);
-          etaT2 = aodTrack2->Eta(); phiT2 = aodTrack2->Phi(); ptT2 = aodTrack2->Pt();
-          phiT2 = ((phiT2 < 0) ? phiT2 + 2 * TMath::Pi() : phiT2);
-          //         cout << "etaT2: " << etaT2 << ", phiT2: " << phiT2 << endl;
-          if(ptT2 > 2.*i+4.) continue;
-          if(it2==it) continue;
-          detaT = etaT - etaT2; 
-          dphiT = phiT - phiT2; 
-          if (dphiT  >   TMath::Pi()) dphiT = (-TMath::Pi() +TMath::Abs(dphiT - TMath::Pi()));
-          if (dphiT  < -1.0*TMath::Pi())  dphiT = (TMath::Pi() -  TMath::Abs(dphiT + TMath::Pi()));
-             
-          fdetaTracks[i]->Fill(detaT);
-          fdphiTracks[i]->Fill(dphiT);
-          fdetadphiTracks[i]->Fill(detaT,dphiT,1);
-       }
-        fetaphiptTracks[i]->Fill(etaT,phiT,ptT);
-       fetaphiTracks[i]->Fill(etaT,phiT,1);
-      }
-    } // End loop over trigger ranges 
-
-    if (status == 0) continue;
-    if((fFilterMask>0)&&!(aodTrack->TestFilterBit(fFilterMask))) continue;
-    fptAllTracksCut->Fill(ptT);
-    fetaAllTracksCut->Fill(etaT);
-    fphiAllTracksCut->Fill(phiT);
-    fetaphiptAllTracksCut->Fill(etaT,phiT,ptT);
-    fetaphiAllTracksCut->Fill(etaT,phiT,1);
-    if(ptT > 0.150 && TMath::Abs(etaT) < 0.9) evtMult++;
-  } // end loop over tracks
-  fEvtMult->Fill(evtMult);   
-
-//////////////////////////////////////////////////
-///////////////// MONOJET PART ///////////////////
-//////////////////////////////////////////////////
-
-  if (nRecJets == 0) return;
-
-  Double_t jetEnergy = recJets[0].E();
-  Int_t    goodBin   = 999;
-
-  for (Int_t i1 = 0; i1 < fnEBin; i1++)
-  {
-    if (jetEnergy < farrayEmax[i1] && jetEnergy >= farrayEmin[i1]) 
-    {
-      goodBin = i1;
-      continue;
-    }
-  }
-
-  fptLeadingJet->Fill(recJets[0].Pt());
-  fetaLeadingJet->Fill(recJets[0].Eta());
-  fphiLeadingJet->Fill(recJets[0].Phi());
-
-  for(Int_t ij=0; ij<nRecJets; ij++)
-  {  
-    fptJet->Fill(recJets[ij].Pt());
-    fetaJet->Fill(recJets[ij].Eta());
-    fphiJet->Fill(recJets[ij].Phi());
-  }
-
-  // Get track ref 
-  TRefArray* ref = recJets[0].GetRefTracks();
-  for(Int_t it=0; it<ref->GetEntries(); it++)
-  {
-    Float_t ptTrack = ((AliVTrack*)ref->At(it))->Pt();
-    fPtvsEtaJet->Fill(recJets[0].Eta(),ptTrack);
-    fNpvsEtaJet->Fill(recJets[0].Eta(),ref->GetEntries());
-    fNpevtvsEtaJet->Fill(recJets[0].Eta(),evtMult);
-    fPtvsPtJet->Fill(recJets[0].Pt(),ptTrack);
-    fNpvsPtJet->Fill(recJets[0].Pt(),ref->GetEntries());
-    fNpevtvsPtJet->Fill(recJets[0].Pt(),evtMult);
-    fPtvsPtJet1D->Fill(recJets[0].Pt(),ptTrack);
-    fNpvsPtJet1D->Fill(recJets[0].Pt(),ref->GetEntries());
-    fNpevtvsPtJet1D->Fill(recJets[0].Pt(),evtMult);
-  }
-
-  FillMonoJetH(goodBin, recJets, tracks);
-
-  //////////////////////////////////////////////////
-  ////////////////// DIJET PART ////////////////////       
-  //////////////////////////////////////////////////
-
-  // UNDER CONSTRUCTION
-
-  PostData(1, fHistList);
-}
-
-//#######################################################################
-void AliAnalysisTaskFragmentationFunction::Terminate(Option_t */*option*/)
-{
-// Terminate analysis
-//
-    if (fDebug > 1) printf("AnalysisDiJets: Terminate() \n");
-    printf("Number of events with vertex out of bound: %d", fNBadRuns);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::DefineJetH()
-{
-
-  /////////////////////////////////////// HISTOGRAMS FIRST JET
-  fEtaMonoJet1H   = new TH1F*[fnEBin+1];
-  fPhiMonoJet1H   = new TH1F*[fnEBin+1];
-  fPtMonoJet1H    = new TH1F*[fnEBin+1];
-  fEMonoJet1H     = new TH1F*[fnEBin+1];
-
-  fdNdXiMonoJet1H = new TH1F**[fnEBin+1];
-  fdNdPtMonoJet1H = new TH1F**[fnEBin+1];
-  fdNdZMonoJet1H  = new TH1F**[fnEBin+1];
-  fdNdThetaMonoJet1H    = new TH1F**[fnEBin+1];
-  fdNdcosThetaMonoJet1H    = new TH1F**[fnEBin+1];
-  fdNdkTMonoJet1H       = new TH1F**[fnEBin+1];
-  fdNdpTvsZMonoJet1H    = new TH1F**[fnEBin+1];
-  fShapeMonoJet1H       = new TH1F**[fnEBin+1];
-  fNMonoJet1sH          = new TH1F**[fnEBin+1];
-
-  fThetaPtPartMonoJet1H = new TH2F**[fnEBin+1];
-  fcosThetaPtPartMonoJet1H = new TH2F**[fnEBin+1];
-  fkTPtPartMonoJet1H    = new TH2F**[fnEBin+1];
-  fThetaPtJetMonoJet1H = new TH2F**[fnEBin+1];
-  fcosThetaPtJetMonoJet1H = new TH2F**[fnEBin+1];
-  fkTPtJetMonoJet1H    = new TH2F**[fnEBin+1];
-  fpTPtJetMonoJet1H    = new TH2F**[fnEBin+1];
-
-  for (Int_t iEbin=0;iEbin<fnEBin+1;iEbin++)
-  {
-    fdNdXiMonoJet1H[iEbin]       = new TH1F*[fnRBin+1];
-    fdNdPtMonoJet1H[iEbin]       = new TH1F*[fnRBin+1];
-    fdNdZMonoJet1H[iEbin]        = new TH1F*[fnRBin+1];
-    fdNdThetaMonoJet1H[iEbin]    = new TH1F*[fnRBin+1];
-    fdNdcosThetaMonoJet1H[iEbin] = new TH1F*[fnRBin+1];
-    fdNdkTMonoJet1H[iEbin]       = new TH1F*[fnRBin+1];
-    fdNdpTvsZMonoJet1H[iEbin]    = new TH1F*[fnRBin+1];
-    fShapeMonoJet1H[iEbin]       = new TH1F*[fnRBin+1];
-    fNMonoJet1sH[iEbin]          = new TH1F*[fnRBin+1];
-
-    fThetaPtPartMonoJet1H[iEbin]    = new TH2F*[fnRBin+1];
-    fcosThetaPtPartMonoJet1H[iEbin] = new TH2F*[fnRBin+1];
-    fkTPtPartMonoJet1H[iEbin]       = new TH2F*[fnRBin+1];
-    fThetaPtJetMonoJet1H[iEbin]     = new TH2F*[fnRBin+1];
-    fcosThetaPtJetMonoJet1H[iEbin]  = new TH2F*[fnRBin+1];
-    fkTPtJetMonoJet1H[iEbin]        = new TH2F*[fnRBin+1];
-    fpTPtJetMonoJet1H[iEbin]        = new TH2F*[fnRBin+1];
-  }
-
-  for (Int_t iEbin=0;iEbin<fnEBin+1;iEbin++)
-  {
-    fEtaMonoJet1H[iEbin]    = 0;
-    fPhiMonoJet1H[iEbin]    = 0;
-    fPtMonoJet1H[iEbin]     = 0;
-    fEMonoJet1H[iEbin]      = 0;
-
-    for (Int_t iRbin=0;iRbin<fnRBin+1;iRbin++)
-    {
-      fdNdXiMonoJet1H[iEbin][iRbin]       = 0;
-      fdNdPtMonoJet1H[iEbin][iRbin]       = 0;
-      fdNdZMonoJet1H[iEbin][iRbin]        = 0;
-      fdNdThetaMonoJet1H[iEbin][iRbin]    = 0;
-      fdNdcosThetaMonoJet1H[iEbin][iRbin] = 0;
-      fdNdkTMonoJet1H[iEbin][iRbin]       = 0;
-      fdNdpTvsZMonoJet1H[iEbin][iRbin]    = 0;
-      fShapeMonoJet1H[iEbin][iRbin]       = 0;
-      fNMonoJet1sH[iEbin][iRbin]          = 0;
-
-      fThetaPtPartMonoJet1H[iEbin][iRbin]    = 0;
-      fcosThetaPtPartMonoJet1H[iEbin][iRbin] = 0;
-      fkTPtPartMonoJet1H[iEbin][iRbin]       = 0;
-      fThetaPtJetMonoJet1H[iEbin][iRbin]     = 0;
-      fcosThetaPtJetMonoJet1H[iEbin][iRbin]  = 0;
-      fkTPtJetMonoJet1H[iEbin][iRbin]        = 0;
-      fpTPtJetMonoJet1H[iEbin][iRbin]        = 0;
-    }
-  }
-
-  fptTracks          = new TH1F*[fnPtTrigBin+1];
-  fetaTracks         = new TH1F*[fnPtTrigBin+1];
-  fphiTracks         = new TH1F*[fnPtTrigBin+1];
-  fdetaTracks        = new TH1F*[fnPtTrigBin+1];
-  fdphiTracks        = new TH1F*[fnPtTrigBin+1];
-  fetaphiptTracks    = new TH2F*[fnPtTrigBin+1];
-  fetaphiTracks      = new TH2F*[fnPtTrigBin+1];
-  fdetadphiTracks    = new TH2F*[fnPtTrigBin+1];
-  fptTracksCut       = new TH1F*[fnPtTrigBin+1];
-  fetaTracksCut      = new TH1F*[fnPtTrigBin+1];
-  fphiTracksCut      = new TH1F*[fnPtTrigBin+1];
-  fdetaTracksCut     = new TH1F*[fnPtTrigBin+1];
-  fdphiTracksCut     = new TH1F*[fnPtTrigBin+1];
-  fetaphiptTracksCut = new TH2F*[fnPtTrigBin+1];
-  fetaphiTracksCut   = new TH2F*[fnPtTrigBin+1];
-  fdetadphiTracksCut = new TH2F*[fnPtTrigBin+1];
-  fNPtTrig           = new TH1F*[fnPtTrigBin+1];
-  fNPtTrigCut        = new TH1F*[fnPtTrigBin+1];
-
-  for(Int_t iPtTrigBin=0; iPtTrigBin<fnPtTrigBin; iPtTrigBin++)
-  {
-    fptTracks[iPtTrigBin]          = 0;
-    fetaTracks[iPtTrigBin]         = 0;
-    fphiTracks[iPtTrigBin]         = 0;
-    fdetaTracks[iPtTrigBin]        = 0;
-    fdphiTracks[iPtTrigBin]        = 0;
-    fetaphiptTracks[iPtTrigBin]    = 0;
-    fetaphiTracks[iPtTrigBin]      = 0;
-    fdetadphiTracks[iPtTrigBin]    = 0;
-    fptTracksCut[iPtTrigBin]       = 0;
-    fetaTracksCut[iPtTrigBin]      = 0;
-    fphiTracksCut[iPtTrigBin]      = 0;
-    fdetaTracksCut[iPtTrigBin]     = 0;
-    fdphiTracksCut[iPtTrigBin]     = 0;
-    fetaphiptTracksCut[iPtTrigBin] = 0;
-    fetaphiTracksCut[iPtTrigBin]   = 0;
-    fdetadphiTracksCut[iPtTrigBin] = 0;
-    fNPtTrig[iPtTrigBin]           = 0;
-    fNPtTrigCut[iPtTrigBin]        = 0;
-  }
-
-  farrayEmin = new Double_t[fnEBin];
-  farrayEmax = new Double_t[fnEBin];
-
-  farrayPtTrigmin = new Double_t[fnPtTrigBin];
-  farrayPtTrigmax = new Double_t[fnPtTrigBin];
-
-  farrayRadii = new Double_t[fnRBin];
-
-  Double_t eMin    = 0;
-  Double_t eMax    = 0;
-  Double_t pasE    = (Double_t)((fEmax-fEmin)/fnEInterval);
-  TString energy;
-  TString energy2;
-
-  Double_t r    = 0.;
-  Double_t pasR = (Double_t)((fRmax-fRmin)/fnRInterval);
-  TString radius;
-
-  for (Int_t i = 0; i < fnEBin; i++)
-  {
-    eMin       = 0;
-    eMax       = 0;
-
-    if (i==0) eMin = fEmin;
-    if (i!=0) eMin = fEmin + pasE*i;
-    eMax = eMin+pasE;
-    energy2 = "E_{jet1} : ";
-    energy = "E_{jet} : ";
-    energy += eMin;
-    energy2 += eMin;
-    energy += "-";
-    energy2 += "-";
-    energy +=eMax;
-    energy2 += eMax;
-    energy += "GeV";
-    energy2 += "GeV";
-
-    farrayEmin[i]      = eMin;
-    farrayEmax[i]      = eMax;
-
-    for (Int_t j = 0; j < fnRBin; j++)
-    {
-      if (j==0) r = fRmin;
-      if (j!=0) r = fRmin + pasR*j;
-      radius = ", R = ";
-      radius += r;    
-
-      farrayRadii[j] = r;
-
-      fEtaMonoJet1H[i]   = new TH1F("fEtaMonoJet1H,"+energy, "#eta_{jet1},"+energy, fnEtaHBin, fEtaHBinMin, fEtaHBinMax);
-      fPhiMonoJet1H[i]   = new TH1F("fPhiMonoJet1H,"+energy, "#phi_{jet1},"+energy, fnPhiHBin, fPhiHBinMin, fPhiHBinMax);
-      fPtMonoJet1H[i]    = new TH1F("fPtMonoJet1H,"+energy, "pT_{jet1},"+energy, fnPtHBin, fPtHBinMin, fPtHBinMax);
-      fEMonoJet1H[i]     = new TH1F("fEMonoJet1H,"+energy, "E_{jet1},"+energy, fnEHBin, fEHBinMin, fEHBinMax);
-
-      fdNdXiMonoJet1H[i][j] = new TH1F("fdNdXiMonoJet1H,"+energy+radius, "dN_{ch}/d#xi,"+energy+radius, fnXiHBin, fXiHBinMin, fXiHBinMax);
-      fdNdPtMonoJet1H[i][j] = new TH1F("fdNdPtMonoJet1H,"+energy+radius, "dN_{ch}/dPt_{had},"+energy+radius, fnPthadHBin, fPthadHBinMin, fPthadHBinMax);
-      fdNdZMonoJet1H[i][j]  = new TH1F("fdNdZMonoJet1H,"+energy+radius, "dN_{ch}/dz,"+energy+radius, fnZHBin, fZHBinMin, fZHBinMax);
-
-      fdNdThetaMonoJet1H[i][j]    = new TH1F("fdNdThetaMonoJet1H,"+energy+radius, "dN_{ch}/d#Theta,"+energy+radius, fnThetaHBin, fThetaHBinMin, fThetaHBinMax);
-      fdNdcosThetaMonoJet1H[i][j] = new TH1F("fdNdcosThetaMonoJet1H,"+energy+radius, "dN_{ch}/dcos(#Theta),"+energy+radius, fnCosThetaHBin, fcosThetaHBinMin, fcosThetaHBinMax);
-      fdNdkTMonoJet1H[i][j]   = new TH1F("fdNdkTMonoJet1H,"+energy+radius, "dN_{ch}/dk_{T},"+energy+radius, fnkTHBin, fkTHBinMin, fkTHBinMax);
-      fdNdpTvsZMonoJet1H[i][j]= new TH1F("fdNdpTvsZMonoJet1H,"+energy+radius, "dN_{ch}/dk_{T} vs Z,"+energy+radius, fnZHBin, fZHBinMin, fZHBinMax);
-      fShapeMonoJet1H[i][j]   = new TH1F("fShapeMonoJet1H,"+energy+radius, "E(R=x)/E(R=1)"+energy+radius, fnRHBin, fRHBinMin, fRHBinMax);
-
-      fThetaPtPartMonoJet1H[i][j] = new TH2F("fThetaPtPartMonoJet1H,"+energy+radius, "#Theta vs Pt particle,"+energy+radius, fnPthadHBin, fPthadHBinMin, fPthadHBinMax, fnThetaHBin, fThetaHBinMin, fThetaHBinMax);
-      fcosThetaPtPartMonoJet1H[i][j] = new TH2F("fcosThetaPtPartMonoJet1H,"+energy+radius, "cos(#Theta) vs Pt particle,"+energy+radius, fnPthadHBin, fPthadHBinMin, fPthadHBinMax, fnCosThetaHBin, fcosThetaHBinMin, fcosThetaHBinMax);
-      fkTPtPartMonoJet1H[i][j] = new TH2F("fkTPtPartMonoJet1H,"+energy+radius, "kT vs Pt particle,"+energy+radius, fnPthadHBin, fPthadHBinMin, fPthadHBinMax, fnkTHBin, fkTHBinMin, fkTHBinMax);
-      fThetaPtJetMonoJet1H[i][j] = new TH2F("fThetaPtJetMonoJet1H,"+energy+radius, "#Theta vs Pt jet,"+energy+radius, fnPtHBin, fPtHBinMin, fPtHBinMax, fnThetaHBin, fThetaHBinMin, fThetaHBinMax);
-      fcosThetaPtJetMonoJet1H[i][j] = new TH2F("fcosThetaPtJetMonoJet1H,"+energy+radius, "cos(#Theta) vs Pt jet,"+energy+radius, fnPtHBin, fPtHBinMin, fPtHBinMax, fnCosThetaHBin, fcosThetaHBinMin, fcosThetaHBinMax);
-      fkTPtJetMonoJet1H[i][j] = new TH2F("fkTPtJetMonoJet1H,"+energy+radius, "kT vs Pt jet,"+energy+radius, fnPtHBin, fPtHBinMin, fPtHBinMax, fnkTHBin, fkTHBinMin, fkTHBinMax);
-      fpTPtJetMonoJet1H[i][j] = new TH2F("fpTPtJetMonoJet1H,"+energy+radius, "pT vs Pt jet,"+energy+radius, fnPtHBin, fPtHBinMin, fPtHBinMax, fnkTHBin, fkTHBinMin, fkTHBinMax);
-
-      fNMonoJet1sH[i][j]    = new TH1F("fNMonoJet1sH,"+energy+radius, "N_{jets1},"+energy+radius, 1, 0., 1.);
-      fNBadRunsH = new TH1F("fNBadRunsH","Number of events with Z vertex out of range", 1, 0., 1.);
-
-      SetProperties(fEtaMonoJet1H[i], "#eta_{jet1}", "Entries");
-      SetProperties(fPhiMonoJet1H[i], "#phi_{jet1}", "Entries");
-      SetProperties(fPtMonoJet1H[i], "p_{Tjet1} (GeV/c)", "Entries");
-      SetProperties(fEMonoJet1H[i], "E_{jet1} (GeV)", "Entries");
-
-      SetProperties(fdNdXiMonoJet1H[i][j], "#xi = ln(E_{jet1}/p_{Thad})", "dN_{had}/d#xi");
-      SetProperties(fdNdPtMonoJet1H[i][j], "p_{Thad} (GeV/c)", "dN_{had}/dp_{Thad}");
-      SetProperties(fdNdZMonoJet1H[i][j], "z = (p_{Thad}/E_{jet1})", "dN_{had}/dz");
-      SetProperties(fdNdThetaMonoJet1H[i][j], "#Theta", "dN_{had}/d#Theta");
-      SetProperties(fdNdcosThetaMonoJet1H[i][j], "cos(#Theta)", "dN_{had}/dcos(#Theta)");
-      SetProperties(fdNdkTMonoJet1H[i][j], "k_{Thad}", "dN_{had}/dk_{Thad}");
-      SetProperties(fdNdpTvsZMonoJet1H[i][j], "z = (p_{Thad}/E_{jet1})", "dN_{had}/dp_{T}");
-      SetProperties(fShapeMonoJet1H[i][j], "R", "#Psi(R)");
-      SetProperties(fNMonoJet1sH[i][j], "Bin", "N_{jets1}");
-
-      SetProperties(fThetaPtPartMonoJet1H[i][j],"p_{Thad} [GeV/c]","#Theta");
-      SetProperties(fcosThetaPtPartMonoJet1H[i][j],"p_{Thad} [GeV/c]","cos(#Theta)");
-      SetProperties(fkTPtPartMonoJet1H[i][j],"p_{Thad} [GeV/c]","k_{Thad}");
-      SetProperties(fThetaPtJetMonoJet1H[i][j], "p_{Tjet} [GeV/c]", "#Theta");
-      SetProperties(fcosThetaPtJetMonoJet1H[i][j], "p_{Tjet} [GeV/c]", "cos(#Theta)");
-      SetProperties(fkTPtJetMonoJet1H[i][j], "p_{Tjet} [GeV/c]", "k_{Thad} [GeV/c]");
-      SetProperties(fpTPtJetMonoJet1H[i][j], "p_{Tjet} [GeV/c]", "p_{Thad} [GeV/c]");
-    }
-  }
-
-  for(Int_t i=0; i<fnPtTrigBin; i++)
-  {
-    if(i==0) farrayPtTrigmin[i] = 1.; 
-    else farrayPtTrigmin[i] = i*5.;
-    farrayPtTrigmax[i] = i*5+5.;
-    
-    TString ptTrigRange;
-    ptTrigRange = "; p_{T} trig range: ";
-    ptTrigRange += farrayPtTrigmin[i];
-    ptTrigRange += "-";
-    ptTrigRange += farrayPtTrigmax[i];
-    ptTrigRange += " [GeV]";
-
-    fptTracks[i] = new TH1F("fptTracks"+ptTrigRange, "Track transverse momentum [GeV]"+ptTrigRange,300,0.,150.);
-    fetaTracks[i] = new TH1F("fetaTracks"+ptTrigRange, "#eta tracks"+ptTrigRange, 36, -0.9, 0.9);
-    fphiTracks[i] = new TH1F("fphiTracks"+ptTrigRange, "#phi tracks"+ptTrigRange, 60, 0., 2*TMath::Pi());
-    fdetaTracks[i] = new TH1F("fdetaTracks"+ptTrigRange, "#Delta #eta tracks"+ptTrigRange,80, -2., 2.);
-    fdphiTracks[i] = new TH1F("fdphiTracks"+ptTrigRange, "#Delta #phi tracks"+ptTrigRange, 120, -TMath::Pi(), TMath::Pi());
-    fetaphiptTracks[i] = new TH2F("fetaphiptTracks"+ptTrigRange,"#eta/#phi track p_{T} mapping"+ptTrigRange,36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-    fetaphiTracks[i] = new TH2F("fetaphiTracks"+ptTrigRange,"#eta/#phi track mapping"+ptTrigRange,36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-    fdetadphiTracks[i] = new TH2F("fdetadphiTracks"+ptTrigRange,"#Delta #eta/#Delta #phi track mapping"+ptTrigRange,80, -2., 2., 120, -TMath::Pi(), TMath::Pi());
-    fptTracksCut[i] = new TH1F("fptTracksCut"+ptTrigRange, "Track transverse momentum after cuts [GeV]"+ptTrigRange,300,0.,150.);
-    fetaTracksCut[i] = new TH1F("fetaTracksCut"+ptTrigRange, "#eta tracks after cuts"+ptTrigRange, 36, -0.9, 0.9);
-    fphiTracksCut[i] = new TH1F("fphiTracksCuts"+ptTrigRange, "#phi tracks after cuts"+ptTrigRange, 60, 0., 2*TMath::Pi());
-    fdetaTracksCut[i] = new TH1F("fdetaTracksCuts"+ptTrigRange, "#Delta #eta tracks after cuts"+ptTrigRange,80, -2., 2.);
-    fdphiTracksCut[i] = new TH1F("fdphiTracksCuts"+ptTrigRange, "#Delta #phi tracks after cuts"+ptTrigRange, 120, -TMath::Pi(), TMath::Pi());
-    fetaphiptTracksCut[i] = new TH2F("fetaphiptTracksCuts"+ptTrigRange,"#eta/#phi track p_{T} mapping after cuts"+ptTrigRange,36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-    fetaphiTracksCut[i] = new TH2F("fetaphiTracksCuts"+ptTrigRange,"#eta/#phi track mapping after cuts"+ptTrigRange,36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-    fdetadphiTracksCut[i] = new TH2F("fdetadphiTracksCuts"+ptTrigRange,"#Delta #eta/#Delta #phi track mapping after cuts"+ptTrigRange,80, -2., 2., 120, -TMath::Pi(), TMath::Pi());
-    fNPtTrig[i] = new TH1F("fNPtTrig"+ptTrigRange,"Number of triggers"+ptTrigRange,1,0.,1.);
-    fNPtTrigCut[i] = new TH1F("fNPtTrigCut"+ptTrigRange,"Number of triggers after cut"+ptTrigRange,1,0.,1.);
-
-    SetProperties(fptTracks[i], "Track p_{T} [GeV]", "dN/dp_{T}"); 
-    SetProperties(fetaTracks[i], "Track #eta", "dN/d#eta"); 
-    SetProperties(fphiTracks[i], "Track #phi", "dN/d#phi");
-    SetProperties(fdetaTracks[i], "#eta_{track} - #eta_{trig}", "dN/d#Delta#eta");
-    SetProperties(fdphiTracks[i], "#phi_{track} - #phi_{trig}", "dN/d#Delta#phi");
-    SetProperties(fetaphiptTracks[i], "#eta_{track}", "#phi_{track}"); 
-    SetProperties(fetaphiTracks[i], "#eta_{track}", "#phi_{track}");
-    SetProperties(fdetadphiTracks[i], "#Delta #eta_{track}", "#Delta #phi_{track}");
-    SetProperties(fptTracksCut[i], "p_{T}track [GeV]", "dN/dp_{T}");
-    SetProperties(fetaTracksCut[i], "#eta_{track}", "dN/d#eta"); 
-    SetProperties(fphiTracksCut[i], "#phi_{track}", "dN/d#phi"); 
-    SetProperties(fdetaTracksCut[i], "#eta_{track} - #eta_{trig}", "dN/d#Delta#eta");
-    SetProperties(fdphiTracksCut[i], "#phi_{track} - #phi_{trig}", "dN/d#Delta#phi");
-    SetProperties(fetaphiptTracksCut[i], "#eta_{track}", "#phi_{track}");
-    SetProperties(fetaphiTracksCut[i], "#eta_{track}", "#phi_{track}");
-    SetProperties(fdetadphiTracksCut[i], "#Delta #eta_{track}", "#Delta #phi_{track}");
-    SetProperties(fNPtTrig[i], "", "Number of triggers");
-    SetProperties(fNPtTrigCut[i], "", "Number of triggers");
-
-  }
-
-  fptAllTracks = new TH1F("fptAllTracks", "Track transverse momentum [GeV]",300,0.,150.);
-  fetaAllTracks = new TH1F("fetaAllTracks", "#eta tracks", 36, -0.9, 0.9);
-  fphiAllTracks = new TH1F("fphiAllTracks", "#phi tracks", 60, 0., 2*TMath::Pi());
-  fetaphiptAllTracks = new TH2F("fetaphiptAllTracks","#eta/#phi track p_{T} mapping",36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-  fetaphiAllTracks = new TH2F("fetaphiAllTracks","#eta/#phi track mapping",36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-  fptAllTracksCut = new TH1F("fptAllTracksCut", "Track transverse momentum after cuts [GeV]",300,0.,150.);
-  fetaAllTracksCut = new TH1F("fetaAllTracksCut", "#eta tracks after cuts", 36, -0.9, 0.9);
-  fphiAllTracksCut = new TH1F("fphiAllTracksCuts", "#phi tracks after cuts", 60, 0., 2*TMath::Pi());
-  fetaphiptAllTracksCut = new TH2F("fetaphiptAllTracksCuts","#eta/#phi track p_{T} mapping after cuts",36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-  fetaphiAllTracksCut = new TH2F("fetaphiAllTracksCuts","#eta/#phi track mapping after cuts",36, -0.9, 0.9,60, 0., 2*TMath::Pi());
-
-  SetProperties(fptAllTracks, "Track p_{T} [GeV]", "dN/dp_{T}"); 
-  SetProperties(fetaAllTracks, "Track #eta", "dN/d#eta");
-  SetProperties(fphiAllTracks, "Track #phi", "dN/d#phi");
-  SetProperties(fetaphiptAllTracks, "#eta_{track}", "#phi_{track}");
-  SetProperties(fetaphiAllTracks, "#eta_{track}", "#phi_{track}");
-  SetProperties(fptAllTracksCut, "p_{T}track [GeV]", "dN/dp_{T}"); 
-  SetProperties(fetaAllTracksCut, "#eta_{track}", "dN/d#eta"); 
-  SetProperties(fphiAllTracksCut, "#phi_{track}", "dN/d#phi"); 
-  SetProperties(fetaphiptAllTracksCut, "#eta_{track}", "#phi_{track}");
-  SetProperties(fetaphiAllTracksCut, "#eta_{track}", "#phi_{track}");
-
-  fvertexXY = new TH2F("fvertexXY","X-Y vertex position",30,0.,10.,30,0.,10.);
-  fvertexZ = new TH1F("fvertexZ","Z vertex position",60,-30.,30.);
-  fEvtMult = new TH1F("fEvtMult","Event multiplicity, track pT cut > 150 MeV/c, |#eta| < 0.9",100,0.,100.);
-  fEvtMultvsJetPt = new TH2F("fEvtMultvsJetPt","Event multiplicity vs pT_{jet}",60,0.,60.,100,0.,100.);
-  fPtvsEtaJet = new TH2F("fPtvsEtaJet","Pt vs #eta_{jet}",20,-1.,1.,60,0.,60.);
-  fNpvsEtaJet = new TH2F("fNpvsEtaJet","N_{part} inside jet vs #eta_{jet}",20,-1.,1.,20,0,20); 
-  fNpevtvsEtaJet = new TH2F("fNpevtvsEtaJet","N_{part} in evt vs #eta_{jet}",20,-1.,1.,90,0,90); 
-  fPtvsPtJet = new TH2F("fPtvsPtJet","Pt vs #p_{Tjet}",60,0.,60.,60,0.,60.);
-  fNpvsPtJet = new TH2F("fNpvsPtJet","N_{part} inside jet vs #pt_{Tjet}",60,0.,60.,20,0,20); 
-  fNpevtvsPtJet = new TH2F("fNpevtvsPtJet","N_{part} in evt vs #pt_{Tjet}",60,0.,60.,90,0,90); 
-  fPtvsPtJet1D = new TH1F("fPtvsPtJet1D","Pt vs #p_{Tjet}",60,0.,60.);
-  fNpvsPtJet1D = new TH1F("fNpvsPtJet1D","N_{part} inside jet vs #pt_{Tjet}",60,0.,60.); 
-  fNpevtvsPtJet1D = new TH1F("fNpevtvsPtJet1D","N_{part} in evt vs #pt_{Tjet}",60,0.,60.); 
-  fptLeadingJet = new TH1F("fptLeadingJet","Pt leading Jet [GeV/c]",60,0.,60.); 
-  fetaLeadingJet = new TH1F("fetaLeadingJet","#eta leading jet",20,-1.,1.);
-  fphiLeadingJet = new TH1F("fphiLeadingJet","#phi leading jet",12,0.,2*TMath::Pi());
-  fptJet = new TH1F("fptJet","Pt Jets [GeV/c]",60,0.,60.); 
-  fetaJet = new TH1F("fetaJet","#eta jet",20,-1.,1.);
-  fphiJet = new TH1F("fphiJet","#phi jet",12,0.,2*TMath::Pi());
-  fNBadRunsH = new TH1F("fNBadRunsH","Number of events with Z vertex out of range", 1, 0., 1.);
-
-  SetProperties(fvertexXY, "vtx X", "vtx Y");
-  SetProperties(fvertexZ, "vtx Z", "Count");
-  SetProperties(fEvtMult, "N_{part} / event", "Count");
-  SetProperties(fEvtMultvsJetPt, "p_{T jet}", "Event multiplicity");
-  SetProperties(fPtvsEtaJet, "#eta_{leading jet}", "p_{T} part [GeV/c]");
-  SetProperties(fNpvsEtaJet, "#eta_{leading jet}", "N_{part} in leading jet");
-  SetProperties(fNpevtvsEtaJet, "#eta_{leading jet}", "N_{part} in event");
-  SetProperties(fPtvsPtJet, "#p_{T leading jet}", "p_{T} part [GeV/c]");
-  SetProperties(fNpvsPtJet, "#p_{T leading jet}", "N_{part} in leading jet");
-  SetProperties(fNpevtvsPtJet, "#p_{T leading jet}", "N_{part} in event");
-  SetProperties(fPtvsPtJet1D, "#p_{T leading jet}", "<p_{T}> part [GeV/c]");
-  SetProperties(fNpvsPtJet1D, "#p_{T leading jet}", "<N_{part}> in leading jet");
-  SetProperties(fNpevtvsPtJet1D, "#p_{T leading jet}", "<N_{part}> in event");
-  SetProperties(fptLeadingJet, "p_{T} leading jet", "dN/dp_{T} leading jet");
-  SetProperties(fetaLeadingJet, "#eta leading jet", "dN/d#eta leading jet");
-  SetProperties(fphiLeadingJet, "#phi leading jet", "dN/d#phi leading jet");
-  SetProperties(fptJet, "p_{T} jet [GeV/c]", "dN/dp_{T}");
-  SetProperties(fetaJet, "#eta jet", "dN/d#eta");
-  SetProperties(fphiJet, "#phi jet", "dN/d#phi");
-
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::FillMonoJetH(Int_t goodBin, AliAODJet* recJets, TClonesArray* tracks)
-{
-  if (goodBin == 999) return;
-
-  Int_t nTracks = tracks->GetEntries();
-  Float_t xi,t1,ene,dr2,deta2,dphi2, z, cosTheta, theta, kt;
-  Bool_t jetOk1 = 0;
-  Bool_t jetOk2 = 0;
-  Bool_t jetOk3 = 0;
-  Bool_t jetOk4 = 0;
-  Bool_t jetOk5 = 0;
-  Bool_t jetOk6 = 0;
-  Bool_t jetOk7 = 0;
-  Bool_t jetOk8 = 0;
-  Bool_t jetOk9 = 0;
-  Bool_t jetOk10 = 0;
-
-  fEtaMonoJet1H[goodBin]->Fill(recJets[0].Eta());
-  fPhiMonoJet1H[goodBin]->Fill(recJets[0].Phi());
-  fPtMonoJet1H[goodBin]->Fill(recJets[0].Pt());
-  fEMonoJet1H[goodBin]->Fill(recJets[0].E());
-
-  Int_t mult = 0;
-  for(Int_t it=0; it<nTracks; it++)
-  {
-    AliAODTrack* aodTrack = (AliAODTrack*)tracks->At(it);
-    // Apply track cuts
-    UInt_t status = aodTrack->GetStatus();
-    if (status == 0) continue;
-    if((fFilterMask>0)&&!(aodTrack->TestFilterBit(fFilterMask)))continue;
-    mult++;
-    Float_t etaT = aodTrack->Eta();
-    Float_t phiT = aodTrack->Phi();
-    Float_t ptT = aodTrack->Pt();
-    // For Theta distribution
-    Float_t pxT = aodTrack->Px();
-    Float_t pyT = aodTrack->Py();
-    Float_t pzT = aodTrack->Pz();
-    Float_t pT = aodTrack->P();
-    // Compute theta
-    cosTheta = (pxT*recJets[0].Px()+pyT*recJets[0].Py()+pzT*recJets[0].Pz())/(pT*recJets[0].P());
-    theta = TMath::ACos(cosTheta);
-    // Compute xi
-    deta2 = etaT - recJets[0].Eta();
-    dphi2 = phiT - recJets[0].Phi();
-    if (dphi2 < -TMath::Pi()) dphi2= -dphi2 - 2.0 * TMath::Pi();
-    if (dphi2 > TMath::Pi()) dphi2 = 2.0 * TMath::Pi() - dphi2;
-    dr2 = TMath::Sqrt(deta2 * deta2 + dphi2 * dphi2);
-    t1  = TMath::Tan(2.0*TMath::ATan(TMath::Exp(-etaT)));
-    ene = ptT*TMath::Sqrt(1.+1./(t1*t1));
-    xi  = (Float_t) TMath::Log(recJets[0].E()/ptT);
-    // Compute z
-    z   = (Double_t)(ptT/recJets[0].E());
-    // Compute kT/jT
-    TVector3 partP; TVector3 jetP;
-    jetP[0] = recJets[0].Px();
-    jetP[1] = recJets[0].Py();
-    jetP[2] = recJets[0].Pz();
-    partP.SetPtEtaPhi(ptT,etaT,phiT);
-    kt = TMath::Sin(partP.Angle(jetP))*partP.Mag();
-    // Compute Jet shape
-
-    for(Int_t i2 = 0; i2 < fnRBin; i2++)
-    {
-      if ((dr2<farrayRadii[i2]) && (ptT > fPartPtCut)) 
-      {
-        if (i2 == 0) jetOk1 = 1;
-        if (i2 == 1) jetOk2 = 1;
-        if (i2 == 2) jetOk3 = 1;
-        if (i2 == 3) jetOk4 = 1;
-        if (i2 == 4) jetOk5 = 1;
-        if (i2 == 5) jetOk6 = 1;
-        if (i2 == 6) jetOk7 = 1;
-        if (i2 == 7) jetOk8 = 1;
-        if (i2 == 8) jetOk9 = 1;
-        if (i2 == 9) jetOk10 = 1;
-
-        fdNdXiMonoJet1H[goodBin][i2]->Fill(xi);
-        fdNdPtMonoJet1H[goodBin][i2]->Fill(ptT);
-        fdNdZMonoJet1H[goodBin][i2]->Fill(z);
-       fdNdThetaMonoJet1H[goodBin][i2]->Fill(theta);
-       fdNdcosThetaMonoJet1H[goodBin][i2]->Fill(cosTheta);
-       fdNdkTMonoJet1H[goodBin][i2]->Fill(kt);
-       fdNdpTvsZMonoJet1H[goodBin][i2]->Fill(z,1/((fPthadHBinMax-fPthadHBinMin)/fnPthadHBin));
-
-       fThetaPtPartMonoJet1H[goodBin][i2]->Fill(ptT,theta);
-       fcosThetaPtPartMonoJet1H[goodBin][i2]->Fill(ptT,cosTheta);
-       fkTPtPartMonoJet1H[goodBin][i2]->Fill(ptT,kt);
-       fThetaPtJetMonoJet1H[goodBin][i2]->Fill(recJets[0].Pt(),theta);
-       fcosThetaPtJetMonoJet1H[goodBin][i2]->Fill(recJets[0].Pt(),cosTheta);
-       fkTPtJetMonoJet1H[goodBin][i2]->Fill(recJets[0].Pt(),kt);
-       fpTPtJetMonoJet1H[goodBin][i2]->Fill(recJets[0].Pt(),ptT);
-      }
-    }
-  }
-  fEvtMultvsJetPt->Fill(recJets[0].Pt(),mult);
-
-  if (jetOk1)  fNMonoJet1sH[goodBin][0]->Fill(0.5);
-  if (jetOk2)  fNMonoJet1sH[goodBin][1]->Fill(0.5);
-  if (jetOk3)  fNMonoJet1sH[goodBin][2]->Fill(0.5);
-  if (jetOk4)  fNMonoJet1sH[goodBin][3]->Fill(0.5);
-  if (jetOk5)  fNMonoJet1sH[goodBin][4]->Fill(0.5);
-  if (jetOk6)  fNMonoJet1sH[goodBin][5]->Fill(0.5);
-  if (jetOk7)  fNMonoJet1sH[goodBin][6]->Fill(0.5);
-  if (jetOk8)  fNMonoJet1sH[goodBin][7]->Fill(0.5);
-  if (jetOk9)  fNMonoJet1sH[goodBin][8]->Fill(0.5);
-  if (jetOk10) fNMonoJet1sH[goodBin][9]->Fill(0.5);
-
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, const char* y)
-{
-  //Set properties of histos (x and y title and error propagation)
-  h->SetXTitle(x);
-  h->SetYTitle(y);
-  h->GetXaxis()->SetTitleColor(1);
-  h->GetYaxis()->SetTitleColor(1);
-  h->Sumw2();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
+/*************************************************************************\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
+\r
+#include "TList.h"\r
+#include "TH1F.h"\r
+#include "TH2F.h"\r
+#include "TString.h"\r
+\r
+#include "AliAODInputHandler.h" \r
+#include "AliAODHandler.h" \r
+#include "AliESDEvent.h"\r
+#include "AliAODMCParticle.h"\r
+#include "AliAODJet.h"\r
+#include "AliGenPythiaEventHeader.h"\r
+#include "AliInputEventHandler.h"\r
+\r
+#include "AliAnalysisHelperJetTasks.h"\r
+#include "AliAnalysisManager.h"\r
+#include "AliAnalysisTaskSE.h"\r
+\r
+#include "AliAnalysisTaskFragmentationFunction.h"\r
+\r
+\r
+ClassImp(AliAnalysisTaskFragmentationFunction)\r
+\r
+//____________________________________________________________________________\r
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()\r
+   : AliAnalysisTaskSE()\r
+   ,fESD(0)\r
+   ,fAOD(0)\r
+   ,fMCEvent(0)\r
+   ,fBranchRecJets("jets")\r
+   ,fBranchGenJets("")\r
+   ,fTrackTypeGen(0)\r
+   ,fJetTypeGen(0)\r
+   ,fFilterMask(0)\r
+   ,fTrackPtCut(0)\r
+   ,fTrackEtaMin(0)\r
+   ,fTrackEtaMax(0)\r
+   ,fTrackPhiMin(0)\r
+   ,fTrackPhiMax(0)\r
+   ,fJetPtCut(0)\r
+   ,fJetEtaMin(0)\r
+   ,fJetEtaMax(0)\r
+   ,fJetPhiMin(0)\r
+   ,fJetPhiMax(0)\r
+   ,fFFRadius(0)\r
+   ,fDijetDeltaPhiCut(0)\r
+   ,fDijetInvMassMin(0)\r
+   ,fDijetInvMassMax(0)\r
+   ,fDijetCDFcut(0)\r
+   ,fDijetEMeanMin(0)\r
+   ,fDijetEMeanMax(0)\r
+   ,fDijetEFractionCut(0)\r
+   ,fDijetEFraction(0)\r
+   ,fTracksRec(0)\r
+   ,fTracksRecCuts(0)\r
+   ,fTracksGen(0)\r
+   ,fJetsRec(0)\r
+   ,fJetsRecCuts(0)\r
+   ,fJetsGen(0)\r
+   ,fQATrackHistosRec(0)\r
+   ,fQATrackHistosRecCuts(0)\r
+   ,fQATrackHistosGen(0)\r
+   ,fQAJetHistosRec(0)\r
+   ,fQAJetHistosRecCuts(0)\r
+   ,fQAJetHistosRecCutsLeading(0)\r
+   ,fQAJetHistosGen(0)\r
+   ,fQAJetHistosGenLeading(0)\r
+   ,fFFHistosRecCuts(0)\r
+   ,fFFHistosRecLeading(0)\r
+   ,fFFHistosRecLeadingTrack(0)\r
+   ,fFFHistosGen(0)\r
+   ,fFFHistosGenLeading(0)\r
+   ,fFFHistosGenLeadingTrack(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
+   ,fh1nRecJetsCuts(0)\r
+   ,fh1nGenJets(0)\r
+{\r
+   // default constructor\r
+}\r
+\r
+//__________________________________________________________________________________________\r
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char *name) \r
+  : AliAnalysisTaskSE(name)\r
+  ,fESD(0)\r
+  ,fAOD(0)\r
+  ,fMCEvent(0)\r
+  ,fBranchRecJets("jets")\r
+  ,fBranchGenJets("")\r
+  ,fTrackTypeGen(0)\r
+  ,fJetTypeGen(0)\r
+  ,fFilterMask(0)\r
+  ,fTrackPtCut(0)\r
+  ,fTrackEtaMin(0)\r
+  ,fTrackEtaMax(0)\r
+  ,fTrackPhiMin(0)\r
+  ,fTrackPhiMax(0)\r
+  ,fJetPtCut(0)\r
+  ,fJetEtaMin(0)\r
+  ,fJetEtaMax(0)\r
+  ,fJetPhiMin(0)\r
+  ,fJetPhiMax(0)\r
+  ,fFFRadius(0)\r
+  ,fDijetDeltaPhiCut(0)\r
+  ,fDijetInvMassMin(0)\r
+  ,fDijetInvMassMax(0)\r
+  ,fDijetCDFcut(0)\r
+  ,fDijetEMeanMin(0)\r
+  ,fDijetEMeanMax(0)\r
+  ,fDijetEFractionCut(0)\r
+  ,fDijetEFraction(0)\r
+  ,fTracksRec(0)\r
+  ,fTracksRecCuts(0)\r
+  ,fTracksGen(0)\r
+  ,fJetsRec(0)\r
+  ,fJetsRecCuts(0)\r
+  ,fJetsGen(0)\r
+  ,fQATrackHistosRec(0)\r
+  ,fQATrackHistosRecCuts(0)\r
+  ,fQATrackHistosGen(0)\r
+  ,fQAJetHistosRec(0)\r
+  ,fQAJetHistosRecCuts(0)\r
+  ,fQAJetHistosRecCutsLeading(0)\r
+  ,fQAJetHistosGen(0)\r
+  ,fQAJetHistosGenLeading(0)\r
+  ,fFFHistosRecCuts(0)\r
+  ,fFFHistosRecLeading(0)\r
+  ,fFFHistosRecLeadingTrack(0)\r
+  ,fFFHistosGen(0)\r
+  ,fFFHistosGenLeading(0)\r
+  ,fFFHistosGenLeadingTrack(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
+  ,fh1nRecJetsCuts(0)\r
+  ,fh1nGenJets(0)\r
+{\r
+  // constructor\r
+  \r
+  DefineOutput(1,TList::Class());\r
+  \r
+\r
+}\r
+\r
+//__________________________________________________________________________________________________________________________\r
+AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const  AliAnalysisTaskFragmentationFunction &copy)\r
+  : AliAnalysisTaskSE()\r
+  ,fESD(copy.fESD)\r
+  ,fAOD(copy.fAOD)\r
+  ,fMCEvent(copy.fMCEvent)\r
+  ,fBranchRecJets(copy.fBranchRecJets)\r
+  ,fBranchGenJets(copy.fBranchGenJets)\r
+  ,fTrackTypeGen(copy.fTrackTypeGen)\r
+  ,fJetTypeGen(copy.fJetTypeGen)\r
+  ,fFilterMask(copy.fFilterMask)\r
+  ,fTrackPtCut(copy.fTrackPtCut)\r
+  ,fTrackEtaMin(copy.fTrackEtaMin)\r
+  ,fTrackEtaMax(copy.fTrackEtaMax)\r
+  ,fTrackPhiMin(copy.fTrackPhiMin)\r
+  ,fTrackPhiMax(copy.fTrackPhiMax)\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
+  ,fDijetDeltaPhiCut(copy.fDijetDeltaPhiCut)\r
+  ,fDijetInvMassMin(copy.fDijetInvMassMin)\r
+  ,fDijetInvMassMax(copy.fDijetInvMassMax)\r
+  ,fDijetCDFcut(copy.fDijetCDFcut)\r
+  ,fDijetEMeanMin(copy.fDijetEMeanMin)\r
+  ,fDijetEMeanMax(copy.fDijetEMeanMax)\r
+  ,fDijetEFractionCut(copy.fDijetEFractionCut)\r
+  ,fDijetEFraction(copy.fDijetEFraction)\r
+  ,fTracksRec(copy.fTracksRec)\r
+  ,fTracksRecCuts(copy.fTracksRecCuts)\r
+  ,fTracksGen(copy.fTracksGen)\r
+  ,fJetsRec(copy.fJetsRec)\r
+  ,fJetsRecCuts(copy.fJetsRecCuts)\r
+  ,fJetsGen(copy.fJetsGen)\r
+  ,fQATrackHistosRec(copy.fQATrackHistosRec)\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
+  ,fFFHistosRecCuts(copy.fFFHistosRecCuts)\r
+  ,fFFHistosRecLeading(copy.fFFHistosRecLeading)\r
+  ,fFFHistosRecLeadingTrack(copy.fFFHistosRecLeadingTrack)\r
+  ,fFFHistosGen(copy.fFFHistosGen)\r
+  ,fFFHistosGenLeading(copy.fFFHistosGenLeading)\r
+  ,fFFHistosGenLeadingTrack(copy.fFFHistosGenLeadingTrack)\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
+  ,fh1nRecJetsCuts(copy.fh1nRecJetsCuts)\r
+  ,fh1nGenJets(copy.fh1nGenJets)\r
+{\r
+  // copy constructor\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
+    fMCEvent                   = o.fMCEvent;\r
+    fBranchRecJets             = o.fBranchRecJets;\r
+    fBranchGenJets             = o.fBranchGenJets;\r
+    fTrackTypeGen              = o.fTrackTypeGen;\r
+    fJetTypeGen                = o.fJetTypeGen;\r
+    fFilterMask                = o.fFilterMask;\r
+    fTrackPtCut                = o.fTrackPtCut;\r
+    fTrackEtaMin               = o.fTrackEtaMin;\r
+    fTrackEtaMax               = o.fTrackEtaMax;\r
+    fTrackPhiMin               = o.fTrackPhiMin;\r
+    fTrackPhiMax               = o.fTrackPhiMax;\r
+    fJetPtCut                  = o.fJetPtCut;\r
+    fJetEtaMin                 = o.fJetEtaMin;\r
+    fJetEtaMax                 = o.fJetEtaMax;\r
+    fJetPhiMin                 = o.fJetPhiMin;\r
+    fJetPhiMax                 = o.fJetPhiMax;\r
+    fFFRadius                  = o.fFFRadius;\r
+    fDijetDeltaPhiCut          = o.fDijetDeltaPhiCut;\r
+    fDijetInvMassMin           = o.fDijetInvMassMin;\r
+    fDijetInvMassMax           = o.fDijetInvMassMax;\r
+    fDijetCDFcut               = o.fDijetCDFcut;\r
+    fDijetEMeanMin             = o.fDijetEMeanMin;\r
+    fDijetEMeanMax             = o.fDijetEMeanMax;\r
+    fDijetEFractionCut         = o.fDijetEFractionCut;\r
+    fDijetEFraction            = o.fDijetEFraction;\r
+    fTracksRec                 = o.fTracksRec;\r
+    fTracksRecCuts             = o.fTracksRecCuts;\r
+    fTracksGen                 = o.fTracksGen;\r
+    fJetsRec                   = o.fJetsRec;\r
+    fJetsRecCuts               = o.fJetsRecCuts;\r
+    fJetsGen                   = o.fJetsGen;\r
+    fQATrackHistosRec          = o.fQATrackHistosRec;\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
+    fFFHistosRecCuts           = o.fFFHistosRecCuts;\r
+    fFFHistosRecLeading        = o.fFFHistosRecLeading;\r
+    fFFHistosRecLeadingTrack   = o.fFFHistosRecLeadingTrack;\r
+    fFFHistosGen               = o.fFFHistosGen;\r
+    fFFHistosGenLeading        = o.fFFHistosGenLeading;\r
+    fFFHistosGenLeadingTrack   = o.fFFHistosGenLeadingTrack;\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
+    fh1nRecJetsCuts            = o.fh1nRecJetsCuts;\r
+    fh1nGenJets                = o.fh1nGenJets; \r
+  }\r
+    \r
+  return *this;\r
+}\r
+\r
+//___________________________________________________________________________\r
+AliAnalysisTaskFragmentationFunction::~AliAnalysisTaskFragmentationFunction()\r
+{\r
+  // destructor\r
+  \r
+}\r
+\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
+  ,fName(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
+  ,fName(copy.fName)\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
+    fName       = o.fName;\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", fName.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);\r
+  fh2TrackPt = new TH2F(Form("fh2FFTrackPt%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsPt, fPtMin, fPtMax);\r
+  fh2Xi      = new TH2F(Form("fh2FFXi%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsXi, fXiMin, fXiMax);\r
+  fh2Z       = new TH2F(Form("fh2FFZ%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsZ, fZMin, fZMax);\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)\r
+{\r
+  // fill FF\r
\r
+  if(incrementJetPt) fh1JetPt->Fill(jetPt);    \r
+  fh2TrackPt->Fill(jetPt,trackPt);\r
+  \r
+  Double_t z = trackPt / jetPt;\r
+  Double_t xi = 0;\r
+  if(z>0) xi = TMath::Log(1/z);\r
+  \r
+  fh2Xi->Fill(jetPt,xi);\r
+  fh2Z->Fill(jetPt,z);\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
+//_________________________________________________________________________________________________________\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
+  ,fName(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
+  ,fName(copy.fName)\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
+    fName     = o.fName;\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", fName.Data()), Form("%s: #eta - #phi distribution", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
+  fh1Pt      = new TH1F(Form("fh1JetQAPt%s", fName.Data()), Form("%s: p_{T} distribution", fName.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
+//___________________________________________________________________________________________________________\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
+  ,fName(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
+  ,fName(copy.fName)\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
+    fName            = o.fName;\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
+}\r
+\r
+//______________________________________________________________________\r
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::DefineHistos()\r
+{\r
+  // book track QA histos\r
+\r
+  fh2EtaPhi       = new TH2F(Form("fh2TrackQAEtaPhi%s", fName.Data()), Form("%s: #eta - #phi distribution", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
+  fh2HighPtEtaPhi = new TH2F(Form("fh2TrackQAHighPtEtaPhi%s", fName.Data()), Form("%s: #eta - #phi distribution for high-p_{T}", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
+  fh1Pt           = new TH1F(Form("fh1TrackQAPt%s", fName.Data()), Form("%s: p_{T} distribution", fName.Data()), 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
+}\r
+\r
+//________________________________________________________________________________________________________\r
+void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::FillTrackQA(Float_t eta, Float_t phi, Float_t pt)\r
+{\r
+  // fill track QA histos\r
+    \r
+  fh2EtaPhi->Fill( eta, phi);\r
+  if(pt > fHighPtThreshold) fh2HighPtEtaPhi->Fill( eta, phi);\r
+  fh1Pt->Fill( 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
+}\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
+  fTracksRec = new TList();\r
+  fTracksRec->SetOwner(kFALSE);  \r
+\r
+  fTracksRecCuts = new TList();\r
+  fTracksRecCuts->SetOwner(kFALSE);  \r
+\r
+  fTracksGen = new TList();\r
+  fTracksGen->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
+  // fJetsKine = new TList();\r
+  // fJetsKine->SetOwner(kTRUE); // delete AOD jets using mom from Kine Tree via TList::Clear()\r
+\r
+\r
+  //\r
+  // Create histograms / output container\r
+  //\r
+\r
+  OpenFile(1);\r
+  fCommonHistList = new TList();\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
+  fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 11,-.5, 10.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",100,0.,100.);\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
+\r
+\r
+  fQATrackHistosRec          = new AliFragFuncQATrackHistos("Rec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
+                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
+  fQATrackHistosRecCuts      = new AliFragFuncQATrackHistos("RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
+                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
+  fQATrackHistosGen          = new AliFragFuncQATrackHistos("Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
+                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
+  \r
+\r
+  fQAJetHistosRec            = new AliFragFuncQAJetHistos("Rec", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
+                                              fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
+  fQAJetHistosRecCuts        = new AliFragFuncQAJetHistos("RecCuts", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
+                                              fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
+  fQAJetHistosRecCutsLeading = new AliFragFuncQAJetHistos("RecCutsLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
+                                              fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
+  fQAJetHistosGen            = new AliFragFuncQAJetHistos("Gen", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
+                                              fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
+  fQAJetHistosGenLeading     = new AliFragFuncQAJetHistos("GenLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
+                                              fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
+  \r
+\r
+  fFFHistosRecCuts          = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+  fFFHistosRecLeading        = new AliFragFuncHistos("RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+  fFFHistosRecLeadingTrack   = new AliFragFuncHistos("RecLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+  fFFHistosGen              = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+  fFFHistosGenLeading        = new AliFragFuncHistos("GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+  fFFHistosGenLeadingTrack   = new AliFragFuncHistos("GenLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
+                                           fFFNBinsZ , fFFZMin , fFFZMax);\r
+\r
+\r
+  fQATrackHistosRec->DefineHistos();\r
+  fQATrackHistosRecCuts->DefineHistos();\r
+  fQATrackHistosGen->DefineHistos();\r
+\r
+  fQAJetHistosRec->DefineHistos();\r
+  fQAJetHistosRecCuts->DefineHistos();\r
+  fQAJetHistosRecCutsLeading->DefineHistos();\r
+  fQAJetHistosGen->DefineHistos();\r
+  fQAJetHistosGenLeading->DefineHistos();\r
+\r
+  fFFHistosRecCuts->DefineHistos();\r
+  fFFHistosRecLeading->DefineHistos();\r
+  fFFHistosRecLeadingTrack->DefineHistos();\r
+  fFFHistosGen->DefineHistos();\r
+  fFFHistosGenLeading->DefineHistos();\r
+  fFFHistosGenLeadingTrack->DefineHistos();\r
+  \r
+  \r
+  const Int_t saveLevel = 4;\r
+  if(saveLevel>0){\r
+    fCommonHistList->Add(fh1EvtSelection);\r
+    fFFHistosRecCuts->AddToOutput(fCommonHistList);\r
+    fFFHistosRecLeading->AddToOutput(fCommonHistList);\r
+    fFFHistosRecLeadingTrack->AddToOutput(fCommonHistList);\r
+    fFFHistosGen->AddToOutput(fCommonHistList);\r
+    fFFHistosGenLeading->AddToOutput(fCommonHistList);\r
+    fFFHistosGenLeadingTrack->AddToOutput(fCommonHistList);\r
+  }\r
+  if(saveLevel>1){\r
+    fQATrackHistosRec->AddToOutput(fCommonHistList);\r
+    fQATrackHistosRecCuts->AddToOutput(fCommonHistList);\r
+    fQATrackHistosGen->AddToOutput(fCommonHistList);\r
+    \r
+    fQAJetHistosRec->AddToOutput(fCommonHistList);\r
+    fQAJetHistosRecCuts->AddToOutput(fCommonHistList);\r
+    fQAJetHistosRecCutsLeading->AddToOutput(fCommonHistList);\r
+    fQAJetHistosGen->AddToOutput(fCommonHistList);\r
+    fQAJetHistosGenLeading->AddToOutput(fCommonHistList);\r
+    \r
+    fCommonHistList->Add(fh1EvtMult);\r
+    fCommonHistList->Add(fh1nRecJetsCuts);\r
+    fCommonHistList->Add(fh1nGenJets);\r
+  }\r
+  if(saveLevel>2){\r
+    fCommonHistList->Add(fh1VertexNContributors);\r
+    fCommonHistList->Add(fh1VertexZ);    \r
+  }\r
+  if(saveLevel>3){\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
+  }\r
+  \r
+  TH1::AddDirectory(oldStatus);\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
+  // Trigger selection\r
+  \r
+  AliInputEventHandler* inputHandler = (AliInputEventHandler*)\r
+    ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());\r
+  if(inputHandler->IsEventSelected()){\r
+    if(fDebug > 1)  Printf(" Trigger Selection: event ACCEPTED ... ");\r
+    fh1EvtSelection->Fill(1.);\r
+  } else {\r
+    fh1EvtSelection->Fill(0.);\r
+    if(inputHandler->InheritsFrom("AliESDInputHandler")){ // PhysicsSelection only with ESD input\r
+       if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");\r
+       PostData(1, fCommonHistList);\r
+       return;\r
+    }\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 (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
+      if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);\r
+    }\r
+  }\r
+  \r
+  if(!fAOD){\r
+    Printf("%s:%d AODEvent not found", (char*)__FILE__,__LINE__);\r
+    return;\r
+  }\r
+  \r
+  \r
+  // event selection (vertex) *****************************************\r
+  \r
+  AliAODVertex* primVtx = fAOD->GetPrimaryVertex();\r
+  Int_t nTracksPrim = primVtx->GetNContributors();\r
+  fh1VertexNContributors->Fill(nTracksPrim);\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(2.);\r
+    PostData(1, fCommonHistList);\r
+    return;\r
+  }\r
+\r
+  fh1VertexZ->Fill(primVtx->GetZ());\r
+  \r
+  if(TMath::Abs(primVtx->GetZ())>10){\r
+    if (fDebug > 1) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); \r
+    fh1EvtSelection->Fill(3.);\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(4.);\r
+    PostData(1, fCommonHistList);\r
+    return;\r
+  }\r
+  if (fDebug > 1) Printf("%s:%d primary vertex selection: event ACCEPTED ...",(char*)__FILE__,__LINE__); \r
+  fh1EvtSelection->Fill(5.);\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
+  \r
+  if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() \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
+  if(nJGen != nGenJets) Printf("%s:%d Mismatch selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);\r
+  fh1nGenJets->Fill(nGenJets);\r
+\r
+\r
+  //____ fetch particles __________________________________________________________\r
+  \r
+  Int_t nT = GetListOfTracks(fTracksRec, kTrackAOD);\r
+  Int_t nRecPart = 0;\r
+  if(nT>=0) nRecPart = fTracksRec->GetEntries();\r
+  if(fDebug>2)Printf("%s:%d Selected Rec tracks: %d %d",(char*)__FILE__,__LINE__,nT,nRecPart);\r
+  if(nRecPart != nT) Printf("%s:%d Mismatch selected Rec tracks: %d %d",(char*)__FILE__,__LINE__,nT,nRecPart);\r
+  \r
+\r
+  Int_t nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODCuts);\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
+  // loop over tracks\r
+\r
+  for(Int_t it=0; it<nRecPart; ++it){\r
+    AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRec->At(it));\r
+    fQATrackHistosRec->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
+  }\r
+  for(Int_t it=0; it<nRecPartCuts; ++it){\r
+    AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRecCuts->At(it));\r
+    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
+    fQATrackHistosGen->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
+  }\r
+  \r
+  // loop over jets\r
+\r
+  for(Int_t ij=0; ij<nRecJets; ++ij){\r
+\r
+    AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRec->At(ij));\r
+    fQAJetHistosRec->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
+  }\r
+  \r
+\r
+  for(Int_t ij=0; ij<nRecJetsCuts; ++ij){\r
+\r
+    AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRecCuts->At(ij));\r
+    fQAJetHistosRecCuts->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
+\r
+    if(ij==0){ // leading jet\r
+      \r
+      fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );\r
+      \r
+      TList* jettracklist = new TList();\r
+      Double_t sumPt = 0.;\r
+      Float_t leadTrackPt = 0.;\r
+      \r
+      if(GetFFRadius()<=0){\r
+       GetJetTracksTrackrefs(jettracklist, jet);\r
+       } else {\r
+       GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt);\r
+      }\r
+      \r
+      for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
+       Float_t trackPt = (dynamic_cast<AliVParticle*> (jettracklist->At(it)))->Pt();\r
+       Float_t jetPt = jet->Pt();\r
+       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
+       \r
+       fFFHistosRecCuts->FillFF( trackPt, jetPt, incrementJetPt);\r
+       \r
+       if(it==0){ \r
+         leadTrackPt = trackPt;\r
+         fFFHistosRecLeadingTrack->FillFF( leadTrackPt, jetPt, kTRUE);\r
+       }\r
+       fFFHistosRecLeading->FillFF( trackPt, leadTrackPt , incrementJetPt);\r
+      }\r
+      \r
+      delete jettracklist;\r
+    }\r
+  }\r
+       \r
+\r
+  for(Int_t ij=0; ij<nGenJets; ++ij){\r
+\r
+    AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));\r
+    fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
+    \r
+    if(ij==0){ // leading jet\r
+    \r
+      fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
+      \r
+      TList* jettracklist = new TList();\r
+      Double_t sumPt = 0.;\r
+      Float_t leadTrackPt = 0.;\r
+      \r
+      if(GetFFRadius()<=0){\r
+       GetJetTracksTrackrefs(jettracklist, jet);\r
+      } else {\r
+       GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt);\r
+      }\r
+      \r
+      for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
+       Float_t trackPt = (dynamic_cast<AliVParticle*>(jettracklist->At(it)))->Pt();\r
+       Float_t jetPt = jet->Pt();\r
+       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
+\r
+       fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt);\r
+       \r
+       if(it==0){ \r
+         leadTrackPt = trackPt;\r
+         fFFHistosGenLeadingTrack->FillFF( leadTrackPt, jetPt, kTRUE);\r
+       }\r
+       fFFHistosGenLeading->FillFF( trackPt, leadTrackPt, incrementJetPt);\r
+      }\r
+      \r
+      delete jettracklist;\r
+    }\r
+  }\r
+  \r
+  fTracksRec->Clear();\r
+  fTracksRecCuts->Clear();\r
+  fTracksGen->Clear();\r
+  fJetsRec->Clear();\r
+  fJetsRecCuts->Clear();\r
+  fJetsGen->Clear();\r
+\r
+  //Post output data.\r
+  PostData(1, fCommonHistList);\r
+  \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(type==kTrackUndef) return -1;\r
+  \r
+  Int_t iCount = 0;\r
+  if(type==kTrackAODCuts || type==kTrackAOD){\r
+\r
+    // all rec. tracks, esd filter mask, eta range\r
+    if(!fAOD) return -1;\r
+    \r
+    for(Int_t it=0; it<fAOD->GetNumberOfTracks(); ++it){\r
+      AliAODTrack *tr = fAOD->GetTrack(it);\r
+      \r
+      if(type == kTrackAODCuts){\r
+       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;\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
+      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) {\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->IsPhysicalPrimary())continue;\r
+      \r
+      if (type==kTrackAODMCCharged || type==kTrackAODMCChargedAcceptance){\r
+       if(part->Charge()==0) continue;\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 = 0x0;\r
+    if(fBranchRecJets.Length()) aodRecJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchRecJets.Data()));\r
+    if(!aodRecJets)             aodRecJets = dynamic_cast<TClonesArray*>(fAOD->GetList()->FindObject(fBranchRecJets.Data()));\r
+\r
+    if(!aodRecJets){\r
+      if(fBranchRecJets.Length()) Printf("%s:%d no reconstructed jet array with name %s found", (char*)__FILE__,__LINE__,fBranchRecJets.Data());\r
+\r
+      if(fDebug>1)fAOD->Print();\r
+      return 0;\r
+    }\r
+\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
+      list->Add(tmp);\r
+         \r
+      nRecJets++;\r
+    }\r
+\r
+    list->Sort();\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
+    AliGenPythiaEventHeader*  pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(fMCEvent);\r
+    if(!pythiaGenHeader){\r
+      Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);\r
+      return 0;\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 = 0x0;\r
+    if(fBranchGenJets.Length()) aodGenJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchGenJets.Data()));\r
+    if(!aodGenJets)             aodGenJets = dynamic_cast<TClonesArray*>(fAOD->GetList()->FindObject(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
+      \r
+      nGenJets++;\r
+    }\r
+    list->Sort();\r
+    return nGenJets;\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
+// __________________________________________________________________________________________\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(TH2* 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, AliAODJet* jet, const Double_t radius,Double_t& sumPt)\r
+{\r
+  // fill list of tracks in cone around jet axis  \r
+\r
+  sumPt = 0;\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
+\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
+  }\r
+  \r
+  outputlist->Sort();\r
+}\r
+\r
+// ___________________________________________________________________________________________\r
+void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, AliAODJet* jet)\r
+{\r
+  // list of jet tracks from trackrefs\r
+  \r
+  Int_t nTracks = jet->GetRefTracks()->GetEntriesFast();\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
+    list->Add(track);\r
+  }\r
+  \r
+  list->Sort();\r
+}\r
index 438d2b73e7d517e4b8935d99f868ff89a534e75b..b1680d551d5bc2776b87eb3ca0d6ce8f658a2c9a 100644 (file)
@@ -7,7 +7,6 @@
 #pragma link C++ class AliAnalysisTaskUE+;
 #pragma link C++ class AliAnalyseUE+;
 #pragma link C++ class AliHistogramsUE+;
-#pragma link C++ class AliAnalysisTaskCorrectionsUE+;
 #pragma link C++ class AliAnalysisTaskJetServices+;
 #pragma link C++ class AliAnalysisTaskJetSpectrum+;
 #pragma link C++ class AliAnalysisTaskJetSpectrum2+;
@@ -22,5 +21,9 @@
 #pragma link C++ class AliAnalysisTaskPWG4PidDetEx+;
 #pragma link C++ class AliJetSpectrumUnfolding+;
 #pragma link C++ class AliAnalysisTaskJetChem+;
+#pragma link C++ class AliAnalysisTaskFragmentationFunction+;
+#pragma link C++ class AliAnalysisTaskFragmentationFunction::AliFragFuncHistos+;
+#pragma link C++ class AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos+;
+#pragma link C++ class AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos+;
 
 #endif
index 680b962701ca95561dbd6e5c8c43dae6e1407a62..882d2eb370c837bb67e5cd3468609ca4438b6d62 100644 (file)
@@ -1,6 +1,6 @@
 #-*- Mode: Makefile -*-
 
-SRCS = JetTasks/AliAnalysisTaskUE.cxx JetTasks/AliHistogramsUE.cxx JetTasks/AliAnalyseUE.cxx  JetTasks/AliAnalysisTaskCorrectionsUE.cxx JetTasks/AliAnalysisTaskJetSpectrum.cxx JetTasks/AliAnalysisTaskJetSpectrum2.cxx JetTasks/AliAnalysisHelperJetTasks.cxx JetTasks/AliAnalysisTaskJetServices.cxx JetTasks/AliAnalysisTaskPWG4PidDetEx.cxx JetTasks/AliJetSpectrumUnfolding.cxx JetTasks/AliAnalysisTaskJFSystematics.cxx JetTasks/AliAnalysisTaskJetCorrections.cxx JetTasks/AliAnalysisTaskThreeJets.cxx JetTasks/AliPWG4HighPtQATPConly.cxx JetTasks/AliPWG4HighPtQAMC.cxx JetTasks/AliPWG4HighPtSpectra.cxx JetTasks/AliPWG4CosmicCandidates.cxx JetTasks/AliAnalysisTaskJetChem.cxx 
+SRCS = JetTasks/AliAnalysisTaskUE.cxx JetTasks/AliHistogramsUE.cxx JetTasks/AliAnalyseUE.cxx JetTasks/AliAnalysisTaskJetSpectrum.cxx JetTasks/AliAnalysisTaskJetSpectrum2.cxx JetTasks/AliAnalysisHelperJetTasks.cxx JetTasks/AliAnalysisTaskJetServices.cxx JetTasks/AliAnalysisTaskPWG4PidDetEx.cxx JetTasks/AliJetSpectrumUnfolding.cxx JetTasks/AliAnalysisTaskJFSystematics.cxx JetTasks/AliAnalysisTaskJetCorrections.cxx JetTasks/AliAnalysisTaskThreeJets.cxx JetTasks/AliPWG4HighPtQATPConly.cxx JetTasks/AliPWG4HighPtQAMC.cxx JetTasks/AliPWG4HighPtSpectra.cxx JetTasks/AliPWG4CosmicCandidates.cxx JetTasks/AliAnalysisTaskJetChem.cxx JetTasks/AliAnalysisTaskFragmentationFunction.cxx 
 
 HDRS:= $(SRCS:.cxx=.h) 
 
index 7b5efc6b23d0b1e0eceec53aeb6569a031fabe8d..979e57e04eb0df22fdb36c09d0ce60d1b963631d 100644 (file)
-AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(UInt_t filterMask = 0,Int_t iPhysicsSelection)
+
+/*************************************************************************************************
+***  Add Fragmentation Function Task ***
+**************************************************************************************************
+The fragmenation function task expects an ESD filter and jet finder running before this task. 
+Or it runs on delta-AODs filled with filtered tracks and jets before.
+
+** Parameters **
+(char) recJetsBranch: branch in AOD for (reconstructed) jets
+(char) genJetsBranch: branch in AOD for (generated) jets
+(char) jetType: "AOD"   jets from recJetsBranch
+                "AODMC" jets from genJetsBranch
+                "KINE"  jets from PYCELL
+                 +"b" (e.g. "AODb") jets with acceptance cuts
+(char) trackType: "AOD"     reconstructed tracks from AOD filled by ESD filter (choose filter mask!)
+                  "AODMC"   MC tracks from AOD filled by kine filter
+                  "KINE"    kine particles from MC event 
+                  +"2" (e.g. "AOD2")  charged tracks only
+                  +"b" (e.g. "AOD2b") with acceptance cuts
+(UInt_t) filterMask: select filter bit of ESD filter task
+
+***************************************************************************************************/
+
+
+
+
+AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(UInt_t iFlag=1, UInt_t filterMask=16){
+        
+        AliAnalysisTaskFragmentationFunction *ff=0;
+
+        // only reconstructed (default)
+       if(iFlag&(1<<0)) ff = AddTaskFragmentationFunction("jets", "", "", "", filterMask);
+        // MC tracks in acceptance, MC jets in acceptance
+       if(iFlag&(1<<1)) ff = AddTaskFragmentationFunction("jets", "AODMC2b", "AODMCb", "AODMCb", filterMask);
+        // kine tracks in acceptance, pythia jets in acceptance
+       if(iFlag&(1<<2)) ff = AddTaskFragmentationFunction("jets", "", "KINEb", "KINEb", filterMask);
+        // reconstructed charged tracks after cuts, MC jets in acceptance 
+       if(iFlag&(1<<3)) ff = AddTaskFragmentationFunction("jets", "AODMC2b", "AODMCb", "AOD2b", filterMask);
+       
+       return ff;
+}
+
+// _______________________________________________________________________________________
+
+AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(
+        const char* recJetsBranch,
+       const char* genJetsBranch,
+       const char* jetType,
+       const char* trackType,
+       UInt_t filterMask)
 {
-// Creates a jet fider task, configures it and adds it to the analysis manager.
+   // Creates a fragmentation function task,
+   // configures it and adds it to the analysis manager.
+
+   //******************************************************************************
+   //*** Configuration Parameter **************************************************
+   //******************************************************************************
+
+   // space for configuration parameter: histo bin, cuts, ...
+   // so far only default parameter used
+
+   Int_t debug = -1; // debug level, -1: not set here
 
+   //******************************************************************************
+
+
+   
    // Get the pointer to the existing analysis manager via the static access method.
    //==============================================================================
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    if (!mgr) {
-      ::Error("AddTaskFragmentationFunction", "No analysis manager to connect to.");
-      return NULL;
-   }  
+         ::Error("AddTaskFragmentationFunction", "No analysis manager to connect to.");
+         return NULL;
+   }
    
    // Check the analysis type using the event handlers connected to the analysis manager.
    //==============================================================================
    if (!mgr->GetInputEventHandler()) {
-      ::Error("AddTaskMyDyJets", "This task requires an input event handler");
-      return NULL;
+        ::Error("AddTaskFragmentationFunction", "This task requires an input event handler");
+         return NULL;
    }
 
+   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+   Printf("Data Type: %s", type.Data());
+
+   TString branchRecJets(recJetsBranch);
+   TString branchGenJets(genJetsBranch);
+   TString typeJets(jetType);
+   TString typeTracks(trackType);
+
+   if(branchRecJets.Length()==0) branchRecJets = "noRecJets";
+   if(branchGenJets.Length()==0) branchGenJets = "noGenJets";
+   if(typeTracks.Length()==0) typeTracks = "trackTypeUndef";
+   if(typeJets.Length()==0)   typeJets   = "jetTypeUndef";
+   
    // Create the task and configure it.
    //===========================================================================
+
+   AliAnalysisTaskFragmentationFunction *task = new AliAnalysisTaskFragmentationFunction(
+        Form("Fragmenation Function %s %s %s %s", branchRecJets.Data(), branchGenJets.Data(), typeJets.Data(), typeTracks.Data()));
+   
+   if(debug>=0) task->SetDebugLevel(debug);
    
-   AliAnalysisTaskFragmentationFunction* pwg4dijets = new  AliAnalysisTaskFragmentationFunction("Fragmentation Function Study");
-      
-   pwg4dijets->SetBranchGen("jetsMC"); 
-   pwg4dijets->SetBranchRec("jets"); 
-   //   pwg4dijets->SetBranchRec("jetsUA1AOD");
-   pwg4dijets->SetLimitGenJetEta(0);
-   pwg4dijets->SetFilterMask(filterMask); 
-    if(iPhysicsSelection) pwg4dijets->SelectCollisionCandidates();
-   mgr->AddTask(pwg4dijets);
+   Printf("Rec Jets %s", branchRecJets.Data());
+   Printf("Gen Jets %s", branchGenJets.Data());
+   Printf("Jet Type %s", typeJets.Data());
+   Printf("Track Type %s", typeTracks.Data());
    
+   if(!branchRecJets.Contains("noRecJets")) task->SetBranchRecJets(branchRecJets);
+   if(!branchGenJets.Contains("noGenJets")) task->SetBranchGenJets(branchGenJets);
 
 
+   if(typeTracks.Contains("AODMC2b"))      task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCChargedAcceptance);
+   else if(typeTracks.Contains("AODMC2"))  task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCCharged);
+   else if(typeTracks.Contains("AODMC"))   task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODMCAll);
+   else if(typeTracks.Contains("KINE2b"))  task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineChargedAcceptance);
+   else if(typeTracks.Contains("KINE2"))   task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineCharged);
+   else if(typeTracks.Contains("KINE"))    task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackKineAll);
+   else if(typeTracks.Contains("AODb"))    task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAODCuts);
+   else if(typeTracks.Contains("AOD"))     task->SetTrackTypeGen(AliAnalysisTaskFragmentationFunction::kTrackAOD);
+   else if(typeTracks.Contains("trackTypeUndef")) task->SetTrackTypeGen(0); // undefined
+   else Printf("trackType %s not found", typeTracks.Data());
+
+   if(typeJets.Contains("AODMCb"))         task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGenAcceptance);
+   else if(typeJets.Contains("AODMC"))     task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsGen);
+   else if(typeJets.Contains("KINEb"))     task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKineAcceptance);
+   else if(typeJets.Contains("KINE"))      task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsKine);
+   else if(typeJets.Contains("AODb"))      task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRecAcceptance);
+   else if(typeJets.Contains("AOD"))       task->SetJetTypeGen(AliAnalysisTaskFragmentationFunction::kJetsRec);
+   else if(typeJets.Contains("jetTypeUndef")) task->SetJetTypeGen(0); // undefined
+   else Printf("jetType %s not found", typeJets.Data());
+   
+   task->SetFilterMask(filterMask);
+  
+   // set default parameter 
+   task->SetTrackCuts();       // default : pt > 0.150 GeV, |eta|<0.9, full phi acc
+   task->SetJetCuts();         // default: jet pt > 5 GeV, |eta|<0.5, full phi acc
+   task->SetDijetCuts();       // default: to be defined
+   task->SetFFRadius();        // default: R = 0.4
+   
+   task->SetHighPtThreshold(); // default: pt > 5 Gev
+   task->SetFFHistoBins();
+   task->SetQAJetHistoBins();
+   task->SetQATrackHistoBins();
+
+   mgr->AddTask(task);
 
-      
    // Create ONLY the output containers for the data produced by the task.
    // Get and connect other common input/output containers via the manager as below
    //==============================================================================
-   AliAnalysisDataContainer *coutput1_FF = mgr->CreateContainer("PWG4_FF", TList::Class(),AliAnalysisManager::kOutputContainer,"PWG4_FF.root");
 
-   mgr->ConnectInput  (pwg4dijets, 0, mgr->GetCommonInputContainer());
-   mgr->ConnectOutput (pwg4dijets, 0, mgr->GetCommonOutputContainer());
-   mgr->ConnectOutput (pwg4dijets,  1, coutput1_FF );
+   AliAnalysisDataContainer *coutput_FragFunc = mgr->CreateContainer(
+      Form("fracfunc_%s_%s_%s_%s", branchRecJets.Data(), branchGenJets.Data(), typeTracks.Data(), typeJets.Data()),
+      TList::Class(),
+      AliAnalysisManager::kOutputContainer,
+      Form("%s:PWG4_FragmentationFunction_%s_%s_%s_%s", 
+         AliAnalysisManager::GetCommonFileName(), branchRecJets.Data(), branchGenJets. Data(), typeTracks.Data(), typeJets.Data()));
+
+   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
+   mgr->ConnectOutput (task, 1, coutput_FragFunc);
    
-   return pwg4dijets;
+   return task;
 }