]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/AliAnalysisTaskFragmentationFunction.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskFragmentationFunction.cxx
index b67d9e225b0615b9b9d81b70605f9b653836cbee..1ed33b596a56d03a249b14350696293fc4fef3df 100644 (file)
@@ -51,6 +51,9 @@
 #include "AliVEvent.h"
 
 #include "AliAnalysisTaskFragmentationFunction.h"
+using std::cout;
+using std::endl;
+using std::cerr;
 
 ClassImp(AliAnalysisTaskFragmentationFunction)
 
@@ -124,7 +127,11 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()
    ,fQAJetHistosGenLeading(0)
    ,fQAJetHistosRecEffLeading(0)
    ,fFFHistosRecCuts(0)
+   ,fFFHistosRecCutsInc(0)
+   ,fFFHistosRecLeadingTrack(0)
    ,fFFHistosGen(0)
+   ,fFFHistosGenInc(0)
+   ,fFFHistosGenLeadingTrack(0)
    ,fQATrackHighPtThreshold(0)
    ,fFFNBinsJetPt(0)    
    ,fFFJetPtMin(0) 
@@ -320,7 +327,11 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const
   ,fQAJetHistosGenLeading(0)
   ,fQAJetHistosRecEffLeading(0)
   ,fFFHistosRecCuts(0)
+  ,fFFHistosRecCutsInc(0)
+  ,fFFHistosRecLeadingTrack(0)
   ,fFFHistosGen(0)
+  ,fFFHistosGenInc(0)
+  ,fFFHistosGenLeadingTrack(0)
   ,fQATrackHighPtThreshold(0) 
   ,fFFNBinsJetPt(0)    
   ,fFFJetPtMin(0) 
@@ -517,7 +528,11 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const
   ,fQAJetHistosGenLeading(copy.fQAJetHistosGenLeading)
   ,fQAJetHistosRecEffLeading(copy.fQAJetHistosRecEffLeading)
   ,fFFHistosRecCuts(copy.fFFHistosRecCuts)
+  ,fFFHistosRecCutsInc(copy.fFFHistosRecCutsInc)
+  ,fFFHistosRecLeadingTrack(copy.fFFHistosRecLeadingTrack)
   ,fFFHistosGen(copy.fFFHistosGen)
+  ,fFFHistosGenInc(copy.fFFHistosGenInc)
+  ,fFFHistosGenLeadingTrack(copy.fFFHistosGenLeadingTrack)
   ,fQATrackHighPtThreshold(copy.fQATrackHighPtThreshold) 
   ,fFFNBinsJetPt(copy.fFFNBinsJetPt)    
   ,fFFJetPtMin(copy.fFFJetPtMin) 
@@ -723,7 +738,11 @@ AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::oper
     fQAJetHistosGenLeading         = o.fQAJetHistosGenLeading;
     fQAJetHistosRecEffLeading      = o.fQAJetHistosRecEffLeading;
     fFFHistosRecCuts               = o.fFFHistosRecCuts;
+    fFFHistosRecCutsInc            = o.fFFHistosRecCutsInc;
+    fFFHistosRecLeadingTrack       = o.fFFHistosRecLeadingTrack;
     fFFHistosGen                   = o.fFFHistosGen;
+    fFFHistosGenInc                = o.fFFHistosGenInc;
+    fFFHistosGenLeadingTrack       = o.fFFHistosGenLeadingTrack;
     fQATrackHighPtThreshold        = o.fQATrackHighPtThreshold; 
     fFFNBinsJetPt                  = o.fFFNBinsJetPt;    
     fFFJetPtMin                    = o.fFFJetPtMin; 
@@ -1456,10 +1475,33 @@ void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
                                                     fFFNBinsZ , fFFZMin , fFFZMax );
 
