cmt.base_tasks.analysis

Analysis tasks.

Class FitBase

class cmt.base_tasks.analysis.FitBase[source]

Bases: object

Class CombineBase

class cmt.base_tasks.analysis.CombineBase(*args, **kwargs)[source]

Bases: FeaturePlot, FitBase

Base task for all combine-related tasks

Parameters:
  • pois (list of str) – Parameters-of-interest to be considered

  • higgs_mass (int) – Higgs mass to be considered inside combine

  • fit_models (str) – filename with fit models to use in the fit

get_output_postfix(**kwargs)[source]
Returns:

string to be included in the output filenames

Return type:

str

Class CombineCategoriesTask

class cmt.base_tasks.analysis.CombineCategoriesTask(*args, **kwargs)[source]

Bases: CombineBase

Base task for all combine-related tasks with multiple categories

Parameters:
  • category_names (list of str) – names of categories to run

  • combine_categories (bool) – whether to run on the combined datacard or per category

get_output_postfix(**kwargs)[source]
Returns:

string to be included in the output filenames

Return type:

str

Class CreateDatacards

class cmt.base_tasks.analysis.CreateDatacards(*args, **kwargs)[source]

Bases: CombineBase

Task that creates datacards for its use inside the combine framework

Parameters:
  • automcstats (int) – Value used for autoMCStats inside the datacard, -1 to avoid using it.

  • additional_lines (list of str) – Additional lines to write at the end of the datacard.

  • propagate_syst_qcd (bool) – Whether to propagate systematics to estimated qcd background.

  • counting (bool) – whether the datacard should consider a counting experiment

requires()[source]

Needs as input the root file provided by the FeaturePlot task

output()[source]

Returns, per feature, one txt storing the datacard and its corresponding root file storing the histograms

run()[source]

Splits the processes into data and non-data. Per feature, loads the input histograms, creates the output histograms and the datacard inside the txt file.

Class Fit

class cmt.base_tasks.analysis.Fit(*args, **kwargs)[source]

Bases: FeaturePlot, FitBase

Task that run fits over FeaturePlot histograms

Parameters:
  • method (str) – Fitting method to consider. To choose between voigtian, polynomial, exponential, powerlaw.

  • process_name (str) – Process name to consider.

  • x_range (Two comma-separated float.) – Range of the x axis to consider in the fitting.

  • blind_range (Two comma-separated float.) – Range of the x axis to blind in the fitting.

  • fit_parameters (str representing a dict (e.g. ‘{“mean”: “(20, -100, 100)”}’).) – Initial values for the parameters involved in the fit.

requires()[source]

Needs as input the root file provided by the FeaturePlot task

output()[source]

Returns, per feature, one json file storing the fit results and one root file storing the workspace

run()[source]

Obtains the fits per feature and systematic.

Class InspectFitSyst

class cmt.base_tasks.analysis.InspectFitSyst(*args, **kwargs)[source]

Bases: Fit

Task that extracts systematic effects on the fits.

requires()[source]

Needs as input the json file provided by the Fit task

output()[source]

Returns, per feature, one json file and one txt file storing the inspection results

run()[source]

Obtains the fits per feature and systematic.

Class CombineDatacards

class cmt.base_tasks.analysis.CombineDatacards(*args, **kwargs)[source]

Bases: CombineCategoriesTask

Task that combines datacards coming from CreateDatacards.

requires()[source]

Needs as input the datacards provided by the CreateDatacards task for each category

output()[source]

Outputs a txt file with the merged datacard

run()[source]

Combines all datacards using combine’s combineCards.py

Class CreateWorkspace

class cmt.base_tasks.analysis.CreateWorkspace(*args, **kwargs)[source]

Bases: CreateDatacards, CombineCategoriesTask, LocalWorkflow, HTCondorWorkflow, SGEWorkflow

Task that creates the Combine workspace from the datacards obtained from CreateDatacards or CombineDatacards.

create_branch_map()[source]

Returns one branch if categories are combined or one branch per category

requires()[source]

Requires the datacard coming from CombineDatacards or one datacard per category obtained by CreateDatacards.

workflow_requires()[source]

Requires the datacard coming from CombineDatacards or one datacard per category obtained by CreateDatacards.

output()[source]

Outputs one root file with the workspace if categories are combined or one per category.

run()[source]

Obtains the workspace for each provided datacard.

Class RunCombine

class cmt.base_tasks.analysis.RunCombine(*args, **kwargs)[source]

Bases: CreateWorkspace

Task that runs the combine tool over the workspace created by CreateWorkspace.

Parameters:
  • method (bool) – Combine method to consider. Only limits (AsymptoticLimits) is implemented for now.

  • unblind – Whether to run combine unblinded.

workflow_requires()[source]

Requires the workspace coming from CreateWorkspace.

requires()[source]

Requires the workspace coming from CreateWorkspace.

output()[source]

Outputs one txt file and one root file in total or one of each per category with the results of running combine

run()[source]

Runs combine over the provided workspaces.

Class PullsAndImpacts

class cmt.base_tasks.analysis.PullsAndImpacts(*args, **kwargs)[source]

Bases: RunCombine

Task that obtains the pulls and impacts over the workspace created by CreateWorkspace. Based on https://gitlab.cern.ch/hh/tools/inference/-/blob/master/dhi/tasks/pulls_impacts.py

create_branch_map()[source]

Returns the nuisance parameters considered in the fit

workflow_requires()[source]

Requires the workspace coming from CreateWorkspace.

requires()[source]

Requires the workspace coming from CreateWorkspace.

output()[source]

Outputs one log, root file, and json per nuisance paramter.

run()[source]

Runs the combine commands needed for pulls and impacts computations.

Class MergePullsAndImpacts

class cmt.base_tasks.analysis.MergePullsAndImpacts(*args, **kwargs)[source]

Bases: CombineCategoriesTask

Task that merges the pulls and impacts for each systematic obtained by PullsAndImpacts.

requires()[source]

Requires the json files coming from PullsAndImpacts.

output()[source]

Outputs one json file (in CombineHarvester format) with the results for all nuisance parameters.

run()[source]

Merges the results from the PullsAndImpacts task into one json file

Class PlotPullsAndImpacts

class cmt.base_tasks.analysis.PlotPullsAndImpacts(*args, **kwargs)[source]

Bases: MergePullsAndImpacts

Task that plots pulls and impacts coming from MergePullsAndImpacts.

requires()[source]

Requires the json file with all pulls and impacts obtained by MergePullsAndImpacts.

output()[source]

Outputs one pdf with the pulls and impacts obtained by CombineHarvester.

run()[source]

Plots the pulls and impacts using CombineHarvester’s plotImpacts.py