//--------------------------------------------------------------------------------------------------
void overlayFrame(TString text, bool align)
{
  // Overlay a linear frame from user coordinates (0 - 1, 0 - 1) and put the frame text

  // Create new transparent pad for the text
  TPad *transPad = new TPad("transPad","Transparent Pad",0,0,1,1);
  transPad->SetFillStyle(4000);
  transPad->Draw();
  transPad->cd();

  // Overlay the text in a well defined frame
  TText *plotText = new TText();
  plotText->SetTextColor(kBlue);
  plotText->SetTextSize(0.04);
  plotText->SetNDC();

  // Draw text at top right
  if (align) {
    plotText->SetTextColor(kBlack);
    plotText->SetTextAlign(33);
    plotText->DrawText(0.92,0.95,text.Data());
  }
  // Draw text at bottom left
  else
    plotText->DrawText(0.01,0.01,text.Data());

  return;
}
예제 #2
0
//--------------------------------------------------------------------------------------------------
void overlayFrame(TString text)
{
  // Overlay a linear frame from user coordinates (0 - 1, 0 - 1) and put the frame text

  // create new transparent pad for the text
  TPad *transPad = new TPad("transPad","Transparent Pad",0,0,1,1);
  transPad->SetFillStyle(4000);
  transPad->Draw();
  transPad->cd();

  // overlay the text in a well defined frame
  TText *plotText = new TText(0.01,0.01,text.Data());
  plotText->SetTextSize(0.04);
  plotText->SetTextColor(kBlue);
  plotText->Draw();

  return;
}
예제 #3
0
void DrawGrid()
{

Int_t ncol = 100;
  Int_t nrow = 200;
  
  
   TPad *grid = new TPad("grid","",0,0,1,1);
   grid->Draw();
   grid->cd();
   grid->SetGrid();
   grid->SetFillStyle(4000);
   grid->SetFrameFillStyle(0);


   TH2 *hgrid = new TH2C("hgrid","", ncol+1, -5, ncol+5, nrow, -5, nrow-1+5);
   hgrid->Draw();
   hgrid->GetXaxis()->SetNdivisions(6,100);
   hgrid->GetYaxis()->SetNdivisions(200);
   hgrid->GetYaxis()->SetLabelOffset(999.);
   hgrid->GetXaxis()->SetLabelOffset(999.);
}
예제 #4
0
void zj_ptj_8TeV()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Thu Apr 28 10:19:34 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,800,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: bottomPad
   TPad *bottomPad = new TPad("bottomPad", "bottomPad",0.005,0.05,0.995,0.995);
   bottomPad->Draw();
   bottomPad->cd();
   bottomPad->Range(0,0,1,1);
   bottomPad->SetFillColor(0);
   bottomPad->SetFillStyle(4000);
   bottomPad->SetBorderMode(0);
   bottomPad->SetBorderSize(2);
   bottomPad->SetTickx(1);
   bottomPad->SetTicky(1);
   bottomPad->SetLeftMargin(0.14);
   bottomPad->SetRightMargin(0.05);
   bottomPad->SetTopMargin(0.05);
   bottomPad->SetBottomMargin(0.16);
   bottomPad->SetFrameLineWidth(2);
   bottomPad->SetFrameBorderMode(0);
   bottomPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(6.172839,-0.2132695,104.9383,0.4330016);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.33);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   Double_t xAxis19[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_toterr__19 = new TH1F("z_ptj_toterr__19","z_ptj",5, xAxis19);
   z_ptj_toterr__19->SetBinContent(1,0.3608738);
   z_ptj_toterr__19->SetBinContent(2,0.225932);
   z_ptj_toterr__19->SetBinContent(3,0.1253807);
   z_ptj_toterr__19->SetBinContent(4,0.06703913);
   z_ptj_toterr__19->SetBinContent(5,0.01561868);
   z_ptj_toterr__19->SetBinContent(6,0.780934);
   z_ptj_toterr__19->SetBinError(1,0.02073388);
   z_ptj_toterr__19->SetBinError(2,0.01400757);
   z_ptj_toterr__19->SetBinError(3,0.009350811);
   z_ptj_toterr__19->SetBinError(4,0.004623786);
   z_ptj_toterr__19->SetBinError(5,0.001395185);
   z_ptj_toterr__19->SetBinError(6,0.06975923);
   z_ptj_toterr__19->SetEntries(12);
   z_ptj_toterr__19->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetLineColor(ci);
   z_ptj_toterr__19->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetMarkerColor(ci);
   z_ptj_toterr__19->SetMarkerStyle(0);
   z_ptj_toterr__19->GetXaxis()->SetNdivisions(4);
   z_ptj_toterr__19->GetXaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetXaxis()->SetLabelOffset(999);
   z_ptj_toterr__19->GetXaxis()->SetLabelSize(0);
   z_ptj_toterr__19->GetXaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetXaxis()->SetTitleFont(132);
   z_ptj_toterr__19->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_toterr__19->GetYaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetYaxis()->SetLabelSize(0.05);
   z_ptj_toterr__19->GetYaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetYaxis()->SetTitleOffset(1.3);
   z_ptj_toterr__19->GetYaxis()->SetTitleFont(132);
   z_ptj_toterr__19->GetZaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetZaxis()->SetLabelSize(0.05);
   z_ptj_toterr__19->GetZaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetZaxis()->SetTitleFont(132);
   z_ptj_toterr__19->Draw("e2");
   Double_t xAxis20[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_staterr__20 = new TH1F("z_ptj_staterr__20","z_ptj",5, xAxis20);
   z_ptj_staterr__20->SetBinContent(1,0.3608738);
   z_ptj_staterr__20->SetBinContent(2,0.225932);
   z_ptj_staterr__20->SetBinContent(3,0.1253807);
   z_ptj_staterr__20->SetBinContent(4,0.06703913);
   z_ptj_staterr__20->SetBinContent(5,0.01561868);
   z_ptj_staterr__20->SetBinContent(6,0.780934);
   z_ptj_staterr__20->SetBinError(1,0.007287406);
   z_ptj_staterr__20->SetBinError(2,0.005663236);
   z_ptj_staterr__20->SetBinError(3,0.002951952);
   z_ptj_staterr__20->SetBinError(4,0.002192817);
   z_ptj_staterr__20->SetBinError(5,0.0004728113);
   z_ptj_staterr__20->SetBinError(6,0.02364057);
   z_ptj_staterr__20->SetEntries(12);
   z_ptj_staterr__20->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetLineColor(ci);
   z_ptj_staterr__20->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetMarkerColor(ci);
   z_ptj_staterr__20->SetMarkerStyle(0);
   z_ptj_staterr__20->GetXaxis()->SetNdivisions(4);
   z_ptj_staterr__20->GetXaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetXaxis()->SetLabelOffset(999);
   z_ptj_staterr__20->GetXaxis()->SetLabelSize(0);
   z_ptj_staterr__20->GetXaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetXaxis()->SetTitleFont(132);
   z_ptj_staterr__20->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_staterr__20->GetYaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetYaxis()->SetLabelSize(0.05);
   z_ptj_staterr__20->GetYaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetYaxis()->SetTitleFont(132);
   z_ptj_staterr__20->GetZaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetZaxis()->SetLabelSize(0.05);
   z_ptj_staterr__20->GetZaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetZaxis()->SetTitleFont(132);
   z_ptj_staterr__20->Draw("e2same");
   
   Double_t ptj_toterrs_fx3022[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t ptj_toterrs_fy3022[5] = {
   0.3671394,
   0.2404275,
   0.1334798,
   0.06537649,
   0.01594908};
   Double_t ptj_toterrs_felx3022[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fely3022[5] = {
   0.02997783,
   0.02293181,
   0.009217184,
   0.004503167,
   0.001643067};
   Double_t ptj_toterrs_fehx3022[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fehy3022[5] = {
   0.02512764,
   0.01751375,
   0.008693834,
   0.005222099,
   0.001753864};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(5,ptj_toterrs_fx3022,ptj_toterrs_fy3022,ptj_toterrs_felx3022,ptj_toterrs_fehx3022,ptj_toterrs_fely3022,ptj_toterrs_fehy3022);
   grae->SetName("ptj_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_Graph_ptj_toterrs30153022 = new TH1F("Graph_Graph_ptj_toterrs30153022","",100,17.325,88.425);
   Graph_Graph_ptj_toterrs30153022->SetMinimum(0.01287542);
   Graph_Graph_ptj_toterrs30153022->SetMaximum(0.4300631);
   Graph_Graph_ptj_toterrs30153022->SetDirectory(0);
   Graph_Graph_ptj_toterrs30153022->SetStats(0);
   Graph_Graph_ptj_toterrs30153022->SetLineWidth(2);
   Graph_Graph_ptj_toterrs30153022->SetMarkerStyle(0);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetNdivisions(4);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelSize(0);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_ptj_toterrs30153022);
   
   grae->Draw("p1p");
   
   Double_t _fx3023[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t _fy3023[5] = {
   0.3671394,
   0.2404275,
   0.1334798,
   0.06537649,
   0.01594908};
   Double_t _felx3023[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3023[5] = {
   0.01985385,
   0.01348796,
   0.006928003,
   0.003412992,
   0.001084033};
   Double_t _fehx3023[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3023[5] = {
   0.01921597,
   0.01338518,
   0.006596172,
   0.003531927,
   0.001381032};
   grae = new TGraphAsymmErrors(5,_fx3023,_fy3023,_felx3023,_fehx3023,_fely3023,_fehy3023);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_Graph_Graph30163023 = new TH1F("Graph_Graph_Graph30163023","",100,17.325,88.425);
   Graph_Graph_Graph30163023->SetMinimum(0.01337855);
   Graph_Graph_Graph30163023->SetMaximum(0.4235044);
   Graph_Graph_Graph30163023->SetDirectory(0);
   Graph_Graph_Graph30163023->SetStats(0);
   Graph_Graph_Graph30163023->SetLineWidth(2);
   Graph_Graph_Graph30163023->SetMarkerStyle(0);
   Graph_Graph_Graph30163023->GetXaxis()->SetNdivisions(4);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelSize(0);
   Graph_Graph_Graph30163023->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_Graph30163023->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph30163023->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30163023->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph30163023);
   
   grae->Draw("p1p");
   
   Double_t ptj_toterrs_fx3024[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t ptj_toterrs_fy3024[5] = {
   0.389299,
   0.2509263,
   0.1443755,
   0.07365244,
   0.01874484};
   Double_t ptj_toterrs_felx3024[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fely3024[5] = {
   0.0283978,
   0.01982285,
   0.01219084,
   0.00636368,
   0.001684181};
   Double_t ptj_toterrs_fehx3024[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fehy3024[5] = {
   0.03041728,
   0.02088176,
   0.0127053,
   0.007720362,
   0.001934453};
   grae = new TGraphAsymmErrors(5,ptj_toterrs_fx3024,ptj_toterrs_fy3024,ptj_toterrs_felx3024,ptj_toterrs_fehx3024,ptj_toterrs_fely3024,ptj_toterrs_fehy3024);
   grae->SetName("ptj_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_ptj_toterrs30173024 = new TH1F("Graph_Graph_ptj_toterrs30173024","",100,17.175,72.075);
   Graph_Graph_ptj_toterrs30173024->SetMinimum(0.01535459);
   Graph_Graph_ptj_toterrs30173024->SetMaximum(0.4599818);
   Graph_Graph_ptj_toterrs30173024->SetDirectory(0);
   Graph_Graph_ptj_toterrs30173024->SetStats(0);
   Graph_Graph_ptj_toterrs30173024->SetLineWidth(2);
   Graph_Graph_ptj_toterrs30173024->SetMarkerStyle(0);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetNdivisions(4);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelSize(0);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_ptj_toterrs30173024);
   
   grae->Draw("p1p");
   
   Double_t _fx3025[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t _fy3025[5] = {
   0.389299,
   0.2509263,
   0.1443755,
   0.07365244,
   0.01874484};
   Double_t _felx3025[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3025[5] = {
   0.02243218,
   0.01539977,
   0.009090877,
   0.00492242,
   0.001303763};
   Double_t _fehx3025[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3025[5] = {
   0.02411537,
   0.01689699,
   0.0100922,
   0.005544287,
   0.001554499};
   grae = new TGraphAsymmErrors(5,_fx3025,_fy3025,_felx3025,_fehx3025,_fely3025,_fehy3025);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph30183025 = new TH1F("Graph_Graph_Graph30183025","",100,17.175,72.075);
   Graph_Graph_Graph30183025->SetMinimum(0.01569697);
   Graph_Graph_Graph30183025->SetMaximum(0.4530117);
   Graph_Graph_Graph30183025->SetDirectory(0);
   Graph_Graph_Graph30183025->SetStats(0);
   Graph_Graph_Graph30183025->SetLineWidth(2);
   Graph_Graph_Graph30183025->SetMarkerStyle(0);
   Graph_Graph_Graph30183025->GetXaxis()->SetNdivisions(4);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelSize(0);
   Graph_Graph_Graph30183025->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_Graph30183025->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph30183025->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30183025->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph30183025);
   
   grae->Draw("p1p");
   
   TLegend *leg = new TLegend(0.65,0.57,0.95,0.82,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("data_stat","Data_{stat}","f");

   ci = TColor::GetColor("#ff9933");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("data_tot","Data_{tot}","f");

   ci = TColor::GetColor("#ffff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("powheg_temp","POWHEG","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("amcatnlo_temp","aMC@NLO","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(24);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.5,0.85,0.85,0.94,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetLineWidth(2);
   pt->SetTextFont(132);
   TText *AText = pt->AddText("LHCb, #sqrt{s} = 8 TeV");
   pt->Draw();
   Double_t xAxis21[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_toterr_copy__21 = new TH1F("z_ptj_toterr_copy__21","z_ptj",5, xAxis21);
   z_ptj_toterr_copy__21->SetBinContent(1,0.3608738);
   z_ptj_toterr_copy__21->SetBinContent(2,0.225932);
   z_ptj_toterr_copy__21->SetBinContent(3,0.1253807);
   z_ptj_toterr_copy__21->SetBinContent(4,0.06703913);
   z_ptj_toterr_copy__21->SetBinContent(5,0.01561868);
   z_ptj_toterr_copy__21->SetBinContent(6,0.780934);
   z_ptj_toterr_copy__21->SetBinError(1,0.02073388);
   z_ptj_toterr_copy__21->SetBinError(2,0.01400757);
   z_ptj_toterr_copy__21->SetBinError(3,0.009350811);
   z_ptj_toterr_copy__21->SetBinError(4,0.004623786);
   z_ptj_toterr_copy__21->SetBinError(5,0.001395185);
   z_ptj_toterr_copy__21->SetBinError(6,0.06975923);
   z_ptj_toterr_copy__21->SetEntries(12);
   z_ptj_toterr_copy__21->SetDirectory(0);
   z_ptj_toterr_copy__21->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetLineColor(ci);
   z_ptj_toterr_copy__21->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetMarkerColor(ci);
   z_ptj_toterr_copy__21->SetMarkerStyle(0);
   z_ptj_toterr_copy__21->GetXaxis()->SetNdivisions(4);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelOffset(999);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelSize(0);
   z_ptj_toterr_copy__21->GetXaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetXaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_toterr_copy__21->GetYaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetYaxis()->SetLabelSize(0.05);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleOffset(1.3);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->GetZaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetZaxis()->SetLabelSize(0.05);
   z_ptj_toterr_copy__21->GetZaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetZaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: lowerPad
   TPad *lowerPad = new TPad("lowerPad", "lowerPad",0.005,0.05,0.995,0.995);
   lowerPad->Draw();
   lowerPad->cd();
   lowerPad->Range(6.172839,-0.1935898,104.9383,4.832052);
   lowerPad->SetFillColor(0);
   lowerPad->SetFillStyle(4000);
   lowerPad->SetBorderMode(0);
   lowerPad->SetBorderSize(2);
   lowerPad->SetTickx(1);
   lowerPad->SetTicky(1);
   lowerPad->SetLeftMargin(0.14);
   lowerPad->SetRightMargin(0.05);
   lowerPad->SetTopMargin(0.665);
   lowerPad->SetBottomMargin(0.14);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   Double_t xAxis22[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp0__22 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp0__22","z_ptj",5, xAxis22);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(1,0.05745466);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(2,0.06199906);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(3,0.07457933);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(4,0.06897145);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(5,0.08932795);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(6,0.06975923);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleOffset(1.3);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->Draw("e2");
   Double_t xAxis23[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp1__23 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp1__23","z_ptj",5, xAxis23);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(1,0.02019378);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(2,0.02506611);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(3,0.02354391);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(4,0.03270951);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(5,0.03027217);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(6,0.02364057);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->Draw("e2same");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fx3026[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fy3026[5] = {
   1.017362,
   1.064159,
   1.064596,
   0.9751989,
   1.021154};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_felx3026[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fely3026[5] = {
   0.08307013,
   0.1014988,
   0.07351357,
   0.06717222,
   0.1051988};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fehx3026[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fehy3026[5] = {
   0.06962999,
   0.07751779,
   0.06933948,
   0.07789628,
   0.1122927};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp2_fx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fy3026,zj_ptj_8TeV_400_1001_0ratiocomp2_felx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fehx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fely3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fehy3026);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp2");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026","",100,17.325,88.425);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026);
   
   grae->Draw("p1");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fx3027[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fy3027[5] = {
   1.017362,
   1.064159,
   1.064596,
   0.9751989,
   1.021154};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_felx3027[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fely3027[5] = {
   0.05501606,
   0.05969921,
   0.05525572,
   0.05091044,
   0.06940621};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fehx3027[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fehy3027[5] = {
   0.05324843,
   0.05924428,
   0.05260914,
   0.05268456,
   0.08842185};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp3_fx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fy3027,zj_ptj_8TeV_400_1001_0ratiocomp3_felx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fehx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fely3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fehy3027);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp3");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027","",100,17.325,88.425);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027);
   
   grae->Draw("p1");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fx3028[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fy3028[5] = {
   1.078768,
   1.110628,
   1.151497,
   1.098648,
   1.200155};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_felx3028[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fely3028[5] = {
   0.07869176,
   0.08773815,
   0.0972306,
   0.09492486,
   0.1078312};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fehx3028[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fehy3028[5] = {
   0.08428785,
   0.09242501,
   0.1013337,
   0.115162,
   0.1238551};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp4_fx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fy3028,zj_ptj_8TeV_400_1001_0ratiocomp4_felx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fehx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fely3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fehy3028);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp4");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028","",100,17.175,72.075);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028);
   
   grae->Draw("p1");
   Double_t xAxis24[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24","z_ptj",5, xAxis24);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(1,0.05745466);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(2,0.06199906);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(3,0.07457933);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(4,0.06897145);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(5,0.08932795);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(6,0.06975923);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetDirectory(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleOffset(1.3);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->Draw("sameaxis");
   lowerPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}
예제 #5
0
파일: test.C 프로젝트: bainbrid/usercode
// -----------------------------------------------------------------------------
//
void test() {

  time_t start = TTimeStamp().GetSec();

  set_plot_style();

  bool draw = true;
  //bool debug = true;

  // Define analysis configuration
  PSet ps;
  defaultPSet(ps);

  // Response plots
  if (false) {
    //xSectDistr(ps);
    responseProfile();
    return;
  }
  
  // Print configuration
  std::stringstream ss;
  printPSet(ps,ss);
  std::cout << ss.str() << std::endl;
  
  // Params to store
  DoubleVV ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err;
  IntV length;
  clear( ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  init( ps, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  
  // Loop through Meff bins 
  int loop = 0;
  int nloops = ps.nmeff;
  for ( int imeff = 0; imeff < ps.nmeff; ++imeff ) {

    // Generate numbers in (x1,x2) plane
    DoubleVV dalitz;
    generateTruth( ps, imeff, dalitz, true );

    // Integrate across dalitz plane
    integrate( ps, imeff, dalitz, ratio, ratio_errh, ratio_errl, 
	       pass, pass_err, fail, fail_err, length );
    
    // Labeling
    std::stringstream ss;
    ss << "Meff" << int( ps.meff_bins[imeff] );
    
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
    
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(ps.min,ps.min,ps.max,ps.max);
    
    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "M_{eff}=" << ps.meff_bins[imeff] << " GeV"
	  << ", p_{T1}=" << dr(ps.pt1_bins[imeff],1) << " GeV"
	  << ", p_{T2}=" << dr(ps.pt2_bins[imeff],1) << " GeV"
	  << ", p_{T3}=" << dr(ps.pt3_bins[imeff],1) << " GeV";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
    
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     ps.nbins,ps.min,ps.max,
			     ps.nbins,ps.min,ps.max);
    
    //double x3 = ( 2. * ps.pt3_bins[imeff] ) / ( ps.meff_bins[imeff] + ps.pt3_bins[imeff] );
    
    // Fill 2D cross-section plot
    for ( int x2_bin = 0; x2_bin < ps.nbins; ++x2_bin ) { 
      for ( int x1_bin = 0; x1_bin < ps.nbins; ++x1_bin ) { 
// 	std::cout << " Fill:"
// 		  << " x2_bin: " << x2_bin 
// 		  << " x2: " << val(x2_bin,nbins) 
// 		  << " x1_bin: " << x1_bin 
// 		  << " x1: " << val(x1_bin,nbins) 
// 		  << " val: " << dalitz[x2_bin][x1_bin]
// 		  << std::endl;
	if (his) his->Fill( val(x2_bin,ps)+ps.width/2.,
			    val(x1_bin,ps)+ps.width/2.,
			    dalitz[x2_bin][x1_bin] ); 
      }
    }
    
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      //his->SetMaximum( his->GetMaximum()*10. );
      //his->SetMinimum( his->GetMinimum(1.e-12)*0.1 );
//       his->SetMaximum( 1.e9 );
//       his->SetMinimum( 1.e0 );
      his->Draw("COLZsame");
    }
    
    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    //TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
	Double_t alpha_t = ps.cutValues[icut];
	const Int_t n = ps.nbins;
	DoubleV x1(n,0.);
	DoubleV x2(n,0.);
	for ( Int_t x2_bin = 0; x2_bin < ps.nbins; x2_bin++ ) {
	  x2[x2_bin] = x2_bin * ps.width;
	  x1[x2_bin] = cutAlgoInverse(ps.cutValues[icut],x2[x2_bin],ALGO_TYPE);
	}
	TGraph* gr = new TGraph(n,&x2.front(),&x1.front());
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
    if (c1) c1->SaveAs(TString(ss.str()+".pdf"));
    if (c1) c1->SaveAs(TString(ss.str()+".C"));

  }

  // Canvas for ratio vs Meff
  if (false) {
    
    TCanvas* c2 = new TCanvas( "c2", "" );
    c2->SetRightMargin(0.2);
    c2->SetLogy();
    c2->cd();
    TMultiGraph* mg2 = new TMultiGraph();

    DoubleV err( ps.nmeff, 0. );
    for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
      if ( length[icut] == 0 ) { continue; }
//       TGraphAsymmErrors* gr = new TGraphAsymmErrors( length[icut], 
//  						     &ps.meff_bins.front(), 
//  						     &err.front(),
//  						     &err.front(),
//  						     &ratio[icut].front(),
//  						     &ratio_errl[icut].front(),
//  						     &ratio_errh[icut].front() );
      TGraph* gr = new TGraphAsymmErrors( length[icut], 
 					  &ps.meff_bins.front(), 
 					  &ratio[icut].front() );
      std::stringstream ss;
      ss << "a_{T}=" << ps.cutValues[icut];
// 	 << " Meff=" << meff_bins[imeff]
// 	 << ", p_{T3}=" << pt3_bins[imeff];
      mg2->Add(gr,"lp");
      gr->SetTitle(TString(ss.str()));
      gr->SetLineColor(2+icut);
      gr->SetLineWidth(2);
      gr->SetMarkerStyle(20+icut);
      gr->SetMarkerColor(2+icut);
      gr->SetMarkerSize(1.5);
    }
    
    mg2->Draw("a");
    mg2->GetYaxis()->SetRangeUser(1.e-6,1.e0);
    c2->Update();
    c2->BuildLegend(0.81,0.1,0.99,0.9);
    
    // Save canvases
    c2->cd();
    c2->SaveAs("RatioVsMeff.png");
    c2->SaveAs("RatioVsMeff.pdf");
    c2->SaveAs("RatioVsMeff.C");
    
  }
  
  time_t stop = TTimeStamp().GetSec();
  std::cout << " Time taken: " << stop - start <<  " seconds" << std::endl;

}
예제 #6
0
void ptBestFit(float BIN_SIZE=5.0,bool BLIND=false,TString MASS,TString NAME)
{
  gROOT->ProcessLine(".x ../../common/styleCMSTDR.C");
  gSystem->Load("libHiggsAnalysisCombinedLimit.so");
  gROOT->ForceStyle();
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gROOT->SetBatch(1);
  gStyle->SetPadRightMargin(0.04);
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadTopMargin(0.06);
  gStyle->SetPadBottomMargin(0.10);
  gStyle->SetTitleFont(42,"XY");
  gStyle->SetTitleSize(0.0475,"XY");
  gStyle->SetTitleOffset(0.9,"X");
  gStyle->SetTitleOffset(1.5,"Y");
  gStyle->SetLabelSize(0.0375,"XY");

  RooMsgService::instance().setSilentMode(kTRUE);
  for(int i=0;i<2;i++) {
    RooMsgService::instance().setStreamStatus(i,kFALSE);
  }
  float XMIN = 80;
  float XMAX = 200; 

  TFile *f1 = TFile::Open("datacards/datacard_m"+MASS+"_"+NAME+".root");
  TFile *f2 = TFile::Open("combine/mlfit.vbfHbb_"+NAME+"_mH"+MASS+".root");
  TFile *f3 = TFile::Open("root/sig_shapes_workspace_B80-200.root");
  TFile *f4 = TFile::Open("root/data_shapes_workspace_"+NAME+".root");

  RooWorkspace *w = (RooWorkspace*)f1->Get("w");
  //w->Print();
  RooAbsPdf *bkg_model = (RooAbsPdf*)w->pdf("model_s");
  RooFitResult *res_s  = (RooFitResult*)f2->Get("fit_s"); 
  RooFitResult *res_b  = (RooFitResult*)f2->Get("fit_b");
  RooRealVar *rFit     = dynamic_cast<RooRealVar *>(res_s->floatParsFinal()).find("r");
  RooDataSet *data     = (RooDataSet*)w->data("data_obs");
  
  int nparS=0,nparB=0;
  cout << res_s->floatParsFinal().getSize() << endl;
  cout << res_b->floatParsFinal().getSize() << endl;
  nparS = res_s->floatParsFinal().getSize();
  nparB = res_b->floatParsFinal().getSize();  
  float chi2sumS = 0.;
  float chi2sumB = 0.;
  int nparsum = 0;
//  if (BLIND) {
//    res_b->Print();
//  }
//  else {
//    res_s->Print();
//  }
  
  w->allVars().assignValueOnly(res_s->floatParsFinal());
//  w->Print();
//  w->allVars()->Print();

  RooWorkspace *wSig = (RooWorkspace*)f3->Get("w"); 
  RooWorkspace *wDat = (RooWorkspace*)f4->Get("w"); 

  const RooSimultaneous *sim = dynamic_cast<const RooSimultaneous *> (bkg_model);
  const RooAbsCategoryLValue &cat = (RooAbsCategoryLValue &) sim->indexCat();
  TList *datasets = data->split(cat,true);
  TIter next(datasets);
  //int count = 0; 
  for(RooAbsData *ds = (RooAbsData*)next();ds != 0; ds = (RooAbsData*)next()) {
	 //if (count > 0) return 0;
	 //count++;
    RooAbsPdf *pdfi = sim->getPdf(ds->GetName());
    RooArgSet *obs = (RooArgSet*)pdfi->getObservables(ds);
    RooRealVar *x = dynamic_cast<RooRealVar *>(obs->first());

    RooRealVar *yield_vbf = (RooRealVar*)wSig->var("yield_signalVBF_mass"+MASS+"_"+TString(ds->GetName()));
    RooRealVar *yield_gf  = (RooRealVar*)wSig->var("yield_signalGF_mass"+MASS+"_"+TString(ds->GetName()));
    TString ds_name(ds->GetName());
    //----- get the QCD normalization -----------
    RooRealVar *qcd_norm_final = dynamic_cast<RooRealVar *>(res_s->floatParsFinal()).find("CMS_vbfbb_qcd_norm_"+ds_name);
    RooRealVar *qcd_yield      = (RooRealVar*)wDat->var("yield_data_"+ds_name);

    float Nqcd  = exp(log(1.5)*qcd_norm_final->getVal())*qcd_yield->getVal();
    float eNqcd = log(1.5)*qcd_norm_final->getError()*Nqcd;
    cout<<"QCD normalization = "<<Nqcd<<" +/- "<<eNqcd<<endl;
    
    TH1 *hCoarse = (TH1*)ds->createHistogram("coarseHisto_"+ds_name,*x);
    float norm = hCoarse->Integral();
  
	 int rebin = BIN_SIZE/hCoarse->GetBinWidth(1);
    hCoarse->Rebin(rebin);

    float MIN_VAL = TMath::Max(0.9*hCoarse->GetBinContent(hCoarse->GetMinimumBin()),1.0);
    float MAX_VAL = 1.3*hCoarse->GetBinContent(hCoarse->GetMaximumBin());
    RooDataHist ds_coarse("ds_coarse_"+ds_name,"ds_coarse_"+ds_name,*x,hCoarse);

    TH1F *hBlind = (TH1F*)hCoarse->Clone("blindHisto_"+ds_name);
    for(int i=0;i<hBlind->GetNbinsX();i++) {
      double x0 = hBlind->GetBinCenter(i+1);
      if (x0 > 100 && x0 < 150) {
        hBlind->SetBinContent(i+1,0);
        hBlind->SetBinError(i+1,0);
      }
    }
    
    RooDataHist ds_blind("ds_blind_"+ds_name,"ds_blind_"+ds_name,*x,hBlind); 
    
    RooHist *hresid,*hresid0;
    RooPlot *frame1 = x->frame();
    RooPlot *frame2 = x->frame();
    
    if (BLIND) {
		//cout << "Blind case: " << ds_coarse.GetName() << endl;
      ds_coarse.plotOn(frame1,LineColor(0),MarkerColor(0));
      pdfi->plotOn(frame1,Components("shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name),VisualizeError(*res_s,1,kTRUE),FillColor(0),MoveToBack());
      pdfi->plotOn(frame1,Components("shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name),LineWidth(2),LineStyle(3));
      ds_blind.plotOn(frame1);
      hresid = frame1->residHist();
      frame2->addPlotable(hresid,"pE1");
    }
    else {    
		//cout << "Non-blind case: " << ds_coarse.GetName() << endl;
		ds_coarse.plotOn(frame1);
      pdfi->plotOn(frame1);
		//cout << pdfi->getParameters(ds_coarse)->selectByAttrib("Constant",kFALSE)->getSize() << endl;
      cout<<"chi2/ndof (bkg+sig) = "<<frame1->chiSquare()<<endl;
		cout << ds_coarse.numEntries() << endl;
		chi2sumS += frame1->chiSquare()*ds_coarse.numEntries();
		nparsum += ds_coarse.numEntries();
		//hresid0 = frame1->residHist();
      //pdfi->plotOn(frame1,VisualizeError(*res_s,1,kTRUE),FillColor(0),MoveToBack());
      pdfi->plotOn(frame1,Components("shapeBkg_qcd_"+ds_name),LineWidth(2),LineStyle(5),LineColor(kGreen+2));
      pdfi->plotOn(frame1,Components("shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name),LineWidth(2),LineStyle(2),LineColor(kBlack)); 
      cout<<"chi2/ndof (bkg) = "<<frame1->chiSquare()<<endl;
		chi2sumB += frame1->chiSquare()*ds_coarse.numEntries();
		pdfi->plotOn(frame1,Components("shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name),LineWidth(2),LineStyle(2),LineColor(kBlack),VisualizeError(*res_s,1,kTRUE),FillColor(0),MoveToBack()); 
      hresid = frame1->residHist();
      frame2->addPlotable(hresid,"pE1");
    
      float yield_sig = rFit->getValV()*(yield_vbf->getValV()+yield_gf->getValV());
      RooAbsPdf *signal_pdf = (RooAbsPdf*)w->pdf("shapeSig_qqH_"+ds_name);
      signal_pdf->plotOn(frame2,LineWidth(2),LineColor(kRed),Normalization(yield_sig,RooAbsReal::NumEvent),MoveToBack());
    }
//	 hresid0->Print();
//	 hresid->Print();
//	 double x2,y2;
//	 for (int i=0; i<3; ++i) {
//		 hresid0->GetPoint(i,x2,y2);
//		 cout << "BKG+SIG\t" << x2 << "\t" << y2 << endl;
//		 hresid->GetPoint(i,x2,y2);
//		 cout << "BKG\t" << x2 << "\t" << y2 << endl;
//		 ds_coarse.get(i);
//		 cout << ds_coarse.weightError(RooAbsData::SumW2) << endl;
//		 cout << endl;
//	 }

    TCanvas* canFit = new TCanvas("Higgs_fit_"+ds_name,"Higgs_fit_"+ds_name,900,750);
    canFit->cd(1)->SetBottomMargin(0.4);
    frame1->SetMinimum(MIN_VAL);
    frame1->SetMaximum(MAX_VAL);
    frame1->GetYaxis()->SetNdivisions(510);
    frame1->GetXaxis()->SetTitleSize(0);
    frame1->GetXaxis()->SetLabelSize(0);
    frame1->GetYaxis()->SetTitle(TString::Format("Events / %1.1f GeV",BIN_SIZE));
    frame1->Draw();
    gPad->Update();
    
    TList *list = (TList*)gPad->GetListOfPrimitives();
    //list->Print();
    TH1F *hUncH  = new TH1F("hUncH"+ds_name,"hUncH"+ds_name,(XMAX-XMIN)/BIN_SIZE,XMIN,XMAX);
    TH1F *hUncL  = new TH1F("hUncL"+ds_name,"hUncL"+ds_name,(XMAX-XMIN)/BIN_SIZE,XMIN,XMAX);
    TH1F *hUnc2H = new TH1F("hUnc2H"+ds_name,"hUnc2H"+ds_name,(XMAX-XMIN)/BIN_SIZE,XMIN,XMAX);
    TH1F *hUnc2L = new TH1F("hUnc2L"+ds_name,"hUnc2L"+ds_name,(XMAX-XMIN)/BIN_SIZE,XMIN,XMAX); 
    TH1F *hUncC  = new TH1F("hUncC"+ds_name,"hUncC"+ds_name,(XMAX-XMIN)/BIN_SIZE,XMIN,XMAX); 
    
    RooCurve *errorBand,*gFit,*gQCDFit,*gBkgFit;
    
	//list->Print();
    if (BLIND) {
      errorBand = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]_errorband_Comp[shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name+"]");
      gFit = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]"+"_Comp[shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name+"]");
    }
    else {
      //errorBand = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]_errorband");
      errorBand = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]_errorband_Comp[shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name+"]");
      gFit = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]");
    } 
    gQCDFit = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]"+"_Comp[shapeBkg_qcd_"+ds_name+"]");  
    gBkgFit = (RooCurve*)list->FindObject("pdf_bin"+ds_name+"_Norm[mbbReg_"+ds_name+"]"+"_Comp[shapeBkg_qcd_"+ds_name+",shapeBkg_top_"+ds_name+",shapeBkg_zjets_"+ds_name+"]");
    for(int i=0;i<hUncH->GetNbinsX();i++) {
      double x0 = hUncH->GetBinCenter(i+1);
      double e1 = fabs(errorBand->Eval(x0)-gBkgFit->Eval(x0));
      //double e1 = fabs(errorBand->Eval(x0)-gFit->Eval(x0));
      double e2 = eNqcd/hUncH->GetNbinsX();
      hUncH->SetBinContent(i+1,sqrt(pow(e2,2)+pow(e1,2)));
      hUnc2H->SetBinContent(i+1,2*sqrt(pow(e2,2)+pow(e1,2)));
      hUncL->SetBinContent(i+1,-sqrt(pow(e2,2)+pow(e1,2)));
      hUnc2L->SetBinContent(i+1,-2*sqrt(pow(e2,2)+pow(e1,2)));
		hUncC->SetBinContent(i+1,0.);
    }
   
    TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
    pad->SetTopMargin(0.63);
    pad->SetFillColor(0);
    pad->SetFillStyle(0);
    pad->Draw();
    pad->cd(0);
    hUnc2H->GetXaxis()->SetTitle("m_{bb} (GeV)");
    hUnc2H->GetYaxis()->SetTitle("Data - Bkg");
    //hUnc2H->GetYaxis()->SetTitle("Data - Fit");
    double YMAX = 1.1*frame2->GetMaximum();
    double YMIN = -1.1*frame2->GetMaximum();
    hUnc2H->GetYaxis()->SetRangeUser(YMIN,YMAX);
    hUnc2H->GetYaxis()->SetNdivisions(507);
//    hUnc2H->GetXaxis()->SetTitleOffset(0.9);
//    hUnc2H->GetYaxis()->SetTitleOffset(1.0);
    hUnc2H->GetYaxis()->SetTickLength(0.0);
//    hUnc2H->GetYaxis()->SetTitleSize(0.05);
//    hUnc2H->GetYaxis()->SetLabelSize(0.04);
    hUnc2H->GetYaxis()->CenterTitle(kTRUE);
    hUnc2H->SetFillColor(kGreen);
    hUnc2L->SetFillColor(kGreen);
    hUncH->SetFillColor(kYellow);
    hUncL->SetFillColor(kYellow);
	 hUncC->SetLineColor(kBlack);
	 hUncC->SetLineStyle(7);
    hUnc2H->Draw("HIST");
    hUnc2L->Draw("same HIST");
    hUncH->Draw("same HIST");
    hUncL->Draw("same HIST");
	 hUncC->Draw("same HIST");
	 frame2->GetYaxis()->SetTickLength(0.03/0.4);
    frame2->Draw("same");

    TList *list1 = (TList*)gPad->GetListOfPrimitives();
    //list1->Print();
    RooCurve *gSigFit = (RooCurve*)list1->FindObject("shapeSig_qqH_"+ds_name+"_Norm[mbbReg_"+ds_name+"]");

    TLegend *leg = new TLegend(0.70,0.61,0.94,1.-gStyle->GetPadTopMargin()-0.01);
	 leg->SetTextFont(42);
	 leg->SetFillStyle(-1);
	 //leg->SetHeader(ds_name+" (m_{H}="+MASS+")");
    leg->SetHeader(TString::Format("Category %d",atoi(ds_name(3,1).Data())+1));
    leg->AddEntry(hBlind,"Data","P");
    if (!BLIND) {
      leg->AddEntry(gSigFit,"Fitted signal","L");
    }
	 TLine *gEmpty = new TLine(0.0,0.0,0.0,0.0);
	 gEmpty->SetLineWidth(0);
	 TLegendEntry *l1 = leg->AddEntry(gEmpty,"(m_{H} = "+MASS+" GeV)","");
	 l1->SetTextSize(0.038*0.97*0.85);
    leg->AddEntry(gFit,"Bkg. + signal","L");
    leg->AddEntry(gBkgFit,"Bkg.","L");
    leg->AddEntry(gQCDFit,"QCD","L");
    leg->AddEntry(hUnc2H,"2#sigma bkg. unc.","F");
    leg->AddEntry(hUncH,"1#sigma bkg. unc.","F");
    leg->SetFillColor(0);
    leg->SetBorderSize(0);
    leg->SetTextFont(42);
    leg->SetTextSize(0.038*0.98);
    leg->Draw(); 
	 leg->SetY1(leg->GetY2()-leg->GetNRows()*0.045*0.96);
     
    TPaveText *paveCMS = new TPaveText(gStyle->GetPadLeftMargin()+0.02,0.7,gStyle->GetPadLeftMargin()+0.15,1.-gStyle->GetPadTopMargin()-0.01,"NDC");
	 paveCMS->SetTextFont(62);
	 paveCMS->SetTextSize(gStyle->GetPadTopMargin()*3./4.);
	 paveCMS->SetBorderSize(0);
	 paveCMS->SetFillStyle(-1);
	 paveCMS->SetTextAlign(12);
	 paveCMS->AddText("CMS");
	 paveCMS->Draw();
	 gPad->Update();
	 paveCMS->SetY1NDC(paveCMS->GetY2NDC()-paveCMS->GetListOfLines()->GetSize()*gStyle->GetPadTopMargin());

	 TPaveText *paveLumi = new TPaveText(0.5,1.-gStyle->GetPadTopMargin(),0.98,1.00,"NDC");
	 paveLumi->SetTextFont(42);
	 paveLumi->SetTextSize(gStyle->GetPadTopMargin()*3./4.);
	 paveLumi->SetBorderSize(0);
	 paveLumi->SetFillStyle(-1);
	 paveLumi->SetTextAlign(32);
	 paveLumi->AddText(TString::Format("%.1f fb^{-1} (8TeV)",(atoi(ds_name(3,1).Data())<4 ? 19.8 : 18.3)).Data());//+ 18.2 ;
	 paveLumi->Draw();

	 TString path=".";
	 //TString path="BiasV10_limit_BRN5p4_dX0p1_B80-200_CAT0-6/output/";
	 system(TString::Format("[ ! -d %s/plot ] && mkdir %s/plot",path.Data(),path.Data()).Data());
	 system(TString::Format("[ ! -d %s/plot/fits ] && mkdir %s/plot/fits",path.Data(),path.Data()).Data());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s.pdf",path.Data(),MASS.Data(),ds_name.Data()).Data());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s.png",path.Data(),MASS.Data(),ds_name.Data()).Data());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s.eps",path.Data(),MASS.Data(),ds_name.Data()).Data());
	 TText *l = (TText*)paveCMS->AddText("Preliminary");
	 l->SetTextFont(52);
	 paveCMS->Draw();
	 gPad->Update();
	 paveCMS->SetY1NDC(paveCMS->GetY2NDC()-paveCMS->GetListOfLines()->GetSize()*gStyle->GetPadTopMargin());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s_prelim.pdf",path.Data(),MASS.Data(),ds_name.Data()).Data());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s_prelim.png",path.Data(),MASS.Data(),ds_name.Data()).Data());
	 canFit->SaveAs(TString::Format("%s/plot/fits/Fit_mH%s_%s_prelim.eps",path.Data(),MASS.Data(),ds_name.Data()).Data());

    delete ds;
  }

  cout << "chi2sumS: " << chi2sumS << endl;
  cout << "chi2sumB: " << chi2sumB << endl;
  cout << "nparS: " << nparS << endl;
  cout << "nparB: " << nparB << endl;
  cout << "nbinsum: " << nparsum << endl;
  cout << "chi2sumS/(nbinsum - nparS): " << chi2sumS / (float)(nparsum - nparS) << endl;
  cout << "chi2sumB/(nbinsum - nparB): " << chi2sumB / (float)(nparsum - nparB) << endl;
  delete datasets; 
}
예제 #7
0
파일: compHwEmu.C 프로젝트: Moanwar/cmssw
void create_plot(
  TH1D * hw,
  TH1D * emu,
  int runNo,
  const char * dataset,
  const char * xLabel,
  const char * exportPath,
  int rebin = 1,
  int energy = 13,
  long rangeLow = 0,
  long rangeHigh = 0
  ) {

  // define latex container to hold the title
  TLatex n;
  n.SetNDC();
  n.SetTextFont(52);
  n.SetTextSize(0.05);

  // create canvas that will hold each plot
  TCanvas* canv = new TCanvas("canv","canvas");

  // top pad (comparison)
  TPad* pad1 = new TPad("mainPad","mainPad",0,0.3,1,1);
  // bottom (resuduals) pad
  TPad* pad2 = new TPad("ratioPad","ratioPad",0,0.05,1,0.3);

  // pad to contain trendline for hw-emu ratio of 1
  TPad* overlayPad = new TPad("pInv","pInv", 0,0.05,1,0.3);
  overlayPad->SetFillStyle(0);

  // create legend that will describe appearance of data points
  TLegend * leg = new TLegend(0.65,0.85,0.91,1);
  leg->SetFillColor(0);
  leg->SetNColumns(2);
  leg->AddEntry(hw,"Hardware", "p");//"l");
  leg->AddEntry(emu,"Emulator", "l");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);

  // optionally reduce segmentation in x to improve visibility of some plots
  hw->Rebin(rebin);
  emu->Rebin(rebin);

  hw->SetMarkerStyle(21);
  hw->SetMarkerColor(1);
  hw->SetMarkerSize(0.5);
  emu->SetLineColor(kRed);
  hw->GetYaxis()->SetTitle("Number of candidates");
  hw->GetYaxis()->SetTitleSize(0.062);
  hw->GetYaxis()->SetTitleOffset(0.80);
  hw->GetYaxis()->SetLabelSize(0.045);
  hw->GetYaxis()->SetTickSize(0.01);

  hw->GetXaxis()->SetLabelSize(0);

  emu->GetXaxis()->SetLabelSize(0);

  pad1->SetBottomMargin(0.02);
  pad1->SetGridx();
  //pad1->SetLogy();

  pad1->Draw();
  pad1->cd();

  hw->SetStats(0);
  emu->SetStats(0);

  if (emu->GetMaximum() > hw->GetMaximum()) {
    hw->SetMaximum(1.1*emu->GetMaximum());
  }

  if (rangeLow != 0 || rangeHigh != 0) {
    emu->GetXaxis()->SetRangeUser(rangeLow, rangeHigh);
    hw->GetXaxis()->SetRangeUser(rangeLow, rangeHigh);
  }
  hw->DrawCopy("p");
  emu->Draw("same");

  if (rangeLow != 0 || rangeHigh != 0) {
    emu->GetXaxis()->SetRangeUser(rangeLow, rangeHigh);
    hw->GetXaxis()->SetRangeUser(rangeLow, rangeHigh);
  }

  leg->Draw();
  stringstream caption;
  caption << "#bf{CMS Preliminary}: " << dataset;
  /*
    caption << "#bf{CMS Preliminary, 2016 Data}:" << ", #sqrt{s} = " << energy
    << " TeV ";
  */
  n.DrawLatex(0.1, 0.915, caption.str().c_str());

  canv->cd();
  pad2->SetTopMargin(0);
  pad2->SetBottomMargin(0.39);
  pad2->Draw();
  pad2->cd();
  pad2->SetGridy();
  pad2->SetGridx();
  hw->Divide(emu);
  hw->GetYaxis()->SetTitle("HW/EM");
  hw->GetYaxis()->CenterTitle();

  stringstream labelText;
  labelText << "Level-1 Trigger " << xLabel;
  hw->GetYaxis()->CenterTitle();
  hw->GetXaxis()->SetTitle(labelText.str().c_str());

  hw->GetYaxis()->SetTitleSize(0.15);
  hw->GetYaxis()->SetTitleOffset(0.3);
  hw->GetYaxis()->SetLabelSize(0.12);

  hw->GetYaxis()->SetLabelOffset(0.006);
  hw->GetYaxis()->SetNdivisions(40407);

  hw->GetXaxis()->SetTitleSize(0.15);
  hw->GetXaxis()->SetTitleOffset(1.1);
  hw->GetXaxis()->SetLabelOffset(0.04);
  hw->GetXaxis()->SetLabelSize(0.12);

  hw->SetMinimum(0.76);
  hw->SetMaximum(1.24);
  hw->Draw("p");
  canv->cd();
  overlayPad->Draw();
  overlayPad->cd();

  if (rangeLow != 0 || rangeHigh != 0) {
    hw->GetXaxis()->SetRangeUser(rangeLow, rangeHigh);
  }
  
  TLine* unity = new TLine(0.1,0.695,0.9,0.695);
  unity->SetLineColor(kBlue);
  unity->Draw();

  stringstream pathStream;
  pathStream << "compHwEmu/" << exportPath;
  canv->SaveAs(pathStream.str().c_str());

  delete canv;
}
예제 #8
0
void CreateDataTemplates(double dX,int BRN_ORDER)
{
  gROOT->ForceStyle();
  RooMsgService::instance().setSilentMode(kTRUE);
  for(int i=0;i<2;i++) {
    RooMsgService::instance().setStreamStatus(i,kFALSE);
  }
  double XMIN = 80;
  double XMAX = 200;
  const int NSEL(2);
  const int NCAT[NSEL] = {4,3};
  const double MVA_BND[NSEL][NCAT[0]+1] = {{-0.6,0.0,0.7,0.84,1},{-0.1,0.4,0.8,1}};
  char name[1000];
  TString SELECTION[NSEL] = {"NOM","VBF"};
  TString SELTAG[NSEL]    = {"NOM","PRK"};
  TString MASS_VAR[NSEL]  = {"mbbReg[1]","mbbReg[2]"};

  TFile *fBKG  = TFile::Open("limit_BRN5+4_dX0p1_80-200_CAT0-6/output/bkg_shapes_workspace.root");
  RooWorkspace *wBkg = (RooWorkspace*)fBKG->Get("w");
  RooWorkspace *w = new RooWorkspace("w","workspace");
  //RooRealVar x(*(RooRealVar*)wBkg->var("mbbReg"));
  TTree *tr;
  TH1F *h,*hBlind;
  TCanvas *canFit[5]; 
  RooDataHist *roohist[5],*roohist_blind[5];

  TFile *fTransfer = TFile::Open("limit_BRN5+4_dX0p1_80-200_CAT0-6/output/transferFunctions.root");
  TF1 *transFunc;

  int counter(0);
  int NPAR = BRN_ORDER;

  for(int isel=0;isel<NSEL;isel++) {
    TFile *fDATA = TFile::Open("flat/Fit_data_sel"+SELECTION[isel]+".root");
    RooRealVar *brn[8];
    RooArgSet brn_params;
    if (isel == 1) {
      NPAR = 4;
    } 
    for(int ib=0;ib<=NPAR;ib++) {
      brn[ib] = new RooRealVar("b"+TString::Format("%d",ib)+"_sel"+SELECTION[isel],"b"+TString::Format("%d",ib)+"_sel"+SELECTION[isel],0.5,0,10.);
      brn_params.add(*brn[ib]);
    }
    for(int icat=0;icat<NCAT[isel];icat++) {
      RooRealVar x("mbbReg_"+TString::Format("CAT%d",counter),"mbbReg_"+TString::Format("CAT%d",counter),XMIN,XMAX);

      sprintf(name,"fitRatio_sel%s_CAT%d",SELTAG[isel].Data(),counter);
      transFunc = (TF1*)fTransfer->Get(name);
		transFunc->Print();
      // --- The error on the tranfer function parameters is shrinked because the correlations are ingored. 
      // --- Must be consistent with TransferFunctions.C
      float p0 = transFunc->GetParameter(0);
      float e0 = transFunc->GetParError(0);
      float p1 = transFunc->GetParameter(1);
      float e1 = transFunc->GetParError(1);
      float p2 = transFunc->GetParameter(2);
      float e2 = transFunc->GetParError(2);
      RooRealVar trans_p2(TString::Format("trans_p2_CAT%d",counter),TString::Format("trans_p2_CAT%d",counter),p2);
      RooRealVar trans_p1(TString::Format("trans_p1_CAT%d",counter),TString::Format("trans_p1_CAT%d",counter),p1);
      RooRealVar trans_p0(TString::Format("trans_p0_CAT%d",counter),TString::Format("trans_p0_CAT%d",counter),p0);
		printf("%.2f %.2f %.2f\n",p0,p1,p2);
      RooGenericPdf *transfer;
      if (isel == 0) {
        trans_p2.setError(0.5*e2);
        trans_p1.setError(0.5*e1);
        trans_p0.setError(0.5*e0);
        transfer = new RooGenericPdf(TString::Format("transfer_CAT%d",counter),"@2*@0+@1",RooArgList(x,trans_p0,trans_p1)); 
      }
      else {
        trans_p2.setError(0.05*e2);
        trans_p1.setError(0.05*e1);
        trans_p0.setError(0.05*e0);
        transfer = new RooGenericPdf(TString::Format("transfer_CAT%d",counter),"@3*@0*@0+@2*@0+@1",RooArgList(x,trans_p0,trans_p1,trans_p2));
      }
      trans_p2.setConstant(kTRUE);
      trans_p1.setConstant(kTRUE);
      trans_p0.setConstant(kTRUE);

		transfer->Print();
            
      sprintf(name,"FitData_sel%s_CAT%d",SELECTION[isel].Data(),icat);
      canFit[icat] = new TCanvas(name,name,900,600);
      canFit[icat]->cd(1)->SetBottomMargin(0.4);
      sprintf(name,"Hbb/events");
      tr = (TTree*)fDATA->Get(name); 
      sprintf(name,"hMbb_%s_CAT%d",SELECTION[isel].Data(),icat);
      int NBINS = (XMAX[isel][icat]-XMIN[isel][icat])/dX;
      
      h = new TH1F(name,name,NBINS,XMIN[isel][icat],XMAX[isel][icat]);

      sprintf(name,"hMbb_blind_%s_CAT%d",SELECTION[isel].Data(),icat);
      hBlind = new TH1F(name,name,NBINS,XMIN[isel][icat],XMAX[isel][icat]);

      sprintf(name,"mva%s>%1.2f && mva%s<=%1.2f",SELECTION[isel].Data(),MVA_BND[isel][icat],SELECTION[isel].Data(),MVA_BND[isel][icat+1]);
      TCut cut(name);
      sprintf(name,"mva%s>%1.2f && mva%s<=%1.2f && %s>100 && %s<150",SELECTION[isel].Data(),MVA_BND[isel][icat],SELECTION[isel].Data(),MVA_BND[isel][icat+1],MASS_VAR[isel].Data(),MASS_VAR[isel].Data());
      TCut cutBlind(name);
      tr->Draw(MASS_VAR[isel]+">>"+h->GetName(),cut); 
      tr->Draw(MASS_VAR[isel]+">>"+hBlind->GetName(),cutBlind); 
      sprintf(name,"yield_data_CAT%d",counter);
      RooRealVar *Yield = new RooRealVar(name,name,h->Integral());
      
      sprintf(name,"data_hist_CAT%d",counter);
      roohist[icat] = new RooDataHist(name,name,x,h);

      sprintf(name,"data_hist_blind_CAT%d",counter);
      roohist_blind[icat] = new RooDataHist(name,name,x,hBlind);
        
      RooAbsPdf *qcd_pdf;
      if (icat == 0) {
        for(int ib=0;ib<=NPAR;ib++) {
          brn[ib]->setConstant(kFALSE);
        }
        sprintf(name,"qcd_model_CAT%d",counter);
        RooBernstein *qcd_pdf_aux = new RooBernstein(name,name,x,brn_params);
        qcd_pdf = dynamic_cast<RooAbsPdf*> (qcd_pdf_aux);
      }
      else {
        for(int ib=0;ib<=NPAR;ib++) {
          brn[ib]->setConstant(kTRUE);
        }
        sprintf(name,"qcd_model_aux1_CAT%d",counter);
        RooBernstein *qcd_pdf_aux1 = new RooBernstein(name,name,x,brn_params);
        sprintf(name,"qcd_model_CAT%d",counter);
        RooProdPdf *qcd_pdf_aux2 = new RooProdPdf(name,name,RooArgSet(*transfer,*qcd_pdf_aux1));
        qcd_pdf = dynamic_cast<RooAbsPdf*> (qcd_pdf_aux2);
      } 

      sprintf(name,"Z_model_CAT%d",counter);
      RooAbsPdf *z_pdf = (RooAbsPdf*)wBkg->pdf(name);
      sprintf(name,"Top_model_CAT%d",counter);
      RooAbsPdf *top_pdf = (RooAbsPdf*)wBkg->pdf(name);

      sprintf(name,"yield_ZJets_CAT%d",counter);
      RooRealVar *nZ = (RooRealVar*)wBkg->var(name);
      sprintf(name,"yield_Top_CAT%d",counter);
      RooRealVar *nT = (RooRealVar*)wBkg->var(name);
      sprintf(name,"yield_QCD_CAT%d",counter);
      RooRealVar nQCD(name,name,1000,0,1e+10);
      nZ->setConstant(kTRUE);
      nT->setConstant(kTRUE);
    
      sprintf(name,"bkg_model_CAT%d",counter);
      RooAddPdf model(name,name,RooArgList(*z_pdf,*top_pdf,*qcd_pdf),RooArgList(*nZ,*nT,nQCD));
      
      RooFitResult *res = model.fitTo(*roohist[icat],RooFit::Save());
      res->Print();
      
      RooPlot* frame = x.frame();
      RooPlot* frame1 = x.frame();
      roohist[icat]->plotOn(frame);
      model.plotOn(frame,LineWidth(2));
      cout<<"chi2/ndof = "<<frame->chiSquare()<<endl;
      RooHist *hresid = frame->residHist(); 
      //model.plotOn(frame,RooFit::VisualizeError(*res,1,kFALSE),FillColor(kGray)MoveToBack());
      model.plotOn(frame,Components(*qcd_pdf),LineWidth(2),LineColor(kBlack),LineStyle(kDashed));
      model.plotOn(frame,Components(*z_pdf),LineWidth(2),LineColor(kBlue));
      model.plotOn(frame,Components(*top_pdf),LineWidth(2),LineColor(kGreen+1));
      frame->Draw(); 
      gPad->Update();
      TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
      pad->SetTopMargin(0.6);
      pad->SetFillColor(0);
      pad->SetFillStyle(0);
      pad->Draw();
      pad->cd(0);
      frame1->addPlotable(hresid,"p");
      frame1->Draw();

      for(int ib=0;ib<=NPAR;ib++) {
        brn[ib]->setConstant(kFALSE);
      }
      
      if (icat > 0) {
        trans_p2.setConstant(kFALSE);
        trans_p1.setConstant(kFALSE);
        trans_p0.setConstant(kFALSE);
      }
      if (isel == 0) {
        w->import(trans_p1);
        w->import(trans_p0);
      }
      else {
        w->import(trans_p2);
        w->import(trans_p1);
        w->import(trans_p0);
      }
      w->import(*roohist[icat]);
      w->import(*roohist_blind[icat]);
      w->import(model);
      w->import(*Yield);
      counter++; 
    }// category loop
  }// selection loop
  w->Print();
  w->writeToFile("data_shapes_workspace_"+TString::Format("BRN%d",BRN_ORDER)+".root");
}
예제 #9
0
void DrawBoosted(TString VAR, float XMIN, float XMAX, int REBIN, TString XTITLE)
{
  gROOT->ForceStyle();
  const int N = 7;
  float XSEC[N] = {1.74e+6,3.67e+5,2.94e+4,6.524e+03,1.064e+03,121.5,2.542e+01};

  TString SAMPLE[N] = {
    "QCD_HT200to300",
    "QCD_HT300to500",
    "QCD_HT500to700", 
    "QCD_HT700to1000",
    "QCD_HT1000to1500",
    "QCD_HT1500to2000",
    "QCD_HT2000toInf" 
  };
 
  TFile *inf[N];
  TH1F  *h0[N],*h1[N];
  TH1F  *hQCD0,*hQCD1; 

  TCanvas *can = new TCanvas("Boosted","Boosted",900,600);
  can->cd(1);
  can->SetBottomMargin(0.3);
  //can->SetRightMargin(0.15);
  for(int k=0;k<N;k++) {
    inf[k] = TFile::Open("Histo_"+SAMPLE[k]+".root");
    h0[k]  = (TH1F*)inf[k]->Get("hadtopBoost/h_"+VAR+"_Cut_ctl");
    h0[k]->Sumw2();
    h0[k]->Rebin(REBIN);
    h1[k]  = (TH1F*)inf[k]->Get("hadtopBoost/h_"+VAR+"_Cut_sig");
    h1[k]->Sumw2();
    h1[k]->Rebin(REBIN);
    h0[k]->Scale(XSEC[k]/((TH1F*)inf[k]->Get("hadtopBoost/TriggerPass"))->GetBinContent(1));
    h1[k]->Scale(XSEC[k]/((TH1F*)inf[k]->Get("hadtopBoost/TriggerPass"))->GetBinContent(1)); 
    cout<<SAMPLE[k]<<": "<<h0[k]->GetEntries()<<" "<<h0[k]->Integral()<<endl;
    if (k == 0) {
      hQCD0 = (TH1F*)h0[k]->Clone();
      hQCD1 = (TH1F*)h1[k]->Clone();
    }
    if (k > 0) {
      hQCD0->Add(h0[k]);
      hQCD1->Add(h1[k]);
    }
  } 
  hQCD0->Scale(1/hQCD0->Integral());
  hQCD1->Scale(1/hQCD1->Integral());
  double max1 = TMath::Max(hQCD0->GetBinContent(hQCD0->GetMaximumBin()),hQCD1->GetBinContent(hQCD1->GetMaximumBin()));
  hQCD0->SetMaximum(1.2*max1);
  hQCD0->SetMinimum(1e-4);
  hQCD0->GetXaxis()->SetLabelSize(0.0);
  hQCD0->GetXaxis()->SetRangeUser(XMIN,XMAX); 
  hQCD0->Draw("HIST");
  hQCD1->Draw("sameE");

  TLegend *leg = new TLegend(0.6,0.7,0.9,0.9);
  leg->SetHeader("QCD Closure");
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.05);
  leg->AddEntry(hQCD1,"Signal sample","P");
  leg->AddEntry(hQCD0,"Control sample","F");
  leg->Draw();

  TH1F *hRatio = (TH1F*)hQCD1->Clone("Ratio");
  hRatio->Divide(hQCD0);

  hRatio->SetLineColor(kBlack);
  hRatio->SetMarkerColor(kBlack);

  TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
  pad->SetTopMargin(0.7);
  //pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  gPad->SetGridy();
  hRatio->GetXaxis()->SetTitle(XTITLE);
  hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX); 
  hRatio->GetYaxis()->SetNdivisions(505);
  hRatio->GetYaxis()->SetRangeUser(0,2);
  hRatio->GetYaxis()->SetLabelSize(0.04);
  hRatio->Draw();
  hRatio->Draw("same");
}
예제 #10
0
void wmj_fit_stack()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Tue May  3 07:35:30 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,700,500);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(-0.1730123,-5358.989,1.06279,32919.5);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.14);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3005[20] = {
   0.025,
   0.075,
   0.125,
   0.175,
   0.225,
   0.275,
   0.325,
   0.375,
   0.425,
   0.475,
   0.525,
   0.575,
   0.625,
   0.675,
   0.725,
   0.775,
   0.825,
   0.875,
   0.925,
   0.975};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3005[20] = {
   0,
   0,
   9,
   26,
   118,
   315,
   881,
   1812,
   3086,
   4575,
   5856,
   6537,
   6824,
   6348,
   5662,
   4769,
   4941,
   6726,
   13179,
   28019};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3005[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3005[20] = {
   0,
   0,
   2.943461,
   5.066015,
   10.37428,
   17.25528,
   29.18586,
   42.07053,
   55.05403,
   67.14059,
   76.02614,
   80.35326,
   82.10902,
   79.17591,
   74.74792,
   68.55976,
   69.79403,
   81.51372,
   114.3009,
   166.8895};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3005[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3005[20] = {
   1.147874,
   1.147874,
   4.110204,
   6.164324,
   11.37428,
   18.25528,
   30.18586,
   43.07053,
   56.05403,
   68.14059,
   77.02614,
   81.35326,
   83.10902,
   80.17591,
   75.74792,
   69.55976,
   70.79403,
   82.51372,
   115.3009,
   167.8895};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(20,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3005);
   grae->SetName("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]");
   grae->SetTitle("Histogram of combData_plot__muminus_ISO_");
   grae->SetFillColor(1);
   grae->SetFillStyle(0);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005 = new TH1F("Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMinimum(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetDirectory(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetStats(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetLineWidth(2);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005);
   
   grae->Draw("e1pa");
   
   Double_t h5_fx7[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t h5_fy7[47] = {
   0,
   0,
   0,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   3.789762,
   3.789762,
   71.12063,
   71.12063,
   211.4394,
   211.4394,
   857.7007,
   857.7007,
   1798.534,
   1798.534,
   3099.609,
   3099.609,
   4425.901,
   4425.901,
   5601.584,
   5601.584,
   6533.687,
   6533.687,
   6910.208,
   6910.208,
   6392.171,
   6392.171,
   5777.193,
   5777.193,
   5020.919,
   5020.919,
   5207.834,
   5207.834,
   6798.159,
   6798.159,
   13033.98,
   13033.98,
   27939.27,
   27939.27,
   0,
   0,
   0,
   0};
   TGraph *graph = new TGraph(47,h5_fx7,h5_fy7);
   graph->SetName("h5");
   graph->SetTitle("Projection of ");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#3333ff");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#3333ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#3333ff");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_h57 = new TH1F("Graph_h57","Projection of ",100,-0.1292683,1.129268);
   Graph_h57->SetMinimum(0);
   Graph_h57->SetMaximum(30733.2);
   Graph_h57->SetDirectory(0);
   Graph_h57->SetStats(0);
   Graph_h57->SetLineWidth(2);
   Graph_h57->SetMarkerStyle(0);
   Graph_h57->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_h57->GetXaxis()->SetRange(11,90);
   Graph_h57->GetXaxis()->SetNdivisions(1005);
   Graph_h57->GetXaxis()->SetLabelFont(132);
   Graph_h57->GetXaxis()->SetLabelOffset(0.02);
   Graph_h57->GetXaxis()->SetLabelSize(0.05);
   Graph_h57->GetXaxis()->SetTitleSize(0.06);
   Graph_h57->GetXaxis()->SetTitleFont(132);
   Graph_h57->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_h57->GetYaxis()->SetLabelFont(132);
   Graph_h57->GetYaxis()->SetLabelSize(0.05);
   Graph_h57->GetYaxis()->SetTitleSize(0.06);
   Graph_h57->GetYaxis()->SetTitleFont(132);
   Graph_h57->GetZaxis()->SetLabelFont(132);
   Graph_h57->GetZaxis()->SetLabelSize(0.05);
   Graph_h57->GetZaxis()->SetTitleSize(0.06);
   Graph_h57->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_h57);
   
   graph->Draw("f");
   
   Double_t sumBkgPdf_totbkg_fitW_fx8[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t sumBkgPdf_totbkg_fitW_fy8[47] = {
   0,
   0,
   0,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   3.789757,
   3.789757,
   71.12063,
   71.12063,
   211.4394,
   211.4394,
   855.0132,
   855.0132,
   1794.513,
   1794.513,
   3088.88,
   3088.88,
   4399.772,
   4399.772,
   5568.272,
   5568.272,
   6460.972,
   6460.972,
   6790.725,
   6790.725,
   6142.168,
   6142.168,
   5333.208,
   5333.208,
   4062.953,
   4062.953,
   3103.771,
   3103.771,
   2394.858,
   2394.858,
   1734.507,
   1734.507,
   1650.883,
   1650.883,
   0,
   0,
   0,
   0};
   graph = new TGraph(47,sumBkgPdf_totbkg_fitW_fx8,sumBkgPdf_totbkg_fitW_fy8);
   graph->SetName("sumBkgPdf_totbkg_fitW");
   graph->SetTitle("Projection of ");

   ci = TColor::GetColor("#ffff66");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#ffff66");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#ffff66");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618 = new TH1F("Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618","Projection of ",100,-0.1292683,1.129268);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMinimum(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMaximum(7469.797);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetDirectory(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetStats(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetLineWidth(2);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetRange(11,90);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618);
   
   graph->Draw("f");
   
   Double_t sumPdf_Norm[muminus_ISO_]_fx9[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t sumPdf_Norm[muminus_ISO_]_fy9[47] = {
   0,
   0,
   0,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   3.789756,
   3.789756,
   71.12054,
   71.12054,
   211.4391,
   211.4391,
   857.6998,
   857.6998,
   1798.532,
   1798.532,
   3099.606,
   3099.606,
   4425.897,
   4425.897,
   5601.578,
   5601.578,
   6533.68,
   6533.68,
   6910.201,
   6910.201,
   6392.164,
   6392.164,
   5777.187,
   5777.187,
   5020.914,
   5020.914,
   5207.829,
   5207.829,
   6798.152,
   6798.152,
   13033.97,
   13033.97,
   27939.24,
   27939.24,
   0,
   0,
   0,
   0};
   graph = new TGraph(47,sumPdf_Norm[muminus_ISO_]_fx9,sumPdf_Norm[muminus_ISO_]_fy9);
   graph->SetName("sumPdf_Norm[muminus_ISO_]");
   graph->SetTitle("Projection of ");

   ci = TColor::GetColor("#ff0000");
   graph->SetFillColor(ci);
   graph->SetFillStyle(0);

   ci = TColor::GetColor("#ff0000");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#ff0000");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839 = new TH1F("Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839","Projection of ",100,-0.1292683,1.129268);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMinimum(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMaximum(30733.17);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetDirectory(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetStats(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetLineWidth(2);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetRange(11,90);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839);
   
   graph->Draw("");
   
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3006[20] = {
   0.025,
   0.075,
   0.125,
   0.175,
   0.225,
   0.275,
   0.325,
   0.375,
   0.425,
   0.475,
   0.525,
   0.575,
   0.625,
   0.675,
   0.725,
   0.775,
   0.825,
   0.875,
   0.925,
   0.975};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3006[20] = {
   0,
   0,
   9,
   26,
   118,
   315,
   881,
   1812,
   3086,
   4575,
   5856,
   6537,
   6824,
   6348,
   5662,
   4769,
   4941,
   6726,
   13179,
   28019};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3006[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3006[20] = {
   0,
   0,
   2.943461,
   5.066015,
   10.37428,
   17.25528,
   29.18586,
   42.07053,
   55.05403,
   67.14059,
   76.02614,
   80.35326,
   82.10902,
   79.17591,
   74.74792,
   68.55976,
   69.79403,
   81.51372,
   114.3009,
   166.8895};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3006[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3006[20] = {
   1.147874,
   1.147874,
   4.110204,
   6.164324,
   11.37428,
   18.25528,
   30.18586,
   43.07053,
   56.05403,
   68.14059,
   77.02614,
   81.35326,
   83.10902,
   80.17591,
   75.74792,
   69.55976,
   70.79403,
   82.51372,
   115.3009,
   167.8895};
   grae = new TGraphAsymmErrors(20,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3006);
   grae->SetName("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]");
   grae->SetTitle("Histogram of combData_plot__muminus_ISO_");
   grae->SetFillColor(1);
   grae->SetFillStyle(0);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006 = new TH1F("Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMinimum(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetDirectory(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetStats(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetLineWidth(2);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006);
   
   grae->Draw("e1p");
   
   TLegend *leg = new TLegend(0.2,0.53,0.6,0.78,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]","Data, #sqrt{s}=8 TeV","lep");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("h5","Electroweak","f");

   ci = TColor::GetColor("#3333ff");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#3333ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sumBkgPdf_totbkg_fitW","QCD","f");

   ci = TColor::GetColor("#ffff66");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#ffff66");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sumPdf_Norm[muminus_ISO_]","Fit","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.2,0.8,0.4,0.87,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetLineWidth(2);
   pt->SetTextFont(132);
   TText *AText = pt->AddText("LHCb");
   pt->Draw();
   
   TH1F *Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy = new TH1F("Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMinimum(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetDirectory(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetStats(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetLineWidth(2);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}
예제 #11
0
void ATLASCMSCOMPARISON(TString quantity="ttbarMass"){

  bool cmssim=true;

  // ---
  //    canvas style 
  // ---
  TStyle myStyle("HHStyle","HHStyle");
  setHHStyle(myStyle);
  myStyle.SetErrorX(0.5);
  myStyle.cd();
  gROOT->SetStyle("HHStyle");
  gStyle->SetEndErrorSize(10);
  gStyle->SetOptFit(0);

  // ---
  //    top Pt 7 TeV
  // ---
  int Nbins7=7;
  if(     quantity=="topPt"    ) Nbins7=7;
  else if(quantity=="ttbarMass") Nbins7=5;
  else if(quantity=="ttbarY"   ) Nbins7=6;

  // CMS data
  TGraphAsymmErrors* CMSdata7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    CMSdata7->SetPoint( 0, 25.0 , 0.004032 ); 
    CMSdata7->SetPoint( 1, 75.0 , 0.006746 ); 
    CMSdata7->SetPoint( 2, 125.0, 0.004737 ); 
    CMSdata7->SetPoint( 3, 175.0, 0.002506 ); 
    CMSdata7->SetPoint( 4, 225.0, 0.001140 ); 
    CMSdata7->SetPoint( 5, 300.0, 0.000334 ); 
    CMSdata7->SetPoint( 6, 575.0, 0.000019 ); 
    
    CMSdata7->SetPointError( 0, 25., 25., ( 5.5/100)*0.004032, ( 5.5/100)*0.004032 );
    CMSdata7->SetPointError( 1, 25., 25., ( 4.1/100)*0.006746, ( 4.1/100)*0.006746 );
    CMSdata7->SetPointError( 2, 25., 25., ( 4.0/100)*0.004737, ( 4.0/100)*0.004737 );
    CMSdata7->SetPointError( 3, 25., 25., ( 5.4/100)*0.002506, ( 5.4/100)*0.002506 );
    CMSdata7->SetPointError( 4, 25., 25., ( 5.6/100)*0.001140, ( 5.6/100)*0.001140 );
    CMSdata7->SetPointError( 5, 50., 50., ( 8.4/100)*0.000334, ( 8.4/100)*0.000334 );
    CMSdata7->SetPointError( 6, 225.,225., (14.1/100)*0.000019, (14.1/100)*0.000019 );
  }
  else if(quantity=="ttbarMass"){
    CMSdata7->SetPoint( 0, 350.0 , 0.002588 ); 
    CMSdata7->SetPoint( 1, 500.0 , 0.002685 ); 
    CMSdata7->SetPoint( 2, 625.0 , 0.000953 ); 
    CMSdata7->SetPoint( 3, 825.0 , 0.000232 ); 
    CMSdata7->SetPoint( 4, 1725.0, 0.000008 ); 
    
    CMSdata7->SetPointError( 0, 100., 100., ( 4.9 /100)*0.002588, (4.9 /100)*0.002588 );
    CMSdata7->SetPointError( 1, 50. , 50. , ( 6.9 /100)*0.002685, (6.9 /100)*0.002685 );
    CMSdata7->SetPointError( 2, 75. , 75. , ( 7.7 /100)*0.000953, (7.7 /100)*0.000953 );
    CMSdata7->SetPointError( 3, 125., 125., ( 14.4/100)*0.000232, (14.4/100)*0.000232 );
    CMSdata7->SetPointError( 4, 775., 775., ( 27.6/100)*0.000008, (27.6/100)*0.000008 );
  }
  else if(quantity=="ttbarY"){
    CMSdata7->SetPoint( 0, -1.75, 0.082140 ); 
    CMSdata7->SetPoint( 1, -0.75, 0.318979 ); 
    CMSdata7->SetPoint( 2, -0.25, 0.427823 ); 
    CMSdata7->SetPoint( 3,  0.25, 0.44591  ); 
    CMSdata7->SetPoint( 4,  0.75, 0.318820 ); 
    CMSdata7->SetPoint( 5,  1.75, 0.080457 );

    CMSdata7->SetPointError( 0, 0.75, 0.75, (8.1/100)*0.082140, (8.1/100)*0.082140 );
    CMSdata7->SetPointError( 1, 0.25, 0.25, (3.3/100)*0.318979, (3.3/100)*0.318979 );
    CMSdata7->SetPointError( 2, 0.25, 0.25, (3.0/100)*0.427823, (3.0/100)*0.427823 );
    CMSdata7->SetPointError( 3, 0.25, 0.25, (3.5/100)*0.44591 , (3.5/100)*0.44591  );
    CMSdata7->SetPointError( 4, 0.25, 0.25, (3.5/100)*0.318820, (3.5/100)*0.318820 );
    CMSdata7->SetPointError( 5, 0.75, 0.75, (5.9/100)*0.080457, (5.9/100)*0.080457 );
  }

  CMSdata7->SetLineWidth(3.);
  CMSdata7->SetMarkerSize(1.2);
  CMSdata7->SetMarkerStyle(24);
  CMSdata7->SetLineStyle(1);
  CMSdata7->SetMarkerColor(kBlue);
  CMSdata7->SetLineColor(kBlue);
  CMSdata7->SetFillStyle(3004);
  CMSdata7->SetFillColor(kBlue);

  // CMS MadGraph+Pythia(Z2*)
  TGraphAsymmErrors* CMSMadGraph7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    CMSMadGraph7->SetPoint( 0, 25.0 , 0.003331 ); 
    CMSMadGraph7->SetPoint( 1, 75.0 , 0.006495 ); 
    CMSMadGraph7->SetPoint( 2, 125.0, 0.005077 ); 
    CMSMadGraph7->SetPoint( 3, 175.0, 0.002748 ); 
    CMSMadGraph7->SetPoint( 4, 225.0, 0.001282 ); 
    CMSMadGraph7->SetPoint( 5, 300.0, 0.000413 ); 
    CMSMadGraph7->SetPoint( 6, 575.0, 0.000027 ); 

    CMSMadGraph7->SetPointError( 0, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 1, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 2, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 3, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 4, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 5, 50., 50., 0., 0. );
    CMSMadGraph7->SetPointError( 6, 225., 225., 0., 0. );
  }
  else if(quantity=="ttbarMass"){
    CMSMadGraph7->SetPoint( 0, 350.0 , 0.002541 ); 
    CMSMadGraph7->SetPoint( 1, 500.0 , 0.002759 ); 
    CMSMadGraph7->SetPoint( 2, 625.0 , 0.000988 ); 
    CMSMadGraph7->SetPoint( 3, 825.0 , 0.000222 ); 
    CMSMadGraph7->SetPoint( 4, 1725.0, 0.000008 ); 
    
    CMSMadGraph7->SetPointError( 0, 100., 100., 0., 0. );
    CMSMadGraph7->SetPointError( 1, 50. , 50. , 0., 0. );
    CMSMadGraph7->SetPointError( 2, 75. , 75. , 0., 0. );
    CMSMadGraph7->SetPointError( 3, 125., 125., 0., 0. );
    CMSMadGraph7->SetPointError( 4, 775., 775., 0., 0. );
  }
  else if(quantity=="ttbarY"){
    CMSMadGraph7->SetPoint( 0, -1.75, 0.088374 ); 
    CMSMadGraph7->SetPoint( 1, -0.75, 0.319964 ); 
    CMSMadGraph7->SetPoint( 2, -0.25, 0.414022 ); 
    CMSMadGraph7->SetPoint( 3,  0.25, 0.415108 ); 
    CMSMadGraph7->SetPoint( 4,  0.75, 0.320370 ); 
    CMSMadGraph7->SetPoint( 5,  1.75, 0.088218 );

    CMSMadGraph7->SetPointError( 0, 0.75, 0.75, 0., 0. );
    CMSMadGraph7->SetPointError( 1, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 2, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 3, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 4, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 5, 0.75, 0.75, 0., 0. ); 
  }

  CMSMadGraph7->SetLineWidth(3.);
  CMSMadGraph7->SetMarkerSize(1.2);
  CMSMadGraph7->SetLineStyle(1);
  CMSMadGraph7->SetMarkerStyle(20);
  CMSMadGraph7->SetMarkerColor(kAzure+6);
  CMSMadGraph7->SetLineColor(kAzure+6);


  // ATLAS data
  TGraphAsymmErrors* ATLASdata7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    ATLASdata7->SetPoint( 0, 25.0 , 0.0034  ); 
    ATLASdata7->SetPoint( 1, 75.0 , 0.0067  ); 
    ATLASdata7->SetPoint( 2, 125.0, 0.0052  ); 
    ATLASdata7->SetPoint( 3, 175.0, 0.00266 ); 
    ATLASdata7->SetPoint( 4, 225.0, 0.00114 ); 
    ATLASdata7->SetPoint( 5, 300.0, 0.00033 ); 
    ATLASdata7->SetPoint( 6, 575.0, 0.000018); 

    ATLASdata7->SetPointError( 0, 25., 25., (4.47 /100)*0.0034  , (4.47 /100)*0.0034   );
    ATLASdata7->SetPointError( 1, 25., 25., (1.41 /100)*0.0067  , (1.41 /100)*0.0067   );
    ATLASdata7->SetPointError( 2, 25., 25., (2.83 /100)*0.0052  , (2.83 /100)*0.0052   );
    ATLASdata7->SetPointError( 3, 25., 25., (3.61 /100)*0.00266 , (3.61 /100)*0.00266  );
    ATLASdata7->SetPointError( 4, 25., 25., (3.61 /100)*0.00114 , (3.61 /100)*0.00114  );
    ATLASdata7->SetPointError( 5, 50., 50., (5.83 /100)*0.00033 , (5.83 /100)*0.00033  );
    ATLASdata7->SetPointError( 6, 225., 225., (11.66/100)*0.000018, (11.66/100)*0.000018 );
  }
  else if(quantity=="ttbarMass"){
    ATLASdata7->SetPoint( 0, 350.0 , 0.00250   ); 
    ATLASdata7->SetPoint( 1, 500.0 , 0.00273   ); 
    ATLASdata7->SetPoint( 2, 625.0 , 0.00102   ); 
    ATLASdata7->SetPoint( 3, 825.0 , 0.00023   ); 
    ATLASdata7->SetPoint( 4, 1725.0, 0.0000076 ); 
    
    ATLASdata7->SetPointError( 0, 100., 100., 0.00008   , 0.00008  );
    ATLASdata7->SetPointError( 1, 50. , 50. , 0.00007   , 0.00007  );
    ATLASdata7->SetPointError( 2, 75. , 75. , 0.00004   , 0.00004  );
    ATLASdata7->SetPointError( 3, 125., 125., 0.00001   , 0.00001  );
    ATLASdata7->SetPointError( 4, 775., 775., 0.0000005, 0.0000005 );
  }
  else if(quantity=="ttbarY"){
    ATLASdata7->SetPoint( 0, -1.75, 0.081 ); 
    ATLASdata7->SetPoint( 1, -0.75, 0.321 ); 
    ATLASdata7->SetPoint( 2, -0.25, 0.436 ); 
    ATLASdata7->SetPoint( 3,  0.25, 0.423 ); 
    ATLASdata7->SetPoint( 4,  0.75, 0.321 ); 
    ATLASdata7->SetPoint( 5,  1.75, 0.087 );

    ATLASdata7->SetPointError( 0, 0.75, 0.75, 0.003, 0.003);
    ATLASdata7->SetPointError( 1, 0.25, 0.25, 0.009, 0.009);
    ATLASdata7->SetPointError( 2, 0.25, 0.25, 0.009, 0.009);
    ATLASdata7->SetPointError( 3, 0.25, 0.25, 0.007, 0.007);
    ATLASdata7->SetPointError( 4, 0.25, 0.25, 0.005, 0.005);
    ATLASdata7->SetPointError( 5, 0.75, 0.75, 0.005, 0.005);
  }
  ATLASdata7->SetLineWidth(3.);
  ATLASdata7->SetMarkerSize(1.2);
  ATLASdata7->SetMarkerStyle(22);
  ATLASdata7->SetLineStyle(2);
  ATLASdata7->SetMarkerColor(kRed);
  ATLASdata7->SetLineColor(kRed);
  ATLASdata7->SetFillStyle(3005);
  ATLASdata7->SetFillColor(kRed);

  // ---
  //    dummy plots for axis
  // ---
  // create variable bin edges
  std::map<TString, std::vector<double> > binning_ = makeVariableBinning(false);
  std::vector<double> newTopBins_;
  if(quantity=="topPt"){
    newTopBins_.push_back(0.);
    newTopBins_.push_back(50.);
    newTopBins_.push_back(100.);
    newTopBins_.push_back(150.);
    newTopBins_.push_back(200.);
    newTopBins_.push_back(250.);
    newTopBins_.push_back(350.);
    newTopBins_.push_back(800.);
  }

  else if(quantity=="ttbarMass"){
    newTopBins_.push_back(250.);
    newTopBins_.push_back(450.);
    newTopBins_.push_back(550.);
    newTopBins_.push_back(700.);
    newTopBins_.push_back(950.);
    newTopBins_.push_back(2500.);
  }
  else if(quantity=="ttbarY"   ){
    newTopBins_.push_back(-2.5);
    newTopBins_.push_back(-1.0);
    newTopBins_.push_back(-0.5);
    newTopBins_.push_back(0.  );
    newTopBins_.push_back(0.5 );
    newTopBins_.push_back(1.0 );
    newTopBins_.push_back(2.5 );
  }

  binning_[quantity]=newTopBins_;
  double start=0.;
  double range=800.;
  int Nfinebins=800;
  if(quantity=="topPt"){ Nfinebins=800; start=0.; range=800.;}
  else if(quantity=="ttbarMass"){ Nfinebins=2250; start=250.; range=2500.; }
  else if(quantity=="ttbarY"   ){ Nfinebins=500 ; start=-2.5; range=2.5;}
  TH1F* dummy= new TH1F("","",Nfinebins,start,range);
  reBinTH1F(*dummy, binning_[quantity], 0);
  histogramStyle(*dummy, kSig);
  TString label="p_{T}^{t} [GeV]";
  TString label2="p_{T}^{t}";
  if(quantity=="topPt"){label="p_{T}^{t} [GeV]"; label2="p_{T}^{t}";}
  else if(quantity=="ttbarMass"){ label="m^{t#bar{t}} [GeV]"; label2="m^{t#bar{t}}"; }
  else if(quantity=="ttbarY"   ){ label="y^{t#bar{t}}"; label2=label; }
  dummy->GetXaxis()->SetTitle(label);
  dummy->GetYaxis()->SetTitle(TString("#frac{1}{#sigma} #frac{d#sigma}{")+label2+"}");
  double max=0.01;
  double min=0.;
  if(quantity=="topPt"    ){max=0.01 ; min=0.;}
  if(quantity=="ttbarMass"){max=0.004; min=0.;}
  if(quantity=="ttbarY"   ){max=1.0  ; min=0.;}
  dummy->SetMaximum(max);
  dummy->SetMinimum(min);
  TH1F* A=convertToHist(ATLASdata7, dummy, Nbins7);
  TH1F* C=convertToHist(CMSdata7  , dummy, Nbins7);
  histogramStyle(*A, kSig, true, 1.2, kRed);
  A->SetLineWidth(3.);
  A->SetMarkerSize(1.2);
  A->SetMarkerStyle(22);
  A->SetLineStyle(1);
  A->SetMarkerColor(kRed);
  A->SetLineColor(kRed);
  A->SetFillStyle(3005);
  histogramStyle(*C, kSig, true, 1.2, kBlue);
  C->SetLineWidth(3.);
  C->SetMarkerSize(1.2);
  C->SetMarkerStyle(24);
  C->SetLineStyle(1);
  C->SetMarkerColor(kBlue);
  C->SetLineColor(kBlue);
  C->SetFillStyle(3004);
  TH1F* M=convertToHist(CMSMadGraph7  , dummy, Nbins7);
  histogramStyle(*M, kSig, false, 1.2, kAzure+6);
  M->SetLineWidth(3.);
  M->SetMarkerSize(1.2);
  M->SetMarkerStyle(22);
  M->SetLineStyle(1);
  M->SetMarkerColor(kAzure+6);
  M->SetLineColor(kAzure+6);

  // ---
  //    legend
  // ---
  TLegend *leg0 = new TLegend(0.45, 0.65, 0.95, 0.85);
  leg0->SetFillStyle(0);
  leg0->SetBorderSize(0);
  leg0->SetHeader("#sqrt{s}=7TeV data (e/#mu channel)");
  TLegend *leg1=(TLegend*)leg0->Clone(); 
  if(cmssim) leg0->AddEntry( CMSMadGraph7, "CMS MadGraph+Pythia(Z2*)", "LP");
  leg0->AddEntry( CMSdata7    , "CMS data in ATLAS binning"   , "LP");
  leg0->AddEntry( ATLASdata7  , "ATLAS data" , "LP");
  leg1->AddEntry( ATLASdata7  , "ATLAS (ATLAS-CONF-2013-099)" , "FP");
  leg1->AddEntry( CMSdata7    , "CMS (TOP-11-013 in ATLAS binning)"   , "FP");
  if(cmssim) leg1->AddEntry( CMSMadGraph7, "CMS MadGraph+Pythia(Z2*)", "LP");


  // ---
  //    privatworklabel
  // ---
  TPaveText *privatworklabel = new TPaveText();
  privatworklabel -> SetX1NDC(gStyle->GetPadLeftMargin());
  privatworklabel -> SetY1NDC(1.0-gStyle->GetPadTopMargin());
  privatworklabel -> SetX2NDC(1.0-gStyle->GetPadRightMargin());
  privatworklabel -> SetY2NDC(1.0);
  privatworklabel -> SetTextFont(42);
  privatworklabel -> AddText("private work");
  privatworklabel->SetFillStyle(0);
  privatworklabel->SetBorderSize(0);
  privatworklabel->SetTextSize(0.04);
  privatworklabel->SetTextAlign(32);

  // canvas
  std::vector<TCanvas*> plotCanvas_;
  // a) linear
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  ATLASdata7  ->Draw("p e2 same");
  CMSdata7    ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // b) log scale
  TH1F* dummy2=(TH1F*)dummy->Clone();
  dummy2->SetMinimum(0.00001);
  dummy2->SetMaximum(max*10);
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  plotCanvas_[plotCanvas_.size()-1]->SetLogy();
  // drawing
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // c) both data with bands
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  // new pad for log plot
  TPad *rPad = new TPad("rPad","",0.4,0.15,0.95,0.85);
  rPad->SetFillStyle(0);
  rPad->SetFillColor(0);
  rPad->SetBorderSize(0);
  rPad->SetBorderMode(0);
  rPad->SetLogy(0);
  rPad->SetLogx(0);
  rPad->SetTicky(1);
  rPad->Draw("");
  rPad->cd();
  // log plot curves
  rPad->SetLogy();
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1->Draw("same");
  privatworklabel->Draw("same");
  // d) both data with ratio
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1 ->Draw("same");
  privatworklabel->Draw("same");
  std::vector<double> errA_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errA_.push_back((ATLASdata7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((ATLASdata7->GetErrorYhigh(bin-1)/ATLASdata7->GetY()[bin-1])));
  }
  std::vector<double> errC_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errC_.push_back((CMSdata7->GetErrorYhigh(bin-1)/CMSdata7->GetY()[bin-1]));
  }
  if(cmssim){
    std::vector<double> errM_;
    for(int bin=1; bin<=Nbins7; ++bin){
      errM_.push_back(0.);
      //errM_.push_back((CMSMadGraph7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((CMSMadGraph7->GetErrorYhigh(bin-1)/CMSMadGraph7->GetY()[bin-1])));
    }
    drawRatio(M, C, 0.5, 1.5,  myStyle, 0, errM_, "x", "CMS data", "hist ", kAzure+6, false, 0.7);
    drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2 same"     , kBlue, true, 0.7);

  }
  else drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2"     , kBlue, true, 0.7);
  drawRatio(A, C, 0.5, 1.5,  myStyle, 0, errA_, "x", "CMS data", "p e2 same", kRed , true, 0.7);

  //saving
  TString path="./diffXSecFromSignal/plots/combined/2012/comparisonATLAS/";
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.eps");
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.png");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.eps");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.png");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.eps");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.png");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.eps");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.png");
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity);
  saveToRootFile("ATLASvsCMSDataComparisonPlots.root", plotCanvas_[plotCanvas_.size()-1], true, 0,"");
}
예제 #12
0
파일: test3.C 프로젝트: s-farry/workspaces
void test3()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Fri May  6 10:50:13 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,700,500);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(1.567901,0.02811051,4.654321,0.1367104);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.14);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   
   TH1F *test3_red_0_0_norm__1 = new TH1F("test3_red_0_0_norm__1","ETA",10,2,4.5);
   test3_red_0_0_norm__1->SetBinContent(1,0.1040398);
   test3_red_0_0_norm__1->SetBinContent(2,0.1186439);
   test3_red_0_0_norm__1->SetBinContent(3,0.1256071);
   test3_red_0_0_norm__1->SetBinContent(4,0.1229555);
   test3_red_0_0_norm__1->SetBinContent(5,0.118442);
   test3_red_0_0_norm__1->SetBinContent(6,0.1127067);
   test3_red_0_0_norm__1->SetBinContent(7,0.09951538);
   test3_red_0_0_norm__1->SetBinContent(8,0.08332527);
   test3_red_0_0_norm__1->SetBinContent(9,0.06651872);
   test3_red_0_0_norm__1->SetBinContent(10,0.0482457);
   test3_red_0_0_norm__1->SetBinError(1,0.001708584);
   test3_red_0_0_norm__1->SetBinError(2,0.001736969);
   test3_red_0_0_norm__1->SetBinError(3,0.001484444);
   test3_red_0_0_norm__1->SetBinError(4,0.001426268);
   test3_red_0_0_norm__1->SetBinError(5,0.001336676);
   test3_red_0_0_norm__1->SetBinError(6,0.00122978);
   test3_red_0_0_norm__1->SetBinError(7,0.00125216);
   test3_red_0_0_norm__1->SetBinError(8,0.00113555);
   test3_red_0_0_norm__1->SetBinError(9,0.0009819959);
   test3_red_0_0_norm__1->SetBinError(10,0.0009418311);
   test3_red_0_0_norm__1->SetEntries(58129);
   test3_red_0_0_norm__1->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm__1->SetFillColor(ci);
   test3_red_0_0_norm__1->SetFillStyle(0);

   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm__1->SetLineColor(ci);
   test3_red_0_0_norm__1->SetLineWidth(2);

   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm__1->SetMarkerColor(ci);
   test3_red_0_0_norm__1->SetMarkerStyle(20);
   test3_red_0_0_norm__1->GetXaxis()->SetTitle("#eta");
   test3_red_0_0_norm__1->GetXaxis()->SetNdivisions(1005);
   test3_red_0_0_norm__1->GetXaxis()->SetLabelFont(132);
   test3_red_0_0_norm__1->GetXaxis()->SetLabelOffset(0.02);
   test3_red_0_0_norm__1->GetXaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm__1->GetXaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm__1->GetXaxis()->SetTitleFont(132);
   test3_red_0_0_norm__1->GetYaxis()->SetNdivisions(505);
   test3_red_0_0_norm__1->GetYaxis()->SetLabelFont(132);
   test3_red_0_0_norm__1->GetYaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm__1->GetYaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm__1->GetYaxis()->SetTitleFont(132);
   test3_red_0_0_norm__1->GetZaxis()->SetLabelFont(132);
   test3_red_0_0_norm__1->GetZaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm__1->GetZaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm__1->GetZaxis()->SetTitleFont(132);
   test3_red_0_0_norm__1->Draw("");
   Double_t xAxis1[11] = {2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.25, 4.5}; 
   
   TH1F *test3_green_0_1_norm__2 = new TH1F("test3_green_0_1_norm__2","ETA",10, xAxis1);
   test3_green_0_1_norm__2->SetBinContent(1,0.1214835);
   test3_green_0_1_norm__2->SetBinContent(2,0.1235428);
   test3_green_0_1_norm__2->SetBinContent(3,0.1252758);
   test3_green_0_1_norm__2->SetBinContent(4,0.1207572);
   test3_green_0_1_norm__2->SetBinContent(5,0.1150848);
   test3_green_0_1_norm__2->SetBinContent(6,0.1056844);
   test3_green_0_1_norm__2->SetBinContent(7,0.09450962);
   test3_green_0_1_norm__2->SetBinContent(8,0.07910584);
   test3_green_0_1_norm__2->SetBinContent(9,0.06467657);
   test3_green_0_1_norm__2->SetBinContent(10,0.04987957);
   test3_green_0_1_norm__2->SetEntries(10);
   test3_green_0_1_norm__2->SetStats(0);

   ci = TColor::GetColor("#00ff00");
   test3_green_0_1_norm__2->SetFillColor(ci);
   test3_green_0_1_norm__2->SetFillStyle(0);

   ci = TColor::GetColor("#00ff00");
   test3_green_0_1_norm__2->SetLineColor(ci);
   test3_green_0_1_norm__2->SetLineWidth(2);

   ci = TColor::GetColor("#00ff00");
   test3_green_0_1_norm__2->SetMarkerColor(ci);
   test3_green_0_1_norm__2->SetMarkerStyle(20);
   test3_green_0_1_norm__2->GetXaxis()->SetTitle("#eta");
   test3_green_0_1_norm__2->GetXaxis()->SetNdivisions(1005);
   test3_green_0_1_norm__2->GetXaxis()->SetLabelFont(132);
   test3_green_0_1_norm__2->GetXaxis()->SetLabelOffset(0.02);
   test3_green_0_1_norm__2->GetXaxis()->SetLabelSize(0.05);
   test3_green_0_1_norm__2->GetXaxis()->SetTitleSize(0.06);
   test3_green_0_1_norm__2->GetXaxis()->SetTitleFont(132);
   test3_green_0_1_norm__2->GetYaxis()->SetNdivisions(505);
   test3_green_0_1_norm__2->GetYaxis()->SetLabelFont(132);
   test3_green_0_1_norm__2->GetYaxis()->SetLabelSize(0.05);
   test3_green_0_1_norm__2->GetYaxis()->SetTitleSize(0.06);
   test3_green_0_1_norm__2->GetYaxis()->SetTitleFont(132);
   test3_green_0_1_norm__2->GetZaxis()->SetLabelFont(132);
   test3_green_0_1_norm__2->GetZaxis()->SetLabelSize(0.05);
   test3_green_0_1_norm__2->GetZaxis()->SetTitleSize(0.06);
   test3_green_0_1_norm__2->GetZaxis()->SetTitleFont(132);
   test3_green_0_1_norm__2->Draw("same");
   
   TLegend *leg = new TLegend(0.2,0.7,0.4,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("MuonTrackingMC2015RW_Sim09/ETA_tot","T&P","lep");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);

   ci = TColor::GetColor("#ff0000");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("MuonUbsTrackingMC2015/ETA_tot","Truth","lep");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);

   ci = TColor::GetColor("#00ff00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TH1F *test3_red_0_0_norm_copy__3 = new TH1F("test3_red_0_0_norm_copy__3","ETA",10,2,4.5);
   test3_red_0_0_norm_copy__3->SetBinContent(1,0.1040398);
   test3_red_0_0_norm_copy__3->SetBinContent(2,0.1186439);
   test3_red_0_0_norm_copy__3->SetBinContent(3,0.1256071);
   test3_red_0_0_norm_copy__3->SetBinContent(4,0.1229555);
   test3_red_0_0_norm_copy__3->SetBinContent(5,0.118442);
   test3_red_0_0_norm_copy__3->SetBinContent(6,0.1127067);
   test3_red_0_0_norm_copy__3->SetBinContent(7,0.09951538);
   test3_red_0_0_norm_copy__3->SetBinContent(8,0.08332527);
   test3_red_0_0_norm_copy__3->SetBinContent(9,0.06651872);
   test3_red_0_0_norm_copy__3->SetBinContent(10,0.0482457);
   test3_red_0_0_norm_copy__3->SetBinError(1,0.001708584);
   test3_red_0_0_norm_copy__3->SetBinError(2,0.001736969);
   test3_red_0_0_norm_copy__3->SetBinError(3,0.001484444);
   test3_red_0_0_norm_copy__3->SetBinError(4,0.001426268);
   test3_red_0_0_norm_copy__3->SetBinError(5,0.001336676);
   test3_red_0_0_norm_copy__3->SetBinError(6,0.00122978);
   test3_red_0_0_norm_copy__3->SetBinError(7,0.00125216);
   test3_red_0_0_norm_copy__3->SetBinError(8,0.00113555);
   test3_red_0_0_norm_copy__3->SetBinError(9,0.0009819959);
   test3_red_0_0_norm_copy__3->SetBinError(10,0.0009418311);
   test3_red_0_0_norm_copy__3->SetEntries(58129);
   test3_red_0_0_norm_copy__3->SetDirectory(0);
   test3_red_0_0_norm_copy__3->SetStats(0);

   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm_copy__3->SetFillColor(ci);
   test3_red_0_0_norm_copy__3->SetFillStyle(0);

   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm_copy__3->SetLineColor(ci);
   test3_red_0_0_norm_copy__3->SetLineWidth(2);

   ci = TColor::GetColor("#ff0000");
   test3_red_0_0_norm_copy__3->SetMarkerColor(ci);
   test3_red_0_0_norm_copy__3->SetMarkerStyle(20);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetTitle("#eta");
   test3_red_0_0_norm_copy__3->GetXaxis()->SetNdivisions(1005);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetLabelFont(132);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetLabelOffset(0.02);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm_copy__3->GetXaxis()->SetTitleFont(132);
   test3_red_0_0_norm_copy__3->GetYaxis()->SetNdivisions(505);
   test3_red_0_0_norm_copy__3->GetYaxis()->SetLabelFont(132);
   test3_red_0_0_norm_copy__3->GetYaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm_copy__3->GetYaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm_copy__3->GetYaxis()->SetTitleFont(132);
   test3_red_0_0_norm_copy__3->GetZaxis()->SetLabelFont(132);
   test3_red_0_0_norm_copy__3->GetZaxis()->SetLabelSize(0.05);
   test3_red_0_0_norm_copy__3->GetZaxis()->SetTitleSize(0.06);
   test3_red_0_0_norm_copy__3->GetZaxis()->SetTitleFont(132);
   test3_red_0_0_norm_copy__3->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}
예제 #13
0
void DrawQCDClosure(TString VAR,TString XTITLE)
{
  gROOT->ForceStyle();
  TString FileName[7] = {"QCD_HT200to300","QCD_HT300to500","QCD_HT500to700","QCD_HT700to1000","QCD_HT1000to1500","QCD_HT1500to2000","QCD_HT2000toInf"};
  float XSEC[7]       = {1.74e+6,3.67e+5,2.94e+4,6.524e+03,1.064e+03,121.5,2.542e+01};
  TFile *inf[7];
  TH1F  *h[7],*h1[7];

  TCanvas *can = new TCanvas("can_QCDClosure_"+VAR,"can_QCDClosure_"+VAR,900,600);
  can->cd(1);
  can->SetBottomMargin(0.3);
  can->SetRightMargin(0.15);

  for(int i=0;i<7;i++) {
    inf[i] = TFile::Open("Histo_"+FileName[i]+".root");
    TH1F *hTriggerPass = (TH1F*)inf[i]->Get("hadtopL/TriggerPass");
    h[i]   = (TH1F*)inf[i]->Get("hadtopL/h_"+VAR);
    h1[i]   = (TH1F*)inf[i]->Get("hadtop/h_"+VAR);
    h[i]->Sumw2();
    h1[i]->Sumw2();
    h[i]->Rebin(5);
    h1[i]->Rebin(5);
    h[i]->Scale(XSEC[i]/hTriggerPass->GetBinContent(1));
    h1[i]->Scale(XSEC[i]/hTriggerPass->GetBinContent(1));
    cout<<hTriggerPass->GetBinContent(1)<<endl;
  }

  TH1F *hQCD  = (TH1F*)h[0]->Clone("hQCD");
  TH1F *hQCD1 = (TH1F*)h1[0]->Clone("hQCD1");
  for(int i=0;i<7;i++) {
    hQCD->Add(h[i]);
    hQCD1->Add(h1[i]);
  } 
  hQCD->SetFillColor(kGray);

  hQCD->Scale(1./hQCD->Integral());
  hQCD1->Scale(1./hQCD1->Integral());
  hQCD->GetXaxis()->SetLabelSize(0.0);
  double max = 1.1*TMath::Max(hQCD->GetBinContent(hQCD->GetMaximumBin()),hQCD1->GetBinContent(hQCD1->GetMaximumBin()));
  hQCD->SetMinimum(1e-5);
  hQCD->SetMaximum(max);
  hQCD->Draw("hist");
  hQCD1->Draw("sameE");
  gPad->RedrawAxis();

  TLegend *leg = new TLegend(0.86,0.65,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD,"Control","F");
  leg->AddEntry(hQCD1,"Signal","LP");
  leg->Draw();

  TH1F *hRatio = (TH1F*)hQCD1->Clone("Ratio");
  hRatio->Divide(hQCD);

  TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
  pad->SetTopMargin(0.7);
  pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  gPad->SetGridy();
  hRatio->GetXaxis()->SetTitle(XTITLE);
  hRatio->GetYaxis()->SetNdivisions(505);
  hRatio->GetYaxis()->SetRangeUser(0,2);
  hRatio->GetYaxis()->SetLabelSize(0.04);
  hRatio->Draw();
}
예제 #14
0
void DrawQCDClosure(TString VAR,int NBINS,float XMIN,float XMAX,TString XTITLE)
{
  gROOT->ForceStyle();
  
  const int N = 11;
  float XSEC[N] = {471100.,117276.,7823.,648.2,186.9,32.293,9.4183,0.84265,0.114943,0.00682981,0.000165445};

  TString SAMPLE[N] = {
    "QCD_Pt_120to170",
    "QCD_Pt_170to300",
    "QCD_Pt_300to470",
    "QCD_Pt_470to600",
    "QCD_Pt_600to800",
    "QCD_Pt_800to1000",
    "QCD_Pt_1000to1400",
    "QCD_Pt_1400to1800",
    "QCD_Pt_1800to2400",
    "QCD_Pt_2400to3200",
    "QCD_Pt_3200toInf" 
  }; 

  TFile *inf[N];
  TTree *tr0[N],*tr1[N],*tr2[N];
  TH1F  *h0[N],*h1[N],*h2[N];

  TCanvas *can = new TCanvas("can_QCDClosure_"+VAR,"can_QCDClosure_"+VAR,900,600);
  can->cd(1);
  can->SetBottomMargin(0.3);
  can->SetRightMargin(0.15);

  for(int i=0;i<N;i++) {
    inf[i] = TFile::Open("flatTree_"+SAMPLE[i]+".root");
    tr0[i] = (TTree*)inf[i]->Get("hadtopNoBtag/events");
    tr1[i] = (TTree*)inf[i]->Get("hadtopOneBtag/events");
    tr2[i] = (TTree*)inf[i]->Get("hadtop/events");
    TH1F *hpu = (TH1F*)inf[i]->Get("hadtop/pileup");
    h0[i]  = new TH1F("h0_"+SAMPLE[i],"h0_"+SAMPLE[i],NBINS,XMIN,XMAX);
    h1[i]  = new TH1F("h1_"+SAMPLE[i],"h1_"+SAMPLE[i],NBINS,XMIN,XMAX);
    h2[i]  = new TH1F("h2_"+SAMPLE[i],"h2_"+SAMPLE[i],NBINS,XMIN,XMAX);
    h0[i]->Sumw2();
    h1[i]->Sumw2();
    h2[i]->Sumw2();
    tr0[i]->Draw(VAR+">>"+"h0_"+SAMPLE[i],"triggerBit[0] && prob>0.05 && nBJets==0 && dRbbTop>2");
    tr1[i]->Draw(VAR+">>"+"h1_"+SAMPLE[i],"triggerBit[0] && prob>0.05 && nBJets==1 && dRbbTop>2");
    tr2[i]->Draw(VAR+">>"+"h2_"+SAMPLE[i],"triggerBit[0] && prob>0.05 && nBJets>1 && dRbbTop>2");
    h0[i]->Scale(XSEC[i]/hpu->GetEntries());
    h1[i]->Scale(XSEC[i]/hpu->GetEntries());
    h2[i]->Scale(XSEC[i]/hpu->GetEntries()); 
    cout<<SAMPLE[i]<<" "<<hpu->GetEntries()<<" "<<h0[i]->GetEntries()<<" "<<h1[i]->GetEntries()<<" "<<h2[i]->GetEntries()<<endl;
  }

  TH1F *hQCD0 = (TH1F*)h0[0]->Clone("hQCD0");
  TH1F *hQCD1 = (TH1F*)h1[0]->Clone("hQCD1");
  TH1F *hQCD2 = (TH1F*)h2[0]->Clone("hQCD2");

  for(int i=1;i<N;i++) {
    hQCD0->Add(h0[1]);
    hQCD1->Add(h1[1]);
    hQCD2->Add(h2[1]);
  }  
   
  hQCD0->SetFillColor(kGray);
  hQCD1->SetLineColor(kBlack);
  hQCD1->SetMarkerColor(kBlack);
  hQCD1->SetMarkerStyle(21);
  hQCD2->SetLineColor(kRed);
  hQCD2->SetMarkerColor(kRed);
  hQCD2->SetMarkerStyle(20);

  hQCD0->Scale(1./hQCD0->Integral());
  hQCD1->Scale(1./hQCD1->Integral());
  hQCD2->Scale(1./hQCD2->Integral());

  hQCD0->GetXaxis()->SetLabelSize(0.0);
  double max = 1.1*TMath::Max(hQCD0->GetBinContent(hQCD0->GetMaximumBin()),hQCD2->GetBinContent(hQCD2->GetMaximumBin()));
  hQCD0->SetMinimum(1e-5);
  hQCD0->SetMaximum(max);
  hQCD0->Draw("hist");
  hQCD1->Draw("sameE");
  hQCD2->Draw("sameE");
  gPad->RedrawAxis();

  TLegend *leg = new TLegend(0.86,0.65,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD0,"Zero btag","F");
  leg->AddEntry(hQCD1,"One btag","LP");
  leg->AddEntry(hQCD2,"Two btag","LP");
  leg->Draw();

  TH1F *hRatio0 = (TH1F*)hQCD2->Clone("Ratio0");
  hRatio0->Divide(hQCD0);
  TH1F *hRatio1 = (TH1F*)hQCD2->Clone("Ratio1");
  hRatio1->Divide(hQCD1);

  hRatio0->SetLineColor(kBlack);
  hRatio0->SetMarkerColor(kBlack);

  TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
  pad->SetTopMargin(0.7);
  pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  gPad->SetGridy();
  hRatio0->GetXaxis()->SetTitle(XTITLE);
  hRatio0->GetYaxis()->SetNdivisions(505);
  hRatio0->GetYaxis()->SetRangeUser(0,2);
  hRatio0->GetYaxis()->SetLabelSize(0.04);
  hRatio0->Draw();
  hRatio1->Draw("same");
}
예제 #15
0
void DrawVariable(TString DIR,TString VAR,float LUMI,bool LOG,int REBIN,float XMIN,float XMAX,TString XTITLE,bool isINT,int XNDIV,bool PRINT)
{
  gROOT->ForceStyle();
  const int N = 14;

  TString SAMPLE[N] = {
    "JetHT",
    "TT_TuneCUETP8M1_13TeV-powheg-pythia8",
    "WJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "DYJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "ST_t-channel_top_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT500to700_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT700to1000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1500to2000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT2000toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8"
  };
  float XSEC[N] = {1.0,0.5*832,3539,1460.,136.02,80.95,35.6,35.6,3.67e+5,2.94e+4,6.524e+03,1.064e+03,121.5,2.542e+01};

  TFile *inf[N];
  TH1F  *h[N];

  TCanvas *can = new TCanvas("DataVsMC_"+DIR+"_"+VAR,"DataVsMC_"+DIR+"_"+VAR,900,600);
  can->SetRightMargin(0.15);

  for(int i=0;i<N;i++) {
    inf[i] = TFile::Open("Histo_"+SAMPLE[i]+".root");
    h[i] = (TH1F*)inf[i]->Get(DIR+"/hWt_"+VAR);
    if (!h[i]) {
      cout<<"Histogram "<<"hWt_"+VAR<<" does not exist !!!"<<endl;
      break;
    } 
    h[i]->SetDirectory(0);
    h[i]->Sumw2();
    h[i]->Rebin(REBIN);
    h[i]->SetLineWidth(1);
    h[i]->SetLineColor(kBlack);
    if (i>0) {
      float norm = ((TH1F*)inf[i]->Get("eventCounter/GenEventWeight"))->GetSumOfWeights();   
      //cout<<SAMPLE[i]<<" "<<norm<<endl;
      h[i]->Scale(LUMI*XSEC[i]/norm);
    }
    inf[i]->Close();
  }

  TH1F *hQCD = (TH1F*)h[8]->Clone("hQCD");
  for(int i=9;i<N;i++) {
    hQCD->Add(h[i]);
  }
 
  TH1F *hST = (TH1F*)h[4]->Clone("hST");
  hST->Add(h[5]);
  hST->Add(h[6]);
  hST->Add(h[7]);
  h[0]->SetLineWidth(2);//data
  hQCD->SetFillColor(kBlue-10);//QCD
  h[1]->SetFillColor(kOrange);//ttbar
  h[2]->SetFillColor(kGreen-10);//WJets
  h[3]->SetFillColor(kGreen-8);//ZJets
  hST->SetFillColor(kOrange-1);//ST

  float kfactor = 1.0;
  if (hQCD->Integral() > 0) { 
    kfactor = (h[0]->Integral()-h[1]->Integral()-h[2]->Integral()-h[3]->Integral()-hST->Integral())/hQCD->Integral();
  }  
  hQCD->Scale(kfactor);

  TH1F *hBkg = (TH1F*)hQCD->Clone("hBkg");
  hBkg->Add(h[1]);
  hBkg->Add(h[2]);
  hBkg->Add(h[3]);
  hBkg->Add(h[4]);
  hBkg->Add(hST);
  //hBkg->SetFillColor(kGray);

  cout<<"======== "<<VAR<<"====================="<<endl;
  cout<<"Data events:  "<<h[0]->Integral()<<endl;
  cout<<"QCD events:   "<<hQCD->Integral()<<endl;
  cout<<"WJets events: "<<h[2]->Integral()<<endl;
  cout<<"ZJets events: "<<h[3]->Integral()<<endl;
  cout<<"ST events:    "<<hST->Integral()<<endl;
  cout<<"TTbar events: "<<h[1]->Integral()<<endl;
  cout<<"kfactor:      "<<kfactor<<endl;

  THStack *hs = new THStack("hs","hs");
  if (LOG) {   
    hs->Add(h[2]);
    hs->Add(h[3]);
    hs->Add(hST); 
    hs->Add(hQCD);
    hs->Add(h[1]);
  }
  else {
    hs->Add(h[3]);
    hs->Add(hST);
    hs->Add(h[2]);
    hs->Add(hQCD);
    hs->Add(h[1]);
  }
  TH1F *hRatio = (TH1F*)h[0]->Clone("Ratio");
  hRatio->SetLineWidth(2);
  hRatio->Divide(hBkg);

  TLegend *leg = new TLegend(0.86,0.7,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD,"QCD","F");
  leg->AddEntry(h[1],"TTbar","F"); 
  leg->AddEntry(hST,"ST","F"); 
  leg->AddEntry(h[2],"WJets","F");
  leg->AddEntry(h[3],"ZJets","F"); 
  
  can->SetBottomMargin(0.25);
  TH1F *hAux = (TH1F*)h[0]->Clone("aux");
  hAux->Reset();
  hAux->GetXaxis()->SetNdivisions(XNDIV);
  if (isINT) {
    hAux->GetXaxis()->CenterLabels();
  } 
  hAux->GetYaxis()->SetRangeUser(0.5,1.1*TMath::Max(hBkg->GetBinContent(hBkg->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin())));  
  if (LOG) {
    gPad->SetLogy(); 
    hAux->GetYaxis()->SetRangeUser(0.5,2*TMath::Max(hBkg->GetBinContent(hBkg->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin())));
  }
  hAux->GetXaxis()->SetRangeUser(XMIN,XMAX);
  hAux->GetYaxis()->SetTitle(TString::Format("Number of events / %1.2f fb^{-1}",LUMI/1000));
  hAux->GetXaxis()->SetTitle("");
  hAux->GetXaxis()->SetLabelSize(0.0);
  hAux->Draw();
  hs->Draw("hist same");
  //hBkg->Draw("sames hist"); 
  h[0]->Draw("sames E");
  
  leg->Draw();
  gPad->RedrawAxis();

  TPad *pad = new TPad("pad","pad",0.,0.,1.,1.);
  pad->SetTopMargin(0.77);
  pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  pad->SetGridy();
  hRatio->GetXaxis()->SetTitleOffset(0.95);
  hRatio->GetYaxis()->SetTitleOffset(1.5);
  hRatio->GetYaxis()->SetTickLength(0.06);
  hRatio->GetYaxis()->SetTitleSize(0.03);
  hRatio->GetYaxis()->SetLabelSize(0.03);
  hRatio->GetYaxis()->SetTitle("Data/MC");
  hRatio->GetXaxis()->SetTitle(XTITLE);
  hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX);
  hRatio->GetYaxis()->SetRangeUser(0.5,1.5);
  hRatio->GetYaxis()->SetNdivisions(505);
  hRatio->GetXaxis()->SetNdivisions(XNDIV);
  if (isINT) {
    hRatio->GetXaxis()->CenterLabels();
  }
  hRatio->Draw();
  if (PRINT) {
    can->Print("plots/"+TString(can->GetName())+".pdf"); 
    can->Print("plots/"+TString(can->GetName())+".png");
  }
}
예제 #16
0
// main method
void LEDRef_evtdis(const int runno = 615,
		   const int gainv = 0,  /*0=low, 1=high*/
		   const int evtnum= -10,
		   int ymax=1023, // set the scale of plots
		   const int delay = 1)  // -1=no delay, wait for input, X>=0 => sleep aprox. X sec. after making plot
{
  // set ranges to plot
  const int strip_f = 0; // first
  const int strip_l = NSTRIPS - 1;
  
  const int nsamples = 65; // number of ADC time samples per channel and event
  
  const int saveplot = 0;
  const int numbering      = 1; // 0: no numbering, 1: nubering on each plot
  const int dofit = 0; // 0: no fit, 1: try to fit the spectra 
  const int debug    = 0;
  const float gammaN = 2;
  // end of setup    
  
  // Assume we are just interested in the 1st segment, _0.root below for fname*
  Char_t fname[256];
  sprintf(fname, "/local/data/Run_%09d.Seq_1A.Stream_0.root",runno);
  cout << "TOTCHAN " << TOTCHAN << endl;

  // set up a raw reader of the data
  AliRawReader *rawReader = NULL;
  rawReader = new AliRawReaderRoot(fname);
  AliCaloRawStream *in = NULL; 
  in = new AliCaloRawStream(rawReader,"EMCAL");

  // set up histograms
  TH1F *hfit[TOTCHAN];
  TF1 *f1[TOTCHAN];
  char ch_label[TOTCHAN][100];
  char buff1[100];
  char name[80];
  for(int i=0; i<TOTCHAN; i++) {
    sprintf(buff1,"hfit_%d",i);
    hfit[i] = new TH1F(buff1,"hfit", nsamples , -0.5, nsamples - 0.5);
    hfit[i]->SetDirectory(0);
    sprintf(name,"f1_%d",i);
    f1[i] = new TF1(name,fitfun,0,70,5);
    f1[i]->SetLineWidth(2);
    f1[i]->SetLineColor(2);

    //	int idx = istrip + NSTRIPS * gain; // encoding used later
    int gain = i / (NSTRIPS);
    int istrip = i % NSTRIPS;
    sprintf(ch_label[i], "Strip%02d", istrip);
  }
  
  TCanvas *cc1 = new TCanvas("cc1","3 columns of 8 strips each",600,800);
  int numcol = NSETS;
  int numrow = NSTRIPS_IN_SET;
  cc1->Divide(numcol, numrow);
  
  TText *t = new TText;
  t->SetTextSize(0.17);
  int clr[2] = {4,2}; // colors
  
  // figure out which events we should look at
  int firstevent = evtnum;
  int lastevent = evtnum;
  if (evtnum < 0) { // get a bunch of events
    firstevent = 0;
    lastevent = - evtnum;
  }
  if (evtnum == 0) { // get all events
    firstevent = 0;
    lastevent = 1000000;
  }
  
  Int_t iev =0;
  AliRawEventHeaderBase *aliHeader=NULL;    
  while ( rawReader->NextEvent() && iev < firstevent) {
    aliHeader = (AliRawEventHeaderBase*) rawReader->GetEventHeader();
    iev++;
  }
  
  // loop over selected events
  while ( rawReader->NextEvent() && iev <= lastevent) {
    aliHeader = (AliRawEventHeaderBase*) rawReader->GetEventHeader();
    int runNumber = aliHeader->Get("RunNb"); 
    
    cout << "Found run number " << runNumber << endl;
    
    // reset histograms
    for(int i=0; i<TOTCHAN; i++) {
      hfit[i]->Reset();
    }
    
    // get events (the "1" ensures that we actually select all events for now)
    if ( 1 || aliHeader->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent ) {
      const UInt_t * evtId = aliHeader->GetP("Id");
      int evno_raw = (int) evtId[0];
      int timestamp = aliHeader->Get("Timestamp");
      
      cout << " evno " << evno_raw
	   << " size " << aliHeader->GetEventSize()
	   << " type " << aliHeader->Get("Type")
	   << " type name " << aliHeader->GetTypeName()
	   << " timestamp " << timestamp
	   << endl;
      
      /// process_event stream
      while ( in->Next() ) {
	
	int strip = in->GetColumn();
	int gain = in->GetRow();
	
	if (in->IsLEDMonData()) {
	  
	  int idx = strip + NSTRIPS*gain;
	  //cout << "hist idx " << idx << endl;
	  
	  if (idx < 0 || idx > TOTCHAN) { 
	    cout << "Hist idx out of range: " << idx << endl;
	  }
	  else { // reasonable range of idx
	    hfit[idx]->SetBinContent(in->GetTime(), in->GetSignal());
	  }

	} // LED Ref data only

      } // Raw data read
    
      // Next: let's actually plot the data..
      for (Int_t strip = strip_f; strip <= strip_l; strip++) {
	
	int idx = strip + NSTRIPS*gainv;
	
	// which set/column does the strip belong in
	int iset = strip / NSTRIPS_IN_SET; 	  
	int within_set = strip % NSTRIPS_IN_SET; 	  
	// on which pad should we plot it?
	int pad_id = (NSTRIPS_IN_SET-1-within_set)*NSETS + iset + 1;
	
	cout << "strip " << strip 
	     << ". set="<< iset << ", within_set=" << within_set
	     << ", pad=" << pad_id << endl;
	cc1->cd(pad_id);
	hfit[idx]->SetTitle("");
	hfit[idx]->SetFillColor(5);
	hfit[idx]->SetMaximum(ymax);
	hfit[idx]->SetMinimum(0);
	// we may or may not decide to fit the data
	if (dofit) {
	  f1[i]->SetParameter(0, 0); // initial guess; zero amplitude :=)
	  hfit[idx]->Fit(f1[i]);
	}
	hfit[idx]->Draw();
	if( numbering ) {
	  t->SetTextColor(clr[gainv]);
	  t->DrawTextNDC(0.65,0.65,ch_label[idx]);
	}
      }

      // add some extra text on the canvas
      // print a box showing run #, evt #, and timestamp
      cc1->cd();
      // first draw transparent pad
      TPad *trans = new TPad("trans","",0,0,1,1);
      trans->SetFillStyle(4000);
      trans->Draw();
      trans->cd();
      // then draw text
      TPaveText *label = new TPaveText(.2,.11,.8,.14,"NDC"); 
      //  label->Clear();
      label->SetBorderSize(1);
      label->SetFillColor(0);
      label->SetLineColor(clr[gainv]);
      label->SetTextColor(clr[gainv]);
      //label->SetFillStyle(0);
      TDatime d;
      d.Set(timestamp);
      sprintf(name,"Run %d, Event %d, Hist Max %d, %s",runno,iev,ymax,d.AsString());
      label->AddText(name);
      label->Draw();
      cc1->Update();
      cout << "Done" << endl;
      
      // some shenanigans to hold the plotting, if requested
      if (firstevent != lastevent) {
	if (delay == -1) {
	  // wait for character input before proceeding
	  cout << " enter y to proceed " << endl;
	  char dummy[2];
	  cin >> dummy;
	  cout << " read " << dummy << endl;
	  if (strcmp(dummy, "y")==0) {
	    cout << " ok, continuing with event " << iev+1 << endl;
	  }
	  else {
	    cout << " ok, exiting " << endl;
	    //exit(1);
	  }
	}
	else {
	  cout << "Sleeping for " << delay * 500 << endl;
	  gSystem->Sleep(delay * 500);
	}
      }

      // save plot, if setup/requested to do so
      char plotname[100];
      if (saveplot==1) {
	sprintf(plotname,"Run_%d_LEDRef_Ev%d_Gain%d_MaxHist%d.gif",
		runno,iev,gainv,ymax);  
	cout <<"SAVING plot:"<< plotname << endl;
	cc1->SaveAs(plotname);
      }

    } // event selection
예제 #17
0
void plot(int mass) {
  double myQCDRelUncert = 0.038;
  double myEWKRelUncert = 0.131;
  double myFakesRelUncert = 0.238;
  double delta = 1.4;
  double br = 0.05;
  bool debug = false;
  bool log = false;
  double ymin = 0.001;
  double ymax = 48;
  
  static bool bMessage = false;
  if (!bMessage) {
    cout << "Values used as relative uncertainty (please check):" << endl;
    cout << "  QCD: " << myQCDRelUncert << endl;
    cout << "  EWK genuine tau: " << myEWKRelUncert << endl;
    cout << "  EWK fake tau: " << myFakesRelUncert << endl << endl;
    bMessage = true;
  }
  cout << "Processing mass point: " << mass << " GeV/c2" << endl;
  
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetTitleFont(43, "xyz");
  gStyle->SetTitleSize(33, "xyz");
  gStyle->SetLabelFont(43, "xyz");
  gStyle->SetLabelSize(27, "xyz");
  
  //std::string infile = "EPS_data_nodeltaphi/hplus_100.root";
  //std::string infile = "EPS_data_deltaphi160/hplus_100.root";
  std::stringstream s;
  s << "lands_histograms_hplushadronic_m" << mass << ".root";

  std::string infile = s.str();
  
 // Canvas
  TCanvas *myCanvas = new TCanvas("myCanvas", "",0,0,600,600);
  myCanvas->SetHighLightColor(2);
  myCanvas->Range(0,0,1,1);
  myCanvas->SetFillColor(0);
  myCanvas->SetBorderMode(0);
  myCanvas->SetBorderSize(2);
  if (log)
    myCanvas->SetLogy();
  myCanvas->SetTickx(1);
  myCanvas->SetTicky(1);
  myCanvas->SetLeftMargin(0.16);
  myCanvas->SetRightMargin(0.05);
  myCanvas->SetTopMargin(0.05);
  myCanvas->SetBottomMargin(0.08);
  myCanvas->SetFrameFillStyle(0);
  myCanvas->SetFrameBorderMode(0);
  myCanvas->SetFrameFillStyle(0);
  myCanvas->SetFrameBorderMode(0);
  myCanvas->cd();

  Int_t ci;

  TFile* f = TFile::Open(infile.c_str());
  s.str("");
  s << "HW" << mass << "_1";
  TH1* hw = (TH1*)f->Get(s.str().c_str());
  s.str("");
  s << "HH" << mass << "_1";
  TH1* hh = (TH1*)f->Get(s.str().c_str());
  TH1* data = (TH1*)f->Get("data_obs");
  data->SetLineWidth(2);
  data->SetMarkerStyle(20);
  data->SetMarkerSize(1.2);

  TH1* ewktau = (TH1*)f->Get("EWK_Tau");
  ci = TColor::GetColor("#993399");
  ewktau->SetFillColor(ci);
  ewktau->SetLineWidth(0);
  TH1* ewkDY = (TH1*)f->Get("EWK_DYx");
  TH1* ewkVV = (TH1*)f->Get("EWK_VVx");
  ewktau->Add(ewkDY);
  ewktau->Add(ewkVV);
  
  //TH1* qcd = (TH1*)f->Get("QCDInv");
  TH1* qcd = (TH1*)f->Get("QCD");
  ci = TColor::GetColor("#ffcc33");
  qcd->SetFillColor(ci);
  qcd->SetLineWidth(0);
  TH1* fakett = (TH1*)f->Get("fake_tt");
  ci = TColor::GetColor("#669900");
  fakett->SetFillColor(ci);
  fakett->SetLineWidth(0);
  TH1* fakeW = (TH1*)f->Get("fake_W");
  ci = TColor::GetColor("#cc3300");
  fakeW->SetFillColor(ci);
  fakeW->SetLineWidth(0);
  TH1* faket = (TH1*)f->Get("fake_t");

  TH1F *hFrame = new TH1F("hFrame","",20,0,400);
  hFrame->SetMinimum(ymin);
  if (log)
    hFrame->SetMaximum(ymax*1.5);
  else
    hFrame->SetMaximum(ymax);
  hFrame->SetDirectory(0);
  hFrame->SetStats(0);
  hFrame->SetLineStyle(0);
  hFrame->SetMarkerStyle(20);
  hFrame->SetXTitle("Transverse mass (#tau jet, E_{T}^{miss}), (GeV/c^{2})");
  if (paperStatus)
    hFrame->SetXTitle("Transverse mass (#tau_{h}, E_{T}^{miss}), (GeV/c^{2})");
  hFrame->SetYTitle("Events / 20 GeV/c^{2}");
  hFrame->GetXaxis()->SetTitleSize(0);
  hFrame->GetXaxis()->SetLabelSize(0);
  hFrame->GetYaxis()->SetTitleFont(43);
  hFrame->GetYaxis()->SetTitleSize(27);
  hFrame->GetYaxis()->SetTitleOffset(1.3);
  

  // signal
  hh->Scale(br*br);
  hw->Scale(2*br*(1.0-br));
  TH1* signal = (TH1*)hh->Clone();
  signal->Add(hw);

  ci = TColor::GetColor("#ff3399");
  signal->SetLineColor(ci);
  signal->SetLineStyle(2);
  signal->SetLineWidth(2);

  // Fakes
  TH1* fakes = (TH1*)(fakett->Clone());
  fakes->Add(fakeW);
  fakes->Add(faket);

  // stacked backgrounds
  THStack *exp = new THStack();
  exp->SetName("exp");
  exp->SetTitle("exp");
  exp->Add(fakes);
  exp->Add(ewktau);
  exp->Add(qcd);
  exp->Add(signal);
  
  TH1* hExpBkg = (TH1*)fakes->Clone();
  hExpBkg->Add(ewktau);
  hExpBkg->Add(qcd);
  
  // uncertainty
  TH1* uncert = (TH1*)fakeW->Clone();
  uncert->Add(fakett);
  uncert->Add(ewktau);
  uncert->Add(qcd);
  uncert->SetFillColor(1);
  uncert->SetFillStyle(3344);
  uncert->SetLineColor(0);
  uncert->SetLineStyle(0);
  uncert->SetLineWidth(0);

  TH1* hExpBkgTotalUncert = (TH1*)uncert->Clone();
  hExpBkgTotalUncert->SetFillStyle(3354);

  TH1* hAgreement = (TH1*)data->Clone();
  hAgreement->Divide(hExpBkg);
  TGraphErrors* hAgreementRelUncert = new TGraphErrors(hAgreement->GetNbinsX());
  hAgreementRelUncert->SetLineWidth(2);
  hAgreementRelUncert->SetLineColor(kBlack);
  for (int i = 1; i <= hFrame->GetNbinsX(); ++i) {
    double myQCDTotalUncert = TMath::Power(qcd->GetBinError(i), 2)
      + TMath::Power(qcd->GetBinContent(i)*myQCDRelUncert, 2);
    double myEWKTotalUncert = TMath::Power(ewktau->GetBinError(i), 2)
      + TMath::Power(ewktau->GetBinContent(i)*myEWKRelUncert, 2);
    double myFakesTotalUncert = TMath::Power(fakes->GetBinError(i), 2)
      + TMath::Power(fakes->GetBinContent(i)*myFakesRelUncert, 2);
    hExpBkgTotalUncert->SetBinError(i, TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert));

    if (hExpBkg->GetBinContent(i) > 0) {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), data->GetBinContent(i) / hExpBkg->GetBinContent(i));
      double myUncertData = 0;
      if (data->GetBinContent(i) > 0)
        myUncertData = TMath::Power(data->GetBinError(i) / data->GetBinContent(i), 2);
      double myUncertBkg = (myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / TMath::Power(hExpBkg->GetBinContent(i), 2);
      hAgreementRelUncert->SetPointError(i-1, 0,  data->GetBinContent(i) / hExpBkg->GetBinContent(i) * TMath::Sqrt(myUncertData + myUncertBkg));
    } else {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), 0);
      hAgreementRelUncert->SetPointError(i-1, 0, 0);
    }
    if (debug) {
      cout << "Point: " << hAgreementRelUncert->GetX()[i-1]-10 << "-" << hAgreementRelUncert->GetX()[i-1]+10
          << " GeV/c2, agreement: " << hAgreementRelUncert->GetY()[i-1] << ", uncert: " << hAgreement->GetBinError(i) << ", " << hAgreementRelUncert->GetErrorY(i-1) << endl;
      cout << "  bkg. stat. uncert. " << hExpBkg->GetBinError(i) << " (i.e. " << hExpBkg->GetBinError(i) / hExpBkg->GetBinContent(i) * 100.0 << " %)"
          << ", stat+syst uncert. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) 
          << " (i.e. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / hExpBkg->GetBinContent(i) * 100.0 << " %)" << endl;
    }
  }

  // Agreement pad
  TPad* pad = new TPad("ratiopad","ratiopad",0.,0.,1.,.3);
  pad->Draw();
  pad->cd();
  pad->Range(0,0,1,1);
  pad->SetFillColor(0);
  pad->SetFillStyle(4000);
  pad->SetBorderMode(0);
  pad->SetBorderSize(2);
  pad->SetTickx(1);
  pad->SetTicky(1);
  pad->SetLeftMargin(0.16);
  pad->SetRightMargin(0.05);
  pad->SetTopMargin(0);
  pad->SetBottomMargin(0.34);
  pad->SetFrameFillStyle(0);
  pad->SetFrameBorderMode(0);
  // Plot here ratio
  if (1.0-delta > 0)
    hAgreement->SetMinimum(1.0-delta);
  else
    hAgreement->SetMinimum(0.);
  hAgreement->SetMaximum(1.0+delta);
  hAgreement->GetXaxis()->SetLabelOffset(0.007);
  hAgreement->GetXaxis()->SetLabelFont(43);
  hAgreement->GetXaxis()->SetLabelSize(27);
  hAgreement->GetYaxis()->SetLabelFont(43);
  hAgreement->GetYaxis()->SetLabelSize(27);
  hAgreement->GetYaxis()->SetLabelOffset(0.007);
  hAgreement->GetYaxis()->SetNdivisions(505);
  hAgreement->GetXaxis()->SetTitleFont(43);
  hAgreement->GetYaxis()->SetTitleFont(43);
  hAgreement->GetXaxis()->SetTitleSize(33);
  hAgreement->GetYaxis()->SetTitleSize(33);
  hAgreement->SetTitleSize(27, "xyz");
  hAgreement->GetXaxis()->SetTitleOffset(3.2);
  hAgreement->GetYaxis()->SetTitleOffset(1.3);
  hAgreement->SetXTitle(hFrame->GetXaxis()->GetTitle());
  hAgreement->SetYTitle("Data/#Sigmabkg");
  hAgreement->Draw("e2");
  // Plot line at zero
  TH1* hAgreementLine = dynamic_cast<TH1*>(hAgreement->Clone());
  for (int i = 1; i <= hAgreementLine->GetNbinsX(); ++i) {
    hAgreementLine->SetBinContent(i,1.0);
    hAgreementLine->SetBinError(i,0.0);
  }
  hAgreementLine->SetLineColor(kRed);
  hAgreementLine->SetLineWidth(2);
  hAgreementLine->SetLineStyle(3);
  hAgreementLine->Draw("hist same");
  hAgreement->Draw("same");
  hAgreementRelUncert->Draw("[]");
  pad->RedrawAxis();

  myCanvas->cd();
  
  TPad* plotpad = new TPad("plotpad", "plotpad",0,0.3,1.,1.);
  plotpad->Draw();
  plotpad->cd();
  plotpad->Range(0,0,1,1);
  plotpad->SetFillColor(0);
  plotpad->SetFillStyle(4000);
  plotpad->SetBorderMode(0);
  plotpad->SetBorderSize(2);
  //if (logy)
  //  plotpad->SetLogy();
  plotpad->SetTickx(1);
  plotpad->SetTicky(1);
  plotpad->SetLeftMargin(0.16);
  plotpad->SetRightMargin(0.05);
  plotpad->SetTopMargin(0.065);
  plotpad->SetBottomMargin(0.0);
  plotpad->SetFrameFillStyle(0);
  plotpad->SetFrameBorderMode(0);
  
  hFrame->GetXaxis()->SetTitleSize(0);
  hFrame->GetXaxis()->SetLabelSize(0);
  hFrame->GetYaxis()->SetTitleFont(43);
  hFrame->GetYaxis()->SetTitleSize(33);
  hFrame->GetYaxis()->SetTitleOffset(1.3);
  
  // Draw objects
  hFrame->Draw();
  exp->Draw("hist same");
  uncert->Draw("E2 same");
  hExpBkgTotalUncert->Draw("E2 same");
  // Data
  data->Draw("same");
  
  //signal->Draw("same");
  TLegend *leg = new TLegend(0.53,0.6,0.87,0.91,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextFont(63);
  leg->SetTextSize(18);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(kWhite);
  //leg->SetFillStyle(4000); // enabling this will cause the plot to be erased from the pad
  TLegendEntry* entry = leg->AddEntry(data, "Data", "P");
  s.str("");
  s << "with H^{#pm}#rightarrow#tau^{#pm}#nu";
  entry = leg->AddEntry(signal, s.str().c_str(), "L");
  entry = leg->AddEntry(qcd, "QCD (meas.)", "F");
  entry = leg->AddEntry(ewktau, "EWK genuine #tau (meas.)", "F");
  entry = leg->AddEntry(fakes, "EWK fake #tau (MC)", "F");
  entry = leg->AddEntry(uncert, "stat. uncert.", "F");
  entry = leg->AddEntry(hExpBkgTotalUncert, "stat. #oplus syst. uncert.", "F");
  leg->Draw();
  
  string myTitle = "CMS Preliminary";
  if (paperStatus)
    myTitle = "CMS";

  TLatex *tex = new TLatex(0.62,0.945,myTitle.c_str());
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.2,0.945,"#sqrt{s} = 7 TeV");
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.43,0.945,"2.2 fb^{-1}");
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();

  s.str("");
  s << "m_{H^{#pm}} = " << mass << " GeV/c^{2}";
  tex = new TLatex(0.28,0.865,s.str().c_str());
  tex->SetNDC();
  tex->SetTextFont(63);
  tex->SetTextSize(20);
  tex->SetLineWidth(2);
  tex->Draw();
  s.str("");
  s << "BR(t#rightarrowbH^{#pm})=" << setprecision(2) << br;
  tex = new TLatex(0.28,0.805,s.str().c_str());
  tex->SetNDC();
  tex->SetTextFont(63);
  tex->SetTextSize(20);
  tex->SetLineWidth(2);
  tex->Draw();

  
  plotpad->RedrawAxis();
  plotpad->Modified();

  s.str("");
  s << "mT_datadriven_m" << mass << ".png";
  myCanvas->Print(s.str().c_str());
  s.str("");
  s << "mT_datadriven_m" << mass << ".C";
  myCanvas->Print(s.str().c_str());
  s.str("");
  s << "mT_datadriven_m" << mass << ".eps";
  myCanvas->Print(s.str().c_str());
   

}
예제 #18
0
void DrawVariable(TString VAR,bool SHAPE,int REBIN,float XMIN,float XMAX,TString XTITLE,bool PRINT,bool BLIND=false,float BLIND_MIN=0,float BLIND_MAX=0)
{
  gROOT->ForceStyle();
  const int N = 20;

  TString SAMPLE[N] = {
    "JetHT",
    "ttHJetTobb_M125_13TeV_amcatnloFXFX_madspin_pythia8",
    "ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8_mWCutfix",
    "QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT500to700_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT700to1000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1500to2000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT2000toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "DYJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "WJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "TT_TuneCUETP8M1_13TeV-powheg-pythia8",
    "ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "TTWJetsToQQ_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8",
    "TTZToQQ_TuneCUETP8M1_13TeV-amcatnlo-pythia8",
    "WZ_TuneCUETP8M1_13TeV-pythia8",
    "WWTo4Q_13TeV-powheg",
    "ZZTo4Q_13TeV_amcatnloFXFX_madspin_pythia8"
  };

  float XSEC[N] = {
    1.0,
    0.2934,
    0.2151,
    347700, 
    32100,
    6831,
    1207,
    119.9,
    25.24,
    1460,
    3539,
    832,
    217,
    35.6,
    35.6,
    0.4062,
    0.5297,
    47.13,
    51.723,
    22.29
  }; 
 
  float LUMI(5760);
  TFile *inf[N];
  TH1F  *h[N];

  TCanvas *can = new TCanvas("can_"+VAR,"can_"+VAR,900,600);
  can->SetRightMargin(0.15);

  for(int i=0;i<N;i++) {
    inf[i] = TFile::Open("Histo_"+SAMPLE[i]+".root");
    //cout<<inf[i]->GetName()<<" "<<VAR<<endl;
    h[i]   = (TH1F*)inf[i]->Get("ttH/h_"+VAR);
    h[i]->SetDirectory(0);
    h[i]->Rebin(REBIN);
    h[i]->Sumw2();
    h[i]->SetLineWidth(1);
    h[i]->SetLineColor(kBlack);
    if (i>0) {
      float norm = ((TH1F*)inf[i]->Get("eventCounter/GenEventWeight"))->GetSumOfWeights();
      //cout<<inf[i]->GetName()<<" "<<norm<<endl; 
      h[i]->Scale(LUMI*XSEC[i]/norm);
    }
    else {
      h[i]->SetLineWidth(2);
    }
    inf[i]->Close();
  }

  TH1F *hQCD = (TH1F*)h[3]->Clone("hQCD");
  hQCD->Add(h[4]);
  hQCD->Add(h[5]);
  hQCD->Add(h[6]); 
  hQCD->Add(h[7]);
  hQCD->Add(h[8]);

  TH1F *hVV = (TH1F*)h[17]->Clone("hVV");
  hVV->Add(h[18]);
  hVV->Add(h[19]);

  TH1F *hST = (TH1F*)h[12]->Clone("hST");
  hST->Add(h[13]);
  hST->Add(h[14]);

  h[1]->SetLineColor(kRed);//ttHbb
  h[1]->SetFillColor(kRed-9);
  h[1]->SetLineWidth(2);
  h[2]->SetLineColor(kRed);//ttHNobb
  h[2]->SetFillColor(kRed-10);
  h[2]->SetLineWidth(2);

  TH1F *hTT     = (TH1F*)h[11]->Clone("TTbar");
  TH1F *hTTZ    = (TH1F*)h[16]->Clone("TTZ");
  TH1F *hTTW    = (TH1F*)h[15]->Clone("TTW");
  TH1F *hWJets  = (TH1F*)h[10]->Clone("WJets");
  TH1F *hDYJets = (TH1F*)h[9]->Clone("DYJets");
 
  hQCD->SetFillColor(kBlue-10);//QCD
  hTT->SetFillColor(kOrange);
  hST->SetFillColor(kOrange-1);//ST
  hVV->SetFillColor(kMagenta-10);//VV
  hTTZ->SetFillColor(kYellow-10);//ttZ
  hTTW->SetFillColor(kYellow-9);//ttW
  hWJets->SetFillColor(kGreen-10);//WJets
  hDYJets->SetFillColor(kGreen-8);//ZJets
 
 

  float kfactor = 1.0;
  if (hQCD->Integral() > 0) { 
    kfactor = (h[0]->Integral()-hTT->Integral()-hWJets->Integral()-hDYJets->Integral()-hST->Integral())/hQCD->Integral();
  }  
  hQCD->Scale(kfactor);

  TH1F *hBkg = (TH1F*)hQCD->Clone("hBkg");
  hBkg->Add(hTT);
  hBkg->Add(hST);
  hBkg->Add(hTTW);
  hBkg->Add(hTTZ);
  hBkg->Add(hWJets);
  hBkg->Add(hDYJets);
  hBkg->Add(hVV);
  hBkg->SetFillColor(kGray);

  cout<<"Data events:  "<<h[0]->Integral()<<endl;
  cout<<"ttHJetTobb:   "<<h[1]->Integral()<<endl;
  cout<<"ttHJetToNonbb:"<<h[2]->Integral()<<endl;
  cout<<"QCD events:   "<<hQCD->Integral()<<endl;
  cout<<"TTbar events: "<<hTT->Integral()<<endl;
  cout<<"ST events:    "<<hST->Integral()<<endl;
  cout<<"TTZ events:   "<<hTTZ->Integral()<<endl;  
  cout<<"TTW events:   "<<hTTW->Integral()<<endl;
  cout<<"WJets events: "<<hWJets->Integral()<<endl;
  cout<<"DYJets events:"<<hDYJets->Integral()<<endl;
  cout<<"VV events:    "<<hVV->Integral()<<endl;
  cout<<"kfactor:      "<<kfactor<<endl;

  THStack *hs = new THStack("hs","hs");
  hs->Add(hVV);
  hs->Add(hTTW);
  hs->Add(hTTZ);
  hs->Add(hWJets);
  hs->Add(hDYJets);
  hs->Add(hST);
  hs->Add(hTT);
  hs->Add(hQCD);

  if (BLIND) {
    for(int i=0;i<h[0]->GetNbinsX();i++) {
      if (h[0]->GetBinCenter(i+1) > BLIND_MIN && h[0]->GetBinCenter(i+1) < BLIND_MAX) {
        h[0]->SetBinContent(i+1,0);
        h[0]->SetBinError(i+1,0);
      } 
    }
  }

  TH1F *hRatio = (TH1F*)h[0]->Clone("Ratio");
  hRatio->SetLineWidth(2);
  hRatio->Divide(hBkg);

  TLegend *leg = new TLegend(0.86,0.55,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD,"QCD","F");
  leg->AddEntry(hTT,"TTbar","F");
  leg->AddEntry(hST,"ST","F");
  leg->AddEntry(hTTZ,"ttZ","F");
  leg->AddEntry(hTTW,"ttW","F");
  leg->AddEntry(hWJets,"WJets","F");
  leg->AddEntry(hDYJets,"ZJets","F");
  leg->AddEntry(hVV,"Diboson","F");
  leg->AddEntry(h[1],"ttHbb","L");
  leg->AddEntry(h[2],"ttHNonbb","L");
  
  if (SHAPE) {
    h[1]->SetFillStyle(3001);
    h[2]->SetFillStyle(3001);
    h[0]->Scale(1./h[0]->Integral());
    h[1]->Scale(1./h[1]->Integral());
    h[2]->Scale(1./h[2]->Integral());
    hQCD->Scale(1./hQCD->Integral());
    hBkg->Scale(1./hBkg->Integral());
    double max = TMath::Max(h[0]->GetBinContent(h[0]->GetMaximumBin()),hBkg->GetBinContent(hBkg->GetMaximumBin()));
    hBkg->SetMaximum(1.1*max);
    hBkg->GetXaxis()->SetTitle(XTITLE);
    hBkg->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hBkg->Draw("hist");
    h[0]->Draw("same E"); 
    //h[1]->Draw("same hist"); 
    leg->Draw();
    gPad->RedrawAxis();
    can->Print("can_"+VAR+"_norm.pdf"); 
  }
  else {
    can->SetBottomMargin(0.25);
    gPad->SetLogy(); 
    //h[1]->Scale(h[0]->Integral()/h[1]->Integral());
    h[1]->SetFillColor(0);
    TH1F *hAux = (TH1F*)h[0]->Clone("aux");
    hAux->Reset();
    hAux->GetYaxis()->SetRangeUser(0.5,1.1*TMath::Max(h[1]->GetBinContent(h[1]->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin()))); 
    
    hAux->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hAux->GetYaxis()->SetTitle(TString::Format("Number of events / %1.2f fb^{-1}",LUMI/1000));
    hAux->GetXaxis()->SetTitle("");
    hAux->GetXaxis()->SetLabelSize(0.0);
    hAux->Draw();
    hs->Draw("hist same"); 
    h[0]->Draw("same E");
    h[1]->Draw("same hist");
    h[2]->Draw("same hist");
    leg->Draw();
    gPad->RedrawAxis();

    TPad *pad = new TPad("pad","pad",0.,0.,1.,1.);
    pad->SetTopMargin(0.77);
    pad->SetRightMargin(0.15);
    pad->SetFillColor(0);
    pad->SetFillStyle(0);
    pad->Draw();
    pad->cd(0);
    pad->SetGridy();
    hRatio->GetXaxis()->SetTitleOffset(0.95);
    hRatio->GetYaxis()->SetTitleOffset(1.5);
    hRatio->GetYaxis()->SetTickLength(0.06);
    hRatio->GetYaxis()->SetTitleSize(0.03);
    hRatio->GetYaxis()->SetLabelSize(0.03);
    hRatio->GetYaxis()->SetTitle("Data/MC");
    hRatio->GetXaxis()->SetTitle(XTITLE);
    hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hRatio->GetYaxis()->SetRangeUser(0.5,1.5);
    hRatio->GetYaxis()->SetNdivisions(505);
    hRatio->Draw();
    if (PRINT) {
      can->Print("plots/can_"+VAR+"_abs.pdf"); 
      can->Print("plots/can_"+VAR+"_abs.png");
    }
  }
}
예제 #19
0
void vs_PlotQCDcomp() {

  Bool_t saveC  = false;
  Bool_t diJets = true;
  Bool_t isMC   = false;

  TString vsSave;
  vsSave = "_T07w";

  TString jSave;
  if(diJets) jSave = "2j";
  else       jSave = "3j";

  TString sample;
  if(diJets) sample = "select_1ph_2jets";
  else       sample = "select_1ph_3jets";

  TString FOtag;
  if(isMC) FOtag = "_FO_CorrMC";
  //  else     FOtag = "_FO_Corr";
  else     FOtag = "_FO";

  TString sysu = "SYSTUP_";
  TString sysd = "SYSTDOWN_";

  TString outDir;
  outDir = "Plots_PhotonSusyAnalysis/QCDweights/";


  //  string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/Merged_QCD_PhotonJet_T07w_PAT/mergedHistos.root";
  //  string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/Merged_Data_V05w_PAT/mergedHistos.root";
  string inputFile1 = "/data/user/vsola/CMSSW_Releases/CMSSW_5_3_9/src/Plots_PhotonSusyAnalysis/PhotonHadReReco_22Jan2013_V05_PAT/mergedHistos.root";
  
  
  setMyTDRStyle();
  gROOT->SetStyle("mytdrStyle");
  
  //  gStyle->SetHistMinimumZero();
  //  gStyle->SetPaintTextFormat("4.2f");

  gStyle->SetHistLineWidth(2);
  gStyle->UseCurrentStyle();

  //  gStyle->SetPadTopMargin(1.0);
  //  gStyle->SetPadLeftMargin(3.2);
  //  gStyle->SetPadRightMargin(4.5);
  //  gStyle->SetPadBottomMargin(3.2);

  gROOT->ForceStyle(1);


  static const Int_t nHt  =  7;
  static const Int_t nPt  = 13;
  static const Int_t nMet = 16;
  static const Int_t nJet = 15;

  Double_t binPt[nPt+1]   = {0.,75.,90.,120.,160.,210.,260.,320.,400.,500.,650.,800.,1000.,1500.};
  Double_t binHt[nHt+1]   = {0.,400.,450.,550.,700.,900.,1200.,1500.};
  Double_t binMet[nMet+1] = {0.,10.,20.,30.,40.,50.,60.,70.,80.,90.,100.,120.,160.,200.,270.,350.,500.};
  Double_t binJet[nJet+1] = {0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15};


  TLatex *as = new TLatex();
  as->SetNDC(true);
  as->SetTextColor(12);
  as->SetTextFont(43);
  as->SetTextSize(19);

  TLegend *legend = new TLegend(0.60, 0.70, 0.75, 0.85, "");
  legend->SetFillColor(10);
  legend->SetFillStyle(1001);
  legend->SetTextSize(0.04);
  legend->SetBorderSize(0);
  legend->SetShadowColor(0);

  std::string outLumi  = "CMS Work in Progress - QCD MC #sqrt{s} = 8 TeV - #geq 1 #gamma, #geq 2 j";

  TFile* f1 = TFile::Open( inputFile1.c_str() );

  //photon Pt
  TCanvas * cPt = new TCanvas("cPt","cPt");

  TH1F* hpt   = (TH1F*) f1->Get( sample+"/PreselCut_photonPt" );
  TH1F* hptFO = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_photonPt" );

  TH1F *hptR = (TH1F*) hpt->Rebin(nPt,hpt->GetTitle(),binPt);
  if (hptR->GetSumw2N() == 0)
    hptR->Sumw2();

  TH1F *hptFOR = (TH1F*) hptFO->Rebin(nPt,hptFO->GetTitle(),binPt);
  if (hptFOR->GetSumw2N() == 0)
    hptFOR->Sumw2();

  TH1F* hptSU = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_"+sysu+"photonPt" );
  TH1F* hptSD = (TH1F*) f1->Get( sample+FOtag+"/PreselCut_"+sysd+"photonPt" );

  TH1F *hptSUR = (TH1F*) hptSU->Rebin(nPt,hptSU->GetTitle(),binPt);
  if (hptSUR->GetSumw2N() == 0)
    hptSUR->Sumw2();

  TH1F *hptSDR = (TH1F*) hptSD->Rebin(nPt,hptSD->GetTitle(),binPt);
  if (hptSDR->GetSumw2N() == 0)
    hptSDR->Sumw2();

  if ( hptFOR != 0 ) {
    for (int b = 0; b < hptFOR->GetNbinsX(); b++) {

      Double_t mainHistoContent   = hptFOR->GetBinContent(b);
      Double_t systUpHistoContent = hptSUR->GetBinContent(b);
      Double_t systDnHistoContent = hptSDR->GetBinContent(b);
      Double_t systDiffUp = fabs( (double) systUpHistoContent - mainHistoContent );
      Double_t systDiffDn = fabs( (double) mainHistoContent - systDnHistoContent );

      // use average error for histogram
      Double_t systDiff = ( systDiffUp + systDiffDn ) / 2.;
      
      Double_t statErr   = hptFOR->GetBinError(b);
      Double_t combError = sqrt( systDiff * systDiff + statErr * statErr );
      hptFOR->SetBinError(b, combError);
    } //for
  }//if
    
  cPt->SetLogy(1);
  gPad->Update();
  cPt->Update();

  //  hptR->Scale(1,"width");
  //  hptR->SetMinimum(0.02);
  //  hptR->SetMaximum(1000); 
  hptR->GetXaxis()->SetTitle("1^{st} photon p_{T} [GeV]");
  hptR->GetYaxis()->SetTitle("Number of Events / GeV");

  if(isMC) hptR->SetMarkerSize(0);
  if(isMC) hptR->Draw("histE");
  else     hptR->Draw("E X0");


  hptFOR->SetMarkerSize(0);
  hptFOR->SetLineColor(2);
  hptFOR->SetFillColor(2);
  hptFOR->SetFillStyle(3004);
  hptFOR->Draw("same hist ][ E2");

  legend->Clear();
  if(isMC) legend->SetHeader("#gamma/QCD (Sim)");
  else     legend->SetHeader("#gamma/QCD (Data)");
  if(isMC) legend->AddEntry(hptR, "#gamma", "l");
  else     legend->AddEntry(hptR, "#gamma", "p");
  legend->AddEntry(hptFOR, "Pred (from #gamma_{jet})", "f");
  legend->Draw();

  as->DrawLatex(0.17, 0.93, outLumi.c_str() );
  cPt->Update();
  cPt->SetBottomMargin(0.2 + 0.8 * cPt->GetBottomMargin() - 0.2 * cPt->GetTopMargin());

  TPad *ratioPt = new TPad("BottomPad", "", 0, 0, 1, 1);
  ratioPt->SetTopMargin(0.8 - 0.8 * ratioPt->GetBottomMargin() + 0.2 * ratioPt->GetTopMargin());
  ratioPt->SetFillStyle(0);
  ratioPt->SetFrameFillColor(10);
  ratioPt->SetFrameBorderMode(0);
  ratioPt->Draw();

  ratioPt->cd();
  ratioPt->SetLogy(0);

  TH1F *hptRat = (TH1F*) divideHistosForRatio(hptR,hptFOR);
  hptRat->SetMinimum(0.);
  hptRat->SetMaximum(10.);
  hptRat->GetXaxis()->SetNdivisions(505);
  if(isMC) hptRat->GetYaxis()->SetTitle("Sim/Pred");
  else     hptRat->GetYaxis()->SetTitle("Data/Pred");
  hptRat->GetYaxis()->SetTitleSize(0.04);
  hptRat->GetYaxis()->SetLabelSize(0.03);
  hptRat->GetYaxis()->SetTitleOffset(1.3);
  hptRat->GetYaxis()->SetNdivisions(505);
  hptRat->SetMarkerStyle(20);
  hptRat->SetMarkerSize(1);
  hptRat->SetMarkerColor(1);
  hptRat->SetLineColor(1);
  hptRat->Draw("E X0");

  TH1F *hptFRat = (TH1F*) getSystErrForRatio(hptFOR);
  hptFRat->SetLineColor(2);
  hptFRat->SetFillColor(2);
  hptFRat->SetFillStyle(3004);
  hptFRat->Draw("same hist ][ E2");


  TLine * line = new TLine( hptRat->GetXaxis()->GetXmin(), 1., hptRat->GetXaxis()->GetXmax(), 1. );
  line->SetLineColor(1);
  line->SetLineWidth(0.5);
  line->SetLineStyle(1);
  line->Draw("same");

  hptR->GetXaxis()->SetLabelSize(0);
  hptR->GetXaxis()->SetTitle("");
  cPt->RedrawAxis();
  gPad->Update();
  cPt->Update();


  return;
}
void GE11sEfficiencyScan(int RunNumber, string RunName, string path)
{
   
   ifstream InGE11_IV_GIF, InGE11_IV, InGE11_V;

   //string path = "/home/ramkrishna/TEMP/LogFiles_TB/LogFiles306To407";	    

   string gif	= path+"/Efficiency_LC1_"+std::to_string(RunNumber)+".log";
   string IV	= path+"/Efficiency_LC2_"+std::to_string(RunNumber)+".log";
   string V	= path+"/Efficiency_LC3_"+std::to_string(RunNumber)+".log";

   cout<<"gif = "<<gif<<endl;
   InGE11_IV_GIF.open(gif);
   InGE11_IV.open(IV);
   InGE11_V.open(V);

   string rootFile = "Efficiency_Run"+std::to_string(RunNumber)+".root";
   const char *CharrootFile = rootFile.c_str();
   TFile *f = new TFile(CharrootFile,"RECREATE");
   //TTree *tree = new TTree("Run306", "Detector info for Run 306");
   TNtuple *GE11_IV_GIF = new TNtuple("GE11_IV_GIF","data from text file LC1","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");
   TNtuple *GE11_IV = new TNtuple("GE11_IV","data from text file LC2","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");
   TNtuple *GE11_V = new TNtuple("GE11_V","data from text file LC3","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");

   Int_t nlines = 0;

   vector<double> GIF_MeanPosOfSector, GIF_Efficiency, GIF_EfficiencyError;
   vector<unsigned int> GIF_Nevents;
   unsigned int temp_Nevents;
   double temp_MeanPosOfSector, temp_Efficiency, temp_EfficiencyError;

   vector<double> IV_MeanPosOfSector, IV_Efficiency, IV_EfficiencyError;
   vector<unsigned int> IV_Nevents;

   vector<double> V_MeanPosOfSector, V_Efficiency, V_EfficiencyError;
   vector<unsigned int> V_Nevents;

   string NameOfDet, xRange;

   while (1) 
   {
     InGE11_IV_GIF >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_IV_GIF.good()) break;

     GIF_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     GIF_Efficiency.push_back(temp_Efficiency);
     GIF_EfficiencyError.push_back(temp_EfficiencyError);
     GIF_Nevents.push_back(temp_Nevents);
    	GE11_IV_GIF->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
	if (nlines > 20) 
	{
	    cout<<"Check the input text file for run number "<< RunNumber << endl;
	    exit(EXIT_SUCCESS);
	}
   }

   InGE11_IV_GIF.close();
   nlines=0;
   while (1) 
   {
     InGE11_IV >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_IV.good()) break;

     IV_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     IV_Efficiency.push_back(temp_Efficiency);
     IV_EfficiencyError.push_back(temp_EfficiencyError);
     IV_Nevents.push_back(temp_Nevents);
    	GE11_IV->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
   }

   InGE11_IV.close();
   nlines=0;
   while (1) 
   {
     InGE11_V >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_V.good()) break;

     V_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     V_Efficiency.push_back(temp_Efficiency);
     V_EfficiencyError.push_back(temp_EfficiencyError);
     V_Nevents.push_back(temp_Nevents);
    	GE11_V->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
   }

   InGE11_V.close();
   string CanvasName = "RunNumber"+std::to_string(RunNumber);
   const char * CharCanvasName = CanvasName.c_str();
   TCanvas* c1 = new TCanvas(CharCanvasName,"Efficiency Scan Plot",200,10,700,500);
   TPad *pad = new TPad("pad","",0,0,1,1);
   //pad->SetFillColor(42);
   pad->SetGrid();
   pad->Draw();
   pad->cd();

      // draw a frame to define the range
   TH1F *hr = pad->DrawFrame(0,-0.5,100,1.1);
   hr->SetXTitle("Detector Position (mm)");
   hr->SetYTitle("Efficiency");
   //pad->GetFrame()->SetFillColor(21);
   pad->GetFrame()->SetBorderSize(12);

      // create first graph
   TGraphErrors *gr_GIF = new TGraphErrors(V_Efficiency.size());
   TGraphErrors *gr_IV = new TGraphErrors(V_Efficiency.size());
   TGraphErrors *gr_V = new TGraphErrors(V_Efficiency.size());
   for(unsigned int i=0;i<V_Efficiency.size();i++)
   {
       gr_GIF->SetPoint(i, GIF_MeanPosOfSector[i], GIF_Efficiency[i]);
       gr_GIF->SetPointError(i,0, GIF_EfficiencyError[i]);
       
       gr_IV->SetPoint(i, IV_MeanPosOfSector[i], IV_Efficiency[i]);
       gr_IV->SetPointError(i,0, IV_EfficiencyError[i]);

       gr_V->SetPoint(i, V_MeanPosOfSector[i], V_Efficiency[i]);
       gr_V->SetPointError(i,0, V_EfficiencyError[i]);
   }
   gr_GIF->SetMarkerColor(kBlue);
   gr_GIF->SetLineColor(kBlue);
   gr_GIF->SetMarkerStyle(21);
   gr_GIF->GetXaxis()->SetTitle("dist (mm)");
   gr_GIF->GetYaxis()->SetTitle("Efficiency");
   gr_GIF->GetYaxis()->SetRangeUser(0,1.2);
   gr_GIF->SetTitle("Efficiency Scan");
   gr_GIF->Draw("ACP");
   gr_IV->SetMarkerColor(kGreen-6);
   gr_IV->SetLineColor(kGreen);
   gr_IV->SetMarkerStyle(21);
   gr_IV->Draw("sameCP");
   gr_V->SetMarkerColor(kBlack);
   gr_V->SetLineColor(kBlack);
   gr_V->SetMarkerStyle(21);
   gr_V->Draw("sameCP");

   //create a transparent pad drawn on top of the main pad
   c1->cd();
   TPad *overlay = new TPad("overlay","",0,0,1,1);
   overlay->SetFillStyle(4000);
   overlay->SetFillColor(0);
   overlay->SetFrameFillStyle(4000);
   overlay->Draw();
   overlay->cd();
   // create second graph
   //TGraphErrors* gr_GIF_Num = new TGraphErrors("data_noerror.dat","%lg %lg");
   TGraphErrors *gr_GIF_Num = new TGraphErrors(GIF_Nevents.size());
   TGraphErrors *gr_IV_Num = new TGraphErrors(IV_Nevents.size());
   TGraphErrors *gr_V_Num = new TGraphErrors(V_Nevents.size());

   for(unsigned int i=0;i<V_MeanPosOfSector.size();i++)
   {
       gr_GIF_Num->SetPoint(i,GIF_MeanPosOfSector[i],GIF_Nevents[i]);
       gr_IV_Num->SetPoint(i,IV_MeanPosOfSector[i],IV_Nevents[i]);
       gr_V_Num->SetPoint(i,V_MeanPosOfSector[i],V_Nevents[i]);

   }
   gr_GIF_Num->SetMarkerColor(kBlue);
   gr_GIF_Num->SetLineColor(kBlue);
   gr_GIF_Num->SetLineStyle(2);
   gr_GIF_Num->SetLineWidth(3);
   gr_GIF_Num->SetMarkerStyle(22);
   gr_GIF_Num->SetName("gr_GIF_Num");

   gr_IV_Num->SetMarkerColor(kGreen-6);
   gr_IV_Num->SetLineColor(kGreen);
   gr_IV_Num->SetMarkerStyle(22);
   gr_IV_Num->SetLineStyle(2);
   gr_IV_Num->SetLineWidth(3);
   gr_IV_Num->SetName("gr_IV_Num");

   gr_V_Num->SetMarkerColor(kBlack);
   gr_V_Num->SetLineColor(kBlack);
   gr_V_Num->SetMarkerStyle(22);
   gr_V_Num->SetLineStyle(2);
   gr_V_Num->SetLineWidth(3);
   gr_V_Num->SetName("gr_V_Num");

   Double_t xmin = pad->GetUxmin();
   Double_t ymin = 0;
   Double_t xmax = pad->GetUxmax();
   Double_t ymax = 1550;
   TH1F *hframe = overlay->DrawFrame(xmin,ymin,xmax,ymax);
   hframe->GetXaxis()->SetLabelOffset(99);
   hframe->GetYaxis()->SetLabelOffset(99);
   hframe->Draw("Y+");
   
   gr_GIF_Num->Draw("CPY+");
   gr_IV_Num->Draw("CPY+");
   gr_V_Num->Draw("CPY+");

   //Draw the Legend 
   TLegend *leg = new TLegend(0.10,0.732,0.40,0.90);
   leg->AddEntry(gr_GIF,"GE11_IV_GIF eff","LPE");
   leg->AddEntry(gr_IV,"GE11_IV eff","LPE");
   leg->AddEntry(gr_V,"GE11_V eff","LPE");
   leg->AddEntry(gr_GIF_Num,"No of events_GE11_IV_GIF","LPE");
   leg->AddEntry(gr_IV_Num,"No of events_GE11_IV","LPE");
   leg->AddEntry(gr_V_Num,"No of events_GE11_V","LPE");

   leg->Draw("same");

   const char *runnum = RunName.c_str();
   
   TLatex *t2a = new TLatex(0.00,0.94, runnum  );
   t2a->SetNDC();
   t2a->SetTextFont(42);
   t2a->SetTextSize(0.033);
   t2a->SetTextAlign(13);
   t2a->Draw("same");
   
   
   //Draw an axis on the right side
   TGaxis *axis = new TGaxis(xmax,ymin,xmax, ymax,ymin,ymax,510,"+L");
   axis->SetLineColor(kRed);
   axis->SetLabelColor(kRed);
   axis->SetTitle("Approx. No. of Events");

   axis->Draw();

   string OutputFileName = "GE11_Efficiency_Scan_"+std::to_string(RunNumber)+".pdf";
   const char *CharOutputFileName = OutputFileName.c_str();
   c1->SaveAs(CharOutputFileName);

   c1->Write();
   //tree->Write();
   //tree->Write("", TObject::kOverwrite);
   f->Write();

}
예제 #21
0
파일: talk.C 프로젝트: bainbrid/usercode
// -----------------------------------------------------------------------------
//
void talk() {
  
  time_t start = TTimeStamp().GetSec();

  bool draw = true;
  bool debug = true;
  
  // Binning
  int xbins = 100;
  int ybins = 100;
  double xmin = 0.0;
  double xmax = 1.0;
  double ymin = 0.0;
  double ymax = 1.0;
  double xbin_centre = ( ( xmax - xmin ) / xbins ) / 2.;
  double ybin_centre = ( ( ymax - ymin ) / ybins ) / 2.;
  
  // AlphaT values
  const int nat = 1;
  double at[nat];
  for ( int ii = 0; ii < nat; ++ii ) { at[ii] = 0.55 + ii * 0.001; } 
  
  // HT regions
  const int nht = 3;
  double ht_min[nht] = { 250., 300., 350. };

  // Jet pT thresholds
  double pt1_min[nht] = { 71.4, 85.7, 100. };
  double pt2_min[nht] = { 71.4, 85.7, 100. };
  double pt3_min[nht] = { 35.7, 42.9., 50. };

  // x fractions
  double x1_min[nht];
  double x2_min[nht];
  double x3_max[nht];
  for ( int ii = 0; ii < nht; ++ii ) { x1_min[ii] = ( 2. * pt1_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  for ( int ii = 0; ii < nht; ++ii ) { x2_min[ii] = ( 2. * pt2_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  for ( int ii = 0; ii < nht; ++ii ) { x3_max[ii] = ( 2. * pt3_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  
  // Loop through bins 
  int loop = 0;
  int nloops = nht;
  for ( int iht = 0; iht < nht; ++iht ) {
    std::cout << "Completed " 
	      << 100.*float(loop)/float(nloops) 
	      << "%..." 
	      << std::endl; 
    loop++;
    
    // Labeling
    std::stringstream ss;
    ss << "HT" << int(ht_min[iht]);
	  
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
	  
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(0.,0.,1.,1.);

    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "H_{T}=" << ht_min[iht]
	  << "(p_{T1},p_{T2},p_{T3})=" 
	  << pt1_min[iht] << ","
	  << pt2_min[iht] << ","
	  << pt3_min[iht] << ")"
	  << ", (x_{1},x_{2},x_{3})=" 
	  << x1_min[iht] << ","
	  << x2_min[iht] << ","
	  << x3_max[iht] << ")";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
	  
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     xbins,xmin,xmax,
			     ybins,ymin,ymax);
	  
    // Fill 2D cross-section plot
    for ( int xbin = 0; xbin < xbins; ++xbin ) { 
      for ( int ybin = 0; ybin < ybins; ++ybin ) { 
	double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin;
	double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin;
	double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) ); 
	      
	if ( !constrain( x1, x2, x3 ) ) { continue; }
	      
	if ( x1 < x1_cut[ix1] ) { continue; }
	      
	double alpha_t =  x2 / ( 2 * sqrt(x1+x2-1) );
	if (his) his->Fill( x2+xbin_centre, x1+ybin_centre, val ); 
      }
    }
	  
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      his->SetMaximum( his->GetMaximum() );
      his->SetMinimum( his->GetMinimum(1.e-12) );
      his->Draw("COLZsame");
    }

    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t iat = 0; iat < nat; iat++ ) {
	Double_t alpha_t = at[iat];
	const Int_t n_ = 100;
	Double_t x1_[n_];
	Double_t x2_[n_];
	for ( Int_t j = 0; j < 100; j++ ) {
	  x2_[j] = j*0.01;
	  Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t );
	  x1_[j] = temp * temp + 1 - alpha_t * alpha_t;
	}
	TGraph* gr = new TGraph(n_,x2_,x1_);
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
	  
  }

}
예제 #22
0
void plottingmacro_IVF()
{


  double fa = 0.46502;
  double fb = 0.53498;
  bool debug_ = true;

  //  std::string path("Nov10thFall11Plots/");
  //  std::string path("Nov10Fall1160MTopSlimPlots/");
  std::string path("Nov10Fall1160MTopIVFPlots_b/");

  if(debug_)
    std::cout << "Init the style form setTDRStyle" << std::endl;
  setTDRStyle();
  gStyle->SetErrorX(0.5);
  gROOT->ForceStyle();
  initOptions();
  

  if(debug_)
    std::cout << "Init the sample" << std::endl;
  //  std::vector<Sample> s = Nov10thDiJetPtUpdatedSlimHistos();
  //std::vector<Sample> s = Nov10Fall1160MTopSlimHistos();
  std::vector<Sample> s = Nov10Fall1160MTopIVFHistos();

  Sample data(1,"fake data","S1.root",0,true,1000);

  if(debug_)
    std::cout << "Init the data sample" << std::endl;
  for(size_t i=0;i< s.size();i++) if(s[i].data) {data=s[i];break;}

  if(debug_)
    std::cout << "Ls data sample" << std::endl;
  data.file()->ls(); 

  if(debug_)
    std::cout << "Init the mc sample" << std::endl;
  for(size_t i=0;i< s.size();i++) s[i].dump(1,fa,fb);

  std::vector<std::string> names;

  if(debug_)
    std::cout << "Get List of Keys" << std::endl;
  TList * subs = data.file()->GetListOfKeys();
  for(size_t i=0;i< subs->GetSize();i++)
    {
      TString nn = subs->At(i)->GetName();
      if( nn.Contains(TRegexp("Count*")) )
	continue;
      if(debug_)
	std::cout << "Get List of Keys in subdirs" << std::endl;
      TList * objs = ((TDirectoryFile *)data.file()->Get(subs->At(i)->GetName()))->GetListOfKeys();
      for(size_t j=0;j< objs->GetSize();j++)
	{
	  if(debug_)
	    std::cout << "Name = " << subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName() << std::endl;
	  names.push_back(subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName());
	  //      std::cout << subs->At(i)->GetName() << "/"  << objs->At(j)->GetName() << std::endl;
	  //TODO: select plots via regexp
	}
    }


  if(debug_)
    std::cout << "Starting plotting" << std::endl;

  std::string process;

  for(size_t i = 0 ; i < names.size() ; i++) 
    {
      
      std::map<std::string,TH1F *> grouped;
      TString n=names[i];
      //      if(!n.Contains(TRegexp("VlightRegionHZee/HiggsPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee/ZPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZmmSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZeeSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVPureRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVTTbarPureRegionZcombSV"))) continue;
      if(!n.Contains(TRegexp("TTbarRegionZeeSVJets"))) continue;

      if(n.Contains(TRegexp("RegionHZcomb")))
	process = "Z(l^{+}l^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZmm")))
	process = "Z(#mu^{+}#mu^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZee")))
	process = "Z(e^{+}e^{-})H(b#bar{b})";

      if(debug_)
	std::cout << "Creating the Canvas" << std::endl;

      TCanvas *c = new TCanvas();
      c->SetLogy(false);
      c->SetTitle(names[i].c_str());

      if(debug_)
	std::cout << "Creating histograms" << std::endl;
  
      TH1F *hd = ((TH1F*)data.file()->Get(names[i].c_str()));
      hd->Sumw2();
      Options o=options[names[i]];
      //      hd->Rebin(o.rebin);
      hd->SetMarkerStyle(20);
      hd->GetXaxis()->SetLabelOffset(99);
      hd->SetYTitle(o.yaxis.c_str());
      double nbin = hd->GetNbinsX();
      double min_bin = hd->GetXaxis()->GetXmin();
      double max_bin = hd->GetXaxis()->GetXmax();
      TH1F *hmc = new TH1F("hmc","hmc", nbin, min_bin, max_bin);
      hmc->SetFillColor(kWhite);
      hmc->Sumw2();
      //      hmc->Rebin(o.rebin);

      if(debug_)
	std::cout << "Creating the THStack and Legend" << std::endl;
      THStack * sta = new THStack("sta",hd->GetTitle());
      TLegend * l = new TLegend(o.legendx1,o.legendy1,o.legendx2,o.legendy2); //0.7,0.1,0.9,0.6);
      l->SetFillColor(kWhite);
      l->SetBorderSize(0);
      l->SetTextFont(62);
      l->SetTextSize(0.03);
      if(debug_)
	std::cout << "Adding data to the legend" << std::endl;  
      l->AddEntry(hd, "Data","P");
      if(debug_)
	std::cout << "Adding MC to the THStack" << std::endl;  

      //with the proper trigger eff
      //      double SF[] = {1.01,1.03,1.00};
      //      double SF[] = {1.03,1.054,1.032};
      double SF[] = {1.0,1.0,1.0};

      if(debug_){
	for(int i = 0; i< 3; ++i)
	  std::cout << "SF [" << i << "] = " << SF[i] << std::endl;
      }

      double mcIntegral=0;
      for(size_t j=0;j< s.size() ;j++) 
	{ 
	  if(!s[j].data) 
	    {
	      if(debug_)
		std::cout << "Creating TH1F from file " << s[j].name << std::endl;  
	      TH1F * h = ((TH1F*)s[j].file()->Get(names[i].c_str()));
	      h->Sumw2();
	      if(debug_){
		std::cout << "TH1F created from file " << s[j].name << std::endl;  
		std::cout << "Scaling : " << s[j].scale(data.lumi(),fa,fb) << std::endl;  
		std::cout << "Scaling with SF : " << s[j].scale(data.lumi(),fa,fb,SF) << std::endl;  
		std::cout << "Histo integral before scaling = " << h->Integral() << std::endl;
	      }
	      h->Scale(s[j].scale(data.lumi(),fa,fb,SF));
	      if(debug_){
		std::cout << "Histo integral after scaling = " << h->Integral() << std::endl;
		std::cout << "Managing style... " << std::endl;  
	      }
	      h->SetLineWidth(1.);
	      h->SetFillColor(s[j].color);
	      h->SetLineColor(s[j].color);
	      //	      h->Rebin(options[names[i]].rebin);
	      if(debug_)
		std::cout << "Cloning and update legend " << std::endl;  
	      if(grouped.find(s[j].name) == grouped.end()){
		l->AddEntry(h,s[j].name.c_str(),"F");
	      }
	      std::cout << "Sample : " << s[j].name << " - Integral for plot " << names[i] << " = " << h->Integral(-10000,10000) << std::endl;
	      mcIntegral += h->Integral();
	      sta->Add(h);
	      hmc->Add(h);	      
	      //TO FIX grouped map
	      // sovrascrive histo con lo stesso nome tipo VV o ST etc...
	      grouped[s[j].name]=(TH1F *)h->Clone(("_"+names[i]).c_str());
	    }
	}

      if(debug_){
	std::cout << "Data total = " << hd->Integral() << std::endl;
	std::cout << "MC = " << mcIntegral << std::endl;
	std::cout << "Data/MC = " << hd->Integral()/mcIntegral << std::endl;
      }

      TPad * TopPad = new TPad("TopPad","Top Pad",0.,0.3,1.,1. ) ;
      TPad * BtmPad = new TPad("BtmPad","Bottom Pad",0.,0.,1.,0.313 ) ;
      TopPad->SetBottomMargin(0.02);
      BtmPad->SetTopMargin(0.0);
      BtmPad->SetFillStyle(4000);
      TopPad->SetFillStyle(4000);
      BtmPad->SetFillColor(0);
      BtmPad->SetBottomMargin(0.35);
      TopPad->Draw() ;
      BtmPad->Draw() ;
      std::cout << "hd maximum = " << hd->GetMaximum() << "  sta maximum = " << sta->GetMaximum() << std::endl;
      double maxY;
      if(hd->GetMaximum() > sta->GetMaximum()) maxY = (hd->GetMaximum())*1.5;
      else maxY = (sta->GetMaximum())*1.5;
      TopPad->cd();
      hd->Draw("E1X0");
      sta->Draw("sameHIST");
      hmc->Draw("sameE2");
      hmc->SetFillColor(2);
      hmc->SetMarkerSize(0);
      hmc->SetFillStyle(3013);
      hd->Draw("E1X0same");
      l->Draw("same");
      std::cout << "Set Maximum to = " << maxY << std::endl;
      hd->GetYaxis()->SetRangeUser(0.,maxY);
      hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);

      BtmPad->cd();
      std::cout << "Division" << std::endl;

      TH1D * divisionErrorBand = (TH1D*)(hmc)->Clone("divisionErrorBand");
      divisionErrorBand->Sumw2();
      divisionErrorBand->Divide(hmc);
      divisionErrorBand->Draw("E2");      
      divisionErrorBand->SetMaximum(2.49);
      divisionErrorBand->SetMinimum(0);
      divisionErrorBand->SetMarkerStyle(20);
      divisionErrorBand->SetMarkerSize(0.55);
      divisionErrorBand->GetXaxis()->SetTitleOffset(1.12);
      divisionErrorBand->GetXaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetXaxis()->SetTitleSize(0.5);
      divisionErrorBand->GetYaxis()->SetTitle("Data/MC");
      divisionErrorBand->GetYaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleOffset(0.40);
      divisionErrorBand->GetYaxis()->SetNdivisions(505);
      //divisionErrorBand->UseCurrentStyle();
      divisionErrorBand->SetFillColor(2);
      divisionErrorBand->SetFillStyle(3001);
      divisionErrorBand->SetMarkerSize(0.);

      TH1D * division = (TH1D*)(hd)->Clone("division");
      division->Sumw2();
      division->Divide(hmc);
