]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskChargedJetsPA.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskChargedJetsPA.cxx
index 67bf3c3f68f9e4eb283c246cfa472fe8ee85d932..61c5e98eca40c3db07ac9536f76569e45d5e8fc2 100644 (file)
@@ -64,24 +64,30 @@ void AliAnalysisTaskChargedJetsPA::Init()
 
   SetCurrentOutputList(0);
 
-  // Cuts
-  TH1D* tmpHisto = AddHistogram1D<TH1D>("hNumberEvents", "Number of events (0 = before cuts, 1 = after cuts)", "", 2, 0, 2, "stage","N^{Events}/cut");
-  tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
-  tmpHisto->GetXaxis()->SetBinLabel(2, "After cuts");
-  tmpHisto = AddHistogram1D<TH1D>("hEventAcceptance", "Accepted events (0 = before cuts, 1 = after pile up, 2 = after vertex)", "", 3, 0, 3, "stage","N^{Events}/cut");
-  tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
-  tmpHisto->GetXaxis()->SetBinLabel(2, "After pile up");
-  tmpHisto->GetXaxis()->SetBinLabel(3, "After vertex");
+  TH1* tmpHisto = AddHistogram1D<TH1D>("hVertexAcceptance", "Accepted vertices for different conditions", "", 4, 0, 4, "stage","N^{Events}/cut");
+  tmpHisto->GetXaxis()->SetBinLabel(1, "Triggered all");
+  tmpHisto->GetXaxis()->SetBinLabel(2, "Triggered w/ vertex");
+  tmpHisto->GetXaxis()->SetBinLabel(3, "Pile-up corrected all");
+  tmpHisto->GetXaxis()->SetBinLabel(4, "Pile-up corrected w vertex");
+
+  TH2* tmpHisto2D = AddHistogram2D<TH2D>("hCentrality", Form("Accepted events in centrality (%s)", fCentralityType.Data()), "COLZ", 102, 0., 102., 4, 0,4,"Centrality","Cut stage","dN^{Events}");
+  tmpHisto2D->GetYaxis()->SetBinLabel(1, "Before cuts");
+  tmpHisto2D->GetYaxis()->SetBinLabel(2, "After pile up");
+  tmpHisto2D->GetYaxis()->SetBinLabel(3, "After vertex demand");
+  tmpHisto2D->GetYaxis()->SetBinLabel(4, "After vertex cuts");
+
   tmpHisto = AddHistogram1D<TH1D>("hTrackAcceptance", "Accepted tracks (0 = before cuts, 1 = after eta, 2 = after pT)", "", 3, 0, 3, "stage","N^{Tracks}/cut");
   tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
   tmpHisto->GetXaxis()->SetBinLabel(2, "After eta");
   tmpHisto->GetXaxis()->SetBinLabel(3, "After p_{T}");
+
   tmpHisto = AddHistogram1D<TH1D>("hJetAcceptance", "Accepted jets (0 = before cuts, 1 = after eta, 2 = after pT, 3 = after area)", "", 4, 0, 4, "stage","N^{Jets}/cut");
   tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
   tmpHisto->GetXaxis()->SetBinLabel(2, "After eta");
   tmpHisto->GetXaxis()->SetBinLabel(3, "After p_{T}");
   tmpHisto->GetXaxis()->SetBinLabel(4, "After area");
-  TH2* tmpHisto2D = AddHistogram2D<TH2D>("hJetPtCutStages", "Jets p_{T} distribution", "", 500, -50., 200., 4, 0, 4, "p_{T} (GeV/c)","Cut stage","dN^{Jets}/dp_{T}");
+
+  tmpHisto2D = AddHistogram2D<TH2D>("hJetPtCutStages", "Jets p_{T} distribution", "", 500, -50., 200., 4, 0, 4, "p_{T} (GeV/c)","Cut stage","dN^{Jets}/dp_{T}");
   tmpHisto2D->GetYaxis()->SetBinLabel(1, "Before cuts");
   tmpHisto2D->GetYaxis()->SetBinLabel(2, "After eta");
   tmpHisto2D->GetYaxis()->SetBinLabel(3, "After p_{T}");
@@ -90,18 +96,18 @@ void AliAnalysisTaskChargedJetsPA::Init()
   AddHistogram1D<TH1D>("hVertexX", "X distribution of the vertex", "", 2000, -1., 1., "#Delta x(cm)","dN^{Events}/dx");
   AddHistogram1D<TH1D>("hVertexY", "Y distribution of the vertex", "", 2000, -1., 1., "#Delta y(cm)","dN^{Events}/dy");
   AddHistogram2D<TH2D>("hVertexXY", "XY distribution of the vertex", "COLZ", 500, -1., 1., 500, -1., 1.,"#Delta x(cm)", "#Delta y(cm)","dN^{Events}/dxdy");
