Closed swertz closed 8 years ago
Ah yes indeed, TH1
should be unique_ptr
, I've missed that, thanks!
Concerning the save, it's a relic of the TTree::Draw where it was necessary to retrieve the histograms from the directory. Indeed here, it should be enough to to the Write on the object itself. I don't exactly remember why I add the SetName with the Write, but I do remember it's needed.
I'll do the necessary changes tomorrow.
Hm weird, I still have a segfault when using unique_ptr
... Only difference is that ROOT doesn't complain anymore that I'm replacing the TH1's...
Can you test with https://github.com/cp3-llbb/CommonTools/pull/39 ? I'm unable to reproduce (it does not crash), but if it still does, at least we will have a line number in the stack trace ...
As it turns out it was one of my plot formulas which gives the segfault. Removing the plot solved the problem. I'm still trying to understand why it causes the problem and why it doesn't happen on every sample though...
There was a bug here: https://github.com/cp3-llbb/TTAnalysis/blob/master/plugins/TTAnalyzer.cc#L663 So nothing to do with the plotter, but the missing delete's would have caused trouble sooner or later ;)
I'm facing a segfault when running a generated plotter on a Json contaning more than one sample:
yields:
Whereas running on TTbarSample.json, for instance, is fine (only one sample).
This is probably just a matter of adding a
delete obj;
at https://github.com/cp3-llbb/CommonTools/blob/master/histFactory/templates/SavePlot.tpl#L6, or making the TH1* unique_ptr's (I'll try that tomorrow). By the way, is it necessary to use this to save the histograms? Why not using{{UNIQUE_NAME}}->Write("{{PLOT_NAME}}");
(with a SetName on the way)?I'm a but suprised that this shows up only now, since I've used the plotter successfully before on the same json's...