]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add MC matched jet analysis
authormverweij <marta.verweij@cern.ch>
Thu, 13 Feb 2014 14:49:38 +0000 (15:49 +0100)
committermverweij <marta.verweij@cern.ch>
Thu, 13 Feb 2014 14:51:03 +0000 (15:51 +0100)
PWGJE/EMCALJetTasks/AliJetContainer.cxx
PWGJE/EMCALJetTasks/AliJetContainer.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetTagger.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetTagger.h
PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetMass.C
PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetTagger.C

index a1a0b60325c4cca9a7b5975e2b7c9ea92d8fb314..aebee58657f8eae01310d2283d41f383e5b52fdd 100644 (file)
@@ -511,3 +511,42 @@ void AliJetContainer::SetClassName(const char *clname)
   if (cls.InheritsFrom("AliEmcalJet")) fClassName = clname;
   else AliError(Form("Unable to set class name %s for a AliJetContainer, it must inherits from AliEmcalJet!",clname));
 }
+
+//________________________________________________________________________
+Double_t AliJetContainer::GetFractionSharedPt(AliEmcalJet *jet1) const
+{
+  //
+  // Get fraction of shared pT between matched full and charged jet
+  // Uses charged jet pT as baseline: fraction = \Sum_{const,full jet} pT,const,i / pT,jet,ch
+  // Only works if tracks array of both jets is the same
+  //
+
+  AliEmcalJet *jet2 = jet1->ClosestJet();
+  if(!jet2) return -1;
+
+  Double_t fraction = 0.;
+  Double_t jetPt2 = jet2->Pt();
+  if(jetPt2>0) {
+    Double_t sumPt = 0.;
+    AliVParticle *vpf = 0x0;
+    Int_t iFound = 0;
+    for(Int_t icc=0; icc<jet2->GetNumberOfTracks(); icc++) {
+      Int_t idx = (Int_t)jet2->TrackAt(icc);
+      iFound = 0;
+      for(Int_t icf=0; icf<jet1->GetNumberOfTracks(); icf++) {
+       if(idx == jet1->TrackAt(icf) && iFound==0 ) {
+         iFound=1;
+         vpf = static_cast<AliVParticle*>(jet1->TrackAt(icf, fParticleContainer->GetArray()));
+         if(vpf) sumPt += vpf->Pt();
+         continue;
+       }
+      }
+    }
+    fraction = sumPt/jetPt2;
+  } else 
+    fraction = -1;
+  
+  return fraction;
+}
+
index 037c6ee416bd0baa3b37db5ceb85c86d7a9485de..edc69dbdc83a89083699a59c5f5a218f18dd6da8 100644 (file)
@@ -64,6 +64,7 @@ class AliJetContainer : public AliEmcalContainer {
   void                        SetJetTrigger(UInt_t t=AliVEvent::kEMCEJE)           { fJetTrigger     = t                ; }
   void                        ConnectParticleContainer(AliParticleContainer *c)    { fParticleContainer = c             ; }
   void                        ConnectClusterContainer(AliClusterContainer *c)      { fClusterContainer  = c             ; }
+
   AliEmcalJet                *GetLeadingJet(const char* opt="")          ;
   AliEmcalJet                *GetJet(Int_t i)                       const;
   AliEmcalJet                *GetAcceptJet(Int_t i)                 const;
@@ -97,6 +98,7 @@ class AliJetContainer : public AliEmcalContainer {
   void                        SetArray(AliVEvent *event);
   AliParticleContainer       *GetParticleContainer()                         {return fParticleContainer;}
   AliClusterContainer        *GetClusterContainer()                          {return fClusterContainer;}
+  Double_t                    GetFractionSharedPt(AliEmcalJet *jet) const;
 
  protected:
   JetAcceptanceType           fJetAcceptanceType;    //  acceptance type
@@ -125,7 +127,6 @@ class AliJetContainer : public AliEmcalContainer {
   UInt_t                      fJetTrigger;           //  jet trigger
   AliParticleContainer       *fParticleContainer;    //  particle container (jet constituents)
   AliClusterContainer        *fClusterContainer;     //  cluster container (jet constituents)
-
   AliRhoParameter            *fRho;                  //! event rho for these jets
   AliLocalRhoParameter       *fLocalRho;             //! event local rho for these jets
   AliEMCALGeometry           *fGeom;                 //! emcal geometry
@@ -135,7 +136,7 @@ class AliJetContainer : public AliEmcalContainer {
   AliJetContainer(const AliJetContainer& obj); // copy constructor
   AliJetContainer& operator=(const AliJetContainer& other); // assignment
 
-  ClassDef(AliJetContainer,6);
+  ClassDef(AliJetContainer,7);
 
 };
 
index f7d02fdb062f94aefc726b9b5ae4f3a9ddafa66a..8544697cb068483331494cdf6e9ee9e694387397 100644 (file)
@@ -39,6 +39,7 @@ ClassImp(AliAnalysisTaskEmcalJetMass)
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() : 
   AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetMass", kTRUE),
   fContainerBase(0),
+  fMinFractionShared(0),
   fh2PtJet1VsLeadPtAllSel(0),
   fh2PtJet1VsLeadPtTagged(0),
   fh2PtVsMassJet1All(0),
@@ -47,6 +48,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
   fpPtVsMassJet1Tagged(0),
   fh2MassVsAreaJet1All(0),
   fh2MassVsAreaJet1Tagged(0),
+  fh2MassVsNConstJet1All(0),
+  fh2MassVsNConstJet1Tagged(0),
   fh2EtMassOverEtRSq(0)
 {
   // Default constructor.
@@ -59,6 +62,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
   fpPtVsMassJet1Tagged         = new TProfile*[fNcentBins];
   fh2MassVsAreaJet1All         = new TH2F*[fNcentBins];
   fh2MassVsAreaJet1Tagged      = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1All       = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1Tagged    = new TH2F*[fNcentBins];
   fh2EtMassOverEtRSq           = new TH2F*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
@@ -70,6 +75,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
     fpPtVsMassJet1Tagged[i]        = 0;
     fh2MassVsAreaJet1All[i]        = 0;
     fh2MassVsAreaJet1Tagged[i]     = 0;
+    fh2MassVsNConstJet1All[i]      = 0;
+    fh2MassVsNConstJet1Tagged[i]   = 0;
     fh2EtMassOverEtRSq[i]          = 0;
   }
 
@@ -81,6 +88,7 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),  
   fContainerBase(0),
+  fMinFractionShared(0),
   fh2PtJet1VsLeadPtAllSel(0),
   fh2PtJet1VsLeadPtTagged(0),
   fh2PtVsMassJet1All(0),
@@ -89,6 +97,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) :
   fpPtVsMassJet1Tagged(0),
   fh2MassVsAreaJet1All(0),
   fh2MassVsAreaJet1Tagged(0),
+  fh2MassVsNConstJet1All(0),
+  fh2MassVsNConstJet1Tagged(0),
   fh2EtMassOverEtRSq(0)
 {
   // Standard constructor.
@@ -101,6 +111,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) :
   fpPtVsMassJet1Tagged         = new TProfile*[fNcentBins];
   fh2MassVsAreaJet1All         = new TH2F*[fNcentBins];
   fh2MassVsAreaJet1Tagged      = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1All       = new TH2F*[fNcentBins];
+  fh2MassVsNConstJet1Tagged    = new TH2F*[fNcentBins];
   fh2EtMassOverEtRSq           = new TH2F*[fNcentBins];
 
   for (Int_t i = 0; i < fNcentBins; i++) {
@@ -112,6 +124,8 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) :
     fpPtVsMassJet1Tagged[i]        = 0;
     fh2MassVsAreaJet1All[i]        = 0;
     fh2MassVsAreaJet1Tagged[i]     = 0;
+    fh2MassVsNConstJet1All[i]      = 0;
+    fh2MassVsNConstJet1Tagged[i]   = 0;
     fh2EtMassOverEtRSq[i]          = 0;
   }
 
