McStas Readout Master 0.8.0
Loading...
Searching...
No Matches
readout_orig.h
1#ifndef READOUT_WRAPPER
2#define READOUT_WRAPPER
3
4#include <stddef.h>
5#include "readout_structs.h"
6
7#ifdef WIN32
8// Export symbols if compile flags "READOUT_SHARED" and "READOUT_EXPORT" are set on Windows.
9 #ifdef READOUT_SHARED
10 #ifdef READOUT_EXPORT
11 #define RL_API __declspec(dllexport)
12 #else
13 #define RL_API __declspec(dllimport)
14 #endif
15 #else
16 // Disable definition if linking statically.
17 #define RL_API
18 #endif
19#else
20// Disable definition for non-Win32 systems.
21#define RL_API
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28struct readout;
29typedef struct readout readout_t;
30
31// Create a new Readout object
32// type == 0x34 for BIFROST, 0x41 for He3CSPEC
33RL_API readout_t * readout_create(const char* address, int port, int command_port, double source_frequency, int type);
34
35// Destroy an existing Readout object
36RL_API void readout_destroy(readout_t* r_ptr);
37
38// Add a readout value to the transmission buffer of the Readout object
39// Automatically transmits the packet if it is full.
40RL_API void readout_add(readout_t* r_ptr, uint8_t ring, uint8_t fen, double time_of_flight, double weight, const void* data);
41// Send the current data buffer for the Readout object
42RL_API void readout_send(readout_t* r_ptr);
43// Update the pulse and previous pulse times for the Readout object
44RL_API void readout_setPulseTime(readout_t* r_ptr);
45
46// Initialize a new packet with no readouts for the Readout object
47RL_API void readout_newPacket(readout_t* r_ptr);
48
49// Send the command-port of the Event Formation Unit the exit signal
50RL_API int readout_shutdown(readout_t* r_ptr);
51
52// Set the verbose level of the readout sender to emit nothing to standard output
53RL_API int readout_silent(readout_t* r_ptr);
54// Set the verbose level of the readout sender to emit extra error messages to standard output
55RL_API int readout_print_errors(readout_t* r_ptr);
56// Set the verbose level of the readout sender to emit warnings and extra error messages to standard output
57RL_API int readout_print_warnings(readout_t* r_ptr);
58// Set the verbose level of the readout sender to emit info, warnings and extra error messages to standard output
59RL_API int readout_print_info(readout_t* r_ptr);
60// Set the verbose level of the readout sender to emit extra detail messages to standard output
61RL_API int readout_print_details(readout_t* r_ptr);
62// Set the verbose level from an integer -- look at ReadoutClass.h
63RL_API int readout_verbose(readout_t* r_ptr, int);
64
65// Control file output for the Readout object
66RL_API void readout_dump_to(readout_t * r_ptr, const char * filename);
67
68// Combine multiple files into one for the Readout object -- each should have come from an equivalent Readout object
69RL_API void readout_merge_files(const char * out_filename, const char ** in_filenames, size_t count);
70
71// Stamp events at pulse + (time_of_flight mod pulse period) -- the frame the event
72// would be detected in -- instead of pulse + time_of_flight (off by default).
73// Times of a period or more are reported on stderr either way.
74RL_API void readout_fold_tof(readout_t * r_ptr, int enable);
75
76// How many output queues an EFU distinguishes: the ESS readout parser keeps one packet
77// sequence per queue, numbered 0 to READOUT_OUTPUT_QUEUES-1.
78#define READOUT_OUTPUT_QUEUES 12
79
80// Send on output queue `queue` (0 by default). Processes sending to one EFU at the same
81// time -- MPI ranks -- need distinct queues or their sequence numbers interleave and the
82// EFU counts every switch as an error. Out-of-range values are refused, returning -1.
83RL_API int readout_output_queue(readout_t * r_ptr, int queue);
84
85// Allow disabling and enabling network communication (on by default)
86RL_API void readout_disable_network(readout_t * r_ptr);
87RL_API void readout_enable_network(readout_t * r_ptr);
88
89// Set the random seed for the readout random object
90RL_API void readout_rand_seed01(readout_t * r_ptr, double seed);
91RL_API void readout_rand_seed(readout_t * r_ptr, uint32_t seed);
92// Convert a probability to a discrete number of events
93RL_API int readout_rand_poisson(readout_t * r_ptr, double mean);
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif