CAEN FERS Library v1.3.0
SDK for FERS systems
Loading...
Searching...
No Matches
Data readout
Collaboration diagram for Data readout:

Functions

int FERS_InitReadout (int handle, int ROmode, int *AllocatedSize)
 Init readout for one board (allocate buffers and initialize variables)
 
int FERS_CloseReadout (int handle)
 De-init readoout (free buffers)
 
int FERS_FlushData (int handle)
 Flush the data buffer (Read and discard data until the RX buffer is empty)
 
int FERS_GetCrcErrorCnt (int cnc_handle, uint32_t *errcnt)
 Get the number of CRC errors detected by the concentrator since the last start of run.
 
int FERS_StartAcquisition (int *handle, int NumBrd, int StartMode, int RunNum)
 Start data acquisition. Set ReadoutState = RUNNING, wait until all threads are running, then send the run command to the boards, according to the given start mode.
 
int FERS_StopAcquisition (int *handle, int NumBrd, int StartMode, int RunNum)
 Send the stop command to the boards (according to the same mode used to start them)
 
int FERS_GetEvent (int *handle, int *bindex, int *DataQualifier, double *tstamp_us, void **Event, int *nb)
 Read and decode one event from the readout buffers. There are two readout modes: sorted or unsorted. If sorting is requested, the readout init function will allocate queues for sorting.
 
int FERS_GetEventFromBoard (int handle, int *DataQualifier, double *tstamp_us, void **Event, int *nb)
 Read and decode one event from a specific board.
 

Detailed Description

Function Documentation

◆ FERS_InitReadout()

int FERS_InitReadout ( int handle,
int ROmode,
int * AllocatedSize )

Init readout for one board (allocate buffers and initialize variables)

Parameters
[out]AllocatedSizePointer to the tot. num. of bytes allocated for data buffers and descriptors
[in]handleBoard handle
[in]ROmodeEventBuilding readout mode
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_CloseReadout()

int FERS_CloseReadout ( int handle)

De-init readoout (free buffers)

Parameters
[in]handleBoard handle
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_FlushData()

int FERS_FlushData ( int handle)

Flush the data buffer (Read and discard data until the RX buffer is empty)

Parameters
[in]handleBoard handle
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_GetCrcErrorCnt()

int FERS_GetCrcErrorCnt ( int cnc_handle,
uint32_t * errcnt )

Get the number of CRC errors detected by the concentrator since the last start of run.

Parameters
[out]errcntPointer to the CRC error counter
[in]cnc_handleHandle of the concentratore
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_StartAcquisition()

int FERS_StartAcquisition ( int * handle,
int NumBrd,
int StartMode,
int RunNum )

Start data acquisition. Set ReadoutState = RUNNING, wait until all threads are running, then send the run command to the boards, according to the given start mode.

Parameters
[in]handleArray of board handles
[in]NumBrdNumber of boards to start
[in]StartModeAcquisition start mode (Async, T0/T1 chain, TDlink)
[in]RunNumRun number
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_StopAcquisition()

int FERS_StopAcquisition ( int * handle,
int NumBrd,
int StartMode,
int RunNum )

Send the stop command to the boards (according to the same mode used to start them)

Note
This function stops the run in the hardware (thus stopping the data flow) but it doesn't stop the RX threads because they need to empty the buffers and the pipes. The threads will stop automatically when there is no data or when a flush command is sent.
Parameters
[in]handleArray of board handles
[in]NumBrdNumber of boards to stop
[in]StartModeAcquisition stop mode
[in]RunNumRun number
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_GetEvent()

int FERS_GetEvent ( int * handle,
int * bindex,
int * DataQualifier,
double * tstamp_us,
void ** Event,
int * nb )

Read and decode one event from the readout buffers. There are two readout modes: sorted or unsorted. If sorting is requested, the readout init function will allocate queues for sorting.

Parameters
[out]bindexPointer to the board index from which the event comes
[out]DataQualifierPointer to the data qualifier (type of data, used to determine the struct for event data)
[out]tstamp_usPointer to the event timestamp in microseconds (the information is also reported in the event data struct)
[out]EventPointer to the read event data structure
[out]nbPointer to the size of the read event (in bytes)
[in]handleArray of boards handles
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes

◆ FERS_GetEventFromBoard()

int FERS_GetEventFromBoard ( int handle,
int * DataQualifier,
double * tstamp_us,
void ** Event,
int * nb )

Read and decode one event from a specific board.

Parameters
[out]DataQualifierPointer to the data qualifier (type of data, used to determine the struct for event data)
[out]tstamp_usPointer to the event timestamp in microseconds (the information is also reported in the event data struct)
[out]EventPointer to the read event data
[out]nbPointer to the size of the read event (in bytes)
[in]handleBoard handle
Returns
0 on success, or a negative error code as defined in FERSLIB_ErrorCodes