//       division->SetMaximum(2.5);
//       division->SetMinimum(0);
//       division->SetMarkerStyle(20);
//       division->SetMarkerSize(0.55);
//       division->GetXaxis()->SetLabelSize(0.12);
//       division->GetXaxis()->SetTitleSize(0.14);
//       division->GetYaxis()->SetLabelSize(0.10);
//       division->GetYaxis()->SetTitleSize(0.10);
//      division->GetYaxis()->SetTitle("Data/MC");
      Double_t min = division->GetXaxis()->GetXmin();
      Double_t max = division->GetXaxis()->GetXmax();
      division->Draw("E1X0same");

      TLine *line = new TLine(min, 1.0, max, 1.0);
      line->SetLineColor(kRed);
      line->Draw("same");
      
      TLegend * leg3 =new TLegend(0.50,0.86,0.69,0.96);
      leg3->AddEntry(divisionErrorBand,"MC uncert. (stat.)","f");
      leg3->SetFillColor(0);
      leg3->SetLineColor(0);
      leg3->SetShadowColor(0);
      leg3->SetTextFont(62);
      leg3->SetTextSize(0.06);
      leg3->Draw();

      TPaveText *pave = new TPaveText(0.15,0.85,0.32,0.96,"brNDC");
      pave->SetTextAlign(12);
      pave->SetLineColor(0);
      pave->SetFillColor(0);
      pave->SetShadowColor(0);
      //TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",histDt->Chi2Test(histCopyMC5,"UWCHI2/NDF"),histDt->KolmogorovTest(histCopyMC5))); // stat + sys
      TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",hd->Chi2Test(hmc,"UWCHI2/NDF"),hd->KolmogorovTest(hmc))); // stat only
      text->SetTextFont(62);
      text->SetTextSize(0.08);
      pave->Draw();

      TopPad->cd();
      TLatex latex;
      latex.SetNDC();
      latex.SetTextAlign(12);
      latex.SetTextSize(0.052);
      latex.DrawLatex(0.17,0.89,"CMS Preliminary");
      latex.SetTextSize(0.04);
      latex.DrawLatex(0.17,0.84,"#sqrt{s} = 7 TeV, L = 4.7 fb^{-1}");
      //      latex.DrawLatex(0.17,0.79,"Z(e^{+}e^{-})H(b#bar{b})");
      latex.DrawLatex(0.17,0.79,process.c_str());
      c->Update();
      std::string cName= hd->GetName();
      cName += "_bare.pdf";
      cName = path+cName;
      c->Print(cName.c_str(),"pdf");

