]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/EBYE/macros/drawBalanceFunction2DPsi.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / EBYE / macros / drawBalanceFunction2DPsi.C
index db7024a9564640ae15b1ec124c97234a32b5d5d3..5bf3536cf82e96c97a84e432ff64594f56853408 100644 (file)
@@ -1,6 +1,12 @@
-const Int_t numberOfCentralityBins = 12;
-TString centralityArray[numberOfCentralityBins] = {"0-80","10-20","20-30","30-40","40-50","50-60","60-70","70-80","0-100","0-1","1-2","2-3"};
+const Int_t numberOfCentralityBins = 14;
+TString centralityArray[numberOfCentralityBins] = {"0-80","10-20","20-30","30-40","40-50","50-60","60-70","70-80","0-100","0-1","1-2","2-3","92-8500","0-10000"};
 
+// reduced ranges for moments determination
+// (Average over all event classes of 3 sigma of Gauss + Pol0 Fit) 
+Double_t rangePbPbEtaMedMom  = 3. * 0.233;// PbPb, Delta Eta, 2<pT,assoc<3<pT,trig<4
+Double_t rangePbPbEtaHighMom = 3. * 0.096;// PbPb, Delta Eta, 3<pT,assoc<8<pT,trig<15
+Double_t rangePbPbPhiMedMom  = 3. * 0.273;// PbPb, Delta Phi, 2<pT,assoc<3<pT,trig<4
+Double_t rangePbPbPhiHighMom = 3. * 0.097;// PbPb, Delta Eta, 3<pT,assoc<8<pT,trig<15
 
 const Int_t gRebin = 1;
 void drawBalanceFunction2DPsi(const char* filename = "AnalysisResultsPsi.root", 
@@ -25,12 +31,12 @@ void drawBalanceFunction2DPsi(const char* filename = "AnalysisResultsPsi.root",
   //for reaction plane dependent analysis
   //Author: Panos.Christakoglou@nikhef.nl
   //Load the PWG2ebye library
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libANALYSISalice.so");
-  gSystem->Load("libEventMixing.so");
-  gSystem->Load("libCORRFW.so");
-  gSystem->Load("libPWGTools.so");
-  gSystem->Load("libPWGCFebye.so");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libEventMixing");
+  gSystem->Load("libCORRFW");
+  gSystem->Load("libPWGTools");
+  gSystem->Load("libPWGCFebye");
 
   //gROOT->LoadMacro("~/SetPlotStyle.C");
   //SetPlotStyle();
@@ -829,7 +835,7 @@ void drawBFPsi2D(const char* lhcPeriod = "LHC11h",
   gHistBalanceFunction->SetTitle("");
   gHistBalanceFunction->GetYaxis()->SetTitleOffset(1.4);
   gHistBalanceFunction->GetYaxis()->SetNdivisions(10);
-  gHistBalanceFunction->GetXaxis()->SetRangeUser(-1.4,1.4); 
+  //gHistBalanceFunction->GetXaxis()->SetRangeUser(-1.4,1.4); 
   gHistBalanceFunction->GetXaxis()->SetNdivisions(10);
   gHistBalanceFunction->GetYaxis()->SetTitle("#Delta #varphi (rad)");
   gHistBalanceFunction->DrawCopy("lego2");
@@ -951,12 +957,12 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
   gSystem->Load("libESD");
   gSystem->Load("libAOD");
 
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libANALYSISalice.so");
-  gSystem->Load("libEventMixing.so");
-  gSystem->Load("libCORRFW.so");
-  gSystem->Load("libPWGTools.so");
-  gSystem->Load("libPWGCFebye.so");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libEventMixing");
+  gSystem->Load("libCORRFW");
+  gSystem->Load("libPWGTools");
+  gSystem->Load("libPWGCFebye");
 
   gStyle->SetOptStat(0);
 
@@ -1091,26 +1097,43 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
   legend->AddEntry(gHistBalanceFunctionMixed,"Mixed data","lp");
   legend->Draw();
   
+  Double_t sigmaGaus      = 0.;
+  Double_t sigmaGausError = 0.;
 
   TString meanLatex, rmsLatex, skewnessLatex, kurtosisLatex;
 
   if(bRootMoments){
 
     // need to restrict to near side in case of dphi
-    if(!kProjectInEta) gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-TMath::Pi()/2,TMath::Pi()/2);
-
-    if(bReduceRangeForMoments){
-
-      // default (for 2<pT,assoc<3<pT,trig<4)
-      Double_t rangeReduced = 1.0;
-
-      //for 3<pT,assoc<8<pT,trig<15
-      if(ptTriggerMax>10){
-       rangeReduced = 0.3;
-      }
+    if(!kProjectInEta && !bReduceRangeForMoments) gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-TMath::Pi()/2,TMath::Pi()/2);
+
+   if(bReduceRangeForMoments){
+
+     Double_t rangeReduced = 0.;
+
+     if(kProjectInEta){
+       if(ptTriggerMax>10){
+        //for 3<pT,assoc<8<pT,trig<15
+        rangeReduced = rangePbPbEtaHighMom;
+       }
+       else{
+        // default (for 2<pT,assoc<3<pT,trig<4)
+        rangeReduced = rangePbPbEtaMedMom;
+       }
+     }
+     else{
+       if(ptTriggerMax>10){
+        rangeReduced = rangePbPbPhiHighMom;
+       }
+       else{
+        rangeReduced = rangePbPbPhiMedMom;
+       }
+     }
 
       cout<<"Use reduced range = "<<rangeReduced<<endl;
-      gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-rangeReduced,rangeReduced);
+      Int_t binLow  = gHistBalanceFunctionSubtracted->GetXaxis()->FindBin(-rangeReduced);
+      Int_t binHigh = gHistBalanceFunctionSubtracted->GetXaxis()->FindBin(rangeReduced);
+      gHistBalanceFunctionSubtracted->GetXaxis()->SetRange(binLow,binHigh);
     }
 
     meanLatex = "#mu = "; 
@@ -1160,6 +1183,7 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
       //rmsFileName.ReplaceAll(".root","_DeltaPhiProjection_Rms.txt");
     ofstream fileRms(rmsFileName.Data(),ios::app);
     fileRms << " " << gHistBalanceFunctionSubtracted->GetRMS() << " " <<gHistBalanceFunctionSubtracted->GetRMSError()<<endl;
+    //fileRms << " " << sigmaGaus << " " <<gHistBalanceFunctionSubtracted->GetRMSError()<<endl;  // just for testing
     fileRms.close();
 
     TString skewnessFileName = filename;
@@ -1432,6 +1456,16 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
   TH2D *gHistNN = dynamic_cast<TH2D *>(f->Get("gHistNNCorrelationFunctions"));
   if(!gHistNN) return;
 
+  // in order to get unzoomed (in older versions used smaller user ranger)
+  Int_t binMinX = gHistPN->GetXaxis()->FindBin(gHistPN->GetXaxis()->GetXmin()+0.00001);
+  Int_t binMaxX = gHistPN->GetXaxis()->FindBin(gHistPN->GetXaxis()->GetXmax()-0.00001);
+  Int_t binMinY = gHistPN->GetYaxis()->FindBin(gHistPN->GetYaxis()->GetXmin()+0.00001);
+  Int_t binMaxY = gHistPN->GetYaxis()->FindBin(gHistPN->GetYaxis()->GetXmax()-0.00001);
+  gHistPN->GetXaxis()->SetRange(binMinX,binMaxX); gHistPN->GetYaxis()->SetRange(binMinY,binMaxY);
+  gHistNP->GetXaxis()->SetRange(binMinX,binMaxX); gHistNP->GetYaxis()->SetRange(binMinY,binMaxY);
+  gHistPP->GetXaxis()->SetRange(binMinX,binMaxX); gHistPP->GetYaxis()->SetRange(binMinY,binMaxY);
+  gHistNN->GetXaxis()->SetRange(binMinX,binMaxX); gHistNN->GetYaxis()->SetRange(binMinY,binMaxY);
+
   gHistPN->Sumw2();
   gHistPP->Sumw2();
   gHistPN->Add(gHistPP,-1);
@@ -1455,7 +1489,7 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
   gHistBalanceFunction2D->GetZaxis()->SetNdivisions(10);
   gHistBalanceFunction2D->GetYaxis()->SetTitleOffset(1.4);
   gHistBalanceFunction2D->GetYaxis()->SetNdivisions(10);
-  gHistBalanceFunction2D->GetXaxis()->SetRangeUser(-1.4,1.4); 
+  //gHistBalanceFunction2D->GetXaxis()->SetRangeUser(-1.4,1.4); 
   gHistBalanceFunction2D->GetXaxis()->SetNdivisions(10);
   gHistBalanceFunction2D->DrawCopy("lego2");
   gPad->SetTheta(30); // default is 30
@@ -1570,8 +1604,6 @@ void mergeBFPsi2D(TString momDirectory = "./",
   TGaxis::SetMaxDigits(3);
   gStyle->SetPalette(55,0);
 
-  cout<<"REDUCE"<<bReduceRangeForMoments<<"  "<<endl;
-
   const Int_t nMaxDirectories = 4; // maximum number of directories to merge (set to 4 for now)
   TString sDirectory[nMaxDirectories];
   Int_t nDirectories = nMaxDirectories;
@@ -1651,26 +1683,30 @@ sFileName[iDir] += momDirectory;
   //Open the file
   fBF[iDir] = TFile::Open(sFileName[iDir].Data());
   if((!fBF[iDir])||(!fBF[iDir]->IsOpen())) {
-    Printf("The file %s is not found. Not used...",sFileName[iDir]);
+    Printf("The file %s is not found. Not used...",sFileName[iDir].Data());
     continue;
   }
   //fBF[iDir]->ls();
 
   hBF[iDir]     = (TH2D*)fBF[iDir]->Get("gHistBalanceFunctionSubtracted");
   if(!hBF[iDir]) continue;
-  entries[iDir] = (Double_t) hBF[iDir]->GetEntries();
+  entries[iDir] = (Double_t) hBF[iDir]->GetEffectiveEntries(); // weighted histograms
   entriesOut += entries[iDir];
   cout<<" BF histogram "<<iDir<<" has "<<entries[iDir] <<" entries."<<endl;
-
-  // scaling and adding (for average)
-  hBF[iDir]->Scale(entries[iDir]);
-  if(iDir==0) hBFOut = (TH2D*)hBF[iDir]->Clone("gHistBalanceFunctionSubtractedOut");
-  else hBFOut->Add(hBF[iDir]);
-  
  }
 
- // scaling with all entries
- hBFOut->Scale(1./entriesOut);
+  // second loop for scaling and adding (for average)
+ for(Int_t iDir = 0; iDir < nDirectories; iDir++){
+
+   if((!fBF[iDir])||(!fBF[iDir]->IsOpen())) {
+     Printf("The file %s is not found. Not used...",sFileName[iDir].Data());
+     continue;
+   }
+
+   hBF[iDir]->Scale(entries[iDir]/entriesOut);
+   if(!hBFOut) hBFOut = (TH2D*)hBF[iDir]->Clone("gHistBalanceFunctionSubtractedOut");
+   else hBFOut->Add(hBF[iDir]); 
+ }
 
  drawProjections(hBFOut,
                 kTRUE,