Skip to content

Commit

Permalink
Enabling STXS model to work with inclusive cards (#886) (#887)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathon Langford <[email protected]>
  • Loading branch information
jonathon-langford and Jonathon Langford authored Dec 19, 2023
1 parent 2cb571b commit db5edac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 4 additions & 4 deletions python/STXS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stage0_procs = {
"ggH": ["ggH"],
"ggH": ["ggH","bbH","ggZH_had"],
"qqH": ["qqH"],
"WH_lep": ["WH_lep"],
"ZH_lep": ["ZH_lep"],
#'ggZH_lep':['ggZH_lep']
'ggZH_lep':['ggZH_lep'],
"VH_had": ["WH_had", "ZH_had"],
"ttH": ["ttH"] # ,
#'other':['tHq','tHW','bbH']
"ttH": ["ttH"],
'other':['tHq','tHW','bbH',"WH","ZH"]
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
20 changes: 18 additions & 2 deletions python/STXSModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import fnmatch
import json
import re

from HiggsAnalysis.CombinedLimit.PhysicsModel import *
from HiggsAnalysis.CombinedLimit.SMHiggsBuilder import SMHiggsBuilder
Expand Down Expand Up @@ -29,7 +30,7 @@
"hcc": "cc",
"htt": "tautau",
"hmm": "mumu",
"hzg": "gamgam",
"hzg": "Zgam",
"hgluglu": "gluglu",
"hinv": "inv",
}
Expand Down Expand Up @@ -82,6 +83,7 @@ def __init__(self, denominator="WW"):
self.denominator = denominator
self.mergeBins = False
self.mergeJson = ""
self.addStage0 = False

def preProcessNuisances(self, nuisances):
# add here any pre-processed nuisances such as constraint terms for the mass profiling?
Expand All @@ -101,6 +103,9 @@ def setPhysicsOptions(self, physOptions):
if po.startswith("mergejson="):
self.mergeBins = True
self.mergeJson = po.replace("mergejson=", "")
if po.startswith("addStage0="):
self.addStage0 = po.replace("addStage0=", "") in ["yes", "1", "Yes", "True", "true"]


def doMH(self):
if self.floatMass:
Expand Down Expand Up @@ -217,7 +222,6 @@ def __init__(self):
STXSBaseModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
self.POIs = "mu"
from HiggsAnalysis.CombinedLimit.STXS import stage1_2_procs, stage1_2_fine_procs

self.stage1_2_fine_procs = stage1_2_fine_procs
self.PROCESSES = [x for v in six.itervalues(stage1_2_procs) for x in v]
self.FINEPROCESSES = [x for v in six.itervalues(stage1_2_fine_procs) for x in v]
Expand All @@ -240,6 +244,14 @@ def doParametersOfInterest(self):
self.modelBuilder.stringout = json.dumps(self.mergeSchemes)
f.close()

# Add stage 0 processes
if self.addStage0:
from HiggsAnalysis.CombinedLimit.STXS import stage0_procs
PROCESSES_STAGE0 = [x for v in six.itervalues(stage0_procs) for x in v]
for proc_stage0 in PROCESSES_STAGE0:
if proc_stage0 not in self.PROCESSES: self.PROCESSES.append(proc_stage0)


allProds = []
for registered_proc in self.PROCESSES:
P = registered_proc
Expand Down Expand Up @@ -314,6 +326,10 @@ def setup(self):
self.modelBuilder.out.function("scaling_%s_%s_13TeV" % (P, D)).Print("")

def getHiggsSignalYieldScale(self, production, decay, energy):
# Catch for H->Zgam: taken from STXStoSMEFT model
if (decay == "Zgam") | ("bkg" in production):
production = production.split("_")[0]

for regproc in self.PROCESSES:
if fnmatch.fnmatch(production, regproc):
return "scaling_%s_%s_%s" % (regproc, decay, energy)
Expand Down

0 comments on commit db5edac

Please sign in to comment.