How to shift drawn TH1 bin centers

Hi,

I like to perform my analysis with histograms since they allow me to easily perform operations like Add, Multiply or Scale.

For spectra it is often necessary to plot data points at a shifted location, e.g. for pT spectra shifted in x-direction to plot the point at the mean pT instead of just at the center of the bin. This is easy to accomplish with TGraph*s where one doesn’t have bins, but individual data points.

Is there a way to change where a data point will be plotted for TH1 (other than converting it to a TGraph*)? Being able to adjust this on a per-bin basis would be optimal. If that is not possible, is there some built-in way to generate TGraph* from histograms (other than copying the contents by hand)?

Cheers,

Benjamin

You can do a global shift when you plot an histogram as a bar chart using the bar offset but there is nothing “bin per bin”.

There is not build way to convert an histogram to a graph but that’s a simple macro which can be written in a general enough way to be use for any 1D histogram.