TH1D *hist = new TH1D("hist", "Example Histogram", 100, 0, 10); // fill histogram with data hist->Rebin(2); // combine bins by a factor of 2
TH1D *hist = new TH1D("hist", "Example Histogram", 100, 0, 10); // fill histogram with data hist->Rebin(5); // combine bins by a factor of 5In this example, we create a histogram with 100 bins ranging from 0 to 10. We then fill the histogram with data and use the Rebin function to combine bins by a factor of 5. Package library: ROOT.