Skip to main content

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

Release files for countingworkspace 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for countingworkspace 0.2.3
File Size Uploaded
countingworkspace-0.2.3.tar.gz 15.8 kB Details

Release files / countingworkspace-0.2.3.tar.gz

Download URL countingworkspace-0.2.3.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e58974e02837818781ddae24d4e87e8d7a2576d0326fcbf818909b23a69c2b09
BLAKE2b-256 checksum
How to use checksums
b9c7c02cf13077885fdee30909b6e48ddd3aeb330b7d61acf02fa2e41776113d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page