Updates
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Feb 2013 14:57:42 +0000 (14:57 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Feb 2013 14:57:42 +0000 (14:57 +0000)
 Salvatore Aiola <salvatore.aiola@cern.ch>

14 files changed:
ANALYSIS/TenderSupplies/AliEMCALTenderSupply.cxx
PWG/EMCAL/AliEmcalPicoTrackMaker.cxx
PWGJE/CMakelibPWGJEEMCALJetTasks.pkg
PWGJE/EMCALJetTasks/AliAnalysisTaskDeltaPt.cxx
PWGJE/EMCALJetTasks/AliAnalysisTaskDeltaPt.h
PWGJE/EMCALJetTasks/AliEmcalJetTask.cxx
PWGJE/EMCALJetTasks/AliEmcalJetTask.h
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.h
PWGJE/EMCALJetTasks/AliJetResponseMaker.cxx
PWGJE/EMCALJetTasks/AliJetResponseMaker.h
PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C
PWGJE/EMCALJetTasks/macros/AddTaskJetEmbeddingFromAOD.C
PWGJE/PWGJEEMCALJetTasksLinkDef.h

index 9857e13..f7eaa76 100644 (file)
@@ -1363,7 +1363,12 @@ Bool_t AliEMCALTenderSupply::InitClusterization()
     AliInfo(Form("Initialising reclustering parameters: Clusterizer type: %d",fRecParam->GetClusterizerFlag()));
   
   //---setup clusterizer
-  delete fClusterizer;
+  if (fClusterizer) {
+    // avoid deleting fDigitsArr
+    fClusterizer->SetDigitsArr(0);
+    delete fClusterizer;
+    fClusterizer = 0;
+  }
   if     (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1)
     fClusterizer = new AliEMCALClusterizerv1 (fEMCALGeo);
   else if (fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv2) 
index 465f8c3..f04e913 100644 (file)
@@ -190,14 +190,15 @@ void AliEmcalPicoTrackMaker::UserExec(Option_t *)
     }
 
     Int_t label = 0;
