System manager class for DDAS.
More...
#include <CPixieSystemUtilities.h>
System manager class for DDAS.
This class manages the Pixie DAQ system. It controls loading and saving settings files, booting and exiting, and stores information about the state of the system which can be accessed across the ctypes interface.
◆ CPixieSystemUtilities()
| CPixieSystemUtilities::CPixieSystemUtilities |
( |
| ) |
|
Constructor.
Default: boot in online mode and read the settings file specified in cfgPixie16.txt. The last error message is initialized to an empty string.
◆ Boot()
| int CPixieSystemUtilities::Boot |
( |
| ) |
|
Boot the entire system.
- Returns
- int
- Return values
-
| 0 | On successful boot. |
| CPIXIEERROR_INVALID_CONFIG | Failed to generate the system configuration. |
| !=0 | XIA API error code on failure. |
Reads in configuration information from cfgPixie16.txt, loads settings file information, boots modules and saves configuration info.
- Note
- (ASC 9/11/24): Check the same envvar as e.g. the readout code to determine whether to perform a full boot or settings-only boot. In principle this could be configurable on the QtScope GUI but for now the boot mode is set the same way as it is for the readout code. An important thing to keep in mind is that
getenv("DDAS_BOOT_WHEN_REQUESTED") is false iff DDAS_BOOT_WHEN_REQUESTED is not set (getenv() returns pointer to the value string which evaluates to true regardless of the value itself). When running a containerized NSCLDAQ one needs to make sure the envvar is set inside the container.
◆ ExitSystem()
| int CPixieSystemUtilities::ExitSystem |
( |
| ) |
|
Exit the system and release resources from the modules.
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code on failure. |
If the call to Pixie16ExitSystem() fails for any module, return the error code and set the booted state flag to false. The system is likely in a bad state.
◆ GetBootMode()
| int CPixieSystemUtilities::GetBootMode |
( |
| ) |
|
|
inline |
Get the boot mode.
- Warning
- Offline boot mode is currently only allowed for XIA API 2!
- Returns
- The boot mode.
- Return values
-
| 0 | Online mode. |
| 1 | Offline mode (no hardware). |
◆ GetBootStatus()
| bool CPixieSystemUtilities::GetBootStatus |
( |
| ) |
|
|
inline |
Get the crate boot status.
- Returns
- bool
- Return values
-
| true | If the system has been booted. |
| false | Otherwise. |
◆ GetLastErrorMessage()
| const char * CPixieSystemUtilities::GetLastErrorMessage |
( |
| ) |
|
|
inline |
Get the reason text from the most recent failed operation.
- Returns
- Pointer to the stored message; empty string if none.
◆ GetModuleChannelCount()
| int CPixieSystemUtilities::GetModuleChannelCount |
( |
int |
module | ) |
|
Get the number of channels on the module.
- Parameters
-
| module | Module number (zero-indexed). |
- Returns
- The number of channels on the module.
- Return values
-
| CPIXIEERROR_NOT_BOOTED | if the system is not booted. |
| CPIXIEERROR_INVALID_MODULE | if the module number is invalid. |
Performs bounds checking on the module number. The various DAQ::DDAS::Configuration accessor methods throw but ctypes does not handle C++ exceptions so we catch them here and print the error message to stderr. The return value is an error code that can be checked by the caller.
◆ GetModuleMSPS()
| int CPixieSystemUtilities::GetModuleMSPS |
( |
int |
module | ) |
|
Get the module ADC sampling rate in MSPS.
- Parameters
-
| module | Module number (zero-indexed). |
- Returns
- The module ADC sampling rate in MSPS.
- Return values
-
| CPIXIEERROR_NOT_BOOTED | if the system is not booted. |
| CPIXIEERROR_INVALID_MODULE | if the module number is invalid. |
Performs bounds checking on the module number. The various DAQ::DDAS::Configuration accessor methods throw but ctypes does not handle C++ exceptions so we catch them here and print the error message to stderr. The return value is an error code that can be checked by the caller.
◆ GetNumModules()
| int CPixieSystemUtilities::GetNumModules |
( |
| ) |
|
|
inline |
Get the number of installed modules.
- Returns
- The number of modules in the crate.
◆ LoadSetFile()
| int CPixieSystemUtilities::LoadSetFile |
( |
char * |
fileName | ) |
|
Load a new settings file.
- Parameters
-
| fileName | Settings file name we are attempting to open. |
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code on failure. |
Check and see if the system is booted. If so, load the parameters from the settings file. If not flag that a new settings file path (potentially different from that in the cfgPixie16.txt) has been set. The flag is checked at boot to load the new settings file.
◆ SaveSetFile()
| int CPixieSystemUtilities::SaveSetFile |
( |
char * |
fileName | ) |
|
Save the currently loaded DSP settings to a settings file.
- Parameters
-
| fileName | Name of file to save. |
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code on failure. |
File format depends on what is supported by the version of the XIA API being used. Version 3+ will save the settings file as a JSON file while in version 2 it is binary.
◆ SetBootMode()
| void CPixieSystemUtilities::SetBootMode |
( |
int |
mode | ) |
|
|
inline |
Set the boot mode.
- Parameters
-
| mode | Set the boot mode to this value. |
◆ SetLastErrorMessage()
| void CPixieSystemUtilities::SetLastErrorMessage |
( |
const char * |
msg | ) |
|
|
inline |
Set the last error message. Used by the extern "C" shims when their catch-all fires.
- Parameters
-
The documentation for this class was generated from the following files: