NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
DAQ::DDAS::Configuration Class Reference

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...
 
FirmwareConfigurationgetFirmwareConfiguration (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)
 

Detailed Description

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.

Member Function Documentation

int DAQ::DDAS::Configuration::getCrateId ( ) const
Returns
The crate id
FirmwareConfiguration & DAQ::DDAS::Configuration::getFirmwareConfiguration ( int  hdwrType)

Retrieve the current firmware specifier for the.

Parameters
hdwrTypethe hardware specifier associated with the firmware configuration
Returns
the firmware configuration associated with the hdwrType
Exceptions
std::runtime_errorif no firmware configuration exists for the provided hdwrType
std::vector< int > DAQ::DDAS::Configuration::getModuleEventLengths ( ) const
Returns
copy of module event lengths vector
size_t DAQ::DDAS::Configuration::getNumberOfModules ( ) const
Returns
the number of modules
std::string DAQ::DDAS::Configuration::getSettingsFilePath ( ) const
Returns
the settings file path
std::vector< unsigned short > DAQ::DDAS::Configuration::getSlotMap ( ) const
Returns
vector containing the slots that are filled
void DAQ::DDAS::Configuration::print ( std::ostream &  stream)

Print brief line of information for cfgPixie16.txt.

Parameters
streamthe 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.

Parameters
idthe 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.

Parameters
specifierthe hardware type
configthe 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.

Parameters
lengthsthe module event lengths
Exceptions
std::runtime_errorif 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.

Parameters
sizenumber 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.

Parameters
paththe path to the settings file
void DAQ::DDAS::Configuration::setSlotMap ( const std::vector< unsigned short > &  map)

Assign a new slot map.

Parameters
mapthe slots that are occupied
Exceptions
std::runtime_errorwhen 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.

Configuration config;
config.setNumberOfModules(2);
config.setSlotMap({2, 3});

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