NSCL DDAS
12.1-001
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 (const Configuration &rhs) | |
Copy 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 | setSettingsFilePath (const std::string &path) |
Set the path to the DSP settings file. More... | |
void | setModuleSettingsFilePath (int modnum, const std::string &path) |
Set a per-module DSP settings file. More... | |
std::string | getSettingsFilePath () const |
Return the path to the .set file. More... | |
std::string | getSettingsFilePath (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... | |
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 &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 and cfgPixie16.txt. 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 DDASFirmwareVersion.txt, modevtlen.txt, and cfgPixie16.txt configuration files. The configuration therefore keeps track of the crate id, slot map, setting file path, module event lengths, module count, and all of the available firmware files for each hardware type.
It can be configured either manually or by passing it as an argument to a ConfigurationParser::parse()
, FirmwareVersionFileParser::parse()
, or ModEvtFileParser::parse()
methods as it is in the Readout programs.
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.
|
inline |
Copy constructor.
|
default |
Destructor.
|
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 and cfgPixie16.txt.
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.
|
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.
|
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 |
Return the number of modules in the crate.
|
inline |
Return the path to the .set file.
std::string DAQ::DDAS::Configuration::getSettingsFilePath | ( | 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 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"
|
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 module event length vectors 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 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 module event length vectors the same length. Without invoking setNumberOfModules()
this is most likely not going to be the case.
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 should call setNumberOfModules prior to calling setSlotMap()
or setModuleEventLengths()
.
|
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. To avoid weird configurations, this ensures that the length of the slot map is the same as the module event length vector at all times. If the user has not set the number of modules previously, this cannot be gauranteed and the method will almost always throw.