//       std::cout << names[i] << " d: " <<  hd->Integral() << " ";
//       THStack * sta2 = new THStack("sta2",hd->GetTitle());
//       float tot=0;
//       float toterr2=0;

//       if(debug_)
// 	std::cout << "Putting the iterator in the for loop" << std::endl;
//       for(std::map<std::string,TH1F *>::reverse_iterator it=grouped.rbegin(); it!=grouped.rend();++it)
//  	{
// 	  if(debug_)
// 	    std::cout << "Using the iterator" << std::endl;
// 	  std::cout << (*it).first << " " << (*it).second->Integral() << " | " << std::endl ;
// 	  if((*it).second->GetEntries() > 0) {
// 	    float er=1.*sqrt((*it).second->GetEntries())/(*it).second->GetEntries()*(*it).second->Integral();
// 	    toterr2+=er*er;
// 	  }
// 	  tot+=(*it).second->Integral();
// 	  sta2->Add(it->second);
//  	}
//       std::cout << " Tot: " << tot << "+-" << sqrt(toterr2) <<  " SF: " << hd->Integral()/tot << std::endl;
//       TCanvas *c2 = new TCanvas();
//       c2->SetTitle(names[i].c_str());
//       std::cout << "hd maximum = " << hd->GetMaximum() << "  sta2 maximum = " << sta2->GetMaximum() << std::endl;
//       if(hd->GetMaximum() > sta2->GetMaximum()) maxY =  hd->GetBinContent(hd->GetMaximumBin()) * 1.5;
//       else maxY = ( sta2->GetMaximum())*1.5;
//       //      hd->Draw("E1"); 
//       sta2->Draw("PADSHIST");
//       //    hd->Draw("E1same");
//       //      l->Draw("same");
//       std::cout << "Set Maximum to = " << maxY << std::endl;
//       hd->GetYaxis()->SetRangeUser(0.,maxY);
//       hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);
//       c2->Update();

