Hi everyone,
I’m having a problem creating a canvas and saving it as png with EnableImplictMT()
on.
I’m running the script on Lxplus and I encountered the problem only with MT on. My code is as follows:
#code
num = dset.Filter(sel_num).Histo1D(bins, var)
den = dset.Histo1D(bins, var)
#more code
for var, (num, den) in effs.items():
a = num.Clone()
a.GetXaxis().SetTitle(var)
b = den.Clone()
b.GetXaxis().SetTitle(var)
c = ROOT.TCanvas(f'c_eff_{var}', f'eff_{var}', 1600, 800)
c.Divide(2, 1)
c.cd(1)
eff = ROOT.TEfficiency(a, b)
eff.Draw()
eff.SetNameTitle(f'eff_{var}', f'eff_{var};{var};efficiency')
c.cd(2).SetLogy()
a.Draw()
b.Draw('same')
b.SetLineColor(ROOT.kRed)
c.Draw()
c.SaveAs(f'{config["output"]["plot_dir"]}/{c.GetName()}.png')
I do a similar thing some line of codes before this ones and it works without problems. I tried without the canvas (saving them in a root file) and it works but I need to do the plots with this script. The error encountered is:
Info in TCanvas::Print>: file …/plots_new/c_eff_trk_pt.png has been created
Exception in thread Thread-1:
Traceback (most recent call last):
File “/cvmfs/sft.cern.ch/lcg/releases/Python/3.9.12-9a1bc/x86_64-centos7-gcc11-opt/lib/python3.9/threading.py”, line 973, in _bootstrap_inner
self.run()
File “/cvmfs/sft.cern.ch/lcg/releases/Python/3.9.12-9a1bc/x86_64-centos7-gcc11-opt/lib/python3.9/threading.py”, line 910, in run
Info in TCanvas::Print>: file …/plots_new/c_eff_trk_eta.png has been created
self._target(*self._args, **self._kwargs)
File “/cvmfs/sft.cern.ch/lcg/views/LCG_102/x86_64-centos7-gcc11-opt/lib/ROOT/_application.py”, line 91, in _process_root_events
*** Break *** segmentation violation
I hope I was clear since it’s the first time writing in the forum. Thanks for all the help you could provide.
_ROOT Version: 6.26.04
_Platform: Lxplus
Compiler: Not Provided