Fix RooRealVar at subsequent fitting

Dear rooters (and especially Wouter)!

I cant find a simple way to fix RooRealVar-s (and “freeze” a model that depends on them) when doing following operations:

  1. Adjust parameters p_i when fitting Model1(p_i) to Data1.
  2. Fix parameters (p_i) at best values from step 1
  3. Use Model1 (with optimized parameters) as a part of more complicated Model2 and fit Model2 to Data2 (at fixed p_i).

How do I fix (p_i) after step 1?
Is the only for this to build analog of Model1 but with fixed parameters?

Thanks for any help.

Hi,
Exact method I don’t know how to do but you can do something like this:

  1. Fit the model to data1 and get variable p_i
  2. after fitting data1 p_i.setConstant(kTRUE);
  3. Now you can fit data2 with fixed p_i.

I guess this trick should do the work

1 Like

Hi,

Let me just confirm that the solution that was just posted is indeed the correct one.

Wouter