Example #1
0
//------------------------------------------------------------------------------
// SetAxis
//------------------------------------------------------------------------------
void SetAxis(TH1*    hist,
	     TString xtitle,
	     TString ytitle,
	     Float_t size,
	     Float_t offset)
{
  TAxis* xaxis = (TAxis*)hist->GetXaxis();
  TAxis* yaxis = (TAxis*)hist->GetYaxis();

  xaxis->SetLabelFont(42);
  yaxis->SetLabelFont(42);
  xaxis->SetTitleFont(42);
  yaxis->SetTitleFont(42);

  xaxis->SetLabelOffset(0.025);
  yaxis->SetLabelOffset(0.025);
  xaxis->SetTitleOffset(1.4);
  yaxis->SetTitleOffset(offset);

  xaxis->SetLabelSize(size);
  yaxis->SetLabelSize(size);
  xaxis->SetTitleSize(size);
  yaxis->SetTitleSize(size);

  xaxis->SetTitle(xtitle);
  yaxis->SetTitle(ytitle);

  xaxis->SetNdivisions(505);
  yaxis->SetNdivisions(505);

  yaxis->CenterTitle();

  gPad->GetFrame()->DrawClone();
  gPad->RedrawAxis();
}
Example #2
0
void PrettyFonts(TH1D* h){
	TAxis * x = h->GetXaxis();
	TAxis * y = h->GetYaxis();
	x->SetTitleFont(132);
	y->SetTitleFont(132);
	x->SetTitleSize(0.06);
	x->SetTitleOffset(1.05); //make the Title a little further from the axis
	y->SetTitleOffset(1.05);
	y->SetTitleSize(0.06);
	x->SetLabelFont(132);
	y->SetLabelFont(132);
	x->SetLabelSize(0.06);
	y->SetLabelSize(0.06);
}
Example #3
0
THStack* DrawOne(TVirtualPad* p, 
		 Double_t     yr,
		 Bool_t       top,
		 TDirectory*  dir, 
		 const char*  name)
{
  p->cd();
  p->SetFillColor(0);
  p->SetFillStyle(0);
  p->SetLineColor(0);
  p->SetRightMargin(0.01);
  p->SetLeftMargin(0.12);
  p->SetGridx();
  if (top) p->SetBottomMargin(0.001);
  else     p->SetBottomMargin(0.2);
  if (top) p->SetTopMargin(0.02);
  else     p->SetTopMargin(0.0001);
  
  
  THStack* s = static_cast<THStack*>(dir->Get(name));
  s->Draw("nostack");
  Double_t sc = (top ? 1-yr : yr);
  TAxis* ya = s->GetHistogram()->GetYaxis();
  ya->SetLabelSize(1/sc*ya->GetLabelSize());
  ya->SetTitleSize(1/sc*ya->GetTitleSize());
  ya->SetTitleOffset(sc*(ya->GetTitleOffset()+.5));
  ya->SetTitleFont(42);
  ya->SetLabelFont(42);
  TAxis* xa = s->GetHistogram()->GetXaxis();
  xa->SetLabelSize(!top ? 1/yr*xa->GetLabelSize() : 0);
  xa->SetTitleSize(!top ? 1/yr*xa->GetTitleSize() : 0);
  xa->SetTitleOffset(yr*(xa->GetTitleOffset()+2));
  xa->SetTitleFont(42);
  xa->SetLabelFont(42);

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

  return s;
}
void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& sample, int massPoint, const std::string& channel, double k, 
	      const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
  std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
  TFile* inputFile = new TFile(inputFileName_full.data());
  if ( !inputFile ) {
    std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
    assert(0);
  }

  inputFile->ls();

  TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
  if ( !canvas ) {
    std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
    assert(0);
  }

  int idxPad = -1;
  if ( massPoint ==  90 ) idxPad = 1;
  if ( massPoint == 125 ) idxPad = 2;
  if ( massPoint == 200 ) idxPad = 3;
  if ( massPoint == 300 ) idxPad = 4;
  if ( massPoint == 500 ) idxPad = 5;
  if ( massPoint == 800 ) idxPad = 6;  
  if ( !(idxPad >= 1 && idxPad <= 6) ) {
    std::cerr << "Invalid sample = " << sample << " !!" << std::endl;
    assert(0);
  }
  TVirtualPad* pad = canvas->GetPad(idxPad);
  std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;

  TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 800);
  canvas_new->SetFillColor(10);
  canvas_new->SetBorderSize(2);
  canvas_new->SetTopMargin(0.065);
  canvas_new->SetLeftMargin(0.17);
  canvas_new->SetBottomMargin(0.165);
  canvas_new->SetRightMargin(0.015);
  canvas_new->SetLogx(true);
  canvas_new->SetLogy(true);
  canvas_new->Draw();
  canvas_new->cd();

  //TList* pad_primitives = canvas->GetListOfPrimitives();
  TList* pad_primitives = pad->GetListOfPrimitives();

  TH1* histogramCA            = 0;
  TH1* histogramSVfit         = 0;
  TH1* histogramSVfitMEMkEq0  = 0;
  TH1* histogramSVfitMEMkNeq0 = 0;

  TIter pad_nextObj(pad_primitives);
  while ( TObject* obj = pad_nextObj() ) {
    std::string objName = "";
    if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();    
    std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;

    TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
    if ( tmpHistogram ) {
      std::cout << "tmpHistogram:" 
		<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
		<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
		<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
		<< " integral = " << tmpHistogram->Integral() << std::endl;
      std::cout << "(mean = " << tmpHistogram->GetMean() << ", rms = " << tmpHistogram->GetRMS() << ": rms/mean = " << (tmpHistogram->GetRMS()/tmpHistogram->GetMean()) << ")" << std::endl;
      if ( tmpHistogram->GetLineColor() == 416 ) histogramCA            = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 600 ) histogramSVfit         = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 616 ) histogramSVfitMEMkEq0  = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 632 ) histogramSVfitMEMkNeq0 = tmpHistogram;
    }
  }

  if ( !(histogramCA && histogramSVfit && histogramSVfitMEMkEq0 && histogramSVfitMEMkNeq0) ) {
    std::cerr << "Failed to load histograms !!" << std::endl;
    assert(0);
  }

  //gStyle->SetLineStyleString(2,"40 10 10 10 10 10 10 10");
  //gStyle->SetLineStyleString(3,"25 15");
  //gStyle->SetLineStyleString(4,"60 25");

  //int colors[4] = { kBlack, kGreen - 6, kBlue - 7, kMagenta - 7  };
  int colors[4] = { 28, kGreen - 6, kBlue - 7, kBlack };
  //int lineStyles[4] = { 2, 3, 4, 1 };
  int lineStyles[4] = { 7, 1, 1, 1 };
  //int lineWidths[4] = { 3, 3, 4, 3 };
  int lineWidths[4] = { 3, 3, 1, 1 };
  int markerStyles[4] = { 20, 25, 21, 24 };
  int markerSizes[4] = { 2, 2, 2, 2 };

  histogramCA->SetFillColor(0);
  histogramCA->SetFillStyle(0);
  histogramCA->SetLineColor(colors[0]);
  histogramCA->SetLineStyle(lineStyles[0]);
  histogramCA->SetLineWidth(lineWidths[0]);
  histogramCA->SetMarkerColor(colors[0]);
  histogramCA->SetMarkerStyle(markerStyles[0]);
  histogramCA->SetMarkerSize(markerSizes[0]);

  histogramSVfit->SetFillColor(0);
  histogramSVfit->SetFillStyle(0);
  histogramSVfit->SetLineColor(colors[1]);
  histogramSVfit->SetLineStyle(lineStyles[1]);
  histogramSVfit->SetLineWidth(lineWidths[1]);
  histogramSVfit->SetMarkerColor(colors[1]);
  histogramSVfit->SetMarkerStyle(markerStyles[1]);
  histogramSVfit->SetMarkerSize(markerSizes[1]);

  histogramSVfitMEMkEq0->SetFillColor(0);
  histogramSVfitMEMkEq0->SetFillStyle(0);
  histogramSVfitMEMkEq0->SetLineColor(colors[2]);
  histogramSVfitMEMkEq0->SetLineStyle(lineStyles[2]);
  histogramSVfitMEMkEq0->SetLineWidth(lineWidths[2]);
  histogramSVfitMEMkEq0->SetMarkerColor(colors[2]);
  histogramSVfitMEMkEq0->SetMarkerStyle(markerStyles[2]);
  histogramSVfitMEMkEq0->SetMarkerSize(markerSizes[2]);
  // CV: fix pathological bins at high mass for which dN/dm increases
  int numBins = histogramSVfitMEMkEq0->GetNbinsX();
  for ( int idxBin = 1; idxBin <= numBins; ++idxBin ) {
    double binCenter = histogramSVfitMEMkEq0->GetBinCenter(idxBin);
    if ( (channel == "#tau_{h}#tau_{h}" && massPoint == 500 && binCenter > 1500.) ||
	 (channel == "#tau_{h}#tau_{h}" && massPoint == 800 && binCenter > 2000.) ||
	 (channel == "#mu#tau_{h}"      && massPoint == 500 && binCenter > 1500.) ||
	 (channel == "#mu#tau_{h}"      && massPoint == 800 && binCenter > 2500.) ) {
      histogramSVfitMEMkEq0->SetBinContent(idxBin, 0.);
    }
  }

  histogramSVfitMEMkNeq0->SetFillColor(0);
  histogramSVfitMEMkNeq0->SetFillStyle(0);
  histogramSVfitMEMkNeq0->SetLineColor(colors[3]);
  histogramSVfitMEMkNeq0->SetLineStyle(lineStyles[3]);
  histogramSVfitMEMkNeq0->SetLineWidth(lineWidths[3]);
  histogramSVfitMEMkNeq0->SetMarkerColor(colors[3]);
  histogramSVfitMEMkNeq0->SetMarkerStyle(markerStyles[3]);
  histogramSVfitMEMkNeq0->SetMarkerSize(markerSizes[3]);

  TAxis* xAxis = histogramCA->GetXaxis();
  xAxis->SetTitle("m_{#tau#tau} [GeV]");
  xAxis->SetTitleOffset(1.15);
  xAxis->SetTitleSize(0.070);
  xAxis->SetTitleFont(42);
  xAxis->SetLabelOffset(0.010);
  xAxis->SetLabelSize(0.055);
  xAxis->SetLabelFont(42);
  xAxis->SetTickLength(0.040);
  xAxis->SetNdivisions(510);

  //double xMin = 20.;
  //double xMax = xAxis->GetXmax();
  //xAxis->SetRangeUser(xMin, xMax);

  TAxis* yAxis = histogramCA->GetYaxis();
  yAxis->SetTitle("dN/dm_{#tau#tau} [1/GeV]");
  yAxis->SetTitleOffset(1.20);
  yAxis->SetTitleSize(0.070);
  yAxis->SetTitleFont(42);
  yAxis->SetLabelOffset(0.010);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelFont(42);
  yAxis->SetTickLength(0.040);  
  yAxis->SetNdivisions(505);

  double massPoint_double = 0.;
  if ( massPoint == 90 ) massPoint_double = 91.2;
  else massPoint_double = massPoint;
  double dLog = (TMath::Log(5.*massPoint_double) - TMath::Log(50.))/25.; // xMin = 50, xMax = 5*massPoint, numBins = 25
  double binWidth = TMath::Exp(TMath::Log(massPoint_double) + 0.5*dLog) - TMath::Exp(TMath::Log(massPoint_double) - 0.5*dLog);
  double sf_binWidth = 1./binWidth;
  std::cout << "massPoint = " << massPoint << ": sf_binWidth = " << sf_binWidth << std::endl;

  histogramCA->SetTitle("");
  histogramCA->SetStats(false);
  histogramCA->SetMaximum(sf_binWidth*0.79);
  histogramCA->SetMinimum(sf_binWidth*1.1e-4);
  histogramCA->Draw("hist");
  histogramSVfit->Draw("histsame");
  //histogramSVfitMEMkEq0->Draw("histsame");
  histogramSVfitMEMkEq0->Draw("epsame");
  //histogramSVfitMEMkNeq0->Draw("histsame");
  histogramSVfitMEMkNeq0->Draw("epsame");
  histogramCA->Draw("axissame");

  //TPaveText* label_sample = new TPaveText(0.21, 0.86, 0.46, 0.94, "NDC");
  TPaveText* label_sample = new TPaveText(0.1700, 0.9475, 0.4600, 1.0375, "NDC");
  label_sample->SetFillStyle(0);
  label_sample->SetBorderSize(0);
  label_sample->AddText(sample.data());
  label_sample->SetTextFont(42);
  label_sample->SetTextSize(0.055);
  label_sample->SetTextColor(1);
  label_sample->SetTextAlign(13);
  label_sample->Draw();

  //TLegend* legend_new = new TLegend(0.225, 0.52, 0.41, 0.82, NULL, "brNDC");
  TLegend* legend_new = new TLegend(0.30, 0.30, 0.80, 0.80, NULL, "brNDC");
  legend_new->SetFillColor(10);
  legend_new->SetFillStyle(0);
  legend_new->SetBorderSize(0);
  legend_new->SetTextFont(42);
  legend_new->SetTextSize(0.055);
  legend_new->SetTextColor(1);
  legend_new->SetMargin(0.20);
  legend_new->AddEntry(histogramCA, "CA", "l");
  legend_new->AddEntry(histogramSVfit, "SVfit", "l");
  //legend_new->AddEntry(histogramSVfitMEMkEq0, "SVfitMEM (k=0)", "l");
  legend_new->AddEntry(histogramSVfitMEMkEq0, "SVfitMEM (k=0)", "p");
  //legend_new->AddEntry(histogramSVfitMEMkNeq0, Form("SVfitMEM(k=%1.0f)", k), "l");
  legend_new->AddEntry(histogramSVfitMEMkNeq0, Form("SVfitMEM (k=%1.0f)", k), "p");
  //legend_new->Draw();

  double label_channel_y0;
  if      ( channel == "e#mu"             ) label_channel_y0 = 0.9275;
  else if ( channel == "#mu#tau_{h}"      ) label_channel_y0 = 0.9400;
  else if ( channel == "#tau_{h}#tau_{h}" ) label_channel_y0 = 0.9350;
  else {
    std::cerr << "Invalid channel = " << channel << " !!" << std::endl;
    assert(0);
  }
  TPaveText* label_channel = new TPaveText(0.895, label_channel_y0, 0.975, label_channel_y0 + 0.055, "NDC");
  label_channel->SetFillStyle(0);
  label_channel->SetBorderSize(0);
  label_channel->AddText(channel.data());
  label_channel->SetTextFont(62);
  label_channel->SetTextSize(0.055);
  label_channel->SetTextColor(1);
  label_channel->SetTextAlign(31);
  label_channel->Draw();

  canvas_new->Update();

  std::string outputFileName_full = Form("%s%s", outputFilePath.data(), outputFileName.data());
  size_t idx = outputFileName_full.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName_full, 0, idx);
  canvas_new->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas_new->Print(std::string(outputFileName_plot).append(".root").data());

  std::string channel_string;
  if      ( channel == "e#mu"             ) channel_string = "emu";
  else if ( channel == "#mu#tau_{h}"      ) channel_string = "muhad";
  else if ( channel == "#tau_{h}#tau_{h}" ) channel_string = "hadhad";
  else {
    std::cerr << "Invalid channel = " << channel << " !!" << std::endl;
    assert(0);
  }
  std::string outputFileName_legend = Form("makeSVfitMEM_PerformancePlots_legend_%s.pdf", channel_string.data());
  makePlot_legend(legend_new, outputFilePath, outputFileName_legend);

  delete label_sample;
  delete legend_new;
  delete label_channel;
  delete canvas_new;

  delete inputFile;
}
Example #5
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
//    parameter = "dg0"
//    parameter = "lam0"
//    parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Individual settings
  //----------------------------------------------------------------------------
  if (parameter.Contains("dg0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#lambda";
      xmin   = -0.5;
      xmax   =  0.5;
      ymin   = -0.039;
      ymax   =  0.053;
    }
  else if (parameter.Contains("lam0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#Deltag^{Z}_{1}";
      xmin   = -0.53;
      xmax   =  0.53;
      ymin   = -0.05;
      ymax   =  0.09;
    }
  else if (parameter.Contains("dk0"))
    {
      xtitle = "#Deltag^{Z}_{1}";
      ytitle = "#lambda";
      xmin   = -0.059;
      xmax   =  0.059;
      ymin   = -0.037;
      ymax   =  0.052;
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");

  TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
  TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
  TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
  TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
  TGraph* bestFit     = (TGraph*)file->Get("bestFit");

  bestFit->SetMarkerSize(1.5);
  bestFit->SetMarkerStyle(34);

  TGraph* g_large = new TGraph(2);

  g_large->SetPoint(0, -1.0, 1.0);
  g_large->SetPoint(1,  1.0, 1.0);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  TMultiGraph* mg = new TMultiGraph();

  mg->Add(cont_exp_68);
  mg->Add(cont_exp_95);
  mg->Add(cont_exp_99);
  mg->Add(cont_obs_95);
  mg->Add(bestFit, "p");
  mg->Add(g_large);

  mg->Draw("ac");

  mg->SetMinimum(ymin);
  mg->SetMaximum(ymax);


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = mg->GetXaxis();
  TAxis* yaxis = mg->GetYaxis();
  
  xaxis->SetLabelFont  (    42);
  xaxis->SetLabelOffset(  0.01);
  xaxis->SetLabelSize  (  0.05);
  xaxis->SetNdivisions (   505);
  xaxis->SetTitle      (xtitle);
  xaxis->SetTitleFont  (    42);
  xaxis->SetTitleOffset(   1.2);
  xaxis->SetTitleSize  (  0.05);

  xaxis->SetLimits(xmin, xmax);

  yaxis->SetLabelFont  (    42);
  yaxis->SetLabelOffset(  0.01);
  yaxis->SetLabelSize  (  0.05);
  yaxis->SetNdivisions (   505);
  yaxis->SetTitle      (ytitle);
  yaxis->SetTitleFont  (    42);
  yaxis->SetTitleOffset(   1.6);
  yaxis->SetTitleSize  (  0.05);

  canvas->Modified();


  // Legend
  //----------------------------------------------------------------------------
  Double_t x0 = 0.580;
  Double_t y0 = 0.755;

  DrawTLegend(x0 - 0.36, y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_68, " Expected 68% CL", "l");
  DrawTLegend(x0 - 0.36, y0 + 1.*(_yoffset+0.001), (TH1F*)cont_exp_95, " Expected 95% CL", "l");
  DrawTLegend(x0,        y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_99, " Expected 99% CL", "l");
  DrawTLegend(x0,        y0 + 1.*(_yoffset+0.001), (TH1F*)cont_obs_95, " Observed 95% CL", "l");
  DrawTLegend(x0,        y0,                       (TH1F*)bestFit,     " Best fit",          "p");


  // Finish it
  //----------------------------------------------------------------------------
  DrawTLatex(_cmsTextFont,   0.190, 0.94, 0.055, 11, "CMS");
  //  DrawTLatex(_extraTextFont, 0.315, 0.94, 0.030, 11, "Preliminary");
  DrawTLatex(_lumiTextFont,  0.940, 0.94, 0.040, 31, "19.6 fb^{-1} (8 TeV)");

  canvas->SaveAs("pdf/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.pdf");
  canvas->SaveAs("png/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.png");
}
Example #6
0
/*
 * Main Function
 */
void ratio() {

  gStyle->SetFrameLineWidth(1); 
                                
  //Number of Measurements
  const int NUM = 2;
  
  //Measurements and uncertainties
  // mean, -stat, +stat, -syst, +syst  
  double m[NUM][5] = {
    0.98, 0.10, 0.10, 0.14, 0.14,
    //1.33, 0.32, 0.32, 0.22, 0.22
    1.26, 0.37, 0.37, 0.46, 0.46
  };
  
  //Theory and uncertainties
  // mean, -uncert, +uncert
  double t[NUM][3] = {
    1.0, 0.114, 0.114,
    1.0, 0.111, 0.111
  };

  // label text, sub-label text
  // Note: TString does not work, b/c one cannot pass an array of TStrings
  // as an argument to a function
  char label[NUM][2][100] = {
    "Z#gamma#gamma", "",
    //"W#gamma#gamma", ""
    "W#gamma#gamma (#mu)", ""
  };

  // format: 
  // # color, bgColor, fontSytle, linewidth, markerStyle 
  int aux[NUM][5] = {
    1,  10, 42, 2, 20,
    1,  10, 42, 2, 20
  };

  // determning the x size of the plot
  double lowX = LOW_X;
  double uppX = UPP_X;

  
  TH2F* lft = new TH2F("lft", "", 50, lowX, uppX, 1, 0.0, 1.0);

  // height = NUM*unitHeight + 2*spacers + 1*bottomMargin + 0.5*topMargin
  const double unitHeight = 50.0; // even number
  const double height = (double(NUM)+2.0)*unitHeight+100.0+30.0;
  // how much to step each time to cover the vertical range of the histo in
  // exactly NUM+2 steps
  const double vstep  = unitHeight/(height-100.0-30.0);
  const double width = 800.0;

  printf("Canvas: width=%d, height=%d\n",
	 TMath::Nint(width), TMath::Nint(height));
  printf("Y-step = %6.4f\n", vstep);

  
  // Set canvas and margins
  TCanvas* canvas = new TCanvas("canvas", "canvas", 200, 0,
				TMath::Nint(width), TMath::Nint(height));
  
  canvas->SetFillColor(10);
  canvas->SetRightMargin(20.0/width);
  canvas->SetLeftMargin(20.0/width);
  canvas->SetBottomMargin(56.0/height);
  canvas->SetTopMargin(30.0/height);
  canvas->Draw();
  canvas->cd();

  //printf("TopMargin   : %6.4f\n", canvas->GetTopMargin());
  //printf("BottomMargin: %6.4f\n", canvas->GetBottomMargin());

  TAxis* xaxis = lft->GetXaxis();
  TAxis* yaxis = lft->GetYaxis();
  xaxis->CenterTitle(kTRUE);  
  xaxis->SetTitleSize(0.07);  
  xaxis->SetTitleFont(62);    
  xaxis->SetTitleOffset(1.1); 
  xaxis->SetNdivisions(6,5,0);
    
  xaxis->SetLabelOffset(0.01);
  xaxis->SetLabelSize(0.05);
  xaxis->SetLabelFont(42);
  yaxis->SetLabelSize(0.0);
  yaxis->SetNdivisions(-1);

  lft->SetXTitle("Cross Section Ratio  #sigma_{Exp} / #sigma_{Theory}");
  lft->SetYTitle("");
  lft->SetStats(kFALSE);
  lft->SetTitle("");
  lft->Draw();

    
  // Draw Theory Bands
  for (int i=0; i!=NUM; ++i) {
    drawTheory(i, t[i][0], t[i][1], t[i][2], vstep);
  }

  canvas->RedrawAxis(); 
  gPad->RedrawAxis(); 

  // Draw Measurements
  for (int i=0; i!=NUM; ++i) {
    drawMeasurement(i, m[i], label[i], aux[i], vstep, lft, canvas);
  }

  //Set CMS Preliminary marker
  int iPeriod=2; // 8 TeV
  int iPos = 0; //
  CMS_lumi( canvas, iPeriod, iPos );

  // Print
  //canvas->Print("Ratio_CrossSec_Exp_Theory.pdf");
  canvas->Draw();
}
void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& histogram, const std::string& channel, const std::string& xAxisTitle, const std::string& yAxisTitle,
	      const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
  std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
  TFile* inputFile = new TFile(inputFileName_full.data());
  if ( !inputFile ) {
    std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
    assert(0);
  }

  inputFile->ls();

  TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
  if ( !canvas ) {
    std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
    assert(0);
  }

  int idxPad = -1;
  if ( histogram == "mVis"    ) idxPad = 1;
  if ( histogram == "mTauTau" ) idxPad = 2;
  if ( !(idxPad >= 1 && idxPad <= 2) ) {
    std::cerr << "Invalid histogram = " << histogram << " !!" << std::endl;
    assert(0);
  }
  TVirtualPad* pad = canvas->GetPad(idxPad);
  std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;

  TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 850);
  canvas_new->SetFillColor(10);
  canvas_new->SetBorderSize(2);
  canvas_new->SetTopMargin(0.065);
  canvas_new->SetLeftMargin(0.17);
  canvas_new->SetBottomMargin(0.155);
  canvas_new->SetRightMargin(0.045);
  canvas_new->SetLogx(false);
  canvas_new->SetLogy(false);
  canvas_new->Draw();
  canvas_new->cd();

  //TList* pad_primitives = canvas->GetListOfPrimitives();
  TList* pad_primitives = pad->GetListOfPrimitives();

  TH1* histogramDYJets   = 0;
  TH1* histogramHiggs125 = 0;
  TH1* histogramHiggs200 = 0;
  TH1* histogramHiggs300 = 0;

  TIter pad_nextObj(pad_primitives);
  while ( TObject* obj = pad_nextObj() ) {
    std::string objName = "";
    if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();    
    std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;

    TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
    if ( tmpHistogram ) {
      std::cout << "tmpHistogram:" 
		<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
		<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
		<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
		<< " integral = " << tmpHistogram->Integral() << std::endl;
      if ( tmpHistogram->GetFillColor() ==   0 ) histogramDYJets   = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 632 ) histogramHiggs125 = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 616 ) histogramHiggs200 = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 600 ) histogramHiggs300 = tmpHistogram;
    }
  }

  if ( !(histogramDYJets && histogramHiggs125 && histogramHiggs200 && histogramHiggs300) ) {
    std::cerr << "Failed to load histograms !!" << std::endl;
    assert(0);
  }

  int lineColors[4] = { 1, 2, 6, 4 };
  int lineStyles[4] = { 1, 1, 1, 1 };
  int lineWidths[4] = { 2, 2, 2, 2 };
  int fillColors[4] = { 10, 2, 6, 4 };
  int fillStyles[4] = { 0, 3002, 3004, 3005 };

  histogramDYJets->SetFillColor(fillColors[0]);
  histogramDYJets->SetFillStyle(fillStyles[0]);
  histogramDYJets->SetLineColor(lineColors[0]);
  histogramDYJets->SetLineStyle(lineStyles[0]);
  histogramDYJets->SetLineWidth(lineWidths[0]);

  histogramHiggs125->SetFillColor(fillColors[1]);
  histogramHiggs125->SetFillStyle(fillStyles[1]);
  histogramHiggs125->SetLineColor(lineColors[1]);
  histogramHiggs125->SetLineStyle(lineStyles[1]);
  histogramHiggs125->SetLineWidth(lineWidths[1]);

  histogramHiggs200->SetFillColor(fillColors[2]);
  histogramHiggs200->SetFillStyle(fillStyles[2]);
  histogramHiggs200->SetLineColor(lineColors[2]);
  histogramHiggs200->SetLineStyle(lineStyles[2]);
  histogramHiggs200->SetLineWidth(lineWidths[2]);

  histogramHiggs300->SetFillColor(fillColors[3]);
  histogramHiggs300->SetFillStyle(fillStyles[3]);
  histogramHiggs300->SetLineColor(lineColors[3]);
  histogramHiggs300->SetLineStyle(lineStyles[3]);
  histogramHiggs300->SetLineWidth(lineWidths[3]);

  TAxis* xAxis = histogramHiggs300->GetXaxis();
  if ( histogram == "mVis"    ) xAxis->SetRangeUser(0,350);
  else xAxis->SetRangeUser(0,450);
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.00);
  xAxis->SetTitleSize(0.070);
  xAxis->SetTitleFont(42);
  xAxis->SetLabelOffset(0.010);
  xAxis->SetLabelSize(0.050);
  xAxis->SetLabelFont(42);
  xAxis->SetTickLength(0.040);
  xAxis->SetNdivisions(505);

  //double xMin = 20.;
  //double xMax = xAxis->GetXmax();
  //xAxis->SetRangeUser(xMin, xMax);

  TAxis* yAxis = histogramHiggs300->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(1.20);
  yAxis->SetTitleSize(0.070);
  yAxis->SetTitleFont(42);
  yAxis->SetLabelOffset(0.010);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelFont(42);
  yAxis->SetTickLength(0.040);  
  yAxis->SetNdivisions(505);

  histogramHiggs300->SetTitle("");
  histogramHiggs300->SetStats(false);
  histogramHiggs300->SetMaximum(1.2*histogramDYJets->GetMaximum());
  histogramHiggs300->SetMinimum(0.);
  histogramHiggs300->Draw("hist");
  histogramHiggs200->Draw("histsame");
  histogramHiggs125->Draw("histsame");
  histogramDYJets->Draw("histsame");
  histogramHiggs300->Draw("axissame");

  TLegend* legend_new = new TLegend(0.50, 0.62, 0.87, 0.92, NULL, "brNDC");
  legend_new->SetFillColor(10);
  legend_new->SetFillStyle(0);
  legend_new->SetBorderSize(0);
  legend_new->SetTextFont(42);
  legend_new->SetTextSize(0.055);
  legend_new->SetTextColor(1);
  legend_new->SetMargin(0.20);
  legend_new->AddEntry(histogramDYJets, "Z/#gamma* #rightarrow #tau#tau", "f");
  legend_new->AddEntry(histogramHiggs125, "H(125 GeV) #rightarrow #tau#tau", "f");
  legend_new->AddEntry(histogramHiggs200, "H(200 GeV) #rightarrow #tau#tau", "f");
  legend_new->AddEntry(histogramHiggs300, "H(300 GeV) #rightarrow #tau#tau", "f");
  legend_new->Draw();

  double label_channel_y0;
  if      ( channel == "e#mu"             ) label_channel_y0 = 0.9275;
  else if ( channel == "#mu#tau_{h}"      ) label_channel_y0 = 0.9400;
  else if ( channel == "#tau_{h}#tau_{h}" ) label_channel_y0 = 0.9350;
  else {
    std::cerr << "Invalid channel = " << channel << " !!" << std::endl;
    assert(0);
  }
  TPaveText* label_channel = new TPaveText(0.855, label_channel_y0, 0.945, label_channel_y0 + 0.055, "NDC");
  label_channel->SetFillStyle(0);
  label_channel->SetBorderSize(0);
  label_channel->AddText(channel.data());
  label_channel->SetTextFont(62);
  label_channel->SetTextSize(0.055);
  label_channel->SetTextColor(1);
  label_channel->SetTextAlign(31);
  label_channel->Draw();

  canvas_new->Update();

  std::string outputFileName_full = Form("%s%s", outputFilePath.data(), outputFileName.data());
  size_t idx = outputFileName_full.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName_full, 0, idx);
  canvas_new->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas_new->Print(std::string(outputFileName_plot).append(".root").data());

  delete legend_new;
  delete label_channel;
  delete canvas_new;

  delete inputFile;
}
Example #8
0
//------------------------------------------------------------------------------
// DrawZPeak
//------------------------------------------------------------------------------
void DrawZPeak(TString energy)
{
  if (energy.Contains("7TeV"))
    {
      _lumiText = "4.9 fb^{-1} (7 TeV)";
    }
  else
    {
      _lumiText = "19.6 fb^{-1} (8 TeV)";
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TString name = "invMass2Lep_";

  TFile* file = new TFile("rootfiles/" + name + energy + ".root", "read");

  TH1F* data;
  TH1F* WZ;
  TH1F* fakes;
  TH1F* ZZ;
  TH1F* Zgamma;
  TH1F* WV;
  TH1F* VVV;
  TH1F* allmc;

  if (energy.Contains("7TeV"))
    {
      data   = (TH1F*)file->Get("hZMass_Sel_datahist_COMB");
      WZ     = (TH1F*)file->Get("hZMass_Sel_wz_COMB");
      fakes  = (TH1F*)file->Get("hZMass_Sel_datadriven_COMB");
      ZZ     = (TH1F*)file->Get("hZMass_Sel_zz_COMB");
      Zgamma = (TH1F*)file->Get("hZMass_Sel_zg_COMB");
      WV     = (TH1F*)file->Get("hZMass_Sel_wz_COMB");
      VVV    = (TH1F*)file->Get("hZMass_Sel_wz_COMB");
      allmc  = (TH1F*)file->Get("all_estimates_with_error_COMB");
    }
  else if (energy.Contains("8TeV"))
    {
      data   = (TH1F*)file->Get("h_data");
      WZ     = (TH1F*)file->Get("h_WZ");
      fakes  = (TH1F*)file->Get("h_Fakes");
      ZZ     = (TH1F*)file->Get("h_ZZ");
      Zgamma = (TH1F*)file->Get("h_ZGamma");
      WV     = (TH1F*)file->Get("h_WV");
      VVV    = (TH1F*)file->Get("h_VVV");
      allmc  = (TH1F*)file->Get("h_All");
    }

  WZ->SetFillColor(kOrange-2);
  WZ->SetLineColor(kOrange-2);

  Zgamma->SetFillColor(kRed+1);  // kRed+2
  Zgamma->SetLineColor(kRed+1);  // kRed+2

  ZZ->SetFillColor(kRed+1);
  ZZ->SetLineColor(kRed+1);

  fakes->SetFillColor(kGray+1);
  fakes->SetLineColor(kGray+1);
  
  data->SetMarkerStyle(kFullCircle);

  allmc->SetFillColor  (kBlack);
  allmc->SetFillStyle  (3345);
  allmc->SetLineColor  (kWhite);
  allmc->SetLineWidth  (0);
  allmc->SetMarkerColor(kOrange-2);
  allmc->SetMarkerSize (0);

  THStack* hs = new THStack();

  if (energy.Contains("8TeV"))
    {
      WV->SetFillColor(kRed+1);  // kAzure
      WV->SetLineColor(kRed+1);  // kAzure

      VVV->SetFillColor(kRed+1);  // kBlack
      VVV->SetLineColor(kRed+1);  // kBlack

      hs->Add(VVV);
      hs->Add(WV);
    }

  hs->Add(Zgamma);
  hs->Add(ZZ);
  hs->Add(fakes);
  hs->Add(WZ);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas(energy, energy);

  data->Draw("ep");


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = data->GetXaxis();
  TAxis* yaxis = data->GetYaxis();
  
  xaxis->SetLabelFont  (  42);
  xaxis->SetLabelOffset(0.01);
  xaxis->SetLabelSize  (0.05);
  xaxis->SetNdivisions ( 505);
  xaxis->SetTitleFont  (  42);
  xaxis->SetTitleOffset( 1.3);
  xaxis->SetTitleSize  (0.05);

  yaxis->SetLabelFont  (  42);
  yaxis->SetLabelOffset(0.01);
  yaxis->SetLabelSize  (0.05);
  yaxis->SetNdivisions ( 505);
  yaxis->SetTitleFont  (  42);
  yaxis->SetTitleOffset( 1.6);
  yaxis->SetTitleSize  (0.05);

  xaxis->SetRangeUser(68, 112);
  xaxis->SetTitle("m_{#font[12]{ll}} (GeV)");
  yaxis->SetTitle(Form("Events /  %.0f GeV", data->GetBinWidth(0)));


  // Adjust scale
  //----------------------------------------------------------------------------
  Float_t theMax   = GetMaximumIncludingErrors(data);
  Float_t theMaxMC = GetMaximumIncludingErrors(allmc);

  if (theMaxMC > theMax) theMax = theMaxMC;

  data->SetMaximum(1.15 * theMax);


  // Legend
  //----------------------------------------------------------------------------
  Double_t x0 = 0.635;
  Double_t y0 = 0.770;

  DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), data,  " Data",               "ep");
  DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), WZ,    " WZ",                 "f");
  DrawTLegend(x0, y0,                       fakes, " Non-prompt leptons", "f");
  DrawTLegend(x0, y0 - 1.*(_yoffset+0.001), ZZ,    " MC background",      "f");
  DrawTLegend(x0, y0 - 2.*(_yoffset+0.001), allmc, " stat. #oplus syst.", "f");


  // Finish it
  //----------------------------------------------------------------------------
  data->SetTitle("");

  DrawTLatex(_cmsTextFont,   0.215, 0.880, 0.055, 13, "CMS");
  //  DrawTLatex(_extraTextFont, 0.215, 0.826, 0.030, 13, "Preliminary");
  DrawTLatex(_lumiTextFont,  0.940, 0.940, 0.040, 31, _lumiText);

  hs   ->Draw("hist,same");
  allmc->Draw("e2,same");
  data ->Draw("ep,same");

  canvas->GetFrame()->DrawClone();
  canvas->RedrawAxis();
  canvas->Update();
  
  canvas->SaveAs("pdf/" + name + energy + ".pdf");
  canvas->SaveAs("png/" + name + energy + ".png");
}
Example #9
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure6
//
//    logy = 0
//    logy = 1
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure6(Int_t logy = 0)
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Read the input file
  //----------------------------------------------------------------------------
  TString name = "WZ_PtZ_plot_allCh_largeATGC";

  TFile* file = new TFile("rootfiles/" + name + ".root", "read");

  TCanvas* c1 = (TCanvas*)file->Get("c1_allCh");

  TH1F* data     = (TH1F*)c1->FindObject("histo_data_3e");
  TH1F* aTGC_dk  = (TH1F*)c1->FindObject("histo_aTGC_dk_3e");
  TH1F* aTGC_lam = (TH1F*)c1->FindObject("histo_aTGC_lam_3e");
  TH1F* aTGC_dg  = (TH1F*)c1->FindObject("histo_aTGC_dg_3e");
  TH1F* WZ       = (TH1F*)c1->FindObject("histo_SM_3e");
  TH1F* fakes    = (TH1F*)c1->FindObject("fake_0");
  TH1F* ZZ       = (TH1F*)c1->FindObject("total_bkg_rebined_ZZ_0");
  TH1F* Zgamma   = (TH1F*)c1->FindObject("total_bkg_rebined_Zgamma_0");
  TH1F* WV       = (TH1F*)c1->FindObject("total_bkg_rebined_WV_0");
  TH1F* VVV      = (TH1F*)c1->FindObject("total_bkg_rebined_VVV_0");

  WZ->SetFillColor(kOrange-2);
  WZ->SetLineColor(kOrange-2);

  Zgamma->SetFillColor(kRed+1);
  Zgamma->SetLineColor(kRed+1);

  ZZ->SetFillColor(kRed+1);
  ZZ->SetLineColor(kRed+1);

  fakes->SetFillColor(kGray+1);
  fakes->SetLineColor(kGray+1);

  WV->SetFillColor(kRed+1);
  WV->SetLineColor(kRed+1);

  VVV->SetFillColor(kRed+1);
  VVV->SetLineColor(kRed+1);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  canvas->SetLogy(logy);

  data->Draw("ep");


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = data->GetXaxis();
  TAxis* yaxis = data->GetYaxis();
  
  xaxis->SetLabelFont  (  42);
  xaxis->SetLabelOffset(0.01);
  xaxis->SetLabelSize  (0.05);
  xaxis->SetNdivisions ( 505);
  xaxis->SetTitleFont  (  42);
  xaxis->SetTitleOffset( 1.2);
  xaxis->SetTitleSize  (0.05);

  yaxis->SetLabelFont  (  42);
  yaxis->SetLabelOffset(0.01);
  yaxis->SetLabelSize  (0.05);
  yaxis->SetNdivisions ( 505);
  yaxis->SetTitleFont  (  42);
  yaxis->SetTitleOffset( 1.6);
  yaxis->SetTitleSize  (0.05);

  xaxis->SetTitle("p_{T}^{Z} (GeV)");
  yaxis->SetTitle(Form("Events /  %.0f GeV", data->GetBinWidth(0)));


  // Adjust scale
  //----------------------------------------------------------------------------
  Float_t theMax   = GetMaximumIncludingErrors(data);
  Float_t theMaxMC = GetMaximumIncludingErrors(aTGC_dk);

  if (theMaxMC > theMax) theMax = theMaxMC;

  if (canvas->GetLogy()) {
    data->SetMaximum(15 * theMax);
    data->SetMinimum(1);
  } else {
    data->SetMaximum(1.2 * theMax);
  }


  // Legend
  //----------------------------------------------------------------------------
  Double_t x0;
  Double_t y0;

  if (logy)
    {
      x0 = 0.630;
      y0 = 0.765;

      DrawTLegend(x0 - 0.37, y0 + 2.*(_yoffset+0.001), data,     " Data",                              "ep");
      DrawTLegend(x0 - 0.37, y0 + 1.*(_yoffset+0.001), aTGC_dk,  " WZ aTGC (#Delta#kappa^{Z} = 0.6)",  "l");
      DrawTLegend(x0 - 0.37, y0,                       aTGC_dg,  " WZ aTGC (#Deltag^{Z}_{1} = -0.06)", "l");
      DrawTLegend(x0 - 0.37, y0 - 1.*(_yoffset+0.001), aTGC_lam, " WZ aTGC (#lambda = 0.04)",          "l");
      DrawTLegend(x0,        y0 + 2.*(_yoffset+0.001), WZ,       " WZ",                                "f");
      DrawTLegend(x0,        y0 + 1.*(_yoffset+0.001), fakes,    " Non-prompt leptons",                "f");
      DrawTLegend(x0,        y0,                       ZZ,       " MC background",                     "f");
    }
  else
    {
      x0 = 0.570;
      y0 = 0.755;

      DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), data,     " Data",                              "ep");
      DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), aTGC_dk,  " WZ aTGC (#Delta#kappa^{Z} = 0.6)",  "l");
      DrawTLegend(x0, y0,                       aTGC_dg,  " WZ aTGC (#Deltag^{Z}_{1} = -0.06)", "l");
      DrawTLegend(x0, y0 - 1.*(_yoffset+0.001), aTGC_lam, " WZ aTGC (#lambda = 0.04)",          "l");
      DrawTLegend(x0, y0 - 2.*(_yoffset+0.001), WZ,       " WZ",                                "f");
      DrawTLegend(x0, y0 - 3.*(_yoffset+0.001), fakes,    " Non-prompt leptons",                "f");
      DrawTLegend(x0, y0 - 4.*(_yoffset+0.001), ZZ,       " MC background",                     "f");
    }


  // Finish it
  //----------------------------------------------------------------------------
  data->SetTitle("");

  if (logy)
    {
      DrawTLatex(_cmsTextFont,   0.190, 0.94, 0.055, 11, "CMS");
      //      DrawTLatex(_extraTextFont, 0.315, 0.94, 0.030, 11, "Preliminary");
    }
  else
    {
      DrawTLatex(_cmsTextFont,   0.215, 0.891, 0.055, 13, "CMS");
      //      DrawTLatex(_extraTextFont, 0.215, 0.837, 0.030, 13, "Preliminary");
    }

  DrawTLatex(_lumiTextFont, 0.940, 0.94, 0.040, 31, "19.6 fb^{-1} (8 TeV)");

  WZ      ->Draw("hist,same");
  aTGC_dk ->Draw("hist,same");
  aTGC_lam->Draw("hist,same");
  aTGC_dg ->Draw("hist,same");
  fakes   ->Draw("hist,same");
  ZZ      ->Draw("hist,same");
  Zgamma  ->Draw("hist,same");
  WV      ->Draw("hist,same");
  VVV     ->Draw("hist,same");
  data    ->Draw("ep,same");

  canvas->GetFrame()->DrawClone();
  canvas->RedrawAxis();
  canvas->Update();
  
  TString cname = name;

  if (logy) cname += "_log_range";

  canvas->SaveAs("pdf/" + cname + ".pdf");
  canvas->SaveAs("png/" + cname + ".png");
}