adding possibility to correct with Event Mixing for multidimensional BF analysis
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Oct 2012 14:42:22 +0000 (14:42 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Oct 2012 14:42:22 +0000 (14:42 +0000)
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.cxx
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.h
PWGCF/EBYE/macros/drawBalanceFunction2DPsi.C
PWGCF/EBYE/macros/drawBalanceFunctionPsi.C

index ff67cfa..91af1b6 100644 (file)
@@ -546,6 +546,154 @@ TH1D *AliBalancePsi::GetBalanceFunctionHistogram(Int_t iVariableSingle,
   return gHistBalanceFunctionHistogram;
 }
 
+//____________________________________________________________________//
+TH1D *AliBalancePsi::GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
+                                                        Int_t iVariablePair,
+                                                        Double_t psiMin, 
+                                                        Double_t psiMax,
+                                                        Double_t ptTriggerMin,
+                                                        Double_t ptTriggerMax,
+                                                        Double_t ptAssociatedMin,
+                                                        Double_t ptAssociatedMax,
+                                                        AliBalancePsi *bfMix) {
+  //Returns the BF histogram, extracted from the 6 AliTHn objects 
+  //after dividing each correlation function by the Event Mixing one 
+  //(private members) of the AliBalancePsi class.
+  //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
+  //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
+  // Psi_2
+  fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+
+  // pt trigger
+  if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+  }
+
+  // pt associated
+  if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
+    fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+  }
+
+  // ============================================================================================
+  // the same for event mixing
+  AliTHn *fHistPMix = bfMix->GetHistNp();
+  AliTHn *fHistNMix = bfMix->GetHistNn();
+  AliTHn *fHistPNMix = bfMix->GetHistNpn();
+  AliTHn *fHistNPMix = bfMix->GetHistNnp();
+  AliTHn *fHistPPMix = bfMix->GetHistNpp();
+  AliTHn *fHistNNMix = bfMix->GetHistNnn();
+
+  // Psi_2
+  fHistPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+
+  // pt trigger
+  if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
+    fHistPMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+  }
+
+  // pt associated
+  if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
+    fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+  }
+  // ============================================================================================
+
+  //Printf("P:%lf - N:%lf - PN:%lf - NP:%lf - PP:%lf - NN:%lf",fHistP->GetEntries(0),fHistN->GetEntries(0),fHistPN->GetEntries(0),fHistNP->GetEntries(0),fHistPP->GetEntries(0),fHistNN->GetEntries(0));
+
+  // Project into the wanted space (1st: analysis step, 2nd: axis)
+  TH1D* hTemp1 = (TH1D*)fHistPN->Project(0,iVariablePair);
+  TH1D* hTemp2 = (TH1D*)fHistNP->Project(0,iVariablePair);
+  TH1D* hTemp3 = (TH1D*)fHistPP->Project(0,iVariablePair);
+  TH1D* hTemp4 = (TH1D*)fHistNN->Project(0,iVariablePair);
+  TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle);
+  TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle);
+
+  // ============================================================================================
+  // the same for event mixing
+  TH2D* hTemp1Mix = (TH2D*)fHistPNMix->Project(0,iVariablePair);
+  TH2D* hTemp2Mix = (TH2D*)fHistNPMix->Project(0,iVariablePair);
+  TH2D* hTemp3Mix = (TH2D*)fHistPPMix->Project(0,iVariablePair);
+  TH2D* hTemp4Mix = (TH2D*)fHistNNMix->Project(0,iVariablePair);
+  TH1D* hTemp5Mix = (TH1D*)fHistPMix->Project(0,iVariableSingle);
+  TH1D* hTemp6Mix = (TH1D*)fHistNMix->Project(0,iVariableSingle);
+  // ============================================================================================
+
+  TH1D *gHistBalanceFunctionHistogram = 0x0;
+  if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
+    gHistBalanceFunctionHistogram = (TH1D*)hTemp1->Clone();
+    gHistBalanceFunctionHistogram->Reset();
+    
+    switch(iVariablePair) {
+    case 1:
+      gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");
+      gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#eta)");
+      break;
+    case 2:
+      gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#varphi (rad)");
+      gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#varphi)");
+      break;
+    default:
+      break;
+    }
+
+    hTemp1->Sumw2();
+    hTemp2->Sumw2();
+    hTemp3->Sumw2();
+    hTemp4->Sumw2();
+    hTemp1Mix->Sumw2();
+    hTemp2Mix->Sumw2();
+    hTemp3Mix->Sumw2();
+    hTemp4Mix->Sumw2();
+
+    hTemp1->Scale(1./hTemp5->GetEntries());
+    hTemp3->Scale(1./hTemp5->GetEntries());
+    hTemp2->Scale(1./hTemp6->GetEntries());
+    hTemp4->Scale(1./hTemp6->GetEntries());
+    hTemp1Mix->Scale(1./hTemp5Mix->GetEntries());
+    hTemp3Mix->Scale(1./hTemp5Mix->GetEntries());
+    hTemp2Mix->Scale(1./hTemp6Mix->GetEntries());
+    hTemp4Mix->Scale(1./hTemp6Mix->GetEntries());
+
+    hTemp1->Divide(hTemp1Mix);
+    hTemp2->Divide(hTemp2Mix);
+    hTemp3->Divide(hTemp3Mix);
+    hTemp4->Divide(hTemp4Mix);
+
+    hTemp1->Add(hTemp3,-1.);
+    hTemp2->Add(hTemp4,-1.);
+
+    gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
+    gHistBalanceFunctionHistogram->Scale(0.5);
+  }
+
+  return gHistBalanceFunctionHistogram;
+}
+
 //____________________________________________________________________//
 TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin, 
                                                        Double_t psiMax,
@@ -619,6 +767,153 @@ TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin,
   return gHistBalanceFunctionHistogram;
 }
 
+//____________________________________________________________________//
+TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(Double_t psiMin, 
+                                                               Double_t psiMax,
+                                                               Double_t ptTriggerMin,
+                                                               Double_t ptTriggerMax,
+                                                               Double_t ptAssociatedMin,
+                                                               Double_t ptAssociatedMax,
+                                                               AliBalancePsi *bfMix) {
+  //Returns the BF histogram in Delta eta vs Delta phi,
+  //after dividing each correlation function by the Event Mixing one 
+  //extracted from the 6 AliTHn objects 
+  //(private members) of the AliBalancePsi class.
+  //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
+  //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
+  TString histName = "gHistBalanceFunctionHistogram2D";
+
+  if(!bfMix){
+    AliError("balance function object for event mixing not available");
+    return NULL;
+  }
+
+  // Psi_2
+  fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+
+  // pt trigger
+  if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+  }
+
+  // pt associated
+  if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
+    fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+  }
+
+
+  // ============================================================================================
+  // the same for event mixing
+  AliTHn *fHistPMix = bfMix->GetHistNp();
+  AliTHn *fHistNMix = bfMix->GetHistNn();
+  AliTHn *fHistPNMix = bfMix->GetHistNpn();
+  AliTHn *fHistNPMix = bfMix->GetHistNnp();
+  AliTHn *fHistPPMix = bfMix->GetHistNpp();
+  AliTHn *fHistNNMix = bfMix->GetHistNnn();
+
+  // Psi_2
+  fHistPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+  fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); 
+
+  // pt trigger
+  if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
+    fHistPMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+    fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
+  }
+
+  // pt associated
+  if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
+    fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+    fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
+  }
+  // ============================================================================================
+
+
+  //AliInfo(Form("P:%lf - N:%lf - PN:%lf - NP:%lf - PP:%lf - NN:%lf",fHistP->GetEntries(0),fHistN->GetEntries(0),fHistPN->GetEntries(0),fHistNP->GetEntries(0),fHistPP->GetEntries(0),fHistNN->GetEntries(0)));
+
+  // Project into the wanted space (1st: analysis step, 2nd: axis)
+  TH2D* hTemp1 = (TH2D*)fHistPN->Project(0,1,2);
+  TH2D* hTemp2 = (TH2D*)fHistNP->Project(0,1,2);
+  TH2D* hTemp3 = (TH2D*)fHistPP->Project(0,1,2);
+  TH2D* hTemp4 = (TH2D*)fHistNN->Project(0,1,2);
+  TH1D* hTemp5 = (TH1D*)fHistP->Project(0,1);
+  TH1D* hTemp6 = (TH1D*)fHistN->Project(0,1);
+
+  // ============================================================================================
+  // the same for event mixing
+  TH2D* hTemp1Mix = (TH2D*)fHistPNMix->Project(0,1,2);
+  TH2D* hTemp2Mix = (TH2D*)fHistNPMix->Project(0,1,2);
+  TH2D* hTemp3Mix = (TH2D*)fHistPPMix->Project(0,1,2);
+  TH2D* hTemp4Mix = (TH2D*)fHistNNMix->Project(0,1,2);
+  TH1D* hTemp5Mix = (TH1D*)fHistPMix->Project(0,1);
+  TH1D* hTemp6Mix = (TH1D*)fHistNMix->Project(0,1);
+  // ============================================================================================
+
+  TH2D *gHistBalanceFunctionHistogram = 0x0;
+  if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
+    gHistBalanceFunctionHistogram = (TH2D*)hTemp1->Clone();
+    gHistBalanceFunctionHistogram->Reset();
+    gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");   
+    gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("#Delta#varphi (rad)");
+    gHistBalanceFunctionHistogram->GetZaxis()->SetTitle("B(#Delta#eta,#Delta#varphi)");   
+    
+    hTemp1->Sumw2();
+    hTemp2->Sumw2();
+    hTemp3->Sumw2();
+    hTemp4->Sumw2();
+    hTemp1Mix->Sumw2();
+    hTemp2Mix->Sumw2();
+    hTemp3Mix->Sumw2();
+    hTemp4Mix->Sumw2();
+
+    hTemp1->Scale(1./hTemp5->GetEntries());
+    hTemp3->Scale(1./hTemp5->GetEntries());
+    hTemp2->Scale(1./hTemp6->GetEntries());
+    hTemp4->Scale(1./hTemp6->GetEntries());
+    hTemp1Mix->Scale(1./hTemp5Mix->GetEntries());
+    hTemp3Mix->Scale(1./hTemp5Mix->GetEntries());
+    hTemp2Mix->Scale(1./hTemp6Mix->GetEntries());
+    hTemp4Mix->Scale(1./hTemp6Mix->GetEntries());
+
+    hTemp1->Divide(hTemp1Mix);
+    hTemp2->Divide(hTemp2Mix);
+    hTemp3->Divide(hTemp3Mix);
+    hTemp4->Divide(hTemp4Mix);
+
+    hTemp1->Add(hTemp3,-1.);
+    hTemp2->Add(hTemp4,-1.);
+
+    gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
+    gHistBalanceFunctionHistogram->Scale(0.5);
+  }
+
+  return gHistBalanceFunctionHistogram;
+}
+
+
 //____________________________________________________________________//
 TH2D *AliBalancePsi::GetCorrelationFunctionPN(Double_t psiMin, 
                                              Double_t psiMax,
index ea38474..0994371 100644 (file)
@@ -116,12 +116,28 @@ class AliBalancePsi : public TObject {
                                    Double_t ptAssociatedMin=-1.,
                                    Double_t ptAssociatedMax=-1);
 
+  TH1D *GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
+                                   Int_t iVariablePair,
+                                   Double_t psiMin, Double_t psiMax,
+                                   Double_t ptTriggerMin=-1.,
+                                   Double_t ptTriggerMax=-1.,
+                                   Double_t ptAssociatedMin=-1.,
+                                   Double_t ptAssociatedMax=-1,
+                                   AliBalancePsi *bfMix=NULL);
+
   TH2D *GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin, Double_t psiMax,
                                           Double_t ptTriggerMin=-1.,
                                           Double_t ptTriggerMax=-1.,
                                           Double_t ptAssociatedMin=-1.,
                                           Double_t ptAssociatedMax=-1);
   
+  TH2D *GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(Double_t psiMin, Double_t psiMax,
+                                                  Double_t ptTriggerMin=-1.,
+                                                  Double_t ptTriggerMax=-1.,
+                                                  Double_t ptAssociatedMin=-1.,
+                                                  Double_t ptAssociatedMax=-1.,
+                                                  AliBalancePsi *bfMix=NULL);
+  
   TH2D *GetQAHistHBTbefore() {return fHistHBTbefore;}
   TH2D *GetQAHistHBTafter() {return fHistHBTafter;}
   TH2D *GetQAHistConversionbefore() {return fHistConversionbefore;}
index 0d84de2..8b19f50 100644 (file)
@@ -12,7 +12,8 @@ void drawBalanceFunction2DPsi(const char* filename = "AnalysisResultsPsi.root",
                              Double_t ptTriggerMin = -1.,
                              Double_t ptTriggerMax = -1.,
                              Double_t ptAssociatedMin = -1.,
-                             Double_t ptAssociatedMax = -1.) {
+                             Double_t ptAssociatedMax = -1.,
+                             Bool_t k2pMethod = kFALSE) {
   //Macro that draws the BF distributions for each centrality bin
   //for reaction plane dependent analysis
   //Author: Panos.Christakoglou@nikhef.nl
@@ -40,7 +41,8 @@ void drawBalanceFunction2DPsi(const char* filename = "AnalysisResultsPsi.root",
   }
   else 
     draw(listBF,listBFShuffled,listBFMixed,gCentrality,psiMin,psiMax,
-        ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);  
+        ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,
+        k2pMethod);  
 }
 
 //______________________________________________________//
@@ -91,7 +93,7 @@ TList *GetListOfObjects(const char* filename,
   listBF = dynamic_cast<TList *>(dir->Get(listBFName.Data()));
   cout<<"======================================================="<<endl;
   cout<<"List name: "<<listBF->GetName()<<endl;
-  //listBF->ls();
+  listBF->ls();
 
   //Get the histograms
   TString histoName;
@@ -180,7 +182,8 @@ TList *GetListOfObjects(const char* filename,
 void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
          Int_t gCentrality, Double_t psiMin, Double_t psiMax,
          Double_t ptTriggerMin, Double_t ptTriggerMax,
-         Double_t ptAssociatedMin, Double_t ptAssociatedMax) {  
+         Double_t ptAssociatedMin, Double_t ptAssociatedMax,
+         Bool_t k2pMethod = kFALSE) {  
   //balance function
   AliTHn *hP = NULL;
   AliTHn *hN = NULL;
@@ -294,20 +297,45 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
   else 
     histoTitle += " (0^{o} < #varphi - #Psi_{2} < 180^{o})"; 
   
-  gHistBalanceFunction = b->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+  if(k2pMethod) 
+    if(bMixed)
+      gHistBalanceFunction = b->GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+    else{
+      cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+      return;
+    }
+  else
+    gHistBalanceFunction = b->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   gHistBalanceFunction->SetTitle(histoTitle.Data());
   gHistBalanceFunction->GetYaxis()->SetTitleOffset(1.3);
   gHistBalanceFunction->SetName("gHistBalanceFunction");
 
   if(listBFShuffled) {
-    gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+    
+    if(k2pMethod) 
+      if(bMixed)
+       gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+      else{
+       cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+       return;
+      }
+    else
+      gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
     gHistBalanceFunctionShuffled->SetTitle(histoTitle.Data());
     gHistBalanceFunctionShuffled->GetYaxis()->SetTitleOffset(1.3);
     gHistBalanceFunctionShuffled->SetName("gHistBalanceFunctionShuffled");
   }
 
   if(listBFMixed) {
-    gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+    if(k2pMethod) 
+      if(bMixed)
+       gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+      else{
+       cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+       return;
+      }
+    else
+      gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionDeltaEtaDeltaPhi(psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
     gHistBalanceFunctionMixed->SetTitle(histoTitle.Data());
     gHistBalanceFunctionMixed->GetYaxis()->SetTitleOffset(1.3);
     gHistBalanceFunctionMixed->SetName("gHistBalanceFunctionMixed");
@@ -391,6 +419,7 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
   newFileName += Form("%.1f",ptTriggerMax); newFileName += "PtaFrom";
   newFileName += Form("%.1f",ptAssociatedMin); newFileName += "To"; 
   newFileName += Form("%.1f",ptAssociatedMax); 
+  if(k2pMethod) newFileName += "_2pMethod";
   newFileName += ".root";
 
   TFile *fOutput = new TFile(newFileName.Data(),"recreate");
index 9aaabcb..961ac14 100644 (file)
@@ -10,7 +10,8 @@ void drawBalanceFunctionPsi(const char* filename = "AnalysisResultsPsi.root",
                            Double_t ptTriggerMin = -1.,
                            Double_t ptTriggerMax = -1.,
                            Double_t ptAssociatedMin = -1.,
-                           Double_t ptAssociatedMax = -1.) {
+                           Double_t ptAssociatedMax = -1.,
+                           Bool_t k2pMethod = kFALSE) {
   //Macro that draws the BF distributions for each centrality bin
   //for reaction plane dependent analysis
   //Author: Panos.Christakoglou@nikhef.nl
@@ -34,7 +35,8 @@ void drawBalanceFunctionPsi(const char* filename = "AnalysisResultsPsi.root",
     draw(listBF,listBFShuffled,listBFMixed,
         gCentrality,gDeltaEtaDeltaPhi,
         psiMin,psiMax,
-        ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);  
+        ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,
+        k2pMethod);  
 }
 
 //______________________________________________________//
@@ -176,7 +178,8 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
          Int_t gCentrality, Int_t gDeltaEtaDeltaPhi, 
          Double_t psiMin, Double_t psiMax,
          Double_t ptTriggerMin, Double_t ptTriggerMax,
-         Double_t ptAssociatedMin, Double_t ptAssociatedMax) {
+         Double_t ptAssociatedMin, Double_t ptAssociatedMax,
+         Bool_t k2pMethod = kFALSE) {
   gROOT->LoadMacro("~/SetPlotStyle.C");
   SetPlotStyle();
   gStyle->SetPalette(1,0);
@@ -273,19 +276,43 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
     histoTitle += " (0^{o} < #phi - #Psi_{2} < 180^{o})"; 
   
   //Raw balance function
-  gHistBalanceFunction = b->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+  if(k2pMethod) 
+    if(bMixed)
+      gHistBalanceFunction = b->GetBalanceFunctionHistogram2pMethod(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+    else{
+      cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+      return;
+    }
+  else
+    gHistBalanceFunction = b->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   gHistBalanceFunction->SetMarkerStyle(20);
   gHistBalanceFunction->SetTitle(histoTitle.Data());
   gHistBalanceFunction->GetYaxis()->SetTitleOffset(1.3);
   gHistBalanceFunction->SetName("gHistBalanceFunction");
   
   //Shuffled balance function
-  gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+  if(k2pMethod) 
+    if(bMixed)
+      gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionHistogram2pMethod(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+    else{
+      cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+      return;
+    }
+  else
+    gHistBalanceFunctionShuffled = bShuffled->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   gHistBalanceFunctionShuffled->SetMarkerStyle(24);
   gHistBalanceFunctionShuffled->SetName("gHistBalanceFunctionShuffled");
 
   //Mixed balance function
-  gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
+  if(k2pMethod) 
+    if(bMixed)
+      gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionHistogram2pMethod(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
+    else{
+      cerr<<"NO MIXED BF BUT REQUESTED CORRECTING WITH IT! --> FAIL"<<endl;
+      return;
+    }
+  else
+    gHistBalanceFunctionMixed = bMixed->GetBalanceFunctionHistogram(0,gDeltaEtaDeltaPhi,psiMin,psiMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   gHistBalanceFunctionMixed->SetMarkerStyle(25);
   gHistBalanceFunctionMixed->SetName("gHistBalanceFunctionMixed");
   
@@ -322,6 +349,7 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
   pngName = "BalanceFunctionDeltaEta.Centrality"; 
   pngName += centralityArray[gCentrality-1]; 
   pngName += ".Psi"; //pngName += psiMin; pngName += "To"; pngName += psiMax;
+  if(k2pMethod) pngName += "_2pMethod";
   pngName += ".png";
   c1->SaveAs(pngName.Data());
   
@@ -381,6 +409,7 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
   newFileName += Form("%.1f",ptTriggerMax); newFileName += "PtaFrom";
   newFileName += Form("%.1f",ptAssociatedMin); newFileName += "To"; 
   newFileName += Form("%.1f",ptAssociatedMax); 
+  if(k2pMethod) newFileName += "_2pMethod";
   newFileName += ".root";
 
   TFile *fOutput = new TFile(newFileName.Data(),"recreate");