Adding histograms for triggers in drawing macro of correlation functions
authormiweber <m.weber@cern.ch>
Thu, 8 Jan 2015 16:30:49 +0000 (17:30 +0100)
committermiweber <m.weber@cern.ch>
Thu, 8 Jan 2015 16:44:32 +0000 (17:44 +0100)
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.cxx
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.h
PWGCF/EBYE/macros/drawCorrelationFunctionPsi.C

index f638b97..772da04 100644 (file)
@@ -1871,6 +1871,69 @@ TH1D *AliBalancePsi::GetBalanceFunction1DFrom2D2pMethod(Bool_t bPhi,
   return gHistBalanceFunctionHistogram;
 }
 
+//____________________________________________________________________//
+TH1D *AliBalancePsi::GetTriggers(TString type,
+                                Double_t psiMin, 
+                                Double_t psiMax,
+                                Double_t vertexZMin,
+                                Double_t vertexZMax,
+                                Double_t ptTriggerMin,
+                                Double_t ptTriggerMax
+                                ) {
+
+  // Returns the 2D correlation function for "type"(PN,NP,PP,NN) pairs,
+  // does the division by event mixing inside,
+  // and averaging over several vertexZ and centrality bins
+
+  // security checks
+  if(type != "PN" && type != "NP" && type != "PP" && type != "NN" && type != "ALL"){
+    AliError("Only types allowed: PN,NP,PP,NN,ALL");
+    return NULL;
+  }
+
+  TH1D *gHist  = NULL;
+
+  // ranges (in bins) for vertexZ and centrality (psi)
+  Int_t binPsiMin    = fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->FindBin(psiMin+0.00001);
+  Int_t binPsiMax    = fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->FindBin(psiMax-0.00001);
+  Int_t binVertexMin = 0;
+  Int_t binVertexMax = 0;
+  if(fVertexBinning){
+    binVertexMin = fHistPN->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(vertexZMin+0.00001);
+    binVertexMax = fHistPN->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(vertexZMax-0.00001);
+  }  
+  Double_t binPsiLowEdge    = 0.;
+  Double_t binPsiUpEdge     = 1000.;
+  Double_t binVertexLowEdge = 0.;
+  Double_t binVertexUpEdge  = 1000.;
+
+   
+  // first set to range and then obtain histogram
+  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);
+    gHist = (TH1D*)fHistP->Project(0,1);
+  }
+  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);
+    gHist = (TH1D*)fHistN->Project(0,1);
+  }
+  else if(type=="ALL"){
+    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);
+    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);
+    gHist = (TH1D*)fHistN->Project(0,1);
+    gHist->Add((TH1D*)fHistP->Project(0,1));
+  }
+
+  return gHist;
+}
 
 //____________________________________________________________________//
 TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
index 27f1448..68393b2 100644 (file)
@@ -72,6 +72,14 @@ class AliBalancePsi : public TObject {
                        Float_t bSign,
                        Double_t kMultorCent = -100,
                        Double_t vertexZ = 0);
+
+  TH1D   *GetTriggers(TString type,
+                     Double_t psiMin, 
+                     Double_t psiMax,
+                     Double_t vertexZMin,
+                     Double_t vertexZMax,
+                     Double_t ptTriggerMin,
+                     Double_t ptTriggerMax);
   
   TH2D   *GetCorrelationFunction(TString type,
                                 Double_t psiMin, Double_t psiMax,
@@ -84,6 +92,7 @@ class AliBalancePsi : public TObject {
                                 AliBalancePsi *bMixed=NULL,
                                 Bool_t normToTrig = kFALSE,
                                 Double_t normalizationRangePhi = TMath::Pi()/6.);
+
   TH2D   *GetCorrelationFunctionPN(Double_t psiMin, Double_t psiMax,
                                   Double_t vertexZMin=-1,
                                   Double_t vertexZMax=-1,
index 405d232..9fc98a0 100644 (file)
@@ -311,6 +311,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   hPP = (AliTHn*) list->FindObject(gHistPPname.Data());
   hNN = (AliTHn*) list->FindObject(gHistNNname.Data());
   hNN->Print();
+  hN->Print();
 
 
   //Create the AliBalancePsi object and fill it with the AliTHn objects
@@ -423,6 +424,10 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   TH2D *gHistNP[4];
   TH2D *gHistPP[4];
   TH2D *gHistNN[4];
+  TH2D *gHistTriggerPN;
+  TH2D *gHistTriggerNP;
+  TH2D *gHistTriggerPP;
+  TH2D *gHistTriggerNN;
   
   TCanvas *cPN[4];
   TCanvas *cNP[4];
@@ -491,6 +496,8 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     else 
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
+
+  gHistTriggerPN = b->GetTriggers("PN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistPN[0] = b->GetCorrelationFunctionPN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistPN[0]->Rebin2D(rebinEta,rebinPhi);
@@ -706,6 +713,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
 
+  gHistTriggerNP = b->GetTriggers("NP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistNP[0] = b->GetCorrelationFunctionNP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistNP[0]->Rebin2D(rebinEta,rebinPhi);
@@ -921,6 +929,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
 
+  gHistTriggerPP = b->GetTriggers("PP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistPP[0] = b->GetCorrelationFunctionPP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistPP[0]->Rebin2D(rebinEta,rebinPhi);
@@ -1134,6 +1143,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   } 
 
+  gHistTriggerNN = b->GetTriggers("NN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistNN[0] = b->GetCorrelationFunctionNN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistNN[0]->Rebin2D(rebinEta,rebinPhi);
@@ -1347,7 +1357,13 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   newFileName += ".root";
 
   TFile *newFile = TFile::Open(newFileName.Data(),"recreate");
-  gHistPN[0]->SetName("gHistPNRaw"); gHistPN[0]->Write();
+
+  gHistTriggerPN->SetName("gHistPNTrigger"); gHistTriggerPN->Write();
+  gHistTriggerNP->SetName("gHistNPTrigger"); gHistTriggerNP->Write();
+  gHistTriggerPP->SetName("gHistPPTrigger"); gHistTriggerPP->Write();
+  gHistTriggerNN->SetName("gHistNNTrigger"); gHistTriggerNN->Write();
+
+  gHistPN[0]->SetName("gHistPNRaw"); gHistPN[0]->Write(); 
   gHistNP[0]->SetName("gHistNPRaw"); gHistNP[0]->Write();
   gHistPP[0]->SetName("gHistPPRaw"); gHistPP[0]->Write();
   gHistNN[0]->SetName("gHistNNRaw"); gHistNN[0]->Write();