epic-drich-beam-test-analysis
ePIC dRICH beam test analysis framework
Loading...
Searching...
No Matches
trigger_registry Struct Reference

Runtime lookup table that maps trigger values to names and positions. More...

#include <triggers.h>

Public Member Functions

 trigger_registry (const std::vector< trigger_config > &config_triggers)
 Build the registry from a list of config-defined triggers.
 
int index_of (uint8_t trigger_value) const
 Returns the registry position for a given trigger value.
 
std::string name_of (uint8_t trigger_value) const
 Returns the name associated with a trigger value.
 
int size () const
 
void label_axes (TH2F *h) const
 Labels both axes of a 2D ROOT histogram with trigger names.
 

Public Attributes

std::vector< std::pair< uint8_t, std::string > > triggers
 Ordered list of {trigger value, name} pairs.
 

Detailed Description

Runtime lookup table that maps trigger values to names and positions.

Built once after the TOML config is loaded. Config-defined triggers occupy the first slots (in declaration order); the built-in defaults follow. This ordering governs histogram bin layout when calling label_axes.

Constructor & Destructor Documentation

◆ trigger_registry()

trigger_registry::trigger_registry ( const std::vector< trigger_config > &  config_triggers)
inlineexplicit

Build the registry from a list of config-defined triggers.

Config triggers are inserted first (preserving TOML declaration order), followed by all entries in all_default_triggers. Duplicate values are not filtered — config entries take priority by appearing first.

Parameters
config_triggersTriggers parsed from the TOML config file.

Member Function Documentation

◆ index_of()

int trigger_registry::index_of ( uint8_t  trigger_value) const
inline

Returns the registry position for a given trigger value.

If the value is not found, emits a warning and falls back to the position of _TRIGGER_UNKNOWN_ in the default table.

Parameters
trigger_valueRaw 8-bit trigger value from the data stream.
Returns
Position in triggers.

◆ label_axes()

void trigger_registry::label_axes ( TH2F *  h) const
inline

Labels both axes of a 2D ROOT histogram with trigger names.

Bin i+1 on both X and Y axes is set to the name of the i-th trigger in the registry. Intended for trigger-vs-trigger correlation plots.

Parameters
hPointer to the histogram whose axes will be labelled.

◆ name_of()

std::string trigger_registry::name_of ( uint8_t  trigger_value) const
inline

Returns the name associated with a trigger value.

Parameters
trigger_valueRaw 8-bit trigger value from the data stream.
Returns
Name string, or "UNKNOWN" if not found.

◆ size()

int trigger_registry::size ( ) const
inline
Returns
Total number of triggers in the registry (config + defaults).

The documentation for this struct was generated from the following file: