import math
from ROOT import TFile, TH1F, TF1, gPad

class expFunc:
    def __call__(self,x,par):
        return par[0]*math.exp(-par[1]*x[0])

fin = TFile("exp.root", "read")
h = fin.Get("h")
h.Draw()

func = TF1("func", expFunc(), 1., 5., 2)
func.SetParameters(2000.,0.4)
h.Fit("func","R")
func.Draw("same")
#gPad.Update() # why is this SOMETIMES in need in PyRoot?
raw_input("hit any key to finish.")

