In my code, corr is initialized as:
TNtuple *corr = new TNtuple("data", "Raw and Corrected rates",
Then filled in a loop.
The following code will be looped eventually, but I’m trying to get it work for just one piece of data for now.
TF1 *fit = h1->GetFunction("gaus");
That compiles but gives me a segfault, as well as working if I just type it in root (I write the ntuple to a file, then open root and experiment with it). So because root likes to initialize things for me, I’m guessing I’m not initializing something correctly.
The output is:
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
*** Break *** segmentation violation
with the break occuring at the first get parameter. the TCanvas is made at the Draw() call.
I’m assuming I have to initialize a canvas, but I’m not sure if that’s right and even if it is I’m not sure how to do it.