Beispiel #1
0
import sys

args = sys.argv[1:]
assert (len(args) >= 2)

ROOT.gSystem.Load('libHiggsAnalysisCombinedLimit')

cb = ch.CombineHarvester()

# this is a technical workaround needed when using ParseCombineWorkspace
cb.SetFlag('workspaces-use-clone', True)

f_wsp = ROOT.TFile(args[0])
workspace = f_wsp.Get('w')

ch.ParseCombineWorkspace(cb, workspace, "ModelConfig", "data_obs", True)

f_fit = ROOT.TFile(args[1])
fitresult = f_fit.Get('fit_s')

cb.UpdateParameters(fitresult)

# Print the full contents
cb.PrintAll()

# Print rate and uncertainty for each process in each category
for b in cb.bin_set():
    for p in cb.cp().bin([b]).process_set():
        print '%-20s %-20s %-12g %-12g' % (b, p, cb.cp().bin([b]).process(
            [p]).GetRate(), cb.cp().bin([b]).process([p]).GetUncertainty(
                fitresult, 500))
Beispiel #2
0

### WORKSPACE PATH  [CHANGE BOTH WORKSPACE AND MLFIT ROOT FILE AT THE SAME TIME]
### ======= CONSTRAINED =========
# fin = ROOT.TFile('output/CONSTRAINED-svfit/cmb/wsp.root')
# fin = ROOT.TFile('output/CONSTRAINED-mvis/cmb/wsp.root')

### ======= UNCONSTRAINED =========
# fin = ROOT.TFile('output/LIMITS-svfit/cmb/wsp.root')
fin = ROOT.TFile('workspace.root')

wsp = fin.Get('w')

cmb = ch.CombineHarvester()
cmb.SetFlag("workspaces-use-clone", True)
ch.ParseCombineWorkspace(cmb, wsp, 'ModelConfig', 'data_obs', False)

### MLFIT ROOT FILE PATH [CHANGE BOTH WORKSPACE AND MLFIT ROOT FILE AT THE SAME TIME]
### ======= CONSTRAINED =========
# mlf = ROOT.TFile('output/CONSTRAINED-svfit/cmb/mlfit.Test.root')
# mlf = ROOT.TFile('output/CONSTRAINED-mvis/cmb/mlfit.Test.root')

### ======= UNCONSTRAINED =========
# mlf = ROOT.TFile('output/LIMITS-svfit/cmb/mlfit.Test.root')
mlf = ROOT.TFile('mlfit.root')




rfr = mlf.Get('fit_s')
Beispiel #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import ROOT
ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit")
ROOT.gROOT.SetBatch()
import os
import CombineHarvester.CombineTools.ch as ch
import argparse

p = argparse.ArgumentParser(
    "Script to print out systematics for a complete workspace")
p.add_argument("--workspace", required=True, help="Path to the workspace file")

args = p.parse_args()

f = ROOT.TFile.Open(args.workspace, "read")
ws = f.Get("w")

cmb = ch.CombineHarvester()
cmb.SetFlag("workspaces-use-clone", True)
ch.ParseCombineWorkspace(cmb, ws, "ModelConfig", "data_obs", False)
cmb.PrintParams()