-    fFFHistosGen            = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+
+    fFFHistosRecCutsInc      = new AliFragFuncHistos("RecCutsInc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
-                                                    fFFNBinsZ , fFFZMin , fFFZMax);
+                                                    fFFNBinsZ , fFFZMin , fFFZMax );
+
+
+    fFFHistosRecLeadingTrack  = new AliFragFuncHistos("RecLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax );
+    
+    fFFHistosGen             = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+    
+    fFFHistosGenInc           = new AliFragFuncHistos("GenInc", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+    
+    fFFHistosGenLeadingTrack  = new AliFragFuncHistos("GenLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
+                                                     fFFNBinsPt, fFFPtMin, fFFPtMax, 
+                                                     fFFNBinsXi, fFFXiMin, fFFXiMax,  
+                                                     fFFNBinsZ , fFFZMin , fFFZMax);
+
   } // end: FF
   
   // efficiency
@@ -1715,7 +1757,11 @@ void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
   
   if(fFFMode){
     fFFHistosRecCuts->DefineHistos();
+    fFFHistosRecCutsInc->DefineHistos();
+    fFFHistosRecLeadingTrack->DefineHistos();
     fFFHistosGen->DefineHistos();
+    fFFHistosGenInc->DefineHistos();
+    fFFHistosGenLeadingTrack->DefineHistos();
   }
   
   if(fEffMode){
@@ -1791,8 +1837,13 @@ void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
   // FF histograms
   if(fFFMode){
     fFFHistosRecCuts->AddToOutput(fCommonHistList);
+    fFFHistosRecCutsInc->AddToOutput(fCommonHistList);
+    fFFHistosRecLeadingTrack->AddToOutput(fCommonHistList);
+
     if(genJets && genTracks){
       fFFHistosGen->AddToOutput(fCommonHistList);
+      fFFHistosGenInc->AddToOutput(fCommonHistList);
+      fFFHistosGenLeadingTrack->AddToOutput(fCommonHistList);
     }
   }
 
@@ -1931,16 +1982,16 @@ void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
       if(ii==3)strTitJS = "_JetPt60to80";
       if(ii==4)strTitJS = "_JetPt80to100";
       
-      fProDelRPtSum[ii]            = new TProfile(Form("AvgPtSumDelR%s",strTitJS.Data()),Form("AvgPtSumDelR%s",strTitJS.Data()),100,0,1,0,250);
+      fProDelRPtSum[ii]            = new TProfile(Form("AvgPtSumDelR%s",strTitJS.Data()),Form("AvgPtSumDelR%s",strTitJS.Data()),50,0,1,0,250);
       if(genJets && genTracks) 
-       fProDelRPtSumGen[ii]       = new TProfile(Form("AvgPtSumDelRGen%s",strTitJS.Data()),Form("AvgPtSumDelRGen%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumGen[ii]       = new TProfile(Form("AvgPtSumDelRGen%s",strTitJS.Data()),Form("AvgPtSumDelRGen%s",strTitJS.Data()),50,0,1,0,250);
       if(fBckgMode) 
-       fProDelRPtSumBgrPerp2[ii]  = new TProfile(Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumBgrPerp2[ii]  = new TProfile(Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),Form("AvgPtSumDelRBgrPerp2%s",strTitJS.Data()),50,0,1,0,250);
       if(fEffMode){
-       fProDelRPtSumRecPrim[ii]   = new TProfile(Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),100,0,1,0,250);
-       fProDelRPtSumRecSecNS[ii]  = new TProfile(Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),100,0,1,0,250);
-       fProDelRPtSumRecSecS[ii]   = new TProfile(Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),100,0,1,0,250);
-       fProDelRPtSumRecSecSsc[ii] = new TProfile(Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),100,0,1,0,250);
+       fProDelRPtSumRecPrim[ii]   = new TProfile(Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),Form("AvgPtSumDelRRecPrim%s",strTitJS.Data()),50,0,1,0,250);
+       fProDelRPtSumRecSecNS[ii]  = new TProfile(Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecNS%s",strTitJS.Data()),50,0,1,0,250);
+       fProDelRPtSumRecSecS[ii]   = new TProfile(Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecS%s",strTitJS.Data()),50,0,1,0,250);
+       fProDelRPtSumRecSecSsc[ii] = new TProfile(Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),Form("AvgPtSumDelRRecSecSsc%s",strTitJS.Data()),50,0,1,0,250);
       }
     }
     
@@ -2319,181 +2370,187 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
       
       AliAODJet* jet = (AliAODJet*)(fJetsRecCuts->At(ij));
       if(fQAMode&2) fQAJetHistosRecCuts->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
-      
-      if(ij==0){ // leading jet
-       
-       if(fQAMode&2) fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );
-
-       Double_t ptFractionEmbedded = 0; 
-       AliAODJet* embeddedJet = 0; 
-
-       if(fBranchEmbeddedJets.Length()){ // find embedded jet
+       
+      if(fQAMode&2 && ij==0) fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );
 
-         Int_t indexEmbedded = -1;
-         for(Int_t i=0; i<nEmbeddedJets; i++){
-           if(iEmbeddedMatchIndex[i] == ij){
-             indexEmbedded      = i;
-             ptFractionEmbedded = fEmbeddedPtFraction[i];
-           }
-         }
+      Double_t ptFractionEmbedded = 0; 
+      AliAODJet* embeddedJet = 0; 
 
