Hi all,

So I have been trying to implement MCToys to do fit validation on two different fitting regimes, one where we do a ‘global fit’ and another where we do a simultaneous fit on the eta, segregated into eta bins.

I’m coming across a problem in PyROOT where I can’t seem to have two ROOT.RooMCStudy objects in the same script, for one simultaneous and one non-simultaneous fit on the same independent variable. I have been able to do this for two regular (non-sim.) fits so I think the problem lies in the implementation of this.

Here are some relevant code snippets

```
# ... defining global fit pdf (omitted)
pdf_GF = w.pdf('model_GF')
# .... defining simultaneous fit pdfs (omitted)
w.factory("SUM:modelR1(Sig_yieldR1[{},0,{}]*signalR1, Bck_yieldR1[{},0,{}]*bkg_pdf2)".format(n_sigR1,n_eventsR1,n_bkgR1,n_eventsR1))
w.factory("SUM:modelR2(Sig_yieldR2[{},0,{}]*signalR2, Bck_yieldR2[{},0,{}]*bkg_pdf2)".format(n_sigR2,n_eventsR2,n_bkgR2,n_eventsR2))
w.factory("SUM:modelR3(Sig_yieldR3[{},0,{}]*signalR3, Bck_yieldR3[{},0,{}]*bkg_pdf2)".format(n_sigR3,n_eventsR3,n_bkgR3,n_eventsR3))
sample = ROOT.RooCategory("sample", "sample")
sample.defineType("R1")
sample.defineType("R2")
sample.defineType("R3")
modelR1 = w.pdf('modelR1')
modelR2 = w.pdf('modelR2')
modelR3 = w.pdf('modelR3')
simPdf = ROOT.RooSimultaneous("simPdf", "simultaneous pdf", sample)
simPdf.addPdf(modelR1, "R1")
simPdf.addPdf(modelR2, "R2")
simPdf.addPdf(modelR3, "R3")
B_mass = w.arg('B_mass')
mcstudy_Global = ROOT.RooMCStudy(pdf_GF, ROOT.RooArgSet(B_mass), ROOT.RooFit.Silence(), ROOT.RooFit.FitOptions(ROOT.RooFit.Save(ROOT.kTRUE), ROOT.RooFit.PrintEvalErrors(0), ROOT.RooFit.Extended(ROOT.kTRUE) ,ROOT.RooFit.NumCPU(100)))
mcstudy_ERF = ROOT.RooMCStudy(simPdf, ROOT.RooArgSet(B_mass, sample), ROOT.RooFit.Silence(), ROOT.RooFit.FitOptions(ROOT.RooFit.Save(ROOT.kTRUE), ROOT.RooFit.PrintEvalErrors(0), ROOT.RooFit.Extended(ROOT.kTRUE) ,ROOT.RooFit.NumCPU(100)))
```

And I get a crash with the last error message of

- RooVectorDataStore::addColumn(RooAbsArg&, Bool_t): Assertion `numEvt != 0’ failed.

*** Break *** abort

Can anyone provide any insight into this or how I can go about implementing this without having to do the toys manually? To add the toys work individually, I just can’t run them in the same script.

Many thanks,

Nathan