-  AddHistogram1D<TH1D>("hVertexZBeforeVertexCut", "Z distribution of the vertex (before std. vertex cut)", "", 200, -20., 20., "#Delta z(cm)","dN^{Events}/dz");
-  AddHistogram1D<TH1D>("hVertexZAfterVertexCut", "Z distribution of the vertex (after std. vertex cut)", "", 200, -20., 20., "#Delta z(cm)","dN^{Events}/dz");
+  AddHistogram1D<TH1D>("hVertexZ", "Z distribution of the vertex (after std. vertex cut)", "", 200, -20., 20., "#Delta z(cm)","dN^{Events}/dz");
   AddHistogram1D<TH1D>("hVertexR", "R distribution of the vertex", "", 100, 0., 1., "#Delta r(cm)","dN^{Events}/dr");
   AddHistogram1D<TH1D>("hCentralityV0M", "Centrality distribution V0M", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
+  AddHistogram1D<TH1D>("hCentralityCL1", "Centrality distribution CL1", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
   AddHistogram1D<TH1D>("hCentralityV0A", "Centrality distribution V0A", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
   AddHistogram1D<TH1D>("hCentralityV0C", "Centrality distribution V0C", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
   AddHistogram1D<TH1D>("hCentralityZNA", "Centrality distribution ZNA", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
-  AddHistogram1D<TH1D>("hCentrality", Form("Centrality distribution %s", fCentralityType.Data()), "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
 
   if(fDoJetAnalysis)
   {
     // Background corrected jet spectra
+    AddHistogram2D<TH2D>("hJetPtNoBgrdSubtracted", "Jets p_{T} distribution, no bgrd. subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");    
     AddHistogram2D<TH2D>("hJetPtBgrdSubtractedExternal", "Jets p_{T} distribution, external bgrd. subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");    
     AddHistogram2D<TH2D>("hJetPtBgrdSubtractedPP", "Jets p_{T} distribution, pp background subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
     AddHistogram2D<TH2D>("hJetPtBgrdSubtractedExternal_Phi1", "Jets p_{T} distribution, external background (Improved CMS) subtracted (1st part of azimuth)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");    
@@ -122,7 +128,14 @@ void AliAnalysisTaskChargedJetsPA::Init()
     AddHistogram2D<TProfile2D>("hJetPtSubtractedRhoPP", "Mean subtracted KT (pp from Michal) background from jets", "COLZ", 600, 0, 150, fNumberOfCentralityBins, 0, 100, "Jet p_{T}", "Centrality", "#rho mean");
 
     // Jet QA plots
-    AddHistogram2D<TH2D>("hJetConstituentPt", "Jet constituents p_{T} distribution", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt0GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 0 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt1GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 1 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt2GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 2 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt3GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 3 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt4GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 4 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt5GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 5 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt7GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 7 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
+    AddHistogram2D<TH2D>("hJetConstituentPt10GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 10 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
     AddHistogram2D<TH2D>("hJetConstituentPtVsJetPt", "Jet constituents p_{T} distribution", "", 500, -50., 200., 200, 0, 200, "#it{p}_{T} (GeV/c)","#it{p}_{T}^{jet} (GeV/c)","dN^{Tracks}/dp_{T}");
     AddHistogram1D<TH1D>("hJetCountAll", "Number of Jets", "", 200, 0., 200., "N jets","dN^{Events}/dN^{Jets}");
     AddHistogram1D<TH1D>("hJetCountAccepted", "Number of accepted Jets", "", 200, 0., 200., "N jets","dN^{Events}/dN^{Jets}");
@@ -135,7 +148,9 @@ void AliAnalysisTaskChargedJetsPA::Init()
     AddHistogram1D<TH1D>("hLeadingJetDeltaPhi", "1st and 2nd leading jet #Delta #phi", "", 250, 0., TMath::Pi(), "#Delta #phi","dN^{Jets}/d(#Delta #phi)");
 
     // Background distributions
+
     AddHistogram2D<TH2D>("hKTBackgroundExternal", "KT background density (External task)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
+    AddHistogram2D<TH2D>("hKTBackgroundExternalVsPt", "KT background density (External task)", "LEGO2", 400, 0., 40., 200, 0, 200, "#rho (GeV/c)","Raw jet p_{T}", "dN^{Events}/d#rho");
     AddHistogram2D<TH2D>("hKTBackgroundExternal20GeV", "KT background density (External task, jet p_{T} > 20 GeV)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
     AddHistogram2D<TH2D>("hKTBackgroundImprovedCMS", "KT background density (Improved CMS approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
     AddHistogram2D<TH2D>("hPPBackground", "PP background density (Michals approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
@@ -152,10 +167,11 @@ void AliAnalysisTaskChargedJetsPA::Init()
     AddHistogram2D<TH2D>("hTRBackgroundExact",  "TR background density (signal jets exactly excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
 
     // Delta pt distributions
+    AddHistogram2D<TH2D>("hDeltaPtPP", "Background fluctuations #delta p_{T} (PP approach)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtExternalBgrd", "Background fluctuations #delta p_{T} (KT, External)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtExternalBgrdVsPt", "Background fluctuations #delta p_{T} (KT, External, in p_{T} bins)", "", 1801, -40.0, 80.0, 200, 0, 200, "#delta p_{T} (GeV/c)","Raw jet p_{T}","dN^{Jets}/d#delta p_{T}");
+    AddHistogram2D<TH2D>("hDeltaPtExternalBgrdPartialExclusion", "Background fluctuations #delta p_{T} (KT, External, partial jet exclusion)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtKTImprovedCMS", "Background fluctuations #delta p_{T} (KT, Improved CMS-like)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
-    AddHistogram2D<TH2D>("hDeltaPtKTImprovedCMSFullExclusion", "Background fluctuations #delta p_{T} (KT, Improved CMS-like, full leading jet exclusion)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtNoBackground", "Background fluctuations #delta p_{T} (No background)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtKTPbPb", "Background fluctuations #delta p_{T} (KT, PbPb w/o ghosts)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
     AddHistogram2D<TH2D>("hDeltaPtKTPbPbWithGhosts", "Background fluctuations #delta p_{T} (KT, PbPb w/ ghosts)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
@@ -299,7 +315,7 @@ void AliAnalysisTaskChargedJetsPA::Init()
 }
 
 //________________________________________________________________________
-AliAnalysisTaskChargedJetsPA::AliAnalysisTaskChargedJetsPA(const char *name, const char* trackArrayName, const char* jetArrayName, const char* backgroundJetArrayName, Bool_t analyzeJetProfile, Bool_t analyzeTrackcuts) : AliAnalysisTaskSE(name), fOutputLists(), fCurrentOutputList(0), fDoJetAnalysis(1), fAnalyzeJetProfile(0), fAnalyzeTrackcuts(0), fAnalyzeJetConstituents(1), fParticleLevel(0), fUseDefaultVertexCut(1), fUsePileUpCut(1), fSetCentralityToOne(0), fNoExternalBackground(0), fBackgroundForJetProfile(0), fPartialAnalysisNParts(1), fPartialAnalysisIndex(0), fJetArray(0), fTrackArray(0), fBackgroundJetArray(0), fJetArrayName(), fTrackArrayName(), fBackgroundJetArrayName(), fRhoTaskName(), fRandConeRadius(0.4), fSignalJetRadius(0.4), fBackgroundJetRadius(0.4), fNumberExcludedJets(-1), fMinEta(-0.9), fMaxEta(0.9), fMinJetEta(-0.5), fMaxJetEta(0.5), fMinTrackPt(0.150), fMinJetPt(5.0), fMinJetArea(0.5), fMinBackgroundJetPt(0.0), fMinNCrossedRows(70), fUsePtDepCrossedRowsCut(0), fNumberOfCentralityBins(20), fCentralityType("V0A"), fMatchTr(), fMatchChi(), fPrimaryVertex(0), fFirstLeadingJet(0), fSecondLeadingJet(0), fFirstLeadingKTJet(0), fSecondLeadingKTJet(0), fNumberSignalJets(0), fNumberSignalJetsAbove5GeV(0), fRandom(0), fHelperClass(0), fInitialized(0), fTaskInstanceCounter(0), fIsDEBUG(0), fIsPA(1), fNoTerminate(1), fEventCounter(0), fHybridESDtrackCuts(0), fHybridESDtrackCuts_variedPtDep(0), fHybridESDtrackCuts_variedPtDep2(0)
+AliAnalysisTaskChargedJetsPA::AliAnalysisTaskChargedJetsPA(const char *name, const char* trackArrayName, const char* jetArrayName, const char* backgroundJetArrayName, Bool_t analyzeJetProfile, Bool_t analyzeTrackcuts) : AliAnalysisTaskSE(name), fOutputLists(), fCurrentOutputList(0), fDoJetAnalysis(1), fAnalyzeJetProfile(0), fAnalyzeTrackcuts(0), fAnalyzeJetConstituents(1), fParticleLevel(0), fUseDefaultVertexCut(1), fUsePileUpCut(1), fSetCentralityToOne(0), fNoExternalBackground(0), fBackgroundForJetProfile(0), fPartialAnalysisNParts(1), fPartialAnalysisIndex(0), fJetArray(0), fTrackArray(0), fBackgroundJetArray(0), fJetArrayName(), fTrackArrayName(), fBackgroundJetArrayName(), fRhoTaskName(), fRandConeRadius(0.4), fRandConeNumber(10), fSignalJetRadius(0.4), fBackgroundJetRadius(0.4), fNumberExcludedJets(-1), fMinEta(-0.9), fMaxEta(0.9), fMinJetEta(-0.5), fMaxJetEta(0.5), fMinTrackPt(0.150), fMinJetPt(5.0), fMinJetArea(0.5), fMinBackgroundJetPt(0.0), fMinNCrossedRows(70), fUsePtDepCrossedRowsCut(0), fNumberOfCentralityBins(20), fCentralityType("V0A"), fMatchTr(), fMatchChi(), fPrimaryVertex(0), fFirstLeadingJet(0), fSecondLeadingJet(0), fFirstLeadingKTJet(0), fSecondLeadingKTJet(0), fNumberSignalJets(0), fNumberSignalJetsAbove5GeV(0), fRandom(0), fHelperClass(0), fInitialized(0), fTaskInstanceCounter(0), fIsDEBUG(0), fIsPA(1), fNoTerminate(1), fEventCounter(0), fTempExcludedRCs(0), fTempAllRCs(1), fTempOverlapCounter(0), fTempMeanExclusionProbability(0), fHybridESDtrackCuts(0), fHybridESDtrackCuts_variedPtDep(0), fHybridESDtrackCuts_variedPtDep2(0)
 {
   #ifdef DEBUGMODE
     AliInfo("Calling constructor.");
@@ -1009,32 +1025,74 @@ inline Bool_t AliAnalysisTaskChargedJetsPA::IsEventInAcceptance(AliVEvent* event
   if (!event)
     return kFALSE;
 
-  FillHistogram("hEventAcceptance", 0.5); // number of events before manual cuts
-  if(fUsePileUpCut)
-    if(fHelperClass->IsPileUpEvent(event))
-      return kFALSE;
-
-  FillHistogram("hEventAcceptance", 1.5); // number of events after pileup cuts
-
   fPrimaryVertex = event->GetPrimaryVertex();
 
-  FillHistogram("hVertexZBeforeVertexCut",fPrimaryVertex->GetZ());
+  // ### Create plot for vertex acceptance
+  fHelperClass->SetMaxVtxZ(10000.);
 
+  // Check vertex existance
+  Bool_t hasVertex = kFALSE;
   if(fUseDefaultVertexCut)
   {
-    if(!fHelperClass->IsVertexSelected2013pA(event))
-      return kFALSE;
+    if(fHelperClass->IsVertexSelected2013pA(event))
+      hasVertex = kTRUE;
+  }
+  else
+  {
+    if(!fPrimaryVertex || (fPrimaryVertex->GetNContributors()<2) || (TMath::Sqrt(fPrimaryVertex->GetX()*fPrimaryVertex->GetX() + fPrimaryVertex->GetY()*fPrimaryVertex->GetY()) > 1.0)) 
+      hasVertex = kTRUE;
   }
-  else // Failsafe vertex cut
+
+  // All triggered events
+  FillHistogram("hVertexAcceptance", 0.5); // all triggered events all
+  if(hasVertex)
+    FillHistogram("hVertexAcceptance", 1.5); // all triggered events w/ vertex
+
+  // Pile-up corrected events
+  if(!fHelperClass->IsPileUpEvent(event))
   {
-    if(!fPrimaryVertex || (TMath::Abs(fPrimaryVertex->GetZ()) > 10.0) || (fPrimaryVertex->GetNContributors()<1)) 
-      return kFALSE;
+    FillHistogram("hVertexAcceptance", 2.5); // pile-up corr. events all
+    if(hasVertex)
+      FillHistogram("hVertexAcceptance", 3.5); // pile-up corr. events w/ vertex
   }
 
+  fHelperClass->SetMaxVtxZ(10.);
+
+  // ### Get centrality values
+  AliCentrality* tmpCentrality = event->GetCentrality();
+  Double_t centralityPercentile = -1.0;
+  if (tmpCentrality != NULL)
+    centralityPercentile = tmpCentrality->GetCentralityPercentile(fCentralityType.Data());
+  FillHistogram("hCentrality",centralityPercentile);
+
+  if(fSetCentralityToOne)
+    centralityPercentile = 1.0;
+
+  if((centralityPercentile < 0.0) || (centralityPercentile > 101.0))
+    AliWarning(Form("Centrality value not valid (c=%E)",centralityPercentile)); 
+
+  FillHistogram("hCentrality", centralityPercentile, 0.5); // before any cuts
+
+  // ### CUT STAGE 1: Pile-up events (only holds for pPb)
+  if(fUsePileUpCut)
+    if(fHelperClass->IsPileUpEvent(event))
+      return kFALSE;
+
+  FillHistogram("hCentrality", centralityPercentile, 1.5); // after pileup cut
 
-  FillHistogram("hVertexZAfterVertexCut",fPrimaryVertex->GetZ());
+  // ### CUT STAGE 2: Existence of primary vertex
 
-  FillHistogram("hEventAcceptance", 2.5); // number of events after vertex cut
+  if(!hasVertex)
+    return kFALSE; 
+
+  FillHistogram("hVertexZ",fPrimaryVertex->GetZ());
+  FillHistogram("hCentrality", centralityPercentile, 2.5); // after vertex existance cut
+
+  // ### CUT STAGE 3: Position of primary vertex
+  if((TMath::Abs(fPrimaryVertex->GetZ()) > 10.0))
+    return kFALSE;
+
+  FillHistogram("hCentrality", centralityPercentile, 3.5); // after vertex position cut
 
   return kTRUE;
 }
@@ -1372,7 +1430,7 @@ Double_t AliAnalysisTaskChargedJetsPA::GetCorrectedJetPt(AliEmcalJet* jet, Doubl
 
 
 //________________________________________________________________________
-Double_t AliAnalysisTaskChargedJetsPA::GetDeltaPt(Double_t rho, Double_t leadingJetExclusionProbability)
+Double_t AliAnalysisTaskChargedJetsPA::GetDeltaPt(Double_t rho, Double_t overlappingJetExclusionProbability)
 {
   #ifdef DEBUGMODE
     AliInfo("Getting Delta Pt.");
@@ -1381,6 +1439,9 @@ Double_t AliAnalysisTaskChargedJetsPA::GetDeltaPt(Double_t rho, Double_t leading
   // Define an invalid delta pt
   Double_t deltaPt = -10000.0;
 
+  // Define the ratio of excluded RCs over all RCs
+  Double_t ratioExcludedRCs = static_cast<Double_t>(fTempExcludedRCs)/fTempAllRCs;
+
   // Define eta range
   Double_t etaMin, etaMax;
   etaMin = fMinEta+fRandConeRadius;
@@ -1391,39 +1452,36 @@ Double_t AliAnalysisTaskChargedJetsPA::GetDeltaPt(Double_t rho, Double_t leading
   Double_t tmpRandConeEta = etaMin + fRandom->Rndm()*(etaMax-etaMin);
   Double_t tmpRandConePhi = fRandom->Rndm()*TMath::TwoPi();
 
-  // if there is a jet, check for overlap if demanded
-  if(leadingJetExclusionProbability)
+  // Check if a signal jet is overlapping with random cone
+  if(overlappingJetExclusionProbability)
   {
-    AliEmcalJet* tmpLeading = dynamic_cast<AliEmcalJet*>(fJetArray->At(0));
-    // Get leading jet (regardless of pT)
-    for (Int_t i = 1; i<fJetArray->GetEntries(); i++)
+    // Calculate the mean exclusion probability
+    fTempOverlapCounter++;
+    fTempMeanExclusionProbability += overlappingJetExclusionProbability;
+    // For all jets, check overlap
+    for (Int_t i = 0; i<fJetArray->GetEntries(); i++)
     {
       AliEmcalJet* tmpJet = static_cast<AliEmcalJet*>(fJetArray->At(i));
-      // if jet is in acceptance and higher, take as new leading
-      if (tmpJet)
-        if ( ((tmpJet->Eta() >= fMinJetEta) && (tmpJet->Eta() < fMaxJetEta)) && (tmpJet->Area() >= fMinJetArea))
-          if((!tmpLeading) || (tmpJet->Pt() > tmpLeading->Pt()))
-            tmpLeading = tmpJet;
-    }
-    if(tmpLeading)
-    {
-      Double_t excludedJetPhi = tmpLeading->Phi();
-      Double_t excludedJetEta = tmpLeading->Eta();
-      Double_t tmpDeltaPhi = GetDeltaPhi(tmpRandConePhi, excludedJetPhi);
+      if (!IsSignalJetInAcceptance(tmpJet, kTRUE)) continue;
 
-      // Check, if cone has overlap with jet
-      if ( tmpDeltaPhi*tmpDeltaPhi + TMath::Abs(tmpRandConeEta-excludedJetEta)*TMath::Abs(tmpRandConeEta-excludedJetEta) <= fRandConeRadius*fRandConeRadius)
+      // Check overlap
+      Double_t tmpDeltaPhi = GetDeltaPhi(tmpRandConePhi, tmpJet->Phi());
+      if ( tmpDeltaPhi*tmpDeltaPhi + (tmpRandConeEta-tmpJet->Eta())*(tmpRandConeEta-tmpJet->Eta()) <= fRandConeRadius*fRandConeRadius )
       {
-        // Define probability to exclude the RC
-        Double_t probability = leadingJetExclusionProbability;
-
-        // Only exclude cone with a given probability
-        if (fRandom->Rndm()<=probability)
+        fTempAllRCs++;
+        // If an overlap is given, discard or accept it according to the exclusion prob. 
+        if(ratioExcludedRCs < fTempMeanExclusionProbability/fTempOverlapCounter) // to few RCs excluded -> exclude this one
+        {
           coneValid = kFALSE;
+          fTempExcludedRCs++;
+        }
+        else  // to many RCs excluded -> take this one
+          coneValid = kTRUE;
       }
     }
   }
 
+
   // Get the cones' pt and calculate delta pt
   if (coneValid)
     deltaPt = GetConePt(tmpRandConeEta,tmpRandConePhi,fRandConeRadius) - (rho*fRandConeRadius*fRandConeRadius*TMath::Pi());
@@ -1778,13 +1836,9 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
   if((fEventCounter+fPartialAnalysisIndex) % fPartialAnalysisNParts != 0)
     return;
 
-  FillHistogram("hNumberEvents",0.5);
-
   if(!IsEventInAcceptance(event))
     return;
 
-  FillHistogram("hNumberEvents",1.5);
-
   #ifdef DEBUGMODE
     AliInfo("Calculate()::Init done.");
   #endif
@@ -1797,25 +1851,23 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
   ////////////////////// NOTE: Get Centrality, (Leading)Signal jets and Background
 
   // Get centrality
-  AliCentrality* tmpCentrality = NULL;
-  tmpCentrality = event->GetCentrality();
+  AliCentrality* tmpCentrality = event->GetCentrality();
   Double_t centralityPercentile = -1.0;
+  Double_t centralityPercentileCL1 = 0.0;
   Double_t centralityPercentileV0A = 0.0;
   Double_t centralityPercentileV0C = 0.0;
   Double_t centralityPercentileV0M = 0.0;
   Double_t centralityPercentileZNA = 0.0;
   if (tmpCentrality != NULL)
   {
-    centralityPercentile = tmpCentrality->GetCentralityPercentile(fCentralityType.Data());
+    centralityPercentile    = tmpCentrality->GetCentralityPercentile(fCentralityType.Data());
+    centralityPercentileCL1 = tmpCentrality->GetCentralityPercentile("CL1");
     centralityPercentileV0A = tmpCentrality->GetCentralityPercentile("V0A");
     centralityPercentileV0C = tmpCentrality->GetCentralityPercentile("V0C");
     centralityPercentileV0M = tmpCentrality->GetCentralityPercentile("V0M");
     centralityPercentileZNA = tmpCentrality->GetCentralityPercentile("ZNA");
   }
 
-  if((centralityPercentile < 0.0) || (centralityPercentile > 100.0))
-    AliWarning(Form("Centrality value not valid (c=%E)",centralityPercentile)); 
-
   if(fSetCentralityToOne)
     centralityPercentile = 1.0;
 
@@ -1825,11 +1877,11 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
   FillHistogram("hVertexY",fPrimaryVertex->GetY());
   FillHistogram("hVertexXY",fPrimaryVertex->GetX(), fPrimaryVertex->GetY());
   FillHistogram("hVertexR",TMath::Sqrt(fPrimaryVertex->GetX()*fPrimaryVertex->GetX() + fPrimaryVertex->GetY()*fPrimaryVertex->GetY()));
+  FillHistogram("hCentralityCL1",centralityPercentileCL1);
   FillHistogram("hCentralityV0M",centralityPercentileV0M);
   FillHistogram("hCentralityV0A",centralityPercentileV0A);
   FillHistogram("hCentralityV0C",centralityPercentileV0C);
   FillHistogram("hCentralityZNA",centralityPercentileZNA);
-  FillHistogram("hCentrality",centralityPercentile);
 
   if(!fDoJetAnalysis)
     return;
@@ -1984,6 +2036,7 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
     if(IsSignalJetInAcceptance(tmpJet))
     {
       // Background corrected jet spectra
+      FillHistogram("hJetPtNoBgrdSubtracted", GetCorrectedJetPt(tmpJet, 0.0), centralityPercentile);
       FillHistogram("hJetPtBgrdSubtractedExternal", GetCorrectedJetPt(tmpJet, backgroundExternal), centralityPercentile);
       FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
       FillHistogram("hJetPtBgrdSubtractedPP", GetCorrectedJetPt(tmpJet, backgroundPP), centralityPercentile);
@@ -2001,7 +2054,9 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
       FillHistogram("hJetPtSubtractedRhoExternal", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundExternal));
       FillHistogram("hJetPtSubtractedRhoKTImprovedCMS", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS));
       FillHistogram("hJetPtSubtractedRhoPP", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundPP));
-      FillHistogram("hDeltaPtExternalBgrdVsPt", GetDeltaPt(backgroundExternal), GetCorrectedJetPt(tmpJet, backgroundExternal));
+      for(Int_t j=0; j<fRandConeNumber; j++)
+        FillHistogram("hDeltaPtExternalBgrdVsPt", GetDeltaPt(backgroundExternal), GetCorrectedJetPt(tmpJet, backgroundExternal));
+      FillHistogram("hKTBackgroundExternalVsPt", backgroundExternal, GetCorrectedJetPt(tmpJet, backgroundExternal));
 
       // ###### CONSTITUENT ANALYSIS
 
@@ -2057,13 +2112,34 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
       else if(leadingTrackPt >= 2)
         FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS_Biased_2GeV", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
 
+
+      // Fill jet constituent histograms
+      for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
+      {
+        FillHistogram("hJetConstituentPt0GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 1.0)
+          FillHistogram("hJetConstituentPt1GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 2.0)
+          FillHistogram("hJetConstituentPt2GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 3.0)
+          FillHistogram("hJetConstituentPt3GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 4.0)
+          FillHistogram("hJetConstituentPt4GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 5.0)
+          FillHistogram("hJetConstituentPt5GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 7.0)
+          FillHistogram("hJetConstituentPt7GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+        if(tmpJet->Pt() >= 10.0)
+          FillHistogram("hJetConstituentPt10GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+      }
+
       if(tmpJet->Pt() >= 5.0)
       {
         Double_t lowestTrackPt = 1e99;
         Double_t highestTrackPt = 0.0;
         for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
         {
-          FillHistogram("hJetConstituentPt", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
+//          FillHistogram("hJetConstituentPt", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
           // Find the lowest pT of a track in the jet
           if (tmpJet->TrackAt(j, fTrackArray)->Pt() < lowestTrackPt)
             lowestTrackPt = tmpJet->TrackAt(j, fTrackArray)->Pt();
@@ -2121,50 +2197,60 @@ void AliAnalysisTaskChargedJetsPA::Calculate(AliVEvent* event)
   FillHistogram("hTRBackgroundExact", backgroundTRExact, centralityPercentile);
 
   // Calculate the delta pt
-  Double_t tmpDeltaPtNoBackground = GetDeltaPt(0.0);
-  Double_t tmpDeltaPtExternalBgrd = GetDeltaPt(backgroundExternal);
-  Double_t tmpDeltaPtKTImprovedCMS = GetDeltaPt(backgroundKTImprovedCMS);
-  Double_t tmpDeltaPtKTImprovedCMSFullExclusion = GetDeltaPt(backgroundKTImprovedCMS, 1.0);
-
-  Double_t tmpDeltaPtKTPbPb = 0;
-  Double_t tmpDeltaPtKTPbPbWithGhosts = 0;
-  Double_t tmpDeltaPtKTCMS = 0;
-  Double_t tmpDeltaPtKTMean = 0;
-  Double_t tmpDeltaPtKTTrackLike = 0;
-  Double_t tmpDeltaPtTR = 0;
-
-  tmpDeltaPtKTPbPb = GetDeltaPt(backgroundKTPbPb);
-  tmpDeltaPtKTPbPbWithGhosts = GetDeltaPt(backgroundKTPbPbWithGhosts);
-  tmpDeltaPtKTCMS = GetDeltaPt(backgroundKTCMS);
-  tmpDeltaPtKTMean = GetDeltaPt(backgroundKTMean);
-  tmpDeltaPtKTTrackLike = GetDeltaPt(backgroundKTTrackLike);
-  tmpDeltaPtTR = GetDeltaPt(backgroundTRCone06);
-
-
-  // If valid, fill the delta pt histograms
-
-  if(tmpDeltaPtExternalBgrd > -10000.0)
-    FillHistogram("hDeltaPtExternalBgrd", tmpDeltaPtExternalBgrd, centralityPercentile);
-  if(tmpDeltaPtKTImprovedCMS > -10000.0)
-    FillHistogram("hDeltaPtKTImprovedCMS", tmpDeltaPtKTImprovedCMS, centralityPercentile);
-  if(tmpDeltaPtKTImprovedCMSFullExclusion > -10000.0)
-    FillHistogram("hDeltaPtKTImprovedCMSFullExclusion", tmpDeltaPtKTImprovedCMSFullExclusion, centralityPercentile);
-
-  if(tmpDeltaPtNoBackground > -10000.0)
-    FillHistogram("hDeltaPtNoBackground", tmpDeltaPtNoBackground, centralityPercentile);
-
-  if(tmpDeltaPtKTPbPb > -10000.0)
-    FillHistogram("hDeltaPtKTPbPb", tmpDeltaPtKTPbPb, centralityPercentile);
-  if(tmpDeltaPtKTPbPbWithGhosts > -10000.0)
-    FillHistogram("hDeltaPtKTPbPbWithGhosts", tmpDeltaPtKTPbPbWithGhosts, centralityPercentile);
-  if(tmpDeltaPtKTCMS > -10000.0)
-    FillHistogram("hDeltaPtKTCMS", tmpDeltaPtKTCMS, centralityPercentile);
-  if(tmpDeltaPtKTMean > -10000.0)
-    FillHistogram("hDeltaPtKTMean", tmpDeltaPtKTMean, centralityPercentile);
-  if(tmpDeltaPtKTTrackLike > -10000.0)
-    FillHistogram("hDeltaPtKTTrackLike", tmpDeltaPtKTTrackLike, centralityPercentile);
-  if(tmpDeltaPtTR > -10000.0)
-    FillHistogram("hDeltaPtTR", tmpDeltaPtTR, centralityPercentile);
+  for(Int_t i=0; i<fRandConeNumber; i++)
+  {
+    Double_t tmpRatio =1./10.;
+    if(fNumberSignalJets)
+      tmpRatio =1./fNumberSignalJets;
+
+    Double_t tmpDeltaPtNoBackground = GetDeltaPt(0.0);
+    Double_t tmpDeltaPtExternalBgrd = GetDeltaPt(backgroundExternal);
+    Double_t tmpDeltaPtExternalBgrdPartialExclusion = GetDeltaPt(backgroundExternal, tmpRatio);
+    Double_t tmpDeltaPtPP = GetDeltaPt(backgroundPP);
+    Double_t tmpDeltaPtKTImprovedCMS = GetDeltaPt(backgroundKTImprovedCMS);
+
+    Double_t tmpDeltaPtKTPbPb = 0;
+    Double_t tmpDeltaPtKTPbPbWithGhosts = 0;
+    Double_t tmpDeltaPtKTCMS = 0;
+    Double_t tmpDeltaPtKTMean = 0;
+    Double_t tmpDeltaPtKTTrackLike = 0;
+    Double_t tmpDeltaPtTR = 0;
+
+    tmpDeltaPtKTPbPb = GetDeltaPt(backgroundKTPbPb);
+    tmpDeltaPtKTPbPbWithGhosts = GetDeltaPt(backgroundKTPbPbWithGhosts);
+    tmpDeltaPtKTCMS = GetDeltaPt(backgroundKTCMS);
+    tmpDeltaPtKTMean = GetDeltaPt(backgroundKTMean);
+    tmpDeltaPtKTTrackLike = GetDeltaPt(backgroundKTTrackLike);
+    tmpDeltaPtTR = GetDeltaPt(backgroundTRCone06);
+
+
+    // If valid, fill the delta pt histograms
+
+    if(tmpDeltaPtExternalBgrd > -10000.0)
+      FillHistogram("hDeltaPtExternalBgrd", tmpDeltaPtExternalBgrd, centralityPercentile);
+    if(tmpDeltaPtKTImprovedCMS > -10000.0)
+      FillHistogram("hDeltaPtKTImprovedCMS", tmpDeltaPtKTImprovedCMS, centralityPercentile);
+    if(tmpDeltaPtExternalBgrdPartialExclusion > -10000.0)
+      FillHistogram("hDeltaPtExternalBgrdPartialExclusion", tmpDeltaPtExternalBgrdPartialExclusion, centralityPercentile);
+    if(tmpDeltaPtPP > -10000.0)
+      FillHistogram("hDeltaPtPP", tmpDeltaPtPP, centralityPercentile);
+
+    if(tmpDeltaPtNoBackground > -10000.0)
+      FillHistogram("hDeltaPtNoBackground", tmpDeltaPtNoBackground, centralityPercentile);
+
+    if(tmpDeltaPtKTPbPb > -10000.0)
+      FillHistogram("hDeltaPtKTPbPb", tmpDeltaPtKTPbPb, centralityPercentile);
+    if(tmpDeltaPtKTPbPbWithGhosts > -10000.0)
+      FillHistogram("hDeltaPtKTPbPbWithGhosts", tmpDeltaPtKTPbPbWithGhosts, centralityPercentile);
+    if(tmpDeltaPtKTCMS > -10000.0)
+      FillHistogram("hDeltaPtKTCMS", tmpDeltaPtKTCMS, centralityPercentile);
+    if(tmpDeltaPtKTMean > -10000.0)
+      FillHistogram("hDeltaPtKTMean", tmpDeltaPtKTMean, centralityPercentile);
+    if(tmpDeltaPtKTTrackLike > -10000.0)
+      FillHistogram("hDeltaPtKTTrackLike", tmpDeltaPtKTTrackLike, centralityPercentile);
+    if(tmpDeltaPtTR > -10000.0)
+      FillHistogram("hDeltaPtTR", tmpDeltaPtTR, centralityPercentile);
+  }
 
   #ifdef DEBUGMODE
     AliInfo("Calculate()::Background done.");