Manage list-mode histogram and baseline runs for a Pixie-16 system.
More...
#include <CPixieRunUtilities.h>
Manage list-mode histogram and baseline runs for a Pixie-16 system.
This class provides functionality to start and stop runs as well as read data from the modules and return it to the caller.
◆ CPixieRunUtilities()
| CPixieRunUtilities::CPixieRunUtilities |
( |
| ) |
|
◆ ~CPixieRunUtilities()
| CPixieRunUtilities::~CPixieRunUtilities |
( |
| ) |
|
◆ BeginBaselineRun()
| int CPixieRunUtilities::BeginBaselineRun |
( |
int |
module, |
|
|
int |
nChannels |
|
) |
| |
Begin a baseline run.
- Parameters
-
| module | Module number. |
| nChannels | Channels per module. |
- Returns
- int
- Return values
-
Baseline acquisition is not a "run" in the same sense that histogram runs or list mode data taking is a "run" to the API (no begin/end functions, no run status change). However, in order for a user to accumulate enough baseline statistics to make judgements about e.g. manually setting baseline cuts, it needs to be treated as such in our manager. The active run flag is set to true when taking a baseline "run."
The baseline data itself is stored internally as a histogram of values in [0, histLength). This data structure is reset on begin.
◆ BeginHistogramRun()
| int CPixieRunUtilities::BeginHistogramRun |
( |
int |
module, |
|
|
int |
nChannels |
|
) |
| |
Begin a histogram (MCA) run for a single module. Explicitly sets module synchronization to OFF.
- Parameters
-
| module | Module number. |
| nChannels | Channels per module. |
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code. |
- Todo:
- Disable multiple modules from running in non-sync mode.
◆ EndBaselineRun()
| int CPixieRunUtilities::EndBaselineRun |
( |
int |
module | ) |
|
"End" a baseline run.
- Parameters
-
- Returns
- int
- Return values
-
Really all we need to do here is set the active run flag to false.
◆ EndHistogramRun()
| int CPixieRunUtilities::EndHistogramRun |
( |
int |
module | ) |
|
End a histogram (MCA) run for a single module. Assumes module synchronization is OFF but only stops a run in a single module.
- Parameters
-
- Returns
- int
- Return values
-
| 0 | Run end attempted; may return 0 even if the run did not stop within the retry limit. |
| !=0 | XIA API error code on failure. |
If the run cannot be ended on the first attempt, retry 10 times before reporting that the run could not be ended properly. Generally speaking, this is caused when one or more channels has a very high trigger rate.
◆ GetBaselineData()
| unsigned int * CPixieRunUtilities::GetBaselineData |
( |
| ) |
|
|
inline |
Get the baseline run data.
- Returns
- Pointer to the underlying baseline storage.
◆ GetHistogramData()
| unsigned int * CPixieRunUtilities::GetHistogramData |
( |
| ) |
|
|
inline |
Get the histogram data from a list-mode run.
- Returns
- Pointer to the underlying histogram storage.
◆ GetHistogramLength()
| int CPixieRunUtilities::GetHistogramLength |
( |
int |
module | ) |
|
Get the histogram length for a module.
- Parameters
-
| module | Module number (zero-indexed). |
- Returns
- The histogram length for the module or XIA error code if failed.
It is assumed that all channels on a module have the same histogram length. Since this function cannot be called until after the system is booted, there is no need to check for that condition here. The caller assumes responsibility for making sure the module number is valid.
◆ GetLastErrorMessage()
| const char * CPixieRunUtilities::GetLastErrorMessage |
( |
| ) |
|
|
inline |
Get the reason text from the most recent failed operation.
- Returns
- Pointer to the stored message; empty string if none.
◆ GetMaxBaselines()
| int CPixieRunUtilities::GetMaxBaselines |
( |
int |
module | ) |
|
Get the maximum number of baselines for a module.
- Parameters
-
| module | Module number (zero-indexed). |
- Returns
- The maximum number of baseline values which can be read out at once for this module or XIA error code if failed.
It is assumed that all channels on a module have the same max baseline size. Since this function cannot be called until after the system is booted, there is no need to check for that condition here. The caller assumes responsibility for making sure the module number is valid.
◆ GetRunActive()
| bool CPixieRunUtilities::GetRunActive |
( |
| ) |
|
|
inline |
Get the current run status.
- Returns
- bool True if a run is active, false otherwise.
◆ ReadBaseline()
| int CPixieRunUtilities::ReadBaseline |
( |
int |
module, |
|
|
int |
channel |
|
) |
| |
Acquire baselines and read baseline data from a single channel.
- Parameters
-
| module | Module number. |
| channel | Channel number on the module. |
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code on failure. |
Acquire baseline values for all channels on a module using Pixie16AcquireBaselines() and update the internal storage for baseline data. The single channel baseline data we want, specified by the input channel parameter, is copied into a local variable which is accessible via a getter function.
- Todo:
- (ASC 7/14/23): Why not just have the getter take a channel as an input parameter and return the correct baseline data. It seems unnecessary to maintain a separate copy.
◆ ReadHistogram()
| int CPixieRunUtilities::ReadHistogram |
( |
int |
module, |
|
|
int |
channel |
|
) |
| |
Read energy histogram from single channel.
- Parameters
-
| module | Module number. |
| channel | Channel number on module to read histogram from. |
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code. |
Histogram data comes either from the module itself if running in online mode or from the data generator.
- Note
- The data generator is primarily used to debug plot elements, curve fitting and display options. It will ignore any histogram settings (EMin, BinFactor) from the DSP.
◆ ReadModuleStats()
| int CPixieRunUtilities::ReadModuleStats |
( |
int |
module | ) |
|
Read statistics for a single module after a run is ended.
- Parameters
-
- Returns
- int
- Return values
-
| 0 | Success. |
| !=0 | XIA API error code. |
XIA API major verson > 3 does not guarantee a fixed-size statistics block. We must use the API function Pixie16GetStatisticsSize() to determine the stats block size and dynamically allocate memory for the statistics prior to reading them.
◆ SetLastErrorMessage()
| void CPixieRunUtilities::SetLastErrorMessage |
( |
const char * |
msg | ) |
|
|
inline |
Set the last error message. Used by the extern "C" shims when their catch-all fires.
- Parameters
-
◆ SetUseGenerator()
| void CPixieRunUtilities::SetUseGenerator |
( |
bool |
mode | ) |
|
|
inline |
Set the use of the generator for offline data.
- Parameters
-
| mode | Set the generator use flag to this value. |
The documentation for this class was generated from the following files: