How to fit using random initial parameters with RooMCStudy?

Hi,

I’m studying the stability of a model.
I followed these steps:
I have a model that I used to fit my MC sample; So I fitted it according to the model and I obtained a result for the parameters.
First I generated 1000 samples according to this model(fixing all the parameters), secondly I fitted these samples according to the same model but now all the parameters are free and the initial parameters are the ones obtained from the result.

My question is: I’d like to fit each of these 1000 samples with random initial parameters. How can I do this?
I tried to use the class RooRandomizeParamMCSModule this way:

RooMCStudy* mcstudy = new RooMCStudy(model1, B_m, Silence(),Extended(),FitOptions(Minos(kFALSE),Save(kTRUE),PrintEvalErrors(0)));

RooRandomizeParamMCSModule randomModule;
randomModule.sampleUniform(a1,0,5);
randomModule.sampleUniform(a2,0,5);
mcstudy->addModule(randomModule);

//Fit samples
mcstudy->fit(Nsamples,“output/mcstudy_%04d.dat”);

But it didn’t work.

Thank you very much.

Hi,
An example on using this class is this tutorial

root.cern.ch/root/htmldoc/tutor … ns2.C.html

If you have a problem using it with your model, please post a running script to reproduce the problem.

Best Regards

Lorenzo

Hi,

Does RooRandomizeParamMCSModule randomize the “true values” of the parameters of a PDF, for which the toy datasets will be generated ?

I would like to keep the “true values” of the parameters fixed for all toys in RooMCStudy, but vary the initial parameter values in fits. Is there a way to accomplish this?

I suppose, by default the initial values are taken to be the same as the true values.
For example,

	RooRealVar x("x","x", 0, 5);
	RooRealVar p0("p0","p0", 0.5, 0, 1);
	RooRealVar p1("p1","p1", 1, 0, 2);
	
	RooGenericPdf gp("gp","gp","p0 + p1*x",RooArgSet(x,p0,p1));

	RooRandom::randomGenerator()->SetSeed(10); // Set random generator seed

	RooMCStudy* study = new RooMCStudy(gp,x,Binned(kFALSE),Silence(),Extended(kFALSE),FitOptions(Save(kTRUE)));
	
    study->generateAndFit(100,20);
	

When p0 is used as a parameter in a PDF, its true value is taken to be 0.5 to generate toys. While fitting, the starting value for p0 is also taken to be 0.5.

Thanks,
Tarak.