/* Few simplae histograms I want to know the frequency of each bin. h2 bin width are in float which is my case, I want to know the number of entries in each bin h4 gives, but the entry is i, which is essentially the bin numbers. */ void BinTest() { TH1F *h1 = new TH1F("h1","Binning Goodies 1",10,0,10); // TH1F *h2 = new TH1F("h2","Binning Goodies 2",10,0,1); TH1F *h3 = new TH1F("h3","Binning Goodies 3",10,0,10); TH1F *h4 = new TH1F("h4","Binning Goodies 4",10,0,10); for (Int_t i = 0; i < 10; i++) { for (Int_t j = 0; j < 5; j++) { h1->Fill(j+i/4); h2->Fill((float)i/11.0,1); h3->Fill(i,j+i/4); h4->Fill(i,1); } } for (Int_t i = 1; i <= 10; i++){ printf("Bin%2d h1:%6.2f h2:%6.2f h3:%6.2f h4:%6.2f \n",i, h1->GetBinContent(i),h2->GetBinContent(i), h3->GetBinContent(i),h4->GetBinContent(i)); } TCanvas *c1 = new TCanvas("c1","S",10,10,700,600); c1->Divide(2,2); c1->cd(1); h1->DrawCopy(); c1->cd(2); h2->DrawCopy(); c1->cd(3); h3->DrawCopy(); c1->cd(4); h4->DrawCopy(); }