#include #include #include %jsroot on TFile *file = TFile::Open("http://opendata.atlas.cern/release/samples/MC/mc_147770.Zee.root"); TTree *tree = (TTree*) file->Get("mini"); UInt_t lepton_n = -1; tree->SetBranchAddress("lep_n", &lepton_n); TCanvas *canvas = new TCanvas("Canvas","a first way to plot a variable",800,600); TH1F *hist = new TH1F("variable","Example plot: Number of leptons",4,0,4); int nentries, nbytes, i; nentries = (Int_t)tree->GetEntries(); for (i = 0; i < nentries; i++) { nbytes = tree->GetEntry(i); hist->Fill(lepton_n); } std::cout << "Done!" << std::endl; hist->Draw(); canvas->Draw();