Why RooUnblindPrecision give wrong fitting results?

Dear experts,

Recently I tried using RooUnblindPrecision to perform a blind analysis, but will always get wrong fitting results. In the following code, RooLLbarEdmPdf is a diy PDF model and has 4 free parameters (a1, a2, Rg2, Ig2). I want to blind the parameter “a1” in this fit, and the details are as follows:

void fit_blind(){
    gSystem->Load("libPhysics");
    R__LOAD_LIBRARY(/home/jyzhang/Tools/RooLLbarEdmPdf/lib/libRBW.so);

    // Creat instance of RooLLbarEdmPdf
    // Definate kinematic variables
    RooRealVar Theta("Theta","Theta",-3.15,3.15);
    RooRealVar Theta1("Theta1","Theta1",-3.15,3.15);
    RooRealVar Theta2("Theta2","Theta2",-3.15,3.15);
    RooRealVar Phi1("Phi1","Phi1",-3.15,3.15);
    RooRealVar Phi2("Phi2","Phi2",-3.15,3.15);

    // Definate free parameters
    RooRealVar a1("a1","a1",0.7,-100,100);
    RooRealVar a2("a2","a2",-0.7,-1.0,0.0);
    RooUnblindPrecision a1_blind("a1_blind","a1_blind","TheBlindingString",0.7,10,a1);
    RooRealVar PL("PL","PL",0);                      // fix to 0
    RooRealVar Rg1("Rg1","Rg1",1.14e-3);
    RooRealVar Ig1("Ig1","Ig1",0.0);                // fix to 0
    RooRealVar Rg2("Rg2","Rg2",0.689e-3,0.0,5e-2);
    RooRealVar Ig2("Ig2","Ig2",0.645e-3,0.0,5e-2);
    RooRealVar RFA("RFA","RFA",0);             // fix to 0
    RooRealVar IFA("IFA","IFA",0);                 // fix to 0
    RooRealVar RHT("RHT","RHT",0);          // fix to 0
    RooRealVar IHT("IHT","IHT",0);               // fix to 0

    PL.setConstant();
    Rg1.setConstant();
    Ig1.setConstant();
    RFA.setConstant();
    IFA.setConstant();
    RHT.setConstant();
    IHT.setConstant();

    // Construct virtual PDF
    RooLLbarEdmPdf *pdf = new RooLLbarEdmPdf("pdf","pdf",Theta,Theta1,Theta2,Phi1,Phi2,a1_blind,a2,PL,Rg1,Ig1,Rg2,Ig2,RFA,IFA,RHT,IHT,true,1);

    // Read toy phspMC
    pdf->readMC("./toy_phsp_1e7.dat", "sig", "");
    // Read toy data
    RooRealVar Weight("Weight","Weight", -2.0, 2.0);
    RooArgSet theSet(Theta,Theta1,Theta2,Phi1,Phi2,Weight);
    RooDataSet *data6 = pdf->readData("./toy_data_2e5.dat", "sig", "", theSet);
    RooDataSet *data = new RooDataSet( data6->GetName(),
            data6->GetTitle(), 
            data6, *data6->get(), 0, Weight.GetName());

    RooFitResult *result = pdf->fitTo(*data, Save(kTRUE));
    a1.Print();
    a1_blind.Print();
    cout << a1_blind.getVal() << endl ;
    result->Print("v");
    return;
}

The input value of parameters are a1 = 0.7519, a2 = -0.7559, Rg2 = 0.689e-3, Ig2 = 0.645e-3.
However the fitting results are:

ERR MATRIX NOT POS-DEF
 PARAMETER  CORRELATION COEFFICIENTS  
       NO.  GLOBAL      1      2      3      4
        1  0.99900   1.000 -0.133 -0.999  0.101
        2  0.13276  -0.133  1.000  0.133 -0.013
        3  0.99900  -0.999  0.133  1.000 -0.101
        4  0.10137   0.101 -0.013 -0.101  1.000
 ERR MATRIX NOT POS-DEF
[#1] INFO:Minimization -- RooAbsMinimizerFcn::setOptimizeConst: deactivating const optimization
RooRealVar::a1 = 8.626 +/- 0.199235  L(-100 - 100) 
RooUnblindPrecision::a1_blind[ state=dummyBlindState value=a1 ] = (hidden)
0.268948

  RooFitResult: minimized FCN value: -1565.36, estimated distance to minimum: 555730
                covariance matrix quality: Full matrix, but forced positive-definite
                Status : MINIMIZE=-1 HESSE=4 

    Constant Parameter    Value     
  --------------------  ------------
                   IFA    0.0000e+00
                   IHT    0.0000e+00
                   Ig1    0.0000e+00
                    PL    0.0000e+00
                   RFA    0.0000e+00
                   RHT    0.0000e+00
                   Rg1    1.1400e-03

    Floating Parameter  InitialValue    FinalValue +/-  Error     GblCorr.
  --------------------  ------------  --------------------------  --------
                   Ig2    6.4500e-04    3.4122e-05 +/-  4.79e-03  <none>
                   Rg2    6.8900e-04    9.5350e-04 +/-  3.41e-07  <none>
                    a1    7.0000e-01    8.6260e+00 +/-  1.99e-01  <none>
                    a2   -7.0000e-01   -7.2559e-03 +/-  1.78e-05  <none>

It seems that I get a wrong fitting results, but if I use parameter “a1” to construct PDF:
RooLLbarEdmPdf *pdf = new RooLLbarEdmPdf(“pdf”,“pdf”,Theta,Theta1,Theta2,Phi1,Phi2,a1,a2,PL,Rg1,Ig1,Rg2,Ig2,RFA,IFA,RHT,IHT,true,1);
Then I will get a correct fitting results:

  RooFitResult: minimized FCN value: -16454.1, estimated distance to minimum: 2.15989e-07
                covariance matrix quality: Full, accurate covariance matrix
                Status : MINIMIZE=0 HESSE=0 

    Constant Parameter    Value     
  --------------------  ------------
                   IFA    0.0000e+00
                   IHT    0.0000e+00
                   Ig1    0.0000e+00
                    PL    0.0000e+00
                   RFA    0.0000e+00
                   RHT    0.0000e+00
                   Rg1    1.1400e-03

    Floating Parameter  InitialValue    FinalValue +/-  Error     GblCorr.
  --------------------  ------------  --------------------------  --------
                   Ig2    5.0000e-05    6.4853e-04 +/-  6.05e-06  <none>
                   Rg2    5.0000e-05    6.8216e-04 +/-  9.02e-06  <none>
                    a1    7.0000e-01    7.5818e-01 +/-  9.52e-03  <none>
                    a2   -7.0000e-01   -7.4815e-01 +/-  9.40e-03  <none>

I don’t know what happend? Is there a problem with my method of using RooUnblindPrecision? I look forward to hearing from you, thank you so much for your help.

Best regards,
Jianyu

Hi, welcome to the ROOT forum!

All this RooFit unblinding stuff has probably not been used and evolved for 10 years, I can’t even tell what this RooUnblindPrecision is supposed to do by looking at the documentation.

Maybe you can explain what you mathematically and practically want to achieve and we can find a way to do it? Thanks!

Jonas

Hi Jonas, nice to see your reply. I want to find a proper way to perform blind fit.
The free parameters in my DIY model are a1, a2, Rg2, Ig2. And I’d like to blind the fitting result because this is a precise measurement. For example,:

Input value: a1 = 0.50, a2 = -0.50, Rg2 = 1.00, Ig2 = -1.00
Fitting results: a1 = 0.51, a2 = -0.49, Rg2 = 1.01, Ig2 = -0.99
Blinded fitting results: a1 = 3.45, a2 = -7.82, Rg2 = 4.11, Ig2 = -8.46

In this fit, I want to get the blinded fitting results before “Open Box”.
I would be very glad to hear from you again. Thank you!

Jianyu

Hi!

Sorry I don’t undestand from this what you want yet. What do you expect to be the difference between the “fitting results” and the “blinded fitting results”?

I would have thought that the blinded fit result is exactly the same, only that the value of the blinded parameter is not hidden.

The problem is I can’t tell you what could be wrong with your usage of RooUnblindPrecision without knowing what you actually want to do :frowning:

I mean if you would expect to get the correct fit results, what do you expect the blinding to actually do?

Hi jonas,

The only thing I want to do is use RooUnblindPrecision to blind some of the fitting results , e.g. “a1”.
In the code I posted on the top, I using “a1_blind” to construct the DIY PDF, then fitting to the toy data.

Example 1 (blinded fit)
RooUnblindPrecision a1_blind(“a1_blind”,“a1_blind”,“TheBlindingString”,0.7,10,a1);
RooLLbarEdmPdf *pdf = new RooLLbarEdmPdf(“pdf”,“pdf”,Theta,Theta1,Theta2,Phi1,Phi2, a1_blind,a2,PL,Rg1,Ig1,Rg2,Ig2,RFA,IFA,RHT,IHT,true,1);

My understanding of blinded fit is same as yours: “the blinded fit result is exactly the same, only that the value of the blinded parameter is not hidden.”
Therefore the fitting results of example 1 (blinded fit) and example 2 (nomal fit) should completely consistent except “a1”. Because the printed value of “a1” in example 1 has been “blinded”.

Example 2 (nomal fit)
RooRealVar a1(“a1”,“a1”,0.7,-100,100);
RooLLbarEdmPdf *pdf = new RooLLbarEdmPdf(“pdf”,“pdf”,Theta,Theta1,Theta2,Phi1,Phi2, a1,a2,PL,Rg1,Ig1,Rg2,Ig2,RFA,IFA,RHT,IHT,true,1);

However, from the results which I posted on the top, the fitting results of example 1 (blinded fit) and
example 2 (nomal fit) are very different. The fit status of example 1 is “forced positive-definite”, and the fitted value of “a2”, “Rg2”, “Ig2” deviates from their input values. While the fitting results of example 2 are correct.

This is what I wonder. How can I use RooUnblindPrecision to make my blind fitting successful. Please forgive me if I still haven’t explained clearly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.