Пример #1
0
TCanvas* createCanvas(TString name,int xlen,int ylen,int xDiv,bool logOn) {

  TCanvas* aCanvas = new TCanvas(name,name,xlen,ylen);

  float xstep = 1./xDiv;

  for (int i1=1; i1<=xDiv; i1++) {

    TPad *mainPad = new TPad("","",0.01+((i1-1)*xstep),0.25,(i1*xstep)-0.01,0.99);
    mainPad->SetNumber(i1);
    mainPad->Draw();

    TPad *ratioPad = new TPad("","",0.01+((i1-1)*xstep),0.01,(i1*xstep)-0.01,0.25);
    ratioPad->SetNumber(i1+xDiv);
    ratioPad->Draw();
  }

  if (logOn==true) { gPad->SetLogy(); }

  aCanvas->SetFillColor(0);
  aCanvas->SetBottomMargin(0.125);
  aCanvas->SetLeftMargin(0.125);
  aCanvas->SetFrameFillColor(0);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameLineWidth(2);

  return aCanvas;
}
Пример #2
0
TCanvas * newTCanvas(char* rootname, char* title){
	TCanvas * canv =new TCanvas( rootname, title, 800, 800);
	canv->SetTopMargin(0.06);
	canv->SetBottomMargin(0.15);
	canv->cd();
	return canv;
}
Пример #3
0
TCanvas* createCanvas(TString name,int xlen,int ylen, int xDiv, bool ratio) {
  TCanvas* aCanvas = new TCanvas(name,name,xlen*xDiv,ylen);

  float xstep = 1./xDiv;
  
  
  for (int i1=0; i1<xDiv; i1++) {

    TPad *mainPad = new TPad();//,0.01+((i1)*xstep),0.25,((i1+1)*xstep)-0.01,0.99);
    mainPad->SetNumber(1+i1);
    if(ratio){
      mainPad = new TPad();//,0.01+((i1)*xstep),0.25,((i1+1)*xstep)-0.01,0.99);
      mainPad->SetNumber(i1);
    }
    mainPad->Draw();
    if(ratio){
      TPad *ratioPad = new TPad("","",0.01+((i1)*xstep),0.01,((i1+1)*xstep)-0.01,0.25);
      ratioPad->SetNumber(i1*2+2);
     ratioPad->Draw();
    }
  }
  

  aCanvas->SetFillColor(0);
  aCanvas->SetBottomMargin(0.125);
  aCanvas->SetLeftMargin(0.125);
  aCanvas->SetFrameFillColor(0);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameLineWidth(2);

  return aCanvas;
}
Пример #4
0
void
Compare(const TString& mode1,
        const TString& mode2)
{
  TH1* h1 = 0;
  TH1* h2 = 0;
  TH1* r1 = 0;
  TH1* i1 = 0;
  TH1* r2 = 0;
  TH1* i2 = 0;
  TProfile* t1 = 0;
  TProfile* t2 = 0;

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

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

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

  can->Print(Form("%s_%s.png", mode1.Data(), mode2.Data()));
}
Пример #5
0
TCanvas * newTCanvas(string rootname, string title){
	TCanvas * canv =new TCanvas( rootname.data(), title.data(), 800, 800);
	canv->SetTopMargin(0.06);
	canv->SetBottomMargin(0.15);
	canv->cd();
	return canv;
}
Пример #6
0
TCanvas* MakeCanvas(const char* name, const char *title, int dX, int dY)
{
  // Start with a canvas
  TCanvas *canvas = new TCanvas(name,title,0,0,dX,dY);
  // General overall stuff
  canvas->SetFillColor      (0);
  canvas->SetBorderMode     (0);
  canvas->SetBorderSize     (10);
  // Set margins to reasonable defaults
  canvas->SetLeftMargin     (0.20);
  canvas->SetRightMargin    (0.05);
  canvas->SetTopMargin      (0.08);
  canvas->SetBottomMargin   (0.15);
  // Setup a frame which makes sense
  canvas->SetFrameFillStyle (0);
  canvas->SetFrameLineStyle (0);
  canvas->SetFrameBorderMode(0);
  canvas->SetFrameBorderSize(10);
  canvas->SetFrameFillStyle (0);
  canvas->SetFrameLineStyle (0);
  canvas->SetFrameBorderMode(0);
  canvas->SetFrameBorderSize(10);

  return canvas;
}
Пример #7
0
// -----------------------------------------------------------------------------
//
TCanvas* getaCanvas(TString name,TDirectory* afile, bool log)
{
  afile->cd();
  TCanvas* aCanvas = new TCanvas(name);
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(0);
  aCanvas->Range(-288.2483,-2.138147,1344.235,6.918939);
  aCanvas->SetFillColor(0);
  aCanvas->SetBorderMode(0);
  aCanvas->SetBorderSize(2);
  if ( log == true)aCanvas->SetLogy();
  aCanvas->SetLeftMargin(0.1765705);
  aCanvas->SetRightMargin(0.05772496);
  aCanvas->SetTopMargin(0.04778761);
  aCanvas->SetBottomMargin(0.1256637);
  aCanvas->SetFrameFillStyle(0);
  aCanvas->SetFrameLineWidth(2);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameFillStyle(0);
  aCanvas->SetFrameLineWidth(2);
  aCanvas->SetFrameBorderMode(0);
 
  
  return aCanvas;
}
Пример #8
0
//------------------------------------------------------------------------------
void  PlotAlignmentValidation::setCanvasStyle( TCanvas& canv )
{
  canv.SetFillStyle   ( 4000 );
  canv.SetLeftMargin  ( 0.15 );
  canv.SetRightMargin ( 0.05 );
  canv.SetBottomMargin( 0.15 );
  canv.SetTopMargin   ( 0.12 );
}
void canvasStyle(TCanvas& canv) 
{
  canv.SetFillStyle   ( 4000 );
  canv.SetLeftMargin  ( 0.20 );
  canv.SetRightMargin ( 0.05 );
  canv.SetBottomMargin( 0.15 );
  canv.SetTopMargin   ( 0.05 );
}
void showGraph(double canvasSizeX, double canvasSizeY,
	       TGraph* graph, 
	       bool useLogScaleX, double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
	       bool useLogScaleY, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
	       const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2); 
  canvas->SetTopMargin(0.05);
  canvas->SetLeftMargin(0.19);
  canvas->SetBottomMargin(0.19);
  canvas->SetRightMargin(0.05);
  canvas->SetLogx(useLogScaleX);
  canvas->SetLogy(useLogScaleY);

  TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", 10, xMin, xMax);
  dummyHistogram->SetTitle("");
  dummyHistogram->SetStats(false);
  dummyHistogram->SetMinimum(yMin);
  dummyHistogram->SetMaximum(yMax);
  dummyHistogram->Draw("axis");

  TAxis* xAxis = dummyHistogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(xAxisOffset);
  xAxis->SetTitleSize(0.065);
  xAxis->SetLabelSize(0.055);
  xAxis->SetLabelOffset(0.01);
  xAxis->SetTickLength(0.055);
  xAxis->SetNdivisions(505);

  TAxis* yAxis = dummyHistogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(yAxisOffset);
  yAxis->SetTitleSize(0.070);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelOffset(0.01);
  yAxis->SetTickLength(0.055);
  yAxis->SetNdivisions(505);

  graph->SetMarkerColor(1);
  graph->SetLineColor(1);
  graph->Draw("p");

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( useLogScaleY ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  //canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete dummyHistogram;
  delete canvas;  
}
Пример #11
0
//------------------------------------------------------------//
// Make canvas
//------------------------------------------------------------//
TCanvas* makeCanvas(TString name)
{

  TCanvas* c = new TCanvas(name.Data(), name.Data(), 700, 500);
  c->SetTicks(1,1);
  c->SetTopMargin(0.05);
  c->SetRightMargin(0.05);
  c->SetBottomMargin(0.12);
  c->SetLeftMargin(0.12);
  
  return c;
}
TCanvas* getaCanvas(TString name)
{

  TCanvas* aCanvas = new TCanvas(name);

  aCanvas->SetFillColor(0);
  aCanvas->SetBottomMargin(0.125);
  aCanvas->SetLeftMargin(0.125);
  aCanvas->SetFrameFillColor(0);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameLineWidth(2);
  return aCanvas;
}
TCanvas* getaCanvas(TString name)
{

  TCanvas* aCanvas = new TCanvas(name,"",292,55,500,700);//,"",181,237,1575,492);

  aCanvas->SetFillColor(0);
  aCanvas->SetBottomMargin(0.125);
  aCanvas->SetLeftMargin(0.125);
  aCanvas->SetFrameFillColor(0);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameLineWidth(2);
  return aCanvas;
}
Пример #14
0
void showHistograms(double canvasSizeX, double canvasSizeY,
		    TH1* histogram, 
		    double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
		    bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
		    const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);
  canvas->SetLeftMargin(0.15);
  canvas->SetBottomMargin(0.15);
  canvas->SetLogy(useLogScale);

  histogram->SetTitle("");
  histogram->SetStats(true);
  histogram->SetMinimum(yMin);
  histogram->SetMaximum(yMax);
  histogram->SetLineColor(1);
  histogram->SetLineWidth(2);
  histogram->SetMarkerColor(1);
  histogram->SetMarkerStyle(20);
  histogram->SetMarkerSize(1.5);
  histogram->Draw("hist");

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetRangeUser(xMin, xMax);
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleSize(0.060);
  xAxis->SetTitleOffset(xAxisOffset);
  xAxis->SetLabelSize(0.050);
  xAxis->SetNdivisions(505);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleSize(0.060);
  yAxis->SetTitleOffset(yAxisOffset);
  yAxis->SetLabelSize(0.050);
  yAxis->SetNdivisions(505);

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( useLogScale ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  //canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete canvas;  
}
Пример #15
0
TGraph2D LoadTGraph2D(TString name)
{
    gROOT->ProcessLine(".x " + name + ".C");    
    std::string canvasName(name + "Canvas");
    TCanvas *pTCanvas = new TCanvas(canvasName.c_str(), canvasName.c_str(), 800, 600);
    pTCanvas->SetTopMargin(0.05);
    pTCanvas->SetBottomMargin(0.15);
    pTCanvas->SetLeftMargin(0.15);
    pTCanvas->SetRightMargin(0.05);

    gPad->SetTheta(30); // default is 30
    gPad->SetPhi(120); // default is 30
    gPad->Update();

    TH3F *pTH3F = new TH3F("AxisName","",100,-0.04,0.04,100,-0.04,0.04,100,0.75,1.25);
    pTH3F->GetXaxis()->SetTitle("#alpha_{4}");
    pTH3F->GetXaxis()->CenterTitle();
    pTH3F->GetXaxis()->SetLabelSize(0.05);
    pTH3F->GetXaxis()->SetTitleSize(0.05);
    pTH3F->GetXaxis()->SetTitleOffset(1.75);
    pTH3F->GetXaxis()->SetNdivisions(5);
    pTH3F->GetYaxis()->SetTitle("#alpha_{5}");
    pTH3F->GetYaxis()->CenterTitle();
    pTH3F->GetYaxis()->SetLabelSize(0.05);
    pTH3F->GetYaxis()->SetTitleSize(0.05);
    pTH3F->GetYaxis()->SetTitleOffset(1.75);
    pTH3F->GetYaxis()->SetNdivisions(5);
    pTH3F->GetZaxis()->SetTitle("w");
    pTH3F->GetZaxis()->CenterTitle();
    pTH3F->GetZaxis()->SetLabelSize(0.05);
    pTH3F->GetZaxis()->SetTitleSize(0.05);
    pTH3F->GetZaxis()->SetTitleOffset(1.5);
    pTH3F->GetZaxis()->SetNdivisions(5);
    pTH3F->Draw();

    Graph2D->SetMarkerStyle(20);
    Graph2D->SetMinimum(0.75);
    Graph2D->SetMaximum(1.25);
    Graph2D->Draw("surf1 same");

    Graph2DA->SetMarkerStyle(20);
    Graph2DA->SetMarkerColor(kBlack);
    Graph2DA->SetMinimum(0.75);
    Graph2DA->SetMaximum(1.25);
    Graph2DA->Draw("p same");

    pTCanvas->SaveAs(name + ".pdf");
}
TCanvas* pMenu(std::string what)
{
  TCanvas* c = new TCanvas(("cMenu"+what).c_str(),("cMenu"+what).c_str(),1500,400); 
  c->SetBottomMargin(0.6);
  c->SetLeftMargin(0.04);
  c->SetRightMargin(0.01);
  TH1D* h = (TH1D*)gROOT->FindObject(("hMenuAlgos"+what).c_str());
  h->SetLineColor(4);
  h->SetFillColor(4);
  h->SetFillStyle(3003);
  h->LabelsOption("v");
  h->GetYaxis()->SetLabelOffset(0.005);
//  h->GetXaxis()->SetRange(550,680);
  h->DrawCopy();
  return c;
}
void showHistogram1d(TH1* histogram, 
		     const std::string& xAxisTitle,
		     Float_t* genX, 
		     const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 600);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.16);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle("Sampling Points");
  yAxis->SetTitleOffset(1.60);

  histogram->SetLineColor(1);
  histogram->SetLineWidth(2);
  histogram->SetMarkerColor(1);
  histogram->SetMarkerStyle(20);
  histogram->Draw("e1p");

  TMarker* genMarker = 0;
  if ( genX ) {
    genMarker = new TMarker(*genX, 0.10, 34);
    genMarker->SetMarkerColor(1);
    genMarker->SetMarkerSize(2);
    genMarker->Draw();
  }

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete genMarker;
  delete canvas;  
}
Пример #18
0
void setCanvasOptions(TCanvas& canvas)
{
  canvas.SetWindowSize(610,630);
  canvas.SetFillStyle(0);
  canvas.SetFillColor(0);
  canvas.SetGrid();
  canvas.SetBorderMode(0);
  canvas.SetFrameBorderMode(0);
  canvas.SetFrameBorderSize(1);
  canvas.SetFrameFillColor(0);
  canvas.SetFrameFillStyle(0);
  canvas.SetFrameLineColor(1);
  canvas.SetFrameLineStyle(1);
  canvas.SetFrameLineWidth(1);
  canvas.SetTopMargin(0.05);
  canvas.SetBottomMargin(0.13);
  canvas.SetLeftMargin(0.13);
  canvas.SetRightMargin(0.05);
  canvas.SetTickx(1);
  canvas.SetTicky(1);
  TH1F* frame = canvas.DrawFrame(0.0, 0.0, 5.0, 1.0);
  frame->GetXaxis()->SetTitle("#DeltaR_{tag-probe}");
  frame->GetYaxis()->SetTitle("Unit-normalized events per 0.1");
  frame->GetXaxis()->SetTitleColor(1);
  frame->GetYaxis()->SetTitleColor(1);
  frame->GetXaxis()->SetTitleFont(42);
  frame->GetYaxis()->SetTitleFont(42);
  frame->GetXaxis()->SetTitleSize(0.06);
  frame->GetYaxis()->SetTitleSize(0.06);
  frame->GetXaxis()->SetTitleOffset(0.9);
  frame->GetYaxis()->SetTitleOffset(1.05);
  frame->GetXaxis()->SetLabelColor(1);
  frame->GetYaxis()->SetLabelColor(1);
  frame->GetXaxis()->SetLabelFont(42);
  frame->GetYaxis()->SetLabelFont(42);
  frame->GetXaxis()->SetLabelSize(0.05);
  frame->GetXaxis()->SetLabelOffset(0.007);
  frame->GetYaxis()->SetLabelOffset(0.007);
  frame->GetXaxis()->SetAxisColor(1);
  frame->GetYaxis()->SetAxisColor(1);
  frame->GetXaxis()->SetDecimals(kTRUE);
  frame->GetYaxis()->SetDecimals(kTRUE);
  frame->GetXaxis()->SetTickLength(0.03);
  frame->GetYaxis()->SetTickLength(0.03);
  frame->GetXaxis()->SetNdivisions(510);
  frame->GetYaxis()->SetNdivisions(510);
}
Пример #19
0
void plotCentrality(){

  
  TFile* f4 = new TFile("histogram_test_MB_2760GeV.root");
  TH1D* cent  = f4->Get("demo/centhist");
  TCanvas* cd = new TCanvas("cd","",600,500);
  cd->SetLeftMargin(0.12);
  cd->SetRightMargin(0.02);
  cd->SetTopMargin(0.02);
  cd->SetBottomMargin(0.12);
  cd->SetTicks(1);
  cent->SetTitle("");
  cent->SetXTitle("Centrality (200 bins)");
  cent->SetYTitle("# of Events");
  cent->GetYaxis()->SetTitleOffset(1.2);
  cent->GetXaxis()->SetTitleOffset(1.2);
  cent->GetXaxis()->CenterTitle(1);
  cent->GetYaxis()->CenterTitle(1);
  cent->GetXaxis()->SetTitleSize(0.046);
  cent->GetYaxis()->SetTitleSize(0.046);
  cent->GetXaxis()->SetTitleFont(62);
  cent->GetYaxis()->SetTitleFont(62);
  cent->SetAxisRange(0,209,"Y");
  cent->SetAxisRange(0,203,"X");
  cent->SetMarkerStyle(20);
  cent->Sumw2();
  cent->SetMarkerSize(1);
  cent->SetMarkerColor(1);
  cent->SetLineColor(1);
  //cent->SetStats(0);
  cent->Draw("Pez");

    TLatex *tex1= new TLatex(55.5,125.060,"Hydjet 2.76TeV MB");
    tex1->SetTextColor(1);
    tex1->SetTextSize(0.05);
    tex1->SetTextFont(42);
    tex1->Draw();

    TLatex *tex2= new TLatex(55.5,99.054,"CMSSW_7_5_0_pre5");
    tex2->SetTextColor(1);
    tex2->SetTextSize(0.05);
    tex2->SetTextFont(42);
    //tex2->Draw();
  cd->SaveAs("centralityDist750x2760GeV.png");

}
Пример #20
0
TCanvas *OverlayAnalysis::CreateCanvas(const std::string &canvasName, const std::string &canvasTitle) const
{
    TCanvas *pCanvas = new TCanvas(canvasName.c_str(), canvasTitle.c_str(), 200, 52, 700, 650);

    pCanvas->SetFillColor(0);
    pCanvas->SetBorderMode(0);
    pCanvas->SetBorderSize(2);
    pCanvas->SetTickx(1);
    pCanvas->SetTicky(1);
    pCanvas->SetLeftMargin(0.15);
    pCanvas->SetRightMargin(0.03);
    pCanvas->SetTopMargin(0.05);
    pCanvas->SetBottomMargin(0.14);
    pCanvas->SetFrameBorderMode(0);
    pCanvas->SetFrameBorderMode(0);

    return pCanvas;
}
Пример #21
0
void StackHistograms(int arm=1, int lyr=1, int sen=9, char *input="inputR") {
  gStyle->SetOptStat(0);

  int idx = arm*8*24*128 + lyr*24*128 + sen*128;
  //open(input,idx,idx+12*128);
  double ymax = open(input,idx,128);

  pointersHI[0]->GetXaxis()->SetRangeUser(5,35);
  pointersHI[0]->GetYaxis()->SetRangeUser(0,ymax);
  pointersLO[0]->GetXaxis()->SetRangeUser(5,25);
  pointersLO[0]->GetYaxis()->SetRangeUser(0,ymax);
  TLegend *leg = new TLegend(0.65,0.20,0.88,0.88,Form("A%dL%dS%d",arm,lyr,sen));
  for(int i=0; i!=N; ++i)
    leg->AddEntry(pointersHI[i],text[i].Data());

  for(int i=0; i!=N; ++i) {
    pratioHI[i] = (TH1D*) pointersHI[i]->Clone( Form("r%s",pointersHI[i]->GetName()) );
    pratioLO[i] = (TH1D*) pointersLO[i]->Clone( Form("r%s",pointersLO[i]->GetName()) );
    pratioHI[i]->Divide( pointersHI[3] );
    pratioLO[i]->Divide( pointersLO[3] );
    pratioHI[i]->GetYaxis()->SetTitle("RATIO");
    pratioLO[i]->GetYaxis()->SetTitle("RATIO");
    pratioHI[i]->GetYaxis()->SetRangeUser(0,2.7);
    pratioLO[i]->GetYaxis()->SetRangeUser(0,2.7);
  }


  TCanvas *main = new TCanvas("main","main",1400,600);
  main->SetLeftMargin(0.2);
  main->SetBottomMargin(0.2);
  main->Divide(2,1);

  main->cd(1);
  pointersHI[0]->Draw();
  for(int i=0; i!=N; ++i)
    pointersHI[i]->Draw("SAME");

  main->cd(2);
  pointersLO[0]->Draw();
  for(int i=0; i!=N; ++i)
    pointersLO[i]->Draw("SAME");
  leg->Draw();

}
Пример #22
0
void Correlation::DrawMatrix(){

  map<TString, map<TString,double> >::iterator it1 = results.begin();
  map<TString, double>::iterator it2 = ((*it1).second).begin();

  int nvars = (int) results.size();
  TH2F* hmatrix = new TH2F("matrix","",nvars,0,nvars,nvars,0,nvars);
  hmatrix->SetStats(0);

  int counter1= 1;
  for(it1 = results.begin(); it1!= results.end(); ++it1){

    TString var1 = (*it1).first;
    var1.ReplaceAll("_both_mix_merge","");
    hmatrix->GetXaxis()->SetBinLabel(counter1,var1);
    counter1++;

    int counter2=1;
    map<TString, double> results2 = (*it1).second;
    map<TString, double>::iterator it2 = results2.begin();

    for(it2 = results2.begin(); it2!=results2.end(); ++it2){
      TString var2 = (*it2).first;
      var2.ReplaceAll("_both_mix_merge","");
      //cout << counter2 << " " << var2 << endl;
      if ( counter1==1) hmatrix->GetYaxis()->SetBinLabel(counter2,var2);
      counter2++;
      double value = abs((*it2).second);
      //cout << var1 << " " << var2 << " " << value << endl;
      hmatrix->Fill(var1,var2,value);
      if(var1!=var2) hmatrix->Fill(var2,var1,value);
    }
  }

  TCanvas* c = new TCanvas("c","",700,700);
  hmatrix->GetXaxis()->SetLabelSize(0.03);
  hmatrix->GetYaxis()->SetLabelSize(0.03);
  c->SetLeftMargin(0.2);
  c->SetBottomMargin(0.2);
  hmatrix->Draw("colz");
  c->SaveAs("results/matrix.pdf");
  c->SaveAs("results/matrix.eps");

}
Пример #23
0
void LEPStyle::setCanvas()
{
  delete _canv;

  _n = _entry.size();

  //  _t = 40;
  //  _b = 70;
  //  _g = 42;
  //  _d = 42;
  //  _h = 130;
  //  _h = 100;
  //  _w = 700;
  
  _W = _g + _w + _d;
  _H = _t + _n*_h + _b ;
  //GHM  _H = _t + (_n+1)*_h + _b ;

  _scale = 400./_H;

  cout << "W/H= " << _W << "/" << _H << endl; 

  _canv=new TCanvas( _name, _title, 0, 0, _W, _H );  
  _canv->SetLeftMargin(  _g/_W );
  _canv->SetRightMargin( _d/_W );
  _canv->SetTopMargin(  _t/_H );
  _canv->SetBottomMargin( _b/_H ); 
  _canv->SetFillColor(0);
  _canv->SetTickx(1);
  _canv->SetTicky(1);
  if( _logX ) 
    {
      _canv->SetLogx();
      _canv->SetGridx();
    }
  _canv->SetFrameFillStyle(0);
  _canv->SetFrameLineWidth(2);
  _canv->SetFrameBorderMode(0);

  gStyle->SetTickLength( 1.2*gStyle->GetTickLength("X")*_scale, "X" );
  //  gStyle->SetEndErrorSize(5*_scale);
  gStyle->SetEndErrorSize(10*_scale);
}
Пример #24
0
TCanvas* makeNiceCanvas(Int_t pixelPerBin, Int_t nbinx, Int_t nbiny, Int_t top, Int_t bottom, Int_t left, Int_t right) {
  
  Int_t rubaX = 4; //determinato sperimentalmente                                                                          
  Int_t rubaY = 28; //determinato sperimentalmente                                                                                                        
  TString name = generateRandomName();

  Int_t plotBaseDimX = pixelPerBin*nbinx;
  Int_t plotBaseDimY = pixelPerBin*nbiny;
  Int_t XX = (plotBaseDimX+left+right+rubaX);
  Int_t YY = (plotBaseDimY+top+bottom+rubaY);
  TCanvas* can = new TCanvas(name,name,XX,YY);
  can->SetTopMargin(1.*top/YY);
  can->SetBottomMargin(1.*bottom/YY);
  can->SetRightMargin(1.*right/XX);
  can->SetLeftMargin(1.*left/XX);
  can->SetBorderMode(0);
  std::cout << "Nice canvas " << XX << " * " << YY << std::endl;
  return can;

}
Пример #25
0
  TCanvas* makeNiceCanvasByFracMargins(Int_t pixelPerBin, Int_t nbinx, Int_t nbiny, Double_t top, Double_t bottom, Double_t left, Double_t right) {
  
  Int_t rubaX = 4; //determinato sperimentalmente                                                                          
  Int_t rubaY = 28; //determinato sperimentalmente                                                                                                        
  TString name = generateRandomName();

  Int_t plotBaseDimX = pixelPerBin*nbinx;
  Int_t plotBaseDimY = pixelPerBin*nbiny;
  Int_t XX = (Int_t)(plotBaseDimX/(1.-left-right));
  Int_t YY = (Int_t)(plotBaseDimY/(1.-top-bottom));
  TCanvas* can = new TCanvas(name,name,XX+rubaX,YY+rubaY);
  can->SetTopMargin(top);
  can->SetBottomMargin(bottom);
  can->SetRightMargin(right);
  can->SetLeftMargin(left);
  can->SetBorderMode(0);
  std::cout << "Nice canvas " << XX << " * " << YY << std::endl;
  return can;

}
Пример #26
0
TCanvas* makeNiceCanvasByPixMargins(Int_t pixelPerBinX, Int_t pixelPerBinY, Int_t nbinx, Int_t nbiny, Int_t top, Int_t bottom, Int_t left, Int_t right) {
  
  Int_t rubaX = 4; //determinato sperimentalmente                                                                          
  Int_t rubaY = 28; //determinato sperimentalmente                                                                                                        

  TString name = generateRandomName();

  Int_t plotBaseDimX = pixelPerBinX*nbinx;
  Int_t plotBaseDimY = pixelPerBinY*nbiny;
  Int_t XX = (Int_t)(plotBaseDimX+left+right);
  Int_t YY = (Int_t)(plotBaseDimY+top+bottom);
  TCanvas* can = new TCanvas(name,name,XX+rubaX,YY+rubaY);
  can->SetTopMargin((1.*top)/(1.*YY));
  can->SetBottomMargin((1.*bottom)/(1.*YY));
  can->SetRightMargin(right/(1.*XX));
  can->SetLeftMargin(left/(1.*XX));
  can->SetBorderMode(0);
  std::cout << "Nice canvas " << XX << " * " << YY << " Margin: t " << can->GetTopMargin() << " b " << can->GetBottomMargin() << " l " << can->GetLeftMargin() << " r " << can->GetRightMargin() << std::endl;

  return can;

}
Пример #27
0
void hist2image()
{

   TCanvas *canv = new TCanvas("image", "xygaus + xygaus(5) + xylandau(10)");
   canv->ToggleEventStatus();
   canv->SetRightMargin(0.2);
   canv->SetLeftMargin(0.01);
   canv->SetTopMargin(0.01);
   canv->SetBottomMargin(0.01);

   // histogram as image (hist taken from draw2dopt.C)
   TImage *img = TImage::Create();

   TF2 *f2 = new TF2("f2","(xygaus + xygaus(5) + xylandau(10))",-4,4,-4,4);
   Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3};
   f2->SetParameters(params);
   TH2D *h2 = new TH2D("h2","xygaus + xygaus(5) + xylandau(10)",100,-4,4,100,-4,4);
   h2->FillRandom("f2",40000);
   img->SetImage((const Double_t *)h2->GetArray(), h2->GetNbinsX() + 2,
                  h2->GetNbinsY() + 2, gHistImagePalette);
   img->Draw();
   img->StartPaletteEditor();
}
Пример #28
0
// -----------------------------------------------------------------------------
//
TCanvas* createCanvas(std::string name,TDirectory* afile, bool log)
{
  afile->cd();
  TCanvas* aCanvas = new TCanvas(name.c_str());
  //gStyle->SetOptFit(1);
  //gStyle->SetOptStat("mr");
  //aCanvas->Range(-288.2483,-2.138147,1344.235,6.918939);
  aCanvas->SetFillColor(0);
  aCanvas->SetBorderMode(0);
  aCanvas->SetBorderSize(2);
  if ( log == true)aCanvas->SetLogy();
  aCanvas->SetLeftMargin(0.15);
  aCanvas->SetRightMargin(0.05);
  aCanvas->SetTopMargin(0.05);
  aCanvas->SetBottomMargin(0.12);
  aCanvas->SetFrameFillStyle(0);
  aCanvas->SetFrameLineWidth(2);
  aCanvas->SetFrameBorderMode(0);
  aCanvas->SetFrameFillStyle(0);
  aCanvas->SetFrameLineWidth(2);
  aCanvas->SetFrameBorderMode(0);
  
  return aCanvas;
}
Пример #29
0
void plotZmmStatCorrelations(const TString  outputDir,   // output directory
             const Double_t lumi         // integrated luminosity (/fb)
) {
  gBenchmark->Start("plotZmmStatCorrelations");
  gStyle->SetTitleOffset(0.75,"Y");

  //--------------------------------------------------------------------------------------------------------------
  // Settings 
  //==============================================================================================================   
  //
  // input ntuple file names
  //
vector<TFile*> file;
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputZPt.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputPhiStar.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputZRap.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLep1Pt.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLep2Pt.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLep1Eta.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLep2Eta.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLepNegPt.root", "OPEN"));
  file.push_back(new TFile("../Unfolding/Zmm/UnfoldingOutputLepPosPt.root", "OPEN"));

  
  // plot output file format
  const TString format("png");

   
  //--------------------------------------------------------------------------------------------------------------
  // Main analysis code 
  //==============================================================================================================  

  
   
  // Create output directory
  gSystem->mkdir(outputDir,kTRUE);
  CPlot::sOutDir = outputDir;  

  //
  // Set up output file
  //
  TString outfilename = outputDir + TString("/") + TString("Zmm_StatCorrelations.root");
  TFile *outFile = new TFile(outfilename,"RECREATE");

  
  // histograms

  TH2D *ZPT_STATCORR_MATRIX=(TH2D*)(file[0]->Get("hCorr_Bayes"));
  TH2D *PHISTAR_STATCORR_MATRIX=(TH2D*)(file[1]->Get("hCorr_Bayes"));
  TH2D *ZRAP_STATCORR_MATRIX=(TH2D*)(file[2]->Get("hCorr_Bayes"));
  TH2D *LEP1PT_STATCORR_MATRIX=(TH2D*)(file[3]->Get("hCorr_Bayes"));
  TH2D *LEP2PT_STATCORR_MATRIX=(TH2D*)(file[4]->Get("hCorr_Bayes"));
  TH2D *LEP1ETA_STATCORR_MATRIX=(TH2D*)(file[5]->Get("hCorr_Bayes"));
  TH2D *LEP2ETA_STATCORR_MATRIX=(TH2D*)(file[6]->Get("hCorr_Bayes"));
  TH2D *LEPNEGPT_STATCORR_MATRIX=(TH2D*)(file[7]->Get("hCorr_Bayes"));
  TH2D *LEPPOSPT_STATCORR_MATRIX=(TH2D*)(file[8]->Get("hCorr_Bayes"));
 


  //--------------------------------------------------------------------------------------------------------------
  // Make plots 
  //==============================================================================================================  

  char xlabel[100];     // string buffer for x-axis label
  char ylabel[100];     // string buffer for y-axis label
  
  // label for lumi
  char lumitext[100];
  sprintf(lumitext,"%.1f fb^{-1}  (13 TeV)",lumi/1000);  
  
  TCanvas *c = MakeCanvas("c","c",800,800);
  c->cd();
  c->SetTopMargin(0.1);
  c->SetBottomMargin(0.15);
  c->SetLeftMargin(0.15);  
  c->SetRightMargin(0.15);  
  c->SetTickx(1);
  c->SetTicky(1);  
  TGaxis::SetMaxDigits(3);

  gStyle->SetTitleOffset(1.4,"Y");
  gStyle->SetPalette(1);
  gStyle->SetPaintTextFormat("4.2f");

  
  
  //
  // ZPt
  //   

  sprintf(ylabel,"p_{T}^{#mu^{+}#mu^{-}} [GeV]");
  sprintf(xlabel,"p_{T}^{#mu^{+}#mu^{-}} [GeV]");
  ZPT_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  ZPT_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmPt("zmmPtStatCorrelations","",xlabel,ylabel);
  plotZmmPt.AddHist2D(ZPT_STATCORR_MATRIX,"COLZ");
  plotZmmPt.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmPt.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmPt.SetLogx();
  plotZmmPt.SetLogy();
  plotZmmPt.Draw(c,kTRUE,format);

  //
  // PhiStar
  //   

  sprintf(ylabel,"#phi_{#eta}*");
  sprintf(xlabel,"#phi_{#eta}*");
  PHISTAR_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  PHISTAR_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmPhiStar("zmmPhiStarStatCorrelations","",xlabel,ylabel);
  plotZmmPhiStar.AddHist2D(PHISTAR_STATCORR_MATRIX,"COLZ");
  plotZmmPhiStar.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmPhiStar.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmPhiStar.SetLogx();
  plotZmmPhiStar.SetLogy();
  plotZmmPhiStar.Draw(c,kTRUE,format);

  //
  // ZRap
  //   

  sprintf(ylabel,"|y^{#mu^{+}#mu^{-}}|");
  sprintf(xlabel,"|y^{#mu^{+}#mu^{-}}|");
  ZRAP_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  ZRAP_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmRap("zmmRapStatCorrelations","",xlabel,ylabel);
  plotZmmRap.AddHist2D(ZRAP_STATCORR_MATRIX,"COLZ");
  plotZmmRap.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmRap.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmRap.Draw(c,kTRUE,format);

  //
  // Lep1Pt
  //   

  sprintf(ylabel,"p_{T} (leading muon) [GeV]");
  sprintf(xlabel,"p_{T} (leading muon) [GeV]");
  LEP1PT_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  LEP1PT_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  CPlot plotZmmLep1Pt("zmmLep1PtStatCorrelations","",xlabel,ylabel);
  plotZmmLep1Pt.AddHist2D(LEP1PT_STATCORR_MATRIX,"COLZ");
  plotZmmLep1Pt.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLep1Pt.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLep1Pt.SetLogx();
  plotZmmLep1Pt.SetLogy();
  plotZmmLep1Pt.Draw(c,kTRUE,format);

  //
  // Lep2Pt
  //   

  sprintf(ylabel,"p_{T} (2nd leading muon) [GeV]");
  sprintf(xlabel,"p_{T} (2nd leading muon) [GeV]");
  LEP2PT_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  LEP2PT_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmLep2Pt("zmmLep2PtStatCorrelations","",xlabel,ylabel);
  plotZmmLep2Pt.AddHist2D(LEP2PT_STATCORR_MATRIX,"COLZ");
  plotZmmLep2Pt.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLep2Pt.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLep2Pt.SetLogx();
  plotZmmLep2Pt.SetLogy();
  plotZmmLep2Pt.Draw(c,kTRUE,format);

  //
  // Lep1Eta
  //   

  sprintf(ylabel,"|#eta| (leading muon)");
  sprintf(xlabel,"|#eta| (leading muon)");
  LEP1ETA_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  LEP1ETA_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmLep1Eta("zmmLep1EtaStatCorrelations","",xlabel,ylabel);
  plotZmmLep1Eta.AddHist2D(LEP1ETA_STATCORR_MATRIX,"COLZ");
  plotZmmLep1Eta.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLep1Eta.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLep1Eta.Draw(c,kTRUE,format);

  //
  // Lep2Eta
  //   

  sprintf(ylabel,"|#eta| (2nd leading muon)");
  sprintf(xlabel,"|#eta| (2nd leading muon)");
  LEP2ETA_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  LEP2ETA_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  CPlot plotZmmLep2Eta("zmmLep2EtaStatCorrelations","",xlabel,ylabel);
  plotZmmLep2Eta.AddHist2D(LEP2ETA_STATCORR_MATRIX,"COLZ");
  plotZmmLep2Eta.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLep2Eta.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLep2Eta.Draw(c,kTRUE,format);

  //
  // LepNegPt
  //   

  sprintf(ylabel,"p_{T}^{#mu^{-}} [GeV]");
  sprintf(xlabel,"p_{T}^{#mu^{-}} [GeV]");
  LEP1PT_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  LEP1PT_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  CPlot plotZmmLepNegPt("zmmLepNegPtStatCorrelations","",xlabel,ylabel);
  plotZmmLepNegPt.AddHist2D(LEP1PT_STATCORR_MATRIX,"COLZ");
  plotZmmLepNegPt.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLepNegPt.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLepNegPt.SetLogx();
  plotZmmLepNegPt.SetLogy();
  plotZmmLepNegPt.Draw(c,kTRUE,format);

  //
  // LepPosPt
  //   

  sprintf(ylabel,"p_{T}^{#mu^{+}} [GeV]");
  sprintf(xlabel,"p_{T}^{#mu^{+}} [GeV]");
  LEP1PT_STATCORR_MATRIX->GetZaxis()->SetRangeUser(-1,1);
  LEP1PT_STATCORR_MATRIX->GetYaxis()->SetTitleOffset(1.25);
  CPlot plotZmmLepPosPt("zmmLepPosPtStatCorrelations","",xlabel,ylabel);
  plotZmmLepPosPt.AddHist2D(LEP1PT_STATCORR_MATRIX,"COLZ");
  plotZmmLepPosPt.AddTextBox("#bf{CMS} #scale[0.75]{#it{Preliminary}}",0.15,0.90,0.4,0.95,0);
  plotZmmLepPosPt.AddTextBox("Bayes Correlation Matrix",0.53,0.90,0.86,0.95,0);
  plotZmmLepPosPt.SetLogx();
  plotZmmLepPosPt.SetLogy();
  plotZmmLepPosPt.Draw(c,kTRUE,format);

  
  
  //--------------------------------------------------------------------------------------------------------------
  // Output
  //==============================================================================================================
  outFile->cd();
  outFile->Write();
  outFile->Close(); 


  cout << "*" << endl;
  cout << "* SUMMARY" << endl;
  cout << "*--------------------------------------------------" << endl;  
  cout << endl;
 
  cout << endl;
  cout << "  <> Output saved in " << outputDir << "/" << endl;    
  cout << endl;     

  gBenchmark->Show("plotZmmStatCorrelations");
}
void effAndSmallSF_DATA_MC_Cracks_pT2()
{
//=========Macro generated from canvas: Canvas/Canvas
//=========  (Mon Feb  8 17:29:37 2016) by ROOT version6.02/05
   TCanvas *Canvas = new TCanvas("Canvas", "Canvas",0,0,725,725);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   Canvas->SetHighLightColor(2);
   Canvas->Range(0,0,1,1);
   Canvas->SetFillColor(0);
   Canvas->SetBorderMode(0);
   Canvas->SetBorderSize(2);
   Canvas->SetTickx(1);
   Canvas->SetTicky(1);
   Canvas->SetLeftMargin(0.15);
   Canvas->SetRightMargin(0.05);
   Canvas->SetTopMargin(0.07);
   Canvas->SetBottomMargin(0.17);
   Canvas->SetFrameFillStyle(0);
   Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0.01,0.3,0.99,0.99);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-15.32432,-0.03620689,94.13513,1.17069);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetGridx();
   pad1->SetGridy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.14);
   pad1->SetRightMargin(0.12);
   pad1->SetBottomMargin(0.03);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   Double_t Graph0_fx3001[3] = {
   13.5,
   25,
   55};
   Double_t Graph0_fy3001[3] = {
   0.9387,
   0.9652,
   0.9863};
   Double_t Graph0_felx3001[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fely3001[3] = {
   0.0034,
   0.0013,
   0.0003};
   Double_t Graph0_fehx3001[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fehy3001[3] = {
   0.0034,
   0.0013,
   0.0003};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(3,Graph0_fx3001,Graph0_fy3001,Graph0_felx3001,Graph0_fehx3001,Graph0_fely3001,Graph0_fehy3001);
   grae->SetName("Graph0");
   grae->SetTitle("TGraphAsymmErrors for MC efficiencies");

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

   ci = TColor::GetColor("#3399ff");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(22);
   grae->SetMarkerSize(0.7);
   
   TH1F *Graph_TH1F3001 = new TH1F("Graph_TH1F3001","TH1F histogram",100,0,81);
   Graph_TH1F3001->SetMinimum(0);
   Graph_TH1F3001->SetMaximum(1.05);
   Graph_TH1F3001->SetFillStyle(0);
   Graph_TH1F3001->SetLineStyle(0);
   Graph_TH1F3001->SetMarkerStyle(20);
   Graph_TH1F3001->GetXaxis()->SetLabelFont(42);
   Graph_TH1F3001->GetXaxis()->SetLabelOffset(0.007);
   Graph_TH1F3001->GetXaxis()->SetLabelSize(0);
   Graph_TH1F3001->GetXaxis()->SetTitleSize(0.06);
   Graph_TH1F3001->GetXaxis()->SetTitleFont(42);
   Graph_TH1F3001->GetYaxis()->SetTitle("ID efficiency");
   Graph_TH1F3001->GetYaxis()->SetLabelFont(42);
   Graph_TH1F3001->GetYaxis()->SetLabelOffset(0.007);
   Graph_TH1F3001->GetYaxis()->SetLabelSize(0.05);
   Graph_TH1F3001->GetYaxis()->SetTitleSize(0.06);
   Graph_TH1F3001->GetYaxis()->SetTitleOffset(0.85);
   Graph_TH1F3001->GetYaxis()->SetTitleFont(42);
   Graph_TH1F3001->GetZaxis()->SetLabelFont(42);
   Graph_TH1F3001->GetZaxis()->SetLabelOffset(0.007);
   Graph_TH1F3001->GetZaxis()->SetLabelSize(0.05);
   Graph_TH1F3001->GetZaxis()->SetTitleSize(0.06);
   Graph_TH1F3001->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_TH1F3001);
   
   grae->Draw("a2");
   
   Double_t Graph0_fx3002[3] = {
   13.5,
   25,
   55};
   Double_t Graph0_fy3002[3] = {
   0.9387,
   0.9652,
   0.9863};
   Double_t Graph0_felx3002[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fely3002[3] = {
   0.0034,
   0.0013,
   0.0003};
   Double_t Graph0_fehx3002[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fehy3002[3] = {
   0.0034,
   0.0013,
   0.0003};
   grae = new TGraphAsymmErrors(3,Graph0_fx3002,Graph0_fy3002,Graph0_felx3002,Graph0_fehx3002,Graph0_fely3002,Graph0_fehy3002);
   grae->SetName("Graph0");
   grae->SetTitle("TGraphAsymmErrors for MC efficiencies");

   ci = TColor::GetColor("#99ccff");
   grae->SetFillColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(22);
   grae->SetMarkerSize(0.7);
   
   TH1F *Graph_Graph_TH1F30013002 = new TH1F("Graph_Graph_TH1F30013002","TH1F histogram",100,0,81);
   Graph_Graph_TH1F30013002->SetMinimum(0);
   Graph_Graph_TH1F30013002->SetMaximum(1.05);
   Graph_Graph_TH1F30013002->SetFillStyle(0);
   Graph_Graph_TH1F30013002->SetLineStyle(0);
   Graph_Graph_TH1F30013002->SetMarkerStyle(20);
   Graph_Graph_TH1F30013002->GetXaxis()->SetLabelFont(42);
   Graph_Graph_TH1F30013002->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph_TH1F30013002->GetXaxis()->SetLabelSize(0);
   Graph_Graph_TH1F30013002->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_TH1F30013002->GetXaxis()->SetTitleFont(42);
   Graph_Graph_TH1F30013002->GetYaxis()->SetTitle("ID efficiency");
   Graph_Graph_TH1F30013002->GetYaxis()->SetLabelFont(42);
   Graph_Graph_TH1F30013002->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph_TH1F30013002->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_TH1F30013002->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_TH1F30013002->GetYaxis()->SetTitleOffset(0.85);
   Graph_Graph_TH1F30013002->GetYaxis()->SetTitleFont(42);
   Graph_Graph_TH1F30013002->GetZaxis()->SetLabelFont(42);
   Graph_Graph_TH1F30013002->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph_TH1F30013002->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_TH1F30013002->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_TH1F30013002->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph_TH1F30013002);
   
   grae->Draw("p");
   
   Double_t Graph1_fx3003[3] = {
   13.5,
   25,
   55};
   Double_t Graph1_fy3003[3] = {
   0.973,
   0.9563,
   0.9835};
   Double_t Graph1_felx3003[3] = {
   6.5,
   5,
   25};
   Double_t Graph1_fely3003[3] = {
   0.004,
   0.0015,
   0.0009};
   Double_t Graph1_fehx3003[3] = {
   6.5,
   5,
   25};
   Double_t Graph1_fehy3003[3] = {
   0.004,
   0.0015,
   0.0009};
   grae = new TGraphAsymmErrors(3,Graph1_fx3003,Graph1_fy3003,Graph1_felx3003,Graph1_fehx3003,Graph1_fely3003,Graph1_fehy3003);
   grae->SetName("Graph1");
   grae->SetTitle("TGraphAsymmErrors for Data efficiencies");
   grae->SetFillColor(1);
   grae->SetMarkerStyle(9);
   grae->SetMarkerSize(0.7);
   
   TH1F *Graph_Graph3003 = new TH1F("Graph_Graph3003","TGraphAsymmErrors for Data efficiencies",100,0,87.3);
   Graph_Graph3003->SetMinimum(0.95184);
   Graph_Graph3003->SetMaximum(0.98736);
   Graph_Graph3003->SetDirectory(0);
   Graph_Graph3003->SetStats(0);
   Graph_Graph3003->SetFillStyle(0);
   Graph_Graph3003->SetLineStyle(0);
   Graph_Graph3003->SetMarkerStyle(20);
   Graph_Graph3003->GetXaxis()->SetLabelFont(42);
   Graph_Graph3003->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph3003->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph3003->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph3003->GetXaxis()->SetTitleFont(42);
   Graph_Graph3003->GetYaxis()->SetLabelFont(42);
   Graph_Graph3003->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph3003->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph3003->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph3003->GetYaxis()->SetTitleOffset(0.85);
   Graph_Graph3003->GetYaxis()->SetTitleFont(42);
   Graph_Graph3003->GetZaxis()->SetLabelFont(42);
   Graph_Graph3003->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph3003->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph3003->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph3003->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph3003);
   
   grae->Draw("p");
   
   TLegend *leg = new TLegend(0.63,0.2,0.87,0.33,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(62);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph1","Data","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(9);
   entry->SetMarkerSize(0.7);
   entry->SetTextFont(62);
   entry=leg->AddEntry("Graph0","Simulation","fp");

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

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

   ci = TColor::GetColor("#3399ff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(0.7);
   entry->SetTextFont(62);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.14,0.94,0.89,0.99,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.03);
   TText *AText = pt->AddText(0.01,0.3,"CMS Preliminary");
   AText = pt->AddText(0.7,0.3,"#sqrt{s} = 13 TeV, L = 2.26 fb^{-1}");
   pt->Draw();
      tex = new TLatex(0.67,0.4,"Z #rightarrow e^{+} e^{-}");
tex->SetNDC();
   tex->SetTextSize(0.03);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.63,0.35," Crack probes");
tex->SetNDC();
   tex->SetTextSize(0.03);
   tex->SetLineWidth(2);
   tex->Draw();
   pad1->Modified();
   Canvas->cd();
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0.01,0.01,0.99,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(-15.32432,0.4915493,94.13513,1.125352);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetGridx();
   pad2->SetGridy();
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.14);
   pad2->SetRightMargin(0.12);
   pad2->SetTopMargin(0.04);
   pad2->SetBottomMargin(0.25);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   
   Double_t Graph0_fx3004[3] = {
   13.5,
   25,
   55};
   Double_t Graph0_fy3004[3] = {
   1.0365,
   0.9908,
   0.9971};
   Double_t Graph0_felx3004[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fely3004[3] = {
   0.009,
   0.0082,
   0.0016};
   Double_t Graph0_fehx3004[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fehy3004[3] = {
   0.009,
   0.0082,
   0.0016};
   grae = new TGraphAsymmErrors(3,Graph0_fx3004,Graph0_fy3004,Graph0_felx3004,Graph0_fehx3004,Graph0_fely3004,Graph0_fehy3004);
   grae->SetName("Graph0");
   grae->SetTitle("TGraphAsymmErrors for scale factors");

   ci = TColor::GetColor("#99ccff");
   grae->SetFillColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetMarkerColor(ci);
   grae->SetMarkerSize(0.7);
   
   TH1F *Graph_Small TH1F3004 = new TH1F("Graph_Small TH1F3004","Small TH1F histogram",100,0,81);
   Graph_Small TH1F3004->SetMinimum(0.65);
   Graph_Small TH1F3004->SetMaximum(1.1);
   Graph_Small TH1F3004->SetFillStyle(0);
   Graph_Small TH1F3004->SetLineStyle(0);
   Graph_Small TH1F3004->SetMarkerStyle(20);
   Graph_Small TH1F3004->GetXaxis()->SetTitle("p_{T} [GeV]");
   Graph_Small TH1F3004->GetXaxis()->SetLabelFont(42);
   Graph_Small TH1F3004->GetXaxis()->SetLabelOffset(0.007);
   Graph_Small TH1F3004->GetXaxis()->SetLabelSize(0.08);
   Graph_Small TH1F3004->GetXaxis()->SetTitleSize(0.08);
   Graph_Small TH1F3004->GetXaxis()->SetTitleFont(42);
   Graph_Small TH1F3004->GetYaxis()->SetLabelFont(42);
   Graph_Small TH1F3004->GetYaxis()->SetLabelOffset(0.007);
   Graph_Small TH1F3004->GetYaxis()->SetLabelSize(0.08);
   Graph_Small TH1F3004->GetYaxis()->SetTitleSize(0.08);
   Graph_Small TH1F3004->GetYaxis()->SetTitleOffset(0.75);
   Graph_Small TH1F3004->GetYaxis()->SetTitleFont(42);
   Graph_Small TH1F3004->GetZaxis()->SetLabelFont(42);
   Graph_Small TH1F3004->GetZaxis()->SetLabelOffset(0.007);
   Graph_Small TH1F3004->GetZaxis()->SetLabelSize(0.05);
   Graph_Small TH1F3004->GetZaxis()->SetTitleSize(0.06);
   Graph_Small TH1F3004->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Small TH1F3004);
   
   grae->Draw("a2");
   
   Double_t Graph0_fx3005[3] = {
   13.5,
   25,
   55};
   Double_t Graph0_fy3005[3] = {
   1.0365,
   0.9908,
   0.9971};
   Double_t Graph0_felx3005[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fely3005[3] = {
   0.009,
   0.0082,
   0.0016};
   Double_t Graph0_fehx3005[3] = {
   6.5,
   5,
   25};
   Double_t Graph0_fehy3005[3] = {
   0.009,
   0.0082,
   0.0016};
   grae = new TGraphAsymmErrors(3,Graph0_fx3005,Graph0_fy3005,Graph0_felx3005,Graph0_fehx3005,Graph0_fely3005,Graph0_fehy3005);
   grae->SetName("Graph0");
   grae->SetTitle("TGraphAsymmErrors for scale factors");

   ci = TColor::GetColor("#99ccff");
   grae->SetFillColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#3399ff");
   grae->SetMarkerColor(ci);
   grae->SetMarkerSize(0.7);
   
   TH1F *Graph_Graph_Small TH1F30043005 = new TH1F("Graph_Graph_Small TH1F30043005","Small TH1F histogram",100,0,81);
   Graph_Graph_Small TH1F30043005->SetMinimum(0.65);
   Graph_Graph_Small TH1F30043005->SetMaximum(1.1);
   Graph_Graph_Small TH1F30043005->SetFillStyle(0);
   Graph_Graph_Small TH1F30043005->SetLineStyle(0);
   Graph_Graph_Small TH1F30043005->SetMarkerStyle(20);
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitle("p_{T} [GeV]");
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelFont(42);
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelSize(0.08);
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitleSize(0.08);
   Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitleFont(42);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelFont(42);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelSize(0.08);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleSize(0.08);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleOffset(0.75);
   Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleFont(42);
   Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelFont(42);
   Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Small TH1F30043005->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Small TH1F30043005->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph_Small TH1F30043005);
   
   grae->Draw("p");
   pad2->Modified();
   Canvas->cd();
   Canvas->Modified();
   Canvas->cd();
   Canvas->SetSelected(Canvas);
}