void TestCode(){ //create file TFile *f = new TFile("TestNTuple.root","RECREATE"); //create ttree and initialize branches TTree *tree = new TTree("tree","tree"); Float_t val,weight; tree->Branch("val",&val,"val/F"); tree->Branch("weight",&weight,"weight/F"); //fill a few entries into this ntuple val=2; weight=0.1; cout<<"Filling Entry: val="<cd(); /////////////////////////////// //Draw 1d histogram with error option set to compute errors using Sumw2() /////////////////////////////// cout<Draw("val>>h0(5,0,5)","weight","e"); TH1D *h0 = (TH1D*)gDirectory->Get("h0"); h0->SetLineColor(2); h0->Draw("hist"); //loop over bins in histogram and inspect the bin content and error value int nx = h0->GetNbinsX(); for(int i=0; iGetBinContent(i); double berr = h0->GetBinError(i); cout<<"h1: BinNumber="<Draw("val:val>>h1(5,0,5,5,0,5)","weight","e"); TH2D *h1 = (TH2D*)gDirectory->Get("h1"); h1->SetLineColor(2); h1->Draw("hist"); //loop over bins in histogram and inspect the bin content and error value int nx = h1->GetNbinsX(); int ny = h1->GetNbinsY(); for(int i=0; iGetBinContent(i,j); double berr = h1->GetBinError(i,j); cout<<"h1: BinNumber(X)="<