]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
use per-trigger averaging (before per-evt averaging)
authormiweber <m.weber@cern.ch>
Sun, 27 Apr 2014 16:00:32 +0000 (18:00 +0200)
committermiweber <m.weber@cern.ch>
Sun, 27 Apr 2014 16:01:42 +0000 (18:01 +0200)
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.cxx
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.h
PWGCF/EBYE/macros/drawBalanceFunction2DPsi.C
PWGCF/EBYE/macros/drawCorrelationFunctionPsi.C

index dea98f0d76211b5422a7b4242a4177d85dfadedb..7c03c3d7e32e3f282e18012f42b21ff0d8d01999 100644 (file)
@@ -1894,8 +1894,7 @@ TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
                                            Double_t ptAssociatedMax,
                                            AliBalancePsi *bMixed,
                                            Bool_t normToTrig,
-                                           Double_t normalizationRangePhi,
-                                           TH2D *hVertexCentrality) {
+                                           Double_t normalizationRangePhi) {
 
   // Returns the 2D correlation function for "type"(PN,NP,PP,NN) pairs,
   // does the division by event mixing inside,
@@ -1910,10 +1909,6 @@ TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
     AliError("No Event Mixing AliTHn");
     return NULL;
   }
-  if(normToTrig && !hVertexCentrality){
-    AliError("Per-trigger yield option chosen, but QA histogram for event statistics not available");
-    return NULL; 
-  }
 
   TH2D *gHist  = NULL;
   TH2D *fSame  = NULL;
@@ -1998,29 +1993,15 @@ TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
        // then get the correlation function (divide fSame/fmixed)
        fSame->Divide(fMixed);
        
-       // // averaging with number of triggers:
-       // // average over number of triggers in each sub-bin
-       // Double_t NTrigSubBin = 0;
-       // if(type=="PN" || type=="PP")
-       //   NTrigSubBin = (Double_t)(fHistP->Project(0,1)->Integral());
-       // else if(type=="NP" || type=="NN")
-       //   NTrigSubBin = (Double_t)(fHistN->Project(0,1)->Integral());
-       // fSame->Scale(NTrigSubBin);
-
-       // averaging with number of events:
-       // average over number of events in each sub-bin
-       Int_t binStatsVertexLowEdge = hVertexCentrality->GetXaxis()->FindBin(binVertexLowEdge + 0.00001) + 0.00001;
-       Int_t binStatsVertexUpEdge  = hVertexCentrality->GetXaxis()->FindBin(binVertexUpEdge - 0.00001) - 0.00001;
-       Int_t binStatsPsiLowEdge    = hVertexCentrality->GetYaxis()->FindBin(binPsiLowEdge + 0.00001) + 0.00001;
-       Int_t binStatsPsiUpEdge     = hVertexCentrality->GetYaxis()->FindBin(binPsiUpEdge - 0.00001) - 0.00001;
-
-       Double_t NEventsSubBin = (Double_t)hVertexCentrality->Integral(binStatsVertexLowEdge,binStatsVertexUpEdge,binStatsPsiLowEdge,binStatsPsiUpEdge);
-
-       //Printf("Averaging from %d < z < %d and %d < cent < %d ",binStatsVertexLowEdge,binStatsVertexUpEdge,binStatsPsiLowEdge,binStatsPsiUpEdge);
-       //Printf("Averaging from %.2f < z < %.2f and %.2f < cent < %.2f --> %.2f ",binVertexLowEdge,binVertexUpEdge,binPsiLowEdge,binPsiUpEdge,NEventsSubBin);
-       fSame->Scale(NEventsSubBin);
+       // averaging with number of triggers:
+       // average over number of triggers in each sub-bin
+       Double_t NTrigSubBin = 0;
+       if(type=="PN" || type=="PP")
+         NTrigSubBin = (Double_t)(fHistP->Project(0,1)->Integral());
+       else if(type=="NP" || type=="NN")
+         NTrigSubBin = (Double_t)(fHistN->Project(0,1)->Integral());
+       fSame->Scale(NTrigSubBin);
        
-       // OLD and NEW averaging:
        // for the first: clone
        if( (iBinPsi == binPsiMin && iBinVertex == binVertexMin) || !gHist ){
          gHist = (TH2D*)fSame->Clone();
@@ -2034,41 +2015,23 @@ TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
 
   if(gHist){
     
-    //// OLD averaging:
-    //// average over number of bins nbinsVertex * nbinsPsi
-    // gHist->Scale(1./((Double_t)(binPsiMax-binPsiMin+1)*(binVertexMax-binVertexMin+1)));
-
-    // // averaging with number of triggers:
-    // // first set to full range and then obtain number of all triggers 
-    // Double_t NTrigAll = 0;
-    // if(type=="PN" || type=="PP"){
-    //   fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
-    //   fHistP->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
-    //   fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
-    //   NTrigAll = (Double_t)(fHistP->Project(0,1)->Integral());
-    // }
-    // else if(type=="NP" || type=="NN"){
-    //   fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
-    //   fHistN->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
-    //   fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
-    //   NTrigAll = (Double_t)(fHistN->Project(0,1)->Integral());
-    // }
-    // gHist->Scale(1./NTrigAll);
-
-    // averaging with number of events:
-    // first set to full range and then obtain number of all events 
-    Int_t binStatsAllVertexLowEdge = hVertexCentrality->GetXaxis()->FindBin(vertexZMin + 0.00001) + 0.00001;
-    Int_t binStatsAllVertexUpEdge  = hVertexCentrality->GetXaxis()->FindBin(vertexZMax - 0.00001) - 0.00001;
-    Int_t binStatsAllPsiLowEdge    = hVertexCentrality->GetYaxis()->FindBin(psiMin + 0.00001) + 0.00001;
-    Int_t binStatsAllPsiUpEdge     = hVertexCentrality->GetYaxis()->FindBin(psiMax - 0.00001) - 0.00001;
-
-    Double_t NEventsAll = (Double_t)hVertexCentrality->Integral(binStatsAllVertexLowEdge,binStatsAllVertexUpEdge,binStatsAllPsiLowEdge,binStatsAllPsiUpEdge);
-    
-    //Printf("All from %d < z < %d and %d < cent < %d ",binStatsAllVertexLowEdge,binStatsAllVertexUpEdge,binStatsAllPsiLowEdge,binStatsAllPsiUpEdge);
-    //Printf("All from %.2f < z < %.2f and %.2f < cent < %.2f --> %.2f ",vertexZMin,vertexZMax,psiMin,psiMax,NEventsAll);
-
-    gHist->Scale(1./NEventsAll);
-    
+    // averaging with number of triggers:
+    // first set to full range and then obtain number of all triggers 
+    Double_t NTrigAll = 0;
+    if(type=="PN" || type=="PP"){
+      fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+      fHistP->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+      fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+      NTrigAll = (Double_t)(fHistP->Project(0,1)->Integral());
+    }
+    else if(type=="NP" || type=="NN"){
+      fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+      fHistN->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+      fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+      NTrigAll = (Double_t)(fHistN->Project(0,1)->Integral());
+    }
+    gHist->Scale(1./NTrigAll);
+   
   }
   
   return gHist;
index a8cc5f033fd647c866f5ae063fa1f4751170ce4d..dcd7683f0d18b18d97b7e1d7099571a4370d3caa 100644 (file)
@@ -83,8 +83,7 @@ class AliBalancePsi : public TObject {
                                 Double_t ptAssociatedMax=-1,
                                 AliBalancePsi *bMixed=NULL,
                                 Bool_t normToTrig = kFALSE,
-                                Double_t normalizationRangePhi = TMath::Pi()/6.,
-                                TH2D *hVertexCentrality = NULL);
+                                Double_t normalizationRangePhi = TMath::Pi()/6.);
   TH2D   *GetCorrelationFunctionPN(Double_t psiMin, Double_t psiMax,
                                   Double_t vertexZMin=-1,
                                   Double_t vertexZMax=-1,
index 9917e591a39b4b42de8053c05a409df69bf0a91b..d8a372940447f358fb79ed20141f948973ffd63b 100644 (file)
@@ -1105,7 +1105,7 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
 
       //for 3<pT,assoc<8<pT,trig<15
       if(ptTriggerMax>10){
-       rangeReduced = 0.4;
+       rangeReduced = 0.3;
       }
 
       cout<<"Use reduced range = "<<rangeReduced<<endl;
index c14a12b42f2cc1bae202865cd3779e6cd3b63212..ebcea28e68108d3454355ef251d0867cb5ebc1b6 100644 (file)
@@ -430,28 +430,6 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   TCanvas *cNN[4];
   TString histoTitle, pngName;
 
-  // need event statistics for per-trigger yield
-  TH2D* hVertexCentrality = NULL;
-  if( normToTrig && !listQA && !bToy){
-    Printf("per-trigger yield option chosen, but QA list for event statistics not available");
-    return;
-  }
-  else if( normToTrig && !listQA ){ //special case Toy model (no QA!)
-    hVertexCentrality = new TH2D("hVertexCentrality","Primary vertex distribution - z coordinate (dummy for toy model);V_{z} (cm);Centrality percentile;Entries",100,-20.,20.,220,-5,105);
-    for(Int_t iX = 0; iX < hVertexCentrality->GetNbinsX(); iX++){
-      for(Int_t iY = 0; iY < hVertexCentrality->GetNbinsY(); iY++){
-       hVertexCentrality->SetBinContent(iX+1,iY+1,1);
-      }
-    }
-  }
-  else{
-    hVertexCentrality = (TH2D*)listQA->FindObject("fHistVz");
-    if(!hVertexCentrality){
-      Printf("per-trigger yield option chosen, but QA histogram for event statistics not available");
-      return;
-    }
-  }
-
   // if no mixing then divide by convoluted histograms
   if(!listBFMixed && listQA){
 
@@ -607,7 +585,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     //cPN[2]->SaveAs(pngName.Data());
 
     //Correlation function (+-)
-    gHistPN[3] = b->GetCorrelationFunction("PN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi,hVertexCentrality);
+    gHistPN[3] = b->GetCorrelationFunction("PN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi);
     gHistPN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
     if(normToTrig)
       gHistPN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
@@ -821,7 +799,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     //cNP[2]->SaveAs(pngName.Data());
 
     //Correlation function (-+)
-    gHistNP[3] = b->GetCorrelationFunction("NP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi,hVertexCentrality);
+    gHistNP[3] = b->GetCorrelationFunction("NP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi);
     gHistNP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
     if(normToTrig)
       gHistNP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
@@ -1036,7 +1014,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     //cPP[2]->SaveAs(pngName.Data());
 
     //Correlation function (++)
-    gHistPP[3] = b->GetCorrelationFunction("PP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi,hVertexCentrality);
+    gHistPP[3] = b->GetCorrelationFunction("PP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi);
     gHistPP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
     if(normToTrig)
       gHistPP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
@@ -1249,7 +1227,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     //cNN[2]->SaveAs(pngName.Data());
 
     //Correlation function (--)
-    gHistNN[3] = b->GetCorrelationFunction("NN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi,hVertexCentrality);
+    gHistNN[3] = b->GetCorrelationFunction("NN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed,normToTrig,normalizationRangePhi);
     gHistNN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
     if(normToTrig)
       gHistNN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");