//       std::string c2Name = hd->GetName();
//       c2Name = path+c2Name;
//       c2Name += "_norm.pdf";
//       c2->Print(c2Name.c_str(),"pdf");  

    }

}
예제 #23
0
void zj_dphi_8TeV_log()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Thu Apr 28 10:19:34 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,800,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: bottomPad
   TPad *bottomPad = new TPad("bottomPad", "bottomPad",0.005,0.05,0.995,0.995);
   bottomPad->Draw();
   bottomPad->cd();
   bottomPad->Range(0,0,1,1);
   bottomPad->SetFillColor(0);
   bottomPad->SetFillStyle(4000);
   bottomPad->SetBorderMode(0);
   bottomPad->SetBorderSize(2);
   bottomPad->SetTickx(1);
   bottomPad->SetTicky(1);
   bottomPad->SetLeftMargin(0.14);
   bottomPad->SetRightMargin(0.05);
   bottomPad->SetTopMargin(0.05);
   bottomPad->SetBottomMargin(0.16);
   bottomPad->SetFrameLineWidth(2);
   bottomPad->SetFrameBorderMode(0);
   bottomPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(-0.5429913,-2.062865,3.335518,1.327192);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetLogy();
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.33);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   
   TH1F *z_dphi_toterr__37 = new TH1F("z_dphi_toterr__37","z_dphi",6,0,3.141593);
   z_dphi_toterr__37->SetBinContent(1,0.261202);
   z_dphi_toterr__37->SetBinContent(2,0.3162337);
   z_dphi_toterr__37->SetBinContent(3,0.3852335);
   z_dphi_toterr__37->SetBinContent(4,0.7150939);
   z_dphi_toterr__37->SetBinContent(5,1.796506);
   z_dphi_toterr__37->SetBinContent(6,7.258657);
   z_dphi_toterr__37->SetBinContent(7,3.800624);
   z_dphi_toterr__37->SetBinError(1,0.03375302);
   z_dphi_toterr__37->SetBinError(2,0.03634611);
   z_dphi_toterr__37->SetBinError(3,0.0427511);
   z_dphi_toterr__37->SetBinError(4,0.05747346);
   z_dphi_toterr__37->SetBinError(5,0.1278198);
   z_dphi_toterr__37->SetBinError(6,0.3295685);
   z_dphi_toterr__37->SetBinError(7,0.1725617);
   z_dphi_toterr__37->SetEntries(14);
   z_dphi_toterr__37->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr__37->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr__37->SetLineColor(ci);
   z_dphi_toterr__37->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr__37->SetMarkerColor(ci);
   z_dphi_toterr__37->SetMarkerStyle(0);
   z_dphi_toterr__37->GetXaxis()->SetNdivisions(4);
   z_dphi_toterr__37->GetXaxis()->SetLabelFont(132);
   z_dphi_toterr__37->GetXaxis()->SetLabelOffset(999);
   z_dphi_toterr__37->GetXaxis()->SetLabelSize(0);
   z_dphi_toterr__37->GetXaxis()->SetTitleSize(0.06);
   z_dphi_toterr__37->GetXaxis()->SetTitleFont(132);
   z_dphi_toterr__37->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   z_dphi_toterr__37->GetYaxis()->SetLabelFont(132);
   z_dphi_toterr__37->GetYaxis()->SetLabelSize(0.05);
   z_dphi_toterr__37->GetYaxis()->SetTitleSize(0.06);
   z_dphi_toterr__37->GetYaxis()->SetTitleOffset(1.3);
   z_dphi_toterr__37->GetYaxis()->SetTitleFont(132);
   z_dphi_toterr__37->GetZaxis()->SetLabelFont(132);
   z_dphi_toterr__37->GetZaxis()->SetLabelSize(0.05);
   z_dphi_toterr__37->GetZaxis()->SetTitleSize(0.06);
   z_dphi_toterr__37->GetZaxis()->SetTitleFont(132);
   z_dphi_toterr__37->Draw("e2");
   
   TH1F *z_dphi_staterr__38 = new TH1F("z_dphi_staterr__38","z_dphi",6,0,3.141593);
   z_dphi_staterr__38->SetBinContent(1,0.261202);
   z_dphi_staterr__38->SetBinContent(2,0.3162337);
   z_dphi_staterr__38->SetBinContent(3,0.3852335);
   z_dphi_staterr__38->SetBinContent(4,0.7150939);
   z_dphi_staterr__38->SetBinContent(5,1.796506);
   z_dphi_staterr__38->SetBinContent(6,7.258657);
   z_dphi_staterr__38->SetBinContent(7,3.800624);
   z_dphi_staterr__38->SetBinError(1,0.01764622);
   z_dphi_staterr__38->SetBinError(2,0.01951211);
   z_dphi_staterr__38->SetBinError(3,0.02108379);
   z_dphi_staterr__38->SetBinError(4,0.03021233);
   z_dphi_staterr__38->SetBinError(5,0.04899558);
   z_dphi_staterr__38->SetBinError(6,0.1002775);
   z_dphi_staterr__38->SetBinError(7,0.05250516);
   z_dphi_staterr__38->SetEntries(14);
   z_dphi_staterr__38->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   z_dphi_staterr__38->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   z_dphi_staterr__38->SetLineColor(ci);
   z_dphi_staterr__38->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   z_dphi_staterr__38->SetMarkerColor(ci);
   z_dphi_staterr__38->SetMarkerStyle(0);
   z_dphi_staterr__38->GetXaxis()->SetNdivisions(4);
   z_dphi_staterr__38->GetXaxis()->SetLabelFont(132);
   z_dphi_staterr__38->GetXaxis()->SetLabelOffset(999);
   z_dphi_staterr__38->GetXaxis()->SetLabelSize(0);
   z_dphi_staterr__38->GetXaxis()->SetTitleSize(0.06);
   z_dphi_staterr__38->GetXaxis()->SetTitleFont(132);
   z_dphi_staterr__38->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   z_dphi_staterr__38->GetYaxis()->SetLabelFont(132);
   z_dphi_staterr__38->GetYaxis()->SetLabelSize(0.05);
   z_dphi_staterr__38->GetYaxis()->SetTitleSize(0.06);
   z_dphi_staterr__38->GetYaxis()->SetTitleFont(132);
   z_dphi_staterr__38->GetZaxis()->SetLabelFont(132);
   z_dphi_staterr__38->GetZaxis()->SetLabelSize(0.05);
   z_dphi_staterr__38->GetZaxis()->SetTitleSize(0.06);
   z_dphi_staterr__38->GetZaxis()->SetTitleFont(132);
   z_dphi_staterr__38->Draw("e2same");
   
   Double_t dphi_toterrs_fx3043[6] = {
   0.3403392,
   0.863938,
   1.387537,
   1.911136,
   2.434734,
   2.958333};
   Double_t dphi_toterrs_fy3043[6] = {
   0.1926519,
   0.2207154,
   0.3546338,
   0.6864677,
   2.01515,
   7.779723};
   Double_t dphi_toterrs_felx3043[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t dphi_toterrs_fely3043[6] = {
   0.03415733,
   0.03577312,
   0.05682396,
   0.09598937,
   0.1897309,
   0.5023379};
   Double_t dphi_toterrs_fehx3043[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t dphi_toterrs_fehy3043[6] = {
   0.04673612,
   0.05211068,
   0.07287587,
   0.1207667,
   0.143423,
   0.3949306};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(6,dphi_toterrs_fx3043,dphi_toterrs_fy3043,dphi_toterrs_felx3043,dphi_toterrs_fehx3043,dphi_toterrs_fely3043,dphi_toterrs_fehy3043);
   grae->SetName("dphi_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_dphi_toterrs3043 = new TH1F("Graph_dphi_toterrs3043","",100,0.07853982,3.220132);
   Graph_dphi_toterrs3043->SetMinimum(0.1426451);
   Graph_dphi_toterrs3043->SetMaximum(8.976269);
   Graph_dphi_toterrs3043->SetDirectory(0);
   Graph_dphi_toterrs3043->SetStats(0);
   Graph_dphi_toterrs3043->SetLineWidth(2);
   Graph_dphi_toterrs3043->SetMarkerStyle(0);
   Graph_dphi_toterrs3043->GetXaxis()->SetNdivisions(4);
   Graph_dphi_toterrs3043->GetXaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3043->GetXaxis()->SetLabelOffset(999);
   Graph_dphi_toterrs3043->GetXaxis()->SetLabelSize(0);
   Graph_dphi_toterrs3043->GetXaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3043->GetXaxis()->SetTitleFont(132);
   Graph_dphi_toterrs3043->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   Graph_dphi_toterrs3043->GetYaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3043->GetYaxis()->SetLabelSize(0.05);
   Graph_dphi_toterrs3043->GetYaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3043->GetYaxis()->SetTitleFont(132);
   Graph_dphi_toterrs3043->GetZaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3043->GetZaxis()->SetLabelSize(0.05);
   Graph_dphi_toterrs3043->GetZaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3043->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_dphi_toterrs3043);
   
   grae->Draw("p1p");
   
   Double_t _fx3044[6] = {
   0.3403392,
   0.863938,
   1.387537,
   1.911136,
   2.434734,
   2.958333};
   Double_t _fy3044[6] = {
   0.1926519,
   0.2207154,
   0.3546338,
   0.6864677,
   2.01515,
   7.779723};
   Double_t _felx3044[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3044[6] = {
   0.02873042,
   0.03223617,
   0.04948444,
   0.07740101,
   0.1117696,
   0.3251484};
   Double_t _fehx3044[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3044[6] = {
   0.03948655,
   0.04420709,
   0.06698785,
   0.1028379,
   0.1104173,
   0.2636435};
   grae = new TGraphAsymmErrors(6,_fx3044,_fy3044,_felx3044,_fehx3044,_fely3044,_fehy3044);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_Graph3044 = new TH1F("Graph_Graph3044","",100,0.07853982,3.220132);
   Graph_Graph3044->SetMinimum(0.1475293);
   Graph_Graph3044->SetMaximum(8.831311);
   Graph_Graph3044->SetDirectory(0);
   Graph_Graph3044->SetStats(0);
   Graph_Graph3044->SetLineWidth(2);
   Graph_Graph3044->SetMarkerStyle(0);
   Graph_Graph3044->GetXaxis()->SetNdivisions(4);
   Graph_Graph3044->GetXaxis()->SetLabelFont(132);
   Graph_Graph3044->GetXaxis()->SetLabelOffset(999);
   Graph_Graph3044->GetXaxis()->SetLabelSize(0);
   Graph_Graph3044->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph3044->GetXaxis()->SetTitleFont(132);
   Graph_Graph3044->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   Graph_Graph3044->GetYaxis()->SetLabelFont(132);
   Graph_Graph3044->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph3044->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph3044->GetYaxis()->SetTitleFont(132);
   Graph_Graph3044->GetZaxis()->SetLabelFont(132);
   Graph_Graph3044->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph3044->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph3044->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph3044);
   
   grae->Draw("p1p");
   
   Double_t dphi_toterrs_fx3045[6] = {
   0.1832596,
   0.7068583,
   1.230457,
   1.754056,
   2.277655,
   2.801253};
   Double_t dphi_toterrs_fy3045[6] = {
   0.3071206,
   0.3788296,
   0.5235754,
   0.9026085,
   2.09773,
   8.042891};
   Double_t dphi_toterrs_felx3045[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t dphi_toterrs_fely3045[6] = {
   0.03223837,
   0.05049376,
   0.0513308,
   0.07859791,
   0.1671821,
   0.6048482};
   Double_t dphi_toterrs_fehx3045[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t dphi_toterrs_fehy3045[6] = {
   0.05069997,
   0.04670219,
   0.05741781,
   0.0972528,
   0.2140117,
   0.6377428};
   grae = new TGraphAsymmErrors(6,dphi_toterrs_fx3045,dphi_toterrs_fy3045,dphi_toterrs_felx3045,dphi_toterrs_fehx3045,dphi_toterrs_fely3045,dphi_toterrs_fehy3045);
   grae->SetName("dphi_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_dphi_toterrs3045 = new TH1F("Graph_dphi_toterrs3045","",100,0,3.063053);
   Graph_dphi_toterrs3045->SetMinimum(0.247394);
   Graph_dphi_toterrs3045->SetMaximum(9.521209);
   Graph_dphi_toterrs3045->SetDirectory(0);
   Graph_dphi_toterrs3045->SetStats(0);
   Graph_dphi_toterrs3045->SetLineWidth(2);
   Graph_dphi_toterrs3045->SetMarkerStyle(0);
   Graph_dphi_toterrs3045->GetXaxis()->SetNdivisions(4);
   Graph_dphi_toterrs3045->GetXaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3045->GetXaxis()->SetLabelOffset(999);
   Graph_dphi_toterrs3045->GetXaxis()->SetLabelSize(0);
   Graph_dphi_toterrs3045->GetXaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3045->GetXaxis()->SetTitleFont(132);
   Graph_dphi_toterrs3045->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   Graph_dphi_toterrs3045->GetYaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3045->GetYaxis()->SetLabelSize(0.05);
   Graph_dphi_toterrs3045->GetYaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3045->GetYaxis()->SetTitleFont(132);
   Graph_dphi_toterrs3045->GetZaxis()->SetLabelFont(132);
   Graph_dphi_toterrs3045->GetZaxis()->SetLabelSize(0.05);
   Graph_dphi_toterrs3045->GetZaxis()->SetTitleSize(0.06);
   Graph_dphi_toterrs3045->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_dphi_toterrs3045);
   
   grae->Draw("p1p");
   
   Double_t _fx3046[6] = {
   0.1832596,
   0.7068583,
   1.230457,
   1.754056,
   2.277655,
   2.801253};
   Double_t _fy3046[6] = {
   0.3071206,
   0.3788296,
   0.5235754,
   0.9026085,
   2.09773,
   8.042891};
   Double_t _felx3046[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3046[6] = {
   0.02710968,
   0.03295216,
   0.04124188,
   0.06402796,
   0.1338949,
   0.4694553};
   Double_t _fehx3046[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3046[6] = {
   0.03469016,
   0.04020747,
   0.048986,
   0.07362466,
   0.1488417,
   0.5027875};
   grae = new TGraphAsymmErrors(6,_fx3046,_fy3046,_felx3046,_fehx3046,_fely3046,_fehy3046);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph3046 = new TH1F("Graph_Graph3046","",100,0,3.063053);
   Graph_Graph3046->SetMinimum(0.2520099);
   Graph_Graph3046->SetMaximum(9.372245);
   Graph_Graph3046->SetDirectory(0);
   Graph_Graph3046->SetStats(0);
   Graph_Graph3046->SetLineWidth(2);
   Graph_Graph3046->SetMarkerStyle(0);
   Graph_Graph3046->GetXaxis()->SetNdivisions(4);
   Graph_Graph3046->GetXaxis()->SetLabelFont(132);
   Graph_Graph3046->GetXaxis()->SetLabelOffset(999);
   Graph_Graph3046->GetXaxis()->SetLabelSize(0);
   Graph_Graph3046->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph3046->GetXaxis()->SetTitleFont(132);
   Graph_Graph3046->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   Graph_Graph3046->GetYaxis()->SetLabelFont(132);
   Graph_Graph3046->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph3046->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph3046->GetYaxis()->SetTitleFont(132);
   Graph_Graph3046->GetZaxis()->SetLabelFont(132);
   Graph_Graph3046->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph3046->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph3046->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph3046);
   
   grae->Draw("p1p");
   
   TLegend *leg = new TLegend(0.2,0.57,0.5,0.82,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("data_stat","Data_{stat}","f");

   ci = TColor::GetColor("#ff9933");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("data_tot","Data_{tot}","f");

   ci = TColor::GetColor("#ffff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("powheg_temp","POWHEG","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("amcatnlo_temp","aMC@NLO","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(24);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.2,0.8,0.55,0.95,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetLineWidth(2);
   pt->SetTextFont(132);
   TText *AText = pt->AddText("LHCb, #sqrt{s} = 8 TeV");
   pt->Draw();
   
   TH1F *z_dphi_toterr_copy__39 = new TH1F("z_dphi_toterr_copy__39","z_dphi",6,0,3.141593);
   z_dphi_toterr_copy__39->SetBinContent(1,0.261202);
   z_dphi_toterr_copy__39->SetBinContent(2,0.3162337);
   z_dphi_toterr_copy__39->SetBinContent(3,0.3852335);
   z_dphi_toterr_copy__39->SetBinContent(4,0.7150939);
   z_dphi_toterr_copy__39->SetBinContent(5,1.796506);
   z_dphi_toterr_copy__39->SetBinContent(6,7.258657);
   z_dphi_toterr_copy__39->SetBinContent(7,3.800624);
   z_dphi_toterr_copy__39->SetBinError(1,0.03375302);
   z_dphi_toterr_copy__39->SetBinError(2,0.03634611);
   z_dphi_toterr_copy__39->SetBinError(3,0.0427511);
   z_dphi_toterr_copy__39->SetBinError(4,0.05747346);
   z_dphi_toterr_copy__39->SetBinError(5,0.1278198);
   z_dphi_toterr_copy__39->SetBinError(6,0.3295685);
   z_dphi_toterr_copy__39->SetBinError(7,0.1725617);
   z_dphi_toterr_copy__39->SetEntries(14);
   z_dphi_toterr_copy__39->SetDirectory(0);
   z_dphi_toterr_copy__39->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr_copy__39->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr_copy__39->SetLineColor(ci);
   z_dphi_toterr_copy__39->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_dphi_toterr_copy__39->SetMarkerColor(ci);
   z_dphi_toterr_copy__39->SetMarkerStyle(0);
   z_dphi_toterr_copy__39->GetXaxis()->SetNdivisions(4);
   z_dphi_toterr_copy__39->GetXaxis()->SetLabelFont(132);
   z_dphi_toterr_copy__39->GetXaxis()->SetLabelOffset(999);
   z_dphi_toterr_copy__39->GetXaxis()->SetLabelSize(0);
   z_dphi_toterr_copy__39->GetXaxis()->SetTitleSize(0.06);
   z_dphi_toterr_copy__39->GetXaxis()->SetTitleFont(132);
   z_dphi_toterr_copy__39->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d|#Delta#it{#phi} [pb/rad]");
   z_dphi_toterr_copy__39->GetYaxis()->SetLabelFont(132);
   z_dphi_toterr_copy__39->GetYaxis()->SetLabelSize(0.05);
   z_dphi_toterr_copy__39->GetYaxis()->SetTitleSize(0.06);
   z_dphi_toterr_copy__39->GetYaxis()->SetTitleOffset(1.3);
   z_dphi_toterr_copy__39->GetYaxis()->SetTitleFont(132);
   z_dphi_toterr_copy__39->GetZaxis()->SetLabelFont(132);
   z_dphi_toterr_copy__39->GetZaxis()->SetLabelSize(0.05);
   z_dphi_toterr_copy__39->GetZaxis()->SetTitleSize(0.06);
   z_dphi_toterr_copy__39->GetZaxis()->SetTitleFont(132);
   z_dphi_toterr_copy__39->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: lowerPad
   TPad *lowerPad = new TPad("lowerPad", "lowerPad",0.005,0.05,0.995,0.995);
   lowerPad->Draw();
   lowerPad->cd();
   lowerPad->Range(-0.5429913,-0.4371795,3.335518,5.614103);
   lowerPad->SetFillColor(0);
   lowerPad->SetFillStyle(4000);
   lowerPad->SetBorderMode(0);
   lowerPad->SetBorderSize(2);
   lowerPad->SetTickx(1);
   lowerPad->SetTicky(1);
   lowerPad->SetLeftMargin(0.14);
   lowerPad->SetRightMargin(0.05);
   lowerPad->SetTopMargin(0.665);
   lowerPad->SetBottomMargin(0.14);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   
   TH1F *zj_dphi_8TeV_log_400_1001_0ratiocomp0__40 = new TH1F("zj_dphi_8TeV_log_400_1001_0ratiocomp0__40","z_dphi",6,0,3.141593);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(1,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(2,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(3,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(4,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(5,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(6,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinContent(7,3.800624);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(1,0.1292219);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(2,0.1149343);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(3,0.1109745);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(4,0.08037191);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(5,0.07114914);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(6,0.04540351);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetBinError(7,0.1725617);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetMinimum(0.41);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetMaximum(1.59);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetEntries(20);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetLineColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetMarkerColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->SetMarkerStyle(0);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetNdivisions(4);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetLabelOffset(0.02);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetXaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetTitle("Ratio");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->CenterTitle(true);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetNdivisions(505);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetTickLength(0.12325);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetTitleOffset(1.3);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetYaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetZaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetZaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetZaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->GetZaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0__40->Draw("e2");
   
   TH1F *zj_dphi_8TeV_log_400_1001_0ratiocomp1__41 = new TH1F("zj_dphi_8TeV_log_400_1001_0ratiocomp1__41","z_dphi",6,0,3.141593);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(1,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(2,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(3,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(4,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(5,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(6,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinContent(7,3.800624);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(1,0.06755777);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(2,0.06170157);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(3,0.0547299);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(4,0.04224946);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(5,0.02727271);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(6,0.01381488);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetBinError(7,0.05250516);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetMinimum(0.41);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetMaximum(1.59);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetEntries(20);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetLineColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetMarkerColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->SetMarkerStyle(0);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetNdivisions(4);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetLabelOffset(0.02);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetXaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetTitle("Ratio");
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->CenterTitle(true);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetNdivisions(505);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetTickLength(0.12325);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetYaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetZaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetZaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetZaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->GetZaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp1__41->Draw("e2same");
   
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_fx3047[6] = {
   0.3403392,
   0.863938,
   1.387537,
   1.911136,
   2.434734,
   2.958333};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_fy3047[6] = {
   0.7375589,
   0.6979502,
   0.9205685,
   0.9599686,
   1.121705,
   1.071786};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_felx3047[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_fely3047[6] = {
   0.1307698,
   0.1131224,
   0.1475052,
   0.1342332,
   0.1056111,
   0.06920535};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_fehx3047[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp2_fehy3047[6] = {
   0.1789271,
   0.1647854,
   0.1891732,
   0.1688822,
   0.07983441,
   0.05440822};
   grae = new TGraphAsymmErrors(6,zj_dphi_8TeV_log_400_1001_0ratiocomp2_fx3047,zj_dphi_8TeV_log_400_1001_0ratiocomp2_fy3047,zj_dphi_8TeV_log_400_1001_0ratiocomp2_felx3047,zj_dphi_8TeV_log_400_1001_0ratiocomp2_fehx3047,zj_dphi_8TeV_log_400_1001_0ratiocomp2_fely3047,zj_dphi_8TeV_log_400_1001_0ratiocomp2_fehy3047);
   grae->SetName("zj_dphi_8TeV_log_400_1001_0ratiocomp2");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047 = new TH1F("Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047","",100,0.07853982,3.220132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetMinimum(0.41);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetMaximum(1.59);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetDirectory(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetStats(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetLineWidth(2);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->SetMarkerStyle(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetNdivisions(4);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetXaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetTitle("Ratio");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->CenterTitle(true);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetNdivisions(505);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetYaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetZaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp23047);
   
   grae->Draw("p1");
   
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_fx3048[6] = {
   0.3403392,
   0.863938,
   1.387537,
   1.911136,
   2.434734,
   2.958333};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_fy3048[6] = {
   0.7375589,
   0.6979502,
   0.9205685,
   0.9599686,
   1.121705,
   1.071786};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_felx3048[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_fely3048[6] = {
   0.1099931,
   0.1019378,
   0.1284531,
   0.1082389,
   0.06221498,
   0.04479457};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_fehx3048[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp3_fehy3048[6] = {
   0.1511724,
   0.1397925,
   0.1738889,
   0.1438103,
   0.06146226,
   0.03632125};
   grae = new TGraphAsymmErrors(6,zj_dphi_8TeV_log_400_1001_0ratiocomp3_fx3048,zj_dphi_8TeV_log_400_1001_0ratiocomp3_fy3048,zj_dphi_8TeV_log_400_1001_0ratiocomp3_felx3048,zj_dphi_8TeV_log_400_1001_0ratiocomp3_fehx3048,zj_dphi_8TeV_log_400_1001_0ratiocomp3_fely3048,zj_dphi_8TeV_log_400_1001_0ratiocomp3_fehy3048);
   grae->SetName("zj_dphi_8TeV_log_400_1001_0ratiocomp3");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048 = new TH1F("Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048","",100,0.07853982,3.220132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetMinimum(0.41);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetMaximum(1.59);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetDirectory(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetStats(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetLineWidth(2);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->SetMarkerStyle(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetNdivisions(4);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetXaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetTitle("Ratio");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->CenterTitle(true);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetNdivisions(505);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetYaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetZaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp33048);
   
   grae->Draw("p1");
   
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_fx3049[6] = {
   0.1832596,
   0.7068583,
   1.230457,
   1.754056,
   2.277655,
   2.801253};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_fy3049[6] = {
   1.175797,
   1.197942,
   1.359112,
   1.262224,
   1.167673,
   1.108041};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_felx3049[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_fely3049[6] = {
   0.1234231,
   0.1596723,
   0.1332459,
   0.1099127,
   0.09305962,
   0.08332785};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_fehx3049[6] = {
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t zj_dphi_8TeV_log_400_1001_0ratiocomp4_fehy3049[6] = {
   0.1941025,
   0.1476825,
   0.1490468,
   0.136,
   0.1191266,
   0.08785962};
   grae = new TGraphAsymmErrors(6,zj_dphi_8TeV_log_400_1001_0ratiocomp4_fx3049,zj_dphi_8TeV_log_400_1001_0ratiocomp4_fy3049,zj_dphi_8TeV_log_400_1001_0ratiocomp4_felx3049,zj_dphi_8TeV_log_400_1001_0ratiocomp4_fehx3049,zj_dphi_8TeV_log_400_1001_0ratiocomp4_fely3049,zj_dphi_8TeV_log_400_1001_0ratiocomp4_fehy3049);
   grae->SetName("zj_dphi_8TeV_log_400_1001_0ratiocomp4");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049 = new TH1F("Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049","",100,0,3.063053);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetMinimum(0.41);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetMaximum(1.59);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetDirectory(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetStats(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetLineWidth(2);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->SetMarkerStyle(0);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetNdivisions(4);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetXaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetTitle("Ratio");
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->CenterTitle(true);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetNdivisions(505);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetYaxis()->SetTitleFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetZaxis()->SetLabelFont(132);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_dphi_8TeV_log_400_1001_0ratiocomp43049);
   
   grae->Draw("p1");
   
   TH1F *zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42 = new TH1F("zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42","z_dphi",6,0,3.141593);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(1,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(2,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(3,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(4,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(5,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(6,1);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinContent(7,3.800624);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(1,0.1292219);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(2,0.1149343);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(3,0.1109745);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(4,0.08037191);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(5,0.07114914);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(6,0.04540351);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetBinError(7,0.1725617);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetMinimum(0.41);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetMaximum(1.59);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetEntries(20);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetDirectory(0);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetLineColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetMarkerColor(ci);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->SetMarkerStyle(0);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetTitle("|#Delta#it{#phi}| [rad]");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetNdivisions(4);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetLabelOffset(0.02);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetXaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetTitle("Ratio");
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->CenterTitle(true);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetNdivisions(505);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetTickLength(0.12325);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetTitleOffset(1.3);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetYaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetZaxis()->SetLabelFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetZaxis()->SetLabelSize(0.05);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetZaxis()->SetTitleSize(0.06);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->GetZaxis()->SetTitleFont(132);
   zj_dphi_8TeV_log_400_1001_0ratiocomp0_copy__42->Draw("sameaxis");
   lowerPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}