I don’t know how to plot the histogram like this. The TH1 class contains a method called TH1::Rebin(). However, this method can only rebin the histogram globally. I just need to merge some bins in the histogram.
Thank you! Your method is also very useful. If I want to plot a histogram from a TTree, I can only use this method to plot the histogram with variable bin width.