]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.cxx
calc match fraction from unsubtracted jet
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskEmcalJetMass.cxx
index fc998d62b101521e546c9881105b39fb5f37b87f..4577a6fe8b2448db6253588ea702cae5144018c3 100644 (file)
@@ -39,96 +39,191 @@ ClassImp(AliAnalysisTaskEmcalJetMass)
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() : 
   AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetMass", kTRUE),
   fContainerBase(0),
+  fContainerUnsub(1),
   fMinFractionShared(0),
-  fJetMassAvg(0),
-  fh2PtJet1VsLeadPtAllSel(0),
-  fh2PtJet1VsLeadPtTagged(0),
-  fh2PtVsMassJet1All(0),
-  fh2PtVsMassJet1Tagged(0),
+  fUseUnsubJet(0),
+  fJetMassType(kRaw),
+  fh3PtJet1VsMassVsLeadPtAllSel(0),
+  fh3PtJet1VsMassVsLeadPtTagged(0),
+  fh3PtJet1VsMassVsLeadPtTaggedMatch(0),
   fpPtVsMassJet1All(0),
   fpPtVsMassJet1Tagged(0),
+  fpPtVsMassJet1TaggedMatch(0),
   fh2MassVsAreaJet1All(0),
   fh2MassVsAreaJet1Tagged(0),
+  fh2MassVsAreaJet1TaggedMatch(0),
   fh2MassVsNConstJet1All(0),
   fh2MassVsNConstJet1Tagged(0),
+  fh2MassVsNConstJet1TaggedMatch(0),
+  fh3PtJet1VsRatVsLeadPtAllSel(0),
+  fh3PtJet1VsRatVsLeadPtTagged(0),
+  fh3PtJet1VsRatVsLeadPtTaggedMatch(0),
+  fpPtVsRatJet1All(0),
+  fpPtVsRatJet1Tagged(0),
+  fpPtVsRatJet1TaggedMatch(0),
+  fh2RatVsAreaJet1All(0),
+  fh2RatVsAreaJet1Tagged(0),
+  fh2RatVsAreaJet1TaggedMatch(0),
+  fh2RatVsNConstJet1All(0),
+  fh2RatVsNConstJet1Tagged(0),
+  fh2RatVsNConstJet1TaggedMatch(0),
   fh2EtMassOverEtRSq(0)
 {
   // Default constructor.
 
-  fh2PtJet1VsLeadPtAllSel      = new TH2F*[fNcentBins];
-  fh2PtJet1VsLeadPtTagged      = new TH2F*[fNcentBins];
-  fh2PtVsMassJet1All           = new TH2F*[fNcentBins];
-  fh2PtVsMassJet1Tagged        = new TH2F*[fNcentBins];
-  fpPtVsMassJet1All            = new TProfile*[fNcentBins];
-  fpPtVsMassJet1Tagged         = new TProfile*[fNcentBins];
-  fh2MassVsAreaJet1All         = new TH2F*[fNcentBins];
-  fh2MassVsAreaJet1Tagged      = new TH2F*[fNcentBins];
-  fh2MassVsNConstJet1All       = new TH2F*[fNcentBins];
-  fh2MassVsNConstJet1Tagged    = new TH2F*[fNcentBins];
-  fh2EtMassOverEtRSq           = new TH2F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtAllSel        = new TH3F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtTagged        = new TH3F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtTaggedMatch   = new TH3F*[fNcentBins];
+  fpPtVsMassJet1All                    = new TProfile*[fNcentBins];
+  fpPtVsMassJet1Tagged                 = new TProfile*[fNcentBins];
+  fpPtVsMassJet1TaggedMatch            = new TProfile*[fNcentBins];
+  fh2MassVsAreaJet1All                 = new TH2F*[fNcentBins];
+  fh2MassVsAreaJet1Tagged              = new TH2F*[fNcentBins];
+  fh2MassVsAreaJet1TaggedMatch         = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1All               = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1Tagged            = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1TaggedMatch       = new TH2F*[fNcentBins];
+
+  fh3PtJet1VsRatVsLeadPtAllSel        = new TH3F*[fNcentBins];
+  fh3PtJet1VsRatVsLeadPtTagged        = new TH3F*[fNcentBins];
+  fh3PtJet1VsRatVsLeadPtTaggedMatch   = new TH3F*[fNcentBins];
+  fpPtVsRatJet1All                    = new TProfile*[fNcentBins];
+  fpPtVsRatJet1Tagged                 = new TProfile*[fNcentBins];
+  fpPtVsRatJet1TaggedMatch            = new TProfile*[fNcentBins];
+  fh2RatVsAreaJet1All                 = new TH2F*[fNcentBins];
+  fh2RatVsAreaJet1Tagged              = new TH2F*[fNcentBins];
+  fh2RatVsAreaJet1TaggedMatch         = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1All               = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1Tagged            = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1TaggedMatch       = new TH2F*[fNcentBins];
+
+  fh2EtMassOverEtRSq                   = new TH2F*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
-    fh2PtJet1VsLeadPtAllSel[i]     = 0;
-    fh2PtJet1VsLeadPtTagged[i]     = 0;
-    fh2PtVsMassJet1All[i]          = 0;
-    fh2PtVsMassJet1Tagged[i]       = 0;
-    fpPtVsMassJet1All[i]           = 0;
-    fpPtVsMassJet1Tagged[i]        = 0;
-    fh2MassVsAreaJet1All[i]        = 0;
-    fh2MassVsAreaJet1Tagged[i]     = 0;
-    fh2MassVsNConstJet1All[i]      = 0;
-    fh2MassVsNConstJet1Tagged[i]   = 0;
-    fh2EtMassOverEtRSq[i]          = 0;
+    fh3PtJet1VsMassVsLeadPtAllSel[i]        = 0;
+    fh3PtJet1VsMassVsLeadPtTagged[i]        = 0;
+    fh3PtJet1VsMassVsLeadPtTaggedMatch[i]   = 0;
+    fpPtVsMassJet1All[i]                    = 0;
+    fpPtVsMassJet1Tagged[i]                 = 0;
+    fpPtVsMassJet1TaggedMatch[i]            = 0;
+    fh2MassVsAreaJet1All[i]                 = 0;
+    fh2MassVsAreaJet1Tagged[i]              = 0;
+    fh2MassVsAreaJet1TaggedMatch[i]         = 0;
+    fh2MassVsNConstJet1All[i]               = 0;
+    fh2MassVsNConstJet1Tagged[i]            = 0;
+    fh2MassVsNConstJet1TaggedMatch[i]       = 0;
+
+    fh3PtJet1VsRatVsLeadPtAllSel[i]        = 0;
+    fh3PtJet1VsRatVsLeadPtTagged[i]        = 0;
+    fh3PtJet1VsRatVsLeadPtTaggedMatch[i]   = 0;
+    fpPtVsRatJet1All[i]                    = 0;
+    fpPtVsRatJet1Tagged[i]                 = 0;
+    fpPtVsRatJet1TaggedMatch[i]            = 0;
+    fh2RatVsAreaJet1All[i]                 = 0;
+    fh2RatVsAreaJet1Tagged[i]              = 0;
+    fh2RatVsAreaJet1TaggedMatch[i]         = 0;
+    fh2RatVsNConstJet1All[i]               = 0;
+    fh2RatVsNConstJet1Tagged[i]            = 0;
+    fh2RatVsNConstJet1TaggedMatch[i]       = 0;
+
+    fh2EtMassOverEtRSq[i]                  = 0;
   }
 
   SetMakeGeneralHistograms(kTRUE);
-  
 }
 
 //________________________________________________________________________
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),  
   fContainerBase(0),
+  fContainerUnsub(1),
   fMinFractionShared(0),
-  fJetMassAvg(0),
-  fh2PtJet1VsLeadPtAllSel(0),
-  fh2PtJet1VsLeadPtTagged(0),
-  fh2PtVsMassJet1All(0),
-  fh2PtVsMassJet1Tagged(0),
+  fUseUnsubJet(0),
+  fJetMassType(kRaw),
+  fh3PtJet1VsMassVsLeadPtAllSel(0),
+  fh3PtJet1VsMassVsLeadPtTagged(0),
+  fh3PtJet1VsMassVsLeadPtTaggedMatch(0),
   fpPtVsMassJet1All(0),
   fpPtVsMassJet1Tagged(0),
+  fpPtVsMassJet1TaggedMatch(0),
   fh2MassVsAreaJet1All(0),
   fh2MassVsAreaJet1Tagged(0),
+  fh2MassVsAreaJet1TaggedMatch(0),
   fh2MassVsNConstJet1All(0),
   fh2MassVsNConstJet1Tagged(0),
+  fh2MassVsNConstJet1TaggedMatch(0),
+  fh3PtJet1VsRatVsLeadPtAllSel(0),
+  fh3PtJet1VsRatVsLeadPtTagged(0),
+  fh3PtJet1VsRatVsLeadPtTaggedMatch(0),
+  fpPtVsRatJet1All(0),
+  fpPtVsRatJet1Tagged(0),
+  fpPtVsRatJet1TaggedMatch(0),
+  fh2RatVsAreaJet1All(0),
+  fh2RatVsAreaJet1Tagged(0),
+  fh2RatVsAreaJet1TaggedMatch(0),
+  fh2RatVsNConstJet1All(0),
+  fh2RatVsNConstJet1Tagged(0),
+  fh2RatVsNConstJet1TaggedMatch(0),
   fh2EtMassOverEtRSq(0)
 {
   // Standard constructor.
 
-  fh2PtJet1VsLeadPtAllSel      = new TH2F*[fNcentBins];
-  fh2PtJet1VsLeadPtTagged      = new TH2F*[fNcentBins];
-  fh2PtVsMassJet1All           = new TH2F*[fNcentBins];
-  fh2PtVsMassJet1Tagged        = new TH2F*[fNcentBins];
-  fpPtVsMassJet1All            = new TProfile*[fNcentBins];
-  fpPtVsMassJet1Tagged         = new TProfile*[fNcentBins];
-  fh2MassVsAreaJet1All         = new TH2F*[fNcentBins];
-  fh2MassVsAreaJet1Tagged      = new TH2F*[fNcentBins];
-  fh2MassVsNConstJet1All       = new TH2F*[fNcentBins];
-  fh2MassVsNConstJet1Tagged    = new TH2F*[fNcentBins];
-  fh2EtMassOverEtRSq           = new TH2F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtAllSel        = new TH3F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtTagged        = new TH3F*[fNcentBins];
+  fh3PtJet1VsMassVsLeadPtTaggedMatch   = new TH3F*[fNcentBins];
+  fpPtVsMassJet1All                    = new TProfile*[fNcentBins];
+  fpPtVsMassJet1Tagged                 = new TProfile*[fNcentBins];
+  fpPtVsMassJet1TaggedMatch            = new TProfile*[fNcentBins];
+  fh2MassVsAreaJet1All                 = new TH2F*[fNcentBins];
+  fh2MassVsAreaJet1Tagged              = new TH2F*[fNcentBins];
+  fh2MassVsAreaJet1TaggedMatch         = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1All               = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1Tagged            = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1TaggedMatch       = new TH2F*[fNcentBins];
+
+  fh3PtJet1VsRatVsLeadPtAllSel         = new TH3F*[fNcentBins];
+  fh3PtJet1VsRatVsLeadPtTagged         = new TH3F*[fNcentBins];
+  fh3PtJet1VsRatVsLeadPtTaggedMatch    = new TH3F*[fNcentBins];
+  fpPtVsRatJet1All                     = new TProfile*[fNcentBins];
+  fpPtVsRatJet1Tagged                  = new TProfile*[fNcentBins];
+  fpPtVsRatJet1TaggedMatch             = new TProfile*[fNcentBins];
+  fh2RatVsAreaJet1All                  = new TH2F*[fNcentBins];
+  fh2RatVsAreaJet1Tagged               = new TH2F*[fNcentBins];
+  fh2RatVsAreaJet1TaggedMatch          = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1All                = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1Tagged             = new TH2F*[fNcentBins];
+  fh2RatVsNConstJet1TaggedMatch        = new TH2F*[fNcentBins];
+
+  fh2EtMassOverEtRSq                   = new TH2F*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
-    fh2PtJet1VsLeadPtAllSel[i]     = 0;
-    fh2PtJet1VsLeadPtTagged[i]     = 0;
-    fh2PtVsMassJet1All[i]          = 0;
-    fh2PtVsMassJet1Tagged[i]       = 0;
-    fpPtVsMassJet1All[i]           = 0;
-    fpPtVsMassJet1Tagged[i]        = 0;
-    fh2MassVsAreaJet1All[i]        = 0;
-    fh2MassVsAreaJet1Tagged[i]     = 0;
-    fh2MassVsNConstJet1All[i]      = 0;
-    fh2MassVsNConstJet1Tagged[i]   = 0;
-    fh2EtMassOverEtRSq[i]          = 0;
+    fh3PtJet1VsMassVsLeadPtAllSel[i]        = 0;
+    fh3PtJet1VsMassVsLeadPtTagged[i]        = 0;
+    fh3PtJet1VsMassVsLeadPtTaggedMatch[i]   = 0;
+    fpPtVsMassJet1All[i]                    = 0;
+    fpPtVsMassJet1Tagged[i]                 = 0;
+    fpPtVsMassJet1TaggedMatch[i]            = 0;
+    fh2MassVsAreaJet1All[i]                 = 0;
+    fh2MassVsAreaJet1Tagged[i]              = 0;
+    fh2MassVsAreaJet1TaggedMatch[i]         = 0;
+    fh2MassVsNConstJet1All[i]               = 0;
+    fh2MassVsNConstJet1Tagged[i]            = 0;
+    fh2MassVsNConstJet1TaggedMatch[i]       = 0;
+
+    fh3PtJet1VsRatVsLeadPtAllSel[i]         = 0;
+    fh3PtJet1VsRatVsLeadPtTagged[i]         = 0;
+    fh3PtJet1VsRatVsLeadPtTaggedMatch[i]    = 0;
+    fpPtVsRatJet1All[i]                     = 0;
+    fpPtVsRatJet1Tagged[i]                  = 0;
+    fpPtVsRatJet1TaggedMatch[i]             = 0;
+    fh2RatVsAreaJet1All[i]                  = 0;
+    fh2RatVsAreaJet1Tagged[i]               = 0;
+    fh2RatVsAreaJet1TaggedMatch[i]          = 0;
+    fh2RatVsNConstJet1All[i]                = 0;
+    fh2RatVsNConstJet1Tagged[i]             = 0;
+    fh2RatVsNConstJet1TaggedMatch[i]        = 0;
+
+    fh2EtMassOverEtRSq[i]                   = 0;
   }
 
   SetMakeGeneralHistograms(kTRUE);
@@ -150,55 +245,59 @@ void AliAnalysisTaskEmcalJetMass::UserCreateOutputObjects()
   Bool_t oldStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
 
-  const Int_t nBinsPt  = 250;
+  const Int_t nBinsPt  = 200;
   const Double_t minPt = -50.;
-  const Double_t maxPt = 200.;
+  const Double_t maxPt = 150.;
+
+  const Int_t nBinsM  = 100;
+  const Double_t minM = -20.;
+  const Double_t maxM = 80.;
 
-  const Int_t nBinsM  = 150;
-  const Double_t minM = -50.;
-  const Double_t maxM = 100.;
+  const Int_t nBinsR  = 100;
+  const Double_t minR = -0.2;
+  const Double_t maxR = 0.8;
 
-  const Int_t nBinsArea = 100;
+  const Int_t nBinsArea = 50;
   const Double_t minArea = 0.;
   const Double_t maxArea = 1.;
 
-  const Int_t nBinsNConst = 100;
+  const Int_t nBinsNConst = 200;
   const Double_t minNConst = 0.;
-  const Double_t maxNConst = 500.;
+  const Double_t maxNConst = 200.;
 
   TString histName = "";
   TString histTitle = "";
   for (Int_t i = 0; i < fNcentBins; i++) {
-    histName = TString::Format("fh2PtJet1VsLeadPtAllSel_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{p}_{T,lead trk}",histName.Data());
-    fh2PtJet1VsLeadPtAllSel[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,20,0.,20.);
-    fOutput->Add(fh2PtJet1VsLeadPtAllSel[i]);
-
-    histName = TString::Format("fh2PtJet1VsLeadPtTagged_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{p}_{T,lead trk}",histName.Data());
-    fh2PtJet1VsLeadPtTagged[i] =  new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,20,0.,20.);
-    fOutput->Add(fh2PtJet1VsLeadPtTagged[i]);
-
-    histName = TString::Format("fh2PtVsMassJet1All_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data());
-    fh2PtVsMassJet1All[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM);
-    fOutput->Add(fh2PtVsMassJet1All[i]);
-
-    histName = TString::Format("fh2PtVsMassJet1Tagged_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data());
-    fh2PtVsMassJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM);
-    fOutput->Add(fh2PtVsMassJet1Tagged[i]);
+    histName = TString::Format("fh3PtJet1VsMassVsLeadPtAllSel_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsMassVsLeadPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsMassVsLeadPtAllSel[i]);
+
+    histName = TString::Format("fh3PtJet1VsMassVsLeadPtTagged_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsMassVsLeadPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsMassVsLeadPtTagged[i]);
+
+    histName = TString::Format("fh3PtJet1VsMassVsLeadPtTaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsMassVsLeadPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsMassVsLeadPtTaggedMatch[i]);
 
     histName = TString::Format("fpPtVsMassJet1All_%d",i);
     histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}",histName.Data());
-    fpPtVsMassJet1All[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsM,minM,maxM);
+    fpPtVsMassJet1All[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
     fOutput->Add(fpPtVsMassJet1All[i]);
 
     histName = TString::Format("fpPtVsMassJet1Tagged_%d",i);
     histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}",histName.Data());
-    fpPtVsMassJet1Tagged[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsM,minM,maxM);
+    fpPtVsMassJet1Tagged[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
     fOutput->Add(fpPtVsMassJet1Tagged[i]);
 
+    histName = TString::Format("fpPtVsMassJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}",histName.Data());
+    fpPtVsMassJet1TaggedMatch[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
+    fOutput->Add(fpPtVsMassJet1TaggedMatch[i]);
+
     histName = TString::Format("fh2MassVsAreaJet1All_%d",i);
     histTitle = TString::Format("%s;#it{M}_{jet1};#it{A}",histName.Data());
     fh2MassVsAreaJet1All[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsArea,minArea,maxArea);
@@ -209,6 +308,11 @@ void AliAnalysisTaskEmcalJetMass::UserCreateOutputObjects()
     fh2MassVsAreaJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsArea,minArea,maxArea);
     fOutput->Add(fh2MassVsAreaJet1Tagged[i]);
 
+    histName = TString::Format("fh2MassVsAreaJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1};#it{A}",histName.Data());
+    fh2MassVsAreaJet1TaggedMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsArea,minArea,maxArea);
+    fOutput->Add(fh2MassVsAreaJet1TaggedMatch[i]);
+
     histName = TString::Format("fh2MassVsNConstJet1All_%d",i);
     histTitle = TString::Format("%s;#it{M}_{jet1};#it{N}_{constituents}",histName.Data());
     fh2MassVsNConstJet1All[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsNConst,minNConst,maxNConst);
@@ -216,9 +320,76 @@ void AliAnalysisTaskEmcalJetMass::UserCreateOutputObjects()
 
     histName = TString::Format("fh2MassVsNConstJet1Tagged_%d",i);
     histTitle = TString::Format("%s;#it{M}_{jet1};#it{N}_{constituents}",histName.Data());
-    fh2MassVsNConstJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsNConst,minNConst,maxNConst);
+    fh2MassVsNConstJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsNConst,minNConst,maxNConst);
     fOutput->Add(fh2MassVsNConstJet1Tagged[i]);
 
+    histName = TString::Format("fh2MassVsNConstJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1};#it{N}_{constituents}",histName.Data());
+    fh2MassVsNConstJet1TaggedMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsNConst,minNConst,maxNConst);
+    fOutput->Add(fh2MassVsNConstJet1TaggedMatch[i]);
+
+    //
+    histName = TString::Format("fh3PtJet1VsRatVsLeadPtAllSel_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsRatVsLeadPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsRatVsLeadPtAllSel[i]);
+
+    histName = TString::Format("fh3PtJet1VsRatVsLeadPtTagged_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsRatVsLeadPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsRatVsLeadPtTagged[i]);
+
+    histName = TString::Format("fh3PtJet1VsRatVsLeadPtTaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,lead trk}",histName.Data());
+    fh3PtJet1VsRatVsLeadPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,20,0.,20.);
+    fOutput->Add(fh3PtJet1VsRatVsLeadPtTaggedMatch[i]);
+
+    histName = TString::Format("fpPtVsRatJet1All_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}/#it{p}_{T,jet1}",histName.Data());
+    fpPtVsRatJet1All[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
+    fOutput->Add(fpPtVsRatJet1All[i]);
+
+    histName = TString::Format("fpPtVsRatJet1Tagged_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}/#it{p}_{T,jet1}",histName.Data());
+    fpPtVsRatJet1Tagged[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
+    fOutput->Add(fpPtVsRatJet1Tagged[i]);
+
+    histName = TString::Format("fpPtVsRatJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet1};Avg #it{M}_{jet1}/#it{p}_{T,jet1}",histName.Data());
+    fpPtVsRatJet1TaggedMatch[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
+    fOutput->Add(fpPtVsRatJet1TaggedMatch[i]);
+
+    histName = TString::Format("fh2RatVsAreaJet1All_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{A}",histName.Data());
+    fh2RatVsAreaJet1All[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsArea,minArea,maxArea);
+    fOutput->Add(fh2RatVsAreaJet1All[i]);
+
+    histName = TString::Format("fh2RatVsAreaJet1Tagged_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{A}",histName.Data());
+    fh2RatVsAreaJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsArea,minArea,maxArea);
+    fOutput->Add(fh2RatVsAreaJet1Tagged[i]);
+
+    histName = TString::Format("fh2RatVsAreaJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{A}",histName.Data());
+    fh2RatVsAreaJet1TaggedMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsArea,minArea,maxArea);
+    fOutput->Add(fh2RatVsAreaJet1TaggedMatch[i]);
+
+    histName = TString::Format("fh2RatVsNConstJet1All_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{N}_{constituents}",histName.Data());
+    fh2RatVsNConstJet1All[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsNConst,minNConst,maxNConst);
+    fOutput->Add(fh2RatVsNConstJet1All[i]);
+
+    histName = TString::Format("fh2RatVsNConstJet1Tagged_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{N}_{constituents}",histName.Data());
+    fh2RatVsNConstJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsNConst,minNConst,maxNConst);
+    fOutput->Add(fh2RatVsNConstJet1Tagged[i]);
+
+    histName = TString::Format("fh2RatVsNConstJet1TaggedMatch_%d",i);
+    histTitle = TString::Format("%s;#it{M}_{jet1}/#it{p}_{T,jet1};#it{N}_{constituents}",histName.Data());
+    fh2RatVsNConstJet1TaggedMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsR,minR,maxR,nBinsNConst,minNConst,maxNConst);
+    fOutput->Add(fh2RatVsNConstJet1TaggedMatch[i]);
+
+
     histName = TString::Format("fh2EtMassOverEtRSq_%d",i);
     histTitle = TString::Format("%s;#it{E}_{T};(#it{M}/(#it{E}_{T}#it{R}))^{2}",histName.Data());
     fh2EtMassOverEtRSq[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,100,0.,1.);
