Skip to main content

Simple builder for counting experiment RooFit workspace

Project description

Build Status Coverage Status PyPI version

CountingWorkspace

Very simple python package to create very simple counting experiment RooFit workspaces.

The statistical model describes the migration of events from truth-bins (e.g. processes) and reco-category. The implemented likelihood is a product of Poissonian distributions:

The product is over all the reconstructed categories. The number of expected events in each category is:

The matrix ε implements the efficiencies and the migrations. It's matrix elements are the conditional probability to be selected and reconstructed in category-c for a process-p: P[c|p]. The generated number of events for each process can be parametrized in any way. A popular one in hep is:

here the generated number of events are equal to the product of the luminosity (the overall normalization), its cross section and the signal strength (which is the free parameter in the fit). The background is added on top of that.

Here a simple example:

import ROOT
from countingworkspace import *

NAMES_PROC = ['proc1', 'proc2']
NCATEGORIES = 3
EFFICIENCIES = [[0.3, 0.1],
                [0.5, 0.4],
                [0.2, 0.2]]
EXPECTED_BKG_CAT = [100, 30, 10]
LUMI = 100.
# first create the parameters needed for the parametrization. The luminosity
ws = ROOT.RooWorkspace()
ws.factory('lumi[%f]' % LUMI)
# and the cross sections:
xsections = create_variables(ws, 'xsec_{proc}',     # {proc} is an index, you can call as you prefer
                             bins=NAMES_PROC,       # the names
                             values=[101.5, 7.99])  # the values of the cross sections
create_workspace(NCATEGORIES, NAMES_PROC,
                 efficiencies=EFFICIENCIES,
                 nexpected_bkg_cat=EXPECTED_BKG_CAT,
                 expression_nsignal_gen='prod:nsignal_gen_proc{proc}(mu_{proc}[1, -4, 5], lumi, xsec_{proc})',
                 ws=ws)                         
                         

It is also possible to add simple systematic uncertainties.

There are some utilies to run toys.

Look at the examples

Installation

pip install countingworkspace

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

countingworkspace-0.2.3.tar.gz (15.8 kB view details)

Uploaded Source

File details

Details for the file countingworkspace-0.2.3.tar.gz.

File metadata

  • Download URL: countingworkspace-0.2.3.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.7

File hashes

Hashes for countingworkspace-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e58974e02837818781ddae24d4e87e8d7a2576d0326fcbf818909b23a69c2b09
MD5 4aeaeb39df2abe466a9503d4c6086f64
BLAKE2b-256 b9c7c02cf13077885fdee30909b6e48ddd3aeb330b7d61acf02fa2e41776113d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page