NSCL DDAS  12.1-001
Support for XIA DDAS at FRIB
Public Member Functions | List of all members
CPixieRunUtilities Class Reference

Manage list-mode histogram and baseline runs for a Pixie-16 system. More...

#include <CPixieRunUtilities.h>

Public Member Functions

 CPixieRunUtilities ()
 Constructor. More...
 
int BeginHistogramRun (int module)
 Begin a histogram (MCA) run for a single module. Explicitly sets module synchronization to OFF. More...
 
int 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. More...
 
int ReadHistogram (int module, int channel)
 Read energy histogram from single channel. More...
 
int BeginBaselineRun (int module)
 Begin a baseline run. More...
 
int EndBaselineRun (int module)
 "End" a baseline run. More...
 
int ReadBaseline (int module, int channel)
 Acquire baselines and read baseline data from a single channel. More...
 
int ReadModuleStats (int module)
 Read statistics for a single module after a run is ended. More...
 
unsigned int * GetHistogramData ()
 Get the histogram data from a list-mode run. More...
 
unsigned int * GetBaselineData ()
 Get the baseline run data. More...
 
bool GetRunActive ()
 Get the current run status. More...
 
void SetUseGenerator (bool mode)
 Set the use of the generator for offline data. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CPixieRunUtilities()

CPixieRunUtilities::CPixieRunUtilities ( )

Constructor.

The CPixieRunUtilities class has ownership of a CDataGenerator object and is responsible for managing it.

Member Function Documentation

◆ BeginBaselineRun()

int CPixieRunUtilities::BeginBaselineRun ( int  module)

Begin a baseline run.

Returns
int
Return values
0Always.

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
moduleModule number.
Returns
int
Return values
0Success.
!=0XIA API error code.
Todo:
Disable multiple modules from running in non-sync mode.

◆ EndBaselineRun()

int CPixieRunUtilities::EndBaselineRun ( int  module)

"End" a baseline run.

Parameters
moduleModule number.
Returns
int
Return values
0Always.

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
moduleModule number.
Returns
int
Return values
0Always, 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
moduleModule number.
channelChannel number on the module.
Returns
int
Return values
0Success.
-1If baseline memory cannot be allocated.
-2If 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
moduleModule number.
channelChannel number on module to read histogram from.
Returns
int
Return values
0Success.
!=0XIA 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
moduleModule number.
Returns
int
Return values
0Success.
!=0XIA 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
modeSet the generator use flag to this value.

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