fire.cfg package

fire.cfg.Process class

class fire.cfg.Process(pass_name)

Bases: object

Process configuration object

The python object that stores the necessary parameters for configuring a Process for fire to execute.

Upon construction, the class-wide reference lastProcess is set and the rest of the attributes are set to sensible defaults.

Parameters:

pass_name (str) – Short reference name for this run of the process

lastProcess

Class-wide reference to the last Process object to be constructed

Type:

Process

event_limit

Maximum number events to process

Type:

int

max_tries

Maximum number of attempts to make in a row before giving up on an event. Only used in Production Mode (no input files)

Type:

int

run

Run number for this process

Type:

int

input_files

Input files to read in event data from and process

Type:

list of strings

output_file

Output file to write out event data to after processing

Type:

OutputFile

storage

Configuration of veto-ing decision maker

Type:

StorageControl

sequence

List of event processors to pass the event bus objects to

Type:

list of Processor

drop_keep_rules

List of rules to keep or drop objects from the event bus

Type:

list of DropKeepRule

libraries

List of libraries to load before attempting to build any processors

Type:

list of strings

log_frequency

Print the event number whenever its modulus with this frequency is zero

Type:

int

term_level

Minimum severity of log messages to print to terminal: 0 (debug) - 4 (fatal)

Type:

int

file_level

Minimum severity of log messages to print to file: 0 (debug) - 4 (fatal)

Type:

int

log_file

File to print log messages to, won’t setup file logging if this parameter is not set

Type:

str

conditions

System handling providers as well as the global tag

Type:

Conditions

See also

fire.cfg.Producer

one type of event processor

fire.cfg.Analyzer

the other type of event processor

addLibrary()

Add a library to the list of dynamically loaded libraries

A process object must already have been created.

Parameters:

lib (str) – name of library to load

Warning

  • Will exit the script if a process object hasn’t been defined yet.

Examples

fire.cfg.Process.addLibrary( ‘libMyModule.so’ )

addModule()

Add a module to the list of dynamically loaded libraries

A process object must already have been created.

Warning

We assume that the libraries are prefixed with ‘lib’ and have the ‘.so’ extension. This limits the usefulness of this function to Linux systems.

Parameters:

module (str) – Name of module to load as a library

Examples

You can use this function to load a general module

addModule(‘MyModule’)

With the string substitutions that are made, you can refer to submodules with cmake, C++, or the library syntax. The following calls are all equivalent.

addModule(‘MyModule/Event’) addModule(‘MyModule::Event’) addModule(‘MyModule_Event’)

declareConditionsProvider()

Declare a conditions object provider to be loaded with the process

A process object must already have been created.

Parameters:

cp (ConditionsProvider) – provider to load with the process

Warning

  • Will exit the script if a process object hasn’t been defined yet.

  • Overrides an already declared COP with the passed COP if they are equal

drop(regex)

Add a regex rule for dropping event objects whose name matches the regex

inputDir(indir, ext='h5')

Scan the input directory and make a list of input root files to read from it

Lists all files ending in ‘.root’ in the input directory (not recursive). Extends the input_files list by these files.

Parameters:
  • indir (str) – Path to directory of event files to read in

  • ext (str, optional) – Filter by the input extension string, default: ‘h5’

keep(regex)

Add a regex rule for keeping event objects whose name matches the regex

lastProcess = None
parameterDump()

Recursively extract all configuration parameters for this process

Only includes objects somehow attached to the process.

pause()

Print this Process and wait for user confirmation to continue

Prints the process through the print function, and then waits for the user to press Enter to continue.

rnss()

Get the random number seed service condition

We create that condition in the constructor of the process, so we can trust that it is the first entry in the conditions provider list.

Return type:

RandomNumberSeedService for more configuration

Examples

You would use this function if you wanted to change the mode with which the random numbers are seeded.

p.rnss().time()

setConditionsGlobalTag(tag)

Set the global tag for all the ConditionsProviders

Parameters:

tag (str) – Global generation tag to pass to all COPs

skimConsider(namePat)

Legacy function, user is encouraged to use

p.storage.listen(processor)

rather than this function.

skimDefaultIsDrop()

Legacy function, user is encouraged to use

p.storage.default(False)

rather than this function.

skimDefaultIsSave()

Legacy function, user is encouraged to use

p.storage.default(True)

rather than this function.

fire.cfg.Processor class

class fire.cfg.Processor(name, class_name, module=None, library=None, **kwargs)

Bases: object

A Processor configuration object

This object contains the parameters that are necessary for a fire::Processor to be configured.

Parameters:
  • name (str) – Name of this copy of the processor object

  • class_name (str) – Name (including namespace) of the C++ class that this processor should be

  • module (str) – Name of module the C++ class is in (i.e. the library that should be loaded)

  • kwargs (dict) – key word arguments to pass along to the derived processor

See also

fire.cfg.Process.addModule

how module names are interpreted as libraries to be loaded

fire.cfg.Process.addLibrary

how libraries are loaded

fire.cfg.OutputFile class

class fire.cfg.OutputFile(name, rows_per_chunk=10000, compression_level=6, shuffle=False)

Bases: object

Configuration for writing an output file

Parameters:
  • name (str) – Name of file to write

  • rows_per_chunk (int, optional) – Number of “rows” in the output file to “chunk” together

fire.cfg.ConditionsProvider class

class fire.cfg.ConditionsProvider(obj_name, class_name, module=None, library=None, **kwargs)

Bases: object

A ConditionsProvider

This object contains the parameters that are necessary for a fire::ConditionsProvider to be configured.

In this constructor we also do two helpful processes. 1. We append the module that this provider is in to the list of libraries to load 2. We declare this provider so that the Process “knows” it exists and will load it into the run

Parameters:
  • obj_name (str) – Name of the object this provider provides

  • class_name (str) – Name (including namespace) of the C++ class of the provider

  • module (str) – Name of module that this COP is compiled into (e.g. Ecal or EventProc)

tag_name

Tag which identifies the generation of information

Type:

str

See also

fire.cfg.Process.addModule

how modules are interpreted as libraries to load

fire.cfg.Process.declareConditionsProvider

how COPs are registered

setTag(newtag)

Set the tag generation of the Conditions

Parameters:

newtag (str) – Tag for generation of conditions

Advanced Usage

Below is documentation of modules and classes that are only used for specific edge cases by the end user. They are “private” modules (beginning with an underscore) because they are subject to change and not meant to be used directly frequently.

fire.cfg._rnss module

RandomNumberSeedService (RNSS) configuration

class fire.cfg._rnss.RandomNumberSeedService

Bases: ConditionsProvider

The random number seed service

This object registers the random number seed service with the process and gives some helper functions for configuration.

seedMode

Name of mode of getting random seeds

Type:

str

external(seed)

Input the master random number seed

Parameters:

seed (int) – Integer to use as master random number seed

override(name, seed)

Override the RNSS and provide your own seed for a specific name

run()

Base random number seeds off of the run number

time()

Set master random seed based off of time

fire.cfg._storage module

Configuration of storage/veto system in fire

class fire.cfg._storage.DropKeepRule(regex, keep)

Bases: object

A single rule specifying if a specific event object should be saved into the output file (keep) or not (drop)

Parameters:
  • keep (bool) – True if the event object matching the regex should be kept

  • regex (str) – Regular expression for this rule

class fire.cfg._storage.ListeningRule(processor_regex, purpose_regex)

Bases: object

A single rule telling storage control whether to listen to a set of processors

Parameters:
  • processor_regex (str) – regular expression matching processors to listen to

  • purpose_regex (str) – regular expression matching purpoeses to listen to

Note

Empty regex strings are translated to the “match all” regex ‘.*’ on the C++ side of configuration.

class fire.cfg._storage.StorageControl

Bases: object

Configuration for how events are chosen to be stored. This configuration keeps the default storage decision and any rules about which processors to listen to when they are making storage hints.

default_keep

True if the default storage is to keep the event

Type:

bool

listening_rules

List of rules about processors/purposes to listen to

Type:

list[ListeningRule]

default(keep=True)
listen(processor)

Add a listening rule that will listen to the processor with name exactly matching the name of the input processor object

Parameters:

processor (Processor) – Processor object to listen to

listen_all()

fire.cfg._conditions module

class fire.cfg._conditions.Conditions(global_tag='Default')

Bases: object

The configuration for the central conditions system