]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalDiJetAna.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskEmcalDiJetAna.cxx
index 5754afee6824f0962a69f63c4747fa65dbfcfec3..59ba028815d9c73fd9fab39812d508fd4b2d2f44 100644 (file)
@@ -38,6 +38,9 @@ ClassImp(AliAnalysisTaskEmcalDiJetAna)
 AliAnalysisTaskEmcalDiJetAna::AliAnalysisTaskEmcalDiJetAna() : 
   AliAnalysisTaskEmcalDiJetBase("AliAnalysisTaskEmcalDiJetAna"),
   fDoMatchFullCharged(kTRUE),
+  fNKtBins(30),
+  fNDiJetEtaBins(1),
+  fNAjBins(1),
   fh2CentRhoCh(0),
   fh2CentRhoScaled(0),
   fh3PtEtaPhiJetFull(0),
@@ -70,6 +73,9 @@ AliAnalysisTaskEmcalDiJetAna::AliAnalysisTaskEmcalDiJetAna() :
 AliAnalysisTaskEmcalDiJetAna::AliAnalysisTaskEmcalDiJetAna(const char *name) : 
   AliAnalysisTaskEmcalDiJetBase(name),
   fDoMatchFullCharged(kTRUE),
+  fNKtBins(30),
+  fNDiJetEtaBins(1),
+  fNAjBins(1),
   fh2CentRhoCh(0),
   fh2CentRhoScaled(0),
   fh3PtEtaPhiJetFull(0),
@@ -157,14 +163,14 @@ void AliAnalysisTaskEmcalDiJetAna::UserCreateOutputObjects()
   const Int_t nBinsSparse0 = 7;
   const Int_t nBinsPtW      = 30;
   const Int_t nBinsDPhi     = 72;
-  const Int_t nBinsKt       = 50;
-  const Int_t nBinsDiJetEta = 40;
+  const Int_t nBinsKt       = fNKtBins;
+  const Int_t nBinsDiJetEta = fNDiJetEtaBins;//40;
   const Int_t nBinsCentr    = fNcentBins;
-  const Int_t nBinsAj       = 20;
+  const Int_t nBinsAj       = fNAjBins;//20
   const Int_t nBins0[nBinsSparse0] = {nBinsPtW,nBinsPtW,nBinsDPhi,nBinsKt,nBinsDiJetEta,nBinsCentr,nBinsAj};
   //pT1, pT2, deltaPhi, kT
   const Double_t xmin0[nBinsSparse0]  = {  minPt, minPt, -0.5*TMath::Pi(),   0.,-1.,0.  , 0.};
-  const Double_t xmax0[nBinsSparse0]  = {  maxPt, maxPt,  1.5*TMath::Pi(), 100., 1.,100., 1.};
+  const Double_t xmax0[nBinsSparse0]  = {  maxPt, maxPt,  1.5*TMath::Pi(), 120., 1.,100., 1.};
   const Double_t centArrayBins[8] = {0.,2.,5.,10.,20.,40.,60.,100.};
 
   if(fDoChargedCharged) {
@@ -190,38 +196,38 @@ void AliAnalysisTaskEmcalDiJetAna::UserCreateOutputObjects()
     fOutput->Add(fhnDiJetVarsFull);
   }
 
