What is “f_gen” in line-60 ? How does generated “f” is filled in that histogram ? Shouldn’t it have been
TH1* h_f_gen = mcs.fitParDataSet().createHistogram(“f”,-40) ; //f
instead of
TH1* h_f_gen = mcs.fitParDataSet().createHistogram(“f_gen”,-40) ; //f_gen
what is difference ? I see the two histograms give different distributions…
Yes what you are doing seems to be the correct way to use it RooMCStudy.
Compared to the linked tutorial, rf804_mcstudy_constr.C , the difference is that there you have a constraint in the parameter f. In this case f is then sampled for every toy according to the given constraint. For this you have in that case a “f_gen” parameter that is not existing in your case. You have “f” fixed to the given initial value for every toy and what you get is the fitted value of “f”. The two histogram you are getting are the same, just done with different min, max values.
fitParDataSet will give you the fitted parameters while genParDataSet will give the generated one when existing, i.e. in model who have constraints as in the tutorial example but not in your example.