Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows users to scale rates in datacard parser via command line for
combineCards.py
ortext2workspace.py
.I ran into a use case where I want to combine cards with signal pdfs normalized to 1 pb to set limits on the cross section in units of pb. When combined, the signal yields/rates need to be reweighed by their relative fraction of the total cross section. With this PR, one can do
combineCards.py datacard_wh.txt datacard_zh.txt --scale-rate='wh_.*=0.6,zh_.*=0.4'
where
0.6 = 1.37/(1.37+0.88)
and0.4 = 0.88/(1.37+0.88)
for 𝜎(WH) = 1.37 pb and 𝜎(ZH) = 0.88 pb.The implementation allows to use regular expression by default, and specify the bin, e.g.
--scale-rate='ch[12]/wh.*=0.6,ch[12]/wz.*=0.4'
Mathematical expressions native to python are possible thanks to implementation with
eval()
, e.g.--scale-rate='wh.*=1.37/(1.37+0.88),zh.*=1-1.37/(1.37+0.88)'
Hope this can be useful to others? I think it should work for simple datacards without shapes and just the rates, or datacards with PDFs, but not histograms (see documentation)?