scikit-hep / pyhf

pure-Python HistFactory implementation with tensors and autodiff
https://pyhf.readthedocs.io/
Apache License 2.0
283 stars 84 forks source link

Parse normalization factor ranges from xml #661

Closed alexander-held closed 4 years ago

alexander-held commented 4 years ago

Description

The .xml workspace specification includes the ranges of normalization factors (NFs), such as

<NormFactor Name="my_NF"  Val="1"  High="20"  Low="-20"  Const="False"   />

A simple example can be found here. When the NF affects multiple samples or channels, the information is consistently specified in all instances.

Given that this information is specified in the xml, it should be picked up by pyhf.readxml.parse() and subsequently be available within pyhf.

Is your feature request related to a problem? Please describe.

The aim of this is to reduce small differences between the results of xml workspace -> fit within ROOT and xml workspace -> translate to pyhf -> fit that can be hard to track down.

Describe the solution you'd like

I would like the ranges to be picked up automatically by pyhf.

Describe alternatives you've considered

Could alternatively specify ranges manually from within pyhf.

Relevant Issues and Pull Requests

None that I am aware of.

Additional context

None

kratsg commented 4 years ago

Notes:

Assumption:

lukasheinrich commented 4 years ago

"the high/low for NormFactor are set consistently everywhere for the given systematic" that is just another one of these "reduction" reqs no?

kratsg commented 4 years ago

"the high/low for NormFactor are set consistently everywhere for the given systematic" that is just another one of these "reduction" reqs no?

I'm not sure. I'm thinking this doesn't need to be true. The correlation is the parameter, not the value. It seems plausible that one can have:

<Sample Name="ttbar" >
  <NormFactor Name="my_NF"  Val="1"  High="20"  Low="-20"  Const="False"   />
</Sample>
<Sample Name="vjets" >
  <NormFactor Name="my_NF"  Val="1"  High="10"  Low="-10"  Const="False"   />
</Sample>

so it doesn't need to be consistent... This does cut away a piece of the space that HiFa can do. Perhaps the parameter configuration should be on the modifier itself for normfactor.

alexander-held commented 4 years ago

I don't see how the above sample would work in the fit - my_NF is one parameter, so there can only be one lower bound for it. I guess you could argue that you take the larger boundary and cap it at -10 for vjets, but I cannot think of a case where that would be desired.

kratsg commented 4 years ago

You're right. I'm thinking of other constrained systematics where this is more configurable. This doesn't make sense in the context of HiFa. So yes, I can write up something tonight in a branch and test it soon.