I am using code in given link  to fit function to data using roofit. It’s problem is, when I print the integral of h_func (after scaling)and h_data, I get this
h_data Integral =2776181.0
h_func Integral after scaling= 2775671.02051
KS probability = 0.0
but KS value is always zero. Also it is when I save this h_func and h_data of same canvas, it saves the h_func without scaling but when I print the integral it gives value which I should get after scaling. I tried it with CMSSW_9_3_x, 8_0_X, 7_4_X. Every time result is same. Could you please have a look of code and tell me why it is using h_func without scaling for KS-probabilty and why it prints the integral after scaling.