calc match fraction from unsubtracted jet
authormverweij <marta.verweij@cern.ch>
Tue, 18 Nov 2014 10:57:22 +0000 (11:57 +0100)
committermverweij <marta.verweij@cern.ch>
Tue, 18 Nov 2014 11:57:01 +0000 (12:57 +0100)
adjust AddTaskEmcalJetMass to set also unsub branch

PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetMass.h
PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetMass.C

index c377470..4577a6f 100644 (file)
@@ -39,7 +39,9 @@ ClassImp(AliAnalysisTaskEmcalJetMass)
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() : 
   AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetMass", kTRUE),
   fContainerBase(0),
+  fContainerUnsub(1),
   fMinFractionShared(0),
+  fUseUnsubJet(0),
   fJetMassType(kRaw),
   fh3PtJet1VsMassVsLeadPtAllSel(0),
   fh3PtJet1VsMassVsLeadPtTagged(0),
@@ -124,7 +126,7 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
     fh2RatVsNConstJet1Tagged[i]            = 0;
     fh2RatVsNConstJet1TaggedMatch[i]       = 0;
 
-    fh2EtMassOverEtRSq[i]                   = 0;
+    fh2EtMassOverEtRSq[i]                  = 0;
   }
 
   SetMakeGeneralHistograms(kTRUE);
@@ -134,7 +136,9 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass() :
 AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),  
   fContainerBase(0),
+  fContainerUnsub(1),
   fMinFractionShared(0),
+  fUseUnsubJet(0),
   fJetMassType(kRaw),
   fh3PtJet1VsMassVsLeadPtAllSel(0),
   fh3PtJet1VsMassVsLeadPtTagged(0),
@@ -177,18 +181,18 @@ AliAnalysisTaskEmcalJetMass::AliAnalysisTaskEmcalJetMass(const char *name) :
   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];
+  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];
 
@@ -454,7 +458,26 @@ Bool_t AliAnalysisTaskEmcalJetMass::FillHistograms()
       fh2RatVsAreaJet1Tagged[fCentBin]->Fill(rat,jet1->Area());
       fh2RatVsNConstJet1Tagged[fCentBin]->Fill(rat,jet1->GetNumberOfConstituents());
 
-      Double_t fraction = jetCont->GetFractionSharedPt(jet1);
+      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);
index 8cf72a5..6403368 100644 (file)
@@ -28,9 +28,10 @@ class AliAnalysisTaskEmcalJetMass : public AliAnalysisTaskEmcalJet {
   void                                Terminate(Option_t *option);
 
   //Setters
-  void SetJetContainerBase(Int_t c)                             { fContainerBase     = c   ; }
-  void SetMinFractionShared(Double_t f)                         { fMinFractionShared = f   ; }
-  void SetJetMassType(JetMassType t)                            { fJetMassType       = t   ; }
+  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   ; }
 
  protected:
   Bool_t                              RetrieveEventObjects();
@@ -40,7 +41,9 @@ class AliAnalysisTaskEmcalJetMass : public AliAnalysisTaskEmcalJet {
   Double_t                            GetJetMass(AliEmcalJet *jet);
  
   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
 
   TH3F            **fh3PtJet1VsMassVsLeadPtAllSel;         //!all jets after std selection pt vs mass vs leading track pt
@@ -75,7 +78,7 @@ class AliAnalysisTaskEmcalJetMass : public AliAnalysisTaskEmcalJet {
   AliAnalysisTaskEmcalJetMass(const AliAnalysisTaskEmcalJetMass&);            // not implemented
   AliAnalysisTaskEmcalJetMass &operator=(const AliAnalysisTaskEmcalJetMass&); // not implemented
 
-  ClassDef(AliAnalysisTaskEmcalJetMass, 7)
+  ClassDef(AliAnalysisTaskEmcalJetMass, 8)
 };
 #endif
 
index 43507cc..8765e86 100644 (file)
@@ -8,7 +8,8 @@ AliAnalysisTaskEmcalJetMass* AddTaskEmcalJetMass(const char * njetsBase,
                                                 Int_t       pSel,
                                                 TString     trigClass      = "",
                                                 TString     kEmcalTriggers = "",
-                                                TString     tag            = "") {
+                                                TString     tag            = "",
+                                                TString     nJetsUnsub    = "") {
 
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr)
@@ -48,6 +49,15 @@ AliAnalysisTaskEmcalJetMass* AddTaskEmcalJetMass(const char * njetsBase,
     jetContBase->ConnectClusterContainer(clusterCont);
     jetContBase->SetPercAreaCut(0.6);
   }
+  if(!nJetsUnsub.IsNull()) {
+    AliJetContainer *jetContUS = task->AddJetContainer(nJetsUnsub.Data(),strType,R);
+    if(jetContUS) {
+      jetContUS->SetRhoName(nrhoBase);
+      jetContUS->ConnectParticleContainer(trackCont);
+      jetContUS->ConnectClusterContainer(clusterCont);
+      jetContUS->SetPercAreaCut(0.6);
+    }
+  }
 
   task->SetCaloTriggerPatchInfoName(kEmcalTriggers.Data());
   task->SetCentralityEstimator(CentEst);