Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-21 23:59:02

0001 // Drawing template (originally used for TRG-17-001)
0002 // Author: O. Davignon (CERN)
0003 #include <TCanvas.h>
0004 #include <TF1.h>
0005 #include <TLatex.h>
0006 #include <TLegend.h>
0007 #include <TPaveText.h>
0008 #include <TMarker.h>
0009 #include <TLine.h>
0010 #include <TAxis.h>
0011 #include <TROOT.h>
0012 #include <TStyle.h>
0013 #include <TH1.h>
0014 #include <TGraph.h>
0015 #include <TMultiGraph.h>
0016 #include <TGraphAsymmErrors.h>
0017 
0018 TCanvas* CreateCanvas(TString CanvasName = "myPlot", bool LogY = false, bool Grid = true) {
0019   TCanvas* c = new TCanvas(CanvasName.Data(), CanvasName.Data(), 800, 800);
0020   c->SetLeftMargin(0.11);
0021   if (Grid) {
0022     c->SetGrid();
0023   }
0024   if (LogY) {
0025     c->SetLogy();
0026   }
0027   return c;
0028 }
0029 
0030 void DrawPrelimLabel(TCanvas* c) {
0031   c->cd();
0032 
0033   TLatex tex;
0034   tex.SetTextSize(0.03);
0035   tex.DrawLatexNDC(0.11, 0.91, "#scale[1.5]{CMS} Phase-2 Simulation");  //typically for Phase-2
0036   // tex.DrawLatexNDC(0.11,0.91,"#scale[1.5]{CMS}");//typically for Phase-1
0037   tex.Draw("same");
0038 
0039   return;
0040 }
0041 
0042 void DrawLumiLabel(TCanvas* c, TString toDisplay = "14 TeV, 3000 fb^{-1}, 200 PU") {
0043   c->cd();
0044 
0045   TLatex tex;
0046   tex.SetTextSize(0.035);
0047   tex.SetTextAlign(31);
0048   //TString toDisplay = toDisplay;//typically for Phase-2
0049   // TString toDisplay = Lumi + " fb^{-1} (13 TeV)";//typically for Phase-1
0050   tex.DrawLatexNDC(0.90, 0.91, toDisplay.Data());
0051   tex.Draw("same");
0052 
0053   return;
0054 }
0055 
0056 void SaveCanvas(TCanvas* c, TString PlotName = "myPlotName") {
0057   c->cd();
0058   c->SaveAs(PlotName + ".png");
0059   c->SaveAs(PlotName + ".pdf");
0060   c->SaveAs(PlotName + ".root");
0061 
0062   return;
0063 }