예제 #1
0
void
Compare(const TString& mode1,
        const TString& mode2)
{
  TH1* h1 = 0;
  TH1* h2 = 0;
  TH1* r1 = 0;
  TH1* i1 = 0;
  TH1* r2 = 0;
  TH1* i2 = 0;
  TProfile* t1 = 0;
  TProfile* t2 = 0;

  if (!GetHistos(mode1, h1, r1, i1, t1)) return;
  if (!GetHistos(mode2, h2, r2, i2, t2)) return;

  TCanvas* can = new TCanvas("comp", "Comparison", 1200, 800);
  can->SetTopMargin(0.15);
  can->SetBottomMargin(0.15);
  can->SetRightMargin(0.03);
  can->SetLeftMargin(0.03);
  can->Divide(2, 2);
  
  DrawTwoInPad(can, 4, t1, t2, true, true);
  DrawTwoInPad(can, 3, i1, i2, true, false, true);
  DrawTwoInPad(can, 2, r1, r2, true);
  DrawTwoInPad(can, 1, h1, h2, false);

  can->Modified();
  can->Update();
  can->cd();

  can->Print(Form("%s_%s.png", mode1.Data(), mode2.Data()));
}
예제 #2
0
void DrawSpectraAndRatios() {

  const Int_t nCent=7;

  const Char_t *title[nCent]={
    "0-5 %",
    "5-10 %",
    "10-20 %",
    "20-40 %",
    "40-60 %",
    "60-80 %",
    "80-90 %"
  };
  const Int_t   colour[nCent]={2,   635, 797, 419, 4 , 6,  1  };
  const Int_t   marker[nCent]={22,  29, 34,  21,  23, 33, 20 };
  const Float_t masize[nCent]={1.3, 1.6, 1.3, 1.2, 1.4, 1.8,  1.3};
  const Float_t factor[nCent]={1.0, 1.0, 1.1, 1.5, 3.0,7.5,15.0}; //scale for drawing
  const Float_t factor2[nCent]={1.0, 0.9, 0.9, 1.1, 2.0,5.5,15.0}; //scale for lin lambda drawing
  const Float_t factor1[nCent]={1.0, 1/2., 1/4., 1/8., 1/16., 1/32., 1/64.}; //scale for log drawing
  
  const Char_t *rNameL[2*nCent]={ // file name, histo name
    "raw.root", "YieldLambda_0005", 
    "raw.root", "YieldLambda_0510", 
    "raw.root", "YieldLambda_1020", 
    "raw.root", "YieldLambda_2040", 
    "raw.root", "YieldLambda_4060", 
    "raw.root", "YieldLambda_6080", 
    "raw.root", "YieldLambda_8090" 
  };
  const Char_t *eNameL[2*nCent]={ // file name, histo name
    "eff.root", "eff_Lambda_comb_0005",
    "eff.root", "eff_Lambda_comb_0510",
    "eff.root", "eff_Lambda_comb_1020",
    "eff.root", "eff_Lambda_comb_2040",
    "eff.root", "eff_Lambda_comb_4060",
    "eff.root", "eff_Lambda_comb_6080",
    "eff.root", "eff_Lambda_comb_8090"
  };

  const Char_t *rNameK[2*nCent]={ // file name, histo name
    "raw.root", "YieldK0Short_0005", 
    "raw.root", "YieldK0Short_0510", 
    "raw.root", "YieldK0Short_1020", 
    "raw.root", "YieldK0Short_2040", 
    "raw.root", "YieldK0Short_4060", 
    "raw.root", "YieldK0Short_6080", 
    "raw.root", "YieldK0Short_8090" 
  };
  const Char_t *eNameK[2*nCent]={ // file name, histo name
    "eff.root", "eff_K0s_comb_0005",
    "eff.root", "eff_K0s_comb_0510",
    "eff.root", "eff_K0s_comb_1020",
    "eff.root", "eff_K0s_comb_2040",
    "eff.root", "eff_K0s_comb_4060",
    "eff.root", "eff_K0s_comb_6080",
    "eff.root", "eff_K0s_comb_8090"
  };

  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetLegendFillColor(0);

  TH1 *raw=0;
  TH1 *eff=0;
  TString option(""), ratio("ratio");

  TCanvas *c1=new TCanvas; c1->SetLogy();
  c1->SetLeftMargin(0.13); c1->SetBottomMargin(0.13);
  TCanvas *c1lin=new TCanvas;
  c1lin->SetLeftMargin(0.13); c1lin->SetBottomMargin(0.13);

  TCanvas *c2=new TCanvas; c2->SetLogy();
  c2->SetLeftMargin(0.13); c2->SetBottomMargin(0.13);
  TCanvas *c2lin=new TCanvas;
  c2lin->SetLeftMargin(0.13); c2lin->SetBottomMargin(0.13);

  TCanvas *c3=new TCanvas;
  c3->SetLeftMargin(0.13); c3->SetBottomMargin(0.13);

  TH1 *lkRatio[nCent]={0};

  for (Int_t cent=0; cent<nCent; cent++) {
      const Char_t *tit=title[cent];
      Int_t col=colour[cent];
      Int_t mar=marker[cent];
      Float_t siz=masize[cent];
 
      // Lambda
      if (!GetHistos(rNameL+2*cent, eNameL+2*cent, raw, eff)) return;
      TH1 *rawHl=MapHisto(raw);
      TH1 *effHl=MapHisto(eff);

      //Feed down
      FeedDown(rawHl);

      rawHl->Divide(effHl);
      SetAttributes(rawHl,tit,col,mar,siz);
      c1->cd();
      DrawHisto(rawHl, option.Data(), sysEffLam, sysSigLam, factor1[cent]);

      TH1 *linHl=(TH1*)rawHl->Clone();
      SetAttributes(linHl,tit,col,mar,siz,0.,20.,32); 
      c1lin->cd();
      DrawHisto(linHl, option.Data(), sysEffLam, sysSigLam, factor2[cent]);

      // K0s
      if (!GetHistos(rNameK+2*cent, eNameK+2*cent, raw, eff)) return;
      TH1 *rawHk=MapHisto(raw);
      TH1 *effHk=MapHisto(eff);
      rawHk->Divide(effHk);
      SetAttributes(rawHk,tit,col,mar,siz,1e-7);
      c2->cd();
      DrawHisto(rawHk, option.Data(), sysEffK0s, sysSigK0s, factor1[cent]);

      TH1 *linHk=(TH1*)rawHk->Clone();
      SetAttributes(linHk,tit,col,mar,siz,0.,120.,32); 
      c2lin->cd();
      DrawHisto(linHk, option.Data(), sysEffK0s, sysSigK0s, factor[cent]);

      // Lambda/K0s
      TH1 *rawHlk=(TH1*)rawHl->Clone();
      lkRatio[cent]=rawHlk;
      TString name=ratio+rawHlk->GetName();
      rawHlk->SetName(name.Data());      
      rawHlk->SetMaximum(1.7);      
      rawHlk->Divide(rawHk);
      rawHlk->GetYaxis()->SetTitle("#Lambda/K^{0}_{S}");
      c3->cd();
      //if (cent!=1)
      DrawRatio(rawHlk,option.Data());

      option+="same";
  }

  for (Int_t cent=0; cent<nCent; cent++) {
    //if (cent != 1) 
    lkRatio[cent]->Draw("same");
  }


  TLegend *leg=c1->BuildLegend(0.68,0.46,0.88,0.82,"Centrality:");
  leg->SetBorderSize(0);
  leg->SetFillColor(0);

  TLegendEntry *entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
  Int_t ci = TColor::GetColor("#cccccc");
  entry->SetLineColor(ci);
  entry->SetLineStyle(1);
  entry->SetLineWidth(10);
  entry->SetMarkerColor(ci);

  c1->cd(); 
  TLatex *   tex = new TLatex(0.5,0.65,"#Lambda");
  tex->SetNDC();
  tex->SetTextFont(42);
  tex->SetTextSize(0.11);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.27,0.83,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
  tex->SetNDC();
  tex->SetTextFont(42);
  tex->SetLineWidth(2);
  tex->Draw();
  //Float_t offx=0.15, offy=0.16, sizx=0.22, sizy=0.22;
  //DrawALICELogo(offx,offy,offx+sizx,offy+sizy);

   leg=c1lin->BuildLegend(0.69,0.43,0.88,0.80,"Centrality:");
   leg->SetBorderSize(0);
   leg->SetFillColor(0);

   entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(10);
   entry->SetMarkerColor(ci);
   entry=leg->AddEntry("NULL","BGBW fit","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);

   c1lin->cd();
   tex=new TLatex(0.27,0.83,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
   tex->SetNDC();
   tex->Draw();
      tex = new TLatex(0.5,0.65,"#Lambda");  
   tex->SetNDC();
   tex->SetTextSize(0.11);
   tex->Draw();
   {
     TFile::Open(" BWFitResults_Lambda0_stat.root");
     const Char_t *name[nCent]={
       "BWFit_0005",
       "BWFit_0510","BWFit_1020","BWFit_2040",
       "BWFit_4060","BWFit_6080","BWFit_8090"
     };
     DrawFit(name, factor2, nCent);
   }
   //Float_t offx1=0.70, offy1=0.18;
   //DrawALICELogo(offx1,offy1,offx1+sizx,offy1+sizy);
       



  leg=c2->BuildLegend(0.68,0.46,0.88,0.82,"Centrality:");
  leg->SetBorderSize(0);
  leg->SetFillColor(0);

  entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
  entry->SetLineColor(ci);
  entry->SetLineStyle(1);
  entry->SetLineWidth(10);
  entry->SetMarkerColor(ci);

  c2->cd(); 
  tex = new TLatex(0.5,0.65,"K^{0}_{S}");
  tex->SetNDC();
  tex->SetTextFont(42);
  tex->SetTextSize(0.089);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.27,0.83,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
  tex->SetNDC();
  tex->SetTextFont(42);
  tex->SetLineWidth(2);
  tex->Draw();
  //DrawALICELogo(offx,offy,offx+sizx,offy+sizy);

   leg=c2lin->BuildLegend(0.69,0.43,0.88,0.80,"Centrality:");
   leg->SetBorderSize(0);
   leg->SetFillColor(0);

   entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(10);
   entry->SetMarkerColor(ci);
   entry=leg->AddEntry("NULL","BGBW fit","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);

   c2lin->cd();
      tex = new TLatex(0.27,0.83,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
   tex->SetNDC();
   tex->Draw();
      tex = new TLatex(0.5,0.65,"K^{0}_{S}");  
   tex->SetNDC();
   tex->SetTextSize(0.089);
   tex->Draw();
   {
     TFile::Open("BWFitResults_K0_stat.root");
     const Char_t *name[nCent]={
       "BWFit_0005",
       "BWFit_0510","BWFit_1020","BWFit_2040",
       "BWFit_4060","BWFit_6080","BWFit_8090"
     };
     DrawFit(name, factor, nCent);
    }
   //DrawALICELogo(offx1,offy1,offx1+sizx,offy1+sizy);
       
   
   //leg=c3->BuildLegend(0.74,0.62,0.88,0.88,"Centrality:");
  leg=c3->BuildLegend(0.55,0.55,0.88,0.88,"Centrality:");
  leg->SetBorderSize(0);
  leg->SetFillColor(0);

  entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
  entry->SetLineColor(ci);
  entry->SetLineStyle(1);
  entry->SetLineWidth(10);
  entry->SetMarkerColor(ci);

  return;
}