-         fh1IndexEmbedded->Fill(indexEmbedded);
-         fh1FractionPtEmbedded->Fill(ptFractionEmbedded);
-         
-         if(indexEmbedded>-1){ 
-           
-           embeddedJet = dynamic_cast<AliAODJet*>(fJetsEmbedded->At(indexEmbedded));
-           if(!embeddedJet) continue;
+      if(fBranchEmbeddedJets.Length()){ // find embedded jet
 
-           Double_t deltaPt = jet->Pt() - embeddedJet->Pt();
-           Double_t deltaR  = jet->DeltaR((AliVParticle*) (embeddedJet)); 
-           
-           fh2DeltaPtVsJetPtEmbedded->Fill(embeddedJet->Pt(),deltaPt);
-           fh2DeltaPtVsRecJetPtEmbedded->Fill(jet->Pt(),deltaPt);
-           fh1DeltaREmbedded->Fill(deltaR);
+       Int_t indexEmbedded = -1;
+       for(Int_t i=0; i<nEmbeddedJets; i++){
+         if(iEmbeddedMatchIndex[i] == ij){
+           indexEmbedded      = i;
+           ptFractionEmbedded = fEmbeddedPtFraction[i];
          }
        }
 
-       // get tracks in jet
-       TList* jettracklist = new TList();
-       Double_t sumPt      = 0.;
-       Bool_t isBadJet     = kFALSE;
-
-       if(GetFFRadius()<=0){
-         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
-       } else {
-         if(fUseEmbeddedJetAxis){
-           if(embeddedJet) GetJetTracksPointing(fTracksRecCuts, jettracklist, embeddedJet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
-         }
-         else              GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
-       }
-       
-       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;
+       fh1IndexEmbedded->Fill(indexEmbedded);
+       fh1FractionPtEmbedded->Fill(ptFractionEmbedded);
        
-       if(isBadJet) continue; 
-
-       if(ptFractionEmbedded>=fCutFractionPtEmbedded){ // if no embedding: ptFraction = cutFraction = 0
-         
-         for(Int_t it=0; it<jettracklist->GetSize(); ++it){
-
-           AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));
-           if(!trackVP)continue;
-
-            AliAODTrack * aodtrack  = dynamic_cast<AliAODTrack*>(jettracklist->At(it));
-            if(!aodtrack) continue;
-
-           TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());
-           
-           Float_t jetPt   = jet->Pt();
-           if(fUseEmbeddedJetPt){
-             if(embeddedJet) jetPt = embeddedJet->Pt();
-             else jetPt = 0;
-           }
-           Float_t trackPt = trackV->Pt();
-
-
-           Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
+       if(indexEmbedded>-1){ 
            
-           if(fFFMode) fFFHistosRecCuts->FillFF(trackPt, jetPt, incrementJetPt);
+         embeddedJet = dynamic_cast<AliAODJet*>(fJetsEmbedded->At(indexEmbedded));
+         if(!embeddedJet) continue;
 
-           delete trackV;
-         }
+         Double_t deltaPt = jet->Pt() - embeddedJet->Pt();
+         Double_t deltaR  = jet->DeltaR((AliVParticle*) (embeddedJet)); 
          
-         // background ff
-         if(fBckgMode){
-           if(fBckgType[0]!=kBckgNone)
-             FillBckgHistos(fBckgType[0], fTracksRecCuts, fJetsRecCuts, jet,  
-                            fFFBckgHisto0RecCuts,fQABckgHisto0RecCuts, fh1BckgMult0);
-           if(fBckgType[1]!=kBckgNone)
-             FillBckgHistos(fBckgType[1], fTracksRecCuts, fJetsRecCuts, jet,
-                            fFFBckgHisto1RecCuts,fQABckgHisto1RecCuts, fh1BckgMult1);
-           if(fBckgType[2]!=kBckgNone)
-             FillBckgHistos(fBckgType[2], fTracksRecCuts, fJetsRecCuts, jet, 
-                            fFFBckgHisto2RecCuts,fQABckgHisto2RecCuts, fh1BckgMult2);
-           if(fBckgType[3]!=kBckgNone)
-             FillBckgHistos(fBckgType[3], fTracksRecCuts, fJetsRecCuts, jet, 
-                            fFFBckgHisto3RecCuts,fQABckgHisto3RecCuts, fh1BckgMult3);
-           if(fBckgType[4]!=kBckgNone)
-             FillBckgHistos(fBckgType[4], fTracksRecCuts, fJetsRecCuts, jet, 
-                            fFFBckgHisto4RecCuts,fQABckgHisto4RecCuts, fh1BckgMult4);
-         } // end if(fBckgMode)
-        
-
-         if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJet, fProDelRPtSum, fProDelR80pcPt);
-          
-         delete jettracklist;  
-
-       } // end: cut embedded ratio
-      } // end: leading jet
-    } // end: rec. jets after cuts
-    
-    // generated jets
-    for(Int_t ij=0; ij<nGenJets; ++ij){
-      
-      AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));
-      if(!jet)continue;
-      if(fQAMode&2) fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
-      
-      if(ij==0){ // leading jet
-       
-       if(fQAMode&2) fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
-
-       TList* jettracklist = new TList();
-       Double_t sumPt      = 0.;
-       Bool_t isBadJet     = kFALSE;
-       
-       if(GetFFRadius()<=0){
-         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
-       } else {
-         GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+         fh2DeltaPtVsJetPtEmbedded->Fill(embeddedJet->Pt(),deltaPt);
+         fh2DeltaPtVsRecJetPtEmbedded->Fill(jet->Pt(),deltaPt);
+         fh1DeltaREmbedded->Fill(deltaR);
        }
+      }
+
+      // get tracks in jet
+      TList* jettracklist = new TList();
+      Double_t sumPt      = 0.;
+      Bool_t isBadJet     = kFALSE;
+
+      if(GetFFRadius()<=0){
+       GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+      } else {
+       if(fUseEmbeddedJetAxis){
+         if(embeddedJet) GetJetTracksPointing(fTracksRecCuts, jettracklist, embeddedJet, 
+                                              GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+         }
+       else              GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, 
+                                              GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+      }
        
-       if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;;
-       if(isBadJet) continue; 
+      if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;
+      
+      if(isBadJet) continue; 
 
+      if(ptFractionEmbedded>=fCutFractionPtEmbedded){ // if no embedding: ptFraction = cutFraction = 0
+         
        for(Int_t it=0; it<jettracklist->GetSize(); ++it){
          
          AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));
          if(!trackVP)continue;
+
+         AliAODTrack * aodtrack  = dynamic_cast<AliAODTrack*>(jettracklist->At(it));
+         if(!aodtrack) continue;
+         
          TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());
          
          Float_t jetPt   = jet->Pt();
+         if(fUseEmbeddedJetPt){
+           if(embeddedJet) jetPt = embeddedJet->Pt();
+           else jetPt = 0;
+         }
          Float_t trackPt = trackV->Pt();
-         
+
          Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
+           
+         if(fFFMode && (ij==0)) fFFHistosRecCuts->FillFF(trackPt, jetPt, incrementJetPt);
+         if(fFFMode)            fFFHistosRecCutsInc->FillFF(trackPt, jetPt, incrementJetPt);
          
-         if(fFFMode) fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt );
+         if(it==0){ // leading track 
+           if(fFFMode) fFFHistosRecLeadingTrack->FillFF( trackPt, jetPt, kTRUE);
+         }
          
          delete trackV;
        }
