TKey::TKey:0: RuntimeWarning: since RooMCStudy has no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You will need to
add a default constructor before attempting to read it.
Is there a way to save the results so that I can access again the mcstudy and do operations like mcstudy.fitResult(i).floatParsFinal() or mcstudy.GenData(i)?
Hello @mdgalati,
thanks for your question!
What you get is a warning, not an error, and to my understanding you should be able to save your MCStudy to a root file in this way, but then you’ll not be able to read it, I think @jonas can provide further info about it. What you could do is the following
root_file = R.TFile("mcstudy.root", "RECREATE")
root_file.cd()
for i in range(nTest):
mcstudy.fitResult(i).Write(mcstudy.fitResult(i).GetName()+f"_{i}")
root_file.Close()
Hi Monica,
Thanks for your answer. I currently by-passed this error by saving the data in a similar way to you:
root_file = R.TFile(rootpath, "RECREATE")
for i in range(nMCevents):
mcstudy.fitResult(i).Write(f"fitResult_{i}")
mcstudy.genData(i).Write(f"genData_{i}")
root_file.Close()
and I can access the single fitResult and genData: