This example will help you to make a ratio plot as in the Outreach Note and at the same time, to practice the comments style of your notebooks
July 21st, 2016 - CERN
First Steps: Create and fill your two histograms
a) Create histograms: You can take this example and jump this step, since you already have two histograms, the total MC and the Data.
// Histogram number 1
TH1F *h1 = new TH1F("h1","test1",100,-3,3);
h1->FillRandom("gaus",200000);
h1->GetXaxis()->SetLabelFont(63); //font in pixels
h1->GetXaxis()->SetLabelSize(16); //in pixels
h1->GetYaxis()->SetLabelFont(63); //font in pixels
h1->GetYaxis()->SetLabelSize(16); //in pixels
// Histogram number 2
TH1F *h2 = new TH1F("h2","test2",100,-3,3);
h2->FillRandom("gaus",100000);
b) Create the Canvas and the two pads: Here we define one single canvas and two pads (2x1 grid) when in the pad on the two will be the plots of the histograms and in the lower pad the ratio plot. As you see in the next cell, both histograms are draw in the same pad
// Definition of the canvas
TCanvas *c1 = new TCanvas("c1","example",600,700);
// Definition of the first pad for the histograms
TPad *pad1 = new TPad("pad1","pad1",0,0.3,1,1);
pad1->SetBottomMargin(0);
pad1->Draw();
pad1->cd();
h1->DrawCopy();
h2->Draw("same");
c1->cd();
Now the second pad:
// Definition of the second pad for the ratio
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);
pad2->SetTopMargin(0);
pad2->Draw();
pad2->cd();
h1->Sumw2();
h1->SetStats(0);
h1->Divide(h2);
h1->SetMarkerStyle(21);
h1->Draw("ep");
c1->cd();
c) Draw the Canvas
c1->Draw();
Example of how to include the header in your notebooks
Note: to create HTML cell, the type should be "markdown"
The W Analysis ROOTbookThe W boson analysis is intended to provide an example for a high statistics analysis using the ATLAS open data dataset. Furthermore it tests the description of the real data by the simulated W boson data which represents the most extensive dataset in terms of luminosity. |
The Z Analysis ROOTbookMany analyses selecting leptons suffer from Z + jets as a contributing background due to its large production cross section. It is therefore vital to check the correct modelling of this process by the Monte-Carlo simulated data. It is important to measure well known Standard Model particles, to confirm that we understand properly the detector and software. We are then ready to search for new physics. |
The W Analysis ROOTbookThe W boson analysis is intended to provide an example for a high statistics analysis using the ATLAS open data dataset. Furthermore it tests the description of the real data by the simulated W boson data which represents the most extensive dataset in terms of luminosity. |
The Z Analysis ROOTbookMany analyses selecting leptons suffer from Z + jets as a contributing background due to its large production cross section. It is therefore vital to check the correct modelling of this process by the Monte-Carlo simulated data. It is important to measure well known Standard Model particles, to confirm that we understand properly the detector and software. We are then ready to search for new physics. |
Author: arturos@cern.ch for the ATLAS Collaboration