]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding phenix points to p/pi plot and implementing a method in AliBWTools to divide...
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Sep 2010 13:49:08 +0000 (13:49 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Sep 2010 13:49:08 +0000 (13:49 +0000)
+ few cosmetic changes

PWG2/SPECTRA/Fit/AliBWTools.cxx
PWG2/SPECTRA/Fit/AliBWTools.h
PWG2/SPECTRA/Fit/CombineSpectra.C

index e61f4eed13e6043fed8aa6643f287ee51320e465..f7c37549c1712e035b97c9449b3edce4ba73c6d9 100644 (file)
@@ -1110,3 +1110,41 @@ void AliBWTools::GetHistoCombinedErrors(TH1 * hdest, const TH1 * h1) {
   
 
 }
+
+TH1F * AliBWTools::DivideHistosDifferentBins(const TH1F* h1, const TH1F* h2) {
+  // Divides 2 histos even if they have a different binning. Finds
+  // overlapping bins and divides them
+  
+  // 1. clone histo
+  TH1F * hRatio = new TH1F(*h1);
+  Int_t nBinsH1=h1->GetNbinsX();
+  Int_t nBinsH2=h2->GetNbinsX();
+  // Loop over H1 bins, 
+  for(Int_t iBin=1; iBin<=nBinsH1; iBin++){
+    hRatio->SetBinContent(iBin,0.);
+    hRatio->SetBinContent(iBin,0.);
+    Float_t lowPtH1=h1->GetBinLowEdge(iBin);
+    Float_t binWidH1=h1->GetBinWidth(iBin);
+    // Loop over H2 bins and find overlapping bins to H1
+    for(Int_t jBin=1; jBin<=nBinsH2; jBin++){
+      Float_t lowPtH2=h2->GetBinLowEdge(jBin);
+      Float_t binWidH2=h2->GetBinWidth(jBin);
+      if(TMath::Abs(lowPtH1-lowPtH2)<0.001 && TMath::Abs(binWidH2-binWidH1)<0.001){
+       Float_t numer=h1->GetBinContent(iBin);
+       Float_t denom=h2->GetBinContent(jBin);
+       Float_t enumer=h1->GetBinError(iBin);
+       Float_t edenom=h2->GetBinError(jBin);
+       Double_t ratio=0.;
+       Double_t eratio=0.;
+       if(numer>0. && denom>0.){
+         ratio=numer/denom;
+         eratio=ratio*TMath::Sqrt((enumer/numer)*(enumer/numer)+(edenom/denom)*(edenom/denom));
+       }
+       hRatio->SetBinContent(iBin,ratio);
+       hRatio->SetBinError(iBin,eratio);
+       break;
+      }
+    }
+  }
+  return hRatio;
+}
index 8642085922e1e167de90535ddc655d89fd42b58c..a056d0e96dcc9dec0ebc9ab28d3ab4413bf0eb9d 100644 (file)
@@ -74,7 +74,8 @@ public:
   static void GetValueAndError(TH1 * hdest, const TH1 * hvalue, const TH1 * herror, Bool_t isPercentError) ;  
   static void AddHisto(TH1 * hdest, const TH1* hsource, Bool_t getMirrorBins = kFALSE);
   static void GetHistoCombinedErrors(TH1 * hdest, const TH1 * h1) ;
-  
+  static TH1F * DivideHistosDifferentBins(const TH1F* h1, const TH1F* h2);
+
 
 private:
 
index 9aa8eb4463f3f103a793dd94c1ab6c299aab7ed7..32412d16cd6304df91ef8d5128fa6f6b24ded9fc 100644 (file)
@@ -47,7 +47,7 @@ enum {kStatErrors = 0, kSystErrors, kStatSystErrors}; // which errors do we put
 
 // flags, labels and names
 const char * partFlag[] = {"Pion", "Kaon", "Proton"};
-const char * detFlag[]  = {"TPC", "TOF", "ITS", "ITS Global", "K0", "Kinks", "Combined TOF + TPC", "Combined TOF + TPC + ITS"};
+const char * detFlag[]  = {"TPC", "TOF", "ITS standalone", "ITS-TPC", "K0", "Kinks", "Combined TOF + TPC", "Combined TOF + TPC + ITS"};
 const char * chargeFlag[]  = {"Pos", "Neg"};
 const char * chargeLabel[]  = {"Positive", "Negative"};
 const char * partLabel[kNPart][kNCharge] = {{"#pi^{+}", "#pi^{-}"}, 
@@ -66,7 +66,8 @@ const char * funcName[] = { "Levi", "UA1", "PowerLaw", "Phojet", "AtlasCSC", "CM
 
 // Style
 //const Int_t marker[] = {25,24,28,20,21}; // set for highlithining marek
-const Int_t marker[] = {20,24,25,28,21}; // standard set
+//const Int_t marker[] = {20,24,25,28,21}; // standard set
+const Int_t marker[] = {24,25,28,27,21}; // No full symbols
 const Int_t color [] = {1,2,4};
 
 const Int_t mcLineColor[] = {kGreen,kRed,kBlue,kBlack};
@@ -166,7 +167,7 @@ TString today = "";
 Bool_t convertToMT = 0;
 Bool_t sumCharge = kFALSE;
 Int_t whatToFit = kStatErrors; 
-Bool_t doPrint = 1;
+Bool_t doPrint = 0;
 Bool_t scaleKaons =  kFALSE;
 Bool_t drawStar =  kFALSE; // Overlay star when doing fits
 Bool_t correctSecondaries  = 1;
@@ -711,7 +712,8 @@ void LoadSpectra() {
   // Apply correction factors
   // Secondaries for protons
 
-  f = new TFile ("./Files/corrFactorProtons_20100615.root");
+  //  f = new TFile ("./Files/corrFactorProtons_20100615.root");
+  f = new TFile ("./Files/corrFactorProtons_2010_09_15.root");
   TH1F * hCorrSecondaries = (TH1F*) gDirectory->Get("corrFactorProtons");
   if(correctSecondaries) {
     cout << "CORRECTING SECONDARIES" << endl;
@@ -1117,18 +1119,25 @@ void DrawWithModels() {
       hempty->SetYTitle("1/N_{ev} d^{2}N / dydp_{t} (GeV/c)^{-1}");
       hempty->Draw();
       c1->SetLogy();
+      
 
 
-      TLegend * l =new TLegend(       0.543624,  0.431818,  0.892617,0.629371);
+      TLegend * l =new TLegend(0.502874, 0.493056, 0.892241, 0.904762);
       l->SetFillColor(kWhite);
       hSpectra[iCombInStudy][ipart][icharge]->Draw("same");
-      l->AddEntry(hSpectra[kTOF][ipart][icharge],TString ("Data: ")+partLabel[ipart][icharge]);
+      l->AddEntry(hSpectra[kTOF][ipart][icharge],TString ("Data"));
       for(Int_t itune = 0; itune < kNTunes; itune++){      
        l->AddEntry(hSpectraMC[itune][ipart][icharge],mcTuneName[itune]);
        hSpectraMC[itune][ipart][icharge]->SetLineWidth(2);    
-       hSpectraMC[itune][ipart][icharge]->Draw("same,chist");    
+       AliBWTools::GetGraphFromHisto(hSpectraMC[itune][ipart][icharge])->Draw("CX");
       }
       l->Draw("same");
+     
+      TLatex * tex = new TLatex(0.6712643,2.353486,partLabel[ipart][icharge]);
+      tex->SetTextFont(42);
+      tex->SetTextSize(0.07936508);
+      tex->SetLineWidth(2);
+      tex->Draw();
 
       // Draw ratio
       p2->cd();
@@ -1140,6 +1149,7 @@ void DrawWithModels() {
       hemptyr->GetYaxis()->SetTitleSize(0.05*scaleFonts);
       hemptyr->GetYaxis()->SetTitleOffset(1.4/scaleFonts);
       hemptyr->GetXaxis()->SetTitleSize(0.05*scaleFonts);
+      hemptyr->GetXaxis()->SetTitleOffset(1.05);
       hemptyr->SetTickLength(0.03*scaleFonts, "X");
       hemptyr->SetTickLength(0.02*scaleFonts, "Y");
       //      hemptyr->GetXaxis()->SetTitleOffset(1.4/scaleFonts);
@@ -1155,7 +1165,7 @@ void DrawWithModels() {
        hRatio->SetLineStyle(hSpectraMC[itune][ipart][icharge]->GetLineStyle());
        hRatio->SetLineColor(hSpectraMC[itune][ipart][icharge]->GetLineColor());
        hRatio->SetLineWidth(hSpectraMC[itune][ipart][icharge]->GetLineWidth());
-       hRatio->Draw("lhist,same");
+       AliBWTools::GetGraphFromHisto(hRatio)->Draw("CX");
       }
 
 
@@ -1238,13 +1248,13 @@ void DrawAllAndKaons() {
     TCanvas * c1 = new TCanvas(TString("cAll_")+chargeFlag[icharge],TString("cAll_")+chargeFlag[icharge],700,700);
     c1->SetLogy();
     c1->SetLeftMargin(0.14);
-    TH2F * hempty = new TH2F(TString("hempty")+long(icharge),"hempty",100,0.,4, 100, 1e-4,10);
+    TH2F * hempty = new TH2F(TString("hempty")+long(icharge),"hempty",100,0.,4, 100, 1e-3,10);
     hempty->SetXTitle("p_{t} (GeV/c)");
     hempty->SetYTitle("1/N_{ev} d^{2}N / dydp_{t} (GeV/c)^{-1}");
     hempty->GetYaxis()->SetTitleOffset(1.35);
     hempty->GetXaxis()->SetTitleOffset(1.1);
-    hempty->Draw();
-    leg = new TLegend(0.602011, 0.489583, 0.896552, 0.925595, NULL,"brNDC");
+    hempty->Draw();    
+    leg = new TLegend(0.482759, 0.489583, 0.896552, 0.925595, NULL,"brNDC");
     leg->SetFillColor(0);
     for(Int_t ipart = 0; ipart < kNPart; ipart++) {
       for(Int_t idet = 0; idet <= kITSTPC; idet++){
@@ -1706,6 +1716,15 @@ void DrawRatios() {
     }
   }
  
+  // Phenix ratio
+  TFile * fPhenix = new TFile("./Files/phenixdata.root");
+  TH1F * hPPiRatioPhenix = (TH1F*) fPhenix->Get("ProtonPHNX");
+  hPPiRatioPhenix->Add((TH1F*) fPhenix->Get("PbarPHNX"));
+  htmp = (TH1F*) fPhenix->Get("PiPlusPHNX");
+  htmp->Add((TH1F*) fPhenix->Get("PiMinusPHNX"));
+  hPPiRatioPhenix = AliBWTools::DivideHistosDifferentBins(hPPiRatioPhenix,htmp);
+  hPPiRatioPhenix->SetMarkerStyle(24);
+
   // Draw
 //   TH2F * hempty = new TH2F(TString("hempty"),"hempty",100,0.,1.5, 100, 0.001,1.8);
 //   hempty->SetXTitle("p_{t} (GeV/c)");
@@ -1749,8 +1768,8 @@ void DrawRatios() {
 
 
   TCanvas * c2 = new TCanvas(TString("cRatio_KPi"),TString("cRatio_KPi"));  
-  c2->SetGridy();
-  hKPiRatio->SetMaximum(0.8);
+  //  c2->SetGridy();
+  hKPiRatio->SetMaximum(0.62);
   hKPiRatio->Draw();
   TLegend * lMC = new TLegend(0.526846, 0.18007, 0.887584,0.407343);
   lMC->SetFillColor(kWhite);
@@ -1763,6 +1782,8 @@ void DrawRatios() {
     GetE735Ratios(0,3)->Draw("EX0,same");
   }
   hKPiRatio->SetMarkerStyle(20);
+  hKPiRatio->SetMarkerColor(kRed);
+  hKPiRatio->SetLineColor(kRed);
   hKPiRatio->Draw("same");
   
   if(showMC){
@@ -1788,7 +1809,10 @@ void DrawRatios() {
 
 
   TCanvas * c3 = new TCanvas(TString("cRatio_PPi"),TString("cRatio_PPi"));  
-  c3->SetGridy();
+  //  c3->SetGridy();
+  hPPiRatio->SetMarkerStyle(20);
+  hPPiRatio->SetMarkerColor(kRed);
+  hPPiRatio->SetLineColor(kRed);
   hPPiRatio->Draw();
   hPPiRatio->SetMaximum(0.39);
   if(showMC){
@@ -1803,6 +1827,16 @@ void DrawRatios() {
   
     lMC->Draw();
   }
+  hPPiRatioPhenix->Draw("same");
+
+  
+  TLegend * l = new TLegend(0.186242, 0.781469, 0.538591, 0.921329);
+  l->SetFillColor(kWhite);
+  l->AddEntry(hPPiRatio, "ALICE, #sqrt{s} = 900 GeV","lpf");
+  l->AddEntry(hPPiRatioPhenix, "PHENIX, #sqrt{s} = 200 GeV","lpf");
+  //  TLegend * l = new TLegend(0.206376, 0.77972, 0.600671, 0.909091);
+  l->Draw();
+
 
   if (doPrint) {
     c2->Update();