ROOT Version: JupyROOT 6.22/06
Platform: macOS Ventura 13.2
Compiler: Jupyter Lab
I am making TF1 objects from functions in python 3.11.0. I have been unable to get a sqrt to work, either via Sqrt() or Pow(x,1/2). I can get Power to work for when it is not raised to 1/2. My code looks like the following:
def background(X, P):
return ROOT.TMath.Power( P[1]*(P[0]-X[0]), 2 )
can = ROOT.TCanvas("can", "can")
show_background = ROOT.TF1("show_background", background, 0.15, 0.45, 2)
show_background.SetParameters( 0.37, 2)
show_background.DrawClone()
can.Draw()
However, when I try ROOT.TMath.Sqrt( P[1]*(P[0]-X[0]) )
or ROOT.TMath.Power( P[1]*(P[0]-X[0]), 1/2 )
in the function background
I get an empty canvas. My end goal is to use the Sqrt() in fits, but I can’t even get it to plot properly. Is there something obvious that I am missing for getting Sqrt() to work? Even when I did get it to sometimes “plot” it was a straight line. I can provide the outputs that I see on my end as well, if this is an issue specific to my environment.