McStas Readout Master 0.3.3
Loading...
Searching...
No Matches
Sender Class Reference

Buffers ESS readout records and transmits them as UDP packets to one EFU. More...

#include <Sender.h>

Public Member Functions

 Sender (std::string IpAddress, const int UDPPort, const int TCPPort, const DetectorType detector_type, const ReadoutType readout_type, efu_time p=efu_time(1), efu_time t=efu_time())
 
 Sender (const SenderConfig &config, efu_time p=efu_time(1), efu_time t=efu_time())
 
void addReadout (uint8_t Ring, uint8_t FEN, double tof, double weight, const void *data)
 Add one readout with its event time set to the current pulse time plus tof; the weight is ignored (statistical sampling happens upstream). A full buffer is transmitted and a new packet started automatically.
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const void *data)
 Add a single readout with an explicit event time.
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const CAEN_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const TTLMonitor_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const CDT_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const VMM3_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const BM0_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const BM2_readout_t *data)
 
void addReadout (uint8_t Ring, uint8_t FEN, efu_time t, const BMI_readout_t *data)
 
int send ()
 Transmit the current data buffer; the caller is responsible for starting a new packet (newPacket()) before adding further readouts.
 
void setPulseTime (uint32_t PHI, uint32_t PLO, uint32_t PPHI, uint32_t PPLO)
 Update the pulse and previous pulse times (high/low pairs).
 
void begin_pulse ()
 Start a new pulse: flush any buffered readouts, wait until the next pulse-grid tick has passed on the wall clock, and start a new packet with that tick as its pulse time. Everything sent afterwards carries reference times strictly later than any wall-clock instant preceding this call.
 
void fold_tof (const bool fold)
 Choose whether add-by-time-of-flight readouts are stamped at pulse + (tof % period) — attributing each event to the frame it would be detected in, as the real readout system reports it — instead of pulse + tof.
 
std::pair< uint32_t, uint32_t > lastPulseTime () const
 
std::pair< uint32_t, uint32_t > prevPulseTime () const
 
std::pair< uint32_t, uint32_t > lastEventTime () const
 
void newPacket ()
 Initialize a new packet with no readouts.
 
int command_shutdown () const
 Tell the remote EFU to shut down via its TCP command port.
 
int verbose (const Verbosity v)
 Set verbosity via enum.
 
int verbose (const int v)
 

Detailed Description

Buffers ESS readout records and transmits them as UDP packets to one EFU.

Records are packed into ESS readout packets (packet-type byte from the DetectorType, record layout from the ReadoutType) and sent to the configured address when the buffer fills, at pulse boundaries (begin_pulse()), or on destruction.

The pulse (reference) times in the packet headers march forward on a fixed grid with the configured period, anchored at the first pulse time: whenever a full buffer forces a new packet, the pulse time advances to the latest grid tick at or before the wall clock, so consecutive packets may share a pulse time until the reference clock ticks. begin_pulse() waits for the next grid tick to pass, guaranteeing the new pulse time is a wall-clock instant later than everything that happened before the call. The previous pulse time is always exactly one period earlier, as for a continuously pulsed source.

Definition at line 41 of file Sender.h.

Constructor & Destructor Documentation

◆ Sender() [1/2]

Sender::Sender ( std::string  IpAddress,
const int  UDPPort,
const int  TCPPort,
const DetectorType  detector_type,
const ReadoutType  readout_type,
efu_time  p = efu_time(1),
efu_time  t = efu_time() 
)
inline

Definition at line 43 of file Sender.h.

◆ Sender() [2/2]

Sender::Sender ( const SenderConfig config,
efu_time  p = efu_time(1),
efu_time  t = efu_time() 
)
inlineexplicit

Definition at line 60 of file Sender.h.

◆ ~Sender()

Sender::~Sender ( )
inline

Definition at line 63 of file Sender.h.

Member Function Documentation

◆ fold_tof()

void Sender::fold_tof ( const bool  fold)
inline

Choose whether add-by-time-of-flight readouts are stamped at pulse + (tof % period) — attributing each event to the frame it would be detected in, as the real readout system reports it — instead of pulse + tof.

Definition at line 102 of file Sender.h.

◆ verbose() [1/2]

int Sender::verbose ( const int  v)
inline

Definition at line 127 of file Sender.h.

◆ verbose() [2/2]

int Sender::verbose ( const Verbosity  v)
inline

Set verbosity via enum.

Definition at line 116 of file Sender.h.


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