Hello,
I have been writing a class to take any number of template histograms and fit them to a data histogram. To this end I would like to pass a vector of TH1s and create a vector of RooHistPdfs with which I can construct a RooAddPdf model.
When I loop over the input vector of TH1s and create the RooDataHists, RooRealVars and RooHistPdfs I find that I get a seg fault. This can be avoided by moving the RooHistPdf section to a separate but identical loop.
I have attached a simple macro to demonstrate this behaviour. It will currently seg fault on running but if you un-comment lines 59-64 and put the RooHistPdfs into a separate loop it runs as expected.
I am using ROOT 5.34/17 but have reproduced this issue using ROOT 6.00/00 as well.
Can you please explain this behaviour to me and why I am unable to create all the RooFit objects in a single loop?
Many thanks,
Jim
badLoop.C (2.79 KB)