McStas Readout Master 0.8.0
Loading...
Searching...
No Matches
Readout Class Reference

Runtime-streaming readout generator used by the legacy Readout components. More...

#include <ReadoutClass.h>

Public Member Functions

 Readout (std::string IpAddress, const int UDPPort, const int TCPPort, const int Type, const pulse_grid grid)
 
 Readout (std::string IpAddress, const int UDPPort, const int TCPPort, const int Type=0x34, const efu_time p=efu_time(1))
 
void addReadout (uint8_t Ring, uint8_t FEN, double tof, double weight, const void *data)
 Add a weighted readout: draws n ~ Poisson(weight) and buffers the event n times (weight <= 0 is a noise event, sent once); 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 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.
 
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 update_time ()
 Advance the reference (pulse) time to now, flushing the buffer and starting a new packet; keeps (now - prev) within the 5-period window required by the ESS CAEN EFUs.
 
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)
 
void dump_to (const std::string &filename, const std::string &dataset_name="events")
 Also store every added readout to a legacy flat HDF5 file (see Writer).
 
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. Either way, a time-of-flight of a period or more is counted and reported.
 
uint64_t long_tof_count () const
 How many readouts so far had a time-of-flight of at least one pulse period.
 
void output_queue (const int queue)
 Send on this output queue (0 until set). An EFU keeps one packet sequence per queue, so several processes sending to one EFU – MPI ranks – each need their own.
 
int output_queue () const
 
int sequence_number () const
 The number the next packet will be sent with.
 
void enable_network ()
 
void disable_network ()
 
void set_random_seed (const uint32_t seed)
 
int random_poisson (const double mean)
 

Detailed Description

Runtime-streaming readout generator used by the legacy Readout components.

Buffers ESS readout packets and sends them over UDP to one EFU while the simulation runs. The weighted addReadout() draws n ~ Poisson(weight) and sends the event that many times (weight <= 0 marks a noise event, sent exactly once); it can also mirror every stored record to a legacy flat HDF5 file via dump_to(). The replay path uses Sender instead.

Pulse (reference) times are ticks of an epoch-anchored pulse_grid, so every Readout – one per MPI rank – and mccode-plumber's mp-tdc agree on them.

Definition at line 36 of file ReadoutClass.h.

Constructor & Destructor Documentation

◆ Readout() [1/2]

Readout::Readout ( std::string  IpAddress,
const int  UDPPort,
const int  TCPPort,
const int  Type,
const pulse_grid  grid 
)
inline

Definition at line 38 of file ReadoutClass.h.

◆ Readout() [2/2]

Readout::Readout ( std::string  IpAddress,
const int  UDPPort,
const int  TCPPort,
const int  Type = 0x34,
const efu_time  p = efu_time(1) 
)
inline

Definition at line 58 of file ReadoutClass.h.

◆ ~Readout()

Readout::~Readout ( )
inline

Definition at line 66 of file ReadoutClass.h.

Member Function Documentation

◆ disable_network()

void Readout::disable_network ( )
inline

Definition at line 150 of file ReadoutClass.h.

◆ enable_network()

void Readout::enable_network ( )
inline

Definition at line 149 of file ReadoutClass.h.

◆ fold_tof()

void Readout::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. Either way, a time-of-flight of a period or more is counted and reported.

Definition at line 135 of file ReadoutClass.h.

◆ long_tof_count()

uint64_t Readout::long_tof_count ( ) const
inline

How many readouts so far had a time-of-flight of at least one pulse period.

Definition at line 137 of file ReadoutClass.h.

◆ output_queue() [1/2]

int Readout::output_queue ( ) const
inline

Definition at line 145 of file ReadoutClass.h.

◆ output_queue() [2/2]

void Readout::output_queue ( const int  queue)
inline

Send on this output queue (0 until set). An EFU keeps one packet sequence per queue, so several processes sending to one EFU – MPI ranks – each need their own.

Definition at line 141 of file ReadoutClass.h.

◆ random_poisson()

int Readout::random_poisson ( const double  mean)
inline

Definition at line 156 of file ReadoutClass.h.

◆ sequence_number()

int Readout::sequence_number ( ) const
inline

The number the next packet will be sent with.

Definition at line 147 of file ReadoutClass.h.

◆ set_random_seed()

void Readout::set_random_seed ( const uint32_t  seed)
inline

Definition at line 152 of file ReadoutClass.h.

◆ update_time()

void Readout::update_time ( )
inline

Advance the reference (pulse) time to now, flushing the buffer and starting a new packet; keeps (now - prev) within the 5-period window required by the ESS CAEN EFUs.

Definition at line 95 of file ReadoutClass.h.

References pulse_grid::at_or_before(), and efu_time::now_nanoseconds().

◆ verbose() [1/2]

int Readout::verbose ( const int  v)
inline

Definition at line 126 of file ReadoutClass.h.

◆ verbose() [2/2]

int Readout::verbose ( const Verbosity  v)
inline

Set verbosity via enum.

Definition at line 115 of file ReadoutClass.h.


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