NSCL DDAS
1.0
Support for XIA DDAS at the NSCL
|
The Configuration class. More...
#include <Configuration.h>
Public Member Functions | |
Configuration (const Configuration &)=default | |
void | setCrateId (int id) |
Set the crate id for the module. More... | |
int | getCrateId () const |
void | setNumberOfModules (size_t size) |
Set the number of modules in the crate. More... | |
size_t | getNumberOfModules () const |
void | setSlotMap (const std::vector< unsigned short > &map) |
Assign a new slot map. More... | |
std::vector< unsigned short > | getSlotMap () const |
void | setSettingsFilePath (const std::string &path) |
Set the path to the .set file. More... | |
std::string | getSettingsFilePath () const |
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 the. More... | |
void | setModuleEventLengths (const std::vector< int > &lengths) |
Set the lengths of events for each module. More... | |
std::vector< int > | getModuleEventLengths () const |
void | setHardwareMap (const std::vector< int > &map) |
std::vector< int > | getHardwareMap () const |
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) |
static std::unique_ptr < Configuration > | generate (const std::string &fwVsnPath, const std::string &cfgPixiePath, const std::string &modEvtLenPath) |
The Configuration class.
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.
int DAQ::DDAS::Configuration::getCrateId | ( | ) | const |
FirmwareConfiguration & DAQ::DDAS::Configuration::getFirmwareConfiguration | ( | int | hdwrType | ) |
Retrieve the current firmware specifier for the.
hdwrType | the hardware specifier associated with the firmware configuration |
std::runtime_error | if no firmware configuration exists for the provided hdwrType |
std::vector< int > DAQ::DDAS::Configuration::getModuleEventLengths | ( | ) | const |
size_t DAQ::DDAS::Configuration::getNumberOfModules | ( | ) | const |
std::string DAQ::DDAS::Configuration::getSettingsFilePath | ( | ) | const |
std::vector< unsigned short > DAQ::DDAS::Configuration::getSlotMap | ( | ) | const |
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 10 DSPParFile: /path/to/file.set"
void DAQ::DDAS::Configuration::setCrateId | ( | int | id | ) |
Set the crate id for the module.
id | the id to assign |
Note that this is not currently used for anything.
void DAQ::DDAS::Configuration::setFirmwareConfiguration | ( | int | specifier, |
const FirmwareConfiguration & | config | ||
) |
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::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::setNumberOfModules | ( | size_t | size | ) |
Set the number of modules in the crate.
size | number of modules |
This resizes both the vectors storing the slot map and module event lengths to be consistent. The caller should call setNumberOfModules prior to calling setSlotMap() or setModuleEventLengths().
void DAQ::DDAS::Configuration::setSettingsFilePath | ( | const std::string & | path | ) |
Set the path to the .set 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 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.