@@ -259,30 +430,71 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
   if(jetCont) {
     jetCont->ResetCurrentID();
     while((jet1 = jetCont->GetNextAcceptJet())) {
-      Double_t fraction = jetCont->GetFractionSharedPt(jet1);
-      if(fMinFractionShared>0. && fraction<fMinFractionShared) continue;
 
       Double_t ptJet1 = jet1->Pt() - GetRhoVal(fContainerBase)*jet1->Area();
-      fh2PtJet1VsLeadPtAllSel[fCentBin]->Fill(ptJet1,jet1->MaxTrackPt());
-      fh2PtVsMassJet1All[fCentBin]->Fill(ptJet1,jet1->M());
-      fpPtVsMassJet1All[fCentBin]->Fill(ptJet1,jet1->M());
-      fh2MassVsAreaJet1All[fCentBin]->Fill(jet1->M(),jet1->Area());
-      fh2MassVsNConstJet1All[fCentBin]->Fill(jet1->M(),jet1->GetNumberOfConstituents());
+      Double_t mJet1 = GetJetMass(jet1);
+      Double_t rat = -1.;
+      if(ptJet1<0. || ptJet1>0.) rat = mJet1/ptJet1;
+      fh3PtJet1VsMassVsLeadPtAllSel[fCentBin]->Fill(ptJet1,mJet1,jet1->MaxTrackPt());
+      fpPtVsMassJet1All[fCentBin]->Fill(ptJet1,mJet1);
+      fh2MassVsAreaJet1All[fCentBin]->Fill(mJet1,jet1->Area());
+      fh2MassVsNConstJet1All[fCentBin]->Fill(mJet1,jet1->GetNumberOfConstituents());
+
+      fh3PtJet1VsRatVsLeadPtAllSel[fCentBin]->Fill(ptJet1,rat,jet1->MaxTrackPt());
+      fpPtVsRatJet1All[fCentBin]->Fill(ptJet1,rat);
+      fh2RatVsAreaJet1All[fCentBin]->Fill(rat,jet1->Area());
+      fh2RatVsNConstJet1All[fCentBin]->Fill(rat,jet1->GetNumberOfConstituents());
       
       if(jet1->GetTagStatus()<1 || !jet1->GetTaggedJet())
        continue;
 
-      fh2PtJet1VsLeadPtTagged[fCentBin]->Fill(ptJet1,jet1->MaxTrackPt());
-      fh2PtVsMassJet1Tagged[fCentBin]->Fill(ptJet1,jet1->M());
-      fpPtVsMassJet1Tagged[fCentBin]->Fill(ptJet1,jet1->M());
-      fh2MassVsAreaJet1Tagged[fCentBin]->Fill(jet1->M(),jet1->Area());
-      fh2MassVsNConstJet1Tagged[fCentBin]->Fill(jet1->M(),jet1->GetNumberOfConstituents());
+      fh3PtJet1VsMassVsLeadPtTagged[fCentBin]->Fill(ptJet1,mJet1,jet1->MaxTrackPt());
+      fpPtVsMassJet1Tagged[fCentBin]->Fill(ptJet1,mJet1);
+      fh2MassVsAreaJet1Tagged[fCentBin]->Fill(mJet1,jet1->Area());
+      fh2MassVsNConstJet1Tagged[fCentBin]->Fill(mJet1,jet1->GetNumberOfConstituents());
+
+      fh3PtJet1VsRatVsLeadPtTagged[fCentBin]->Fill(ptJet1,rat,jet1->MaxTrackPt());
+      fpPtVsRatJet1Tagged[fCentBin]->Fill(ptJet1,rat);
+      fh2RatVsAreaJet1Tagged[fCentBin]->Fill(rat,jet1->Area());
+      fh2RatVsNConstJet1Tagged[fCentBin]->Fill(rat,jet1->GetNumberOfConstituents());
+
+      Double_t fraction = -1.;
+      if(fUseUnsubJet) {
+       AliEmcalJet *jetUS = NULL;
+       AliJetContainer *jetContUS = GetJetContainer(fContainerUnsub);
+       Int_t ifound = 0;
+       Int_t ilab = -1;
+       for(Int_t i = 0; i<jetContUS->GetNJets(); i++) {
+         jetUS = jetContUS->GetJet(i);
+         if(jetUS->GetLabel()==jet1->GetLabel()) {
+           ifound++;
+           if(ifound==1) ilab = i;
+         }
+       }
+       if(ifound>1) AliDebug(2,Form("Found %d partners",ifound));
+       if(ifound==0) jetUS = 0x0;
+       else          jetUS = jetContUS->GetJet(ilab);
+       fraction = jetCont->GetFractionSharedPt(jetUS);
+      } else
+       fraction = jetCont->GetFractionSharedPt(jet1);
+
+      if(fMinFractionShared>0. && fraction>fMinFractionShared) {
+       fh3PtJet1VsMassVsLeadPtTaggedMatch[fCentBin]->Fill(ptJet1,mJet1,jet1->MaxTrackPt());
+       fpPtVsMassJet1TaggedMatch[fCentBin]->Fill(ptJet1,mJet1);
+       fh2MassVsAreaJet1TaggedMatch[fCentBin]->Fill(mJet1,jet1->Area());
+       fh2MassVsNConstJet1TaggedMatch[fCentBin]->Fill(mJet1,jet1->GetNumberOfConstituents());
+
+       fh3PtJet1VsRatVsLeadPtTaggedMatch[fCentBin]->Fill(ptJet1,rat,jet1->MaxTrackPt());
+       fpPtVsRatJet1TaggedMatch[fCentBin]->Fill(ptJet1,rat);
+       fh2RatVsAreaJet1TaggedMatch[fCentBin]->Fill(rat,jet1->Area());
+       fh2RatVsNConstJet1TaggedMatch[fCentBin]->Fill(rat,jet1->GetNumberOfConstituents());
+      }
       
-      Double_t Et2 = jet1->M()*jet1->M() + jet1->Pt()*jet1->Pt();
+      Double_t Et2 = mJet1*mJet1 + ptJet1*ptJet1;
       Double_t Et = 0.;    Double_t massOverEtR = 0.;
       if(Et2>0.) Et = TMath::Sqrt(Et2);
       if((Et*jetCont->GetJetRadius())>0.) 
-       massOverEtR = jet1->M()/(Et*jetCont->GetJetRadius());
+       massOverEtR = mJet1/(Et*jetCont->GetJetRadius());
       fh2EtMassOverEtRSq[fCentBin]->Fill(Et,massOverEtR*massOverEtR);
     }
   }
@@ -292,9 +504,13 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
 
 //________________________________________________________________________
 Double_t AliAnalysisTaskEmcalJetMass::GetJetMass(AliEmcalJet *jet) {
-  //calc subtracted jet mass, not implemented
-  return jet->M();
-
+  //calc subtracted jet mass
+  if(fJetMassType==kRaw)
+    return jet->M();
+  else if(fJetMassType==kDeriv)
+    return jet->GetSecondOrderSubtracted();
+  
+  return 0;
 }
 
 //________________________________________________________________________
@@ -302,12 +518,10 @@ Bool_t AliAnalysisTaskEmcalJetMass::RetrieveEventObjects() {
   //
   // retrieve event objects
   //
-
   if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects())
     return kFALSE;
 
   return kTRUE;
-
 }
 
 //_______________________________________________________________________