|
NSCL DDAS 12.2-009
Support for XIA DDAS at FRIB
|
Store the system configuration information needed by Readout. More...
#include <Configuration.h>
Public Member Functions | |
| Configuration ()=default | |
| Constructor. More... | |
| ~Configuration ()=default | |
| Destructor. More... | |
| void | setCrateId (int id) |
| Set the crate id for the module. More... | |
| int | getCrateId () const |
| Return the crate id value. More... | |
| void | setNumberOfModules (size_t size) |
| Set the number of modules in the crate. More... | |
| size_t | getNumberOfModules () const |
| Return the number of modules in the crate. More... | |
| void | setSlotMap (const std::vector< unsigned short > &map) |
| Assign a new slot map. More... | |
| std::vector< unsigned short > | getSlotMap () const |
| Return the vector containing the filled slots. More... | |
| void | setChannelMap (const std::vector< unsigned short > &map) |
| Assign a new channel map (number of channels per module). More... | |
| std::vector< unsigned short > | getChannelMap () |
| Return the channel map. More... | |
| unsigned short | getModuleChannelCount (size_t mod) |
| Get the number of channels in a module. More... | |
| void | setSettingsFilePath (const std::string &path) |
| Set the path to the DSP settings file. More... | |
| std::string | getSettingsFilePath () const |
| Return the path to the .set file. More... | |
| void | setModuleSettingsFilePath (int modnum, const std::string &path) |
| Set a per-module DSP settings file. More... | |
| std::string | getModuleSettingsFilePath (int modNum) |
| Returns the DSP settings file path specific to a single module. More... | |
| void | setFirmwareConfiguration (int specifier, const FirmwareConfiguration &config) |
| Set the firmware configuration for a hardware type. More... | |
| FirmwareConfiguration & | getFirmwareConfiguration (int hdwrType) |
| Retrieve the current firmware specifier for a particular hardware type. More... | |
| void | setModuleFirmwareMap (int module, const FirmwareMap &mapping) |
| Sets a firmware map specific to a module. More... | |
| FirmwareConfiguration & | getModuleFirmwareConfiguration (int hdwrType, int modnum) |
| Get the module firmware configuration information. More... | |
| FirmwareMap & | getDefaultFirmwareMap () |
| Return the default map of firmware information. More... | |
| void | setModuleEventLengths (const std::vector< int > &lengths) |
| Set the lengths of events for each module. More... | |
| std::vector< int > | getModuleEventLengths () const |
| Return a copy of the module event length vector. More... | |
| void | setHardwareMap (const std::vector< int > &map) |
| Set the hardware map for each module. More... | |
| std::vector< int > | getHardwareMap () const |
| Return a copy of the hardware map vector. More... | |
| std::map< int, FirmwareMap > | getModuleFirmwareMaps () const |
| Get the per-module FW maps. More... | |
| std::map< int, std::string > | getModuleSetFileMap () const |
| Get the per-module settings file map. More... | |
| void | print (std::ostream &stream) |
| Print brief line of information for cfgPixie16.txt. More... | |
Static Public Member Functions | |
| static std::unique_ptr< Configuration > | generate (const std::string &cfgPixiePath) |
| Generate a Configuration class object from cfgPixie16.txt. More... | |
| static std::unique_ptr< Configuration > | generate (const std::string &fwVsnPath, const std::string &cfgPixiePath) |
| Generate a Configuration class object from a firmware version file and cfgPixie16.txt. More... | |
| static std::unique_ptr< Configuration > | generate (const std::string &fwVsnPath, const std::string &cfgPixiePath, const std::string &modEvtLenPath) |
| Generate a Configuration class object from a firmware version file, cfgPixie16.txt and modevtlen.txt file. More... | |
| static std::unique_ptr< Configuration > | generateManagedFW (const std::string &cfgPixiePath, const std::string &modEvtLenPath) |
| Generate a Configuration class object from cfgPixie16.txt and modevtlen.txt files (managed FW). More... | |
Store the system configuration information needed by Readout.
The Configuration class stores all of the system configuration for a Readout program. It maintains the configuration that is read in from the modevtlen.txt, and cfgPixie16.txt configuration files. The configuration keeps track of the crate ID, slot map, settings file path, module event lengths, module count, the hardware types present the crate, and, if specified, the firmware and DSP settings loaded onto those modules.
A number of methods are provided to generate a Configuration object based on which of the aforementioned configuration files are present. The new function generateManagedFW() can be used to generate a valid Configuration compatible with XIA's automatic firmware management (i.e. no pre-defined default FW).
At the moment, modules are expected to output events of equal length for all channels. There is no attempt to read out channels with different lengths in a module.
|
default |
Constructor.
|
default |
Destructor.
|
static |
Generate a Configuration class object from cfgPixie16.txt.
| cfgPixiePath | Path to cfgPixie16.txt. |
| std::runtime_error | Any errors opening or parsing the firmware and configuration files. |
|
static |
Generate a Configuration class object from a firmware version file and cfgPixie16.txt.
| fwVsnPath | Path to the firmware version file. |
| cfgPixiePath | Path to cfgPixie16.txt. |
| std::runtime_error | Any errors opening or parsing the firmware and configuration files. |
std::move() ensures correct ownership of the returned pointer, though we may be able to take advantage of some copy elision here.
|
static |
Generate a Configuration class object from a firmware version file, cfgPixie16.txt and modevtlen.txt file.
| fwVsnPath | Path to the firmware version file. |
| cfgPixiePath | Path to cfgPixie16.txt. |
| modEvtLenPath | Path to the modevtlen.txt file. |
| std::runtime_error | Error opening or parsing the modevtlen file. |
std::move() ensures correct ownership of the returned pointer, though we may be able to take advantage of some copy elision here.
|
static |
Generate a Configuration class object from cfgPixie16.txt and modevtlen.txt files (managed FW).
| cfgPixiePath | Path to cfgPixie16.txt. |
| modEvtLenPath | Path to the modevtlen.txt file. |
| std::runtime_error | Error opening or parsing the modevtlen file. |
std::move() ensures correct ownership of the returned pointer, though we may be able to take advantage of some copy elision here.
|
inline |
Return the channel map.
|
inline |
Return the crate id value.
|
inline |
Return the default map of firmware information.
| DAQ::DDAS::FirmwareConfiguration & DAQ::DDAS::Configuration::getFirmwareConfiguration | ( | int | hdwrType | ) |
Retrieve the current firmware specifier for a particular hardware type.
| hdwrType | The hardware specifier associated with the firmware configuration. |
| std::runtime_error | If no firmware configuration exists for the provided hdwrType. |
Searches the firmware map using std::find.
|
inline |
Return a copy of the hardware map vector.
| unsigned short DAQ::DDAS::Configuration::getModuleChannelCount | ( | size_t | mod | ) |
Get the number of channels in a module.
| mod | The module number (index, not slot). |
| std::out_of_range | if the module is out of range. |
|
inline |
Return a copy of the module event length vector.
| DAQ::DDAS::FirmwareConfiguration & DAQ::DDAS::Configuration::getModuleFirmwareConfiguration | ( | int | hwType, |
| int | modnum | ||
| ) |
Get the module firmware configuration information.
| hwType | The hardware type detected in the module. |
| modnum | Module number. |
| std::runtime_error | If the module firmware configuraton is not in the firmware map. |
It is an error to have a firmware configuration map file but not to have a configuration for the hardware type. If a per-module firmware map does not exist, return the default configuration.
|
inline |
Get the per-module FW maps.
|
inline |
Get the per-module settings file map.
| std::string DAQ::DDAS::Configuration::getModuleSettingsFilePath | ( | int | modnum | ) |
Returns the DSP settings file path specific to a single module.
| modnum | Module number. |
If there's a per-module set file it's returned otherwise return the default settings file.
|
inline |
Return the number of modules in the crate.
|
inline |
Return the path to the .set file.
|
inline |
Return the vector containing the filled slots.
| void DAQ::DDAS::Configuration::print | ( | std::ostream & | stream | ) |
Print brief line of information for cfgPixie16.txt.
| stream | The ostream to write to. |
Prints out a message similar to: "Crate number 1: 2 modules, in slots:2 3 DSPParFile: /path/to/file.set"
| void DAQ::DDAS::Configuration::setChannelMap | ( | const std::vector< unsigned short > & | map | ) |
Assign a new channel map (number of channels per module).
| map | Map of channels in each module. |
It is important for the caller to first call setNumberOfModules() before calling this to avoid an exception being thrown as this method ensures that the length of the channel map is the same as the expected number of modules in the system. If the user has not set the number of modules prior to calling this function, this cannot be guaranteed and the method will almost always throw.
|
inline |
Set the crate id for the module.
| id | The id to assign. |
|
inline |
Set the firmware configuration for a hardware type.
| specifier | The hardware type. |
| config | The new configuration. |
Any previous FirmwareConfiguration stored will be replaced by the new configuration. If there is no previous configuration for the hardware type it will be added.
| void DAQ::DDAS::Configuration::setHardwareMap | ( | const std::vector< int > & | map | ) |
Set the hardware map for each module.
| map | The hardware map. |
| std::runtime_error | if size of lengths does not match size of stored slot map. |
It is necessary that the caller has previously invoked setNumberOfModules() before calling this. The logic of this method aims to keep the slot map and number of modules in the system the same length. Without invoking setNumberOfModules() this is most likely not going to be the case.
| void DAQ::DDAS::Configuration::setModuleEventLengths | ( | const std::vector< int > & | lengths | ) |
Set the lengths of events for each module.
| lengths | The module event lengths. |
| std::runtime_error | if size of lengths vector does not match the number of modules in the system. |
It is important for the caller to first call setNumberOfModules() before calling this to avoid an exception being thrown as this method ensures that the length of the module event length map is the same as the expected number of modules in the system. If the user has not set the number of modules prior to calling this function, this cannot be guaranteed and the method will almost always throw.
| void DAQ::DDAS::Configuration::setModuleFirmwareMap | ( | int | module, |
| const FirmwareMap & | mapping | ||
| ) |
Sets a firmware map specific to a module.
| module | Module index. |
| mapping | Firmware mapping for that module. |
An existing map is ovewritten.
| void DAQ::DDAS::Configuration::setModuleSettingsFilePath | ( | int | modNum, |
| const std::string & | path | ||
| ) |
Set a per-module DSP settings file.
| modNum | Module number. |
| path | The path to the settings file. |
The filename path should be checked for readability by the caller.
| void DAQ::DDAS::Configuration::setNumberOfModules | ( | size_t | size | ) |
Set the number of modules in the crate.
| size | Number of modules. |
This resizes the vectors storing the slot map, module event lengths, and hardware map to be consistent. The caller must call setNumberOfModules() prior to setting the slot map, channel map, event lengths, or hardware map. Failure to do so will at best result in an exception and/or the caller application fatally terminating.
|
inline |
Set the path to the DSP settings file.
| path | The path to the settings file. |
| void DAQ::DDAS::Configuration::setSlotMap | ( | const std::vector< unsigned short > & | map | ) |
Assign a new slot map.
| map | The slots that are occupied. |
| std::runtime_error | When length of argument is different than the length of stored modevtlen vector. |
It is important for the caller to first call setNumberOfModules() before calling this to avoid an exception being thrown as this method ensures that the length of the slot map is the same as the expected number of modules in the system. If the user has not set the number of modules prior to calling this function, this cannot be guaranteed and the method will almost always throw.