]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/AliAnalysisTaskJetCore.cxx
select good quality high pt tracks via the filterbit
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskJetCore.cxx
index edc2451c42b95a7a289746539ed1ee24f5e9112b..09e8cc5f7124aea9554a1243351900152b52fa9f 100644 (file)
@@ -1,7 +1,8 @@
+
 // ******************************************
 // This task computes several jet observables like 
 // the fraction of energy in inner and outer coronnas,
-// the distance from track to jet axis and a 
+// jet-track correlations,triggered jet shapes and 
 // correlation strength distribution of particles inside jets.    
 // Author: lcunquei@cern.ch
 // *******************************************
@@ -26,7 +27,6 @@
 #include "TChain.h"
 #include "TTree.h"
 #include "TMath.h"
-#include "TH1I.h"
 #include "TH1F.h"
 #include "TH2F.h"
 #include "TH3F.h"
@@ -45,8 +45,8 @@
 #include "AliAnalysisHelperJetTasks.h"
 #include "AliInputEventHandler.h"
 #include "AliAODJetEventBackground.h"
+#include "AliAODMCParticle.h"
 #include "AliAnalysisTaskFastEmbedding.h"
-
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
 #include "AliAODJet.h"
@@ -58,17 +58,21 @@ ClassImp(AliAnalysisTaskJetCore)
 AliAnalysisTaskJetCore::AliAnalysisTaskJetCore() :
 AliAnalysisTaskSE(),
 fESD(0x0),
-fAOD(0x0),
+fAODIn(0x0),
+fAODOut(0x0),
 fAODExtension(0x0),
 fBackgroundBranch(""),
 fNonStdFile(""),
 fIsPbPb(kTRUE),
 fOfflineTrgMask(AliVEvent::kAny),
 fMinContribVtx(1),
-fVtxZMin(-8.),
-fVtxZMax(8.),
+fVtxZMin(-10.),
+fVtxZMax(10.),
 fEvtClassMin(0),
 fEvtClassMax(4),
+fFilterMask(0),
+fFilterMaskBestPt(16),
+fFilterType(2),
 fRadioFrac(0.2),
 fMinDist(0.1),
 fCentMin(0.),
@@ -76,8 +80,22 @@ fCentMax(100.),
 fNInputTracksMin(0),
 fNInputTracksMax(-1),
 fAngStructCloseTracks(0),
+fCheckMethods(0),
+fDoEventMixing(0), 
+fFlagPhiBkg(0),
+fFlagEtaBkg(0),
+fFlagJetHadron(0),
+fFlagRandom(0),
+fFlagOnlyRecoil(0),
+fTrackTypeRec(kTrackUndef),
+fRPAngle(0),
+fNRPBins(100),
 fJetEtaMin(-.5),
 fJetEtaMax(.5),
+fNevents(0),
+fTindex(0),
+fTrigBufferIndex(0),
+fCountAgain(0), 
 fJetPtMin(20.),
 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
 fJetPtFractionMin(0.5),
@@ -89,85 +107,18 @@ fkEvtClasses(12),
 fOutputList(0x0),
 fbEvent(kTRUE),
 fHistEvtSelection(0x0),
-fHistJetSelection(0x0),
-fh2JetSelection(0x0),
+fhnDeltaR(0x0),
+fhnMixedEvents(0x0),
 fh2JetCoreMethod1C10(0x0),
 fh2JetCoreMethod2C10(0x0),
-fh2JetCoreMethod3C10(0x0),
 fh2JetCoreMethod1C20(0x0),
 fh2JetCoreMethod2C20(0x0),
-fh2JetCoreMethod3C20(0x0),
 fh2JetCoreMethod1C30(0x0),
 fh2JetCoreMethod2C30(0x0),
-fh2JetCoreMethod3C30(0x0),
 fh2JetCoreMethod1C60(0x0),
 fh2JetCoreMethod2C60(0x0),
-fh2JetCoreMethod3C60(0x0),
-fh2SumPtInC10(0x0),
-fh2SumPtInC20(0x0),
-fh2SumPtInC30(0x0),
-fh2SumPtInC60(0x0),
-fh2SumPtOutC10(0x0),
-fh2SumPtOutC10b(0x0),
-fh2SumPtOutC20(0x0),
-fh2SumPtOutC30(0x0),
-fh2SumPtOutC60(0x0),
-fh2SumPtInC10bkg(0x0),
-fh2SumPtInC20bkg(0x0),
-fh2SumPtInC30bkg(0x0),
-fh2SumPtInC60bkg(0x0),
-fh2SumPtOutC10bkg(0x0),
-fh2SumPtOutC20bkg(0x0),
-fh2SumPtOutC30bkg(0x0),
-fh2SumPtOutC60bkg(0x0),
-fh2DeltaRC10pt1(0x0),
-fh2DeltaRC20pt1(0x0),
-fh2DeltaRC30pt1(0x0),
-fh2DeltaRC60pt1(0x0),  
-fh2DeltaRC10pt2(0x0),
-fh2DeltaRC20pt2(0x0),
-fh2DeltaRC30pt2(0x0),
-fh2DeltaRC60pt2(0x0),  
-fh2DeltaRC10pt3(0x0),
-fh2DeltaRC20pt3(0x0),
-fh2DeltaRC30pt3(0x0),
-fh2DeltaRC60pt3(0x0),  
-fh2DeltaRC10pt4(0x0),
-fh2DeltaRC20pt4(0x0),
-fh2DeltaRC30pt4(0x0),
-fh2DeltaRC60pt4(0x0),
-fh2DeltaEtaC10pt1(0x0),
-fh2DeltaEtaC20pt1(0x0),
-fh2DeltaEtaC30pt1(0x0),
-fh2DeltaEtaC60pt1(0x0),  
-fh2DeltaEtaC10pt2(0x0),
-fh2DeltaEtaC20pt2(0x0),
-fh2DeltaEtaC30pt2(0x0),
-fh2DeltaEtaC60pt2(0x0),  
-fh2DeltaEtaC10pt3(0x0),
-fh2DeltaEtaC20pt3(0x0),
-fh2DeltaEtaC30pt3(0x0),
-fh2DeltaEtaC60pt3(0x0),  
-fh2DeltaEtaC10pt4(0x0),
-fh2DeltaEtaC20pt4(0x0),
-fh2DeltaEtaC30pt4(0x0),
-fh2DeltaEtaC60pt4(0x0),
-fh2DeltaPhiC10pt1(0x0),
-fh2DeltaPhiC20pt1(0x0),
-fh2DeltaPhiC30pt1(0x0),
-fh2DeltaPhiC60pt1(0x0),  
-fh2DeltaPhiC10pt2(0x0),
-fh2DeltaPhiC20pt2(0x0),
-fh2DeltaPhiC30pt2(0x0),
-fh2DeltaPhiC60pt2(0x0),  
-fh2DeltaPhiC10pt3(0x0),
-fh2DeltaPhiC20pt3(0x0),
-fh2DeltaPhiC30pt3(0x0),
-fh2DeltaPhiC60pt3(0x0),  
-fh2DeltaPhiC10pt4(0x0),
-fh2DeltaPhiC20pt4(0x0),
-fh2DeltaPhiC30pt4(0x0),
-fh2DeltaPhiC60pt4(0x0),
+fh3JetTrackC3060(0x0),
+fh3JetTrackC20(0x0),
 fh2AngStructpt1C10(0x0),
 fh2AngStructpt2C10(0x0),
 fh2AngStructpt3C10(0x0),
@@ -183,10 +134,33 @@ fh2AngStructpt4C30(0x0),
 fh2AngStructpt1C60(0x0),
 fh2AngStructpt2C60(0x0),
 fh2AngStructpt3C60(0x0),
-fh2AngStructpt4C60(0x0)
+fh2AngStructpt4C60(0x0),
+fh2Ntriggers(0x0),
+fh2Ntriggers2(0x0), 
+fh3JetDensity(0x0),
+fh3JetDensityA4(0x0),
+fh2RPJets(0x0),
+fh2RPT(0x0),
+fh3spectriggeredC20RP(0x0),
+fh3spectriggeredC20(0x0),
+fh3spectriggeredC3060(0x0)
+
 {
    // default Constructor
 
+
+ // Trigger buffer.
+   for(Int_t i=0; i<10; i++) {
+               for(Int_t j=0; j<6; j++) {
+                       fTrigBuffer[i][j]=0;
+               }                               
+       }       
+
+
+
+
+
    fJetBranchName[0] = "";
    fJetBranchName[1] = "";
 
@@ -197,17 +171,21 @@ fh2AngStructpt4C60(0x0)
 AliAnalysisTaskJetCore::AliAnalysisTaskJetCore(const char *name) :
 AliAnalysisTaskSE(name),
 fESD(0x0),
-fAOD(0x0),
+fAODIn(0x0),
+fAODOut(0x0),
 fAODExtension(0x0),
 fBackgroundBranch(""),
 fNonStdFile(""),
 fIsPbPb(kTRUE),
 fOfflineTrgMask(AliVEvent::kAny),
 fMinContribVtx(1),
-fVtxZMin(-8.),
-fVtxZMax(8.),
+fVtxZMin(-10.),
+fVtxZMax(10.),
 fEvtClassMin(0),
 fEvtClassMax(4),
+fFilterMask(0),
+fFilterMaskBestPt(16),
+fFilterType(2),
 fRadioFrac(0.2),
 fMinDist(0.1),
 fCentMin(0.),
@@ -215,8 +193,22 @@ fCentMax(100.),
 fNInputTracksMin(0),
 fNInputTracksMax(-1),
 fAngStructCloseTracks(0),
+fCheckMethods(0),
+fDoEventMixing(0),
+fFlagPhiBkg(0),
+fFlagEtaBkg(0),
+fFlagJetHadron(0),
+fFlagRandom(0),
+fFlagOnlyRecoil(0),
+fTrackTypeRec(kTrackUndef),
+fRPAngle(0),
+fNRPBins(100),
 fJetEtaMin(-.5),
 fJetEtaMax(.5),
+fNevents(0),
+fTindex(0),
+fTrigBufferIndex(0),
+fCountAgain(0),
 fJetPtMin(20.),
 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
 fJetPtFractionMin(0.5),
@@ -228,85 +220,18 @@ fkEvtClasses(12),
 fOutputList(0x0),
 fbEvent(kTRUE),
 fHistEvtSelection(0x0),
-fHistJetSelection(0x0),
-fh2JetSelection(0x0),
+fhnDeltaR(0x0),
+fhnMixedEvents(0x0),
 fh2JetCoreMethod1C10(0x0),
 fh2JetCoreMethod2C10(0x0),
-fh2JetCoreMethod3C10(0x0),
 fh2JetCoreMethod1C20(0x0),
 fh2JetCoreMethod2C20(0x0),
-fh2JetCoreMethod3C20(0x0),
 fh2JetCoreMethod1C30(0x0),
 fh2JetCoreMethod2C30(0x0),
-fh2JetCoreMethod3C30(0x0),
 fh2JetCoreMethod1C60(0x0),
 fh2JetCoreMethod2C60(0x0),
-fh2JetCoreMethod3C60(0x0),
-fh2SumPtInC10(0x0),
-fh2SumPtInC20(0x0),
-fh2SumPtInC30(0x0),
-fh2SumPtInC60(0x0),
-fh2SumPtOutC10(0x0),
-fh2SumPtOutC10b(0x0),
-fh2SumPtOutC20(0x0),
-fh2SumPtOutC30(0x0),
-fh2SumPtOutC60(0x0),
-fh2SumPtInC10bkg(0x0),
-fh2SumPtInC20bkg(0x0),
-fh2SumPtInC30bkg(0x0),
-fh2SumPtInC60bkg(0x0),
-fh2SumPtOutC10bkg(0x0),
-fh2SumPtOutC20bkg(0x0),
-fh2SumPtOutC30bkg(0x0),
-fh2SumPtOutC60bkg(0x0),
-fh2DeltaRC10pt1(0x0),
-fh2DeltaRC20pt1(0x0),
-fh2DeltaRC30pt1(0x0),
-fh2DeltaRC60pt1(0x0),  
-fh2DeltaRC10pt2(0x0),
-fh2DeltaRC20pt2(0x0),
-fh2DeltaRC30pt2(0x0),
-fh2DeltaRC60pt2(0x0),  
-fh2DeltaRC10pt3(0x0),
-fh2DeltaRC20pt3(0x0),
-fh2DeltaRC30pt3(0x0),
-fh2DeltaRC60pt3(0x0),  
-fh2DeltaRC10pt4(0x0),
-fh2DeltaRC20pt4(0x0),
-fh2DeltaRC30pt4(0x0),
-fh2DeltaRC60pt4(0x0),
-fh2DeltaEtaC10pt1(0x0),
-fh2DeltaEtaC20pt1(0x0),
-fh2DeltaEtaC30pt1(0x0),
-fh2DeltaEtaC60pt1(0x0),  
-fh2DeltaEtaC10pt2(0x0),
-fh2DeltaEtaC20pt2(0x0),
-fh2DeltaEtaC30pt2(0x0),
-fh2DeltaEtaC60pt2(0x0),  
-fh2DeltaEtaC10pt3(0x0),
-fh2DeltaEtaC20pt3(0x0),
-fh2DeltaEtaC30pt3(0x0),
-fh2DeltaEtaC60pt3(0x0),  
-fh2DeltaEtaC10pt4(0x0),
-fh2DeltaEtaC20pt4(0x0),
-fh2DeltaEtaC30pt4(0x0),
-fh2DeltaEtaC60pt4(0x0),
-fh2DeltaPhiC10pt1(0x0),
-fh2DeltaPhiC20pt1(0x0),
-fh2DeltaPhiC30pt1(0x0),
-fh2DeltaPhiC60pt1(0x0),  
-fh2DeltaPhiC10pt2(0x0),
-fh2DeltaPhiC20pt2(0x0),
-fh2DeltaPhiC30pt2(0x0),
-fh2DeltaPhiC60pt2(0x0),  
-fh2DeltaPhiC10pt3(0x0),
-fh2DeltaPhiC20pt3(0x0),
-fh2DeltaPhiC30pt3(0x0),
-fh2DeltaPhiC60pt3(0x0),  
-fh2DeltaPhiC10pt4(0x0),
-fh2DeltaPhiC20pt4(0x0),
-fh2DeltaPhiC30pt4(0x0),
-fh2DeltaPhiC60pt4(0x0),
+fh3JetTrackC3060(0x0),
+fh3JetTrackC20(0x0),
 fh2AngStructpt1C10(0x0),
 fh2AngStructpt2C10(0x0),
 fh2AngStructpt3C10(0x0),
@@ -322,11 +247,29 @@ fh2AngStructpt4C30(0x0),
 fh2AngStructpt1C60(0x0),
 fh2AngStructpt2C60(0x0),
 fh2AngStructpt3C60(0x0),
-fh2AngStructpt4C60(0x0)    
+fh2AngStructpt4C60(0x0),    
+fh2Ntriggers(0x0),
+fh2Ntriggers2(0x0),
+fh3JetDensity(0x0),
+fh3JetDensityA4(0x0),
+fh2RPJets(0x0),
+fh2RPT(0x0),
+fh3spectriggeredC20RP(0x0),
+fh3spectriggeredC20(0x0),
+fh3spectriggeredC3060(0x0)
 
  {
    // Constructor
 
+
+    for(Int_t i=0; i<10; i++) {
+       for(Int_t j=0; j<6; j++) {
+           fTrigBuffer[i][j]=0;
+               }                               
+    }  
+
+
+
    fJetBranchName[0] = "";
    fJetBranchName[1] = "";
 
@@ -378,221 +321,115 @@ void AliAnalysisTaskJetCore::UserCreateOutputObjects()
    fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
    fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
 
-   fHistJetSelection = new TH1I("fHistJetSelection", "jet selection", 8, -0.5, 7.5);
-   fHistJetSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
-   fHistJetSelection->GetXaxis()->SetBinLabel(2,"probes IN");
-   fHistJetSelection->GetXaxis()->SetBinLabel(3,"no matching jet");
-   fHistJetSelection->GetXaxis()->SetBinLabel(4,"not in list");
-   fHistJetSelection->GetXaxis()->SetBinLabel(5,"fraction cut");
-   fHistJetSelection->GetXaxis()->SetBinLabel(6,"acceptance cut");
-   fHistJetSelection->GetXaxis()->SetBinLabel(7,"p_{T} cut");
-   fHistJetSelection->GetXaxis()->SetBinLabel(8,"trigger exclude mask");
-
-   fh2JetSelection = new TH2F("fh2JetSelection", "jet selection", 8, -0.5, 7.5,100,0.,200.);
-   fh2JetSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
-   fh2JetSelection->GetXaxis()->SetBinLabel(2,"probes IN");
-   fh2JetSelection->GetXaxis()->SetBinLabel(3,"no matching jet");
-   fh2JetSelection->GetXaxis()->SetBinLabel(4,"not in list");
-   fh2JetSelection->GetXaxis()->SetBinLabel(5,"fraction cut");
-   fh2JetSelection->GetXaxis()->SetBinLabel(6,"acceptance cut");
-   fh2JetSelection->GetXaxis()->SetBinLabel(7,"p_{T} cut");
-   fh2JetSelection->GetXaxis()->SetBinLabel(8,"trigger exclude mask");
+     UInt_t entries = 0; // bit coded, see GetDimParams() below 
+     entries = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 |1<<7; 
+     fhnDeltaR = NewTHnSparseF("fhnDeltaR", entries);
+
+     //change binning in pTtrack
+     Double_t *xPt3 = new Double_t[10];
+     xPt3[0] = 0.;
+     for(int i = 1; i<=9;i++){
+      if(xPt3[i-1]<2)xPt3[i] = xPt3[i-1] + 0.4; // 1 - 5
+      else if(xPt3[i-1]<11)xPt3[i] = xPt3[i-1] + 3; // 5 - 12
+      else xPt3[i] = xPt3[i-1] + 150.; // 18 
+     }
+    fhnDeltaR->SetBinEdges(2,xPt3);
+    delete [] xPt3;
+
+    //change binning in HTI
+     Double_t *xPt4 = new Double_t[14];
+     xPt4[0] = 0.;
+     for(int i = 1; i<=13;i++){
+      if(xPt4[i-1]<10)xPt4[i] = xPt4[i-1] + 1; // 1 - 10
+      else if(xPt4[i-1]<20)xPt4[i] = xPt4[i-1] + 5; // 10 - 12
+      else xPt4[i] = xPt4[i-1] + 30.; // 13
+     }
+    fhnDeltaR->SetBinEdges(6,xPt4);
+    delete [] xPt4;
 
+    
 
-   //UInt_t entries = 0; // bit coded, see GetDimParams() below
-   //UInt_t opt = 0;  // bit coded, default (0) or high resolution (1)
 
-   //  Int_t bins[5]={10,10,150,150,15};
-   //Double_t xmin[5]={0.,0.,0.,0.,0.};
-   //Double_t xmax[5]={100.,6.5,150.,1.5,1.5};     
-   //fhnDeltaRjets = new THnSparseF("fhnDeltaRjets", "fhnDeltaRjets",5,bins,xmin,xmax);
 
 
+   
+     if(fDoEventMixing){    
+     UInt_t cifras = 0; // bit coded, see GetDimParams() below 
+     cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<7; 
+     fhnMixedEvents = NewTHnSparseF("fhnMixedEvents", cifras);}
 
+    if(fCheckMethods){
     fh2JetCoreMethod1C10 = new TH2F("JetCoreMethod1C10","",150, 0., 150.,100, 0., 1.5);
     fh2JetCoreMethod2C10 = new TH2F("JetCoreMethod2C10","",150, 0., 150.,100, 0., 1.5);
-    fh2JetCoreMethod3C10 = new TH2F("JetCoreMethod3C10","",150, 0., 150.,100, 0., 1.5); 
     fh2JetCoreMethod1C20 = new TH2F("JetCoreMethod1C20","",150, 0., 150.,100, 0., 1.5);
     fh2JetCoreMethod2C20 = new TH2F("JetCoreMethod2C20","",150, 0., 150.,100, 0., 1.5);
-    fh2JetCoreMethod3C20 = new TH2F("JetCoreMethod3C20","",150, 0., 150.,100, 0., 1.5); 
     fh2JetCoreMethod1C30 = new TH2F("JetCoreMethod1C30","",150, 0., 150.,100, 0., 1.5);
     fh2JetCoreMethod2C30 = new TH2F("JetCoreMethod2C30","",150, 0., 150.,100, 0., 1.5);
-    fh2JetCoreMethod3C30 = new TH2F("JetCoreMethod3C30","",150, 0., 150.,100, 0., 1.5); 
     fh2JetCoreMethod1C60 = new TH2F("JetCoreMethod1C60","",150, 0., 150.,100, 0., 1.5);
-    fh2JetCoreMethod2C60 = new TH2F("JetCoreMethod2C60","",150, 0., 150.,100, 0., 1.5);
-    fh2JetCoreMethod3C60 = new TH2F("JetCoreMethod3C60","",150, 0., 150.,100, 0., 1.5); 
+    fh2JetCoreMethod2C60 = new TH2F("JetCoreMethod2C60","",150, 0., 150.,100, 0., 1.5);}
+
+    fh3JetTrackC3060=new TH3F("JetTrackC3060","",50,0,50,150,0.,150.,35,0.,3.5);
+    fh3JetTrackC20=new TH3F("JetTrackC20","",50,0,50,150,0.,150.,35,0.,3.5);
+    if(fAngStructCloseTracks>0){
+    fh2AngStructpt1C10 = new TH2F("Ang struct pt1 C10","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt2C10 = new TH2F("Ang struct pt2 C10","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt3C10 = new TH2F("Ang struct pt3 C10","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt4C10 = new TH2F("Ang struct pt4 C10","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt1C20 = new TH2F("Ang struct pt1 C20","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt2C20 = new TH2F("Ang struct pt2 C20","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt3C20 = new TH2F("Ang struct pt3 C20","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt4C20 = new TH2F("Ang struct pt4 C20","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt1C30 = new TH2F("Ang struct pt1 C30","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt2C30 = new TH2F("Ang struct pt2 C30","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt3C30 = new TH2F("Ang struct pt3 C30","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt4C30 = new TH2F("Ang struct pt4 C30","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt1C60 = new TH2F("Ang struct pt1 C60","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt2C60 = new TH2F("Ang struct pt2 C60","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt3C60 = new TH2F("Ang struct pt3 C60","",15,0.,1.5,150,0.,10.);
+    fh2AngStructpt4C60 = new TH2F("Ang struct pt4 C60","",15,0.,1.5,150,0.,10.); }
+
    
-    fh2SumPtInC10 = new TH2F("PtSumInC10","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC20 = new TH2F("PtSumInC20","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC30 = new TH2F("PtSumInC30","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC60 = new TH2F("PtSumInC60","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC10 = new TH2F("PtSumOutC10","",150, 0., 150.,5000, 0., 50.);
-    fh2SumPtOutC10b= new TH2F("PtSumOutC10b","",150, 0., 150.,500, 0., 50.);
-    fh2SumPtOutC20 = new TH2F("PtSumOutC20","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC30 = new TH2F("PtSumOutC30","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC60 = new TH2F("PtSumOutC60","",150, 0., 150.,5000, 0., 50.); 
-     
-    fh2SumPtInC10bkg = new TH2F("PtSumInC10bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC20bkg = new TH2F("PtSumInC20bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC30bkg = new TH2F("PtSumInC30bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtInC60bkg = new TH2F("PtSumInC60bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC10bkg = new TH2F("PtSumOutC10bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC20bkg = new TH2F("PtSumOutC20bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC30bkg = new TH2F("PtSumOutC30bkg","",150, 0., 150.,5000, 0., 50.); 
-    fh2SumPtOutC60bkg = new TH2F("PtSumOutC60bkg","",150, 0., 150.,5000, 0., 50.); 
-
-
-
-    fh2DeltaRC10pt1 = new TH2F("DeltaRC10pt1","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC20pt1 = new TH2F("DeltaRC20pt1","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC30pt1 = new TH2F("DeltaRC30pt1","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC60pt1 = new TH2F("DeltaRC60pt1","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC10pt2 = new TH2F("DeltaRC10pt2","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC20pt2 = new TH2F("DeltaRC20pt2","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC30pt2 = new TH2F("DeltaRC30pt2","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC60pt2 = new TH2F("DeltaRC60pt2","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC10pt3 = new TH2F("DeltaRC10pt3","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC20pt3 = new TH2F("DeltaRC20pt3","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC30pt3 = new TH2F("DeltaRC30pt3","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC60pt3 = new TH2F("DeltaRC60pt3","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC10pt4 = new TH2F("DeltaRC10pt4","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC20pt4 = new TH2F("DeltaRC20pt4","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC30pt4 = new TH2F("DeltaRC30pt4","",150, 0., 150.,100,0.,1.5); 
-    fh2DeltaRC60pt4 = new TH2F("DeltaRC60pt4","",150, 0., 150.,100,0.,1.5); 
-
-    fh2DeltaEtaC10pt1 = new TH2F("DeltaEtaC10pt1","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC20pt1 = new TH2F("DeltaEtaC20pt1","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC30pt1 = new TH2F("DeltaEtaC30pt1","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC60pt1 = new TH2F("DeltaEtaC60pt1","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC10pt2 = new TH2F("DeltaEtaC10pt2","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC20pt2 = new TH2F("DeltaEtaC20pt2","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC30pt2 = new TH2F("DeltaEtaC30pt2","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC60pt2 = new TH2F("DeltaEtaC60pt2","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC10pt3 = new TH2F("DeltaEtaC10pt3","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC20pt3 = new TH2F("DeltaEtaC20pt3","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC30pt3 = new TH2F("DeltaEtaC30pt3","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC60pt3 = new TH2F("DeltaEtaC60pt3","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC10pt4 = new TH2F("DeltaEtaC10pt4","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC20pt4 = new TH2F("DeltaEtaC20pt4","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC30pt4 = new TH2F("DeltaEtaC30pt4","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaEtaC60pt4 = new TH2F("DeltaEtaC60pt4","",150, 0., 150.,100,-1.5,1.5); 
-    fh2DeltaPhiC10pt1 = new TH2F("DeltaPhiC10pt1","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC20pt1 = new TH2F("DeltaPhiC20pt1","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC30pt1 = new TH2F("DeltaPhiC30pt1","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC60pt1 = new TH2F("DeltaPhiC60pt1","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC10pt2 = new TH2F("DeltaPhiC10pt2","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC20pt2 = new TH2F("DeltaPhiC20pt2","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC30pt2 = new TH2F("DeltaPhiC30pt2","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC60pt2 = new TH2F("DeltaPhiC60pt2","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC10pt3 = new TH2F("DeltaPhiC10pt3","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC20pt3 = new TH2F("DeltaPhiC20pt3","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC30pt3 = new TH2F("DeltaPhiC30pt3","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC60pt3 = new TH2F("DeltaPhiC60pt3","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC10pt4 = new TH2F("DeltaPhiC10pt4","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC20pt4 = new TH2F("DeltaPhiC20pt4","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC30pt4 = new TH2F("DeltaPhiC30pt4","",150, 0., 150.,100,-6.5,6.5); 
-    fh2DeltaPhiC60pt4 = new TH2F("DeltaPhiC60pt4","",150, 0., 150.,100,-6.5,6.5); 
-
-    fh2AngStructpt1C10 = new TH2F("Ang struct pt1 C10","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt2C10 = new TH2F("Ang struct pt2 C10","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt3C10 = new TH2F("Ang struct pt3 C10","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt4C10 = new TH2F("Ang struct pt4 C10","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt1C20 = new TH2F("Ang struct pt1 C20","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt2C20 = new TH2F("Ang struct pt2 C20","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt3C20 = new TH2F("Ang struct pt3 C20","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt4C20 = new TH2F("Ang struct pt4 C20","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt1C30 = new TH2F("Ang struct pt1 C30","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt2C30 = new TH2F("Ang struct pt2 C30","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt3C30 = new TH2F("Ang struct pt3 C30","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt4C30 = new TH2F("Ang struct pt4 C30","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt1C60 = new TH2F("Ang struct pt1 C60","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt2C60 = new TH2F("Ang struct pt2 C60","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt3C60 = new TH2F("Ang struct pt3 C60","",15,0.,1.5,150,0.,5.);
-    fh2AngStructpt4C60 = new TH2F("Ang struct pt4 C60","",15,0.,1.5,150,0.,5.); 
 
+    fh2Ntriggers=new TH2F("# of triggers","",10,0.,100.,50,0.,50.);
+    fh2Ntriggers2=new TH2F("# of triggers2","",50,0.,50.,50,0.,50.);
+
+    fh3JetDensity=new TH3F("Jet density vs mutliplicity A>0.4","",100,0.,4000.,100,0.,5.,10,0.,50.);
+    fh3JetDensityA4=new TH3F("Jet density vs multiplicity A>0.4","",100,0.,4000.,100,0.,5.,10,0.,50.);
+    fh2RPJets=new TH2F("RPJet","",fNRPBins,0.,fNRPBins,150,0.,150.);
+    fh2RPT=new TH2F("RPTrigger","",fNRPBins,0.,fNRPBins,150,0.,150.); 
+    fh3spectriggeredC20RP = new TH3F("Triggered spectrumC20RP","",3,0.,3.,140,-80.,200.,10,0.,50.);
+    fh3spectriggeredC20 = new TH3F("Triggered spectrumC20","",100,0.,1.,140,-80.,200.,10,0.,50.);
+    fh3spectriggeredC3060 = new TH3F("Triggered spectrumC3060","",100,0.,1.,140,-80.,200.,10,0.,50.);
+
+    
+    
    fOutputList->Add(fHistEvtSelection);
-   fOutputList->Add(fHistJetSelection);
-   fOutputList->Add(fh2JetSelection);
+
+   fOutputList->Add(fhnDeltaR);
+   
+   fOutputList->Add(fhnMixedEvents);
+         
+     
+  
+      if(fCheckMethods){
+
       fOutputList->Add(fh2JetCoreMethod1C10);
       fOutputList->Add(fh2JetCoreMethod2C10);
-      fOutputList->Add(fh2JetCoreMethod3C10);
       fOutputList->Add(fh2JetCoreMethod1C20);
       fOutputList->Add(fh2JetCoreMethod2C20);
-      fOutputList->Add(fh2JetCoreMethod3C20);
       fOutputList->Add(fh2JetCoreMethod1C30);
       fOutputList->Add(fh2JetCoreMethod2C30);
-      fOutputList->Add(fh2JetCoreMethod3C30);
       fOutputList->Add(fh2JetCoreMethod1C60);
-      fOutputList->Add(fh2JetCoreMethod2C60);
-      fOutputList->Add(fh2JetCoreMethod3C60);
-      fOutputList->Add(fh2SumPtInC10);
-      fOutputList->Add(fh2SumPtInC20);
-      fOutputList->Add(fh2SumPtInC30);
-      fOutputList->Add(fh2SumPtInC60);
-      fOutputList->Add(fh2SumPtOutC10);
-      fOutputList->Add(fh2SumPtOutC10b);
-      fOutputList->Add(fh2SumPtOutC20);
-      fOutputList->Add(fh2SumPtOutC30);
-      fOutputList->Add(fh2SumPtOutC60);
-      
-      fOutputList->Add(fh2SumPtInC10bkg);
-      fOutputList->Add(fh2SumPtInC20bkg);
-      fOutputList->Add(fh2SumPtInC30bkg);
-      fOutputList->Add(fh2SumPtInC60bkg);
-      fOutputList->Add(fh2SumPtOutC10bkg);
-      fOutputList->Add(fh2SumPtOutC20bkg);
-      fOutputList->Add(fh2SumPtOutC30bkg);
-      fOutputList->Add(fh2SumPtOutC60bkg);     
-      fOutputList->Add(fh2DeltaRC10pt1);
-      fOutputList->Add(fh2DeltaRC20pt1);
-      fOutputList->Add(fh2DeltaRC30pt1);
-      fOutputList->Add(fh2DeltaRC60pt1); 
-      fOutputList->Add(fh2DeltaRC10pt2);
-      fOutputList->Add(fh2DeltaRC20pt2);
-      fOutputList->Add(fh2DeltaRC30pt2);
-      fOutputList->Add(fh2DeltaRC60pt2); 
-      fOutputList->Add(fh2DeltaRC10pt3);
-      fOutputList->Add(fh2DeltaRC20pt3);
-      fOutputList->Add(fh2DeltaRC30pt3);
-      fOutputList->Add(fh2DeltaRC60pt3); 
-      fOutputList->Add(fh2DeltaRC10pt4);
-      fOutputList->Add(fh2DeltaRC20pt4);
-      fOutputList->Add(fh2DeltaRC30pt4);
-      fOutputList->Add(fh2DeltaRC60pt4);
+      fOutputList->Add(fh2JetCoreMethod2C60);}
       
-      fOutputList->Add(fh2DeltaEtaC10pt1);
-      fOutputList->Add(fh2DeltaEtaC20pt1);
-      fOutputList->Add(fh2DeltaEtaC30pt1);
-      fOutputList->Add(fh2DeltaEtaC60pt1); 
-      fOutputList->Add(fh2DeltaEtaC10pt2);
-      fOutputList->Add(fh2DeltaEtaC20pt2);
-      fOutputList->Add(fh2DeltaEtaC30pt2);
-      fOutputList->Add(fh2DeltaEtaC60pt2); 
-      fOutputList->Add(fh2DeltaEtaC10pt3);
-      fOutputList->Add(fh2DeltaEtaC20pt3);
-      fOutputList->Add(fh2DeltaEtaC30pt3);
-      fOutputList->Add(fh2DeltaEtaC60pt3); 
-      fOutputList->Add(fh2DeltaEtaC10pt4);
-      fOutputList->Add(fh2DeltaEtaC20pt4);
-      fOutputList->Add(fh2DeltaEtaC30pt4);
-      fOutputList->Add(fh2DeltaEtaC60pt4); 
-      fOutputList->Add(fh2DeltaPhiC10pt1);
-      fOutputList->Add(fh2DeltaPhiC20pt1);
-      fOutputList->Add(fh2DeltaPhiC30pt1);
-      fOutputList->Add(fh2DeltaPhiC60pt1); 
-      fOutputList->Add(fh2DeltaPhiC10pt2);
-      fOutputList->Add(fh2DeltaPhiC20pt2);
-      fOutputList->Add(fh2DeltaPhiC30pt2);
-      fOutputList->Add(fh2DeltaPhiC60pt2); 
-      fOutputList->Add(fh2DeltaPhiC10pt3);
-      fOutputList->Add(fh2DeltaPhiC20pt3);
-      fOutputList->Add(fh2DeltaPhiC30pt3);
-      fOutputList->Add(fh2DeltaPhiC60pt3); 
-      fOutputList->Add(fh2DeltaPhiC10pt4);
-      fOutputList->Add(fh2DeltaPhiC20pt4);
-      fOutputList->Add(fh2DeltaPhiC30pt4);
-      fOutputList->Add(fh2DeltaPhiC60pt4);      
+      fOutputList->Add(fh3JetTrackC3060);
+      fOutputList->Add(fh3JetTrackC20);
      
+            
+     
+
+
+        if(fAngStructCloseTracks>0){
        fOutputList->Add(fh2AngStructpt1C10);
        fOutputList->Add(fh2AngStructpt2C10);
        fOutputList->Add(fh2AngStructpt3C10);
@@ -608,11 +445,23 @@ void AliAnalysisTaskJetCore::UserCreateOutputObjects()
        fOutputList->Add(fh2AngStructpt1C60);
        fOutputList->Add(fh2AngStructpt2C60);
        fOutputList->Add(fh2AngStructpt3C60);
-       fOutputList->Add(fh2AngStructpt4C60);  
+       fOutputList->Add(fh2AngStructpt4C60);}  
+
 
 
 
+       fOutputList->Add(fh2Ntriggers);
+        fOutputList->Add(fh2Ntriggers2);
+        fOutputList->Add(fh3JetDensity);
+        fOutputList->Add(fh3JetDensityA4);
+        fOutputList->Add(fh2RPJets);
+        fOutputList->Add(fh2RPT);
+        fOutputList->Add(fh3spectriggeredC20RP); 
+       fOutputList->Add(fh3spectriggeredC20); 
+       fOutputList->Add(fh3spectriggeredC3060);   
 
+     
    // =========== Switch on Sumw2 for all histos ===========
    for (Int_t i=0; i<fOutputList->GetEntries(); ++i) {
       TH1 *h1 = dynamic_cast<TH1*>(fOutputList->At(i));
@@ -642,10 +491,17 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
    fESD=dynamic_cast<AliESDEvent*>(InputEvent());
    if (!fESD) {
       AliError("ESD not available");
-      fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
-   } else {
-      fAOD = dynamic_cast<AliAODEvent*>(AODEvent());
-   }
+      fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
+   } 
+      fAODOut = dynamic_cast<AliAODEvent*>(AODEvent());
+
+       static AliAODEvent* aod = 0;
+       // take all other information from the aod we take the tracks from
+       if(!aod){
+       if(!fESD)aod = fAODIn;
+       else aod = fAODOut;}
+
+   
  
     if(fNonStdFile.Length()!=0){
     // case that we have an AOD extension we need can fetch the jets from the extended output
@@ -656,15 +512,13 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
     }}
     
 
-
-
-
    // -- event selection --
    fHistEvtSelection->Fill(1); // number of events before event selection
 
    // physics selection
    AliInputEventHandler* inputHandler = (AliInputEventHandler*)
    ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+   cout<<inputHandler->IsEventSelected()<<" "<<fOfflineTrgMask<<endl;
    if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){
       if(fDebug) Printf(" Trigger Selection: event REJECTED ... ");
       fHistEvtSelection->Fill(2);
@@ -673,7 +527,20 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
    }
 
    // vertex selection
-   AliAODVertex* primVtx = fAOD->GetPrimaryVertex();
+   if(!aod){
+     if(fDebug) Printf("%s:%d No AOD",(char*)__FILE__,__LINE__);
+     fHistEvtSelection->Fill(3);
+      PostData(1, fOutputList);
+   }
+   AliAODVertex* primVtx = aod->GetPrimaryVertex();
+
+   if(!primVtx){
+     if(fDebug) Printf("%s:%d No primVtx",(char*)__FILE__,__LINE__);
+     fHistEvtSelection->Fill(3);
+     PostData(1, fOutputList);
+     return;
+   }
+
    Int_t nTracksPrim = primVtx->GetNContributors();
    if ((nTracksPrim < fMinContribVtx) ||
          (primVtx->GetZ() < fVtxZMin) ||
@@ -695,69 +562,79 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
 
    // centrality selection
    AliCentrality *cent = 0x0;
-   Float_t centValue = 0.; 
-   if(fESD) cent = fESD->GetCentrality();
-   if(cent) centValue = cent->GetCentralityPercentile("V0M");
+   Double_t centValue = 0.; 
+   if(fIsPbPb){
+   if(fESD) {cent = fESD->GetCentrality();
+     if(cent) centValue = cent->GetCentralityPercentile("V0M");}
+   else     centValue=aod->GetHeader()->GetCentrality();
+   
    if(fDebug) printf("centrality: %f\n", centValue);
-   if (centValue < fCentMin || centValue > fCentMax){
+      if (centValue < fCentMin || centValue > fCentMax){
       fHistEvtSelection->Fill(4);
       PostData(1, fOutputList);
       return;
-   }
-
+      }}
 
-   // multiplicity due to input tracks
-   //Int_t nInputTracks = GetNInputTracks();
-   //if (nInputTracks < fNInputTracksMin || (fNInputTracksMax > -1 && nInputTracks > fNInputTracksMax)){
-   //   fHistEvtSelection->Fill(5);
-   //   PostData(1, fOutputList);
-   //   return;
-   // }
 
-   
    fHistEvtSelection->Fill(0); 
    // accepted events  
    // -- end event selection --
   
    // get background
    AliAODJetEventBackground* externalBackground = 0;
-   if(fAOD&&!externalBackground&&fBackgroundBranch.Length()){
-      externalBackground =  (AliAODJetEventBackground*)(fAOD->FindListObject(fBackgroundBranch.Data()));
+   if(fAODOut&&!externalBackground&&fBackgroundBranch.Length()){
+      externalBackground =  (AliAODJetEventBackground*)(fAODOut->FindListObject(fBackgroundBranch.Data()));
       if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
    }
    if(fAODExtension&&!externalBackground&&fBackgroundBranch.Length()){
      externalBackground =  (AliAODJetEventBackground*)(fAODExtension->GetAOD()->FindListObject(fBackgroundBranch.Data()));
       if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
    }
+
+    if(fAODIn&&!externalBackground&&fBackgroundBranch.Length()){
+      externalBackground =  (AliAODJetEventBackground*)(fAODIn->FindListObject(fBackgroundBranch.Data()));
+      if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
+    }
    
    Float_t rho = 0;
-   if(externalBackground)rho = externalBackground->GetBackground(0);
 
+   if(fFlagRandom==0){
+     if(externalBackground)rho = externalBackground->GetBackground(0);}
+   if(fFlagRandom==1){
+      if(externalBackground)rho = externalBackground->GetBackground(2);}
 
    // fetch jets
    TClonesArray *aodJets[2];
    aodJets[0]=0;
-   if(fAOD&&!aodJets[0]){
-   aodJets[0] = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fJetBranchName[0].Data())); // 
-   aodJets[1] = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fJetBranchName[1].Data()));  }
+   if(fAODOut&&!aodJets[0]){
+   aodJets[0] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[0].Data())); 
+   aodJets[1] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[1].Data()));  }
    if(fAODExtension && !aodJets[0]){ 
-     aodJets[0] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[0].Data())); // 
-     aodJets[1] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[1].Data()));  }
+   aodJets[0] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[0].Data())); 
+   aodJets[1] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[1].Data()));  }
+     if(fAODIn&&!aodJets[0]){
+   aodJets[0] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[0].Data())); 
+   aodJets[1] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[1].Data()));  } 
+
+
+   //Double_t ptsub[aodJets[0]->GetEntriesFast()];
+   //Int_t inord[aodJets[0]->GetEntriesFast()];
+   //for(Int_t n=0;n<aodJets[0]->GetEntriesFast();n++){
+   //  ptsub[n]=0;
+   //  inord[n]=0;}   
 
    TList ParticleList;
    Int_t nT = GetListOfTracks(&ParticleList);
      for (Int_t iJetType = 0; iJetType < 2; iJetType++) {
       fListJets[iJetType]->Clear();
       if (!aodJets[iJetType]) continue;
-
       if(fDebug) Printf("%s: %d jets",fJetBranchName[iJetType].Data(),aodJets[iJetType]->GetEntriesFast());
-      
       for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) {
          AliAODJet *jet = dynamic_cast<AliAODJet*>((*aodJets[iJetType])[iJet]);
          if (jet) fListJets[iJetType]->Add(jet);
-      }
-      fListJets[iJetType]->Sort();
-   }
+        // if(iJetType==0){
+        // ptsub[iJet]=jet->Pt()-rho*jet->EffectiveAreaCharged();}
+      }}
    
    Double_t etabig=0;
    Double_t ptbig=0;
@@ -766,61 +643,107 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
    Double_t etasmall=0;
    Double_t ptsmall=0;
    Double_t areasmall=0;
-   Double_t distr=0.;
    Double_t phismall=0.;
+         
+  
 
-   Double_t up1[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t up2[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t up3[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t up4[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t down1[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t down2[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t down3[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-   Double_t down4[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
-
+   Int_t iCount=0; 
+   Int_t trigJet=-1;
+   Int_t trigBBTrack=-1;
+   Int_t trigInTrack=-1;
+   fRPAngle = aod->GetHeader()->GetEventplane();     
+   AliVParticle *partback = (AliVParticle*)ParticleList.At(nT);     
+   if(!partback){  
+   PostData(1, fOutputList);
+   return;}
 
+   fh2Ntriggers->Fill(centValue,partback->Pt());
+   Int_t phiBinT = GetPhiBin(RelativePhi(partback->Phi(),fRPAngle));
+   if(centValue<20.) fh2RPT->Fill(phiBinT,partback->Pt()); 
 
+   Double_t accep=2.*TMath::Pi()*1.8;
+   Int_t injet4=0;
+   Int_t injet=0; 
    for(Int_t i=0; i<fListJets[0]->GetEntries(); ++i){
            AliAODJet* jetbig = (AliAODJet*)(fListJets[0]->At(i));
            etabig  = jetbig->Eta();
            phibig  = jetbig->Phi();
            ptbig   = jetbig->Pt();
            if(ptbig==0) continue; 
+           Int_t phiBin = GetPhiBin(RelativePhi(phibig,fRPAngle));       
            areabig = jetbig->EffectiveAreaCharged();
            Double_t ptcorr=ptbig-rho*areabig;
-           if(ptcorr<=0) continue;
           if((etabig<fJetEtaMin)||(etabig>fJetEtaMax)) continue;
+           if(areabig>=0.07) injet=injet+1;
+           if(areabig>=0.4) injet4=injet4+1;   
+           Double_t dphi=RelativePhi(partback->Phi(),phibig); 
+
+           if(fFlagEtaBkg==1){
+          Double_t etadif= partback->Eta()-etabig;
+           if(TMath::Abs(etadif)<=0.5){             
+          
+           if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
+           if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}}
+           if(fFlagEtaBkg==0){
+           if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
+           if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}
+
+
+           if(fFlagJetHadron==0){
+           if(fFlagPhiBkg!=0) if((TMath::Abs(dphi)<TMath::Pi()/2.-0.1)||(TMath::Abs(dphi)>TMath::Pi()/2.+0.1)) continue;
+           if(fFlagPhiBkg==0) if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;}
+           if(fFlagJetHadron!=0) if(TMath::Abs(dphi)>0.4) continue;
+
+
+                   if(centValue<20.) fh2RPJets->Fill(phiBin, ptcorr);
+                
                    Double_t dismin=100.;
                    Double_t ptmax=-10.; 
                    Int_t index1=-1;
                    Int_t index2=-1;
-                   Double_t fracin=0.;
-                   Double_t sumPtIn=0.;
-                   Double_t sumPtOut=0.; 
-          //compute sum of the pt of the tracks in a concentric cone
-           TRefArray *genTrackList = jetbig->GetRefTracks();
-           Int_t nTracksGenJet = genTrackList->GetEntriesFast();
-           AliAODTrack* genTrack;
-             for(Int_t ir=0; ir<nTracksGenJet; ++ir){
-             genTrack = (AliAODTrack*)(genTrackList->At(ir));
-            Float_t etr=genTrack->Eta();
-             Float_t phir=genTrack->Phi();
-             distr=(etr-etabig)*(etr-etabig)+(phir-phibig)*(phir-phibig);
-             distr=TMath::Sqrt(distr);
-            if(distr<=fRadioFrac){ fracin=fracin+genTrack->Pt();}}
-    
-            if(centValue<10) fh2JetCoreMethod3C10->Fill(ptcorr,fracin/ptbig);
-             
-             if((centValue>20)&&(centValue<40)) fh2JetCoreMethod3C20->Fill(ptcorr,fracin/ptbig);
-                                                
-             if((centValue>30)&&(centValue<60)) fh2JetCoreMethod3C30->Fill(ptcorr,fracin/ptbig);
-                                                
-             if(centValue>60) fh2JetCoreMethod3C60->Fill(ptcorr,fracin/ptbig);
-                             
-         
-            
+           if(centValue<20.)  fh3spectriggeredC20RP->Fill(phiBin,ptcorr,partback->Pt());
+           if(centValue<20.)  fh3spectriggeredC20->Fill(jetbig->EffectiveAreaCharged(),ptcorr,partback->Pt());
+           if(centValue>30. && centValue<60.)  fh3spectriggeredC3060->Fill(jetbig->EffectiveAreaCharged(),ptcorr,partback->Pt());
+
+                   if(ptcorr<=0) continue;
+
+                  
+                       AliAODTrack* leadtrack=0; 
+                       Int_t ippt=0;
+                       Double_t ppt=-10;
+                       if(fFlagJetHadron==0){   
+                      TRefArray *genTrackList = jetbig->GetRefTracks();
+                       Int_t nTracksGenJet = genTrackList->GetEntriesFast();
+                       AliAODTrack* genTrack;
+                       for(Int_t ir=0; ir<nTracksGenJet; ++ir){
+                       genTrack = (AliAODTrack*)(genTrackList->At(ir));
+                      if(genTrack->Pt()>ppt){ppt=genTrack->Pt();
+                      ippt=ir;}}
+                       leadtrack=(AliAODTrack*)(genTrackList->At(ippt));
+                       if(!leadtrack) continue;}
+
+                      AliVParticle* leadtrackb=0;
+                       if(fFlagJetHadron!=0){
+                        Int_t nTb = GetHardestTrackBackToJet(jetbig);
+                         leadtrackb = (AliVParticle*)ParticleList.At(nTb);
+                         if(!leadtrackb) continue;  
+                      }
+
+
+
+
+                       
+                       //store one trigger info                   
+                        if(iCount==0){                        
+                         trigJet=i;
+                          trigBBTrack=nT;
+                          trigInTrack=ippt;
+                          iCount=iCount+1;} 
 
-                for(Int_t j=0; j<fListJets[1]->GetEntries(); ++j){
+   
+                 if(fCheckMethods){
+                  for(Int_t j=0; j<fListJets[1]->GetEntries(); ++j){
                   AliAODJet* jetsmall = (AliAODJet*)(fListJets[1]->At(j));
                   etasmall  = jetsmall->Eta();
                   phismall = jetsmall->Phi();
@@ -845,202 +768,185 @@ void AliAnalysisTaskJetCore::UserExec(Option_t *)
                   if(centValue<10) fh2JetCoreMethod2C10->Fill(ptcorr,jetmethod2->Pt()/ptbig);
                   if((centValue>20)&&(centValue<40)) fh2JetCoreMethod2C20->Fill(ptcorr,jetmethod2->Pt()/ptbig); 
                  if((centValue>30)&&(centValue<60)) fh2JetCoreMethod2C30->Fill(ptcorr,jetmethod2->Pt()/ptbig);
-                 if(centValue>60) fh2JetCoreMethod2C60->Fill(ptcorr,jetmethod2->Pt()/ptbig); }  
-
-     Double_t R=fRadioFrac*2.;      
-  
-     for(int it = 0;it<nT;++it){
-
+                 if(centValue>60) fh2JetCoreMethod2C60->Fill(ptcorr,jetmethod2->Pt()/ptbig); }}  
+       
+                  
+        
+        for(int it = 0;it<ParticleList.GetEntries();++it){
          AliVParticle *part = (AliVParticle*)ParticleList.At(it);
-         Float_t deltaR = jetbig->DeltaR(part);
-          Float_t deltaEta = part->Eta()-etabig;
-          Float_t deltaPhi = part->Phi()-phibig;  
-         if((deltaR>=0.4)&&(deltaR<=0.6))sumPtIn=sumPtIn+part->Pt();                     
-          if((deltaR>=0.8)&&(deltaR<=1.))sumPtOut=sumPtOut+part->Pt();     
-         if(centValue<10.){
-              if((ptcorr>=70.)&&(ptcorr<85.)) {fh2DeltaRC10pt1->Fill(part->Pt(),deltaR);
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R))fh2DeltaEtaC10pt1->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC10pt1->Fill(part->Pt(),deltaPhi);}
-              if((ptcorr>=85.)&&(ptcorr<100.)) {fh2DeltaRC10pt2->Fill(part->Pt(),deltaR);
-               if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC10pt2->Fill(part->Pt(),deltaEta);
-               if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC10pt2->Fill(part->Pt(),deltaPhi); }
-              if((ptcorr>=100.)&&(ptcorr<120.)) {fh2DeltaRC10pt3->Fill(part->Pt(),deltaR);
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC10pt3->Fill(part->Pt(),deltaEta);
-               if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC10pt3->Fill(part->Pt(),deltaPhi);}
-              if((ptcorr>=120.)&&(ptcorr<140.)) {fh2DeltaRC10pt4->Fill(part->Pt(),deltaR); 
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC10pt4->Fill(part->Pt(),deltaEta);
-               if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC10pt4->Fill(part->Pt(),deltaPhi); }}
-
-          if((centValue>20.)&&(centValue<40.)){
-              if((ptcorr>=70.)&&(ptcorr<85.)) {fh2DeltaRC20pt1->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R))fh2DeltaEtaC20pt1->Fill(part->Pt(),deltaEta);
-             if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC20pt1->Fill(part->Pt(),deltaPhi);}
-                     if((ptcorr>=85.)&&(ptcorr<100.)) {fh2DeltaRC20pt2->Fill(part->Pt(),deltaR);
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC20pt2->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC20pt2->Fill(part->Pt(),deltaPhi); }
-             if((ptcorr>=100.)&&(ptcorr<120.)) {fh2DeltaRC20pt3->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC20pt3->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC20pt3->Fill(part->Pt(),deltaPhi);}
-             if((ptcorr>=120.)&&(ptcorr<140.)) {fh2DeltaRC20pt4->Fill(part->Pt(),deltaR); 
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC20pt4->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC20pt4->Fill(part->Pt(),deltaPhi); }}
-
-         if((centValue>30.)&&(centValue<60.)){
-
-              if((ptcorr>=70.)&&(ptcorr<85.)) {fh2DeltaRC30pt1->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R))fh2DeltaEtaC30pt1->Fill(part->Pt(),deltaEta);
-             if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC30pt1->Fill(part->Pt(),deltaPhi);}
-             if((ptcorr>=85.)&&(ptcorr<100.)) {fh2DeltaRC30pt2->Fill(part->Pt(),deltaR);
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC30pt2->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC30pt2->Fill(part->Pt(),deltaPhi); }
-             if((ptcorr>=100.)&&(ptcorr<120.)) {fh2DeltaRC30pt3->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC30pt3->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC30pt3->Fill(part->Pt(),deltaPhi);}
-             if((ptcorr>=120.)&&(ptcorr<140.)) {fh2DeltaRC30pt4->Fill(part->Pt(),deltaR); 
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC30pt4->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC30pt4->Fill(part->Pt(),deltaPhi); }}
-                 
-
-         if(centValue>60.){
-              if((ptcorr>=70.)&&(ptcorr<85.)) {fh2DeltaRC60pt1->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R))fh2DeltaEtaC60pt1->Fill(part->Pt(),deltaEta);
-             if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC60pt1->Fill(part->Pt(),deltaPhi);}
-             if((ptcorr>=85.)&&(ptcorr<100.)) {fh2DeltaRC60pt2->Fill(part->Pt(),deltaR);
-              if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC60pt2->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC60pt2->Fill(part->Pt(),deltaPhi); }
-             if((ptcorr>=100.)&&(ptcorr<120.)) {fh2DeltaRC60pt3->Fill(part->Pt(),deltaR);
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC60pt3->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R)) fh2DeltaPhiC60pt3->Fill(part->Pt(),deltaPhi);}
-             if((ptcorr>=120.)&&(ptcorr<140.)) {fh2DeltaRC60pt4->Fill(part->Pt(),deltaR); 
-             if((part->Phi()<=phibig+R)&&(part->Phi()>=phibig-R)) fh2DeltaEtaC60pt4->Fill(part->Pt(),deltaEta);
-              if((part->Eta()<=etabig+R)&&(part->Eta()>=etabig-R))fh2DeltaPhiC60pt4->Fill(part->Pt(),deltaPhi);}}
-                 
-     } 
-     //end of track loop
-     Double_t coronain=rho*TMath::Pi()*(1.-0.8*0.8);
-     Double_t coronaout=rho*TMath::Pi()*(0.6*0.6-0.4*0.4);
-     if(centValue<10.){  
-     fh2SumPtInC10bkg->Fill(ptcorr,coronain/ptbig);       
-     fh2SumPtOutC10bkg->Fill(ptcorr,coronaout/ptbig);           
-     fh2SumPtInC10->Fill(ptcorr,sumPtIn/ptbig);
-     fh2SumPtOutC10->Fill(ptcorr,sumPtOut/ptbig); 
-     fh2SumPtOutC10b->Fill(ptcorr,sumPtOut/ptbig);      
-}
-     if((centValue>20.)&&(centValue<40.)){             
-     fh2SumPtInC20bkg->Fill(ptcorr,coronain/ptbig);
-     fh2SumPtOutC20bkg->Fill(ptcorr,coronaout/ptbig);    
-     fh2SumPtInC20->Fill(ptcorr,sumPtIn/ptbig);
-     fh2SumPtOutC20->Fill(ptcorr,sumPtOut/ptbig); } 
-     if((centValue>30.)&&(centValue<60.)){
-     fh2SumPtInC30bkg->Fill(ptcorr,coronain/ptbig);
-     fh2SumPtOutC30bkg->Fill(ptcorr,coronaout/ptbig);                    
-     fh2SumPtInC30->Fill(ptcorr,sumPtIn/ptbig);
-     fh2SumPtOutC30->Fill(ptcorr,sumPtOut/ptbig); } 
-     if(centValue>60.){         
-     fh2SumPtInC60bkg->Fill(ptcorr,coronain/ptbig);
-     fh2SumPtOutC60bkg->Fill(ptcorr,coronaout/ptbig);      
-     fh2SumPtInC60->Fill(ptcorr,sumPtIn/ptbig);
-     fh2SumPtOutC60->Fill(ptcorr,sumPtOut/ptbig);}      
-  
-     //////////////////ANGULAR STRUCTURE//////////////////////////////////////
+                 Double_t deltaR = jetbig->DeltaR(part);
+          Double_t deltaEta = etabig-part->Eta();
+          if(centValue<20.) fh2Ntriggers2->Fill(partback->Pt(),part->Pt());
+          if(fDoEventMixing==0 && fFlagOnlyRecoil==0){ 
+          Double_t deltaPhi=phibig-part->Phi();
+          if(deltaPhi<-0.5*TMath::Pi()) deltaPhi+=2.*TMath::Pi();
+          if(deltaPhi>3./2.*TMath::Pi()) deltaPhi-=2.*TMath::Pi();
+         Double_t pTcont=0;
+          if(fFlagJetHadron==0) pTcont=leadtrack->Pt();
+          if(fFlagJetHadron!=0) pTcont=leadtrackb->Pt(); 
+          Double_t jetEntries[8] = {centValue,ptcorr,part->Pt(),deltaR,deltaEta,deltaPhi,pTcont,partback->Pt()};  
+           fhnDeltaR->Fill(jetEntries);}
 
-     //tracks up to R=0.8 distant from the jet axis
-     if(fAngStructCloseTracks==1){
-      TList CloseTrackList;
-      Int_t nn=GetListOfTracksCloseToJet(&CloseTrackList,jetbig);
-      Double_t difR=0.04;
-      for(Int_t l=0;l<15;l++){
-      Double_t rr=l*0.1+0.1;
-       for(int it = 0;it<nn;++it){
-           AliVParticle *part1 = (AliVParticle*)CloseTrackList.At(it);
-           for(int itu=it+1;itu<CloseTrackList.GetEntries();itu++){      
-           AliVParticle *part2 = (AliVParticle*)CloseTrackList.At(itu);  
-           Double_t ptm=part1->Pt();
-           Double_t ptn=part2->Pt();   
-           Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
-                      Rnm=TMath::Sqrt(Rnm);
-                      Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));      
-                      Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
-                      if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                       down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
-                      if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                       down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}  
-                      if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                        down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
-                      if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
-                       down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}
-     }
-    
-     //only jet constituents
-      if(fAngStructCloseTracks==0){
 
-      Double_t difR=0.04;
-      for(Int_t l=0;l<15;l++){
-      Double_t rr=l*0.1+0.1;
+}
+        
+        
+          //end of track loop, we only do it if EM is switched off
+         
 
-    
-      AliAODTrack* part1;
-      AliAODTrack* part2;
-          for(Int_t it=0; it<nTracksGenJet; ++it){
-             part1 = (AliAODTrack*)(genTrackList->At(it));
-           for(Int_t itu=0; itu<nTracksGenJet; ++itu){
-             part2 = (AliAODTrack*)(genTrackList->At(itu));
-           Double_t ptm=part1->Pt();
-           Double_t ptn=part2->Pt();   
-           Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
-                      Rnm=TMath::Sqrt(Rnm);
-                      Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
-                      Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR))); 
-                      if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                       down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
-                      if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                       down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}  
-                      if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
-                                                        down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
-                      if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
-                       down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}}
 
 
-   
 
+       
 
 
 
+   }
+   if(injet>0) fh3JetDensity->Fill(ParticleList.GetEntries(),injet/accep,partback->Pt());
+   if(injet4>0)fh3JetDensityA4->Fill(ParticleList.GetEntries(),injet4/accep,partback->Pt());
+          //end of jet loop
 
 
 
 
+          if(fDoEventMixing>0){
+            //check before if the trigger exists
+            // fTrigBuffer[i][0] = zvtx
+            // fTrigBuffer[i][1] = phi
+            // fTrigBuffer[i][2] = eta
+            // fTrigBuffer[i][3] = pt_jet
+            // fTrigBuffer[i][4] = pt_trig
+            // fTrigBuffer[i][5]= centrality
+            if(fTindex==10) fTindex=0;
+            if(fTrigBuffer[fTindex][3]>0){
+           if (TMath::Abs(fTrigBuffer[fTindex][0]-primVtx->GetZ()<2.)){
+           if (TMath::Abs(fTrigBuffer[fTindex][5]-centValue<5)){  
+             
+                        for(int it = 0;it<nT;++it){
+                       AliVParticle *part = (AliVParticle*)ParticleList.At(it);         
+                        Double_t DPhi = fTrigBuffer[fTindex][1] - part->Phi();
+                        Double_t DEta = fTrigBuffer[fTindex][2] - part->Eta();
+                        Double_t DR=TMath::Sqrt(DPhi*DPhi+DEta*DEta);
+                        if(DPhi<-0.5*TMath::Pi()) DPhi+=2.*TMath::Pi();
+                        if(DPhi>3./2.*TMath::Pi()) DPhi-=2.*TMath::Pi();
+                        Double_t triggerEntries[7] = {centValue,fTrigBuffer[fTindex][3],part->Pt(),DR,DEta,DPhi,fTrigBuffer[fTindex][4]};                      
+                        fhnMixedEvents->Fill(triggerEntries);
+                        }
+                        fNevents=fNevents+1;  
+                        if(fNevents==10) fTindex=fTindex+1; 
+           }}}
+
+              if(fTindex==10&&fNevents==10) fCountAgain=0;
+
+               // Copy the triggers from the current event into the buffer.
+               //again, only if the trigger exists:
+              if(fCountAgain==0){
+               if(trigJet>-1){
+                AliAODJet* jetT = (AliAODJet*)(fListJets[0]->At(trigJet));                      AliVParticle *partT = (AliVParticle*)ParticleList.At(trigBBTrack);         
+                fTrigBuffer[fTrigBufferIndex][0] = primVtx->GetZ();
+                fTrigBuffer[fTrigBufferIndex][1] = jetT->Phi();
+                fTrigBuffer[fTrigBufferIndex][2] = jetT->Eta();
+                fTrigBuffer[fTrigBufferIndex][3] = jetT->Pt()-rho*jetT->EffectiveAreaCharged();
+                fTrigBuffer[fTrigBufferIndex][4] = partT->Pt();
+                fTrigBuffer[fTrigBufferIndex][5] = centValue;
+                fTrigBufferIndex++;
+                if(fTrigBufferIndex==9) {fTrigBufferIndex=0; 
+                                        fCountAgain=1;}
+               }
+              }
+         
+         }
 
 
 
+     //////////////////ANGULAR STRUCTURE//////////////////////////////////////
 
-   }
+     //tracks up to R=0.8 distant from the jet axis
+   //   if(fAngStructCloseTracks==1){
+   //    TList CloseTrackList;
+   //    Int_t nn=GetListOfTracksCloseToJet(&CloseTrackList,jetbig);
+   //    Double_t difR=0.04;
+   //    for(Int_t l=0;l<15;l++){
+   //    Double_t rr=l*0.1+0.1;
+   //     for(int it = 0;it<nn;++it){
+   //         AliVParticle *part1 = (AliVParticle*)CloseTrackList.At(it);
+   //         for(int itu=it+1;itu<CloseTrackList.GetEntries();itu++){      
+   //         AliVParticle *part2 = (AliVParticle*)CloseTrackList.At(itu);  
+   //         Double_t ptm=part1->Pt();
+   //         Double_t ptn=part2->Pt();        
+   //         Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
+   //                    Rnm=TMath::Sqrt(Rnm);
+   //                    Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));      
+   //                    Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
+   //                    if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                  down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
+   //                    if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                  down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}  
+   //                    if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                   down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
+   //                    if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                  down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}
+   //   }
+    
+   //   //only jet constituents
+   //    if(fAngStructCloseTracks==2){
 
+   //    Double_t difR=0.04;
+   //    for(Int_t l=0;l<15;l++){
+   //    Double_t rr=l*0.1+0.1;
 
-     //end loop over R=0.4 jets        
-   
-     for(Int_t l=0;l<15;l++){
-     Double_t rr=l*0.1+0.1;
-        if(down1[l]!=0){  
-       if(centValue<10.)fh2AngStructpt1C10->Fill(rr,rr*up1[l]/down1[l]);
-        if(centValue>20. && centValue<40.) fh2AngStructpt1C20->Fill(rr,rr*up1[l]/down1[l]);
-        if(centValue>30. && centValue<60.) fh2AngStructpt1C30->Fill(rr,rr*up1[l]/down1[l]);
-        if(centValue>60.) fh2AngStructpt1C60->Fill(rr,rr*up1[l]/down1[l]);}
-        if(down2[l]!=0){  
-       if(centValue<10.) fh2AngStructpt2C10->Fill(rr,rr*up2[l]/down2[l]);
-        if(centValue>20. && centValue<40.) fh2AngStructpt2C20->Fill(rr,rr*up2[l]/down2[l]);
-        if(centValue>30. && centValue<60.) fh2AngStructpt2C30->Fill(rr,rr*up2[l]/down2[l]);
-        if(centValue>60.) fh2AngStructpt2C60->Fill(rr,rr*up2[l]/down2[l]);}
-        if(down3[l]!=0){  
-       if(centValue<10.) fh2AngStructpt3C10->Fill(rr,rr*up3[l]/down3[l]);
-        if(centValue>20. && centValue<40.) fh2AngStructpt3C20->Fill(rr,rr*up3[l]/down3[l]);
-        if(centValue>30. && centValue<60.) fh2AngStructpt3C30->Fill(rr,rr*up3[l]/down3[l]);
-        if(centValue>60.) fh2AngStructpt3C60->Fill(rr,rr*up3[l]/down3[l]);}
-        if(down4[l]!=0){  
-       if(centValue<10.) fh2AngStructpt4C10->Fill(rr,rr*up4[l]/down4[l]);
-        if(centValue>20. && centValue<40.) fh2AngStructpt4C20->Fill(rr,rr*up4[l]/down4[l]);
-        if(centValue>30. && centValue<60.) fh2AngStructpt4C30->Fill(rr,rr*up4[l]/down4[l]);
-        if(centValue>60.) fh2AngStructpt4C60->Fill(rr,rr*up4[l]/down4[l]);}}
+    
+   //    AliAODTrack* part1;
+   //    AliAODTrack* part2;
+
+   //        TRefArray *genTrackListb = jetbig->GetRefTracks();
+   //        Int_t nTracksGenJetb = genTrackListb->GetEntriesFast();
+          
+             
+
+   //        for(Int_t it=0; it<nTracksGenJetb; ++it){
+   //           part1 = (AliAODTrack*)(genTrackListb->At(it));
+   //         for(Int_t itu=0; itu<nTracksGenJetb; ++itu){
+   //           part2 = (AliAODTrack*)(genTrackListb->At(itu));
+   //         Double_t ptm=part1->Pt();
+   //         Double_t ptn=part2->Pt();        
+   //         Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
+   //                    Rnm=TMath::Sqrt(Rnm);
+   //                    Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
+   //                    Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR))); 
+   //                    if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                  down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
+   //                    if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                  down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}  
+   //                    if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                                                   down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
+   //                    if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
+   //                  down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}}
+   // }
+     // //end loop over R=0.4 jets     
+     // if(fAngStructCloseTracks>0){
+     // for(Int_t l=0;l<15;l++){
+     // Double_t rr=l*0.1+0.1;
+     //    if(down1[l]!=0){  
+     //        if(centValue<10.)fh2AngStructpt1C10->Fill(rr,rr*up1[l]/down1[l]);
+     //    if(centValue>20. && centValue<40.) fh2AngStructpt1C20->Fill(rr,rr*up1[l]/down1[l]);
+     //    if(centValue>30. && centValue<60.) fh2AngStructpt1C30->Fill(rr,rr*up1[l]/down1[l]);
+     //    if(centValue>60.) fh2AngStructpt1C60->Fill(rr,rr*up1[l]/down1[l]);}
+     //    if(down2[l]!=0){  
+     //        if(centValue<10.) fh2AngStructpt2C10->Fill(rr,rr*up2[l]/down2[l]);
+     //    if(centValue>20. && centValue<40.) fh2AngStructpt2C20->Fill(rr,rr*up2[l]/down2[l]);
+     //    if(centValue>30. && centValue<60.) fh2AngStructpt2C30->Fill(rr,rr*up2[l]/down2[l]);
+     //    if(centValue>60.) fh2AngStructpt2C60->Fill(rr,rr*up2[l]/down2[l]);}
+     //    if(down3[l]!=0){  
+     //        if(centValue<10.) fh2AngStructpt3C10->Fill(rr,rr*up3[l]/down3[l]);
+     //    if(centValue>20. && centValue<40.) fh2AngStructpt3C20->Fill(rr,rr*up3[l]/down3[l]);
+     //    if(centValue>30. && centValue<60.) fh2AngStructpt3C30->Fill(rr,rr*up3[l]/down3[l]);
+     //    if(centValue>60.) fh2AngStructpt3C60->Fill(rr,rr*up3[l]/down3[l]);}
+     //    if(down4[l]!=0){  
+     //        if(centValue<10.) fh2AngStructpt4C10->Fill(rr,rr*up4[l]/down4[l]);
+     //    if(centValue>20. && centValue<40.) fh2AngStructpt4C20->Fill(rr,rr*up4[l]/down4[l]);
+     //    if(centValue>30. && centValue<60.) fh2AngStructpt4C30->Fill(rr,rr*up4[l]/down4[l]);
+     //    if(centValue>60.) fh2AngStructpt4C60->Fill(rr,rr*up4[l]/down4[l]);}}}
 
     
 
@@ -1062,41 +968,111 @@ void AliAnalysisTaskJetCore::Terminate(const Option_t *)
 
 
 
+  
 
 
+Int_t  AliAnalysisTaskJetCore::GetListOfTracks(TList *list){
 
+      Int_t iCount = 0;
+      AliAODEvent *aod = 0;
 
+     if(!fESD)aod = fAODIn;
+     else aod = fAODOut;   
+      Int_t index=-1;
+     Double_t ptmax=-10;
 
 
-
-
-Int_t  AliAnalysisTaskJetCore::GetListOfTracks(TList *list){
-
-    Int_t iCount = 0;
-  Int_t fFilterMask=272;
-    for(int it = 0;it < fAOD->GetNumberOfTracks();++it){
-      AliAODTrack *tr = fAOD->GetTrack(it);
+    
+     for(int it = 0;it < aod->GetNumberOfTracks();++it){
+      AliAODTrack *tr = aod->GetTrack(it);
+      Bool_t bGood = false;
+      if(fFilterType == 0)bGood = true;
+      else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
+      else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();       
       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
+      if(bGood==false) continue;
       if(TMath::Abs(tr->Eta())>0.9)continue;
       if(tr->Pt()<0.15)continue;
       list->Add(tr);
-      //cout<<fAOD->GetNumberOfTracks()<<" "<<tr->Pt()<<endl;
       iCount++;
-    }
+      if(fFilterMaskBestPt>0){// only set the trigger track index for good quality tracks
+       if(tr->TestFilterBit(fFilterMaskBestPt)){
+         if(tr->Pt()>ptmax){ 
+           ptmax=tr->Pt();     
+           index=iCount-1;
+         }
+       }
+      }
+      else{
+       if(tr->Pt()>ptmax){ 
+         ptmax=tr->Pt();       
+         index=iCount-1;
+       }
+      }
+     }
   
-   list->Sort();
-  return iCount;
+   
+    // else if (type == kTrackAODMCCharged) {
+    // TClonesArray *tca = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
+    // if(!tca)return iCount;
+    // for(int it = 0;it < tca->GetEntriesFast();++it){
+    //   AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));
+    //   if(!part)continue;
+    //   if(part->Pt()<0.15)continue;
+    //   if(!part->IsPhysicalPrimary())continue;
+    //   if(part->Charge()==0)continue;
+    //   if(TMath::Abs(part->Eta())>0.9)continue;
+    //   list->Add(part);
+    //   iCount++;
+    //   if(part->Pt()>ptmax){ ptmax=part->Pt();
+    //         index=iCount-1;}}}
+      return index;
  
 }
 
+   Int_t  AliAnalysisTaskJetCore::GetHardestTrackBackToJet(AliAODJet *jetbig){
+    AliAODEvent *aod = 0;
+    if(!fESD)aod = fAODIn;
+    else aod = fAODOut;     
+    Int_t index=-1;
+    Double_t ptmax=-10;
+    Double_t dphi=0;
+    Double_t dif=0;
+    Int_t iCount=0;
+    for(int it = 0;it < aod->GetNumberOfTracks();++it){
+      AliAODTrack *tr = aod->GetTrack(it);
+      if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
+      if(TMath::Abs(tr->Eta())>0.9)continue;
+      if(tr->Pt()<0.15)continue;
+      iCount=iCount+1;
+      dphi=RelativePhi(tr->Phi(),jetbig->Phi());  
+      if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;
+      if(tr->Pt()>ptmax){ ptmax=tr->Pt();
+      index=iCount-1;
+      dif=dphi;  }}
+  
+      return index;
+
+   }
+
+
+
+
+
+
+
+
+
  Int_t  AliAnalysisTaskJetCore::GetListOfTracksCloseToJet(TList *list,AliAODJet *jetbig){
 
     Int_t iCount = 0;
-  Int_t fFilterMask=272;
-    for(int it = 0;it < fAOD->GetNumberOfTracks();++it){
-      AliAODTrack *tr = fAOD->GetTrack(it);
+      AliAODEvent *aod = 0;
+     if(!fESD)aod = fAODIn;
+     else aod = fAODOut;   
+  
+      for(int it = 0;it < aod->GetNumberOfTracks();++it){
+      AliAODTrack *tr = aod->GetTrack(it);
       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
       if(TMath::Abs(tr->Eta())>0.9)continue;
       if(tr->Pt()<0.15)continue;
@@ -1126,7 +1102,9 @@ Int_t AliAnalysisTaskJetCore::GetNInputTracks()
 {
 
    Int_t nInputTracks = 0;
-
+     AliAODEvent *aod = 0;
+     if(!fESD)aod = fAODIn;
+     else aod = fAODOut;   
    TString jbname(fJetBranchName[1]);
    //needs complete event, use jets without background subtraction
    for(Int_t i=1; i<=3; ++i){
@@ -1137,7 +1115,7 @@ Int_t AliAnalysisTaskJetCore::GetNInputTracks()
    if(jbname.Contains("AODextra")) jbname.ReplaceAll("AODextra","AOD");
 
    if(fDebug) Printf("Multiplicity from jet branch %s", jbname.Data());
-   TClonesArray *tmpAODjets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(jbname.Data()));
+   TClonesArray *tmpAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(jbname.Data()));
    if(!tmpAODjets){
       Printf("Jet branch %s not found", jbname.Data());
       Printf("AliAnalysisTaskJetCore::GetNInputTracks FAILED");
@@ -1171,5 +1149,137 @@ Double_t AliAnalysisTaskJetCore::RelativePhi(Double_t mphi,Double_t vphi){
   return dphi;//dphi in [-Pi, Pi]
 }
 
+Int_t AliAnalysisTaskJetCore::GetPhiBin(Double_t phi)
+{
+    Int_t phibin=-1;
+    if(!(TMath::Abs(phi)<=2*TMath::Pi())){AliError("phi w.r.t. RP out of defined range");return -1;}
+    Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi)));
+    phibin=Int_t(fNRPBins*phiwrtrp/(0.5*TMath::Pi()));
+    if(phibin<0||phibin>=fNRPBins){AliError("Phi Bin not defined");}
+    return phibin;
+}
+
 
 
+
+THnSparse* AliAnalysisTaskJetCore::NewTHnSparseF(const char* name, UInt_t entries)
+{
+   // generate new THnSparseF, axes are defined in GetDimParams()
+
+   Int_t count = 0;
+   UInt_t tmp = entries;
+   while(tmp!=0){
+      count++;
+      tmp = tmp &~ -tmp;  // clear lowest bit
+   }
+
+   TString hnTitle(name);
+   const Int_t dim = count;
+   Int_t nbins[dim];
+   Double_t xmin[dim];
+   Double_t xmax[dim];
+
+   Int_t i=0;
+   Int_t c=0;
+   while(c<dim && i<32){
+      if(entries&(1<<i)){
+      
+         TString label("");
+         GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
+         hnTitle += Form(";%s",label.Data());
+         c++;
+      }
+      
+      i++;
+   }
+   hnTitle += ";";
+
+   return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
+}
+
+void AliAnalysisTaskJetCore::GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
+{
+   // stores label and binning of axis for THnSparse
+
+   const Double_t pi = TMath::Pi();
+   
+   switch(iEntry){
+      
+   case 0:
+      label = "V0 centrality (%)";
+     
+         nbins = 10;
+         xmin = 0.;
+         xmax = 100.;
+         break;
+      
+      
+   case 1:
+      label = "corrected jet pt";
+         nbins = 20;
+         xmin = 0.;
+         xmax = 200.;
+          break;
+      
+      
+   case 2:
+      label = "track pT";
+     
+         nbins = 9;
+         xmin = 0.;
+         xmax = 150;
+         break;
+      
+      
+    case 3:
+      label = "deltaR";
+      nbins = 15;
+      xmin = 0.;
+      xmax = 1.5;
+      break;
+
+
+
+   case 4:
+      label = "deltaEta";
+      nbins = 8;
+      xmin = -1.6;
+      xmax = 1.6;
+      break;
+
+
+  case 5:
+      label = "deltaPhi";
+      nbins = 90;
+      xmin = -0.5*pi;
+      xmax = 1.5*pi;
+      break;   
+   
+      
+        
+    case 6:
+      label = "leading track";
+      nbins = 13;
+      xmin = 0;
+      xmax = 50;
+      break;
+           
+     case 7:
+    
+      label = "trigger track";
+      nbins =10;
+      xmin = 0;
+      xmax = 50;
+      break;
+
+
+   
+  
+
+
+
+
+   }
+
+}
+