@@ -142,6 +156,10 @@ void AliAnalysisTaskEmcalJetMass::UserCreateOutputObjects()
   const Double_t minArea = 0.;
   const Double_t maxArea = 1.;
 
+  const Int_t nBinsNConst = 100;
+  const Double_t minNConst = 0.;
+  const Double_t maxNConst = 500.;
+
   TString histName = "";
   TString histTitle = "";
   for (Int_t i = 0; i < fNcentBins; i++) {
@@ -185,6 +203,16 @@ void AliAnalysisTaskEmcalJetMass::UserCreateOutputObjects()
     fh2MassVsAreaJet1Tagged[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsArea,minArea,maxArea);
     fOutput->Add(fh2MassVsAreaJet1Tagged[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(),nBinsPt,minPt,maxPt,nBinsNConst,minNConst,maxNConst);
+    fOutput->Add(fh2MassVsNConstJet1All[i]);
+
+    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);
+    fOutput->Add(fh2MassVsNConstJet1Tagged[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.);
@@ -220,32 +248,31 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
 {
   // Fill histograms.
 
-  AliEmcalJet* jet1 = 0;
-  AliEmcalJet* jet2 = 0;
+  AliEmcalJet* jet1 = NULL;
 
   AliJetContainer *jetCont = GetJetContainer(fContainerBase);
   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();//jetCont->GetJetPtCorr(jetCont->GetCurrentID());//
       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());
       
-      if(jet1->GetTagStatus()<1)
+      if(jet1->GetTagStatus()<1 || !jet1->GetTaggedJet())
        continue;
-      
-      jet2 = jet1->GetTaggedJet();
-      if(!jet2) 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());
       
-      //      Double_t massOverEtR = jet1->M()/(ptJet1*jetCont->GetJetRadius());
-      //      fh2EtMassOverEtRSq[fCentBin]->Fill(ptJet1,massOverEtR*massOverEtR);
       Double_t Et2 = jet1->M()*jet1->M() + jet1->Pt()*jet1->Pt();
       Double_t Et = 0.;    Double_t massOverEtR = 0.;
       if(Et2>0.) Et = TMath::Sqrt(Et2);
@@ -258,7 +285,6 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
   return kTRUE;
 }
 
