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::PMTconfigurationExtraction Class Reference

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

Inheritance diagram for icarus::PMTconfigurationExtraction:

Classes

struct  Config
 Configuration of the module. More...
 

Public Types

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

Public Member Functions

 PMTconfigurationExtraction (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 (sbn::PMTconfiguration const &newConfig, std::string const &srcName) const
 Throws an exception if the newConfig is not compatible with the current. More...
 

Private Attributes

std::optional
< sbn::PMTconfiguration
fPMTconfig
 Current PMT configuration (may be still unassigned). More...
 
icarusDB::IICARUSChannelMap const * fChannelMap = nullptr
 Pointer to the online channel mapping service. More...
 
bool fRequireConsistency = true
 Whether PMT configuration inconsistency is fatal. More...
 
bool fVerbose = false
 Whether to print the configuration we read. More...
 
std::string fLogCategory
 Category tag for messages. More...
 

Detailed Description

Writes PMT configuration from FHiCL into a data product.

This module reads the configuration related to PMT 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::PMTconfigurationExtractor, which is the utility used for the actual extraction.

Output

A data product of type sbn::PMTconfiguration 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 91 of file PMTconfigurationExtraction_module.cc.

Member Typedef Documentation

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

Definition at line 139 of file PMTconfigurationExtraction_module.cc.

Constructor & Destructor Documentation

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

Constructor: just reads the configuration.

Definition at line 165 of file PMTconfigurationExtraction_module.cc.

166  : art::EDProducer(config)
167  , fChannelMap(config().AssignOfflineChannelIDs()
168  ? art::ServiceHandle<icarusDB::IICARUSChannelMap const>{}.get()
icarusDB::IICARUSChannelMap const * fChannelMap
Pointer to the online channel mapping service.

Member Function Documentation

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

Action on new run: configuration is written.

Definition at line 184 of file PMTconfigurationExtraction_module.cc.

184  {
185 
188 
189  checkConsistency(config, "run " + std::to_string(run.run()));
190  if (!fPMTconfig.has_value() && fVerbose)
191  mf::LogInfo(fLogCategory) << "PMT readout:" << config;
192 
193  fPMTconfig = std::move(config);
194 
195  // put a copy of the current configuration
196  run.put(std::make_unique<sbn::PMTconfiguration>(fPMTconfig.value()));
197 
198 } // icarus::PMTconfigurationExtraction::beginRun()
icarusDB::IICARUSChannelMap const * fChannelMap
Pointer to the online channel mapping service.
sbn::PMTconfiguration extractPMTreadoutConfiguration(std::string const &srcFileName, icarus::PMTconfigurationExtractor extractor)
bool fVerbose
Whether to print the configuration we read.
bool checkConsistency(sbn::PMTconfiguration const &newConfig, std::string const &srcName) const
Throws an exception if the newConfig is not compatible with the current.
std::string fLogCategory
Category tag for messages.
Class to extract PMT readout board configuration.
std::string to_string(WindowPattern const &pattern)
Class containing configuration for PMT readout.
std::optional< sbn::PMTconfiguration > fPMTconfig
Current PMT configuration (may be still unassigned).
bool icarus::PMTconfigurationExtraction::checkConsistency ( sbn::PMTconfiguration const &  newConfig,
std::string const &  srcName 
) const
private

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

Definition at line 203 of file PMTconfigurationExtraction_module.cc.

204 {
205  if (!fPMTconfig.has_value() || (*fPMTconfig == config)) return true;
206 
207  // see debug information for more details
208  if (fRequireConsistency) {
209  throw cet::exception("PMTconfigurationExtraction")
210  << "Configuration from " << srcName
211  << " is incompatible with the previously found configuration.\n"
212  ;
213  } // if consistency is required
214 
215  mf::LogWarning(fLogCategory)
216  << "Configuration from " << srcName
217  << " is incompatible with the previously found configuration.\n"
218  ;
219  if (fVerbose) mf::LogVerbatim(fLogCategory) << "PMT readout:" << config;
220  return false;
221 
222 
223 } // icarus::PMTconfigurationExtraction::checkConsistency()
bool fRequireConsistency
Whether PMT configuration inconsistency is fatal.
bool fVerbose
Whether to print the configuration we read.
std::string fLogCategory
Category tag for messages.
std::optional< sbn::PMTconfiguration > fPMTconfig
Current PMT configuration (may be still unassigned).
virtual void icarus::PMTconfigurationExtraction::produce ( art::Event &  )
inlineoverridevirtual

Mandatory method, unused.

Definition at line 150 of file PMTconfigurationExtraction_module.cc.

150 {}

Member Data Documentation

icarusDB::IICARUSChannelMap const* icarus::PMTconfigurationExtraction::fChannelMap = nullptr
private

Pointer to the online channel mapping service.

Definition at line 97 of file PMTconfigurationExtraction_module.cc.

std::string icarus::PMTconfigurationExtraction::fLogCategory
private

Category tag for messages.

Definition at line 104 of file PMTconfigurationExtraction_module.cc.

std::optional<sbn::PMTconfiguration> icarus::PMTconfigurationExtraction::fPMTconfig
private

Current PMT configuration (may be still unassigned).

Definition at line 94 of file PMTconfigurationExtraction_module.cc.

bool icarus::PMTconfigurationExtraction::fRequireConsistency = true
private

Whether PMT configuration inconsistency is fatal.

Definition at line 100 of file PMTconfigurationExtraction_module.cc.

bool icarus::PMTconfigurationExtraction::fVerbose = false
private

Whether to print the configuration we read.

Definition at line 102 of file PMTconfigurationExtraction_module.cc.


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