include single inclusive triggers to h-jet ana
authormverweij <marta.verweij@cern.ch>
Mon, 1 Dec 2014 21:42:12 +0000 (22:42 +0100)
committermverweij <marta.verweij@cern.ch>
Tue, 2 Dec 2014 11:47:56 +0000 (12:47 +0100)
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalHJetMass.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalHJetMass.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.cxx
PWGJE/EMCALJetTasks/macros/AddTaskEmcalHJetMass.C
PWGJE/PWGJEEMCALJetTasksLinkDef.h

index eaaed67..66c9af8 100644 (file)
@@ -15,6 +15,9 @@
 #include <TSystem.h>
 #include <TFile.h>
 #include <TKey.h>
+#include <TArrayI.h>
+#include <TArrayF.h>
+#include <TRandom3.h>
 
 #include "AliVCluster.h"
 #include "AliVTrack.h"
 
 #include "AliAnalysisTaskEmcalHJetMass.h"
 
-ClassImp(AliAnalysisTaskEmcalHJetMass)
-
-//________________________________________________________________________
-AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass() : 
-  AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalHJetMass", kTRUE),
-  fContainerBase(0),
-  fContainerUnsub(1),
-  fMinFractionShared(0),
-  fUseUnsubJet(0),
-  fJetMassType(kRaw),
-  fDPhiHJetMax(0.6),
-  fh1PtHadron(0),
-  fh3PtHPtJDPhi(0),
-  fh3PtJet1VsMassVsHPtAllSel(0),
-  fh3PtJet1VsMassVsHPtTagged(0),
-  fh3PtJet1VsMassVsHPtTaggedMatch(0),
-  fh3PtJet1VsRatVsHPtAllSel(0),
-  fh3PtJet1VsRatVsHPtTagged(0),
-  fh3PtJet1VsRatVsHPtTaggedMatch(0)
-{
-  // Default constructor.
-
-  fh1PtHadron                       = new TH1F*[fNcentBins];
-  fh3PtHPtJDPhi                     = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtAllSel        = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtTagged        = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtTaggedMatch   = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtAllSel         = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtTagged         = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtTaggedMatch    = new TH3F*[fNcentBins];
-
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    fh1PtHadron[i]                       = 0;
-    fh3PtHPtJDPhi[i]                     = 0;
-    fh3PtJet1VsMassVsHPtAllSel[i]        = 0;
-    fh3PtJet1VsMassVsHPtTagged[i]        = 0;
-    fh3PtJet1VsMassVsHPtTaggedMatch[i]   = 0;
-    fh3PtJet1VsRatVsHPtAllSel[i]         = 0;
-    fh3PtJet1VsRatVsHPtTagged[i]         = 0;
-    fh3PtJet1VsRatVsHPtTaggedMatch[i]    = 0;
-  }
+ClassImp(EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass)
+
+namespace EmcalHJetMassAnalysis {
+
+  //________________________________________________________________________
+  AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass() : 
+    AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalHJetMass", kTRUE),
+    fContainerBase(0),
+    fContainerUnsub(1),
+    fMinFractionShared(0),
+    fUseUnsubJet(0),
+    fJetMassType(kRaw),
+    fDPhiHJetMax(0.6),
+    fTriggerTrackType(kInclusive),
+    fPtTTMin(0),
+    fPtTTMax(0),
+    fRandom(0),
+    fh1PtHadron(0),
+    fh3PtHPtJDPhi(0),
+    fh3PtJet1VsMassVsHPtAllSel(0),
+    fh3PtJet1VsMassVsHPtTagged(0),
+    fh3PtJet1VsMassVsHPtTaggedMatch(0),
+    fh3PtJet1VsRatVsHPtAllSel(0),
+    fh3PtJet1VsRatVsHPtTagged(0),
+    fh3PtJet1VsRatVsHPtTaggedMatch(0)
+  {
+    // Default constructor.
+
+    fh1PtHadron                       = new TH1F*[fNcentBins];
+    fh3PtHPtJDPhi                     = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtAllSel        = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtTagged        = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtTaggedMatch   = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtAllSel         = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtTagged         = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtTaggedMatch    = new TH3F*[fNcentBins];
+
+    for (Int_t i = 0; i < fNcentBins; i++) {
+      fh1PtHadron[i]                       = 0;
+      fh3PtHPtJDPhi[i]                     = 0;
+      fh3PtJet1VsMassVsHPtAllSel[i]        = 0;
+      fh3PtJet1VsMassVsHPtTagged[i]        = 0;
+      fh3PtJet1VsMassVsHPtTaggedMatch[i]   = 0;
+      fh3PtJet1VsRatVsHPtAllSel[i]         = 0;
+      fh3PtJet1VsRatVsHPtTagged[i]         = 0;
+      fh3PtJet1VsRatVsHPtTaggedMatch[i]    = 0;
+    }
 
-  SetMakeGeneralHistograms(kTRUE);
-}
+    fPtTTMin = new TArrayF();
+    fPtTTMax = new TArrayF();
 
-//________________________________________________________________________
-AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass(const char *name) : 
-  AliAnalysisTaskEmcalJet(name, kTRUE),  
-  fContainerBase(0),
-  fContainerUnsub(1),
-  fMinFractionShared(0),
-  fUseUnsubJet(0),
-  fJetMassType(kRaw),
-  fDPhiHJetMax(0.6),
-  fh1PtHadron(0),
-  fh3PtHPtJDPhi(0),
-  fh3PtJet1VsMassVsHPtAllSel(0),
-  fh3PtJet1VsMassVsHPtTagged(0),
-  fh3PtJet1VsMassVsHPtTaggedMatch(0),
-  fh3PtJet1VsRatVsHPtAllSel(0),
-  fh3PtJet1VsRatVsHPtTagged(0),
-  fh3PtJet1VsRatVsHPtTaggedMatch(0)
-{
-  // Standard constructor.
-
-  fh1PtHadron                       = new TH1F*[fNcentBins];
-  fh3PtHPtJDPhi                     = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtAllSel        = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtTagged        = new TH3F*[fNcentBins];
-  fh3PtJet1VsMassVsHPtTaggedMatch   = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtAllSel         = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtTagged         = new TH3F*[fNcentBins];
-  fh3PtJet1VsRatVsHPtTaggedMatch    = new TH3F*[fNcentBins];
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    fh1PtHadron[i]                       = 0;
-    fh3PtHPtJDPhi[i]                     = 0;
-    fh3PtJet1VsMassVsHPtAllSel[i]        = 0;
-    fh3PtJet1VsMassVsHPtTagged[i]        = 0;
-    fh3PtJet1VsMassVsHPtTaggedMatch[i]   = 0;
-    fh3PtJet1VsRatVsHPtAllSel[i]         = 0;
-    fh3PtJet1VsRatVsHPtTagged[i]         = 0;
-    fh3PtJet1VsRatVsHPtTaggedMatch[i]    = 0;
+    SetMakeGeneralHistograms(kTRUE);
   }
 
-  SetMakeGeneralHistograms(kTRUE);
-}
-
-//________________________________________________________________________
-AliAnalysisTaskEmcalHJetMass::~AliAnalysisTaskEmcalHJetMass()
-{
-  // Destructor.
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskEmcalHJetMass::UserCreateOutputObjects()
-{
-  // Create user output.
-
-  AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
-
-  Bool_t oldStatus = TH1::AddDirectoryStatus();
-  TH1::AddDirectory(kFALSE);
-
-  const Int_t nBinsPt  = 200;
-  const Double_t minPt = -50.;
-  const Double_t maxPt = 150.;
-
-  const Int_t nBinsM  = 100;
-  const Double_t minM = -20.;
-  const Double_t maxM = 80.;
-
-  const Int_t nBinsR  = 100;
-  const Double_t minR = -0.2;
-  const Double_t maxR = 0.8;
+  //________________________________________________________________________
+  AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass(const char *name) : 
+    AliAnalysisTaskEmcalJet(name, kTRUE),  
+    fContainerBase(0),
+    fContainerUnsub(1),
+    fMinFractionShared(0),
+    fUseUnsubJet(0),
+    fJetMassType(kRaw),
+    fDPhiHJetMax(0.6),
+    fTriggerTrackType(kInclusive),
+    fPtTTMin(0),
+    fPtTTMax(0),
+    fRandom(0),
+    fh1PtHadron(0),
+    fh3PtHPtJDPhi(0),
+    fh3PtJet1VsMassVsHPtAllSel(0),
+    fh3PtJet1VsMassVsHPtTagged(0),
+    fh3PtJet1VsMassVsHPtTaggedMatch(0),
+    fh3PtJet1VsRatVsHPtAllSel(0),
+    fh3PtJet1VsRatVsHPtTagged(0),
+    fh3PtJet1VsRatVsHPtTaggedMatch(0)
+  {
+    // Standard constructor.
+
+    fh1PtHadron                       = new TH1F*[fNcentBins];
+    fh3PtHPtJDPhi                     = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtAllSel        = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtTagged        = new TH3F*[fNcentBins];
+    fh3PtJet1VsMassVsHPtTaggedMatch   = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtAllSel         = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtTagged         = new TH3F*[fNcentBins];
+    fh3PtJet1VsRatVsHPtTaggedMatch    = new TH3F*[fNcentBins];
+    for (Int_t i = 0; i < fNcentBins; i++) {
+      fh1PtHadron[i]                       = 0;
+      fh3PtHPtJDPhi[i]                     = 0;
+      fh3PtJet1VsMassVsHPtAllSel[i]        = 0;
+      fh3PtJet1VsMassVsHPtTagged[i]        = 0;
+      fh3PtJet1VsMassVsHPtTaggedMatch[i]   = 0;
+      fh3PtJet1VsRatVsHPtAllSel[i]         = 0;
+      fh3PtJet1VsRatVsHPtTagged[i]         = 0;
+      fh3PtJet1VsRatVsHPtTaggedMatch[i]    = 0;
+    }
 
-  const Int_t nBinsPtH  = 100;
-  const Double_t minPtH = 0.;
-  const Double_t maxPtH = 100.;
+    fPtTTMin = new TArrayF();
+    fPtTTMax = new TArrayF();
 
-  const Int_t nBinsPhi  = 18*4;
-  const Double_t minPhi = -0.5*TMath::Pi();
-  const Double_t maxPhi = 1.5*TMath::Pi();
+    SetMakeGeneralHistograms(kTRUE);
+  }
 
-  TString histName = "";
-  TString histTitle = "";
-  for (Int_t i = 0; i < fNcentBins; i++) {
-    histName = TString::Format("fh1PtHadron_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,h}",histName.Data());
-    fh1PtHadron[i] = new TH1F(histName.Data(),histTitle.Data(),200.,0.,200.);
-    fOutput->Add(fh1PtHadron[i]);
+  //________________________________________________________________________
+  AliAnalysisTaskEmcalHJetMass::~AliAnalysisTaskEmcalHJetMass()
+  {
+    // Destructor.
 
-    histName = TString::Format("fh3PtHPtJDPhi_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,h};#it{p}_{T,jet};#Delta#varphi_{h,jet}",histName.Data());
-    fh3PtHPtJDPhi[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPtH,minPtH,maxPtH,nBinsPt,minPt,maxPt,nBinsPhi,minPhi,maxPhi);
-    fOutput->Add(fh3PtHPtJDPhi[i]);
+    if(fRandom)      delete fRandom;
+    if(fPtTTMin)     delete fPtTTMin;
+    if(fPtTTMax)     delete fPtTTMax;
+  }
 
-    histName = TString::Format("fh3PtJet1VsMassVsHPtAllSel_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsMassVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsMassVsHPtAllSel[i]);
+  //________________________________________________________________________
+  void AliAnalysisTaskEmcalHJetMass::UserCreateOutputObjects()
+  {
+    // Create user output.
+
+    AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
+
+    Bool_t oldStatus = TH1::AddDirectoryStatus();
+    TH1::AddDirectory(kFALSE);
+
+    const Int_t nBinsPt  = 200;
+    const Double_t minPt = -50.;
+    const Double_t maxPt = 150.;
+
+    const Int_t nBinsM  = 100;
+    const Double_t minM = -20.;
+    const Double_t maxM = 80.;
+
+    const Int_t nBinsR  = 100;
+    const Double_t minR = -0.2;
+    const Double_t maxR = 0.8;
+
+    const Int_t nBinsPtH  = 100;
+    const Double_t minPtH = 0.;
+    const Double_t maxPtH = 100.;
+
+    const Int_t nBinsPhi  = 18*4;
+    const Double_t minPhi = -0.5*TMath::Pi();
+    const Double_t maxPhi = 1.5*TMath::Pi();
+
+    TString histName = "";
+    TString histTitle = "";
+    for (Int_t i = 0; i < fNcentBins; i++) {
+      histName = TString::Format("fh1PtHadron_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,h}",histName.Data());
+      fh1PtHadron[i] = new TH1F(histName.Data(),histTitle.Data(),200.,0.,200.);
+      fOutput->Add(fh1PtHadron[i]);
+
+      histName = TString::Format("fh3PtHPtJDPhi_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,h};#it{p}_{T,jet};#Delta#varphi_{h,jet}",histName.Data());
+      fh3PtHPtJDPhi[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPtH,minPtH,maxPtH,nBinsPt,minPt,maxPt,nBinsPhi,minPhi,maxPhi);
+      fOutput->Add(fh3PtHPtJDPhi[i]);
+
+      histName = TString::Format("fh3PtJet1VsMassVsHPtAllSel_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsMassVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsMassVsHPtAllSel[i]);
+
+      histName = TString::Format("fh3PtJet1VsMassVsHPtTagged_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsMassVsHPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsMassVsHPtTagged[i]);
+
+      histName = TString::Format("fh3PtJet1VsMassVsHPtTaggedMatch_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsMassVsHPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsMassVsHPtTaggedMatch[i]);
+
+      //
+      histName = TString::Format("fh3PtJet1VsRatVsHPtAllSel_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsRatVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsRatVsHPtAllSel[i]);
+
+      histName = TString::Format("fh3PtJet1VsRatVsHPtTagged_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsRatVsHPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsRatVsHPtTagged[i]);
+
+      histName = TString::Format("fh3PtJet1VsRatVsHPtTaggedMatch_%d",i);
+      histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
+      fh3PtJet1VsRatVsHPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
+      fOutput->Add(fh3PtJet1VsRatVsHPtTaggedMatch[i]);
+    }
 
-    histName = TString::Format("fh3PtJet1VsMassVsHPtTagged_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsMassVsHPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsMassVsHPtTagged[i]);
+    TH1::AddDirectory(oldStatus);
 
-    histName = TString::Format("fh3PtJet1VsMassVsHPtTaggedMatch_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsMassVsHPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsMassVsHPtTaggedMatch[i]);
+    fRandom = new TRandom3(0);
 
-    //
-    histName = TString::Format("fh3PtJet1VsRatVsHPtAllSel_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsRatVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsRatVsHPtAllSel[i]);
-
-    histName = TString::Format("fh3PtJet1VsRatVsHPtTagged_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsRatVsHPtTagged[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsRatVsHPtTagged[i]);
-
-    histName = TString::Format("fh3PtJet1VsRatVsHPtTaggedMatch_%d",i);
-    histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
-    fh3PtJet1VsRatVsHPtTaggedMatch[i] =  new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
-    fOutput->Add(fh3PtJet1VsRatVsHPtTaggedMatch[i]);
+    PostData(1, fOutput); // Post data for ALL output slots > 0 here.
   }
 
-  TH1::AddDirectory(oldStatus);
-
-  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
-}
-
-//________________________________________________________________________
-Bool_t AliAnalysisTaskEmcalHJetMass::Run()
-{
-  // Run analysis code here, if needed. It will be executed before FillHistograms().
-
-  AliVParticle *vp = NULL;
-  AliParticleContainer *pCont = GetParticleContainer(0);
-  AliJetContainer      *jCont = GetJetContainer(fContainerBase);
-  if(pCont) {
-    pCont->ResetCurrentID();
-    while((vp = pCont->GetNextAcceptParticle())) {
-      fh1PtHadron[fCentBin]->Fill(vp->Pt()); //all hadrons
-      AliEmcalJet* jet = NULL;
-      if(jCont) {
-       jCont->ResetCurrentID();
-       while((jet = jCont->GetNextAcceptJet())) {
-         Double_t dphi = GetDeltaPhi(vp,jet)-TMath::Pi();
-         fh3PtHPtJDPhi[fCentBin]->Fill(vp->Pt(),jet->Pt() - GetRhoVal(fContainerBase)*jet->Area(),dphi);
-         if(dphi>fDPhiHJetMax) continue;
-         FillHJetHistograms(vp->Pt(),jet);
-       }
+  //________________________________________________________________________
+  Bool_t AliAnalysisTaskEmcalHJetMass::Run()
+  {
+    // Run analysis code here, if needed. It will be executed before FillHistograms().
+
+    AliParticleContainer *pCont = GetParticleContainer(0);
+    AliJetContainer      *jCont = GetJetContainer(fContainerBase);
+    if(!pCont || !jCont) return kFALSE;
+
+    AliVParticle *vp = NULL;
+
+    if(fTriggerTrackType==kInclusive) {
+      pCont->ResetCurrentID();
+      while((vp = pCont->GetNextAcceptParticle())) {
+        fh1PtHadron[fCentBin]->Fill(vp->Pt()); //all hadrons
+        AliEmcalJet* jet = NULL;
+        if(jCont) {
+          jCont->ResetCurrentID();
+          while((jet = jCont->GetNextAcceptJet())) {
+            Double_t dphi = GetDeltaPhi(vp,jet)-TMath::Pi();
+            fh3PtHPtJDPhi[fCentBin]->Fill(vp->Pt(),jet->Pt() - GetRhoVal(fContainerBase)*jet->Area(),dphi);
+            if(dphi>fDPhiHJetMax) continue;
+            FillHJetHistograms(vp->Pt(),jet);
+          }
+        }
+      }
+    }
+    else if(fTriggerTrackType==kSingleInclusive) {
+      TArrayI arr; arr.Set(pCont->GetNParticles());
+      for(Int_t it = 0; it<fPtTTMin->GetSize(); it++) {
+        Int_t counter = -1;
+        arr.Reset();
+        pCont->ResetCurrentID();
+        while((vp = pCont->GetNextAcceptParticle())) {
+          if(vp->Pt()>fPtTTMin->At(it) && vp->Pt()<fPtTTMax->At(it) ) {
+            counter++;
+            arr.SetAt(pCont->GetCurrentID(),counter);
+          }
+        }
+        if(counter<0) continue;
+        //select trigger track randomly
+        fRandom->SetSeed(arr.At(0)); //random selection reproducible
+        Double_t rnd = fRandom->Uniform() * counter;
+        Int_t trigID = arr.At(TMath::FloorNint(rnd));
+        vp = pCont->GetParticle(trigID);
+        fh1PtHadron[fCentBin]->Fill(vp->Pt()); //all hadrons
+        AliEmcalJet* jet = NULL;
+        jCont->ResetCurrentID();
+        while((jet = jCont->GetNextAcceptJet())) {
+          Double_t dphi = GetDeltaPhi(vp,jet)-TMath::Pi();
+          fh3PtHPtJDPhi[fCentBin]->Fill(vp->Pt(),jet->Pt() - GetRhoVal(fContainerBase)*jet->Area(),dphi);
+          if(dphi>fDPhiHJetMax) continue;
+          FillHJetHistograms(vp->Pt(),jet);
+        }
       }
     }
+    return kTRUE;
   }
-  return kTRUE;
-}
 
-//________________________________________________________________________
-Bool_t AliAnalysisTaskEmcalHJetMass::FillHJetHistograms(Double_t pt, const AliEmcalJet *jet)
-{
-  // Fill hadron-jet histograms.
-  Double_t ptJet = jet->Pt() - GetRhoVal(fContainerBase)*jet->Area();
-  Double_t mJet = GetJetMass(jet);
-  Double_t rat = -1.;
-  if(ptJet<0. || ptJet>0.) rat = mJet/ptJet;
-
-  fh3PtJet1VsMassVsHPtAllSel[fCentBin]->Fill(ptJet,mJet,pt);
-  fh3PtJet1VsRatVsHPtAllSel[fCentBin]->Fill(ptJet,rat,pt);
-
-  if(jet->GetTagStatus()<1 || !jet->GetTaggedJet())
-    return kFALSE;
-  fh3PtJet1VsMassVsHPtTagged[fCentBin]->Fill(ptJet,mJet,pt);
-  fh3PtJet1VsRatVsHPtTagged[fCentBin]->Fill(ptJet,rat,pt);
-
-  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()==jet->GetLabel()) {
-       ifound++;
-       if(ifound==1) ilab = i;
+  //________________________________________________________________________
+  Bool_t AliAnalysisTaskEmcalHJetMass::FillHJetHistograms(Double_t pt, const AliEmcalJet *jet)
+  {
+    // Fill hadron-jet histograms.
+    Double_t ptJet = jet->Pt() - GetRhoVal(fContainerBase)*jet->Area();
+    Double_t mJet = GetJetMass(jet);
+    Double_t rat = -1.;
+    if(ptJet<0. || ptJet>0.) rat = mJet/ptJet;
+
+    fh3PtJet1VsMassVsHPtAllSel[fCentBin]->Fill(ptJet,mJet,pt);
+    fh3PtJet1VsRatVsHPtAllSel[fCentBin]->Fill(ptJet,rat,pt);
+
+    if(jet->GetTagStatus()<1 || !jet->GetTaggedJet())
+      return kFALSE;
+    fh3PtJet1VsMassVsHPtTagged[fCentBin]->Fill(ptJet,mJet,pt);
+    fh3PtJet1VsRatVsHPtTagged[fCentBin]->Fill(ptJet,rat,pt);
+
+    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()==jet->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 = jetContUS->GetFractionSharedPt(jetUS);
+    } else {
+      AliJetContainer *jetCont = GetJetContainer(fContainerBase);
+      fraction = jetCont->GetFractionSharedPt(jet);
     }
-    if(ifound>1) AliDebug(2,Form("Found %d partners",ifound));
-    if(ifound==0) jetUS = 0x0;
-    else          jetUS = jetContUS->GetJet(ilab);
-    fraction = jetContUS->GetFractionSharedPt(jetUS);
-  } else {
-    AliJetContainer *jetCont = GetJetContainer(fContainerBase);
-    fraction = jetCont->GetFractionSharedPt(jet);
-  }
   
-  if(fMinFractionShared>0. && fraction>fMinFractionShared) {
-    fh3PtJet1VsMassVsHPtTaggedMatch[fCentBin]->Fill(ptJet,mJet,pt);
-    fh3PtJet1VsRatVsHPtTaggedMatch[fCentBin]->Fill(ptJet,rat,pt);
+    if(fMinFractionShared>0. && fraction>fMinFractionShared) {
+      fh3PtJet1VsMassVsHPtTaggedMatch[fCentBin]->Fill(ptJet,mJet,pt);
+      fh3PtJet1VsRatVsHPtTaggedMatch[fCentBin]->Fill(ptJet,rat,pt);
+    }
+    return kTRUE;
   }
-  return kTRUE;
-}
 
-//________________________________________________________________________
-Double_t AliAnalysisTaskEmcalHJetMass::GetJetMass(const AliEmcalJet *jet) const {
-  //calc subtracted jet mass
-  if(fJetMassType==kRaw)
-    return jet->M();
-  else if(fJetMassType==kDeriv)
-    return jet->GetSecondOrderSubtracted();
+  //________________________________________________________________________
+  Double_t AliAnalysisTaskEmcalHJetMass::GetJetMass(const AliEmcalJet *jet) const {
+    //calc subtracted jet mass
+    if(fJetMassType==kRaw)
+      return jet->M();
+    else if(fJetMassType==kDeriv)
+      return jet->GetSecondOrderSubtracted();
   
-  return 0;
-}
+    return 0;
+  }
 
-//________________________________________________________________________
-Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(const AliVParticle *vp, const AliEmcalJet* jet) const {
-  // Calculate azimuthal angle between particle and jet. range:[-0.5\pi,1.5\pi]
-  return GetDeltaPhi(vp->Phi(),jet->Phi());
-}
+  //________________________________________________________________________
+  Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(const AliVParticle *vp, const AliEmcalJet* jet) const {
+    // Calculate azimuthal angle between particle and jet. range:[-0.5\pi,1.5\pi]
+    return GetDeltaPhi(vp->Phi(),jet->Phi());
+  }
 
-//________________________________________________________________________
-Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(Double_t phi1, Double_t phi2) const {
-  // Calculate azimuthal angle between phi1 and phi2. range:[-0.5\pi,1.5\pi]
-  Double_t dPhi = phi1-phi2;
-  if(dPhi <-0.5*TMath::Pi())  dPhi += TMath::TwoPi();
-  if(dPhi > 1.5*TMath::Pi())  dPhi -= TMath::TwoPi();
-  return dPhi;
-}
+  //________________________________________________________________________
+  Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(Double_t phi1, Double_t phi2) const {
+    // Calculate azimuthal angle between phi1 and phi2. range:[-0.5\pi,1.5\pi]
+    Double_t dPhi = phi1-phi2;
+    if(dPhi <-0.5*TMath::Pi())  dPhi += TMath::TwoPi();
+    if(dPhi > 1.5*TMath::Pi())  dPhi -= TMath::TwoPi();
+    return dPhi;
+  }
 
 
-//________________________________________________________________________
-Bool_t AliAnalysisTaskEmcalHJetMass::RetrieveEventObjects() {
-  //
-  // retrieve event objects
-  //
-  if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects())
-    return kFALSE;
+  //________________________________________________________________________
+  Bool_t AliAnalysisTaskEmcalHJetMass::RetrieveEventObjects() {
+    //
+    // retrieve event objects
+    //
+    if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects())
+      return kFALSE;
+
+    return kTRUE;
+  }
 
-  return kTRUE;
-}
+  //________________________________________________________________________
+  void AliAnalysisTaskEmcalHJetMass::AddTriggerTrackPtCuts(Float_t min, Float_t max) {
+    if(!fPtTTMin) fPtTTMin = new TArrayF();
+    if(!fPtTTMax) fPtTTMax = new TArrayF();
+    Int_t newSize = fPtTTMin->GetSize()+1;
+    fPtTTMin->Set(newSize);
+    fPtTTMax->Set(newSize);
+    fPtTTMin->AddAt(min,newSize-1);
+    fPtTTMax->AddAt(max,newSize-1);
+  }
 
-//_______________________________________________________________________
-void AliAnalysisTaskEmcalHJetMass::Terminate(Option_t *) 
-{
-  // Called once at the end of the analysis.
+  //_______________________________________________________________________
+  void AliAnalysisTaskEmcalHJetMass::Terminate(Option_t *) 
+  {
+    // Called once at the end of the analysis.
+  }
 }
 
index 1280e07..ec0dbfe 100644 (file)
@@ -8,64 +8,80 @@ class TH3F;
 class THnSparse;
 class TClonesArray;
 class TArrayI;
+class TArrayF;
+class TRandom3;
 class AliAnalysisManager;
 class AliJetContainer;
 class AliEmcalJet;
 
 #include "AliAnalysisTaskEmcalJet.h"
 
-class AliAnalysisTaskEmcalHJetMass : public AliAnalysisTaskEmcalJet {
- public:
-  enum JetMassType {
-    kRaw   = 0,  //mass form anti-kt 4-vector
-    kDeriv = 1   //area based subtracted jet mass
-  };
-
-  AliAnalysisTaskEmcalHJetMass();
-  AliAnalysisTaskEmcalHJetMass(const char *name);
-  virtual ~AliAnalysisTaskEmcalHJetMass();
-
-  void                                UserCreateOutputObjects();
-  void                                Terminate(Option_t *option);
-
-  //Setters
-  void SetJetContainerBase(Int_t c)                             { fContainerBase     = c   ; }
- void SetJetContainerUnsub(Int_t c)                                 { fContainerUnsub    = c   ; }
-  void SetMinFractionShared(Double_t f, Bool_t useUnsubJet = kFALSE) { fMinFractionShared = f   ; fUseUnsubJet = useUnsubJet; }
-  void SetJetMassType(JetMassType t)                            { fJetMassType       = t   ; }
-  void SetMaxDeltaPhi(Double_t dphi)                            { fDPhiHJetMax       = dphi; }
-
- protected:
-  Bool_t                              RetrieveEventObjects();
-  Bool_t                              Run();
-  Bool_t                              FillHJetHistograms(Double_t pt, const AliEmcalJet *jet);
-
-  Double_t                            GetJetMass(const AliEmcalJet *jet) const;
-  Double_t                            GetDeltaPhi(const AliVParticle *vp, const AliEmcalJet* jet) const;
-  Double_t                            GetDeltaPhi(Double_t phi1,Double_t phi2) const; 
-
-  Int_t                               fContainerBase;              // jets to be analyzed
-  Int_t                               fContainerUnsub;             // unsubtracted jets
-  Double_t                            fMinFractionShared;          // only fill histos for jets if shared fraction larger than X
-  Bool_t                              fUseUnsubJet;                // calc fraction of unsubtracted jet (relevant for constituent subtraction
-  JetMassType                         fJetMassType;                // jet mass type to be used
-  Double_t                            fDPhiHJetMax;                // maximum delta phi between hadron and jet
-
-  TH1F            **fh1PtHadron;                        //!pt of hadrons
-  TH3F            **fh3PtHPtJDPhi;                      //!pt hadron vs pt jet vs delta phi
-  TH3F            **fh3PtJet1VsMassVsHPtAllSel;         //!all jets after std selection pt vs mass vs track pt
-  TH3F            **fh3PtJet1VsMassVsHPtTagged;         //!tagged jets pt vs mass vs track pt
-  TH3F            **fh3PtJet1VsMassVsHPtTaggedMatch;    //!tagged jets pt vs mass vs track pt matched to MC
-
-  TH3F            **fh3PtJet1VsRatVsHPtAllSel;          //!all jets after std selection pt vs mass/pt vs track pt
-  TH3F            **fh3PtJet1VsRatVsHPtTagged;          //!tagged jets pt vs mass/pt vs track pt
-  TH3F            **fh3PtJet1VsRatVsHPtTaggedMatch;     //!tagged jets pt vs mas/pts vs track pt matched to MC
-
- private:
-  AliAnalysisTaskEmcalHJetMass(const AliAnalysisTaskEmcalHJetMass&);            // not implemented
-  AliAnalysisTaskEmcalHJetMass &operator=(const AliAnalysisTaskEmcalHJetMass&); // not implemented
-
-  ClassDef(AliAnalysisTaskEmcalHJetMass, 2)
-};
+namespace EmcalHJetMassAnalysis {
+  class AliAnalysisTaskEmcalHJetMass : public AliAnalysisTaskEmcalJet {
+  public:
+    enum JetMassType {
+      kRaw   = 0,  //mass form anti-kt 4-vector
+      kDeriv = 1   //area based subtracted jet mass
+    };
+
+    enum TriggerTrackType {
+      kInclusive       = 0,  //take all trigger tracks
+      kSingleInclusive = 1   //take randomly trigger track within defined pt bin
+    };
+
+
+    AliAnalysisTaskEmcalHJetMass();
+    AliAnalysisTaskEmcalHJetMass(const char *name);
+    virtual ~AliAnalysisTaskEmcalHJetMass();
+
+    void                                UserCreateOutputObjects();
+    void                                Terminate(Option_t *option);
+
+    //Setters
+    void SetJetContainerBase(Int_t c)                                  { fContainerBase     = c   ; }
+    void SetJetContainerUnsub(Int_t c)                                 { fContainerUnsub    = c   ; }
+    void SetMinFractionShared(Double_t f, Bool_t useUnsubJet = kFALSE) { fMinFractionShared = f   ; fUseUnsubJet = useUnsubJet; }
+    void SetJetMassType(JetMassType t)                                 { fJetMassType       = t   ; }
+    void SetMaxDeltaPhi(Double_t dphi)                                 { fDPhiHJetMax       = dphi; }
+    void SetTriggerTrackType(TriggerTrackType t)                       { fTriggerTrackType  = t   ; }
+    void AddTriggerTrackPtCuts(Float_t min, Float_t max);
+
+  protected:
+    Bool_t                              RetrieveEventObjects();
+    Bool_t                              Run();
+    Bool_t                              FillHJetHistograms(Double_t pt, const AliEmcalJet *jet);
+
+    Double_t                            GetJetMass(const AliEmcalJet *jet) const;
+    Double_t                            GetDeltaPhi(const AliVParticle *vp, const AliEmcalJet* jet) const;
+    Double_t                            GetDeltaPhi(Double_t phi1,Double_t phi2) const; 
+
+    Int_t                               fContainerBase;              // jets to be analyzed
+    Int_t                               fContainerUnsub;             // unsubtracted jets
+    Double_t                            fMinFractionShared;          // only fill histos for jets if shared fraction larger than X
+    Bool_t                              fUseUnsubJet;                // calc fraction of unsubtracted jet (relevant for constituent subtraction
+    JetMassType                         fJetMassType;                // jet mass type to be used
+    Double_t                            fDPhiHJetMax;                // maximum delta phi between hadron and jet
+    TriggerTrackType                    fTriggerTrackType;           // method to select trigger track
+    TArrayF                            *fPtTTMin;                    // minimum pt of trigger tracks
+    TArrayF                            *fPtTTMax;                    // maximum pt of trigger tracks
+    TRandom3                           *fRandom;                     //! Random number generator
+
+    TH1F            **fh1PtHadron;                        //!pt of hadrons
+    TH3F            **fh3PtHPtJDPhi;                      //!pt hadron vs pt jet vs delta phi
+    TH3F            **fh3PtJet1VsMassVsHPtAllSel;         //!all jets after std selection pt vs mass vs track pt
+    TH3F            **fh3PtJet1VsMassVsHPtTagged;         //!tagged jets pt vs mass vs track pt
+    TH3F            **fh3PtJet1VsMassVsHPtTaggedMatch;    //!tagged jets pt vs mass vs track pt matched to MC
+
+    TH3F            **fh3PtJet1VsRatVsHPtAllSel;          //!all jets after std selection pt vs mass/pt vs track pt
+    TH3F            **fh3PtJet1VsRatVsHPtTagged;          //!tagged jets pt vs mass/pt vs track pt
+    TH3F            **fh3PtJet1VsRatVsHPtTaggedMatch;     //!tagged jets pt vs mas/pts vs track pt matched to MC
+
+  private:
+    AliAnalysisTaskEmcalHJetMass(const AliAnalysisTaskEmcalHJetMass&);            // not implemented
+    AliAnalysisTaskEmcalHJetMass &operator=(const AliAnalysisTaskEmcalHJetMass&); // not implemented
+
+    ClassDef(AliAnalysisTaskEmcalHJetMass, 3)
+      };
+}
 #endif
 
index 7d87a23..a697a1d 100644 (file)
@@ -511,7 +511,6 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
        else jetM = jet1->ClosestJet();
        if(jetM) maxTrackPt = jetM->MaxTrackPt();
        else     maxTrackPt = -1.;
-       if(fUseUnsubJet) Printf("fraction: %f maxTrackPt: %f",fraction,maxTrackPt);
        fh3PtJet1VsMassVsLeadPtTaggedMatch[fCentBin]->Fill(ptJet1,mJet1,maxTrackPt);
        fpPtVsMassJet1TaggedMatch[fCentBin]->Fill(ptJet1,mJet1);
        fh2MassVsAreaJet1TaggedMatch[fCentBin]->Fill(mJet1,jet1->Area());
index 29e912a..0802f2c 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskEmcalHJetMass* AddTaskEmcalHJetMass(const char * njetsBase,
+EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass* AddTaskEmcalHJetMass(const char * njetsBase,
                                                   const Double_t R,
                                                   const char * nrhoBase,
                                                   const char * ntracks,
@@ -33,7 +33,7 @@ AliAnalysisTaskEmcalHJetMass* AddTaskEmcalHJetMass(const char * njetsBase,
   TString wagonName = Form("HJetMass_%s_TC%s%s",njetsBase,trigClass.Data(),tag.Data());
 
   //Configure jet tagger task
-  AliAnalysisTaskEmcalHJetMass *task = new AliAnalysisTaskEmcalHJetMass(wagonName.Data());
+  EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass *task = new EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass(wagonName.Data());
   task->SetNCentBins(4);
   task->SetMaxDeltaPhi(maxDPhi);
   
index 53800ab..682e776 100644 (file)
@@ -44,7 +44,8 @@
 #pragma link C++ class AliAnalysisTaskEmcalDiJetAna+;
 #pragma link C++ class AliAnalysisTaskEmcalDiJetResponse+;
 #pragma link C++ class AliAnalysisTaskEmcalHighMultTrigger+;
-#pragma link C++ class AliAnalysisTaskEmcalHJetMass+;
+#pragma link C++ namespace EmcalHJetMassAnalysis+;
+#pragma link C++ class EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass+;
 #pragma link C++ class AliAnalysisTaskEmcalJetHMEC+;
 #pragma link C++ class AliAnalysisTaskEmcalJetHadCorQA+;
 #pragma link C++ class AliAnalysisTaskEmcalJetHadEPpid+;