-    if (track->GetLabel() > 0 || fUseNegativeLabels)
-      label = track->GetLabel();
-    else
-      label = -track->GetLabel();
-       
-
-    if (fIsMC && label == 0) 
-      label = 99999;
+    if (fIsMC) {
+      if (track->GetLabel() > 0 || fUseNegativeLabels)
+       label = track->GetLabel();
+      else
+       label = -track->GetLabel();
+      
+      if (label == 0) 
+       label = 99999;
+    }
 
     /*AliPicoTrack *picotrack =*/ new ((*fTracksOut)[nacc]) AliPicoTrack(track->Pt(), 
                                                                         track->Eta(), 
index d661bc6..c4eee98 100644 (file)
@@ -40,6 +40,7 @@ set ( SRCS
  EMCALJetTasks/AliJetEmbeddingTask.cxx
  EMCALJetTasks/AliJetEmbeddingFromGenTask.cxx
  EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
+ EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.cxx
  EMCALJetTasks/AliJetModelBaseTask.cxx
  EMCALJetTasks/AliJetRandomizerTask.cxx
  EMCALJetTasks/AliJetResponseMaker.cxx
index 99ee21f..fd5dc2a 100644 (file)
@@ -42,8 +42,8 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt() :
   fEmbeddedTrackNIds(0),
   fHistRCPhiEta(0),
   fHistRCPtExLJVSDPhiLJ(0),
-  fHistEmbJetPhiEta(0),
-  fHistEmbPartPhiEta(0)
+  fHistEmbJetsPhiEta(0),
+  fHistLeadPartPhiEta(0)
 {
   // Default constructor.
 
@@ -55,11 +55,13 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt() :
     fHistDeltaPtRC[i] = 0;
     fHistDeltaPtRCExLJ[i] = 0;
     fHistDeltaPtRCRand[i] = 0;
+    fHistEmbNotFoundPt[i] = 0;
     fHistEmbNotFoundPhiEta[i] = 0;
     fHistEmbJetsPtArea[i] = 0;
     fHistEmbJetsCorrPtArea[i] = 0;
-    fHistEmbPartPt[i] = 0;
-    fHistDistEmbPartJetAxis[i] = 0;
+    fHistEmbPartPtvsJetPt[i] = 0;
+    fHistLeadPartPtvsArea[i] = 0;
+    fHistDistLeadPart2JetAxis[i] = 0;
     fHistEmbBkgArea[i] = 0;
     fHistRhoVSEmbBkg[i] = 0;
     fHistDeltaPtEmbArea[i] = 0;
@@ -88,8 +90,8 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt(const char *name) :
   fEmbeddedTrackNIds(0),
   fHistRCPhiEta(0),
   fHistRCPtExLJVSDPhiLJ(0),
-  fHistEmbJetPhiEta(0),
-  fHistEmbPartPhiEta(0)
+  fHistEmbJetsPhiEta(0),
+  fHistLeadPartPhiEta(0)
 {
   // Standard constructor.
 
@@ -101,11 +103,13 @@ AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt(const char *name) :
     fHistDeltaPtRC[i] = 0;
     fHistDeltaPtRCExLJ[i] = 0;
     fHistDeltaPtRCRand[i] = 0;
+    fHistEmbNotFoundPt[i] = 0;
     fHistEmbNotFoundPhiEta[i] = 0;
     fHistEmbJetsPtArea[i] = 0;
     fHistEmbJetsCorrPtArea[i] = 0;
-    fHistEmbPartPt[i] = 0;
-    fHistDistEmbPartJetAxis[i] = 0;
+    fHistEmbPartPtvsJetPt[i] = 0;
+    fHistLeadPartPtvsArea[i] = 0;
+    fHistDistLeadPart2JetAxis[i] = 0;
     fHistEmbBkgArea[i] = 0;
     fHistRhoVSEmbBkg[i] = 0;
     fHistDeltaPtEmbArea[i] = 0;
@@ -127,108 +131,127 @@ void AliAnalysisTaskDeltaPt::UserCreateOutputObjects()
 
   AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
 
-  fHistRCPhiEta = new TH2F("fHistRCPhiEta","Phi-Eta distribution of rigid cones", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
-  fHistRCPhiEta->GetXaxis()->SetTitle("#eta");
-  fHistRCPhiEta->GetYaxis()->SetTitle("#phi");
-  fOutput->Add(fHistRCPhiEta);
-
-  fHistRCPtExLJVSDPhiLJ = new TH2F("fHistRCPtExLJVSDPhiLJ","fHistRCPtExLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
-  fHistRCPtExLJVSDPhiLJ->GetXaxis()->SetTitle("rigid cone #it{p}_{T} (GeV/#it{c})");
-  fHistRCPtExLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
-  fOutput->Add(fHistRCPtExLJVSDPhiLJ);
-
-  if (!fJetsName.IsNull()) {
-    fHistEmbJetPhiEta = new TH2F("fHistEmbJetPhiEta","Phi-Eta distribution of embedded jets", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
-    fHistEmbJetPhiEta->GetXaxis()->SetTitle("#eta");
-    fHistEmbJetPhiEta->GetYaxis()->SetTitle("#phi");
-    fOutput->Add(fHistEmbJetPhiEta);
+  if (!fTracksName.IsNull() || !fCaloName.IsNull()) {
+    fHistRCPhiEta = new TH2F("fHistRCPhiEta","fHistRCPhiEta", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
+    fHistRCPhiEta->GetXaxis()->SetTitle("#eta");
+    fHistRCPhiEta->GetYaxis()->SetTitle("#phi");
+    fOutput->Add(fHistRCPhiEta);
+
+    if (!fJetsName.IsNull()) {
+      fHistRCPtExLJVSDPhiLJ = new TH2F("fHistRCPtExLJVSDPhiLJ","fHistRCPtExLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
+      fHistRCPtExLJVSDPhiLJ->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
+      fHistRCPtExLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
+      fOutput->Add(fHistRCPtExLJVSDPhiLJ);
+    }
+  }
+
+  if (!fEmbJetsName.IsNull()) {
+    fHistEmbJetsPhiEta = new TH2F("fHistEmbJetsPhiEta","fHistEmbJetsPhiEta", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
+    fHistEmbJetsPhiEta->GetXaxis()->SetTitle("#eta");
+    fHistEmbJetsPhiEta->GetYaxis()->SetTitle("#phi");
+    fOutput->Add(fHistEmbJetsPhiEta);
     
-    fHistEmbPartPhiEta = new TH2F("fHistEmbPartPhiEta","Phi-Eta distribution of embedded particles", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
-    fHistEmbPartPhiEta->GetXaxis()->SetTitle("#eta");
-    fHistEmbPartPhiEta->GetYaxis()->SetTitle("#phi");
-    fOutput->Add(fHistEmbPartPhiEta);
+    fHistLeadPartPhiEta = new TH2F("fHistLeadPartPhiEta","fHistLeadPartPhiEta", 50, -1, 1, 101, 0, TMath::Pi() * 2.02);
+    fHistLeadPartPhiEta->GetXaxis()->SetTitle("#eta");
+    fHistLeadPartPhiEta->GetYaxis()->SetTitle("#phi");
+    fOutput->Add(fHistLeadPartPhiEta);
   }
 
   TString histname;
 
-  for (Int_t i = 0; i < 4; i++) {
-    histname = "fHistRCPt_";
-    histname += i;
-    fHistRCPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-    fHistRCPt[i]->GetXaxis()->SetTitle("rigid cone #it{p}_{T} (GeV/#it{c})");
-    fHistRCPt[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistRCPt[i]);
-
-    histname = "fHistRCPtExLJ_";
-    histname += i;
-    fHistRCPtExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-    fHistRCPtExLJ[i]->GetXaxis()->SetTitle("rigid cone #it{p}_{T}^{RC} (GeV/#it{c})");
-    fHistRCPtExLJ[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistRCPtExLJ[i]);
-
-    histname = "fHistRCPtRand_";
-    histname += i;
-    fHistRCPtRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
-    fHistRCPtRand[i]->GetXaxis()->SetTitle("rigid cone #it{p}_{T}^{RC} (GeV/#it{c})");
-    fHistRCPtRand[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistRCPtRand[i]);
-
-    histname = "fHistRhoVSRCPt_";
-    histname += i;
-    fHistRhoVSRCPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
-    fHistRhoVSRCPt[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
-    fHistRhoVSRCPt[i]->GetYaxis()->SetTitle("rigid cone #it{p}_{T} (GeV/#it{c})");
-    fOutput->Add(fHistRhoVSRCPt[i]);
-
-    histname = "fHistDeltaPtRC_";
-    histname += i;
-    fHistDeltaPtRC[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-    fHistDeltaPtRC[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-    fHistDeltaPtRC[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistDeltaPtRC[i]);
-
-    histname = "fHistDeltaPtRCExLJ_";
-    histname += i;
-    fHistDeltaPtRCExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-    fHistDeltaPtRCExLJ[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-    fHistDeltaPtRCExLJ[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistDeltaPtRCExLJ[i]);
-
-    histname = "fHistDeltaPtRCRand_";
-    histname += i;
-    fHistDeltaPtRCRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
-    fHistDeltaPtRCRand[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
-    fHistDeltaPtRCRand[i]->GetYaxis()->SetTitle("counts");
-    fOutput->Add(fHistDeltaPtRCRand[i]);
+  for (Int_t i = 0; i < fNcentBins; i++) {
+    if (!fTracksName.IsNull() || !fCaloName.IsNull()) {
+      histname = "fHistRCPt_";
+      histname += i;
+      fHistRCPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
+      fHistRCPt[i]->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
+      fHistRCPt[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistRCPt[i]);
+
+      histname = "fHistRhoVSRCPt_";
+      histname += i;
+      fHistRhoVSRCPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
+      fHistRhoVSRCPt[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
+      fHistRhoVSRCPt[i]->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
+      fOutput->Add(fHistRhoVSRCPt[i]);
+
+      histname = "fHistDeltaPtRC_";
+      histname += i;
+      fHistDeltaPtRC[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
+      fHistDeltaPtRC[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
+      fHistDeltaPtRC[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistDeltaPtRC[i]);
+      
+      if (!fJetsName.IsNull()) {
+       histname = "fHistRCPtExLJ_";
+       histname += i;
+       fHistRCPtExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
+       fHistRCPtExLJ[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
+       fHistRCPtExLJ[i]->GetYaxis()->SetTitle("counts");
+       fOutput->Add(fHistRCPtExLJ[i]);
+
+       histname = "fHistDeltaPtRCExLJ_";
+       histname += i;
+       fHistDeltaPtRCExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
+       fHistDeltaPtRCExLJ[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
+       fHistDeltaPtRCExLJ[i]->GetYaxis()->SetTitle("counts");
+       fOutput->Add(fHistDeltaPtRCExLJ[i]);
+      }
+    }
+
+    if (!fRandTracksName.IsNull() || !fRandCaloName.IsNull()) {
+      histname = "fHistRCPtRand_";
+      histname += i;
+      fHistRCPtRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
+      fHistRCPtRand[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
+      fHistRCPtRand[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistRCPtRand[i]);
+
+      histname = "fHistDeltaPtRCRand_";
+      histname += i;
+      fHistDeltaPtRCRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
+      fHistDeltaPtRCRand[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
+      fHistDeltaPtRCRand[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistDeltaPtRCRand[i]);
+    }
+
 
     if (!fEmbJetsName.IsNull()) {
       histname = "fHistEmbJetsPtArea_";
       histname += i;
       fHistEmbJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
       fHistEmbJetsPtArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbJetsPtArea[i]->GetYaxis()->SetTitle("embedded jet #it{p}_{T}^{raw} (GeV/#it{c})");
+      fHistEmbJetsPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,raw} (GeV/#it{c})");
       fOutput->Add(fHistEmbJetsPtArea[i]);
 
       histname = "fHistEmbJetsCorrPtArea_";
       histname += i;
       fHistEmbJetsCorrPtArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins * 2, -fMaxBinPt, fMaxBinPt);
       fHistEmbJetsCorrPtArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbJetsCorrPtArea[i]->GetYaxis()->SetTitle("embedded jet #it{p}_{T}^{corr} (GeV/#it{c})");
+      fHistEmbJetsCorrPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,corr} (GeV/#it{c})");
       fOutput->Add(fHistEmbJetsCorrPtArea[i]);
 
-      histname = "fHistEmbPartPt_";
+      histname = "fHistEmbPartPtvsJetPt_";
+      histname += i;
+      fHistEmbPartPtvsJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
+      fHistEmbPartPtvsJetPt[i]->GetXaxis()->SetTitle("#sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
+      fHistEmbPartPtvsJetPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} (GeV/#it{c})");
+      fHistEmbPartPtvsJetPt[i]->GetZaxis()->SetTitle("counts");
+      fOutput->Add(fHistEmbPartPtvsJetPt[i]);
+
+      histname = "fHistLeadPartPtvsArea_";
       histname += i;
-      fHistEmbPartPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
-      fHistEmbPartPt[i]->GetXaxis()->SetTitle("embedded particle #it{p}_{T}^{emb} (GeV/#it{c})");
-      fHistEmbPartPt[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistEmbPartPt[i]);
+      fHistLeadPartPtvsArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
+      fHistLeadPartPtvsArea[i]->GetXaxis()->SetTitle("area");
+      fHistLeadPartPtvsArea[i]->GetYaxis()->SetTitle("#it{p}_{T,const}^{leading} (GeV/#it{c})");
+      fOutput->Add(fHistLeadPartPtvsArea[i]);
 
-      histname = "fHistDistEmbPartJetAxis_";
+      histname = "fHistDistLeadPart2JetAxis_";
       histname += i;
-      fHistDistEmbPartJetAxis[i] = new TH1F(histname.Data(), histname.Data(), 50, 0, 0.5);
-      fHistDistEmbPartJetAxis[i]->GetXaxis()->SetTitle("distance");
-      fHistDistEmbPartJetAxis[i]->GetYaxis()->SetTitle("counts");
-      fOutput->Add(fHistDistEmbPartJetAxis[i]);
+      fHistDistLeadPart2JetAxis[i] = new TH1F(histname.Data(), histname.Data(), 50, 0, 0.5);
+      fHistDistLeadPart2JetAxis[i]->GetXaxis()->SetTitle("distance");
+      fHistDistLeadPart2JetAxis[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistDistLeadPart2JetAxis[i]);
 
       histname = "fHistEmbNotFoundPhiEta_";
       histname += i;
@@ -237,18 +260,25 @@ void AliAnalysisTaskDeltaPt::UserCreateOutputObjects()
       fHistEmbNotFoundPhiEta[i]->GetYaxis()->SetTitle("#phi");
       fOutput->Add(fHistEmbNotFoundPhiEta[i]);
 
+      histname = "fHistEmbNotFoundPt_";
+      histname += i;
+      fHistEmbNotFoundPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
+      fHistEmbNotFoundPt[i]->GetXaxis()->SetTitle("#it{p}_{T,const}^{emb} (GeV/#it{c})");
+      fHistEmbNotFoundPt[i]->GetYaxis()->SetTitle("counts");
+      fOutput->Add(fHistEmbNotFoundPt[i]);
+
       histname = "fHistEmbBkgArea_";
       histname += i;
       fHistEmbBkgArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
       fHistEmbBkgArea[i]->GetXaxis()->SetTitle("area");
-      fHistEmbBkgArea[i]->GetYaxis()->SetTitle("background of embedded track (GeV/#it{c})");
+      fHistEmbBkgArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
       fOutput->Add(fHistEmbBkgArea[i]);
 
       histname = "fHistRhoVSEmbBkg_";
       histname += i;
       fHistRhoVSEmbBkg[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
       fHistRhoVSEmbBkg[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
-      fHistRhoVSEmbBkg[i]->GetYaxis()->SetTitle("background of embedded track (GeV/#it{c})");
+      fHistRhoVSEmbBkg[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
       fOutput->Add(fHistRhoVSEmbBkg[i]);
       
       histname = "fHistDeltaPtEmbArea_";
@@ -268,50 +298,61 @@ Bool_t AliAnalysisTaskDeltaPt::FillHistograms()
 {
   // Fill histograms.
 
-  Int_t *sortedJets = GetSortedArray(fJets);
-  
-  AliEmcalJet* jet = 0;
-
-  if (sortedJets && sortedJets[0] > 0) 
-    jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0]));
-
   // ************
   // Random cones
   // _________________________________
   
   const Float_t rcArea = fJetRadius * fJetRadius * TMath::Pi();
-
-  for (Int_t i = 0; i < fRCperEvent; i++) {
-    // Simple random cones
-    Float_t RCpt = 0;
-    Float_t RCeta = 0;
-    Float_t RCphi = 0;
-    GetRandomCone(RCpt, RCeta, RCphi, 0);
-    if (RCpt > 0) {
-      fHistRCPhiEta->Fill(RCeta, RCphi);
-      fHistRhoVSRCPt[fCentBin]->Fill(fRhoVal * rcArea, RCpt);
-
-      fHistRCPt[fCentBin]->Fill(RCpt);
-      fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
-    }
+  Float_t RCpt = 0;
+  Float_t RCeta = 0;
+  Float_t RCphi = 0;
   
-    // Random cones far from leading jet
-    RCpt = 0;
-    RCeta = 0;
-    RCphi = 0;
-    GetRandomCone(RCpt, RCeta, RCphi, jet);
-    if (RCpt > 0) {
-      if (jet) {
-       Float_t dphi = RCphi - jet->Phi();
-       if (dphi > 4.8) dphi -= TMath::Pi() * 2;
-       if (dphi < -1.6) dphi += TMath::Pi() * 2; 
-       fHistRCPtExLJVSDPhiLJ->Fill(RCpt, dphi);
+  if (fTracks || fCaloClusters) {
+    
+    for (Int_t i = 0; i < fRCperEvent; i++) {
+      // Simple random cones
+      RCpt = 0;
+      RCeta = 0;
+      RCphi = 0;
+      GetRandomCone(RCpt, RCeta, RCphi, 0);
+      if (RCpt > 0) {
+       fHistRCPhiEta->Fill(RCeta, RCphi);
+       fHistRhoVSRCPt[fCentBin]->Fill(fRhoVal * rcArea, RCpt);
+       
+       fHistRCPt[fCentBin]->Fill(RCpt);
+       fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
+      }
+      
+      if (fJets) {
+
+       // Random cones far from leading jet
+       Int_t *sortedJets = GetSortedArray(fJets);
+       
+       AliEmcalJet* jet = 0;
+       
+       if (sortedJets && sortedJets[0] > 0) 
+         jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0]));
+       
+       RCpt = 0;
+       RCeta = 0;
+       RCphi = 0;
+       GetRandomCone(RCpt, RCeta, RCphi, jet);
+       if (RCpt > 0) {
+         if (jet) {
+           Float_t dphi = RCphi - jet->Phi();
+           if (dphi > 4.8) dphi -= TMath::Pi() * 2;
+           if (dphi < -1.6) dphi += TMath::Pi() * 2; 
+           fHistRCPtExLJVSDPhiLJ->Fill(RCpt, dphi);
+         }
+         fHistRCPtExLJ[fCentBin]->Fill(RCpt);
+         fHistDeltaPtRCExLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
+       }
       }
-      fHistRCPtExLJ[fCentBin]->Fill(RCpt);
-      fHistDeltaPtRCExLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
     }
-    
-    // Random cones with randomized particles
+  }
+  
+  // Random cones with randomized particles
+  if (fRandTracks || fRandCaloClusters) {
     RCpt = 0;
     RCeta = 0;
     RCphi = 0;
@@ -321,109 +362,105 @@ Bool_t AliAnalysisTaskDeltaPt::FillHistograms()
       fHistDeltaPtRCRand[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
     }  
   }
-  
+
   // ************
   // Embedding
   // _________________________________
 
-  if (!fEmbJets)
-    return kTRUE;
-
-  AliEmcalJet *embJet = NextEmbeddedJet(0);
-
-  Int_t countEmbJets = 0;
-
-  while (embJet != 0) {
-
-    countEmbJets++;
-
-    Double_t maxClusterPt = 0;
-    Double_t maxClusterEta = 0;
-    Double_t maxClusterPhi = 0;
-
-    Double_t maxTrackPt = 0;
-    Double_t maxTrackEta = 0;
-    Double_t maxTrackPhi = 0;
-
-    Double_t probePt = 0;
-    Double_t probeEta = 0;
-    Double_t probePhi = 0;
-
-    AliVCluster *cluster = embJet->GetLeadingCluster(fEmbCaloClusters);
-    if (cluster) {
-      TLorentzVector nPart;
-      cluster->GetMomentum(nPart, fVertex);
-
-      maxClusterEta = nPart.Eta();
-      maxClusterPhi = nPart.Phi();
-      maxClusterPt = nPart.Pt();
-    }
-
-    AliVParticle *track = embJet->GetLeadingTrack(fEmbTracks);
-    if (track) {
-      maxTrackEta = track->Eta();
-      maxTrackPhi = track->Phi();
-      maxTrackPt = track->Pt();
-    }
+  if (fEmbJets) {
+    
+    AliEmcalJet *embJet = NextEmbeddedJet(0);
+    
+    Int_t countEmbJets = 0;
+    
+    while (embJet != 0) {
+      
+      countEmbJets++;
+      
+      Double_t maxClusterPt = 0;
+      Double_t maxClusterEta = 0;
+      Double_t maxClusterPhi = 0;
 
-    if (!track && !cluster) {
-      AliWarning(Form("%s - Embedded jet found but no leading particle was found (?) !", GetName()));
-      return kTRUE;
-    }
+      Double_t maxTrackPt = 0;
+      Double_t maxTrackEta = 0;
+      Double_t maxTrackPhi = 0;
+      
+      Double_t maxPartPt = 0;
+      Double_t maxPartEta = 0;
+      Double_t maxPartPhi = 0;
+      
+      AliVCluster *cluster = embJet->GetLeadingCluster(fEmbCaloClusters);
+      if (cluster) {
+       TLorentzVector nPart;
+       cluster->GetMomentum(nPart, fVertex);
+       
+       maxClusterEta = nPart.Eta();
+       maxClusterPhi = nPart.Phi();
+       maxClusterPt = nPart.Pt();
+      }
+      
+      AliVParticle *track = embJet->GetLeadingTrack(fEmbTracks);
+      if (track) {
+       maxTrackEta = track->Eta();
+       maxTrackPhi = track->Phi();
+       maxTrackPt = track->Pt();
+      }
+      
+      if (!track && !cluster) {
+       AliWarning(Form("%s - Embedded jet found but no leading particle was found (?) !", GetName()));
+       return kTRUE;
+      }
+      
+      if (maxTrackPt > maxClusterPt) {
+       maxPartPt = maxTrackPt;
+       maxPartEta = maxTrackEta;
+       maxPartPhi = maxTrackPhi;
+      }
+      else {
+       maxPartPt = maxClusterPt;
+       maxPartEta = maxClusterEta;
+       maxPartPhi = maxClusterPhi;
+      }
+      
+      Double_t distLeading2Jet = TMath::Sqrt((embJet->Eta() - maxPartEta) * (embJet->Eta() - maxPartEta) + (embJet->Phi() - maxPartPhi) * (embJet->Phi() - maxPartPhi));
+      
+      fHistEmbPartPtvsJetPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt());
+      fHistLeadPartPhiEta->Fill(maxPartEta, maxPartPhi);
+      fHistLeadPartPtvsArea[fCentBin]->Fill(maxPartPt, embJet->Area());
+      fHistDistLeadPart2JetAxis[fCentBin]->Fill(distLeading2Jet);
+      
+      fHistEmbJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt());
+      fHistEmbJetsCorrPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - fRhoVal * embJet->Area());
+      fHistEmbJetsPhiEta->Fill(embJet->Eta(), embJet->Phi());
+      
+      fHistEmbBkgArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->MCPt());
+      fHistRhoVSEmbBkg[fCentBin]->Fill(fRhoVal * embJet->Area(), embJet->Pt() - embJet->MCPt());
+      fHistDeltaPtEmbArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
 
-    if (maxTrackPt > maxClusterPt) {
-      probePt = maxTrackPt;
-      probeEta = maxTrackEta;
-      probePhi = maxTrackPhi;
-    }
-    else {
-      probePt = maxClusterPt;
-      probeEta = maxClusterEta;
-      probePhi = maxClusterPhi;
+      embJet = NextEmbeddedJet();
     }
 
-    Double_t distProbeJet = TMath::Sqrt((embJet->Eta() - probeEta) * (embJet->Eta() - probeEta) + (embJet->Phi() - probePhi) * (embJet->Phi() - probePhi));
-
-    fHistEmbPartPt[fCentBin]->Fill(probePt);
-    fHistEmbPartPhiEta->Fill(probeEta, probePhi);
-    fHistDistEmbPartJetAxis[fCentBin]->Fill(distProbeJet);
-
-    fHistEmbJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt());
-    fHistEmbJetsCorrPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - fRhoVal * embJet->Area());
-    fHistEmbJetPhiEta->Fill(embJet->Eta(), embJet->Phi());
-
-    fHistEmbBkgArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->MCPt());
-    fHistRhoVSEmbBkg[fCentBin]->Fill(fRhoVal * embJet->Area(), embJet->Pt() - embJet->MCPt());
-    fHistDeltaPtEmbArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
-
-    embJet = NextEmbeddedJet();
-  }
-
-  if (countEmbJets==0) {
-    if (fEmbTracks) {
-      DoEmbTrackLoop();
-      AliVParticle* maxTrack = 0;
-      for (Int_t i = 0; i < fEmbeddedTrackNIds; i++) {
-       AliVParticle *track2 = static_cast<AliVParticle*>(fEmbTracks->At(fEmbeddedTrackIds[i]));
-       if (!maxTrack || track2->Pt() > maxTrack->Pt())
-         maxTrack = track2;
+    if (countEmbJets==0) {
+      if (fEmbTracks) {
+       DoEmbTrackLoop();
+       for (Int_t i = 0; i < fEmbeddedTrackNIds; i++) {
+         AliVParticle *track2 = static_cast<AliVParticle*>(fEmbTracks->At(fEmbeddedTrackIds[i]));
+         if (!track2) continue;
+         fHistEmbNotFoundPhiEta[fCentBin]->Fill(track2->Eta(), track2->Phi());
+         fHistEmbNotFoundPt[fCentBin]->Fill(track2->Pt());
+       }
       }
-      if (maxTrack)
-       fHistEmbNotFoundPhiEta[fCentBin]->Fill(maxTrack->Eta(), maxTrack->Phi());
-    }
-
-    if (fEmbCaloClusters) {
-      DoEmbClusterLoop();
-      TLorentzVector maxCluster;
-      for (Int_t i = 0; i < fEmbeddedClusterNIds; i++) {
-       AliVCluster *cluster2 = static_cast<AliVCluster*>(fEmbCaloClusters->At(fEmbeddedClusterIds[i]));
-       TLorentzVector nPart;
-       cluster2->GetMomentum(nPart, fVertex);
-       if (nPart.Pt() > maxCluster.Pt())
-         maxCluster = nPart;
+      
+      if (fEmbCaloClusters) {
+       DoEmbClusterLoop();
+       for (Int_t i = 0; i < fEmbeddedClusterNIds; i++) {
+         AliVCluster *cluster2 = static_cast<AliVCluster*>(fEmbCaloClusters->At(fEmbeddedClusterIds[i]));
+         TLorentzVector nPart;
+         cluster2->GetMomentum(nPart, fVertex);
+         fHistEmbNotFoundPhiEta[fCentBin]->Fill(nPart.Eta(), nPart.Phi());
+         fHistEmbNotFoundPt[fCentBin]->Fill(nPart.Pt());
+       }
       }
-      if (maxCluster.Pt() > 0)
-       fHistEmbNotFoundPhiEta[fCentBin]->Fill(maxCluster.Eta(), maxCluster.Phi());
     }
   }
 
index 8a7ac24..1d4e4b7 100644 (file)
@@ -5,9 +5,8 @@
 
 class TClonesArray;
 class TString;
-class TH1F;
-class TH2F;
-class AliRhoParameter;
+class TH1;
+class TH2;
 
 #include "AliAnalysisTaskEmcalJet.h"
 
@@ -60,27 +59,29 @@ class AliAnalysisTaskDeltaPt : public AliAnalysisTaskEmcalJet {
   Int_t                       fEmbeddedTrackIds[999];      //!Embedded track ids
 
   // Random cones
-  TH2F                       *fHistRCPhiEta;               //!Phi-Eta distribution of random cones
-  TH1F                       *fHistRCPt[4];                //!Random cone pt
-  TH1F                       *fHistRCPtExLJ[4];            //!Random cone pt, imposing min distance from leading jet
-  TH1F                       *fHistRCPtRand[4];            //!Random cone pt, randomized particles
-  TH2F                       *fHistRCPtExLJVSDPhiLJ;       //!Random cone pt, imposing min distance from leading jet, vs. deltaPhi leading jet
-  TH2F                       *fHistRhoVSRCPt[4];           //!Area(RC) * rho vs. Pt(RC)
-  TH1F                       *fHistDeltaPtRC[4];           //!deltaPt = Pt(RC) - A * rho
-  TH1F                       *fHistDeltaPtRCExLJ[4];       //!deltaPt = Pt(RC) - A * rho, imposing min distance from leading jet
-  TH1F                       *fHistDeltaPtRCRand[4];       //!deltaPt = Pt(RC) - A * rho, randomzied particles
+  TH2                        *fHistRCPhiEta;               //!Phi-Eta distribution of random cones
+  TH1                        *fHistRCPt[4];                //!Random cone pt
+  TH1                        *fHistRCPtExLJ[4];            //!Random cone pt, imposing min distance from leading jet
+  TH1                        *fHistRCPtRand[4];            //!Random cone pt, randomized particles
+  TH2                        *fHistRCPtExLJVSDPhiLJ;       //!Random cone pt, imposing min distance from leading jet, vs. deltaPhi leading jet
+  TH2                        *fHistRhoVSRCPt[4];           //!Area(RC) * rho vs. Pt(RC)
+  TH1                        *fHistDeltaPtRC[4];           //!deltaPt = Pt(RC) - A * rho
+  TH1                        *fHistDeltaPtRCExLJ[4];       //!deltaPt = Pt(RC) - A * rho, imposing min distance from leading jet
+  TH1                        *fHistDeltaPtRCRand[4];       //!deltaPt = Pt(RC) - A * rho, randomzied particles
 
   // Jet embedding
-  TH2F                       *fHistEmbNotFoundPhiEta[4];   //!Phi-Eta of "not found" embedded particles
-  TH2F                       *fHistEmbJetsPtArea[4];       //!Pt vs. area of embedded jets
-  TH2F                       *fHistEmbJetsCorrPtArea[4];   //!Pt-rho*A vs. area of embedded jets
-  TH1F                       *fHistEmbPartPt[4];           //!Pt distribution of embedded particle
-  TH2F                       *fHistEmbJetPhiEta;           //!Phi-Eta distribution of embedded jets
-  TH2F                       *fHistEmbPartPhiEta;          //!Phi-Eta distribution of embedded particles
-  TH1F                       *fHistDistEmbPartJetAxis[4];  //!Distance between embedded particle and jet axis
-  TH2F                       *fHistEmbBkgArea[4];          //!Pt(embjet) - Pt(embtrack) vs. area of embedded jets
-  TH2F                       *fHistRhoVSEmbBkg[4];         //!Area(embjet) * rho vs. Pt(embjet) - Pt(embtrack)
-  TH2F                       *fHistDeltaPtEmbArea[4];      //!deltaPt = Pt(embjet) - Area(embjet) * rho - Pt(embtrack)
+  TH2                        *fHistEmbNotFoundPhiEta[4];   //!Phi-Eta of "not found" embedded particles
+  TH1                        *fHistEmbNotFoundPt[4];       //!Pt of "not found" embedded particles
+  TH2                        *fHistEmbJetsPtArea[4];       //!Pt vs. area of embedded jets
+  TH2                        *fHistEmbJetsCorrPtArea[4];   //!Pt-rho*A vs. area of embedded jets
+  TH2                        *fHistEmbPartPtvsJetPt[4];    //!MC pt vs total pt of embedded jets
+  TH2                        *fHistEmbJetsPhiEta;          //!Phi-Eta distribution of embedded jets
+  TH2                        *fHistLeadPartPhiEta;         //!Phi-Eta distribution of the leading particle of embedded jets
+  TH2                        *fHistLeadPartPtvsArea[4];    //!Pt of the leading particle vs. area of embedded jets
+  TH1                        *fHistDistLeadPart2JetAxis[4];//!Distance between leading particle and jet axis
+  TH2                        *fHistEmbBkgArea[4];          //!Pt(embjet) - Pt(embtrack) vs. area of embedded jets
+  TH2                        *fHistRhoVSEmbBkg[4];         //!Area(embjet) * rho vs. Pt(embjet) - Pt(embtrack)
+  TH2                        *fHistDeltaPtEmbArea[4];      //!deltaPt = Pt(embjet) - Area(embjet) * rho - Pt(embtrack)
 
  private:
   AliAnalysisTaskDeltaPt(const AliAnalysisTaskDeltaPt&);            // not implemented
index 0c78aa2..54d5089 100644 (file)
@@ -32,9 +32,11 @@ AliEmcalJetTask::AliEmcalJetTask() :
   fTracksName("Tracks"),
   fCaloName("CaloClusters"),
   fJetsName("Jets"),
-  fAlgo(1),
+  fJetType(kNone),
+  fConstSel(kAllJets),
+  fMCConstSel(kAllJets),
+  fMarkConst(kFALSE),
   fRadius(0.4),
-  fType(0),
   fMinJetTrackPt(0.15),
   fMinJetClusPt(0.15),
   fPhiMin(0),
@@ -62,9 +64,11 @@ AliEmcalJetTask::AliEmcalJetTask(const char *name) :
   fTracksName("Tracks"),
   fCaloName("CaloClusters"),
   fJetsName("Jets"),
-  fAlgo(1),
+  fJetType(kAKT|kFullJet|kRX1Jet),
+  fConstSel(kAllJets),
+  fMCConstSel(kAllJets),
+  fMarkConst(kFALSE),
   fRadius(0.4),
-  fType(0),
   fMinJetTrackPt(0.15),
   fMinJetClusPt(0.15),
   fPhiMin(0),
@@ -133,11 +137,18 @@ void AliEmcalJetTask::FindJets()
 
   TString name("kt");
   fastjet::JetAlgorithm jalgo(fastjet::kt_algorithm);
-  if (fAlgo>=1) {
+  if ((fJetType & kAKT) != 0) {
     name  = "antikt";
     jalgo = fastjet::antikt_algorithm;
   }
 
+  if ((fJetType & kR020Jet) != 0)
+    fRadius = 0.2;
+  else if ((fJetType & kR030Jet) != 0)
+    fRadius = 0.3; 
+  else if ((fJetType & kR040Jet) != 0)
+    fRadius = 0.4;
+
   // setup fj wrapper
   AliFJWrapper fjw(name, name);
   fjw.SetAreaType(fastjet::active_area_explicit_ghosts);
@@ -151,16 +162,32 @@ void AliEmcalJetTask::FindJets()
   Double_t vertex[3] = {0, 0, 0};
   fEvent->GetPrimaryVertex()->GetXYZ(vertex);
 
-  if ((fIsMcPart || fType == 0 || fType == 1) && fTracks) {
+  AliDebug(2,Form("Jet type = %d)", fJetType));
+
+  if ((fIsMcPart || ((fJetType & kFullJet) != 0) || ((fJetType & kChargedJet) != 0)) && fTracks) {
     const Int_t Ntracks = fTracks->GetEntries();
     for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
       AliVParticle *t = static_cast<AliVParticle*>(fTracks->At(iTracks));
       if (!t)
         continue;
-      if (fIsMcPart && fType == 1 && t->Charge() == 0)
-       continue;
-      if (fIsMcPart && fType == 2 && t->Charge() != 0)
-       continue;
+      if (fIsMcPart) {
+       if (((fJetType & kChargedJet) != 0) && (t->Charge() == 0))
+         continue;
+       if (((fJetType & kNeutralJet) != 0) && (t->Charge() != 0))
+         continue;
+      }
+      if (fIsMcPart || t->GetLabel() != 0) {
+       if (fMCConstSel != kAllJets && t->TestBits(fMCConstSel) != (Int_t)fMCConstSel) {
+         AliDebug(2,Form("Skipping track %d because it does not match the bit mask (%d, %d)", iTracks, fMCConstSel, t->TestBits(TObject::kBitMask)));
+         continue;
+       }
+      }
+      else {
+       if (fConstSel != kAllJets && t->TestBits(fConstSel) != (Int_t)fConstSel) {
+         AliDebug(2,Form("Skipping track %d because it does not match the bit mask (%d, %d)", iTracks, fConstSel, t->TestBits(TObject::kBitMask)));
+         continue;
+       }
+      }
       if (t->Pt() < fMinJetTrackPt) 
         continue;
       Double_t eta = t->Eta();
@@ -174,7 +201,7 @@ void AliEmcalJetTask::FindJets()
     }
   }
 
-  if ((fType == 0 || fType == 2) && fClus) {
+  if ((((fJetType & kFullJet) != 0) || ((fJetType & kNeutralJet) != 0)) && fClus) {
     const Int_t Nclus = fClus->GetEntries();
     for (Int_t iClus = 0; iClus < Nclus; ++iClus) {
       AliVCluster *c = 0;
@@ -184,9 +211,20 @@ void AliEmcalJetTask::FindJets()
        AliEmcalParticle *ep = static_cast<AliEmcalParticle*>(fClus->At(iClus));
        if (!ep)
          continue;
+
        c = ep->GetCluster();
        if (!c)
-            continue;
+         continue;
+
+       if (c->GetLabel() > 0) {
+         if (fMCConstSel != kAllJets && ep->TestBits(fMCConstSel) != (Int_t)fMCConstSel)
+           continue;
+       }
+       else {
+         if (fConstSel != kAllJets && ep->TestBits(fConstSel) != (Int_t)fConstSel)
+           continue;
+       }
+
        cEta = ep->Eta();
        cPhi = ep->Phi();
        cPt  = ep->Pt();
@@ -197,6 +235,16 @@ void AliEmcalJetTask::FindJets()
        c = static_cast<AliVCluster*>(fClus->At(iClus));
        if (!c)
          continue;
+
+       if (c->GetLabel() > 0) {
+         if (fMCConstSel != kAllJets && c->TestBits(fMCConstSel) != (Int_t)fMCConstSel)
+           continue;
+       }
+       else {
+         if (fConstSel != kAllJets && c->TestBits(fConstSel) != (Int_t)fConstSel)
+           continue;
+       }
+
        TLorentzVector nP;
        c->GetMomentum(nP, vertex);
        cEta = nP.Eta();
@@ -275,6 +323,8 @@ void AliEmcalJetTask::FindJets()
         AliVParticle *t = static_cast<AliVParticle*>(fTracks->At(tid));
         if (!t)
           continue;
+       if (fMarkConst)
+         t->SetBit(fJetType);
         Double_t cEta = t->Eta();
         Double_t cPhi = t->Phi();
         Double_t cPt  = t->Pt();
@@ -289,8 +339,7 @@ void AliEmcalJetTask::FindJets()
           if (cPt > maxCh)
             maxCh = cPt;
         }
-
-        if (fIsMcPart || t->GetLabel() > 0) // check if MC particle
+        if (fIsMcPart || t->GetLabel() != 0) // check if MC particle
           mcpt += cPt;
 
         if (cPhi<0) 
@@ -315,6 +364,8 @@ void AliEmcalJetTask::FindJets()
           c = ep->GetCluster();
           if (!c)
             continue;
+         if (fMarkConst)
+           ep->SetBit(fJetType);
           cEta = ep->Eta();
           cPhi = ep->Phi();
           cPt  = ep->Pt();
@@ -323,6 +374,8 @@ void AliEmcalJetTask::FindJets()
           c = static_cast<AliVCluster*>(fClus->At(cid));
           if (!c)
             continue;
+         if (fMarkConst)
+           c->SetBit(fJetType);
           TLorentzVector nP;
           c->GetMomentum(nP, vertex);
           cEta = nP.Eta();
index f6f1190..5e2bbe6 100644 (file)
@@ -11,6 +11,24 @@ class AliVEvent;
 
 class AliEmcalJetTask : public AliAnalysisTaskSE {
  public:
+
+  enum JetType {
+    kNone=0,
+    kKT=1<<0,
+    kAKT=1<<1,
+    kFullJet=1<<2,
+    kChargedJet=1<<3,
+    kNeutralJet=1<<4,
+    kR020Jet=1<<5,
+    kR030Jet=1<<6,
+    kR040Jet=1<<7,
+    kRX1Jet=1<<8,  // user defined radii, use SetRadius(Double_t)
+    kRX2Jet=1<<9,
+    kRX3Jet=1<<10,
+    kAllJets=kKT|kAKT|kFullJet|kChargedJet|kNeutralJet|kR020Jet|kR030Jet|kR040Jet|kRX1Jet|kRX2Jet|kRX3Jet
+  };
+
+
   AliEmcalJetTask();
   AliEmcalJetTask(const char *name);
   virtual ~AliEmcalJetTask();
@@ -19,16 +37,21 @@ class AliEmcalJetTask : public AliAnalysisTaskSE {
   void                   UserExec(Option_t *option);
   void                   Terminate(Option_t *option);
 
-  void                   SetAlgo(Int_t a)                 { fAlgo          = a     ; }
+  void                   SelectConstituents(UInt_t constSel, UInt_t MCconstSel)  { fConstSel = constSel; fMCConstSel = MCconstSel; };
+  void                   SetAlgo(Int_t a)                 { if (a==0) fJetType |= kKT; else fJetType |= kAKT; }  // for backward compatibility only
   void                   SetClusName(const char *n)       { fCaloName      = n     ; }
   void                   SetJetsName(const char *n)       { fJetsName      = n     ; }
+  void                   SetJetType(UInt_t t)             { fJetType       = t     ; }
+  void                   SetMarkConstituents(Bool_t m)    { fMarkConst     = m     ; }
   void                   SetMinJetArea(Double_t a)        { fMinJetArea    = a     ; }
   void                   SetMinJetClusPt(Double_t min)    { fMinJetClusPt  = min   ; }
   void                   SetMinJetPt(Double_t j)          { fMinJetPt      = j     ; }
   void                   SetMinJetTrackPt(Double_t min)   { fMinJetTrackPt = min   ; }
-  void                   SetRadius(Double_t r)            { fRadius        = r     ; }
+  void                   SetRadius(Double_t r)            { fRadius        = r     ; if ((fJetType & (kRX1Jet|kRX2Jet|kRX3Jet)) == 0) AliWarning("Radius value will be ignored if jet type is not set to a user defined radius (kRX1Jet,kRX2Jet,kRX3Jet)."); }
   void                   SetTracksName(const char *n)     { fTracksName    = n     ; }
-  void                   SetType(Int_t t)                 { fType          = t     ; }
+  void                   SetType(Int_t t)                 { if (t==0) fJetType |= kFullJet; 
+                                                            else if (t==1) fJetType |= kChargedJet; 
+                                                            else if (t==2) fJetType |= kNeutralJet; } // for backward compatibility only
   void                   SetEtaRange(Double_t emi, Double_t ema) {fEtaMin = emi; fEtaMax = ema; }
   void                   SetPhiRange(Double_t pmi, Double_t pma) {fPhiMin = pmi; fPhiMax = pma; }
   void                   SetGhostArea(Double_t gharea)    { fGhostArea      = gharea;  }
@@ -45,6 +68,9 @@ class AliEmcalJetTask : public AliAnalysisTaskSE {
       fOfflineTriggerMask = fOfflineTriggerMask | offlineTriggerMask;
     }
   }
+
+  UInt_t                 GetJetType()                     { return fJetType; }
+
  protected:
   void                   FindJets();
   Bool_t                 DoInit();
@@ -52,9 +78,11 @@ class AliEmcalJetTask : public AliAnalysisTaskSE {
   TString                fTracksName;             // name of track collection
   TString                fCaloName;               // name of calo cluster collection
   TString                fJetsName;               // name of jet collection
-  Int_t                  fAlgo;                   // algo (0==kt, 1==antikt)
+  UInt_t                 fJetType;                // jet type (algorithm, radius, constituents)
+  UInt_t                 fConstSel;               // select constituents from a previous jet finding
+  UInt_t                 fMCConstSel;             // select MC constituents (label!=0) from a previous jet finding
+  Bool_t                 fMarkConst;              // =true constituents are marked (via TObject::SetBit) as belonging to the jet
   Double_t               fRadius;                 // jet radius
-  Int_t                  fType;                   // jet type (0=all, 1=ch, 2=neutral)
   Double_t               fMinJetTrackPt;          // min jet track momentum   (applied before clustering)
   Double_t               fMinJetClusPt;           // min jet cluster momentum (applied before clustering)
   Double_t               fPhiMin;                 // minimum phi for constituents (applied before clustering)
@@ -77,6 +105,6 @@ class AliEmcalJetTask : public AliAnalysisTaskSE {
   AliEmcalJetTask(const AliEmcalJetTask&);            // not implemented
   AliEmcalJetTask &operator=(const AliEmcalJetTask&); // not implemented
 
-  ClassDef(AliEmcalJetTask, 5) // Jet producing task
+  ClassDef(AliEmcalJetTask, 6) // Jet producing task
 };
 #endif
index c36ea78..3a8937e 100644 (file)
@@ -15,6 +15,7 @@
 #include <TH2C.h>
 #include <TList.h>
 #include <TStreamerInfo.h>
+#include <TRandom.h>
 
 #include "AliVEvent.h"
 #include "AliAODTrack.h"
@@ -37,6 +38,7 @@ ClassImp(AliJetEmbeddingFromAODTask)
 AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() : 
   AliJetModelBaseTask("AliJetEmbeddingFromAODTask"),
   fFileList(0),
+  fRandomAccess(kFALSE),
   fAODTreeName(),
   fAODHeaderName(),
   fAODVertexName(),
@@ -49,19 +51,24 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
   fTriggerMask(AliVEvent::kAny),
   fZVertexCut(10),
   fIncludeNoITS(kTRUE),
-  fTotalFiles(2200),
+  fTotalFiles(2050),
+  fAttempts(5),
   fEsdTreeMode(kFALSE),
   fCurrentFileID(0),
-  fCurrentAODFileID(-1),
+  fCurrentAODFileID(0),
   fCurrentAODFile(0),
   fPicoTrackVersion(0),
+  fCurrentAODTree(0),
   fAODHeader(0),
   fAODVertex(0),
   fAODTracks(0),
   fAODClusters(0),
   fAODCaloCells(0),
   fAODMCParticles(0),
-  fHistFileIDs(0)
+  fCurrentAODEntry(-1),
+  fHistFileMatching(0),
+  fHistAODFileError(0),
+  fHistNotEmbedded(0)
 {
   // Default constructor.
   SetSuffix("AODEmbedding");
@@ -74,6 +81,7 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
 AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t drawqa) : 
   AliJetModelBaseTask(name, drawqa),
   fFileList(0),
+  fRandomAccess(kFALSE),
   fAODTreeName("aodTree"),
   fAODHeaderName("header"),
   fAODVertexName("vertices"),
@@ -86,19 +94,24 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t
   fTriggerMask(AliVEvent::kAny),
   fZVertexCut(10),
   fIncludeNoITS(kTRUE),
-  fTotalFiles(2200),
+  fTotalFiles(2050),
+  fAttempts(5),
   fEsdTreeMode(kFALSE),
   fCurrentFileID(0),
-  fCurrentAODFileID(-1),
+  fCurrentAODFileID(0),
   fCurrentAODFile(0),
   fPicoTrackVersion(0),
+  fCurrentAODTree(0),
   fAODHeader(0),
   fAODVertex(0),
   fAODTracks(0),
   fAODClusters(0),
   fAODCaloCells(0),  
   fAODMCParticles(0),
-  fHistFileIDs(0)
+  fCurrentAODEntry(-1),
+  fHistFileMatching(0),
+  fHistAODFileError(0),
+  fHistNotEmbedded(0)
 {
   // Standard constructor.
   SetSuffix("AODEmbedding");
@@ -126,10 +139,21 @@ void AliJetEmbeddingFromAODTask::UserCreateOutputObjects()
 
   AliJetModelBaseTask::UserCreateOutputObjects();
   
-  fHistFileIDs = new TH2C("fHistFileIDs", "fHistFileIDs", fTotalFiles, -0.5, fTotalFiles - 0.5, fFileList->GetEntriesFast(), -0.5, fFileList->GetEntriesFast() -0.5);
-  fHistFileIDs->GetXaxis()->SetTitle("File no. (PYTHIA)");
-  fHistFileIDs->GetYaxis()->SetTitle("File no. (Embedded AOD)");
-  fOutput->Add(fHistFileIDs);
+  fHistFileMatching = new TH2C("fHistFileMatching", "fHistFileMatching", fTotalFiles, -0.5, fTotalFiles - 0.5, fFileList->GetEntriesFast(), -0.5, fFileList->GetEntriesFast() -0.5);
+  fHistFileMatching->GetXaxis()->SetTitle("File no. (PYTHIA)");
+  fHistFileMatching->GetYaxis()->SetTitle("File no. (Embedded AOD)");
+  fHistFileMatching->GetZaxis()->SetTitle("counts");
+  fOutput->Add(fHistFileMatching);
+
+  fHistAODFileError = new TH1C("fHistAODFileError", "fHistAODFileError", fFileList->GetEntriesFast(), -0.5, fFileList->GetEntriesFast() -0.5);
+  fHistAODFileError->GetXaxis()->SetTitle("File no. (Embedded AOD)");
+  fHistAODFileError->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistAODFileError);
+
+  fHistNotEmbedded = new TH1C("fHistNotEmbedded", "fHistNotEmbedded", fTotalFiles, -0.5, fTotalFiles - 0.5);
+  fHistNotEmbedded->GetXaxis()->SetTitle("File no. (PYTHIA)");
+  fHistNotEmbedded->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistNotEmbedded);
 
   PostData(1, fOutput);
 }
@@ -147,8 +171,10 @@ Bool_t AliJetEmbeddingFromAODTask::UserNotify()
     return kTRUE;
   }
   fCurrentFileID = path.Atoi();
-  fCurrentAODFileID = fFileList->GetEntriesFast() * fCurrentFileID / fTotalFiles;
-  AliInfo(Form("Start embedding from file ID %d", fCurrentAODFileID));
+  if (!fRandomAccess) {
+    fCurrentAODFileID = fFileList->GetEntriesFast() * fCurrentFileID / fTotalFiles-1;
+    AliInfo(Form("Start embedding from file ID %d", fCurrentAODFileID));
+  }
   return kTRUE;
 }
 
@@ -172,22 +198,33 @@ Bool_t AliJetEmbeddingFromAODTask::OpenNextFile()
     fCurrentAODFile = 0;
   }
 
-  if (fCurrentAODFileID >= fFileList->GetEntriesFast())
-    return kFALSE;
+  Int_t i = 0;
+  TString fileName;
 
-  TObjString *objFileName = static_cast<TObjString*>(fFileList->At(fCurrentAODFileID));
-  TString fileName = objFileName->GetString();
-  
-  if (fileName.BeginsWith("alien://") && !gGrid) {
+  do {
+    if (i>0) {
+      AliDebug(2,Form("Failed to open file %s...", fileName.Data()));
+      if (fQAhistos)
+       fHistAODFileError->Fill(fCurrentAODFileID);
+    }
+
+    fileName = GetNextFileName();
+
+    if (fileName.IsNull())
+      break;
+    
+    if (fileName.BeginsWith("alien://") && !gGrid) {
       AliInfo("Trying to connect to AliEn ...");
       TGrid::Connect("alien://");
-  }
+    }
+
+    AliDebug(2,Form("Trying to open file %s...", fileName.Data()));
+    fCurrentAODFile = TFile::Open(fileName);
 
-  fCurrentAODFile = TFile::Open(fileName);
+  } while ((!fCurrentAODFile || fCurrentAODFile->IsZombie()) && i < fAttempts);
 
-  if (!fCurrentAODFile || fCurrentAODFile->IsZombie()) {
+  if (!fCurrentAODFile || fCurrentAODFile->IsZombie())
     return kFALSE;
-  }
 
   const TList *clist = fCurrentAODFile->GetStreamerInfoCache();
   if(clist) {
@@ -198,62 +235,75 @@ Bool_t AliJetEmbeddingFromAODTask::OpenNextFile()
       fPicoTrackVersion = 0;
   }
 
+  fCurrentAODTree = static_cast<TTree*>(fCurrentAODFile->Get(fAODTreeName));
+  if (!fCurrentAODTree)
+    return kFALSE;
+
+  if (!fAODHeaderName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODHeaderName, &fAODHeader);
+  
+  if (!fAODVertexName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODVertexName, &fAODVertex);
+      
+  if (!fAODTrackName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODTrackName, &fAODTracks);
+  
+  if (!fAODClusName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODClusName, &fAODClusters);
+  
+  if (!fAODCellsName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODCellsName, &fAODCaloCells);
+  
+  if (!fAODMCParticlesName.IsNull()) 
+    fCurrentAODTree->SetBranchAddress(fAODMCParticlesName, &fAODMCParticles);
+  
+  if (fRandomAccess)
+    fCurrentAODEntry = TMath::Nint(gRandom->Rndm()*fCurrentAODTree->GetEntries());
+  else
+    fCurrentAODEntry = 0;
+  
   if (fQAhistos)
-    fHistFileIDs->Fill(fCurrentFileID, fCurrentAODFileID);
+    fHistFileMatching->Fill(fCurrentFileID, fCurrentAODFileID-1);
   
-  fCurrentAODFileID++;
   return kTRUE;
 }
 
 //________________________________________________________________________
-Bool_t AliJetEmbeddingFromAODTask::GetNextEntry() 
+TString AliJetEmbeddingFromAODTask::GetNextFileName()
 {
-  static TTree *tree = 0;
-  static Int_t entry = 0;
+    if (fRandomAccess) 
+      fCurrentAODFileID = TMath::Nint(gRandom->Rndm()*fFileList->GetEntriesFast());
+    else
+      fCurrentAODFileID++;
 
+    if (fCurrentAODFileID >= fFileList->GetEntriesFast())
+      return "";
+    
+    TObjString *objFileName = static_cast<TObjString*>(fFileList->At(fCurrentAODFileID));
+    return objFileName->GetString();
+}
+
+//________________________________________________________________________
+Bool_t AliJetEmbeddingFromAODTask::GetNextEntry() 
+{
   Int_t attempts = 0;
 
   do {
-    
-    if (!fCurrentAODFile || !tree || entry >= tree->GetEntries()) {
+    if (!fCurrentAODFile || !fCurrentAODTree || fCurrentAODEntry >= fCurrentAODTree->GetEntries()) {
       if (!OpenNextFile())
        return kFALSE;
-      
-      tree = static_cast<TTree*>(fCurrentAODFile->Get(fAODTreeName));
-      if (!tree)
-       return kFALSE;
-
-      if (!fAODHeaderName.IsNull()) 
-       tree->SetBranchAddress(fAODHeaderName, &fAODHeader);
-
-      if (!fAODVertexName.IsNull()) 
-       tree->SetBranchAddress(fAODVertexName, &fAODVertex);
-      
-      if (!fAODTrackName.IsNull()) 
-       tree->SetBranchAddress(fAODTrackName, &fAODTracks);
-      
-      if (!fAODClusName.IsNull()) 
-       tree->SetBranchAddress(fAODClusName, &fAODClusters);
-      
-      if (!fAODCellsName.IsNull()) 
-       tree->SetBranchAddress(fAODCellsName, &fAODCaloCells);
-
-      if (!fAODMCParticlesName.IsNull()) 
-       tree->SetBranchAddress(fAODMCParticlesName, &fAODMCParticles);
-      
-      entry = 0;
     }
     
-    tree->GetEntry(entry);
-    entry++;
+    fCurrentAODTree->GetEntry(fCurrentAODEntry);
+    fCurrentAODEntry++;
     attempts++;
 
     if (attempts == 1000) 
       AliWarning("After 1000 attempts no event has been accepted by the event selection (trigger, centrality...)!");
 
-  } while (!IsAODEventSelected() && tree);
+  } while (!IsAODEventSelected() && fCurrentAODTree);
 
-  return (tree!=0);
+  return (fCurrentAODTree!=0);
 }
 
 //________________________________________________________________________
@@ -262,18 +312,22 @@ Bool_t AliJetEmbeddingFromAODTask::IsAODEventSelected()
   if (!fEsdTreeMode && fAODHeader) {
     AliAODHeader *aodHeader = static_cast<AliAODHeader*>(fAODHeader);
 
-    UInt_t offlineTrigger = aodHeader->GetOfflineTrigger();
-  
-    if ((offlineTrigger & fTriggerMask) == 0) {
-      AliDebug(2, Form("Event rejected due to physics selection. Event trigger mask: %d, trigger mask selection: %d.", offlineTrigger, fTriggerMask));
-      return kFALSE;
+    if (fTriggerMask != AliVEvent::kAny) {
+      UInt_t offlineTrigger = aodHeader->GetOfflineTrigger();
+      
+      if ((offlineTrigger & fTriggerMask) == 0) {
+       AliDebug(2,Form("Event rejected due to physics selection. Event trigger mask: %d, trigger mask selection: %d.", offlineTrigger, fTriggerMask));
+       return kFALSE;
+      }
     }
     
-    AliCentrality *cent = aodHeader->GetCentralityP();
-    Float_t centVal = cent->GetCentralityPercentile("V0M");
-    if (centVal < fMinCentrality || centVal >= fMaxCentrality) {
-      AliDebug(2, Form("Event rejected due to centrality selection. Event centrality: %f, centrality range selection: %f to %f", centVal, fMinCentrality, fMaxCentrality));
-      return kFALSE;
+    if (fMinCentrality >= 0) {
+      AliCentrality *cent = aodHeader->GetCentralityP();
+      Float_t centVal = cent->GetCentralityPercentile("V0M");
+      if (centVal < fMinCentrality || centVal >= fMaxCentrality) {
+       AliDebug(2,Form("Event rejected due to centrality selection. Event centrality: %f, centrality range selection: %f to %f", centVal, fMinCentrality, fMaxCentrality));
+       return kFALSE;
+      }
     }
   }
 
@@ -293,7 +347,8 @@ Bool_t AliJetEmbeddingFromAODTask::IsAODEventSelected()
 void AliJetEmbeddingFromAODTask::Run() 
 {
   if (!GetNextEntry()) {
-    AliError("Unable to get AOD event to embed. Nothing will be embedded.");
+    fHistNotEmbedded->Fill(fCurrentFileID);
+    AliError("Unable to get the AOD event to embed. Nothing will be embedded.");
     return;
   }
 
index 6b10895..49f5c58 100644 (file)
@@ -10,6 +10,7 @@ class TString;
 class AliVCaloCells;
 class AliVHeader;
 class TH2;
+class TH1;
 
 #include "AliJetModelBaseTask.h"
 
@@ -34,15 +35,19 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   void           SetAODfilterBits(Int_t b0 = 0, Int_t b1 = 0)      { fAODfilterBits[0]   = b0    ; fAODfilterBits[1] = b1  ; }
   void           SetIncludeNoITS(Bool_t f)                         { fIncludeNoITS       = f     ; }
   void           SetTotalFiles(Int_t n)                            { fTotalFiles         = n     ; }
+  void           SetAttempts(Int_t n)                              { fAttempts           = n     ; }
+  void           SetRandomAccess(Bool_t r=kTRUE)                   { fRandomAccess       = r     ; }
 
  protected:
-  Bool_t         ExecOnce()            ;// intialize task
-  void           Run()                 ;// do jet model action
-  Bool_t         OpenNextFile()        ;// open next file in fFileList
-  Bool_t         GetNextEntry()        ;// get next entry in current tree
-  Bool_t         IsAODEventSelected()  ;// AOD event trigger/centrality selection
+  Bool_t          ExecOnce()            ;// intialize task
+  void            Run()                 ;// do jet model action
+  virtual TString GetNextFileName()     ;// get next file name from fFileList
+  virtual Bool_t  OpenNextFile()        ;// open next file
+  virtual Bool_t  GetNextEntry()        ;// get next entry in current tree
+  virtual Bool_t  IsAODEventSelected()  ;// AOD event trigger/centrality selection
 
-  TObjArray     *fFileList            ;//  List of AOD files
+  TObjArray     *fFileList            ;//  List of AOD files 
+  Bool_t         fRandomAccess        ;//  Random access to file number and event
   TString        fAODTreeName         ;//  Name of the tree in the AOD file
   TString        fAODHeaderName       ;//  Name of the header in the AOD tree
   TString        fAODVertexName       ;//  Name of the vertex branch in the AOD tree
@@ -57,23 +62,28 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   Int_t          fAODfilterBits[2]    ;//  AOD track filter bit map
   Bool_t         fIncludeNoITS        ;//  True = includes tracks with failed ITS refit
   Int_t          fTotalFiles          ;//  Total number of files per pt hard bin
+  Int_t          fAttempts            ;//  Attempts to be tried before giving up in opening the next file
   Bool_t         fEsdTreeMode         ;//! True = embed from ESD (must be a skimmed ESD!)
-  Int_t          fCurrentFileID       ;//! Current file being processed (trough the event handler)
+  Int_t          fCurrentFileID       ;//! Current file being processed (via the event handler)
   Int_t          fCurrentAODFileID    ;//! Current file ID
   TFile         *fCurrentAODFile      ;//! Current open file
   Int_t          fPicoTrackVersion    ;//! Version of the PicoTrack class (if any) in fCurrentAODFile
+  TTree         *fCurrentAODTree      ;//! Current open tree
   AliVHeader    *fAODHeader           ;//! AOD header
   TClonesArray  *fAODVertex           ;//! AOD vertex
   TClonesArray  *fAODTracks           ;//! AOD track collection
   TClonesArray  *fAODClusters         ;//! AOD cluster collection
   AliVCaloCells *fAODCaloCells        ;//! AOD cell collection
   TClonesArray  *fAODMCParticles      ;//! AOD MC particles collection
-  TH2           *fHistFileIDs         ;//! Current file ID vs. AOD file ID (to be embedded)
+  Int_t          fCurrentAODEntry     ;//! Current entry in the AOD tree
+  TH2           *fHistFileMatching    ;//! Current file ID vs. AOD file ID (to be embedded)
+  TH1           *fHistAODFileError    ;//! AOD file ID (to be embedded) error
+  TH1           *fHistNotEmbedded     ;//! File ID not embedded
 
  private:
   AliJetEmbeddingFromAODTask(const AliJetEmbeddingFromAODTask&);            // not implemented
   AliJetEmbeddingFromAODTask &operator=(const AliJetEmbeddingFromAODTask&); // not implemented
 
-  ClassDef(AliJetEmbeddingFromAODTask, 3) // Jet embedding from AOD task
+  ClassDef(AliJetEmbeddingFromAODTask, 4) // Jet embedding from AOD task
 };
 #endif
index 4194f08..a8505fb 100644 (file)
@@ -62,7 +62,8 @@ AliJetResponseMaker::AliJetResponseMaker() :
   fHistJets2PtAreaAcceptance(0),
   fHistJets2CorrPtAreaAcceptance(0),
   fHistMatchingLevelvsJet2Pt(0),
-  fHistDistancevsCommonEnergy(0),
+  fHistDistancevsCommonEnergy1(0),
+  fHistDistancevsCommonEnergy2(0),
   fHistDeltaEtaPhivsJet2Pt(0),
   fHistDeltaPtvsJet2Pt(0),
   fHistDeltaPtvsMatchingLevel(0),
@@ -121,7 +122,8 @@ AliJetResponseMaker::AliJetResponseMaker(const char *name) :
   fHistJets2PtAreaAcceptance(0),
   fHistJets2CorrPtAreaAcceptance(0),
   fHistMatchingLevelvsJet2Pt(0),
-  fHistDistancevsCommonEnergy(0),
+  fHistDistancevsCommonEnergy1(0),
+  fHistDistancevsCommonEnergy2(0),
   fHistDeltaEtaPhivsJet2Pt(0),
   fHistDeltaPtvsJet2Pt(0),
   fHistDeltaPtvsMatchingLevel(0),
@@ -232,11 +234,17 @@ void AliJetResponseMaker::UserCreateOutputObjects()
   fHistMatchingLevelvsJet2Pt->GetZaxis()->SetTitle("counts");
   fOutput->Add(fHistMatchingLevelvsJet2Pt);
 
-  fHistDistancevsCommonEnergy = new TH2F("fHistDistancevsCommonEnergy", "fHistDistancevsCommonEnergy", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
-  fHistDistancevsCommonEnergy->GetXaxis()->SetTitle("Distance");
-  fHistDistancevsCommonEnergy->GetYaxis()->SetTitle("Common energy (%)");  
-  fHistDistancevsCommonEnergy->GetZaxis()->SetTitle("counts");
-  fOutput->Add(fHistDistancevsCommonEnergy);
+  fHistDistancevsCommonEnergy1 = new TH2F("fHistDistancevsCommonEnergy1", "fHistDistancevsCommonEnergy1", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
+  fHistDistancevsCommonEnergy1->GetXaxis()->SetTitle("Distance");
+  fHistDistancevsCommonEnergy1->GetYaxis()->SetTitle("Common energy 1 (%)");  
+  fHistDistancevsCommonEnergy1->GetZaxis()->SetTitle("counts");
+  fOutput->Add(fHistDistancevsCommonEnergy1);
+
+  fHistDistancevsCommonEnergy2 = new TH2F("fHistDistancevsCommonEnergy2", "fHistDistancevsCommonEnergy2", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
+  fHistDistancevsCommonEnergy2->GetXaxis()->SetTitle("Distance");
+  fHistDistancevsCommonEnergy2->GetYaxis()->SetTitle("Common energy 2 (%)");  
+  fHistDistancevsCommonEnergy2->GetZaxis()->SetTitle("counts");
+  fOutput->Add(fHistDistancevsCommonEnergy2);
 
   fHistDeltaEtaPhivsJet2Pt = new TH3F("fHistDeltaEtaPhivsJet2Pt", "fHistDeltaEtaPhivsJet2Pt", 40, -1, 1, 128, -1.6, 4.8, fNbins/2, fMinBinPt, fMaxBinPt);
   fHistDeltaEtaPhivsJet2Pt->GetXaxis()->SetTitle("#Delta#eta");
@@ -916,11 +924,13 @@ Bool_t AliJetResponseMaker::FillHistograms()
          else if ((fAreCollections1MC && fAreCollections2MC) || (!fAreCollections1MC && !fAreCollections2MC))
            GetSameCollectionsMatchingLevel(jet2->MatchedJet(), jet2, d1, d2);
 
-         fHistDistancevsCommonEnergy->Fill(jet2->ClosestJetDistance(), d2);
+         fHistDistancevsCommonEnergy1->Fill(jet2->ClosestJetDistance(), d1);
+         fHistDistancevsCommonEnergy2->Fill(jet2->ClosestJetDistance(), d2);
        }
        else if (jet2->GetMatchingType() == kMCLabel || jet2->GetMatchingType() == kSameCollections) {
          GetGeometricalMatchingLevel(jet2->MatchedJet(), jet2, d1);
-         fHistDistancevsCommonEnergy->Fill(d1, jet2->ClosestJetDistance());
+         fHistDistancevsCommonEnergy1->Fill(d1, jet2->MatchedJet()->ClosestJetDistance());
+         fHistDistancevsCommonEnergy2->Fill(d1, jet2->ClosestJetDistance());
        }
          
        fHistMatchingLevelvsJet2Pt->Fill(jet2->ClosestJetDistance(), jet2->Pt());
index c5a4e53..8974e14 100644 (file)
@@ -96,7 +96,8 @@ class AliJetResponseMaker : public AliAnalysisTaskEmcalJet {
   TH2                        *fHistJets2CorrPtAreaAcceptance; //!inclusive jet pt vs. area histogram 2 using jet 1 cuts (acceptance, leading hadron bias, ...)
   // Jet1-Jet2 matching
   TH2                        *fHistMatchingLevelvsJet2Pt;              //!matching level vs jet 2 pt
-  TH2                        *fHistDistancevsCommonEnergy;             //!distance vs common energy (%)
+  TH2                        *fHistDistancevsCommonEnergy1;            //!distance vs common energy 1 (%)
+  TH2                        *fHistDistancevsCommonEnergy2;            //!distance vs common energy 2 (%)
   TH3                        *fHistDeltaEtaPhivsJet2Pt;                //!delta eta-phi between matched jets vs jet 2 pt
   TH2                        *fHistDeltaPtvsJet2Pt;                    //!delta pt between matched jets vs jet 2 pt
   TH2                        *fHistDeltaPtvsMatchingLevel;             //!delta pt between matched jets vs matching level
index d45ce0e..8bca902 100644 (file)
@@ -1,14 +1,14 @@
 // $Id$ 
 
 AliEmcalJetTask* AddTaskEmcalJet(
+  const UInt_t type          = AliEmcalJetTask::kAKT | AliEmcalJetTask::kFullJet | AliEmcalJetTask::kR040Jet,
   const char *nTracks        = "Tracks",
   const char *nClusters      = "CaloClusters",
-  const Int_t algo           = 1,
-  const Double_t radius      = 0.4,
-  const Int_t type           = 0,
   const Double_t minTrPt     = 0.15,
   const Double_t minClPt     = 0.30,
-  const Double_t ghostArea   = 0.01  
+  const Double_t ghostArea   = 0.01,
+  const Double_t radius      = 0.4,
+  const char *tag            = "Jet"
 )
 {  
   // Get the pointer to the existing analysis manager via the static access method.
@@ -35,24 +35,31 @@ AliEmcalJetTask* AddTaskEmcalJet(
   Double_t minJetPt = 0;
 
   char *algoString;
-  if (algo == 0) {
+  if ((type & AliEmcalJetTask::kKT) != 0) {
     algoString = "KT";
     minJetPt = 0.1;
-  } else if (algo == 1) {
+  } else if ((type & AliEmcalJetTask::kAKT) != 0) {
     algoString = "AKT";
     minJetPt = 1.0;
   }
 
   char *typeString;
-  if (type == 0)
+  if ((type & AliEmcalJetTask::kFullJet) != 0)
     typeString = "Full";
-  else if (type == 1)
+  else if ((type & AliEmcalJetTask::kChargedJet) != 0)
     typeString = "Charged";
-  else if (type == 2)
+  else if ((type & AliEmcalJetTask::kNeutralJet) != 0)
     typeString = "Neutral";
 
   char radiusString[200];
-  sprintf(radiusString,"R0%2.0f",radius*100.0);
+  if ((type & AliEmcalJetTask::kR020Jet) != 0)
+    sprintf(radiusString,"R020");
+  else if ((type & AliEmcalJetTask::kR030Jet) != 0)
+    sprintf(radiusString,"R030");
+  else if ((type & AliEmcalJetTask::kR040Jet) != 0)
+    sprintf(radiusString,"R040");
+  else
+    sprintf(radiusString,"R0%2.0f",radius*100.0);
 
   char pTString[200];
   if (minTrPt==0)
@@ -71,15 +78,15 @@ AliEmcalJetTask* AddTaskEmcalJet(
     sprintf(ETString,"ET%4.0f",minClPt*1000.0);  
 
   TString name;
-  if (type == 0)
-    name = TString(Form("Jet_%s%s%s_%s_%s_%s_%s",
-                        algoString,typeString,radiusString,nTracks,pTString,nClusters,ETString));
-  else if (type == 1)
-    name = TString(Form("Jet_%s%s%s_%s_%s",
-                        algoString,typeString,radiusString,nTracks,pTString));
-  else if (type == 2)
-    name = TString(Form("Jet_%s%s%s_%s_%s",
-                        algoString,typeString,radiusString,nClusters,ETString));
+  if (*nTracks && *nClusters)
+    name = TString(Form("%s_%s%s%s_%s_%s_%s_%s",
+                        tag,algoString,typeString,radiusString,nTracks,pTString,nClusters,ETString));
+  else if (!*nClusters)
+    name = TString(Form("%s_%s%s%s_%s_%s",
+                        tag,algoString,typeString,radiusString,nTracks,pTString));
+  else if (!*nTracks)
+    name = TString(Form("%s_%s%s%s_%s_%s",
+                        tag,algoString,typeString,radiusString,nClusters,ETString));
  
   AliEmcalJetTask* mgrTask = mgr->GetTask(name.Data());
   if (mgrTask)
@@ -89,12 +96,12 @@ AliEmcalJetTask* AddTaskEmcalJet(
   jetTask->SetTracksName(nTracks);
   jetTask->SetClusName(nClusters);
   jetTask->SetJetsName(name);
-  jetTask->SetAlgo(algo);
+  jetTask->SetJetType(type);
   jetTask->SetMinJetTrackPt(minTrPt);
   jetTask->SetMinJetClusPt(minClPt);
   jetTask->SetMinJetPt(minJetPt);
-  jetTask->SetRadius(radius);
-  jetTask->SetType(type);
+  if ((type & (AliEmcalJetTask::kRX1Jet|AliEmcalJetTask::kRX2Jet|AliEmcalJetTask::kRX3Jet)) != 0)
+    jetTask->SetRadius(radius);
   jetTask->SetGhostArea(ghostArea);
 
   //-------------------------------------------------------
@@ -109,3 +116,43 @@ AliEmcalJetTask* AddTaskEmcalJet(
 
   return jetTask;
 }
+
+
+AliEmcalJetTask* AddTaskEmcalJet(
+  const char *nTracks        = "Tracks",
+  const char *nClusters      = "CaloClusters",
+  const Int_t algo           = 1,
+  const Double_t radius      = 0.4,
+  const Int_t type           = 0,
+  const Double_t minTrPt     = 0.15,
+  const Double_t minClPt     = 0.30,
+  const Double_t ghostArea   = 0.01  ,
+  const char *tag            = "Jet"
+)
+{  
+  
+  UInt_t jetType = 0;
+
+  if (algo == 0) 
+    jetType |= AliEmcalJetTask::kKT; 
+  else 
+    jetType |= AliEmcalJetTask::kAKT;
+
+  if (type==0)
+    jetType |= AliEmcalJetTask::kFullJet; 
+  else if (type==1) 
+    jetType |= AliEmcalJetTask::kChargedJet; 
+  else if (type==2) 
+    jetType |= AliEmcalJetTask::kNeutralJet;
+
+  if (radius==0.2) 
+    jetType |= AliEmcalJetTask::kR020Jet; 
+  else if (radius==0.3) 
+    jetType |= AliEmcalJetTask::kR030Jet;
+  else if (radius==0.4) 
+    jetType |= AliEmcalJetTask::kR040Jet;
+  else
+    jetType |= AliEmcalJetTask::kRX1Jet;
+
+  return AddTaskEmcalJet(jetType, nTracks, nClusters, minTrPt, minClPt, ghostArea, radius, tag);
+}
index 562aeaa..7c10070 100644 (file)
@@ -13,7 +13,7 @@ AliJetEmbeddingFromAODTask* AddTaskJetEmbeddingFromAOD(
   const char     *aodClusName   = "",
   const char     *aodCellsName  = "emcalCells",
   const char     *aodMCPartName = "",
-  const char     *runperiod     = "",
+  const char     *runperiod     = "lhc11h",
   Bool_t          includeNoITS  = kTRUE,
   Double_t        minCent       = 0,
   Double_t        maxCent       = 10,
@@ -74,7 +74,6 @@ AliJetEmbeddingFromAODTask* AddTaskJetEmbeddingFromAOD(
   jetEmb->SetEtaRange(minEta, maxEta);
   jetEmb->SetPhiRange(minPhi, maxPhi);
   jetEmb->SetPtRange(minPt, maxPt);
-  jetEmb->SetMarkMC(-1);
 
   jetEmb->SetIncludeNoITS(includeNoITS);
   TString runPeriod(runperiod);
index 98cba0b..675fa63 100644 (file)
@@ -19,6 +19,7 @@
 #pragma link C++ class AliJetEmbeddingTask+;
 #pragma link C++ class AliJetEmbeddingFromGenTask+;
 #pragma link C++ class AliJetEmbeddingFromAODTask+;
+#pragma link C++ class AliJetEmbeddingFromPYTHIATask+;
 #pragma link C++ class AliJetModelBaseTask+;
 #pragma link C++ class AliJetRandomizerTask+;
 #pragma link C++ class AliJetResponseMaker+;