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 |
( |
| ) |
|
◆ BeginBaselineRun()
int CPixieRunUtilities::BeginBaselineRun |
( |
int |
module | ) |
|
Begin a baseline run.
- 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, MAX_HISTOGRAM_LENGTH). This data structure is reset on begin.
◆ BeginHistogramRun()
int CPixieRunUtilities::BeginHistogramRun |
( |
int |
module | ) |
|
Begin a histogram (MCA) run for a single module. Explicitly sets module synchronization to OFF.
- Parameters
-
- 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 | Always, even if the run ended improperly. |
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.
◆ 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. |
-1 | If baseline memory cannot be allocated. |
-2 | If updating the baseline histograms fails. |
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.
◆ 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. |
Statistics size is different between XIA API version 2 and 3. 3.x provides a Pixie16GetStatisticsSize() so we don't have to worry about calculating the statistics size ourselves or use a hardcoded value. Accessing the run statistics using the wrong method results in a segfault.
- Todo:
- (ASC 9/27/23): Confirm end of run and handle if not ended properly.
◆ 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: