Skip to content

Commit 0142ef3

Browse files
for pyhf allow datasets not in pyhf file
1 parent 77e4cfa commit 0142ef3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

smodels/matching/theoryPrediction.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,26 @@ def theoryPredictionsFor(database : Database, smsTopDict : Dict,
745745

746746
return tpList
747747

748+
def _isDatasetInCombination ( dataset, expResult ) -> Union[None,bool]:
749+
""" is a given dataset mentioned in the combination?
750+
we are allowing datasets in an expResult that is not mentioned
751+
in the combination of that result.
752+
:returns: true if its in, false if it is not in, None if there is no combination
753+
"""
754+
assert hasattr ( dataset, "dataInfo" ), "why does the dataset here not have a dataInfo?"
755+
dataId = dataset.dataInfo.dataId
756+
if hasattr ( expResult.globalInfo, "jsonFiles" ):
757+
for regionSet in expResult.globalInfo.jsonFiles.values():
758+
for region in regionSet:
759+
if dataId == region["smodels"]:
760+
return True
761+
return False
762+
if hasattr ( expResult.globalInfo, "datasetOrder" ):
763+
for ds in expResult.globalInfo.datasetOrder:
764+
if dataId == ds:
765+
return True
766+
return False
767+
return None
748768

749769
def _getCombinedResultFor(dataSetResults, expResult):
750770
"""
@@ -793,6 +813,10 @@ def _getCombinedResultFor(dataSetResults, expResult):
793813
txnameList += pred.txnames
794814
smsList += pred.smsList
795815
avgSMSlist.append(pred.avgSMS)
816+
if not _isDatasetInCombination ( pred.dataset, expResult ):
817+
print ( f"@@ {pred.dataset.dataInfo.dataId} is out" )
818+
continue
819+
print ( f"@@ {pred.dataset.dataInfo.dataId} is in" )
796820
if totalXsec is None:
797821
totalXsec = pred.xsection
798822
else:

0 commit comments

Comments
 (0)