-
-       if(fBckgMode){
+         
+       // background ff
+       if(fBckgMode && (ij==0)){
          if(fBckgType[0]!=kBckgNone)
-           FillBckgHistos(fBckgType[0], fTracksGen, fJetsGen, jet,
-                          fFFBckgHisto0Gen, fQABckgHisto0Gen);
+           FillBckgHistos(fBckgType[0], fTracksRecCuts, fJetsRecCuts, jet,  
+                          fFFBckgHisto0RecCuts,fQABckgHisto0RecCuts, fh1BckgMult0);
          if(fBckgType[1]!=kBckgNone)
-           FillBckgHistos(fBckgType[1], fTracksGen, fJetsGen, jet,
-                          fFFBckgHisto1Gen, fQABckgHisto1Gen);
+           FillBckgHistos(fBckgType[1], fTracksRecCuts, fJetsRecCuts, jet,
+                          fFFBckgHisto1RecCuts,fQABckgHisto1RecCuts, fh1BckgMult1);
          if(fBckgType[2]!=kBckgNone)
-           FillBckgHistos(fBckgType[2], fTracksGen, fJetsGen, jet,
-                          fFFBckgHisto2Gen, fQABckgHisto2Gen);
+           FillBckgHistos(fBckgType[2], fTracksRecCuts, fJetsRecCuts, jet, 
+                          fFFBckgHisto2RecCuts,fQABckgHisto2RecCuts, fh1BckgMult2);
          if(fBckgType[3]!=kBckgNone)
-           FillBckgHistos(fBckgType[3], fTracksGen, fJetsGen, jet,
-                          fFFBckgHisto3Gen, fQABckgHisto3Gen);
+           FillBckgHistos(fBckgType[3], fTracksRecCuts, fJetsRecCuts, jet, 
+                          fFFBckgHisto3RecCuts,fQABckgHisto3RecCuts, fh1BckgMult3);
          if(fBckgType[4]!=kBckgNone)
-           FillBckgHistos(fBckgType[4], fTracksGen, fJetsGen, jet,
-                          fFFBckgHisto4Gen, fQABckgHisto4Gen);
+           FillBckgHistos(fBckgType[4], fTracksRecCuts, fJetsRecCuts, jet, 
+                          fFFBckgHisto4RecCuts,fQABckgHisto4RecCuts, fh1BckgMult4);
        } // end if(fBckgMode)
        
 
-       if(fJSMode) FillJetShape(jet, jettracklist, fProNtracksLeadingJetGen, fProDelRPtSumGen, fProDelR80pcPtGen);
+       if(fJSMode && (ij==0)) FillJetShape(jet, jettracklist, fProNtracksLeadingJet, fProDelRPtSum, fProDelR80pcPt);
+          
+       delete jettracklist;    
+       
+      } // end: cut embedded ratio
+    } // end: rec. jets after cuts
+    
+    // generated jets
+    for(Int_t ij=0; ij<nGenJets; ++ij){
+      
+      AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));
+      if(!jet)continue;
+
+      if(fQAMode&2) fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
+
+      if(fQAMode&2 && (ij==0)) fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());
 
-       delete jettracklist;
+      TList* jettracklist = new TList();
+      Double_t sumPt      = 0.;
+      Bool_t isBadJet     = kFALSE;
+       
+      if(GetFFRadius()<=0){
+       GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
+      } else {
+       GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);
       }
-    }
-  } // end: QA, FF and intra-jet
+      
+      if(GetFFMinNTracks()>0 && jettracklist->GetSize()<=GetFFMinNTracks()) isBadJet = kTRUE;;
+      
+      if(isBadJet) continue; 
 
+      for(Int_t it=0; it<jettracklist->GetSize(); ++it){
+       
+       AliVParticle*   trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));
+       if(!trackVP)continue;
+       TLorentzVector* trackV  = new TLorentzVector(trackVP->Px(),trackVP->Py(),trackVP->Pz(),trackVP->P());
+       
+       Float_t jetPt   = jet->Pt();
+       Float_t trackPt = trackV->Pt();
+       
+       Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
+       
+       if(fFFMode && (ij==0)) fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt );
+       if(fFFMode)            fFFHistosGenInc->FillFF( trackPt, jetPt, incrementJetPt );
+       
+       if(it==0){ // leading track
+         if(fFFMode) fFFHistosGenLeadingTrack->FillFF( trackPt, jetPt, kTRUE );          
+       }
+       
+       delete trackV;
+      }
+
+      if(fBckgMode && (ij==0)){
+       if(fBckgType[0]!=kBckgNone)
+         FillBckgHistos(fBckgType[0], fTracksGen, fJetsGen, jet,
+                        fFFBckgHisto0Gen, fQABckgHisto0Gen);
+       if(fBckgType[1]!=kBckgNone)
+         FillBckgHistos(fBckgType[1], fTracksGen, fJetsGen, jet,
+                        fFFBckgHisto1Gen, fQABckgHisto1Gen);
+       if(fBckgType[2]!=kBckgNone)
+         FillBckgHistos(fBckgType[2], fTracksGen, fJetsGen, jet,
+                        fFFBckgHisto2Gen, fQABckgHisto2Gen);
+       if(fBckgType[3]!=kBckgNone)
+         FillBckgHistos(fBckgType[3], fTracksGen, fJetsGen, jet,
+                        fFFBckgHisto3Gen, fQABckgHisto3Gen);
+       if(fBckgType[4]!=kBckgNone)
+         FillBckgHistos(fBckgType[4], fTracksGen, fJetsGen, jet,
+                        fFFBckgHisto4Gen, fQABckgHisto4Gen);
+      } // end if(fBckgMode)
       
+      if(fJSMode && (ij==0)) FillJetShape(jet, jettracklist, fProNtracksLeadingJetGen, fProDelRPtSumGen, fProDelR80pcPtGen);
+      
+      delete jettracklist;
+    }
+  } // end: QA, FF and intra-jet
+  
+  
   // ____ efficiency _______________________________
 
   if(fEffMode && (fJetTypeRecEff != kJetsUndef)){
@@ -2646,7 +2703,6 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
          TList* perpjettracklistGen1 = new TList();
          TList* perpjettracklistGen2 = new TList();
 
-         Double_t sumPtGenPerp  = 0.;
          Double_t sumPtGenPerp1 = 0.;
          Double_t sumPtGenPerp2 = 0.;
          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp1); 
@@ -2654,36 +2710,31 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
 
          perpjettracklistGen->AddAll(perpjettracklistGen1);
          perpjettracklistGen->AddAll(perpjettracklistGen2);
-         sumPtGenPerp = 0.5*(sumPtGenPerp1+sumPtGenPerp2);
 
          TList* perpjettracklistGenSecNS  = new TList();
          TList* perpjettracklistGenSecNS1 = new TList();
          TList* perpjettracklistGenSecNS2 = new TList();
 
-          Double_t sumPtGenPerpNS;
-          Double_t sumPtGenPerpNS1;
-          Double_t sumPtGenPerpNS2;
+          Double_t sumPtGenPerpNS1 = 0;
+          Double_t sumPtGenPerpNS2 = 0;
           GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS1); 
           GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS2); 
 
          perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS1);
          perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS2);
-         sumPtGenPerpNS = 0.5*(sumPtGenPerpNS1+sumPtGenPerpNS2);
 
 
          TList* perpjettracklistGenSecS  = new TList();
          TList* perpjettracklistGenSecS1 = new TList();
          TList* perpjettracklistGenSecS2 = new TList();
 
-          Double_t sumPtGenPerpS;
-          Double_t sumPtGenPerpS1;
-          Double_t sumPtGenPerpS2;
+          Double_t sumPtGenPerpS1 = 0;
+          Double_t sumPtGenPerpS2 = 0;
           GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS1); 
           GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS2); 
 
          perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS1);
          perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS2);
