Files | |
file | bpm_interface.h |
Front end interface structure definitions and handlers. | |
file | get_header.c |
file | load_bpmconf.c |
file | load_signals.c |
file | load_struct.c |
file | save_signals.c |
Data Structures | |
struct | bpmconf |
struct | bpmsignal |
struct | bpmcalib |
struct | bpmproc |
struct | beamconf |
struct | bpmmode |
struct | rfmodel |
Defines | |
#define | NMAX_MODES |
Typedefs | |
typedef bpmconf | bpmconf_t |
typedef bpmsignal | bpmsignal_t |
typedef bpmcalib | bpmcalib_t |
typedef bpmproc | bpmproc_t |
typedef beamconf | beamconf_t |
typedef bpmmode | bpmmode_t |
typedef rfmodel | rfmodel_t |
Enumerations | |
enum | bpmtype_t { diode, monopole, dipole } |
enum | bpmpol_t { horiz, vert } |
enum | bpmphase_t { randomised, locked } |
Functions | |
EXTERN int | load_bpmconf (const char *fname, bpmconf_t **conf, int *num_conf) |
EXTERN int | get_header (FILE *file, double *version, int *num_structs) |
EXTERN int | load_struct (FILE *file, char ***arg_list, char ***val_list, int *num_args) |
EXTERN int | save_signals (char *fname, bpmsignal_t *sigs, int num_evts) |
EXTERN int | load_signals (char *fname, bpmsignal_t **sigs) |
Variables | |
EXTERN int | bpm_verbose |
type definition for BPM configuration
Definition at line 63 of file bpm_interface.h.
typedef struct bpmsignal bpmsignal_t |
type definition for BPM signals
Definition at line 64 of file bpm_interface.h.
typedef struct bpmcalib bpmcalib_t |
type definition for calibrations
Definition at line 65 of file bpm_interface.h.
type definition for processed BPM signals
Definition at line 66 of file bpm_interface.h.
typedef struct beamconf beamconf_t |
type definition for beam configurations
Definition at line 67 of file bpm_interface.h.
enum bpmtype_t |
BPM cavity ( of better signal ) type
diode | diodified bpm signal or trigger pulse |
monopole | reference cavity signal ( monopole ) |
dipole | position sentivive cavity signal ( dipole ) |
Definition at line 40 of file bpm_interface.h.
enum bpmpol_t |
BPM polarisation plane, basically a difficult way to say x or y ;)
Definition at line 49 of file bpm_interface.h.
enum bpmphase_t |
BPM electronics phase lock type
Definition at line 57 of file bpm_interface.h.
EXTERN int load_bpmconf | ( | const char * | fname, | |
bpmconf_t ** | conf, | |||
int * | num_conf | |||
) |
Load a set of bpm configurations from file fname. Memory is allocated using calloc and so is the responsibility of the user to delete after use.
The configuration file lists the fields and their initial values. The first non-comment line is the header for the configuration. Hashed lines indicate comments.
Example of a bpmconf file:
# Header - libbpm version, number of BPMs 0.1 21
# Here are the BPM definitions themselves. Add whichever you want though the # ** fields are required. # Everything else will be set to -DBL_MAX bpm_x9 # BPM name. Currently not used. { bpm_idx 0 # The index in the created array **
cav_type dipole cav_polarisation horiz cav_phasetype locked cav_freq 2626 # Cavity frequency (in MHz) cav_decaytime 3 # Decay time (microsec) cav_phase 0 cav_iqrotation 0 cav_chargesens 10 cav_possens 10 cav_tiltsens 10
rf_LOfreq 2550
digi_trigtimeoffset 50 digi_freq 100 digi_nbits 14 # Number of bits in the ADC ** digi_nsamples 256 # Number of samples in the ADC ** digi_ampnoise 5 digi_voltageoffset 8192 digi_phasenoise 3
geom_pos 0 0 40 geom_tilt 0 0 0
ref_idx 10 # Refernce index ** diode_idx 10 # Diode index ** }
# etc...
fname | the filename of the configuration file to load | |
conf | the pointer to the newly created set of configurations | |
num_conf | the number of conifgurations loaded |
Definition at line 12 of file load_bpmconf.c.
References bpm_error(), bpm_warning(), diode, dipole, get_header(), horiz, load_struct(), locked, MHz, monopole, randomised, and vert.
EXTERN int get_header | ( | FILE * | file, | |
double * | version, | |||
int * | num_structs | |||
) |
Load in the header information from a configuration file. The header must have the bpm version followed by the number of entries. Comments are denoted by #
Example of the header:
# Header - libbpm version, number of BPMs 0.1 21
file | A FILE pointer to the stream to load from | |
version | Pointer to a double that is filled with the version number | |
num_structs | Pointer to an integer that is filled with the number of structs in the file |
Definition at line 9 of file get_header.c.
References bpm_error().
Referenced by load_bpmconf(), and load_signals().
EXTERN int load_struct | ( | FILE * | file, | |
char *** | arg_list, | |||
char *** | val_list, | |||
int * | num_args | |||
) |
Load in a structure from a file and return the arguments and the values in a list. Comments are denoted by #
Example of a structure:
# Describe x9 using a bpmconf struture x9
file | A FILE pointer to the stream to load from | |
arg_list | Pointer to an array of names that will hold the arguments | |
val_list | Pointer to an array of the values for each field specfied in arg_list | |
num_args | Pointer to an integer that will hold the number of arguments found |
Definition at line 11 of file load_struct.c.
References bpm_error(), and MAX_ARGS.
Referenced by load_bpmconf().
EXTERN int save_signals | ( | char * | fname, | |
bpmsignal_t * | sigs, | |||
int | num_evts | |||
) |
Save a set of waveforms
fname | The filename to save to | |
sigs | The bpmsignal structures to save | |
num_evts | The number of events |
Definition at line 10 of file save_signals.c.
References bpm_error(), and bpmsignal::ns.
EXTERN int load_signals | ( | char * | fname, | |
bpmsignal_t ** | sigs | |||
) |
Load the specified number of events from the given file
fname | The filename to load from | |
sigs | The bpmsignal structures |
Definition at line 10 of file load_signals.c.
References bpm_error(), bpm_warning(), and get_header().
EXTERN int bpm_verbose |