Low-Energy Muon (LEM) Experiment
0.5.2
|
#include <linux/version.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#include "midas.h"
#include "mfe.h"
#include "mcstd.h"
#include "sis3820.h"
#include "v1190.h"
#include "sis3100_vme_calls.h"
#include "experim.h"
#include "nemu_experim.h"
Go to the source code of this file.
Data Structures | |
struct | TDC_EVAL_EVENT |
struct | TDC_PILEUP |
Macros | |
#define | SIS3820_ADDRESS_0 0x38000000 |
Local definitions to connect to VME module. More... | |
#define | SIS3820_ADDRESS_1 0x39000000 |
VME address of 2nd scaler module. More... | |
#define | V1190_ADDRESS 0xEE000000 |
the VME address of the CAEN V1190 TDC More... | |
#define | MAX_NUMBER_LWORDS 1024 |
max number of block data transfer */ More... | |
#define | ALMOST_FULL_LEVEL 1024 |
#define | DATABUFFER_SIZE 131072 |
set size of FiFo (ring) buffer, 2^17 More... | |
#define | DIFF_TOLERANCE -12200 |
#define | TD_EVENT (1<<0) |
Event flags. More... | |
#define | LE_POSITRON_EVENT (1<<1) |
#define | M2_EVENT (1<<2) |
#define | BC_EVENT (1<<3) |
#define | M1_EVENT (1<<4) |
#define | M1_POSITRON_EVENT (1<<5) |
#define | MASTERLAST 1 |
timing flags More... | |
#define | MASTERFIRST 2 |
#define | BINNING 0.1953125 |
Functions | |
INT | frontend_init () |
INT | frontend_exit () |
INT | begin_of_run (INT run_number, char *error) |
INT | end_of_run (INT run_number, char *error) |
INT | pause_run (INT run_number, char *error) |
INT | resume_run (INT run_number, char *error) |
INT | frontend_loop () |
INT | read_trigger_event (char *pevent, INT off) |
INT | poll_event (INT source, INT count, BOOL test) |
INT | read_scaler_event (char *pevent, INT off) |
INT | read_slowcontrol_event (char *pevent, INT off) |
INT | do_channel (INT ch, INT time) |
INT | do_master_channel (INT ch, INT event_type) |
U_LONG | pileup_end (INT pileupWindow) |
INT | evaluate_slow_muon_event () |
INT | evaluate_fast_muon_event () |
BOOL | check_tof_and_pileup (INT timing, INT tofWindow, INT firstCh, INT lastCh, INT masterChannel, INT masterIndex, INT *channel, INT *ind) |
BOOL | check_positron (INT decWindow, INT coincWindow, INT firstCh, INT lastCh, INT masterChannel, INT masterIndex, INT *channel, INT *ind) |
void | scaler_mode (u_int32_t module_address) |
int | init_sis3820 (u_int32_t module_address) |
int | init_v1190 (u_int32_t module_address) |
void | OnOff_mode () |
INT | interrupt_configure (INT cmd, INT source, PTYPE adr) |
Variables | |
const char * | frontend_name = "VME_FE" |
< created by ODBedit, command "make" More... | |
const char * | frontend_file_name = __FILE__ |
The frontend file name, don't change it. More... | |
BOOL | frontend_call_loop = TRUE |
frontend_loop is called periodically if this variable is TRUE More... | |
INT | display_period = 3000 |
a frontend status page is displayed with this frequency in ms More... | |
INT | max_event_size = 128000 |
maximum event size produced by this frontend More... | |
INT | max_event_size_frag = 5*1024*1024 |
maximum event size for fragmented events (EQ_FRAGMENTED) More... | |
INT | event_buffer_size = 60*10000 |
buffer size to hold events More... | |
TRIGGER_SETTINGS | trigger_settings |
/Equipment/Trigger/Settings More... | |
SCALER_SETTINGS | scaler_settings |
RUNINFO | runinfo |
/Runinfo ODB key, defined in from midas.h More... | |
BEAMLINE_EVENT | beamline_event |
for slow control parameters More... | |
LEMVAC_EVENT | lemvac_event |
MODCRYO_EVENT | moddy_event |
SAMPLECRYO_EVENT | sample_event |
SCS2001M_EVENT | scs2001m_event |
HV_EVENT | hv_event |
HV_DETECTORS_EVENT | hvdet_event |
HV_SETTINGS | hv_settings |
OMEGA_EVENT | omega_event |
INFO | info |
static VME_STATS | vme_stats |
static TDC_EVAL_EVENT | tdc_eval_event |
static TDC_PILEUP | tdc_pileup |
static INT | hdev |
handle for VME-PCI device More... | |
static DWORD * | databuffer |
ring buffer for TDC data More... | |
static DWORD * | p_read |
static DWORD * | p_write |
read and write pointers for data ring buffer More... | |
static DWORD | masterFlagSlowMuon |
use either TD_EVENT or M2_EVENT as slow muon master More... | |
static DWORD | eventDefinedSlowMuon |
bit pattern containing trigger mode for slow muons (BC-TD-M2) More... | |
static DWORD | eventDefinedFastMuon |
bit pattern containing trigger mode for fast muons (BC-M1) More... | |
static DWORD | masterChannelSlowMuon |
"master" TDC channel for slow muons (TD or M2) More... | |
static DWORD | masterChannelFastMuon |
"master" TDC channel for BC-M1 (usually M1) More... | |
static U_LONG | runTime |
absolute run time in TDC LSB units More... | |
static U_LONG | nextGoodTime |
absolute run time when new events are accepted (for on/off mode) More... | |
static DWORD | dataWindowFastMuon |
static DWORD | dataWindowSlowMuon |
static INT | t0_offset |
static BOOL | flag_external_on |
flag to indicate "on/off", "red/green" mode More... | |
static BOOL | flag_scaler_address_0 |
static BOOL | flag_scaler_address_1 |
flags to indicate status of VME scalers More... | |
INT | mode |
scaler mode, see scaler_mode() More... | |
static struct timeval | tvLastTime |
static BOOL | flag_on_puls |
flag to indicate that "puls" was turned on, "on/off" or "red/green" mode More... | |
BOOL | equipment_common_overwrite = FALSE |
EQUIPMENT | equipment [] |
#define ALMOST_FULL_LEVEL 1024 |
Definition at line 221 of file vme_fe.cxx.
Referenced by init_v1190().
#define BC_EVENT (1<<3) |
Definition at line 229 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_fast_muon_event(), evaluate_slow_muon_event(), and frontend_loop().
#define BINNING 0.1953125 |
Referenced by frontend_loop().
#define DATABUFFER_SIZE 131072 |
set size of FiFo (ring) buffer, 2^17
Definition at line 222 of file vme_fe.cxx.
Referenced by evaluate_fast_muon_event(), evaluate_slow_muon_event(), frontend_init(), and read_trigger_event().
#define DIFF_TOLERANCE -12200 |
this is the allowed TDC time difference to the preceding event 12200 ~ 524288 - 512000 (2^19-1/10kHz)
Definition at line 223 of file vme_fe.cxx.
Referenced by do_channel().
#define LE_POSITRON_EVENT (1<<1) |
Definition at line 227 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), and frontend_loop().
#define M1_EVENT (1<<4) |
Definition at line 230 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_fast_muon_event(), and frontend_loop().
#define M1_POSITRON_EVENT (1<<5) |
Definition at line 231 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_fast_muon_event(), and frontend_loop().
#define M2_EVENT (1<<2) |
Definition at line 228 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), and frontend_loop().
#define MASTERFIRST 2 |
Definition at line 235 of file vme_fe.cxx.
Referenced by evaluate_fast_muon_event(), and evaluate_slow_muon_event().
#define MASTERLAST 1 |
timing flags
Definition at line 234 of file vme_fe.cxx.
Referenced by check_tof_and_pileup(), and evaluate_slow_muon_event().
#define MAX_NUMBER_LWORDS 1024 |
max number of block data transfer */
Definition at line 220 of file vme_fe.cxx.
Referenced by frontend_loop().
#define SIS3820_ADDRESS_0 0x38000000 |
Local definitions to connect to VME module.
VME address of 1st scaler module
Definition at line 217 of file vme_fe.cxx.
Referenced by begin_of_run(), frontend_exit(), frontend_init(), read_scaler_event(), and resume_run().
#define SIS3820_ADDRESS_1 0x39000000 |
VME address of 2nd scaler module.
Definition at line 218 of file vme_fe.cxx.
Referenced by begin_of_run(), frontend_exit(), frontend_init(), read_scaler_event(), and resume_run().
#define TD_EVENT (1<<0) |
Event flags.
Definition at line 226 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), and frontend_loop().
#define V1190_ADDRESS 0xEE000000 |
the VME address of the CAEN V1190 TDC
Definition at line 219 of file vme_fe.cxx.
Referenced by begin_of_run(), end_of_run(), frontend_init(), frontend_loop(), and resume_run().
INT begin_of_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 597 of file vme_fe.cxx.
References BC_EVENT, BCL1, BCL2, BCL3, BCL4, BCR1, BCR2, BCR3, BCR4, TRIGGER_SETTINGS::beamcounter_active, CLOCK, TRIGGER_SETTINGS::data_window, databuffer, dataWindowFastMuon, dataWindowSlowMuon, TRIGGER_SETTINGS::enable_onoff_mode, TRIGGER_SETTINGS::event_0_active, TRIGGER_SETTINGS::event_0_settings, TRIGGER_SETTINGS::event_1_active, TRIGGER_SETTINGS::event_1_settings, TRIGGER_SETTINGS::event_2_active, TRIGGER_SETTINGS::event_2_settings, eventDefinedFastMuon, eventDefinedSlowMuon, TRIGGER_SETTINGS::events, EXTOFF1, EXTON1, flag_external_on, flag_on_puls, flag_scaler_address_0, flag_scaler_address_1, hdev, VME_STATS::last_TDCtime, LE_POSITRON_EVENT, M1_EVENT, M1_POSITRON_EVENT, M2_EVENT, masterChannelFastMuon, masterChannelSlowMuon, masterFlagSlowMuon, MCP1, TRIGGER_SETTINGS::mcp2_active, MCP2F, MCP2R, MCP2X1, MCP2X2, MCP2Y1, MCP2Y2, N_TDC_CHANNELS, nextGoodTime, p_read, p_write, POSBDI, POSBDO, POSBUI, POSBUO, TRIGGER_SETTINGS::positrons_active, POSLDI, POSLDO, POSLUI, POSLUO, POSMCP1I, POSMCP1O, POSRDI, POSRDO, POSRUI, POSRUO, POSTDI, POSTDO, POSTUI, POSTUO, runTime, scaler_mode(), SIS3820_ADDRESS_0, SIS3820_ADDRESS_1, sis3820_key_disable(), sis3820_key_enable(), sis3820_key_reset(), t0_offset, TRIGGER_SETTINGS::t0_offset, TD, TRIGGER_SETTINGS::td_active, TD_EVENT, TRIGGER_SETTINGS::td_master, V1190_ADDRESS, V1190_OPCODE_ADDRESS, and V1190_SOFTWARE_CLEAR.
BOOL check_positron | ( | INT | decWindow, |
INT | coincWindow, | ||
INT | firstCh, | ||
INT | lastCh, | ||
INT | masterChannel, | ||
INT | masterIndex, | ||
INT * | channel, | ||
INT * | ind | ||
) |
check_positron(decWindow, coincWindow, firstCh, lastCh, masterchannel, channel, ind):
check events: is there a e+ (coincidence) signal in the decWindow relative to masterChannel? find the nearest e+ event with respect to the masterChannel[0] event. if coincWindow < 0: single e+ counters are considered if coincWindow >=0: look for coincidences between the two channels firstCh and lastCh N O T E: post- pileup checking for positrons; this data will be written to the Midas event
Definition at line 2026 of file vme_fe.cxx.
References TDC_EVAL_EVENT::foundChannel, masterChannel, and TDC_EVAL_EVENT::tdc_event.
Referenced by evaluate_fast_muon_event(), and evaluate_slow_muon_event().
BOOL check_tof_and_pileup | ( | INT | timing, |
INT | tofWindow, | ||
INT | firstCh, | ||
INT | lastCh, | ||
INT | masterChannel, | ||
INT | masterIndex, | ||
INT * | channel, | ||
INT * | ind | ||
) |
check_tof_and_pileup():
check events: is there a signal in the tofWIndow relative to masteChannel? if yes: check if hit is "clean", i.e. there was no other signal within pileupWindow
N O T E: this function only checks the pre-pileup for "TOF" and "Decay" hits, i.e. BC and e+ hits. The pre-pileup for the master channels is implicitly done in the loop over the TDC output buffer (currently done in frontend_loop()) where it is required that two starts of master channel events are separated by at least diffTimeSlowMuon or diffTimeFastMuon (which is 10musec at the moment).
Definition at line 1958 of file vme_fe.cxx.
References TDC_EVAL_EVENT::foundChannel, masterChannel, MASTERLAST, TDC_EVAL_EVENT::pileup, and TDC_EVAL_EVENT::tdc_event.
Referenced by evaluate_fast_muon_event(), and evaluate_slow_muon_event().
INT do_channel | ( | INT | ch, |
INT | TDCtime | ||
) |
update channel statistics, copy TDC times in temporary buffer tdc_event[ch][index] to be used in evaluate_event():
Definition at line 1333 of file vme_fe.cxx.
References DIFF_TOLERANCE, TDC_EVAL_EVENT::event_time, TDC_EVAL_EVENT::foundChannel, VME_STATS::last_TDCtime, VME_STATS::run_time, runTime, TDC_EVAL_EVENT::set_t0, t0_offset, TDC_BIT_RANGE, TDC_EVAL_EVENT::tdc_event, TDC_EVAL_EVENT::thisTimeFastMuon, and TDC_EVAL_EVENT::thisTimeSlowMuon.
Referenced by frontend_loop().
INT do_master_channel | ( | INT | ch, |
INT | event_type | ||
) |
Definition at line 1368 of file vme_fe.cxx.
References dataWindowFastMuon, dataWindowSlowMuon, TDC_EVAL_EVENT::doEvaluateFastMuonEvent, TDC_EVAL_EVENT::doEvaluateSlowMuonEvent, TDC_PILEUP::endMasterEvent0, TDC_PILEUP::endMasterEvent1or2, EVENT_0_TYPE, EVENT_1_TYPE, EVENT_2_TYPE, eventDefinedFastMuon, eventDefinedSlowMuon, TDC_EVAL_EVENT::foundChannel, TDC_EVAL_EVENT::indexFastMuon, TDC_EVAL_EVENT::indexFastMuonSet, TDC_EVAL_EVENT::indexSlowMuon, TDC_EVAL_EVENT::indexSlowMuonSet, TDC_PILEUP::lastMasterEvent0Pileup, TDC_PILEUP::lastMasterEvent1or2Pileup, TDC_EVAL_EVENT::lastTimeFastMuon, TDC_EVAL_EVENT::lastTimeSlowMuon, VME_STATS::mcp1_clean, VME_STATS::mcp1_good, VME_STATS::mcp2_clean, VME_STATS::mcp2_good, MCP2F, TDC_EVAL_EVENT::pileup, pileup_end(), runTime, TD, VME_STATS::td_clean, VME_STATS::td_good, TDC_EVAL_EVENT::thisTimeFastMuon, and TDC_EVAL_EVENT::thisTimeSlowMuon.
Referenced by frontend_loop().
INT end_of_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 865 of file vme_fe.cxx.
References VME_STATS::channelCounts, VME_STATS::fastMuonEvents, hdev, p_read, p_write, VME_STATS::readcounts, VME_STATS::run_time, VME_STATS::slowMuonEvents, TRIGGER_SETTINGS::tdc_disable_atstartup, VME_STATS::tdc_error_counts, V1190_ADDRESS, V1190_DISABLE_ALL_CHANNEL, and V1190_OPCODE_ADDRESS.
INT evaluate_fast_muon_event | ( | ) |
check events, if trigger condition is met, build events, move them to ring buffer which is read in the read_trigger_event() function
Definition at line 1809 of file vme_fe.cxx.
References BC_EVENT, BCL1, BCL2, BCL3, BCL4, BCR1, BCR2, BCR3, BCR4, LEM_DATA::channel, VME_STATS::channelCounts, check_positron(), check_tof_and_pileup(), LEM_DATA::data, DATA_N_HITS, TRIGGER_SETTINGS::data_window, databuffer, DATABUFFER_SIZE, TRIGGER_SETTINGS::event_0_settings, EVENT_0_TYPE, eventDefinedFastMuon, TDC_EVAL_EVENT::eventSize, VME_STATS::fastMuonEvents, TDC_EVAL_EVENT::foundChannel, TDC_EVAL_EVENT::indexFastMuon, M1_EVENT, M1_POSITRON_EVENT, masterChannelFastMuon, MASTERFIRST, MCP1, VME_STATS::mcp1_clean, N_TDC_CHANNELS, NEW_EVENT_MASK, p_write, POSMCP1I, POSMCP1O, TDC_EVAL_EVENT::tdc_data, TDC_EVAL_EVENT::tdc_event, TRIGGER_SETTINGS::tof_bc_pileup_window, and TRIGGER_SETTINGS::tof_bc_window.
Referenced by frontend_loop().
INT evaluate_slow_muon_event | ( | ) |
check events, if trigger condition is met, build events, move them to ring buffer which is read in the read_trigger_event() function
Definition at line 1486 of file vme_fe.cxx.
References BC_EVENT, LEM_DATA::channel, VME_STATS::channelCounts, check_positron(), check_tof_and_pileup(), CLOCK, LEM_DATA::data, DATA_N_HITS, TRIGGER_SETTINGS::data_window, databuffer, DATABUFFER_SIZE, TRIGGER_SETTINGS::enable_onoff_mode, TRIGGER_SETTINGS::event_1_active, TRIGGER_SETTINGS::event_1_settings, EVENT_1_TYPE, TRIGGER_SETTINGS::event_2_settings, EVENT_2_TYPE, TDC_EVAL_EVENT::event_time, eventDefinedSlowMuon, TRIGGER_SETTINGS::events, TDC_EVAL_EVENT::eventSize, TDC_EVAL_EVENT::eventType, EXTOFF1_FLAG, EXTON1_FLAG, flag_external_on, TDC_EVAL_EVENT::foundChannel, TDC_EVAL_EVENT::indexSlowMuon, LE_POSITRON_EVENT, M2_EVENT, masterChannelSlowMuon, MASTERFIRST, MASTERLAST, VME_STATS::mcp2_clean, MCP2F, MCP2R, MCP2X1, MCP2X2, MCP2Y1, MCP2Y2, N_TDC_CHANNELS, NEW_EVENT_MASK, nextGoodTime, p_write, POSBDI, POSBDO, POSBUI, POSBUO, POSLDI, POSLDO, POSLUI, POSLUO, POSRDI, POSRDO, POSRUI, POSRUO, POSTDI, POSTDO, POSTUI, POSTUO, runTime, VME_STATS::slowMuonEvents, TD, VME_STATS::td_clean, TD_EVENT, TDC_EVAL_EVENT::tdc_data, TDC_EVAL_EVENT::tdc_event, and TRIGGER_SETTINGS::tof_m2_window.
Referenced by frontend_loop().
INT frontend_exit | ( | ) |
Definition at line 565 of file vme_fe.cxx.
References databuffer, flag_scaler_address_0, flag_scaler_address_1, hdev, SIS3820_ADDRESS_0, SIS3820_ADDRESS_1, and sis3820_key_reset().
INT frontend_init | ( | ) |
create hot links to ODB structures
to save selected slow control parameter
Definition at line 429 of file vme_fe.cxx.
References BEAMLINE_EVENT_STR, BEAMLINE_SETTINGS_STR, databuffer, DATABUFFER_SIZE, eventDefinedFastMuon, eventDefinedSlowMuon, EXP_PARAM_STR, flag_external_on, flag_on_puls, flag_scaler_address_0, flag_scaler_address_1, hDB, hdev, HV_DETECTORS_EVENT_STR, HV_DETECTORS_SETTINGS_STR, HV_EVENT_STR, HV_SETTINGS_STR, init_sis3820(), init_v1190(), LEMVAC_EVENT_STR, LEMVAC_SETTINGS_STR, MODCRYO_EVENT_STR, MODCRYO_SETTINGS_STR, p_read, p_write, runinfo, SAMPLECRYO_EVENT_STR, SAMPLECRYO_SETTINGS_STR, SCALER_SETTINGS_STR, SCS2001M_EVENT_STR, SCS2001M_SETTINGS_STR, SIS3820_ADDRESS_0, SIS3820_ADDRESS_1, TRIGGER_SETTINGS_STR, tvLastTime, V1190_ADDRESS, and VME_STATS_STR.
INT frontend_loop | ( | ) |
frontend_loop() is called whenever the frontend is idle or once between every event if the variable frontend_call_loop = true in the frontend code. This means that the frontend has to be re-compiled if one wants to use frontend_loop().
It performs the readout of the V1190 TDC and builds the events to be sent in read_trigger_event();
A 10kHz clock is used to check if hits belong to one TDC cycle of 100musec. Events may look like
1-1-1-4-1-1 = clock-clock-clock-TD-clock-clock –> no valid events 1-4-4-1-1 = clock-TD-TD-clock-clock –> no valid event 1-26-27-30-29-28-31-1 = clock-M2F-M2R-Y1-X2-X1-Y2 –> no valid event, TD missing 4-26-27-28-29-30-31-1 –> valid event 4-4-26-27-28-29-30-31-1 –> valid event 4-26-27-28-29-30-31-26-27-28-29-30-31-4 –> valid event, pileup times are sent with data buffer
Read complete TDC output buffer of 32k events. At low rates a VME bus error (return code = 0x211) indicates the end of data. This stops reading data from the TDC. At high rates (MHz) this does not work anymore since there are always data present in the output buffer. In this case a TDC TDC error may occur (bit 29 is set) that can be used to tag the start of new data.
Definition at line 957 of file vme_fe.cxx.
References VME_STATS::bc_clean, BC_EVENT, TRIGGER_SETTINGS::bc_rate, BCL1, BCL2, BCL3, BCL4, BCR1, BCR2, BCR3, BCR4, BINNING, V1190_DATA::buffer, V1190_DATA::channel, VME_STATS::channelCounts, CLOCK, TDC_EVAL_EVENT::clockIndex, V1190_DATA::data, dataWindowFastMuon, dataWindowSlowMuon, TRIGGER_SETTINGS::delay_daq_usec_, do_channel(), do_master_channel(), TDC_EVAL_EVENT::doEvaluateFastMuonEvent, TDC_EVAL_EVENT::doEvaluateSlowMuonEvent, TRIGGER_SETTINGS::enable_onoff_mode, TDC_PILEUP::endBeamCounterEvent, evaluate_fast_muon_event(), evaluate_slow_muon_event(), TRIGGER_SETTINGS::event_0_settings, EVENT_0_TYPE, TRIGGER_SETTINGS::event_1_active, TRIGGER_SETTINGS::event_1_settings, EVENT_1_TYPE, TRIGGER_SETTINGS::event_2_active, TRIGGER_SETTINGS::event_2_settings, EVENT_2_TYPE, TDC_EVAL_EVENT::event_time, eventDefinedFastMuon, eventDefinedSlowMuon, TRIGGER_SETTINGS::events, EXTOFF1, EXTON1, flag_external_on, TDC_EVAL_EVENT::foundChannel, VME_STATS::frontend_loop_counts, VME_STATS::frontend_loop_readtdc, hdev, VME_STATS::last_TDCtime, TDC_PILEUP::lastBeamCounterEventPileup, TDC_EVAL_EVENT::lastTimeFastMuon, TDC_EVAL_EVENT::lastTimeSlowMuon, LE_POSITRON_EVENT, M1_EVENT, M1_POSITRON_EVENT, M2_EVENT, TRIGGER_SETTINGS::master_delay, masterChannelFastMuon, masterChannelSlowMuon, MAX_NUMBER_LWORDS, MCP1, TRIGGER_SETTINGS::mcp1_delay, TRIGGER_SETTINGS::mcp1_rate, MCP2F, MCP2R, MCP2X1, MCP2X2, MCP2Y1, MCP2Y2, N_HITS, nextGoodTime, OnOff_mode(), TDC_EVAL_EVENT::pileup, pileup_end(), POSBDI, POSBDO, POSBUI, POSBUO, TRIGGER_SETTINGS::positron_delay, POSLDI, POSLDO, POSLUI, POSLUO, POSMCP1I, POSMCP1O, POSRDI, POSRDO, POSRUI, POSRUO, POSTDI, POSTDO, POSTUI, POSTUO, rate, VME_STATS::run_time, runinfo, runTime, TRIGGER_SETTINGS::simulation_flag, t0_offset, TD, TRIGGER_SETTINGS::td_delay, TD_EVENT, TDC_BIT_RANGE, VME_STATS::tdc_error_counts, TDC_EVAL_EVENT::tdc_event, TDC_EVAL_EVENT::thisTimeFastMuon, TDC_EVAL_EVENT::thisTimeSlowMuon, TRIGGER_SETTINGS::tof_bc_pileup_window, TRIGGER_SETTINGS::tof_bc_window, V1190_ADDRESS, V1190_ALMFULL_BIT, V1190_OUTPUT_BUFFER_SIZE, and V1190_STATUS_REGISTER.
int init_sis3820 | ( | u_int32_t | module_address | ) |
init_sis3820 is called during frontend_init for hardware initialization.
Return:
Definition at line 2452 of file vme_fe.cxx.
References hdev, mode, sis3820_control_read(), sis3820_key_enable(), sis3820_key_reset(), sis3820_modid_read(), and sis3820_operation_mode_read().
Referenced by frontend_init().
int init_v1190 | ( | u_int32_t | module_address | ) |
Definition at line 2503 of file vme_fe.cxx.
References ALMOST_FULL_LEVEL, hdev, TRIGGER_SETTINGS::tdc_disable_atstartup, V1190_ALMOST_FULL_LEVEL, V1190_CONT_STOR, V1190_CONTROL_REGISTER, V1190_DISABLE_ALL_CHANNEL, V1190_EDGE_LEADING_MODE, V1190_LSB_200PS, V1190_MODULE_RESET, V1190_OPCODE_ADDRESS, V1190_SET_DETECTION, V1190_SET_TR_LEAD_LSB, and V1190_STATUS_REGISTER.
Referenced by frontend_init().
INT interrupt_configure | ( | INT | cmd, |
INT | source, | ||
PTYPE | adr | ||
) |
Definition at line 2105 of file vme_fe.cxx.
void OnOff_mode | ( | ) |
Definition at line 2593 of file vme_fe.cxx.
References TRIGGER_SETTINGS::delay_offpuls_usec_, flag_on_puls, hdev, TRIGGER_SETTINGS::period_onpuls_usec_, and tvLastTime.
Referenced by frontend_loop().
INT pause_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 893 of file vme_fe.cxx.
U_LONG pileup_end | ( | INT | pileupWindow | ) |
calculate the end of pileup gate in absolute run time (in TDC LSB units)
Definition at line 1471 of file vme_fe.cxx.
References runTime.
Referenced by do_master_channel(), and frontend_loop().
INT poll_event | ( | INT | source, |
INT | count, | ||
BOOL | test | ||
) |
Definition at line 2088 of file vme_fe.cxx.
References p_read, p_write, and VME_STATS::poll_counts.
INT read_scaler_event | ( | char * | pevent, |
INT | off | ||
) |
Read out of scaler modules.
If HAVE_TEST_RUN is defined scaler entries of about 100 are thrown. If not defined use the function sis3820_read_scaler to read out the VME scaler module.
Return:
Definition at line 2207 of file vme_fe.cxx.
References A32BLT32, flag_scaler_address_0, flag_scaler_address_1, hdev, SCALER_SETTINGS::input_mode_3, N_SCALER, N_SCALER_MODULE, SIS3820_ADDRESS_0, SIS3820_ADDRESS_1, and sis3820_scaler_read().
INT read_slowcontrol_event | ( | char * | pevent, |
INT | off | ||
) |
Read slow control parameters from ODB.
Definition at line 2278 of file vme_fe.cxx.
References MICROWAVE_LOG::ana_pico_set_frequency, MICROWAVE_LOG::ana_pico_set_power, MICROWAVE_LOG::ana_pico_timestamp, BEAMLINE_EVENT::demand, MODCRYO_EVENT::input, SAMPLECRYO_EVENT::input, LEMVAC_EVENT::input, SCS2001M_EVENT::input, OMEGA_EVENT::input, MICROWAVE_LOG::keysight_u2002a_measured_power, MICROWAVE_LOG::keysight_u2002a_timestamp, MICROWAVE_LOG::keysight_u8481a_measured_power, MICROWAVE_LOG::keysight_u8481a_timestamp, BEAMLINE_EVENT::measured, HV_EVENT::measured, HV_DETECTORS_EVENT::measured, INFO::microwave_log, MICROWAVE_LOG::pressure_1, MICROWAVE_LOG::pressure_2, MICROWAVE_LOG::pressure_3, INFO::sample_cryo, MICROWAVE_LOG::tektronix_set_frequency, MICROWAVE_LOG::tektronix_set_power, and MICROWAVE_LOG::tektronix_timestamp.
INT read_trigger_event | ( | char * | pevent, |
INT | off | ||
) |
read_trigger_event() is the event read out function to get the V1190 TDC data.
Definition at line 2129 of file vme_fe.cxx.
References databuffer, DATABUFFER_SIZE, NEW_EVENT_MASK, p_read, and VME_STATS::readcounts.
INT resume_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 900 of file vme_fe.cxx.
References flag_scaler_address_0, flag_scaler_address_1, hdev, SIS3820_ADDRESS_0, SIS3820_ADDRESS_1, sis3820_key_disable(), sis3820_key_enable(), sis3820_key_reset(), V1190_ADDRESS, and V1190_SOFTWARE_CLEAR.
void scaler_mode | ( | u_int32_t | module_address | ) |
scaler_mode is called at begin_of_run. It reads the ODB record /Equipment/Scaler/Settings and checks if the variable scaler_settings.input_mode_3 is set. If yes the SIS3820 will be set to
SIS3820_CONTROL_INPUT_MODE3 + SIS3820_SCALER_DATA_FORMAT_24BIT
otherwise it will be set to
SIS3820_CONTROL_INPUT_MODE0 + SIS3820_SCALER_DATA_FORMAT_32BIT
No interrupt handling at the moment.
Definition at line 2383 of file vme_fe.cxx.
References CTRL_REFERENCE_CH1_DISABLE, CTRL_REFERENCE_CH1_ENABLE, hDB, hdev, SCALER_SETTINGS::input_mode_3, SCALER_SETTINGS::reference_ch1, scaler_settings, SIS3820_CONTROL_INPUT_MODE0, SIS3820_CONTROL_INPUT_MODE3, sis3820_control_read(), sis3820_control_write(), sis3820_operation_mode_read(), sis3820_operation_mode_write(), SIS3820_SCALER_DATA_FORMAT_24BIT, and SIS3820_SCALER_DATA_FORMAT_32BIT.
Referenced by begin_of_run().
BEAMLINE_EVENT beamline_event |
for slow control parameters
Definition at line 204 of file vme_fe.cxx.
|
static |
ring buffer for TDC data
Definition at line 277 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_fast_muon_event(), evaluate_slow_muon_event(), frontend_exit(), frontend_init(), and read_trigger_event().
|
static |
Definition at line 286 of file vme_fe.cxx.
Referenced by begin_of_run(), do_master_channel(), and frontend_loop().
|
static |
Definition at line 286 of file vme_fe.cxx.
Referenced by begin_of_run(), do_master_channel(), and frontend_loop().
INT display_period = 3000 |
a frontend status page is displayed with this frequency in ms
Definition at line 176 of file vme_fe.cxx.
EQUIPMENT equipment[] |
Definition at line 343 of file vme_fe.cxx.
BOOL equipment_common_overwrite = FALSE |
equipment_common_overwrite:
Definition at line 341 of file vme_fe.cxx.
INT event_buffer_size = 60*10000 |
buffer size to hold events
Definition at line 185 of file vme_fe.cxx.
|
static |
bit pattern containing trigger mode for fast muons (BC-M1)
Definition at line 281 of file vme_fe.cxx.
Referenced by begin_of_run(), do_master_channel(), evaluate_fast_muon_event(), frontend_init(), and frontend_loop().
|
static |
bit pattern containing trigger mode for slow muons (BC-TD-M2)
Definition at line 280 of file vme_fe.cxx.
Referenced by begin_of_run(), do_master_channel(), evaluate_slow_muon_event(), frontend_init(), and frontend_loop().
|
static |
flag to indicate "on/off", "red/green" mode
Definition at line 288 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), frontend_init(), and frontend_loop().
|
static |
flag to indicate that "puls" was turned on, "on/off" or "red/green" mode
Definition at line 292 of file vme_fe.cxx.
Referenced by begin_of_run(), frontend_init(), and OnOff_mode().
|
static |
Definition at line 289 of file vme_fe.cxx.
Referenced by begin_of_run(), frontend_exit(), frontend_init(), read_scaler_event(), and resume_run().
|
static |
flags to indicate status of VME scalers
Definition at line 289 of file vme_fe.cxx.
Referenced by begin_of_run(), frontend_exit(), frontend_init(), read_scaler_event(), and resume_run().
BOOL frontend_call_loop = TRUE |
frontend_loop is called periodically if this variable is TRUE
Definition at line 173 of file vme_fe.cxx.
const char* frontend_file_name = __FILE__ |
The frontend file name, don't change it.
Definition at line 170 of file vme_fe.cxx.
const char* frontend_name = "VME_FE" |
< created by ODBedit, command "make"
experiment specific ODB structuresexperiment specific definition for frontend and analyzer The frontend name (client name) as seen by other MIDAS clients
Definition at line 167 of file vme_fe.cxx.
|
static |
handle for VME-PCI device
Definition at line 276 of file vme_fe.cxx.
Referenced by begin_of_run(), end_of_run(), frontend_exit(), frontend_init(), frontend_loop(), init_sis3820(), init_v1190(), OnOff_mode(), read_scaler_event(), resume_run(), and scaler_mode().
HV_EVENT hv_event |
Definition at line 209 of file vme_fe.cxx.
HV_SETTINGS hv_settings |
Definition at line 211 of file vme_fe.cxx.
HV_DETECTORS_EVENT hvdet_event |
Definition at line 210 of file vme_fe.cxx.
INFO info |
Definition at line 213 of file vme_fe.cxx.
LEMVAC_EVENT lemvac_event |
Definition at line 205 of file vme_fe.cxx.
|
static |
"master" TDC channel for BC-M1 (usually M1)
Definition at line 283 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_fast_muon_event(), and frontend_loop().
|
static |
"master" TDC channel for slow muons (TD or M2)
Definition at line 282 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), and frontend_loop().
|
static |
use either TD_EVENT or M2_EVENT as slow muon master
Definition at line 279 of file vme_fe.cxx.
Referenced by begin_of_run().
INT max_event_size = 128000 |
maximum event size produced by this frontend
Definition at line 179 of file vme_fe.cxx.
INT max_event_size_frag = 5*1024*1024 |
maximum event size for fragmented events (EQ_FRAGMENTED)
Definition at line 182 of file vme_fe.cxx.
MODCRYO_EVENT moddy_event |
Definition at line 206 of file vme_fe.cxx.
INT mode |
scaler mode, see scaler_mode()
Definition at line 290 of file vme_fe.cxx.
Referenced by init_sis3820().
|
static |
absolute run time when new events are accepted (for on/off mode)
Definition at line 285 of file vme_fe.cxx.
Referenced by begin_of_run(), evaluate_slow_muon_event(), and frontend_loop().
OMEGA_EVENT omega_event |
Definition at line 212 of file vme_fe.cxx.
|
static |
Definition at line 278 of file vme_fe.cxx.
Referenced by begin_of_run(), end_of_run(), frontend_init(), poll_event(), and read_trigger_event().
|
static |
read and write pointers for data ring buffer
Definition at line 278 of file vme_fe.cxx.
Referenced by begin_of_run(), end_of_run(), evaluate_fast_muon_event(), evaluate_slow_muon_event(), frontend_init(), and poll_event().
RUNINFO runinfo |
/Runinfo ODB key, defined in from midas.h
Not defined in experim.h:
Definition at line 201 of file vme_fe.cxx.
|
static |
absolute run time in TDC LSB units
Definition at line 284 of file vme_fe.cxx.
Referenced by begin_of_run(), do_channel(), do_master_channel(), evaluate_slow_muon_event(), frontend_loop(), and pileup_end().
SAMPLECRYO_EVENT sample_event |
Definition at line 207 of file vme_fe.cxx.
SCALER_SETTINGS scaler_settings |
/Equipment/Scaler/Settings/
Definition at line 197 of file vme_fe.cxx.
SCS2001M_EVENT scs2001m_event |
Definition at line 208 of file vme_fe.cxx.
|
static |
Definition at line 287 of file vme_fe.cxx.
Referenced by begin_of_run(), do_channel(), and frontend_loop().
|
static |
Definition at line 274 of file vme_fe.cxx.
|
static |
Definition at line 275 of file vme_fe.cxx.
TRIGGER_SETTINGS trigger_settings |
/Equipment/Trigger/Settings
The following structures are defined in experim.h that is created by entering 'make' in ODBedit.
ODB record values can be easily accessed by db_open_record which creates a hot-link to the structure; structure_name.keyvalue
Definition at line 196 of file vme_fe.cxx.
|
static |
Definition at line 291 of file vme_fe.cxx.
Referenced by frontend_init(), and OnOff_mode().
|
static |
Definition at line 273 of file vme_fe.cxx.