Merge branch 'master' of https://git.cern.ch/reps/AliRoot
authorJulian Book <Julian>
Mon, 16 Dec 2013 14:16:40 +0000 (15:16 +0100)
committerJulian Book <jbook@cern.ch>
Mon, 16 Dec 2013 14:16:40 +0000 (15:16 +0100)
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.cxx
PWGCF/EBYE/macros/drawBalanceFunction2DPsi.C
PWGCF/EBYE/macros/drawBalanceFunctionPsi.C

index 23da226..81c286f 100644 (file)
@@ -953,23 +953,69 @@ TH1D *AliBalancePsi::GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
       //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* hTempHelper1 = (TH1D*)fHistPN->Project(0,iVariablePair);
+      TH1D* hTempHelper2 = (TH1D*)fHistNP->Project(0,iVariablePair);
+      TH1D* hTempHelper3 = (TH1D*)fHistPP->Project(0,iVariablePair);
+      TH1D* hTempHelper4 = (TH1D*)fHistNN->Project(0,iVariablePair);
       TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle);
       TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle);
       
       // ============================================================================================
       // the same for event mixing
-      TH1D* hTemp1Mix = (TH1D*)fHistPNMix->Project(0,iVariablePair);
-      TH1D* hTemp2Mix = (TH1D*)fHistNPMix->Project(0,iVariablePair);
-      TH1D* hTemp3Mix = (TH1D*)fHistPPMix->Project(0,iVariablePair);
-      TH1D* hTemp4Mix = (TH1D*)fHistNNMix->Project(0,iVariablePair);
+      TH1D* hTempHelper1Mix = (TH1D*)fHistPNMix->Project(0,iVariablePair);
+      TH1D* hTempHelper2Mix = (TH1D*)fHistNPMix->Project(0,iVariablePair);
+      TH1D* hTempHelper3Mix = (TH1D*)fHistPPMix->Project(0,iVariablePair);
+      TH1D* hTempHelper4Mix = (TH1D*)fHistNNMix->Project(0,iVariablePair);
       TH1D* hTemp5Mix = (TH1D*)fHistPMix->Project(0,iVariableSingle);
       TH1D* hTemp6Mix = (TH1D*)fHistNMix->Project(0,iVariableSingle);
       // ============================================================================================
-      
+
+      hTempHelper1->Sumw2();
+      hTempHelper2->Sumw2();
+      hTempHelper3->Sumw2();
+      hTempHelper4->Sumw2();
+      hTemp5->Sumw2();
+      hTemp6->Sumw2();
+      hTempHelper1Mix->Sumw2();
+      hTempHelper2Mix->Sumw2();
+      hTempHelper3Mix->Sumw2();
+      hTempHelper4Mix->Sumw2();
+      hTemp5Mix->Sumw2();
+      hTemp6Mix->Sumw2();
+
+      // first put everything on positive x - axis (to be comparable with published data) --> ONLY IN THIS OPTION!
+
+      Double_t helperEndBin = 1.6;
+      if(iVariablePair==2) helperEndBin = TMath::Pi();
+
+      TH1D* hTempPos1 = new TH1D(Form("hTempPos1_%d_%d",iBinPsi,iBinVertex),Form("hTempPos1_%d_%d",iBinPsi,iBinVertex),hTempHelper1->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos2 = new TH1D(Form("hTempPos2_%d_%d",iBinPsi,iBinVertex),Form("hTempPos2_%d_%d",iBinPsi,iBinVertex),hTempHelper2->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos3 = new TH1D(Form("hTempPos3_%d_%d",iBinPsi,iBinVertex),Form("hTempPos3_%d_%d",iBinPsi,iBinVertex),hTempHelper3->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos4 = new TH1D(Form("hTempPos4_%d_%d",iBinPsi,iBinVertex),Form("hTempPos4_%d_%d",iBinPsi,iBinVertex),hTempHelper4->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos1Mix = new TH1D(Form("hTempPos1Mix_%d_%d",iBinPsi,iBinVertex),Form("hTempPos1Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper1Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos2Mix = new TH1D(Form("hTempPos2Mix_%d_%d",iBinPsi,iBinVertex),Form("hTempPos2Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper2Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos3Mix = new TH1D(Form("hTempPos3Mix_%d_%d",iBinPsi,iBinVertex),Form("hTempPos3Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper3Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTempPos4Mix = new TH1D(Form("hTempPos4Mix_%d_%d",iBinPsi,iBinVertex),Form("hTempPos4Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper4Mix->GetNbinsX()/2,0,helperEndBin);
+
+      TH1D* hTemp1 = new TH1D(Form("hTemp1_%d_%d",iBinPsi,iBinVertex),Form("hTemp1_%d_%d",iBinPsi,iBinVertex),hTempHelper1->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp2 = new TH1D(Form("hTemp2_%d_%d",iBinPsi,iBinVertex),Form("hTemp2_%d_%d",iBinPsi,iBinVertex),hTempHelper2->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp3 = new TH1D(Form("hTemp3_%d_%d",iBinPsi,iBinVertex),Form("hTemp3_%d_%d",iBinPsi,iBinVertex),hTempHelper3->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp4 = new TH1D(Form("hTemp4_%d_%d",iBinPsi,iBinVertex),Form("hTemp4_%d_%d",iBinPsi,iBinVertex),hTempHelper4->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp1Mix = new TH1D(Form("hTemp1Mix_%d_%d",iBinPsi,iBinVertex),Form("hTemp1Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper1Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp2Mix = new TH1D(Form("hTemp2Mix_%d_%d",iBinPsi,iBinVertex),Form("hTemp2Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper2Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp3Mix = new TH1D(Form("hTemp3Mix_%d_%d",iBinPsi,iBinVertex),Form("hTemp3Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper3Mix->GetNbinsX()/2,0,helperEndBin);
+      TH1D* hTemp4Mix = new TH1D(Form("hTemp4Mix_%d_%d",iBinPsi,iBinVertex),Form("hTemp4Mix_%d_%d",iBinPsi,iBinVertex),hTempHelper4Mix->GetNbinsX()/2,0,helperEndBin);
+
+
+      hTempPos1->Sumw2();
+      hTempPos2->Sumw2();
+      hTempPos3->Sumw2();
+      hTempPos4->Sumw2();
+      hTempPos1Mix->Sumw2();
+      hTempPos2Mix->Sumw2();
+      hTempPos3Mix->Sumw2();
+      hTempPos4Mix->Sumw2();
+
       hTemp1->Sumw2();
       hTemp2->Sumw2();
       hTemp3->Sumw2();
@@ -978,7 +1024,122 @@ TH1D *AliBalancePsi::GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
       hTemp2Mix->Sumw2();
       hTemp3Mix->Sumw2();
       hTemp4Mix->Sumw2();
-      
+
+
+      for(Int_t i=0;i<hTempHelper1->GetNbinsX();i++){
+
+       Double_t binCenter  = hTempHelper1->GetXaxis()->GetBinCenter(i+1);
+
+       if(iVariablePair==1){
+         if(binCenter>0){
+           hTempPos1->SetBinContent(hTempPos1->FindBin(binCenter),hTempHelper1->GetBinContent(i+1));
+           hTempPos2->SetBinContent(hTempPos2->FindBin(binCenter),hTempHelper2->GetBinContent(i+1));
+           hTempPos3->SetBinContent(hTempPos3->FindBin(binCenter),hTempHelper3->GetBinContent(i+1));
+           hTempPos4->SetBinContent(hTempPos4->FindBin(binCenter),hTempHelper4->GetBinContent(i+1));
+           hTempPos1Mix->SetBinContent(hTempPos1Mix->FindBin(binCenter),hTempHelper1Mix->GetBinContent(i+1));
+           hTempPos2Mix->SetBinContent(hTempPos2Mix->FindBin(binCenter),hTempHelper2Mix->GetBinContent(i+1));
+           hTempPos3Mix->SetBinContent(hTempPos3Mix->FindBin(binCenter),hTempHelper3Mix->GetBinContent(i+1));
+           hTempPos4Mix->SetBinContent(hTempPos4Mix->FindBin(binCenter),hTempHelper4Mix->GetBinContent(i+1));
+
+           hTempPos1->SetBinError(hTempPos1->FindBin(binCenter),hTempHelper1->GetBinError(i+1));
+           hTempPos2->SetBinError(hTempPos2->FindBin(binCenter),hTempHelper2->GetBinError(i+1));
+           hTempPos3->SetBinError(hTempPos3->FindBin(binCenter),hTempHelper3->GetBinError(i+1));
+           hTempPos4->SetBinError(hTempPos4->FindBin(binCenter),hTempHelper4->GetBinError(i+1));
+           hTempPos1Mix->SetBinError(hTempPos1Mix->FindBin(binCenter),hTempHelper1Mix->GetBinError(i+1));
+           hTempPos2Mix->SetBinError(hTempPos2Mix->FindBin(binCenter),hTempHelper2Mix->GetBinError(i+1));
+           hTempPos3Mix->SetBinError(hTempPos3Mix->FindBin(binCenter),hTempHelper3Mix->GetBinError(i+1));
+           hTempPos4Mix->SetBinError(hTempPos4Mix->FindBin(binCenter),hTempHelper4Mix->GetBinError(i+1));
+         }
+         else{
+           hTemp1->SetBinContent(hTemp1->FindBin(-binCenter),hTempHelper1->GetBinContent(i+1));
+           hTemp2->SetBinContent(hTemp2->FindBin(-binCenter),hTempHelper2->GetBinContent(i+1));
+           hTemp3->SetBinContent(hTemp3->FindBin(-binCenter),hTempHelper3->GetBinContent(i+1));
+           hTemp4->SetBinContent(hTemp4->FindBin(-binCenter),hTempHelper4->GetBinContent(i+1));
+           hTemp1Mix->SetBinContent(hTemp1Mix->FindBin(-binCenter),hTempHelper1Mix->GetBinContent(i+1));
+           hTemp2Mix->SetBinContent(hTemp2Mix->FindBin(-binCenter),hTempHelper2Mix->GetBinContent(i+1));
+           hTemp3Mix->SetBinContent(hTemp3Mix->FindBin(-binCenter),hTempHelper3Mix->GetBinContent(i+1));
+           hTemp4Mix->SetBinContent(hTemp4Mix->FindBin(-binCenter),hTempHelper4Mix->GetBinContent(i+1));
+
+           hTemp1->SetBinError(hTemp1->FindBin(-binCenter),hTempHelper1->GetBinError(i+1));
+           hTemp2->SetBinError(hTemp2->FindBin(-binCenter),hTempHelper2->GetBinError(i+1));
+           hTemp3->SetBinError(hTemp3->FindBin(-binCenter),hTempHelper3->GetBinError(i+1));
+           hTemp4->SetBinError(hTemp4->FindBin(-binCenter),hTempHelper4->GetBinError(i+1));
+           hTemp1Mix->SetBinError(hTemp1Mix->FindBin(-binCenter),hTempHelper1Mix->GetBinError(i+1));
+           hTemp2Mix->SetBinError(hTemp2Mix->FindBin(-binCenter),hTempHelper2Mix->GetBinError(i+1));
+           hTemp3Mix->SetBinError(hTemp3Mix->FindBin(-binCenter),hTempHelper3Mix->GetBinError(i+1));
+           hTemp4Mix->SetBinError(hTemp4Mix->FindBin(-binCenter),hTempHelper4Mix->GetBinError(i+1));
+         }
+       }
+       else if(iVariablePair==2){
+         if(binCenter>0 && binCenter<TMath::Pi()){
+           hTempPos1->SetBinContent(hTempPos1->FindBin(binCenter),hTempHelper1->GetBinContent(i+1));
+           hTempPos2->SetBinContent(hTempPos2->FindBin(binCenter),hTempHelper2->GetBinContent(i+1));
+           hTempPos3->SetBinContent(hTempPos3->FindBin(binCenter),hTempHelper3->GetBinContent(i+1));
+           hTempPos4->SetBinContent(hTempPos4->FindBin(binCenter),hTempHelper4->GetBinContent(i+1));
+           hTempPos1Mix->SetBinContent(hTempPos1Mix->FindBin(binCenter),hTempHelper1Mix->GetBinContent(i+1));
+           hTempPos2Mix->SetBinContent(hTempPos2Mix->FindBin(binCenter),hTempHelper2Mix->GetBinContent(i+1));
+           hTempPos3Mix->SetBinContent(hTempPos3Mix->FindBin(binCenter),hTempHelper3Mix->GetBinContent(i+1));
+           hTempPos4Mix->SetBinContent(hTempPos4Mix->FindBin(binCenter),hTempHelper4Mix->GetBinContent(i+1));
+
+           hTempPos1->SetBinError(hTempPos1->FindBin(binCenter),hTempHelper1->GetBinError(i+1));
+           hTempPos2->SetBinError(hTempPos2->FindBin(binCenter),hTempHelper2->GetBinError(i+1));
+           hTempPos3->SetBinError(hTempPos3->FindBin(binCenter),hTempHelper3->GetBinError(i+1));
+           hTempPos4->SetBinError(hTempPos4->FindBin(binCenter),hTempHelper4->GetBinError(i+1));
+           hTempPos1Mix->SetBinError(hTempPos1Mix->FindBin(binCenter),hTempHelper1Mix->GetBinError(i+1));
+           hTempPos2Mix->SetBinError(hTempPos2Mix->FindBin(binCenter),hTempHelper2Mix->GetBinError(i+1));
+           hTempPos3Mix->SetBinError(hTempPos3Mix->FindBin(binCenter),hTempHelper3Mix->GetBinError(i+1));
+           hTempPos4Mix->SetBinError(hTempPos4Mix->FindBin(binCenter),hTempHelper4Mix->GetBinError(i+1));
+         }
+         else if(binCenter<0){
+           hTemp1->SetBinContent(hTemp1->FindBin(-binCenter),hTempHelper1->GetBinContent(i+1));
+           hTemp2->SetBinContent(hTemp2->FindBin(-binCenter),hTempHelper2->GetBinContent(i+1));
+           hTemp3->SetBinContent(hTemp3->FindBin(-binCenter),hTempHelper3->GetBinContent(i+1));
+           hTemp4->SetBinContent(hTemp4->FindBin(-binCenter),hTempHelper4->GetBinContent(i+1));
+           hTemp1Mix->SetBinContent(hTemp1Mix->FindBin(-binCenter),hTempHelper1Mix->GetBinContent(i+1));
+           hTemp2Mix->SetBinContent(hTemp2Mix->FindBin(-binCenter),hTempHelper2Mix->GetBinContent(i+1));
+           hTemp3Mix->SetBinContent(hTemp3Mix->FindBin(-binCenter),hTempHelper3Mix->GetBinContent(i+1));
+           hTemp4Mix->SetBinContent(hTemp4Mix->FindBin(-binCenter),hTempHelper4Mix->GetBinContent(i+1));
+
+           hTemp1->SetBinError(hTemp1->FindBin(-binCenter),hTempHelper1->GetBinError(i+1));
+           hTemp2->SetBinError(hTemp2->FindBin(-binCenter),hTempHelper2->GetBinError(i+1));
+           hTemp3->SetBinError(hTemp3->FindBin(-binCenter),hTempHelper3->GetBinError(i+1));
+           hTemp4->SetBinError(hTemp4->FindBin(-binCenter),hTempHelper4->GetBinError(i+1));
+           hTemp1Mix->SetBinError(hTemp1Mix->FindBin(-binCenter),hTempHelper1Mix->GetBinError(i+1));
+           hTemp2Mix->SetBinError(hTemp2Mix->FindBin(-binCenter),hTempHelper2Mix->GetBinError(i+1));
+           hTemp3Mix->SetBinError(hTemp3Mix->FindBin(-binCenter),hTempHelper3Mix->GetBinError(i+1));
+           hTemp4Mix->SetBinError(hTemp4Mix->FindBin(-binCenter),hTempHelper4Mix->GetBinError(i+1));
+         }
+         else{
+           hTemp1->SetBinContent(hTemp1->FindBin(TMath::Pi()-binCenter),hTempHelper1->GetBinContent(i+1));
+           hTemp2->SetBinContent(hTemp2->FindBin(TMath::Pi()-binCenter),hTempHelper2->GetBinContent(i+1));
+           hTemp3->SetBinContent(hTemp3->FindBin(TMath::Pi()-binCenter),hTempHelper3->GetBinContent(i+1));
+           hTemp4->SetBinContent(hTemp4->FindBin(TMath::Pi()-binCenter),hTempHelper4->GetBinContent(i+1));
+           hTemp1Mix->SetBinContent(hTemp1Mix->FindBin(TMath::Pi()-binCenter),hTempHelper1Mix->GetBinContent(i+1));
+           hTemp2Mix->SetBinContent(hTemp2Mix->FindBin(TMath::Pi()-binCenter),hTempHelper2Mix->GetBinContent(i+1));
+           hTemp3Mix->SetBinContent(hTemp3Mix->FindBin(TMath::Pi()-binCenter),hTempHelper3Mix->GetBinContent(i+1));
+           hTemp4Mix->SetBinContent(hTemp4Mix->FindBin(TMath::Pi()-binCenter),hTempHelper4Mix->GetBinContent(i+1));
+
+           hTemp1->SetBinError(hTemp1->FindBin(TMath::Pi()-binCenter),hTempHelper1->GetBinError(i+1));
+           hTemp2->SetBinError(hTemp2->FindBin(TMath::Pi()-binCenter),hTempHelper2->GetBinError(i+1));
+           hTemp3->SetBinError(hTemp3->FindBin(TMath::Pi()-binCenter),hTempHelper3->GetBinError(i+1));
+           hTemp4->SetBinError(hTemp4->FindBin(TMath::Pi()-binCenter),hTempHelper4->GetBinError(i+1));
+           hTemp1Mix->SetBinError(hTemp1Mix->FindBin(TMath::Pi()-binCenter),hTempHelper1Mix->GetBinError(i+1));
+           hTemp2Mix->SetBinError(hTemp2Mix->FindBin(TMath::Pi()-binCenter),hTempHelper2Mix->GetBinError(i+1));
+           hTemp3Mix->SetBinError(hTemp3Mix->FindBin(TMath::Pi()-binCenter),hTempHelper3Mix->GetBinError(i+1));
+           hTemp4Mix->SetBinError(hTemp4Mix->FindBin(TMath::Pi()-binCenter),hTempHelper4Mix->GetBinError(i+1));
+         }
+       }
+      }
+
+      hTemp1->Add(hTempPos1);
+      hTemp2->Add(hTempPos2);
+      hTemp3->Add(hTempPos3);
+      hTemp4->Add(hTempPos4);
+      hTemp1Mix->Add(hTempPos1Mix);
+      hTemp2Mix->Add(hTempPos2Mix);
+      hTemp3Mix->Add(hTempPos3Mix);
+      hTemp4Mix->Add(hTempPos4Mix);
+
       hTemp1->Scale(1./hTemp5->GetEntries());
       hTemp3->Scale(1./hTemp5->GetEntries());
       hTemp2->Scale(1./hTemp6->GetEntries());
@@ -1011,6 +1172,23 @@ TH1D *AliBalancePsi::GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
        h4->Add(hTemp4);
       }
 
+      delete hTemp1;
+      delete hTemp2;
+      delete hTemp3;
+      delete hTemp4;
+      delete hTemp1Mix;
+      delete hTemp2Mix;
+      delete hTemp3Mix;
+      delete hTemp4Mix;
+
+      delete hTempPos1;
+      delete hTempPos2;
+      delete hTempPos3;
+      delete hTempPos4;
+      delete hTempPos1Mix;
+      delete hTempPos2Mix;
+      delete hTempPos3Mix;
+      delete hTempPos4Mix;
     }
   }
 
index 1be2476..1e5b83d 100644 (file)
@@ -932,7 +932,8 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
                     Bool_t k2pMethod = kTRUE,
                     TString eventClass = "Centrality",
                     Bool_t bRootMoments = kFALSE,
-                    Bool_t kUseZYAM = kFALSE) {
+                    Bool_t kUseZYAM = kFALSE,
+                    Bool_t bReduceRangeForMoments = kFALSE) {
   //Macro that draws the balance functions PROJECTIONS 
   //for each centrality bin for the different pT of trigger and 
   //associated particles
@@ -1097,6 +1098,20 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
     // 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.4;
+      }
+
+      cout<<"Use reduced range = "<<rangeReduced<<endl;
+      gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-rangeReduced,rangeReduced);
+    }
+
     meanLatex = "#mu = "; 
     meanLatex += Form("%.3f",gHistBalanceFunctionSubtracted->GetMean());
     meanLatex += " #pm "; 
@@ -1169,7 +1184,7 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
     fileKurtosis.close();
 
     if(!kProjectInEta) gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-TMath::Pi()/2,3.*TMath::Pi()/2);
-
+    else               gHistBalanceFunctionSubtracted->GetXaxis()->SetRangeUser(-1.6,1.6);
   }
   // calculate the moments by hand
   else{
@@ -1257,7 +1272,12 @@ void drawProjections(TH2D *gHistBalanceFunction2D = 0x0,
 
   // Weighted mean as calculated for 1D analysis
   Double_t weightedMean, weightedMeanError;
-  GetWeightedMean1D(gHistBalanceFunctionSubtracted,kProjectInEta,1,-1,weightedMean,weightedMeanError);
+  if(bReduceRangeForMoments){
+    GetWeightedMean1D(gHistBalanceFunctionSubtracted,kProjectInEta,1,-1,weightedMean,weightedMeanError,rangeReduced);
+  }
+  else{
+    GetWeightedMean1D(gHistBalanceFunctionSubtracted,kProjectInEta,1,-1,weightedMean,weightedMeanError,-1.);
+  }
   Printf("Weighted Mean: %lf - Error: %lf",weightedMean, weightedMeanError);
  
   // store in txt files
@@ -1319,7 +1339,8 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
                                         Double_t ptAssociatedMax = -1.,
                                         TString eventClass = "Multiplicity",
                                         Bool_t bRootMoments = kFALSE,
-                                        Bool_t bFullPhiForEtaProjection = kFALSE
+                                        Bool_t bFullPhiForEtaProjection = kFALSE,
+                                        Bool_t bReduceRangeForMoments = kFALSE
 ) {
   //Macro that draws the BF distributions for each centrality bin
   //for reaction plane dependent analysis
@@ -1456,7 +1477,9 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
                   ptAssociatedMin,ptAssociatedMax,
                   kTRUE,
                   eventClass.Data(),
-                  bRootMoments);
+                  bRootMoments,
+                  kFALSE,
+                  bReduceRangeForMoments);
  }
  else{
   drawProjections(gHistBalanceFunction2D,
@@ -1468,7 +1491,9 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
                   ptAssociatedMin,ptAssociatedMax,
                   kTRUE,
                   eventClass.Data(),
-                  bRootMoments);
+                 bRootMoments,
+                 kFALSE,
+                 bReduceRangeForMoments);
  }
 
   drawProjections(gHistBalanceFunction2D,
@@ -1480,7 +1505,9 @@ void drawBFPsi2DFromCorrelationFunctions(const char* lhcPeriod = "LHC10h",
                  ptAssociatedMin,ptAssociatedMax,
                  kTRUE,
                  eventClass.Data(),
-                 bRootMoments);
+                 bRootMoments,
+                 kFALSE,
+                 bReduceRangeForMoments);
 
   TString outFileName = filename;
   outFileName.ReplaceAll("correlationFunction","balanceFunction2D");
@@ -1504,7 +1531,8 @@ void mergeBFPsi2D(TString momDirectory = "./",
                  Double_t ptTriggerMin = -1.,
                  Double_t ptTriggerMax = -1.,
                  Double_t ptAssociatedMin = -1.,
-                 Double_t ptAssociatedMax = -1.
+                 Double_t ptAssociatedMax = -1.,
+                 Bool_t bReduceRangeForMoments = kFALSE
 ) {
   //Macro that draws the BF distributions for each centrality bin
   //for reaction plane dependent analysis
@@ -1611,8 +1639,8 @@ sFileName[iDir] += momDirectory;
 
  // scaling with all entries
  hBFOut->Scale(1./entriesOut);
-  
 drawProjections(hBFOut,
+
+ drawProjections(hBFOut,
                  kTRUE,
                  1,36,
                  gCentrality,
@@ -1621,7 +1649,9 @@ sFileName[iDir] += momDirectory;
                  ptAssociatedMin,ptAssociatedMax,
                  kTRUE,
                  eventClass,
-                 kTRUE);
+                 kTRUE,
+                 kFALSE,
+                 bReduceRangeForMoments);
 
   drawProjections(hBFOut,
                  kFALSE,
@@ -1632,7 +1662,9 @@ sFileName[iDir] += momDirectory;
                  ptAssociatedMin,ptAssociatedMax,
                  kTRUE,
                  eventClass.Data(),
-                 kTRUE);
+                 kTRUE,
+                 kFALSE,
+                 bReduceRangeForMoments);
 
  // output
  TString outFileName = "balanceFunction2D.";
@@ -1672,7 +1704,7 @@ sFileName[iDir] += momDirectory;
 }
 
 //____________________________________________________________________//
-void GetWeightedMean1D(TH1D *gHistBalance, Bool_t kProjectInEta = kTRUE, Int_t fStartBin = 1, Int_t fStopBin = -1, Double_t &WM, Double_t &WME) {
+void GetWeightedMean1D(TH1D *gHistBalance, Bool_t kProjectInEta = kTRUE, Int_t fStartBin = 1, Int_t fStopBin = -1, Double_t &WM, Double_t &WME,Double_t rangeReduced = -1.) {
 
   //Prints the calculated width of the BF and its error
   Double_t gSumXi = 0.0, gSumBi = 0.0, gSumBiXi = 0.0;
@@ -1699,6 +1731,9 @@ void GetWeightedMean1D(TH1D *gHistBalance, Bool_t kProjectInEta = kTRUE, Int_t f
       if(currentBinCenter > TMath::Pi()) currentBinCenter = 2 * TMath::Pi() - currentBinCenter;
     }
 
+    if(rangeReduced > 0 && currentBinCenter > rangeReduced )
+      continue;
+
     gSumXi += currentBinCenter;
     gSumBi += gHistBalance->GetBinContent(i);
     gSumBiXi += gHistBalance->GetBinContent(i)*currentBinCenter;
index 6b5b193..eb50ce1 100644 (file)
@@ -221,7 +221,7 @@ void draw(TList *listBF, TList *listBFShuffled, TList *listBFMixed,
   SetPlotStyle();
   gStyle->SetPalette(1,0);
   
-  const Int_t gRebin = gDeltaEtaDeltaPhi; //rebin by 2 the Delta phi projection
+  const Int_t gRebin = 1.;//gDeltaEtaDeltaPhi; //rebin by 2 the Delta phi projection (old)
 
   //balance function
   AliTHn *hP = NULL;