-         sumPtGenPerpS = 0.5*(sumPtGenPerpS1+sumPtGenPerpS2);
 
 
           if(perpjettracklistGen->GetSize() != perpjettracklistGen1->GetSize() + perpjettracklistGen2->GetSize()){
@@ -2880,23 +2931,28 @@ Int_t AliAnalysisTaskFragmentationFunction::GetListOfTracks(TList *list, Int_t t
        if(type==kTrackAODMCChargedSecNS || type==kTrackAODMCChargedSecS){
          Bool_t isFromStrange = kFALSE;
          Int_t iMother = part->GetMother();
-         if(iMother >= 0){
-           AliAODMCParticle *partM = dynamic_cast<AliAODMCParticle*>(tca->At(iMother));
-           if(!partM) continue;
 
-           Int_t codeM =  TMath::Abs(partM->GetPdgCode());
-           Int_t mfl = Int_t (codeM/ TMath::Power(10, Int_t(TMath::Log10(codeM))));
-           if  (mfl == 3 && codeM != 3) isFromStrange = kTRUE;
+          if(iMother < 0) continue; // throw out PYTHIA stack partons + incoming protons
+
+         AliAODMCParticle *partM = dynamic_cast<AliAODMCParticle*>(tca->At(iMother));
+         if(!partM) continue;
+
+         Int_t codeM =  TMath::Abs(partM->GetPdgCode());
+         Int_t mfl = Int_t (codeM/ TMath::Power(10, Int_t(TMath::Log10(codeM))));
+         if  (mfl == 3 && codeM != 3) isFromStrange = kTRUE;
            
-           // if(mfl ==3){
-           //   cout<<" mfl "<<mfl<<" codeM "<<partM->GetPdgCode()<<" code this track "<<part->GetPdgCode()<<endl; 
-           //   cout<<" index this track "<<it<<" index daughter 0 "<<partM->GetDaughter(0)<<" 1 "<<partM->GetDaughter(1)<<endl; 
-           // }
+          if(codeM == 130) isFromStrange = kTRUE; // K0 long
+          if(part->IsSecondaryFromMaterial()) isFromStrange = kFALSE; // strange resonances from hadronic showers ? 
 
-           if(type==kTrackAODMCChargedSecNS && isFromStrange) continue;
-           if(type==kTrackAODMCChargedSecS  && !isFromStrange) continue;
-         }
+         // if(mfl ==3){
+         //   cout<<" mfl "<<mfl<<" codeM "<<partM->GetPdgCode()<<" code this track "<<part->GetPdgCode()<<endl; 
+         //   cout<<" index this track "<<it<<" index daughter 0 "<<partM->GetDaughter(0)<<" 1 "<<partM->GetDaughter(1)<<endl; 
+         // }
+
+         if(type==kTrackAODMCChargedSecNS && isFromStrange) continue;
+         if(type==kTrackAODMCChargedSecS  && !isFromStrange) continue;
        }
+       
 
        if(type==kTrackAODMCChargedAcceptance && 
           (     part->Eta() > fTrackEtaMax
@@ -3212,7 +3268,7 @@ void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, c
 
 // ________________________________________________________________________________________________________________________________________________________
 void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist, TList* outputlist, const AliAODJet* jet, 
-                                                                  const Double_t radius, Double_t& sumPt, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)
+                                                               const Double_t& radius, Double_t& sumPt, const Double_t& minPtL, const Double_t& maxPt, Bool_t& isBadPt)
 {
   // fill list of tracks in cone around jet axis  
 
@@ -3253,7 +3309,8 @@ void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist
 }
 
 // _________________________________________________________________________________________________________________________________________________________________
-void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, const AliAODJet* jet, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)
+void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, const AliAODJet* jet, const Double_t& minPtL, 
+                                                                const Double_t& maxPt, Bool_t& isBadPt)
 {
   // list of jet tracks from trackrefs
   
@@ -3359,7 +3416,7 @@ void  AliAnalysisTaskFragmentationFunction::AssociateGenRec(TList* tracksAODMCCh
 
 // _____________________________________________________________________________________________________________________________________________
 void AliAnalysisTaskFragmentationFunction::FillSingleTrackHistosRecGen(AliFragFuncQATrackHistos* trackQAGen, AliFragFuncQATrackHistos* trackQARec, TList* tracksGen, 
-                                                                      const TArrayI& indexAODTr, const TArrayS& isRefGen, const Bool_t scaleStrangeness){
+                                                                      const TArrayI& indexAODTr, const TArrayS& isRefGen, Bool_t scaleStrangeness){
 
   // fill QA for single track reconstruction efficiency
   
@@ -3389,7 +3446,8 @@ void AliAnalysisTaskFragmentationFunction::FillSingleTrackHistosRecGen(AliFragFu
 
     if(iRec>=0 && trackQARec){
       if(scaleStrangeness){ 
-       Double_t weight = GetMCStrangenessFactor(ptGen);
+       //Double_t weight = GetMCStrangenessFactor(ptGen);
+       Double_t weight = GetMCStrangenessFactorCMS(gentrack);    
        trackQARec->FillTrackQA(etaGen, phiGen, ptGen, kFALSE, 0, kTRUE, weight);
       }
       else trackQARec->FillTrackQA(etaGen, phiGen, ptGen);
@@ -3401,7 +3459,7 @@ void AliAnalysisTaskFragmentationFunction::FillSingleTrackHistosRecGen(AliFragFu
 
 void  AliAnalysisTaskFragmentationFunction::FillJetTrackHistosRec(AliFragFuncHistos* ffhistRec, AliAODJet* jet, 
                                                                  TList* jetTrackList, const TList* tracksGen, const TList* tracksRec, const TArrayI& indexAODTr,
-                                                                 const TArrayS& isRefGen, TList* jetTrackListTR, const Bool_t scaleStrangeness,
+                                                                 const TArrayS& isRefGen, TList* jetTrackListTR, Bool_t scaleStrangeness,
                                                                  Bool_t fillJS, TProfile* hProNtracksLeadingJet, TProfile** hProDelRPtSum, TProfile* hProDelR80pcPt)
 {
   // fill objects for jet track reconstruction efficiency or secondaries contamination 
@@ -3469,7 +3527,9 @@ void  AliAnalysisTaskFragmentationFunction::FillJetTrackHistosRec(AliFragFuncHis
        Bool_t incrementJetPt = kFALSE; 
        
        if(scaleStrangeness){
-         Double_t weight = GetMCStrangenessFactor(ptGen);        
+         //Double_t weight = GetMCStrangenessFactor(ptGen);
+         Double_t weight = GetMCStrangenessFactorCMS(gentrack);          
+
          ffhistRec->FillFF( trackPt, jetPtRec, incrementJetPt, 0, kTRUE, weight );
        }
        else{
@@ -3931,7 +3991,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
   // get median cluster
 
   AliAODJet* medianCluster = 0;
-  Double_t   medianDensity = 0;
+  //Double_t   medianDensity = 0;
 
   if(TMath::Odd(nBckgClusters)){
     
@@ -3941,7 +4001,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
     Double_t clusterPt = medianCluster->Pt();
     Double_t area      = medianCluster->EffectiveAreaCharged();
     
-    if(area>0) medianDensity = clusterPt/area;
+    //if(area>0) medianDensity = clusterPt/area;
   }
   else{
 
@@ -3961,7 +4021,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
     Double_t area2      = medianCluster2->EffectiveAreaCharged();
     if(area2>0) density2 = clusterPt2/area2;
     
-    medianDensity = 0.5*(density1+density2);
+    //medianDensity = 0.5*(density1+density2);
     
     medianCluster = ( (fRandom->Rndm()>0.5) ? medianCluster1 : medianCluster2 );  // select one randomly to avoid adding areas
   }
@@ -4553,9 +4613,8 @@ void AliAnalysisTaskFragmentationFunction::FillBckgHistos(Int_t type, TList* inp
   delete tracklistout3jetsStat;  
 }
 
-// -----------------------------------------------------------------
-
-Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Double_t pt)
+//_____________________________________________________________________________________
+Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Double_t& pt)
 {
   // factor strangeness data/MC as function of pt from UE analysis (Sara Vallero)
 
@@ -4578,7 +4637,149 @@ Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Doub
   return alpha;
 }
 
-// ---------------------------------------------------------------------------------------------------------------------------------
+//__________________________________________________________________________________________________
+Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactorCMS(AliAODMCParticle* daughter)
+{
+  // strangeness ratio MC/data as function of mother pt from CMS data in |eta|<2.0
+
+  TClonesArray *tca = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
+  if(!tca) return 1;
+
+  AliAODMCParticle* currentMother   = daughter;
+  AliAODMCParticle* currentDaughter = daughter;
+
+
+  // find first primary mother K0s, Lambda or Xi   
+  while(1){
+
+    Int_t daughterPDG   = currentDaughter->GetPdgCode();       
+
+    Int_t motherLabel   = currentDaughter->GetMother();
+    if(motherLabel >= tca->GetEntriesFast()){ // protection
+      currentMother = currentDaughter; 
+      break; 
+    }
+
+    currentMother     = (AliAODMCParticle*) tca->At(motherLabel);
+
+    if(!currentMother){ 
+      currentMother = currentDaughter; 
+      break; 
+    }
+
+    Int_t motherPDG   = currentMother->GetPdgCode();   
+    // phys. primary found ?   
+    if(currentMother->IsPhysicalPrimary()) break; 
+
+    if(TMath::Abs(daughterPDG) == 321){ // K+/K- e.g. from phi (ref data not feeddown corrected)
+      currentMother = currentDaughter; break; 
+    }          
+    if(TMath::Abs(motherPDG) == 310 ){ // K0s e.g. from phi (ref data not feeddown corrected)
+      break; 
+    }  
+    if(TMath::Abs(motherPDG) == 3212 && TMath::Abs(daughterPDG) == 3122){ // mother Sigma0, daughter Lambda (this case not included in feeddown corr.)
+      currentMother = currentDaughter; break; 
+    }
+
+    currentDaughter = currentMother;
+  }
+
+
+  Int_t motherPDG   = currentMother->GetPdgCode();     
+  Double_t motherPt = currentMother->Pt();     
+
+  Double_t fac = 1;
+
+  if(TMath::Abs(motherPDG) == 310 || TMath::Abs(motherPDG)==321){ // K0s / K+ / K-
+
+    if(0.00 <= motherPt && motherPt < 0.20) fac = 0.768049;
+    else if(0.20 <= motherPt && motherPt < 0.40) fac = 0.732933;
+    else if(0.40 <= motherPt && motherPt < 0.60) fac = 0.650298;
+    else if(0.60 <= motherPt && motherPt < 0.80) fac = 0.571332;
+    else if(0.80 <= motherPt && motherPt < 1.00) fac = 0.518734;
+    else if(1.00 <= motherPt && motherPt < 1.20) fac = 0.492543;
+    else if(1.20 <= motherPt && motherPt < 1.40) fac = 0.482704;
+    else if(1.40 <= motherPt && motherPt < 1.60) fac = 0.488056;
+    else if(1.60 <= motherPt && motherPt < 1.80) fac = 0.488861;
+    else if(1.80 <= motherPt && motherPt < 2.00) fac = 0.492862;
+    else if(2.00 <= motherPt && motherPt < 2.20) fac = 0.504332;
+    else if(2.20 <= motherPt && motherPt < 2.40) fac = 0.501858;
+    else if(2.40 <= motherPt && motherPt < 2.60) fac = 0.512970;
+    else if(2.60 <= motherPt && motherPt < 2.80) fac = 0.524131;
+    else if(2.80 <= motherPt && motherPt < 3.00) fac = 0.539130;
+    else if(3.00 <= motherPt && motherPt < 3.20) fac = 0.554101;
+    else if(3.20 <= motherPt && motherPt < 3.40) fac = 0.560348;
+    else if(3.40 <= motherPt && motherPt < 3.60) fac = 0.568869;
+    else if(3.60 <= motherPt && motherPt < 3.80) fac = 0.583310;
+    else if(3.80 <= motherPt && motherPt < 4.00) fac = 0.604818;
+    else if(4.00 <= motherPt && motherPt < 5.00) fac = 0.632630;
+    else if(5.00 <= motherPt && motherPt < 6.00) fac = 0.710070;
+    else if(6.00 <= motherPt && motherPt < 8.00) fac = 0.736365;
+    else if(8.00 <= motherPt && motherPt < 10.00) fac = 0.835865;
+  }
+
+  if(TMath::Abs(motherPDG) == 3122){ // Lambda
+
+    if(0.00 <= motherPt && motherPt < 0.20) fac = 0.645162;
+    else if(0.20 <= motherPt && motherPt < 0.40) fac = 0.627431;
+    else if(0.40 <= motherPt && motherPt < 0.60) fac = 0.457136;
+    else if(0.60 <= motherPt && motherPt < 0.80) fac = 0.384369;
+    else if(0.80 <= motherPt && motherPt < 1.00) fac = 0.330597;
+    else if(1.00 <= motherPt && motherPt < 1.20) fac = 0.309571;
+    else if(1.20 <= motherPt && motherPt < 1.40) fac = 0.293620;
+    else if(1.40 <= motherPt && motherPt < 1.60) fac = 0.283709;
+    else if(1.60 <= motherPt && motherPt < 1.80) fac = 0.282047;
+    else if(1.80 <= motherPt && motherPt < 2.00) fac = 0.277261;
+    else if(2.00 <= motherPt && motherPt < 2.20) fac = 0.275772;
+    else if(2.20 <= motherPt && motherPt < 2.40) fac = 0.280726;
+    else if(2.40 <= motherPt && motherPt < 2.60) fac = 0.288540;
+    else if(2.60 <= motherPt && motherPt < 2.80) fac = 0.288315;
+    else if(2.80 <= motherPt && motherPt < 3.00) fac = 0.296619;
+    else if(3.00 <= motherPt && motherPt < 3.20) fac = 0.302993;
+    else if(3.20 <= motherPt && motherPt < 3.40) fac = 0.338121;
+    else if(3.40 <= motherPt && motherPt < 3.60) fac = 0.349800;
+    else if(3.60 <= motherPt && motherPt < 3.80) fac = 0.356802;
+    else if(3.80 <= motherPt && motherPt < 4.00) fac = 0.391202;
+    else if(4.00 <= motherPt && motherPt < 5.00) fac = 0.422573;
+    else if(5.00 <= motherPt && motherPt < 6.00) fac = 0.573815;
+    else if(6.00 <= motherPt && motherPt < 8.00) fac = 0.786984;
+    else if(8.00 <= motherPt && motherPt < 10.00) fac = 1.020021;
+  }    
+  
+  if(TMath::Abs(motherPDG) == 3312 || TMath::Abs(motherPDG) == 3322){ // xi 
+
+    if(0.00 <= motherPt && motherPt < 0.20) fac = 0.666620;
+    else if(0.20 <= motherPt && motherPt < 0.40) fac = 0.575908;
+    else if(0.40 <= motherPt && motherPt < 0.60) fac = 0.433198;
+    else if(0.60 <= motherPt && motherPt < 0.80) fac = 0.340901;
+    else if(0.80 <= motherPt && motherPt < 1.00) fac = 0.290896;
+    else if(1.00 <= motherPt && motherPt < 1.20) fac = 0.236074;
+    else if(1.20 <= motherPt && motherPt < 1.40) fac = 0.218681;
+    else if(1.40 <= motherPt && motherPt < 1.60) fac = 0.207763;
+    else if(1.60 <= motherPt && motherPt < 1.80) fac = 0.222848;
+    else if(1.80 <= motherPt && motherPt < 2.00) fac = 0.208806;
+    else if(2.00 <= motherPt && motherPt < 2.20) fac = 0.197275;
+    else if(2.20 <= motherPt && motherPt < 2.40) fac = 0.183645;
+    else if(2.40 <= motherPt && motherPt < 2.60) fac = 0.188788;
+    else if(2.60 <= motherPt && motherPt < 2.80) fac = 0.188282;
+    else if(2.80 <= motherPt && motherPt < 3.00) fac = 0.207442;
+    else if(3.00 <= motherPt && motherPt < 3.20) fac = 0.240388;
+    else if(3.20 <= motherPt && motherPt < 3.40) fac = 0.241916;
+    else if(3.40 <= motherPt && motherPt < 3.60) fac = 0.208276;
+    else if(3.60 <= motherPt && motherPt < 3.80) fac = 0.234550;
+    else if(3.80 <= motherPt && motherPt < 4.00) fac = 0.251689;
+    else if(4.00 <= motherPt && motherPt < 5.00) fac = 0.310204;
+    else if(5.00 <= motherPt && motherPt < 6.00) fac = 0.343492;  
+  }
+  
+  Double_t weight = 1;
+  if(fac > 0) weight = 1/fac;
+       
+  return weight;
+}
+
+// _________________________________________________________________________________
 void  AliAnalysisTaskFragmentationFunction::FillJetShape(AliAODJet* jet, TList* list,  
                                                         TProfile* hProNtracksLeadingJet, TProfile** hProDelRPtSum, TProfile* hProDelR80pcPt, 
                                                         Double_t dPhiUE, Double_t normUE, Bool_t scaleStrangeness){
@@ -4589,8 +4790,6 @@ void  AliAnalysisTaskFragmentationFunction::FillJetShape(AliAODJet* jet, TList*
   Int_t nJetTracks = list->GetEntries();
   
   Float_t PtSumA[kNbinsR]     = {0.0};
-  Float_t PtWeightsA[kNbinsR] = {0.0};
-  Float_t nTracksA[kNbinsR]   = {0.0};
   
   Float_t *delRA     = new Float_t[nJetTracks];
   Float_t *trackPtA  = new Float_t[nJetTracks];
@@ -4637,9 +4836,9 @@ void  AliAnalysisTaskFragmentationFunction::FillJetShape(AliAODJet* jet, TList*
       Float_t xlow = kBinWidthR*(ibin-1);
       Float_t xup  = kBinWidthR*ibin;
       if(xlow <= dR && dR < xup){
-       PtSumA[ibin-1]     += track->Pt();
-       PtWeightsA[ibin-1] += weight; 
-       nTracksA[ibin-1]   += 1; 
+
+       if(scaleStrangeness) PtSumA[ibin-1]     += track->Pt()*weight;
+       else                 PtSumA[ibin-1]     += track->Pt();
       }
     }
   } // track loop
@@ -4658,11 +4857,8 @@ void  AliAnalysisTaskFragmentationFunction::FillJetShape(AliAODJet* jet, TList*
       if(k==4){jetPtMin=80.0;jetPtMax=100.0;}
       if(jetPt>jetPtMin && jetPt<jetPtMax){
        
-       if(scaleStrangeness){
-         if(nTracksA[ibin]) hProDelRPtSum[k]->Fill(fR,PtSumA[ibin],PtWeightsA[ibin]/nTracksA[ibin]);
-         else               hProDelRPtSum[k]->Fill(fR,PtSumA[ibin],0);
-       }
-       else                 hProDelRPtSum[k]->Fill(fR,PtSumA[ibin]);
+        hProDelRPtSum[k]->Fill(fR,PtSumA[ibin]);
+       
       }
     }
   }