|
49 | 49 | from madanalysis.IOinterface.library_writer import LibraryWriter
|
50 | 50 | from madanalysis.misc.histfactory_reader import HF_Background, HF_Signal, get_HFID
|
51 | 51 |
|
52 |
| -from .statistical_models import initialise_statistical_models |
| 52 | +from .statistical_models import initialise_statistical_models, compute_poi_upper_limits |
53 | 53 |
|
54 | 54 | try:
|
55 | 55 | import spey
|
@@ -1266,7 +1266,7 @@ def compute_cls(self, analyses, dataset):
|
1266 | 1266 | for model_type, record in zip(model_types, [None, "cov_subset", "pyhf"]):
|
1267 | 1267 | models = statistical_models[model_type]
|
1268 | 1268 | if models:
|
1269 |
| - regiondata = self.compute_poi_upper_limits( |
| 1269 | + regiondata = compute_poi_upper_limits( |
1270 | 1270 | regiondata,
|
1271 | 1271 | models,
|
1272 | 1272 | dataset.xsection,
|
@@ -2143,48 +2143,6 @@ def extract_cls(
|
2143 | 2143 |
|
2144 | 2144 | return regiondata
|
2145 | 2145 |
|
2146 |
| - def compute_poi_upper_limits( |
2147 |
| - self, |
2148 |
| - regiondata: dict, |
2149 |
| - stat_models: dict, |
2150 |
| - xsection: float, |
2151 |
| - is_extrapolated: bool, |
2152 |
| - record_to: str = None, |
2153 |
| - ) -> dict: # pylint: disable=too-many-arguments |
2154 |
| - """ |
2155 |
| - Compute upper limit on cross section. |
2156 |
| -
|
2157 |
| - Args: |
2158 |
| - regiondata (``dict``): data for each region |
2159 |
| - regions (``list[str]``): list of regions |
2160 |
| - xsection (``float``): cross section |
2161 |
| - lumi (``float``): luminosity |
2162 |
| - is_extrapolated (``bool``): extrapolated luminosity |
2163 |
| - record_to (``str``): record to a specific section in regiondata |
2164 |
| -
|
2165 |
| - Returns: |
2166 |
| - ``dict``: |
2167 |
| - regiondata |
2168 |
| - """ |
2169 |
| - self.logger.debug("Compute signal CL...") |
2170 |
| - if record_to is not None and record_to not in regiondata.keys(): |
2171 |
| - regiondata[record_to] = {} |
2172 |
| - tags = ( |
2173 |
| - [[APRIORI], ["exp"]] |
2174 |
| - if is_extrapolated |
2175 |
| - else [[APOSTERIORI, OBSERVED], ["exp", "obs"]] |
2176 |
| - ) |
2177 |
| - |
2178 |
| - for tag, label in zip(*tags): |
2179 |
| - for reg, stat_model in stat_models.items(): |
2180 |
| - s95 = stat_model.poi_upper_limit(expected=tag) * xsection |
2181 |
| - self.logger.debug(f"{record_to}:: region {reg} s95{label} = {s95:.5f} pb") |
2182 |
| - if record_to is None: |
2183 |
| - regiondata[reg]["s95" + label] = "%-20.7f" % s95 |
2184 |
| - else: |
2185 |
| - regiondata[record_to][reg]["s95" + label] = "%-20.7f" % s95 |
2186 |
| - return regiondata |
2187 |
| - |
2188 | 2146 | def write_cls_output(
|
2189 | 2147 | self, analysis, regions, regiondata, errordata, summary, xsflag, lumi
|
2190 | 2148 | ):
|
|
0 commit comments