-  fh3PtTrigKt1Kt2Ch = new TH3F("fh3PtTrigKt1Kt2Ch","fh3PtTrigKt1Kt2Ch;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsKt,-100.,100.,nBinsKt,-100.,100.);
+  fh3PtTrigKt1Kt2Ch = new TH3F("fh3PtTrigKt1Kt2Ch","fh3PtTrigKt1Kt2Ch;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsKt,0.,120.,nBinsKt,0.,120.);
   fOutput->Add(fh3PtTrigKt1Kt2Ch);  
 
-  fh3PtTrigKt1Kt2FuCh = new TH3F("fh3PtTrigKt1Kt2FuCh","fh3PtTrigKt1Kt2FuCh;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsKt,-100.,100.,nBinsKt,-100.,100.);
+  fh3PtTrigKt1Kt2FuCh = new TH3F("fh3PtTrigKt1Kt2FuCh","fh3PtTrigKt1Kt2FuCh;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsKt,0.,120.,nBinsKt,0.,120.);
   fOutput->Add(fh3PtTrigKt1Kt2FuCh); 
 
-  fh3PtTrigDPhi1DPhi2Ch = new TH3F("fh3PtTrigDPhi1DPhi2Ch","fh3PtTrigDPhi1DPhi2Ch;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsDPhi,-0.5*TMath::Pi(),1.5*TMath::Pi(),nBinsDPhi,-0.5*TMath::Pi(),1.5*TMath::Pi());
+  fh3PtTrigDPhi1DPhi2Ch = new TH3F("fh3PtTrigDPhi1DPhi2Ch","fh3PtTrigDPhi1DPhi2Ch;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,36,-0.5*TMath::Pi(),1.5*TMath::Pi(),36,-0.5*TMath::Pi(),1.5*TMath::Pi());
   fOutput->Add(fh3PtTrigDPhi1DPhi2Ch);  
 
-  fh3PtTrigDPhi1DPhi2FuCh = new TH3F("fh3PtTrigDPhi1DPhi2FuCh","fh3PtTrigDPhi1DPhi2FuCh;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,nBinsDPhi,-0.5*TMath::Pi(),1.5*TMath::Pi(),nBinsDPhi,-0.5*TMath::Pi(),1.5*TMath::Pi());
+  fh3PtTrigDPhi1DPhi2FuCh = new TH3F("fh3PtTrigDPhi1DPhi2FuCh","fh3PtTrigDPhi1DPhi2FuCh;#it{p}_{T,1} (GeV/#it{c});#it{k}_{T,1};#it{k}_{T,2}",nBinsPt,minPt,maxPt,36,-0.5*TMath::Pi(),1.5*TMath::Pi(),36,-0.5*TMath::Pi(),1.5*TMath::Pi());
   fOutput->Add(fh3PtTrigDPhi1DPhi2FuCh);  
  
 
   for(Int_t i=0; i<4; i++) {
     TString histoName = Form("fh3DiJetKtNEFPtAssoc_TrigBin%d",i);
-    fh3DiJetKtNEFPtAssoc[i] = new TH3F(histoName.Data(),histoName.Data(),nBinsKt,-100.,100.,50,0.,1.,nBinsPt,minPt,maxPt);
+    fh3DiJetKtNEFPtAssoc[i] = new TH3F(histoName.Data(),histoName.Data(),nBinsKt,0.,120.,50,0.,1.,nBinsPt,minPt,maxPt);
     fOutput->Add(fh3DiJetKtNEFPtAssoc[i]);
 
     histoName = Form("fCentCorrPtAssocCh_TrigBin%d",i);
-    fCentCorrPtAssocCh[i]  = new TH3F(histoName.Data(),histoName.Data(),100,0.,100.,100,0.,100.,nBinsPt,minPt,maxPt);
+    fCentCorrPtAssocCh[i]  = new TH3F(histoName.Data(),histoName.Data(),10,0.,100.,10,0.,100.,nBinsPt,minPt,maxPt);
     fOutput->Add(fCentCorrPtAssocCh[i]);
 
     histoName = Form("fCentCorrPtAssocFuCh_TrigBin%d",i);
-    fCentCorrPtAssocFuCh[i]  = new TH3F(histoName.Data(),histoName.Data(),100,0.,100.,100,0.,100.,nBinsPt,minPt,maxPt);
+    fCentCorrPtAssocFuCh[i]  = new TH3F(histoName.Data(),histoName.Data(),10,0.,100.,10,0.,100.,nBinsPt,minPt,maxPt);
     fOutput->Add(fCentCorrPtAssocFuCh[i]);
 
     histoName = Form("fAjPtAssocCentCh_TrigBin%d",i);
-    fAjPtAssocCentCh[i]  = new TH3F(histoName.Data(),histoName.Data(),100,0.,1.,nBinsPt,minPt,maxPt,100,0.,100.);
+    fAjPtAssocCentCh[i]  = new TH3F(histoName.Data(),histoName.Data(),50,0.,1.,nBinsPt,minPt,maxPt,20,0.,100.);
     fOutput->Add(fAjPtAssocCentCh[i]);
 
     histoName = Form("fAjPtAssocCentFuCh_TrigBin%d",i);
-    fAjPtAssocCentFuCh[i]  = new TH3F(histoName.Data(),histoName.Data(),100,0.,1.,nBinsPt,minPt,maxPt,100,0.,100.);
+    fAjPtAssocCentFuCh[i]  = new TH3F(histoName.Data(),histoName.Data(),50,0.,1.,nBinsPt,minPt,maxPt,20,0.,100.);
     fOutput->Add(fAjPtAssocCentFuCh[i]);
 
     histoName = Form("fh3PtAssoc1PtAssoc2DPhi23Ch_TrigBin%d",i);
@@ -241,7 +247,7 @@ void AliAnalysisTaskEmcalDiJetAna::UserCreateOutputObjects()
   const Int_t nBinsType = 3;
   const Int_t nBinsMatch[nBinsSparseMatch] = {nBinsPt,nBinsPt,nBinsDPhiMatch,nBinsDEtaMatch,nBinsDR,nBinsFraction,nBinsType};
   //pTfull, pTch, deltaPhi, deltaEta, deltaR, fraction, jet type (leading,subleading,other)
-  const Double_t xminMatch[nBinsSparseMatch]  = { minPt, minPt, -0.5,-0.5, 0.,0.  ,0};
+  const Double_t xminMatch[nBinsSparseMatch]  = { minPt, minPt, -0.5,-0.5, 0. ,0.  ,0};
   const Double_t xmaxMatch[nBinsSparseMatch]  = { maxPt, maxPt,  0.5, 0.5, 0.5,1.05,3};
   if(fDoMatchFullCharged) {
     fhnMatchingFullCharged = new THnSparseF("fhnMatchingFullCharged","fhnMatchingFullCharged;#it{p}_{T,full} (GeV/#it{c});#it{p}_{T,ch} (GeV/#it{c});#Delta#varphi;#Delta#eta;#Delta R;f_{ch};type",
@@ -276,7 +282,6 @@ Bool_t AliAnalysisTaskEmcalDiJetAna::FillHistograms()
   fh2CentRhoCh->Fill(fCent,fRhoChVal);
   fh2CentRhoScaled->Fill(fCent,fRhoFullVal);
 
-
   Int_t nJetsFull = GetNJets(fContainerFull);
   for(Int_t ij=0; ij<nJetsFull; ij++) {
     AliEmcalJet *jet = static_cast<AliEmcalJet*>(GetAcceptJetFromArray(ij, fContainerFull));
@@ -284,7 +289,6 @@ Bool_t AliAnalysisTaskEmcalDiJetAna::FillHistograms()
 
     Double_t jetPt = GetJetPt(jet,0);
     fh3PtEtaPhiJetFull->Fill(jetPt,jet->Eta(),jet->Phi());
-    
   }
 
   Int_t nJetsCh = GetNJets(fContainerCharged);
@@ -294,9 +298,7 @@ Bool_t AliAnalysisTaskEmcalDiJetAna::FillHistograms()
 
       Double_t jetPt = GetJetPt(jet,1);
       fh3PtEtaPhiJetCharged->Fill(jetPt,jet->Eta(),jet->Phi());
-    
   }
-  
 
   return kTRUE;
 }
@@ -377,17 +379,7 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateTwoJets(const Int_t type) {
     return;
   }
 
-  Int_t nJetsTrig  = 0;
-  if(type==0) {
-    nJetsTrig  = GetNJets(fContainerFull);
-  }
-  else if(type==1) {
-    nJetsTrig  = GetNJets(fContainerCharged);
-  }
-  else if(type==2) {
-    nJetsTrig  = GetNJets(fContainerFull);
-  }
-
+  Int_t nJetsTrig  = GetNJets(typet);
   for(Int_t ijt=0; ijt<nJetsTrig; ijt++) {
 
     AliEmcalJet *jetTrig = NULL; 
@@ -399,7 +391,6 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateTwoJets(const Int_t type) {
     else
       jetTrig = static_cast<AliEmcalJet*>(GetAcceptJetFromArray(ijt, typet));
 
-
     if(!jetTrig)
       continue; //jet not selected
     
@@ -412,9 +403,11 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateTwoJets(const Int_t type) {
     if(!jetAssoc)
       continue;
 
-    if(type==0 || type==1) {
-      if(GetJetPt(jetAssoc,typea)>jetTrigPt)
-       continue;
+    if(fDoPtBias) {
+      if(type==0 || type==1) {
+       if(GetJetPt(jetAssoc,typea)>jetTrigPt)
+         continue;
+      }
     }
 
     FillDiJetHistos(jetTrig,jetAssoc, type);
@@ -425,7 +418,6 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateTwoJets(const Int_t type) {
       FillThreeJetHistos(jetTrig,jetAssoc,jetAssoc2,type);
     
   }
-
 }
 
 //________________________________________________________________________
@@ -445,7 +437,6 @@ AliEmcalJet* AliAnalysisTaskEmcalDiJetAna::GetLeadingJet(const Int_t type) {
   Double_t ptLead = -999;
   Int_t    iJetLead = -1;
   for(Int_t ij=0; ij<nJets; ij++) {
-
     AliEmcalJet *jet = NULL;
     if(type==0) {
       jet = static_cast<AliEmcalJet*>(GetJetFromArray(ij, cont));
@@ -464,13 +455,11 @@ AliEmcalJet* AliAnalysisTaskEmcalDiJetAna::GetLeadingJet(const Int_t type) {
       ptLead = jetPt;
       iJetLead = ij;
     }
-
   }
 
   AliEmcalJet *jetLead = static_cast<AliEmcalJet*>(GetJetFromArray(iJetLead, cont));
 
   return jetLead;
-
 }
 
 //________________________________________________________________________
@@ -489,7 +478,6 @@ AliEmcalJet* AliAnalysisTaskEmcalDiJetAna::GetLeadingAssociatedJet(const Int_t t
   AliEmcalJet *jetAssocLead = GetLeadingJetOppositeHemisphere(type, typea, jetTrig);
   
   return jetAssocLead;
-
 }
 
 //________________________________________________________________________
@@ -508,7 +496,6 @@ AliEmcalJet* AliAnalysisTaskEmcalDiJetAna::GetSecondLeadingAssociatedJet(const I
   AliEmcalJet *jetAssocLead2 = GetSecondLeadingJetOppositeHemisphere(type, typea, jetTrig);
   
   return jetAssocLead2;
-
 }
 
 //________________________________________________________________________
@@ -536,23 +523,10 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateAllJets(const Int_t type) {
     return;
   }
 
-  Int_t nJetsTrig  = 0;
-  Int_t nJetsAssoc = 0;
-  if(type==0) {
-    nJetsTrig  = GetNJets(fContainerFull);
-    nJetsAssoc = nJetsTrig;
-  }
-  else if(type==1) {
-    nJetsTrig  = GetNJets(fContainerCharged);
-    nJetsAssoc = nJetsTrig;
-  }
-  else if(type==2) {
-    nJetsTrig  = GetNJets(fContainerFull);
-    nJetsAssoc = GetNJets(fContainerCharged);
-  }
+  Int_t nJetsTrig  = GetNJets(typet);
+  Int_t nJetsAssoc = GetNJets(typea);
 
   for(Int_t ijt=0; ijt<nJetsTrig; ijt++) {
-
     AliEmcalJet *jetTrig = NULL; 
     if(type==0) {
       jetTrig = static_cast<AliEmcalJet*>(GetJetFromArray(ijt, typet));
@@ -562,7 +536,6 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateAllJets(const Int_t type) {
     else
       jetTrig = static_cast<AliEmcalJet*>(GetAcceptJetFromArray(ijt, typet));
 
-
     if(!jetTrig)
       continue; //jet not selected
     
@@ -621,7 +594,7 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateLeadingSubleadingJets(const Int_t ty
     return;
   }
 
-  AliEmcalJet *jetTrig = GetLeadingJet(type);
+  AliEmcalJet *jetTrig = GetLeadingJet(typet);
   if(!jetTrig)
     return;
 
@@ -634,10 +607,7 @@ void AliAnalysisTaskEmcalDiJetAna::CorrelateLeadingSubleadingJets(const Int_t ty
   if(!jetAssoc)
     return;
   
-
   FillDiJetHistos(jetTrig,jetAssoc, type);
-  
-
 }
 
 //________________________________________________________________________
@@ -651,17 +621,17 @@ void AliAnalysisTaskEmcalDiJetAna::FillDiJetHistos(const AliEmcalJet *jet1, cons
 
   Int_t typet = 0;
   Int_t typea = 0;
-  if(mode==0) {
-    typet = 0;
-    typea = 0;
+  if(mode==0) { //full-full
+    typet = fContainerFull;
+    typea = fContainerFull;
   }
-  else if(mode==1) {
-    typet = 1;
-    typea = 1;
+  else if(mode==1) { //charged-charged
+    typet = fContainerCharged;
+    typea = fContainerCharged;
   }
-  else if(mode==2) {
-    typet = 0;
-    typea = 1;
+  else if(mode==2) { //full-charged
+    typet = fContainerFull;
+    typea = fContainerCharged;
   }
   else {
     AliWarning(Form("%s: mode %d of dijet correlation not defined!",GetName(),mode));
@@ -672,13 +642,13 @@ void AliAnalysisTaskEmcalDiJetAna::FillDiJetHistos(const AliEmcalJet *jet1, cons
   Double_t jetAssocPt = GetJetPt(jet2,typea);
 
   Double_t deltaPhi = GetDeltaPhi(jet1->Phi(),jet2->Phi());
-  if(fDebug>10) Printf("deltaPhi:%.2f",deltaPhi);
 
   Double_t kT = TMath::Abs(jetTrigPt*TMath::Sin(deltaPhi));
 
   Double_t dijetEta = (jet1->Eta()+jet2->Eta())/2.;
 
-  Double_t aj = (jetTrigPt-jetAssocPt)/(jetTrigPt+jetAssocPt);
+  Double_t aj = 0.;
+  if((jetTrigPt+jetAssocPt)>0.) aj = (jetTrigPt-jetAssocPt)/(jetTrigPt+jetAssocPt);
 
   Double_t diJetVars[7] = {jetTrigPt,jetAssocPt,deltaPhi,kT,dijetEta,fCent,aj};
 
@@ -704,7 +674,6 @@ void AliAnalysisTaskEmcalDiJetAna::FillDiJetHistos(const AliEmcalJet *jet1, cons
   AliCentrality *aliCent = InputEvent()->GetCentrality();
   if (aliCent) {
     centZNA = aliCent->GetCentralityPercentile("ZNA");
-    
     if(trigBin>-1 && trigBin<4) {
       if(deltaPhi>dPhiMin && deltaPhi<dPhiMax) {
        if(mode==1) {
@@ -732,17 +701,17 @@ void AliAnalysisTaskEmcalDiJetAna::FillThreeJetHistos(const AliEmcalJet *jet1, c
 
   Int_t typet = 0;
   Int_t typea = 0;
-  if(mode==0) {
-    typet = 0;
-    typea = 0;
+  if(mode==0) { //full-full
+    typet = fContainerFull;
+    typea = fContainerFull;
   }
-  else if(mode==1) {
-    typet = 1;
-    typea = 1;
+  else if(mode==1) { //charged-charged
+    typet = fContainerCharged;
+    typea = fContainerCharged;
   }
-  else if(mode==2) {
-    typet = 0;
-    typea = 1;
+  else if(mode==2) { //full-charged
+    typet = fContainerFull;
+    typea = fContainerCharged;
   }
   else {
     AliWarning(Form("%s: mode %d of dijet correlation not defined!",GetName(),mode));
@@ -781,7 +750,6 @@ void AliAnalysisTaskEmcalDiJetAna::FillThreeJetHistos(const AliEmcalJet *jet1, c
       else if(mode==2)
        fh3PtTrigKt1Kt2FuCh->Fill(jetTrigPt,kT12,kT13);
     }
-  
   }
 
 }
@@ -800,7 +768,6 @@ Int_t AliAnalysisTaskEmcalDiJetAna::GetPtTriggerBin(Double_t pt) {
     binTrig = 3;
 
   return binTrig;
-
 }
 
 //________________________________________________________________________
@@ -811,7 +778,7 @@ void AliAnalysisTaskEmcalDiJetAna::FillMatchFullChargedHistos(Int_t cFull,Int_t
 
   Int_t match = MatchFullAndChargedJets(cFull,cCharged);
   if(match==0) {
-    if(fDebug>1) AliWarning(Form("%s: matching failed",GetName()));
+    AliDebug(11,Form("%s: matching failed",GetName()));
     return;
   }
   
@@ -823,7 +790,6 @@ void AliAnalysisTaskEmcalDiJetAna::FillMatchFullChargedHistos(Int_t cFull,Int_t
     if(!jetCh) continue;
 
     Double_t shFraction = GetFractionSharedPt(jetFull,jetCh);
-    if(fDebug>10) Printf("shared charged pT:%.2f",shFraction);
     Double_t matchVars[7] = {
       jetFull->Pt(),
       jetCh->Pt(),
@@ -846,12 +812,12 @@ Int_t AliAnalysisTaskEmcalDiJetAna::MatchFullAndChargedJets(Int_t cFull, Int_t c
   //
 
   if(GetNJets(cFull)<1) {
-    if(fDebug>1) AliInfo(Form("%s: no full jets: %d", GetName(),GetNJets(cFull)));
+    AliDebug(2,Form("%s: no full jets: %d", GetName(),GetNJets(cFull)));
     return 0;
   }
 
   if(GetNJets(cCharged)<1) {
-    if(fDebug>1) AliInfo(Form("%s: no charged jets: %d", GetName(),GetNJets(cCharged)));
+    AliDebug(2,Form("%s: no charged jets: %d", GetName(),GetNJets(cCharged)));
     return 0;
   }
 
@@ -859,21 +825,20 @@ Int_t AliAnalysisTaskEmcalDiJetAna::MatchFullAndChargedJets(Int_t cFull, Int_t c
   TClonesArray *cJetsCharged = GetJetArray(cCharged);
 
   if(!cJetsFull) {
-    if(fDebug>1) AliInfo(Form("%s: no full jet array",GetName()));
+    AliDebug(2,Form("%s: no full jet array",GetName()));
     return 0;
   }
 
   if(!cJetsCharged) {
-    if(fDebug>1)  AliInfo(Form("%s: no charged jet array",GetName()));
+    AliDebug(2,Form("%s: no charged jet array",GetName()));
     return 0;
   }
 
-
   if(!fMatchingDone) {
-      MatchJetsGeo(cFull, cCharged, fDebug);
+      MatchJetsGeo(cFull, cCharged, 0);
       return 1;  
   } else {
-    if(fDebug>1) AliInfo(Form("%s: Matching already done before",GetName()));
+    AliDebug(11,Form("%s: Matching already done before",GetName()));
     return 1;
   }