Optimal shift value

Dear,

I have two TH1’s, which in the ideal case should be very similar (typical data/MC plot). However, you can see with the naked eye that there is a shift difference between the two.

Is there a function/test/way to find the optimal shift value that would be applied to the MC such that the difference between the two histograms is minimized?

Many thanks!

Have you tried looking into Double_t TH1::KolmogorovTest()?

https://root.cern.ch/doc/master/classTH1.html#aeadcf087afe6ba203bcde124cfabbee4

The Kolmogorov test returns value between 0 and 1; 0 means incompatible, 1 means compatible.

If you want to use it in some minimizer algorithm, you can choose to minimizer the value given by 1.0 - KolmogorovTest().

Cheers!