-
 //________________________________________________________________________
 Bool_t AliAnalysisTaskEmcalJetMass::RetrieveEventObjects() {
   //
index 2ce8bc4a27f3aa4ac3a05460f63f3d58a3e76af0..f7c3d03a436518371d343a1c5bbadf8831bbcd88 100644 (file)
@@ -24,14 +24,16 @@ class AliAnalysisTaskEmcalJetMass : public AliAnalysisTaskEmcalJet {
   void                                Terminate(Option_t *option);
 
   //Setters
-  void SetJetContainerBase(Int_t c)                             { fContainerBase = c;}
+  void SetJetContainerBase(Int_t c)                             { fContainerBase = c       ; }
+  void SetMinFractionShared(Double_t f)                         { fMinFractionShared = f   ; }
 
  protected:
   Bool_t                              RetrieveEventObjects();
   Bool_t                              Run();
   Bool_t                              FillHistograms();
 
-  Int_t                               fContainerBase;              // jets to be tagged
+  Int_t                               fContainerBase;              // jets to be analyzed
+  Double_t                            fMinFractionShared;          // only fill histos for jets if shared fraction larger than X
   
  private:
   TH2F            **fh2PtJet1VsLeadPtAllSel;      //!all jets after std selection vs leading track pt
@@ -42,12 +44,14 @@ class AliAnalysisTaskEmcalJetMass : public AliAnalysisTaskEmcalJet {
   TProfile        **fpPtVsMassJet1Tagged;         //!pT vs avg mass of tagged jets
   TH2F            **fh2MassVsAreaJet1All;         //!mass vs area of all jets
   TH2F            **fh2MassVsAreaJet1Tagged;      //!mass vs area of tagged jets
+  TH2F            **fh2MassVsNConstJet1All;       //!mass vs number of constituents of all jets
+  TH2F            **fh2MassVsNConstJet1Tagged;    //!mass vs number of constituents of tagged jets
   TH2F            **fh2EtMassOverEtRSq;           //!Et vs (M/Et*R)^2
 
   AliAnalysisTaskEmcalJetMass(const AliAnalysisTaskEmcalJetMass&);            // not implemented
   AliAnalysisTaskEmcalJetMass &operator=(const AliAnalysisTaskEmcalJetMass&); // not implemented
 
-  ClassDef(AliAnalysisTaskEmcalJetMass, 2)
+  ClassDef(AliAnalysisTaskEmcalJetMass, 3)
 };
 #endif
 
index 3abc28575db37a72247c5c272095ed750070c8d7..f0fea8a51a465525caf1531b76236a8c3bff3b36 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliMCEvent.h"
 #include "AliAnalysisManager.h"
 #include "AliJetContainer.h"
+#include "AliParticleContainer.h"
 
 #include "AliAODEvent.h"
 #include "AliESDEvent.h"
@@ -43,9 +44,11 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger() :
   fJetTaggingMethod(kGeo),
   fContainerBase(0),
   fContainerTag(1),
+  fMinFractionShared(0),
   fMatchingDone(0),
   fh3PtJet1VsDeltaEtaDeltaPhi(0),
   fh2PtJet1VsDeltaR(0),
+  fh2PtJet2VsFraction(0),
   fh2PtJet1VsLeadPtAllSel(0),
   fh2PtJet1VsLeadPtTagged(0),
   fh2PtJet1VsPtJet2(0),
@@ -57,6 +60,7 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger() :
 
   fh3PtJet1VsDeltaEtaDeltaPhi  = new TH3F*[fNcentBins];
   fh2PtJet1VsDeltaR            = new TH2F*[fNcentBins];
+  fh2PtJet2VsFraction          = new TH2F*[fNcentBins];
   fh2PtJet1VsLeadPtAllSel      = new TH2F*[fNcentBins];
   fh2PtJet1VsLeadPtTagged      = new TH2F*[fNcentBins];
   fh2PtJet1VsPtJet2            = new TH2F*[fNcentBins];
@@ -64,6 +68,7 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger() :
   for (Int_t i = 0; i < fNcentBins; i++) {
     fh3PtJet1VsDeltaEtaDeltaPhi[i] = 0;
     fh2PtJet1VsDeltaR[i]           = 0;
+    fh2PtJet2VsFraction[i]         = 0;
     fh2PtJet1VsLeadPtAllSel[i]     = 0;
     fh2PtJet1VsLeadPtTagged[i]     = 0;
     fh2PtJet1VsPtJet2[i]           = 0;
@@ -80,9 +85,11 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger(const char *name) :
   fJetTaggingMethod(kGeo),
   fContainerBase(0),
   fContainerTag(1),
+  fMinFractionShared(0),
   fMatchingDone(0),
   fh3PtJet1VsDeltaEtaDeltaPhi(0),
   fh2PtJet1VsDeltaR(0),
+  fh2PtJet2VsFraction(0),
   fh2PtJet1VsLeadPtAllSel(0),
   fh2PtJet1VsLeadPtTagged(0),
   fh2PtJet1VsPtJet2(0),
@@ -94,6 +101,7 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger(const char *name) :
 
   fh3PtJet1VsDeltaEtaDeltaPhi = new TH3F*[fNcentBins];
   fh2PtJet1VsDeltaR           = new TH2F*[fNcentBins];
+  fh2PtJet2VsFraction         = new TH2F*[fNcentBins];
   fh2PtJet1VsLeadPtAllSel     = new TH2F*[fNcentBins];
   fh2PtJet1VsLeadPtTagged     = new TH2F*[fNcentBins];
   fh2PtJet1VsPtJet2           = new TH2F*[fNcentBins];
@@ -101,6 +109,7 @@ AliAnalysisTaskEmcalJetTagger::AliAnalysisTaskEmcalJetTagger(const char *name) :
   for (Int_t i = 0; i < fNcentBins; i++) {
     fh3PtJet1VsDeltaEtaDeltaPhi[i] = 0;
     fh2PtJet1VsDeltaR[i]           = 0;
+    fh2PtJet2VsFraction[i]         = 0;
     fh2PtJet1VsLeadPtAllSel[i]     = 0;
     fh2PtJet1VsLeadPtTagged[i]     = 0;
     fh2PtJet1VsPtJet2[i]           = 0;
@@ -129,15 +138,18 @@ void AliAnalysisTaskEmcalJetTagger::UserCreateOutputObjects()
   const Int_t nBinsDPhi        = 100;
   const Int_t nBinsDEta        = 100;
   const Int_t nBinsDR          = 50;
-
-  const Double_t minPt = -50.;
-  const Double_t maxPt = 200.;
-  const Double_t minDPhi = -0.5;
-  const Double_t maxDPhi =  0.5;
-  const Double_t minDEta = -0.5;
-  const Double_t maxDEta =  0.5;
-  const Double_t minDR   =  0.;
-  const Double_t maxDR   =  0.5;
+  const Int_t nBinsFraction    = 101;
+
+  const Double_t minPt       = -50.;
+  const Double_t maxPt       = 200.;
+  const Double_t minDPhi     = -0.5;
+  const Double_t maxDPhi     =  0.5;
+  const Double_t minDEta     = -0.5;
+  const Double_t maxDEta     =  0.5;
+  const Double_t minDR       =  0.;
+  const Double_t maxDR       =  0.5;
+  const Double_t minFraction =  -0.005;
+  const Double_t maxFraction =  1.005;
 
   TString histName = "";
   TString histTitle = "";
@@ -153,6 +165,11 @@ void AliAnalysisTaskEmcalJetTagger::UserCreateOutputObjects()
     fh2PtJet1VsDeltaR[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsDR,minDR,maxDR);
     fOutput->Add(fh2PtJet1VsDeltaR[i]);
 
+    histName = TString::Format("fh2PtJet2VsFraction_%d",i);
+    histTitle = TString::Format("%s;#it{p}_{T,jet2};#it{f}_{shared}",histName.Data());
+    fh2PtJet2VsFraction[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsFraction,minFraction,maxFraction);
+    fOutput->Add(fh2PtJet2VsFraction[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.);
@@ -200,8 +217,9 @@ Bool_t AliAnalysisTaskEmcalJetTagger::Run()
 {
   // Run analysis code here, if needed. It will be executed before FillHistograms().
 
-  if(fJetTaggingMethod==kGeo)
-    MatchJetsGeo(fContainerBase,fContainerTag,0,0.3,2);
+  MatchJetsGeo(fContainerBase,fContainerTag,0,0.3,2);
+
+  //  if(fJetTaggingMethod==kFraction)
 
   return kTRUE;
 }
@@ -211,16 +229,17 @@ Bool_t AliAnalysisTaskEmcalJetTagger::FillHistograms()
 {
   // Fill histograms.
 
-  for(int i = 0; i < GetNJets(fContainerBase);++i) {
-    AliEmcalJet *jet1 = static_cast<AliEmcalJet*>(GetAcceptJetFromArray(i, fContainerBase));
-    if(!jet1) continue;
-
-    Double_t ptJet1 =  jet1->Pt() - GetRhoVal(fContainerBase)*jet1->Area();
+  AliEmcalJet *jet1 = NULL;
+  AliJetContainer *jetCont = GetJetContainer(fContainerBase);
+  if(!jetCont) return kFALSE;
+  jetCont->ResetCurrentID();
+  while((jet1 = jetCont->GetNextAcceptJet())) {
+    Double_t ptJet1 =  jet1->Pt() - jetCont->GetRhoVal()*jet1->Area();
     fh2PtJet1VsLeadPtAllSel[fCentBin]->Fill(ptJet1,jet1->MaxTrackPt());
 
     //fill histo with angle between jet axis and constituents
     for(Int_t icc=0; icc<jet1->GetNumberOfTracks(); icc++) {
-      AliVParticle *vp = static_cast<AliVParticle*>(jet1->TrackAt(icc, fTracks));
+      AliVParticle *vp = static_cast<AliVParticle*>(jet1->TrackAt(icc, jetCont->GetParticleContainer()->GetArray()));//fTracks));
       if(!vp) continue;
       Double_t dEta = jet1->Eta()-vp->Eta();
       Double_t dPhi = jet1->Phi()-vp->Phi();
@@ -236,11 +255,19 @@ Bool_t AliAnalysisTaskEmcalJetTagger::FillHistograms()
     if(jet1->GetTagStatus()<1 && fJetTaggingType==kTag)
       continue;
 
-    AliEmcalJet *jet2 = jet1->GetTaggedJet();
+    AliEmcalJet *jet2 = NULL;
+    if(fJetTaggingType==kTag)     jet2 = jet1->GetTaggedJet();
+    if(fJetTaggingType==kClosest) jet2 = jet1->ClosestJet();
     if(!jet2) continue;
+
     Double_t ptJet2 =  jet2->Pt() - GetRhoVal(fContainerTag)*jet2->Area();
-    fh2PtJet1VsLeadPtTagged[fCentBin]->Fill(ptJet1,jet1->MaxTrackPt());
+    Double_t fraction = jetCont->GetFractionSharedPt(jet1);
+    fh2PtJet2VsFraction[fCentBin]->Fill(ptJet2,fraction);
 
+    if(fraction<fMinFractionShared && fJetTaggingType==kClosest)
+      continue;
+
+    fh2PtJet1VsLeadPtTagged[fCentBin]->Fill(ptJet1,jet1->MaxTrackPt());
     fh2PtJet1VsPtJet2[fCentBin]->Fill(ptJet1,ptJet2);
 
     Double_t dPhi = GetDeltaPhi(jet1->Phi(),jet2->Phi());
@@ -252,9 +279,7 @@ Bool_t AliAnalysisTaskEmcalJetTagger::FillHistograms()
     fh3PtJet1VsDeltaEtaDeltaPhi[fCentBin]->Fill(ptJet1,jet1->Eta()-jet2->Eta(),dPhi);
     fh2PtJet1VsDeltaR[fCentBin]->Fill(ptJet1,GetDeltaR(jet1,jet2));
   }
-
   return kTRUE;
-
 }
 
 //________________________________________________________________________
@@ -275,7 +300,7 @@ void AliAnalysisTaskEmcalJetTagger::ResetTagging(const Int_t c) {
 
 //________________________________________________________________________
 void AliAnalysisTaskEmcalJetTagger::MatchJetsGeo(Int_t c1, Int_t c2,
-                                                Int_t iDebug, Float_t maxDist, Int_t type) {
+                                                Int_t iDebug, Float_t maxDist, Int_t type, Bool_t bReset) {
 
   //
   // Match the full jets to the corresponding charged jets
@@ -290,9 +315,10 @@ void AliAnalysisTaskEmcalJetTagger::MatchJetsGeo(Int_t c1, Int_t c2,
 
   if(nJets1==0 || nJets2==0) return;
 
-  ResetTagging(c1);
-  ResetTagging(c2);
-
+  if(bReset) {
+    ResetTagging(c1);
+    ResetTagging(c2);
+  }
   fMatchingDone = kFALSE;
 
   TArrayI faMatchIndex1;
@@ -418,9 +444,7 @@ void AliAnalysisTaskEmcalJetTagger::MatchJetsGeo(Int_t c1, Int_t c2,
       }
     }
   }
-
   fMatchingDone = kTRUE;
-  
 }
 
 //________________________________________________________________________
@@ -476,7 +500,7 @@ Double_t AliAnalysisTaskEmcalJetTagger::GetFractionSharedPt(const AliEmcalJet *j
  
   if(jetPt2>0) {
 
-    AliDebug(2,Form("%s: nConstituents: %d, ch: %d  chne: %d ne: %d",GetName(),jet1->GetNumberOfConstituents(),jet2->GetNumberOfTracks(),jet1->GetNumberOfTracks(),jet1->GetNumberOfClusters()));
+    AliDebug(2,Form("%s: nConstituents_jet1: %d, nConstituents_jet2: %d, tracks_jet1: %d  tracks_jet2: %d clusters_jet1: %d clusters_jet2: %d",GetName(),jet1->GetNumberOfConstituents(),jet2->GetNumberOfConstituents(),jet1->GetNumberOfTracks(),jet2->GetNumberOfTracks(),jet1->GetNumberOfClusters(),jet2->GetNumberOfClusters()));
     
     Double_t sumPt = 0.;
     AliVParticle *vpf = 0x0;
@@ -488,19 +512,14 @@ Double_t AliAnalysisTaskEmcalJetTagger::GetFractionSharedPt(const AliEmcalJet *j
        if(idx == jet1->TrackAt(icf) && iFound==0 ) {
          iFound=1;
          vpf = static_cast<AliVParticle*>(jet1->TrackAt(icf, fTracks));
-         if(!vpf) continue;
-         if(vpf->Charge()!=0)
-           sumPt += vpf->Pt();
+         if(vpf) sumPt += vpf->Pt();
          continue;
        }
       }
     }
-    
     fraction = sumPt/jetPt2;
-  }
-
+  } else fraction = -1.;
   return fraction;
-
 }
 
 //________________________________________________________________________
index 8ac1656da2180f3893356fac251139d8ce8625e1..316ca5863dc6cae26e99eeaaf65492bba4403417 100644 (file)
@@ -39,6 +39,11 @@ class AliAnalysisTaskEmcalJetTagger : public AliAnalysisTaskEmcalJet {
   void SetJetTaggingType(JetTaggingType t)                      { fJetTaggingType = t;}
   void SetJetTaggingMethod(JetTaggingMethod m)                  { fJetTaggingMethod = m;}
 
+  void SetMinFractionShared(Double_t f)                         { fMinFractionShared = f; }
+
+  //Getters
+  Double_t GetFractionSharedPt(const AliEmcalJet *jet1, const AliEmcalJet *jet2) const;
+
  protected:
   Bool_t                              RetrieveEventObjects();
   Bool_t                              Run();
@@ -48,9 +53,8 @@ class AliAnalysisTaskEmcalJetTagger : public AliAnalysisTaskEmcalJet {
   Double_t GetDeltaPhi(const AliEmcalJet* jet1, const AliEmcalJet* jet2);
   Double_t GetDeltaPhi(Double_t phi1,Double_t phi2);
   Double_t GetDeltaR(const AliEmcalJet* jet1, const AliEmcalJet* jet2) const;
-  Double_t GetFractionSharedPt(const AliEmcalJet *jet1, const AliEmcalJet *jet2) const;
 
-  void     MatchJetsGeo(Int_t c1 = -1, Int_t c2 = -1, Int_t iDebug = 0, Float_t maxDist = 0.3, Int_t type = 2);
+  void     MatchJetsGeo(Int_t c1 = -1, Int_t c2 = -1, Int_t iDebug = 0, Float_t maxDist = 0.3, Int_t type = 2, Bool_t bReset = kTRUE);
   void     ResetTagging(const Int_t c);
   
   JetTaggingType                      fJetTaggingType;             // jet matching type
@@ -58,11 +62,14 @@ class AliAnalysisTaskEmcalJetTagger : public AliAnalysisTaskEmcalJet {
 
   Int_t                               fContainerBase;              // jets to be tagged
   Int_t                               fContainerTag;               // jets used for tagging
+
+  Double_t                            fMinFractionShared;          // only fill histos for jets if shared fraction larger than X
   
  private:
   Bool_t            fMatchingDone;                // flag to indicate if matching is done or not
   TH3F            **fh3PtJet1VsDeltaEtaDeltaPhi;  //!pt jet 1 vs deta vs dphi
   TH2F            **fh2PtJet1VsDeltaR;            //!pt jet 1 vs dR
+  TH2F            **fh2PtJet2VsFraction;          //!pt jet 1 vs shared fraction
   
   TH2F            **fh2PtJet1VsLeadPtAllSel;      //!all jets after std selection
   TH2F            **fh2PtJet1VsLeadPtTagged;      //!tagged jets
@@ -75,7 +82,7 @@ class AliAnalysisTaskEmcalJetTagger : public AliAnalysisTaskEmcalJet {
   AliAnalysisTaskEmcalJetTagger(const AliAnalysisTaskEmcalJetTagger&);            // not implemented
   AliAnalysisTaskEmcalJetTagger &operator=(const AliAnalysisTaskEmcalJetTagger&); // not implemented
 
-  ClassDef(AliAnalysisTaskEmcalJetTagger, 2)
+  ClassDef(AliAnalysisTaskEmcalJetTagger, 3)
 };
 #endif
 
index ddc938b474911cbe85fe77fb3afb93743ad41666..43507cc25e594439e36cab2a3f51b0e8840df902 100644 (file)
@@ -7,7 +7,8 @@ AliAnalysisTaskEmcalJetMass* AddTaskEmcalJetMass(const char * njetsBase,
                                                 const char *CentEst,
                                                 Int_t       pSel,
                                                 TString     trigClass      = "",
-                                                TString     kEmcalTriggers = "") {
+                                                TString     kEmcalTriggers = "",
+                                                TString     tag            = "") {
 
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr)
@@ -26,7 +27,7 @@ AliAnalysisTaskEmcalJetMass* AddTaskEmcalJetMass(const char * njetsBase,
       return NULL;
     }
 
-  TString wagonName = Form("JetMass_%s_TC%s",njetsBase,trigClass.Data());
+  TString wagonName = Form("JetMass_%s_TC%s%s",njetsBase,trigClass.Data(),tag.Data());
 
   //Configure jet tagger task
   AliAnalysisTaskEmcalJetMass *task = new AliAnalysisTaskEmcalJetMass(wagonName.Data());
@@ -45,16 +46,12 @@ AliAnalysisTaskEmcalJetMass* AddTaskEmcalJetMass(const char * njetsBase,
     jetContBase->SetRhoName(nrhoBase);
     jetContBase->ConnectParticleContainer(trackCont);
     jetContBase->ConnectClusterContainer(clusterCont);
-    jetContBase->SetZLeadingCut(0.98,0.98);
     jetContBase->SetPercAreaCut(0.6);
   }
 
   task->SetCaloTriggerPatchInfoName(kEmcalTriggers.Data());
-
   task->SetCentralityEstimator(CentEst);
-
   task->SelectCollisionCandidates(pSel);
-
   task->SetUseAliAnaUtils(kFALSE);
 
   mgr->AddTask(task);
index 90c08e0dff96ef2b64e9b0cebfe1028a65449e8e..bb27034328ca8686e850566b3710dd5d37a809ec 100644 (file)
@@ -28,7 +28,8 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(TString     kTracksName
                                                     TString     kEmcalTriggers      = "",
                                                     TString     kPeriod             = "LHC11h",
                                                     Int_t       recombScheme        = 0,
-                                                    TString     tag                 = "Jet"
+                                                    TString     tag1                = "Jet",
+                                                    TString     tag2                = ""
                                                     ) {
   
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -49,23 +50,25 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(TString     kTracksName
   // #### Add necessary jet finder tasks
   gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
 
+  if(tag2.IsNull()) tag2=tag1;
+
   AliEmcalJetTask* jetFinderTaskBase = 0x0;
   if (strcmp(type,"TPC")==0)
-    jetFinderTaskBase = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus,0.005,recombScheme,tag.Data());
+    jetFinderTaskBase = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus,0.005,recombScheme,tag1.Data());
   else if (strcmp(type,"EMCAL")==0)
-    jetFinderTaskBase = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus,0.005,recombScheme,tag.Data());
+    jetFinderTaskBase = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus,0.005,recombScheme,tag1.Data());
   jetFinderTaskBase->SelectCollisionCandidates(AliVEvent::kAny);
   jetFinderTaskBase->SetMinJetPt(0.);
 
-  AliEmcalJetTask* jetFinderTaskTag  = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kCHARGEDJETS, ptminTag, etminClus,0.005,recombScheme,tag.Data());
+  AliEmcalJetTask* jetFinderTaskTag  = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kCHARGEDJETS, ptminTag, etminClus,0.005,recombScheme,tag2.Data());
   jetFinderTaskTag->SelectCollisionCandidates(AliVEvent::kAny);
   jetFinderTaskTag->SetMinJetPt(0.);
 
-  if(tag.EqualTo("JetPythia")) {
+  if(tag1.EqualTo("JetPythia"))
     jetFinderTaskBase->SelectConstituents(TObject::kBitMask, 0);
+  if(tag2.EqualTo("JetPythia"))
     jetFinderTaskTag->SelectConstituents(TObject::kBitMask, 0);
-  }
-
+  
   TString strJetsBase = jetFinderTaskBase->GetName();
   TString strJetsTag  = jetFinderTaskTag->GetName();
 
@@ -74,7 +77,7 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(TString     kTracksName
   TString rhoNameBase = "";
   TString rhoNameTag  = "";
   if(rhoType==1) {
-    rhoTaskBase = AttachRhoTaskTagger(kPeriod,kTracksName,kClusName,R,ptminTrack,etminClus,recombScheme,tag);
+    rhoTaskBase = AttachRhoTaskTagger(kPeriod,kTracksName,kClusName,R,ptminTrack,etminClus,recombScheme,tag1);
     if(rhoTaskBase) {
       rhoTaskBase->SetCentralityEstimator(CentEst);  
       rhoTaskBase->SelectCollisionCandidates(AliVEvent::kAny);
@@ -84,7 +87,7 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(TString     kTracksName
        rhoNameBase = rhoTaskBase->GetOutRhoScaledName();
     }
     if(rhoTaskTag) {
-      rhoTaskTag = AttachRhoTaskTagger(kPeriod,kTracksName,kClusName,R,ptminTag,0.,recombScheme,tag);
+      rhoTaskTag = AttachRhoTaskTagger(kPeriod,kTracksName,kClusName,R,ptminTag,0.,recombScheme,tag2);
       rhoTaskTag->SetCentralityEstimator(CentEst); 
       rhoTaskTag->SelectCollisionCandidates(AliVEvent::kAny);
       rhoNameTag  = rhoTaskTag->GetOutRhoName();
@@ -159,7 +162,6 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(const char * njetsBase,
     jetContBase->SetRhoName(nrhoBase);
     jetContBase->ConnectParticleContainer(trackCont);
     jetContBase->ConnectClusterContainer(clusterCont);
-    jetContBase->SetZLeadingCut(0.98,0.98);
   }
 
   AliJetContainer *jetContTag = task->AddJetContainer(njetsTag,"TPC",R);
@@ -190,6 +192,7 @@ AliAnalysisTaskEmcalJetTagger* AddTaskEmcalJetTagger(const char * njetsBase,
   return task;  
 }
 
+//Attach rho task
 AliAnalysisTaskRhoBase *AttachRhoTaskTagger(TString     kPeriod             = "LHC13b",
                                            TString     kTracksName         = "PicoTracks", 
                                            TString     kClusName           = "caloClustersCorr",