Wrong indexCat from MakeUnconstrainedPdf?

Dear experts,
I have a simultaneous pdf with constraints. When I use the RooStats::MakeUnconstrainedPdf to get the unconstrained pdf, the indexCat in the new pdf seems incorrect.

My full pdf is named simul_pdf, and here is output of simul_pdf.Print('v'):

 vvvvvvvvvvvvvvvvvvvv simul_pdf vvvvvvvvvvvvvvvvvvvv
--- RooAbsArg ---
  Value State: DIRTY
  Shape State: DIRTY
  Attributes:  [SnapShot_ExtRefClone] 
  Address: 0xae6a150
  Clients: 
  Servers: 
    (0xade5ee0,V-) RooCategory::sample "sample"
    (0xaeb8e90,V-) RooProdPdf::all_bkg_DD_gconst "all_bkg_DD_gconst"
    (0xaf6e960,V-) RooProdPdf::all_bkg_LL_gconst "all_bkg_LL_gconst"
  Proxies: 
    !plotCoefNormSet -> 
    indexCat -> sample
    comp_DD -> all_bkg_DD_gconst
    comp_LL -> all_bkg_LL_gconst
--- RooAbsReal ---

  Plot label is "all_bkg_simul_gconst"
--- RooAbsPdf ---
Cached value = 0

Here the indexCat is correct: comp_DD -> all_bkg_DD_gconst and comp_LL -> all_bkg_LL_gconst.
Then I get the unconstrained pdf using:

p = RooStats.MakeUnconstrainedPdf(simul_pdf, simul_pdf.getObservables(simul_data))

where simul_data is the toy dataset generated from simul_pdf. The output of p.Print('v') is

 vvvvvvvvvvvvvvvvvvvv MakeUnconstrainedPdf vvvvvvvvvvvvvvvvvvvv
--- RooAbsArg ---
  Value State: DIRTY
  Shape State: DIRTY
  Attributes: 
  Address: 0xb80bc50
  Clients: 
  Servers: 
    (0xb46cd40,V-) RooCategory::sample "sample"
    (0xb41a430,V-) RooAddPdf::all_bkg_LL_unconstrained_unconstrained "all_bkg_LL"
    (0xb4e74a0,V-) RooAddPdf::all_bkg_DD_unconstrained_unconstrained "all_bkg_DD"
  Proxies: 
    !plotCoefNormSet -> 
    indexCat -> sample
    comp_DD -> all_bkg_LL_unconstrained_unconstrained
    comp_LL -> all_bkg_DD_unconstrained_unconstrained
--- RooAbsReal ---

  Plot label is "all_bkg_simul_gconst_unconstrained"
--- RooAbsPdf ---
Cached value = 0

you can see now the indexCat is wrong: comp_DD -> all_bkg_LL_unconstrained_unconstrained, comp_LL -> all_bkg_DD_unconstrained_unconstrained.

Strangely, if I call the MakeUnconstrainedPdf again, I get the correct labels:

pp = RooStats.MakeUnconstrainedPdf(p, p.getObservables(simul_data))

the output of pp.Print('v'):

--- RooAbsArg ---
  Value State: DIRTY
  Shape State: DIRTY
  Attributes: 
  Address: 0xb44fd70
  Clients: 
  Servers: 
    (0xb3c0800,V-) RooCategory::sample "sample"
    (0xb663260,V-) RooAddPdf::all_bkg_DD_unconstrained_unconstrained_unconstrained "all_bkg_DD"
    (0x974a530,V-) RooAddPdf::all_bkg_LL_unconstrained_unconstrained_unconstrained "all_bkg_LL"
  Proxies: 
    !plotCoefNormSet -> 
    indexCat -> sample
    comp_DD -> all_bkg_DD_unconstrained_unconstrained_unconstrained
    comp_LL -> all_bkg_LL_unconstrained_unconstrained_unconstrained
--- RooAbsReal ---

  Plot label is "all_bkg_simul_gconst_unconstrained_unconstrained"
--- RooAbsPdf ---
Cached value = 0

but the label get wrong again if I call the function one more time:

ppp = RooStats.MakeUnconstrainedPdf(pp, pp.getObservables(simul_data))
print('\n', 'v'*20, 'MakeUnconstrainedPdf x 3', 'v'*20)
ppp.Print('v')

gives

 vvvvvvvvvvvvvvvvvvvv MakeUnconstrainedPdf x 3 vvvvvvvvvvvvvvvvvvvv
--- RooAbsArg ---
  Value State: DIRTY
  Shape State: DIRTY
  Attributes: 
  Address: 0xb41f710
  Clients: 
  Servers: 
    (0x9de26c0,V-) RooCategory::sample "sample"
    (0xb45bf60,V-) RooAddPdf::all_bkg_LL_unconstrained_unconstrained_unconstrained_unconstrained "all_bkg_LL"
    (0xb538b40,V-) RooAddPdf::all_bkg_DD_unconstrained_unconstrained_unconstrained_unconstrained "all_bkg_DD"
  Proxies: 
    !plotCoefNormSet -> 
    indexCat -> sample
    comp_DD -> all_bkg_LL_unconstrained_unconstrained_unconstrained_unconstrained
    comp_LL -> all_bkg_DD_unconstrained_unconstrained_unconstrained_unconstrained
--- RooAbsReal ---

  Plot label is "all_bkg_simul_gconst_unconstrained_unconstrained_unconstrained"
--- RooAbsPdf ---
Cached value = 0

I tried to create a simple pdf to reproduce these observations, but it does not appear there. Here is my test script that can produce these outputs and the “simple pdf test”: check_unconstrained.py (3.8 KB)
I wonder, what might be wrong with my pdf? Thanks.

Hi,

Adding in the loop @jonas , who might have a hint.

Best,
Danilo

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