ROOT Version: 6.22
Compiler: Not Provided
I’m currently running a program that has two histograms, one of which I draw a fit graph on. The first time I run it, it works fine, but if I try to load the macro again I get a segmentation violation error. When I quit root, I further get an error saying “double free or corruption (!prev)”. This only happens when I add the fit graph; without it, the code runs fine. Here’s the code in charge of graphing:
//create canvas auto c = new TCanvas("Z Boson Data", "Z Boson Data", 1200, 600); c->Divide(1, 2); //graph mass histogram and fit Breit-Wigner to it c->cd(1); TF1 *func = new TF1("mybw",mybw,mass_bound_low, mass_bound_high, 3); func->SetParameter(1, resonance_width); //get gamma/resonance width for parameter 1 func->SetParameter(2, mass_hist->GetMean()); //get M/Z mass for parameter 2 auto mass_fit = mass_hist->Fit("mybw", "QR"); //mass_fit->DrawClone("Same"); mass_hist->DrawClone("Same"); //graph momentum histogram c->cd(2); p_hist->DrawClone("Same");
I’m not double-freeing any of these graphs with a delete statement, so I don’t know why I would be getting such an error.
Any help would be appreciated!