Hi all,
I am trying to use RooMCStudy in order to fit simultaneously many toy distributions, but I have a problem.
Basically when I run my code I get an error message which seems to be related to the difficulty of associating each category to the samples to be fitted simultaneously. In order to do the study I use the RooMCStudy::generateAndFit. I attach a simplified version of my code:
RooRealVar* numTrack = new RooRealVar("numTracks","numTracks",0,20);
RooCategory IDcat("IDcat","IDcat");
IDcat.defineType("NoID");
IDcat.defineType("ID");
RooSimultaneous* simPDF = new RooSimultaneous("simPDF","simPDF",IDcat); simPDF->addPdf(*sumTemNoID,"NoID");
simPDF->addPdf(*sumTemID,"ID");
//sumTem is a RooAddPdf used to model the distibutions built adding RooHistPdfs
numTrack->setRange("fitRange_NoID",1,14);
numTrack->setRange("fitRange_ID",1,11);
RooMCStudy* mgr = new RooMCStudy(*simPDF,*numTrack, Binned(kTRUE),FitOptions(Range("fitRange"),SplitRange(kTRUE),Minos(kTRUE)));
mgr->generateAndFit(NumExperiments,NumEvents);
And the error message I get:
[#0] WARNING:Minization -- RooMinuit::RooMinuit: removing parameter IDcat from list because it is not of type RooRealVar
[#1] INFO:Minization -- RooMinuit::optimizeConst: activating const optimization
[#0] ERROR:InputArguments -- RooTreeData::split(genData) ERROR category IDcat doesn't depend on any variable in this dataset
[#0] ERROR:Fitting -- RooAbsTestStatistic::initSimMode(nll_simPDF_genData) ERROR: index category of simultaneous pdf is missing in dataset, aborting
Exception: RooAbsTestStatistic::initSimMode() ERROR, index category of simultaneous pdf is missing in dataset, aborting
:0:
(void)0
*** Interpreter error recovered ***
What can I do in order to avoid the problem?
Is it possible to use RooMCStudy without generating and fitting in two separate steps with a simultaneous fit?
Thanks in advance,
Federico