All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
icarus::TriggerConfigurationExtraction Class Reference

Writes trigger configuration from FHiCL into a data product. More...

Inheritance diagram for icarus::TriggerConfigurationExtraction:

Classes

struct  Config
 Configuration of the module. More...
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 TriggerConfigurationExtraction (Parameters const &config)
 Constructor: just reads the configuration. More...
 
virtual void beginRun (art::Run &run) override
 Action on new run: configuration is written. More...
 
virtual void produce (art::Event &) override
 Mandatory method, unused. More...
 

Private Member Functions

bool checkConsistency (icarus::TriggerConfiguration const &newConfig, std::string const &srcName) const
 Throws an exception if the newConfig is not compatible with the current. More...
 

Private Attributes

std::optional
< icarus::TriggerConfiguration
fTriggerConfig
 Current Trigger configuration (may be still unassigned). More...
 
bool fRequireConsistency = true
 Whether trigger configuration inconsistency is fatal. More...
 
std::string fTriggerFragmentType
 Name of the trigger fragment type. More...
 
bool fVerbose = false
 Whether to print the configuration we read. More...
 
std::string fLogCategory
 Category tag for messages. More...
 

Detailed Description

Writes trigger configuration from FHiCL into a data product.

This module reads the configuration related to the Trigger from the FHiCL configuration of the input runs and puts it into each run as a data product.

Input

This module requires any input with art run objects in it. The format expected for that configuration is defined in icarus::TriggerConfigurationExtractor, which is the utility used for the actual extraction.

Output

A data product of type icarus::TriggerConfiguration is placed in each run. Note that the module itself does not enforce any coherence in the configuration.

Configuration parameters

The following configuration parameters are supported:

Multithreading

This module does not support multithreading, and art does not provide multithreading for its functionality anyway: the only action is performed at run and input file level, and the only concurrency in art is currently (art 3.7) at event level.

Definition at line 83 of file TriggerConfigurationExtraction_module.cc.

Member Typedef Documentation

Definition at line 122 of file TriggerConfigurationExtraction_module.cc.

Constructor & Destructor Documentation

icarus::TriggerConfigurationExtraction::TriggerConfigurationExtraction ( Parameters const &  config)

Constructor: just reads the configuration.

Definition at line 148 of file TriggerConfigurationExtraction_module.cc.

149  : art::EDProducer(config)
150  , fTriggerFragmentType(config().TriggerFragmentType())
151  , fVerbose(config().Verbose())
152  , fLogCategory(config().LogCategory())
153 {
154 
155  // no consummation here (except for FHiCL configuration)
156 
157  produces<icarus::TriggerConfiguration, art::InRun>();
158 
159 } // icarus::TriggerConfigurationExtraction::ICARUSTriggerConfigurationExtraction()
BEGIN_PROLOG Verbose
std::string fTriggerFragmentType
Name of the trigger fragment type.
bool fVerbose
Whether to print the configuration we read.

Member Function Documentation

void icarus::TriggerConfigurationExtraction::beginRun ( art::Run &  run)
overridevirtual

Action on new run: configuration is written.

Definition at line 163 of file TriggerConfigurationExtraction_module.cc.

163  {
164 
167 
168  checkConsistency(config, "run " + std::to_string(run.run()));
169  if (!fTriggerConfig.has_value() && fVerbose)
170  mf::LogInfo(fLogCategory) << "Trigger readout:" << config;
171 
172  fTriggerConfig = std::move(config);
173 
174  // put a copy of the current configuration
175  run.put(std::make_unique<icarus::TriggerConfiguration>(fTriggerConfig.value()));
176 
177 } // icarus::riggerConfigurationExtraction::beginRun()
std::string fTriggerFragmentType
Name of the trigger fragment type.
std::optional< icarus::TriggerConfiguration > fTriggerConfig
Current Trigger configuration (may be still unassigned).
icarus::TriggerConfiguration extractTriggerReadoutConfiguration(std::string const &srcFileName, icarus::TriggerConfigurationExtractor extractor)
std::string to_string(WindowPattern const &pattern)
Class to extract PMT readout board configuration.
bool checkConsistency(icarus::TriggerConfiguration const &newConfig, std::string const &srcName) const
Throws an exception if the newConfig is not compatible with the current.
bool fVerbose
Whether to print the configuration we read.
bool icarus::TriggerConfigurationExtraction::checkConsistency ( icarus::TriggerConfiguration const &  newConfig,
std::string const &  srcName 
) const
private

Throws an exception if the newConfig is not compatible with the current.

Definition at line 182 of file TriggerConfigurationExtraction_module.cc.

183 {
184  if (!fTriggerConfig.has_value() || (*fTriggerConfig == config)) return true;
185 
186  // see debug information for more details
187  if (fRequireConsistency) {
188  throw cet::exception("icarus::TriggerConfigurationExtraction")
189  << "Configuration from " << srcName
190  << " is incompatible with the previously found configuration.\n"
191  ;
192  } // if consistency is required
193 
194  mf::LogWarning(fLogCategory)
195  << "Configuration from " << srcName
196  << " is incompatible with the previously found configuration.\n"
197  ;
198  if (fVerbose) mf::LogVerbatim(fLogCategory) << "Trigger readout:" << config;
199  return false;
200 
201 
202 } // icarus::TriggerConfigurationExtraction::checkConsistency()
bool fRequireConsistency
Whether trigger configuration inconsistency is fatal.
std::optional< icarus::TriggerConfiguration > fTriggerConfig
Current Trigger configuration (may be still unassigned).
bool fVerbose
Whether to print the configuration we read.
virtual void icarus::TriggerConfigurationExtraction::produce ( art::Event &  )
inlineoverridevirtual

Mandatory method, unused.

Definition at line 133 of file TriggerConfigurationExtraction_module.cc.

133 {}

Member Data Documentation

std::string icarus::TriggerConfigurationExtraction::fLogCategory
private

Category tag for messages.

Definition at line 95 of file TriggerConfigurationExtraction_module.cc.

bool icarus::TriggerConfigurationExtraction::fRequireConsistency = true
private

Whether trigger configuration inconsistency is fatal.

Definition at line 89 of file TriggerConfigurationExtraction_module.cc.

std::optional<icarus::TriggerConfiguration> icarus::TriggerConfigurationExtraction::fTriggerConfig
private

Current Trigger configuration (may be still unassigned).

Definition at line 86 of file TriggerConfigurationExtraction_module.cc.

std::string icarus::TriggerConfigurationExtraction::fTriggerFragmentType
private

Name of the trigger fragment type.

Definition at line 91 of file TriggerConfigurationExtraction_module.cc.

bool icarus::TriggerConfigurationExtraction::fVerbose = false
private

Whether to print the configuration we read.

Definition at line 93 of file TriggerConfigurationExtraction_module.cc.


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