order.config
Contents
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)[source]#
Bases:
order.unique.UniqueObject,order.mixins.CopyMixin,order.mixins.AuxDataMixin,order.mixins.TagMixinClass 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 and id to theUniqueObjectconstructor.Copy behavior
copy()All attributes are copied.
copy_shallow()All attributs are copied except for contained
datasetswhich are set to a default value instead.Example
import order as od c = od.Campaign( name="2017B", id=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
UniqueObjectIndexof child datasets.
Methods:
add_dataset(*args, **kwargs)Adds a child dataset to the
datasetsindex and returns it.remove_dataset(*args, **kwargs)Removes a child dataset from the
datasetsindex and returns the removed object.Removes all child datasets from the
datasetsindex.extend_datasets(objs)Adds multiple child datasets to the
datasetsindex and returns the added objects in a list.get_dataset(obj[, default])Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex.has_dataset(obj)Checks if the
datasetsindex contains an obj which might be a name, id, or an instance.Attributes:
Returns True when this dataset has child datasets, False otherwise.
Returns True when this dataset has no child datasets, False otherwise.
- add_dataset(*args, **kwargs)[source]#
Adds a child dataset to the
datasetsindex and returns it. SeeUniqueObjectIndex.add()for more info. Also sets the campaign of the added dataset to this instance.
- remove_dataset(*args, **kwargs)[source]#
Removes a child dataset from the
datasetsindex and returns the removed object. SeeUniqueObjectIndex.remove()for more info. Also resets the campaign of the added dataset.
- extend_datasets(objs)#
Adds multiple child datasets to the
datasetsindex and returns the added objects in a list.
- get_dataset(obj, default=no_default)#
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex. When no dataset is found, default is returned when set. Otherwise, an error is raised.
- has_dataset(obj)#
Checks if the
datasetsindex contains an obj which might be a name, id, or an instance.
- 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)[source]#
Bases:
order.unique.UniqueObject,order.mixins.CopyMixin,order.mixins.AuxDataMixin,order.mixins.TagMixinClass holding analysis information that is related to a
Campaigninstance. Most of the analysis configuration happens here.Besides references to the
AnalysisandCampaigninstances it belongs to, it stores analysis datasets, processes, channels, categories, variables, and shifts inUniqueObjectIndexinstances.Arguments
datasets, processes, channels, categories, variables, and shifts are initialized from constructor arguments. name and id are forwarded to the
UniqueObjectconstructor. 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
copy()The
campaignandanalysisattributes are carried over as references, all remaining attributes are copied. Note that the copied config is also registered in the analysis.copy_shallow()All attributs are copied except for the
analysisandcampaign, as well as containeddatasets,processes,channels,variablesandshiftswhich are set to default values instead.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
Analysisinstance 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
UniqueObjectIndexof child shifts.
- variables#
type:
UniqueObjectIndex(read-only)The
UniqueObjectIndexof child variables.
- categories#
type:
UniqueObjectIndex(read-only)The
UniqueObjectIndexof child categories.
- channels#
type:
UniqueObjectIndex(read-only)The
UniqueObjectIndexof child channels.
- processes#
type:
UniqueObjectIndex(read-only)The
UniqueObjectIndexof child processes.
- datasets#
type:
UniqueObjectIndex(read-only)The
UniqueObjectIndexof child datasets.
Methods:
add_category(*args, **kwargs)Adds a child category to the
categoriesindex and returns it.add_channel(*args, **kwargs)Adds a child channel to the
channelsindex and returns it.add_dataset(*args, **kwargs)Adds a child dataset to the
datasetsindex and returns it.add_process(*args, **kwargs)Adds a child process to the
processesindex and returns it.add_shift(*args, **kwargs)Adds a child shift to the
shiftsindex and returns it.add_variable(*args, **kwargs)Adds a child variable to the
variablesindex and returns it.Removes all child categories from the
categoriesindex.Removes all child channels from the
channelsindex.Removes all child datasets from the
datasetsindex.Removes all child processes from the
processesindex.Removes all child shifts from the
shiftsindex.Removes all child variables from the
variablesindex.copy(*args, **kwargs[, _specs, _skip])Creates a copy of this instance and returns it.
extend_categories(objs)Adds multiple child categories to the
categoriesindex and returns the added objects in a list.extend_channels(objs)Adds multiple child channels to the
channelsindex and returns the added objects in a list.extend_datasets(objs)Adds multiple child datasets to the
datasetsindex and returns the added objects in a list.extend_processes(objs)Adds multiple child processes to the
processesindex and returns the added objects in a list.extend_shifts(objs)Adds multiple child shifts to the
shiftsindex and returns the added objects in a list.extend_variables(objs)Adds multiple child variables to the
variablesindex and returns the added objects in a list.get_category(obj[, deep, default])Returns a child category given by obj, which might be a name, id, or an instance from the
categoriesindex.get_channel(obj[, deep, default])Returns a child channel given by obj, which might be a name, id, or an instance from the
channelsindex.get_dataset(obj[, default])Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex.Returns all child categories from the
categoriesindex that have no child categories themselves in a recursive fashion.Returns all child channels from the
channelsindex that have no child channels themselves in a recursive fashion.Returns all child processes from the
processesindex that have no child processes themselves in a recursive fashion.get_process(obj[, deep, default])Returns a child process given by obj, which might be a name, id, or an instance from the
processesindex.get_shift(obj[, default])Returns a child shift given by obj, which might be a name, id, or an instance from the
shiftsindex.get_variable(obj[, default])Returns a child variable given by obj, which might be a name, id, or an instance from the
variablesindex.has_category(obj[, deep])Checks if the
categoriesindex contains an obj which might be a name, id, or an instance.has_channel(obj[, deep])Checks if the
channelsindex contains an obj which might be a name, id, or an instance.has_dataset(obj)Checks if the
datasetsindex contains an obj which might be a name, id, or an instance.has_process(obj[, deep])Checks if the
processesindex contains an obj which might be a name, id, or an instance.has_shift(obj)Checks if the
shiftsindex contains an obj which might be a name, id, or an instance.has_variable(obj)Checks if the
variablesindex contains an obj which might be a name, id, or an instance.remove_category(obj[, silent])Removes a child category given by obj, which might be a name, id, or an instance from the
categoriesindex and returns the removed object.remove_channel(obj[, silent])Removes a child channel given by obj, which might be a name, id, or an instance from the
channelsindex and returns the removed object.remove_dataset(obj[, silent])Removes a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex and returns the removed object.remove_process(obj[, silent])Removes a child process given by obj, which might be a name, id, or an instance from the
processesindex and returns the removed object.remove_shift(obj[, silent])Removes a child shift given by obj, which might be a name, id, or an instance from the
shiftsindex and returns the removed object.remove_variable(obj[, silent])Removes a child variable given by obj, which might be a name, id, or an instance from the
variablesindex and returns the removed object.walk_categories([algo, depth_first, ...])Walks through the
categoriesindex 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.walk_channels([algo, depth_first, include_self])Walks through the
channelsindex 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.walk_processes([algo, depth_first, include_self])Walks through the
processesindex 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.Attributes:
Returns True when this category has child categories, False otherwise.
Returns True when this channel has child channels, False otherwise.
Returns True when this dataset has child datasets, False otherwise.
Returns True when this process has child processes, False otherwise.
Returns True when this shift has child shifts, False otherwise.
Returns True when this variable has child variables, False otherwise.
Returns True when this category has no child categories, False otherwise.
Returns True when this channel has no child channels, False otherwise.
Returns True when this dataset has no child datasets, False otherwise.
Returns True when this process has no child processes, False otherwise.
Returns True when this shift has no child shifts, False otherwise.
Returns True when this variable has no child variables, False otherwise.
- add_category(*args, **kwargs)#
Adds a child category to the
categoriesindex and returns it. SeeUniqueObjectIndex.add()for more info.
- add_channel(*args, **kwargs)#
Adds a child channel to the
channelsindex and returns it. SeeUniqueObjectIndex.add()for more info.
- add_dataset(*args, **kwargs)#
Adds a child dataset to the
datasetsindex and returns it. SeeUniqueObjectIndex.add()for more info.
- add_process(*args, **kwargs)#
Adds a child process to the
processesindex and returns it. SeeUniqueObjectIndex.add()for more info.
- add_shift(*args, **kwargs)#
Adds a child shift to the
shiftsindex and returns it. SeeUniqueObjectIndex.add()for more info.
- add_variable(*args, **kwargs)#
Adds a child variable to the
variablesindex and returns it. SeeUniqueObjectIndex.add()for more info.
- clear_categories()#
Removes all child categories from the
categoriesindex.
- copy(*args, **kwargs, _specs=None, _skip=None)[source]#
Creates a copy of this instance and returns it. All args and kwargs are converted to named arguments (based on the init signature) and set as attributes of the created copy. Additional specifications per attribute are taken from
copy_specsor _specs if set. _skip can be a sequence of source attribute names that should be skipped.
- extend_categories(objs)#
Adds multiple child categories to the
categoriesindex and returns the added objects in a list.
- extend_channels(objs)#
Adds multiple child channels to the
channelsindex and returns the added objects in a list.
- extend_datasets(objs)#
Adds multiple child datasets to the
datasetsindex and returns the added objects in a list.
- extend_processes(objs)#
Adds multiple child processes to the
processesindex and returns the added objects in a list.
- extend_shifts(objs)#
Adds multiple child shifts to the
shiftsindex and returns the added objects in a list.
- extend_variables(objs)#
Adds multiple child variables to the
variablesindex and returns the added objects in a list.
- get_category(obj, deep=True, default=no_default)#
Returns a child category given by obj, which might be a name, id, or an instance from the
categoriesindex. If deep is True, the lookup is recursive through potentially nested child categories. When no category is found, default is returned when set. Otherwise, an error is raised.
- get_channel(obj, deep=True, default=no_default)#
Returns a child channel given by obj, which might be a name, id, or an instance from the
channelsindex. If deep is True, the lookup is recursive through potentially nested child channels. When no channel is found, default is returned when set. Otherwise, an error is raised.
- get_dataset(obj, default=no_default)#
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex. When no dataset is found, default is returned when set. Otherwise, an error is raised.
- get_leaf_categories()#
Returns all child categories from the
categoriesindex that have no child categories themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_leaf_channels()#
Returns all child channels from the
channelsindex that have no child channels themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_leaf_processes()#
Returns all child processes from the
processesindex that have no child processes themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_process(obj, deep=True, default=no_default)#
Returns a child process given by obj, which might be a name, id, or an instance from the
processesindex. If deep is True, the lookup is recursive through potentially nested child processes. When no process is found, default is returned when set. Otherwise, an error is raised.
- get_shift(obj, default=no_default)#
Returns a child shift given by obj, which might be a name, id, or an instance from the
shiftsindex. When no shift is found, default is returned when set. Otherwise, an error is raised.
- get_variable(obj, default=no_default)#
Returns a child variable given by obj, which might be a name, id, or an instance from the
variablesindex. When no variable is found, default is returned when set. Otherwise, an error is raised.
- property has_categories#
Returns True when this category has child categories, False otherwise.
- has_category(obj, deep=True)#
Checks if the
categoriesindex contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child categories.
- has_channel(obj, deep=True)#
Checks if the
channelsindex contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child channels.
- property has_channels#
Returns True when this channel has child channels, False otherwise.
- has_dataset(obj)#
Checks if the
datasetsindex contains an obj which might be a name, id, or an instance.
- property has_datasets#
Returns True when this dataset has child datasets, False otherwise.
- has_process(obj, deep=True)#
Checks if the
processesindex contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child processes.
- property has_processes#
Returns True when this process has child processes, False otherwise.
- has_shift(obj)#
Checks if the
shiftsindex contains an obj which might be a name, id, or an instance.
- property has_shifts#
Returns True when this shift has child shifts, False otherwise.
- has_variable(obj)#
Checks if the
variablesindex contains an obj which might be a name, id, or an instance.
- 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, silent=False)#
Removes a child category given by obj, which might be a name, id, or an instance from the
categoriesindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- remove_channel(obj, silent=False)#
Removes a child channel given by obj, which might be a name, id, or an instance from the
channelsindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- remove_dataset(obj, silent=False)#
Removes a child dataset given by obj, which might be a name, id, or an instance from the
datasetsindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- remove_process(obj, silent=False)#
Removes a child process given by obj, which might be a name, id, or an instance from the
processesindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- remove_shift(obj, silent=False)#
Removes a child shift given by obj, which might be a name, id, or an instance from the
shiftsindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- remove_variable(obj, silent=False)#
Removes a child variable given by obj, which might be a name, id, or an instance from the
variablesindex and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()for more info.
- walk_categories(algo='bfs', depth_first=False, include_self=False)#
Walks through the
categoriesindex 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.The traversal order is defined by algo which allows different values (more info):
"bfs": Breadth-first search."dfs_preorder": Pre-order depth-first search."dfs_postorder": Post-order depth-first search."dfs": Alias for"dfs_preorder"."dfs_pre": Alias for"dfs_preorder"."dfs_post": Alias for"dfs_postorder".
When include_self is True, this category instance is yielded as well with a depth of 0.
- walk_channels(algo='bfs', depth_first=False, include_self=False)#
Walks through the
channelsindex 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.The traversal order is defined by algo which allows different values (more info):
"bfs": Breadth-first search."dfs_preorder": Pre-order depth-first search."dfs_postorder": Post-order depth-first search."dfs": Alias for"dfs_preorder"."dfs_pre": Alias for"dfs_preorder"."dfs_post": Alias for"dfs_postorder".
When include_self is True, this channel instance is yielded as well with a depth of 0.
- walk_processes(algo='bfs', depth_first=False, include_self=False)#
Walks through the
processesindex 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.The traversal order is defined by algo which allows different values (more info):
"bfs": Breadth-first search."dfs_preorder": Pre-order depth-first search."dfs_postorder": Post-order depth-first search."dfs": Alias for"dfs_preorder"."dfs_pre": Alias for"dfs_preorder"."dfs_post": Alias for"dfs_postorder".
When include_self is True, this process instance is yielded as well with a depth of 0.