order.config¶
Definition of a data-taking campaign and the connection of its information to an analysis within a config.
Contents
Class Campaign¶
- class Campaign(*args, **kwargs)¶
Bases:
UniqueObject
,CopyMixin
,AuxDataMixin
,TagMixin
Class that provides data that is subject to a campaign, i.e., a well-defined range of data-taking, detector alignment, MC production settings, datasets, etc. Common, generic information is available via dedicated attributes, specialized data can be stored as auxiliary data.
Arguments
ecm is the center-of-mass energy, bx the bunch-crossing. tags are forwarded to the
TagMixin
, aux to theAuxDataMixin
, name, id and context to theUniqueObject
constructor.Copy behavior
All attributes are copied except for references to contained datasets. Also note the copy behavior of
UniqueObject
’s.Example
import order as od c = od.Campaign("2017B", 1, ecm=13, bx=25, ) d = c.add_dataset("ttH", 1) d in c.datasets # -> True d.campaign == c # -> True
Members
- ecm¶
- type: float
The center-of-mass energy in arbitrary units.
- bx¶
- type: float
The bunch crossing in arbitrary units.
- datasets¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child datasets.
- add_dataset(*args, **kwargs)¶
Adds a child dataset and returns it. See
UniqueObjectIndex.add()
for more info. Also sets the campaign of the added dataset to this instance.
- remove_dataset(*args, **kwargs)¶
Removes a child dataset. See
UniqueObjectIndex.remove()
for more info. Also resets the campaign of the added dataset.
- clear_datasets(context=None)¶
Removes all child datasets from the
datasets
index for context. When context is None, the default_context of thedatasets
index is used.
- extend_datasets(objs, context=None)¶
Adds multiple child datasets to the
datasets
index for context and returns the added objects in a list. When context is None, the default_context of thedatasets
index is used.
- get_dataset(obj, default=no_default, context=None)¶
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index for context. When no dataset is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of thedatasets
index is used.
- has_dataset(obj, context=None)¶
Checks if the
datasets
index for context contains an obj which might be a name, id, or an instance. When context is None, the default_context of thedatasets
index is used.
- property has_datasets¶
Returns True when this dataset has child datasets, False otherwise.
- property is_leaf_dataset¶
Returns True when this dataset has no child datasets, False otherwise.
Class Config¶
- class Config(*args, **kwargs)¶
Bases:
UniqueObject
,CopyMixin
,AuxDataMixin
,TagMixin
Class holding analysis information that is related to a
Campaign
instance. Most of the analysis configuration happens here.Besides references to the
Analysis
andCampaign
instances it belongs to, it stores analysis datasets, processes, channels, categories, variables, and shifts inUniqueObjectIndex
instances.Arguments
datasets, processes, channels, categories, variables, and shifts are initialized from constructor arguments. name, id and context are forwarded to the
UniqueObject
constructor. name and id default to the values of the campaign instance. Specialized data such as integrated luminosities, triggers, etc, can be stored as auxiliary data aux, which are forwarded to theAuxDataMixin
. tags are forwarded to theTagMixin
.Copy behavior
Only name, id, context, auxiliary data, and references to the analysis and campaign instances are copied. Datasets, processes, channels, categories, variables and shifts are not copied! This is due to the fact that order does not try to auto-magically guess wich exact copy behavior is desired by the user. Also note the copy behavior of
UniqueObject
’s.Example
import order as od analysis = od.Analysis("ttH", 1) campaign = od.Campaign("data_taking_2018", 1) # add the campaign to the analysis, which returns a new config cfg = analysis.add_config(campaign) cfg.name, cfg.id # -> "data_taking_2019", 1 # start configuration cfg.add_dataset(campaign.get_dataset("ttH_bb")) cfg.add_process("ttH_bb", 1, xsecs={13: 0.5071}) bb = cfg.add_channel("bb", 1) bb.add_category("eq6j_eq4b") cfg.add_variable("jet1_px", expression="jet1_pt * cos(jet1_phi)") cfg.add_shift("pdf_up", type=Shift.SHAPE) ... # at some point you might want to create a second config # with other values for that campaign, e.g. for sub-measurements cfg2 = analysis.add_config(campaign, name="sf_meausurement", id=2) ...
Members
- analysis¶
- type: Analysis
- read-only
The
Analysis
instance this config belongs to. When set, this config is added to the index of configs of the analysis object.
- shifts¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child shifts.
- variables¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child variables.
- categories¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child categories.
- channels¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child channels.
- processes¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child processes.
- datasets¶
- type: UniqueObjectIndex
- read-only
The
UniqueObjectIndex
of child datasets.
- add_category(*args, **kwargs)¶
Adds a child category to the
categories
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_channel(*args, **kwargs)¶
Adds a child channel to the
channels
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_dataset(*args, **kwargs)¶
Adds a child dataset to the
datasets
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_process(*args, **kwargs)¶
Adds a child process to the
processes
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_shift(*args, **kwargs)¶
Adds a child shift to the
shifts
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_variable(*args, **kwargs)¶
Adds a child variable to the
variables
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- clear_categories(context=None)¶
Removes all child categories from the
categories
index for context. When context is None, the default_context of thecategories
index is used.
- clear_channels(context=None)¶
Removes all child channels from the
channels
index for context. When context is None, the default_context of thechannels
index is used.
- clear_datasets(context=None)¶
Removes all child datasets from the
datasets
index for context. When context is None, the default_context of thedatasets
index is used.
- clear_processes(context=None)¶
Removes all child processes from the
processes
index for context. When context is None, the default_context of theprocesses
index is used.
- clear_shifts(context=None)¶
Removes all child shifts from the
shifts
index for context. When context is None, the default_context of theshifts
index is used.
- clear_variables(context=None)¶
Removes all child variables from the
variables
index for context. When context is None, the default_context of thevariables
index is used.
- extend_categories(objs, context=None)¶
Adds multiple child categories to the
categories
index for context and returns the added objects in a list. When context is None, the default_context of thecategories
index is used.
- extend_channels(objs, context=None)¶
Adds multiple child channels to the
channels
index for context and returns the added objects in a list. When context is None, the default_context of thechannels
index is used.
- extend_datasets(objs, context=None)¶
Adds multiple child datasets to the
datasets
index for context and returns the added objects in a list. When context is None, the default_context of thedatasets
index is used.
- extend_processes(objs, context=None)¶
Adds multiple child processes to the
processes
index for context and returns the added objects in a list. When context is None, the default_context of theprocesses
index is used.
- extend_shifts(objs, context=None)¶
Adds multiple child shifts to the
shifts
index for context and returns the added objects in a list. When context is None, the default_context of theshifts
index is used.
- extend_variables(objs, context=None)¶
Adds multiple child variables to the
variables
index for context and returns the added objects in a list. When context is None, the default_context of thevariables
index is used.
- get_category(obj, deep=True, default=no_default, context=None)¶
Returns a child category given by obj, which might be a name, id, or an instance from the
categories
index for context. If deep is True, the lookup is recursive. When no category is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of thecategories
index is used.
- get_channel(obj, deep=True, default=no_default, context=None)¶
Returns a child channel given by obj, which might be a name, id, or an instance from the
channels
index for context. If deep is True, the lookup is recursive. When no channel is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of thechannels
index is used.
- get_dataset(obj, default=no_default, context=None)¶
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index for context. When no dataset is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of thedatasets
index is used.
- get_leaf_categories(context=None)¶
Returns all child categories from the
categories
index for context that have no child categories themselves in a recursive fashion. When context is None, the default_context of thecategories
index is used.
- get_leaf_channels(context=None)¶
Returns all child channels from the
channels
index for context that have no child channels themselves in a recursive fashion. When context is None, the default_context of thechannels
index is used.
- get_leaf_processes(context=None)¶
Returns all child processes from the
processes
index for context that have no child processes themselves in a recursive fashion. When context is None, the default_context of theprocesses
index is used.
- get_process(obj, deep=True, default=no_default, context=None)¶
Returns a child process given by obj, which might be a name, id, or an instance from the
processes
index for context. If deep is True, the lookup is recursive. When no process is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of theprocesses
index is used.
- get_shift(obj, default=no_default, context=None)¶
Returns a child shift given by obj, which might be a name, id, or an instance from the
shifts
index for context. When no shift is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of theshifts
index is used.
- get_variable(obj, default=no_default, context=None)¶
Returns a child variable given by obj, which might be a name, id, or an instance from the
variables
index for context. When no variable is found, default is returned when set. Otherwise, an error is raised. When context is None, the default_context of thevariables
index is used.
- property has_categories¶
Returns True when this category has child categories, False otherwise.
- has_category(obj, deep=True, context=None)¶
Checks if the
categories
index for context contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive. When context is None, the default_context of thecategories
index is used.
- has_channel(obj, deep=True, context=None)¶
Checks if the
channels
index for context contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive. When context is None, the default_context of thechannels
index is used.
- property has_channels¶
Returns True when this channel has child channels, False otherwise.
- has_dataset(obj, context=None)¶
Checks if the
datasets
index for context contains an obj which might be a name, id, or an instance. When context is None, the default_context of thedatasets
index is used.
- property has_datasets¶
Returns True when this dataset has child datasets, False otherwise.
- has_process(obj, deep=True, context=None)¶
Checks if the
processes
index for context contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive. When context is None, the default_context of theprocesses
index is used.
- property has_processes¶
Returns True when this process has child processes, False otherwise.
- has_shift(obj, context=None)¶
Checks if the
shifts
index for context contains an obj which might be a name, id, or an instance. When context is None, the default_context of theshifts
index is used.
- property has_shifts¶
Returns True when this shift has child shifts, False otherwise.
- has_variable(obj, context=None)¶
Checks if the
variables
index for context contains an obj which might be a name, id, or an instance. When context is None, the default_context of thevariables
index is used.
- property has_variables¶
Returns True when this variable has child variables, False otherwise.
- property is_leaf_category¶
Returns True when this category has no child categories, False otherwise.
- property is_leaf_channel¶
Returns True when this channel has no child channels, False otherwise.
- property is_leaf_dataset¶
Returns True when this dataset has no child datasets, False otherwise.
- property is_leaf_process¶
Returns True when this process has no child processes, False otherwise.
- property is_leaf_shift¶
Returns True when this shift has no child shifts, False otherwise.
- property is_leaf_variable¶
Returns True when this variable has no child variables, False otherwise.
- remove_category(obj, context=None, silent=False)¶
Removes a child category given by obj, which might be a name, id, or an instance from the
categories
index for context and returns the removed object. When context is None, the default_context of thecategories
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_channel(obj, context=None, silent=False)¶
Removes a child channel given by obj, which might be a name, id, or an instance from the
channels
index for context and returns the removed object. When context is None, the default_context of thechannels
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_dataset(obj, context=None, silent=False)¶
Removes a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index for context and returns the removed object. When context is None, the default_context of thedatasets
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_process(obj, context=None, silent=False)¶
Removes a child process given by obj, which might be a name, id, or an instance from the
processes
index for context and returns the removed object. When context is None, the default_context of theprocesses
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_shift(obj, context=None, silent=False)¶
Removes a child shift given by obj, which might be a name, id, or an instance from the
shifts
index for context and returns the removed object. When context is None, the default_context of theshifts
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_variable(obj, context=None, silent=False)¶
Removes a child variable given by obj, which might be a name, id, or an instance from the
variables
index for context and returns the removed object. When context is None, the default_context of thevariables
index is used. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- walk_categories(context=None, depth_first=False, include_self=False)¶
Walks through the
categories
index for context and per iteration, yields a child category, its depth relative to this category, and its child categories in a list that can be modified to alter the walking. When context is None, the default_context of thecategories
index is used. When context is all, all indices are traversed. When depth_first is True, iterate depth-first instead of the default breadth-first. When include_self is True, also yield this category instance with a depth of 0.
- walk_channels(context=None, depth_first=False, include_self=False)¶
Walks through the
channels
index for context and per iteration, yields a child channel, its depth relative to this channel, and its child channels in a list that can be modified to alter the walking. When context is None, the default_context of thechannels
index is used. When context is all, all indices are traversed. When depth_first is True, iterate depth-first instead of the default breadth-first. When include_self is True, also yield this channel instance with a depth of 0.
- walk_processes(context=None, depth_first=False, include_self=False)¶
Walks through the
processes
index for context and per iteration, yields a child process, its depth relative to this process, and its child processes in a list that can be modified to alter the walking. When context is None, the default_context of theprocesses
index is used. When context is all, all indices are traversed. When depth_first is True, iterate depth-first instead of the default breadth-first. When include_self is True, also yield this process instance with a depth of 0.