Low-Energy Muon (LEM) Experiment
0.5.2
|
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include "midas.h"
#include "mfe.h"
#include "class/hv.h"
#include "hv_nhr.h"
#include "hvr400.h"
#include "hv_scs2001_apd.h"
#include "hpx30_107.h"
#include "tcpip_rs232.h"
#include "bus/null.h"
Go to the source code of this file.
Macros | |
#define | LEMVAC_GAS_INLET_ON 0x80 |
#define | LEMVAC_MC_STATUS_WORD_2 15 |
#define | LEMVAC_TC_STATUS_WORD_2 18 |
#define | LEMVAC_SC_STATUS_WORD_2 21 |
#define | TD_FIRST_CH 0 |
#define | TD_LAST_CH 3 |
#define | MCP1_CH 4 |
#define | MCP2_FIRST_CH 6 |
#define | MCP2_LAST_CH 7 |
#define | POS_MCP1_I 12 |
#define | POS_MCP1_O 13 |
#define | HV_TD_MAX_COUNT 30 |
#define | HV_DETECTOR_CHANNELS 94 |
#define | HV_DETECTOR_READ_TIME 10 |
Functions | |
INT | poll_event (INT source, INT count, BOOL test) |
INT | interrupt_configure (INT cmd, INT source, POINTER_T adr) |
void | hv_detectors_scfe_gas_inlet (INT hDB, INT hKey, void *dummy) |
void | hv_detectors_scfe_td_check (INT hDB, INT hKey, void *dummy) |
INT | frontend_init () |
INT | frontend_exit () |
INT | frontend_loop () |
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) |
Variables | |
const char * | frontend_name = "HV Detectors" |
The frontend name (client name) as seen by other MIDAS clients. 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 = 1000 |
a frontend status page is displayed with this frequency in ms More... | |
INT | max_event_size = 10000 |
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 = 10*10000 |
buffer size to hold events More... | |
HNDLE | hv_detectors_hDB |
HNDLE | hv_detectors_measured_hKey |
int | hv_detectors_drop_counter [HV_DETECTOR_CHANNELS] |
char | hv_detectors_names [HV_DETECTOR_CHANNELS *NAME_LENGTH] |
float | hv_detectors_demand [HV_DETECTOR_CHANNELS] |
float | hv_detectors_measured [HV_DETECTOR_CHANNELS] |
int | hv_td_hv_check_counter |
counter needed in the TD HV check More... | |
INT | hv_monitoring_enabled |
Monitoring enabled (hotlinked) More... | |
INT | hv_hvAlreadyOff |
HV already switched off. More... | |
float | lemvac_in [27] |
holds the status info of lemvac input variables More... | |
DWORD | hv_dectector_timestamp |
cyclic timer to check hv's More... | |
DEVICE_DRIVER | hv_driver [] |
device driver list More... | |
BOOL | equipment_common_overwrite = FALSE |
EQUIPMENT | equipment [] |
equipment structure for the mfe.c More... | |
#define HV_DETECTOR_CHANNELS 94 |
Definition at line 64 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
#define HV_DETECTOR_READ_TIME 10 |
Definition at line 66 of file hv_detectors_scfe.cxx.
Referenced by frontend_loop().
#define HV_TD_MAX_COUNT 30 |
Definition at line 62 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_td_check().
#define LEMVAC_GAS_INLET_ON 0x80 |
Definition at line 50 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define LEMVAC_MC_STATUS_WORD_2 15 |
Definition at line 51 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define LEMVAC_SC_STATUS_WORD_2 21 |
Definition at line 53 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define LEMVAC_TC_STATUS_WORD_2 18 |
Definition at line 52 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define MCP1_CH 4 |
Definition at line 56 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define MCP2_FIRST_CH 6 |
Definition at line 57 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define MCP2_LAST_CH 7 |
Definition at line 58 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
#define POS_MCP1_I 12 |
Definition at line 59 of file hv_detectors_scfe.cxx.
Referenced by frontend_loop().
#define POS_MCP1_O 13 |
Definition at line 60 of file hv_detectors_scfe.cxx.
Referenced by frontend_loop().
#define TD_FIRST_CH 0 |
Definition at line 54 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet(), and hv_detectors_scfe_td_check().
#define TD_LAST_CH 3 |
Definition at line 55 of file hv_detectors_scfe.cxx.
Referenced by hv_detectors_scfe_gas_inlet().
INT begin_of_run | ( | INT | run_number, |
char * | error | ||
) |
Called by the mfe at the begin of the run. Here it is only a dummy.
Definition at line 464 of file hv_detectors_scfe.cxx.
INT end_of_run | ( | INT | run_number, |
char * | error | ||
) |
Called by the mfe at the end of the run. Here it is only a dummy.
Definition at line 474 of file hv_detectors_scfe.cxx.
INT frontend_exit | ( | ) |
Called by the mfe at exiting stage. Unlinks all the established hotlinks.
Definition at line 350 of file hv_detectors_scfe.cxx.
INT frontend_init | ( | ) |
Called by the master frontend (mfe) at initializing stage. It hotlinks various variables which are needed for safety reasons. It monitors for example if the gas inlet is activated, and if yes, shuts down the high voltage of the corresponding chamber. For further details see the corresponding hotlink dispatcher functions.
Definition at line 262 of file hv_detectors_scfe.cxx.
References hDB, hKey, hv_dectector_timestamp, HV_DETECTOR_CHANNELS, hv_detectors_demand, hv_detectors_drop_counter, hv_detectors_hDB, hv_detectors_measured, hv_detectors_measured_hKey, hv_detectors_names, hv_detectors_scfe_gas_inlet(), hv_detectors_scfe_td_check(), hv_hvAlreadyOff, hv_monitoring_enabled, hv_td_hv_check_counter, and lemvac_in.
INT frontend_loop | ( | ) |
Called by the mfe in the main loop, if the frontend_call_loop flag is set to TRUE.
It cyclically reads the measured detector HV's and checks that they are not too strongly are deviating from the demand ones.
Definition at line 396 of file hv_detectors_scfe.cxx.
References hKey, hv_dectector_timestamp, HV_DETECTOR_CHANNELS, HV_DETECTOR_READ_TIME, hv_detectors_demand, hv_detectors_drop_counter, hv_detectors_hDB, hv_detectors_measured, hv_detectors_measured_hKey, hv_detectors_names, offset, POS_MCP1_I, and POS_MCP1_O.
void hv_detectors_scfe_gas_inlet | ( | INT | hDB, |
INT | hKey, | ||
void * | dummy | ||
) |
This hotlink routine sets the values of the hv demand values of the various chamber to zero, if the gas inlet flag of the vacuum control unit (lemvac) is set.
The purpose is the following: the vacuum control unit is switching the hv power supplies power off if the gas inlet is activated. Hence, if the demand values wouldn't be set to zero, after powering the hv power supplies again, the hv would just ramp back to there set values. This could lead to hv problems and therefore these demand values are set to zero.
hDB | main ODB handle |
hKey | unused handle |
dummy | not used |
Definition at line 163 of file hv_detectors_scfe.cxx.
References LEMVAC_GAS_INLET_ON, lemvac_in, LEMVAC_MC_STATUS_WORD_2, LEMVAC_SC_STATUS_WORD_2, LEMVAC_TC_STATUS_WORD_2, MCP1_CH, MCP2_FIRST_CH, MCP2_LAST_CH, TD_FIRST_CH, and TD_LAST_CH.
Referenced by frontend_init().
void hv_detectors_scfe_td_check | ( | INT | hDB, |
INT | hKey, | ||
void * | dummy | ||
) |
hDB | main ODB handle |
hKey | handle to the DB50 sc_status |
dummy | not used |
Definition at line 229 of file hv_detectors_scfe.cxx.
References hv_detectors_measured, hv_td_hv_check_counter, HV_TD_MAX_COUNT, and TD_FIRST_CH.
Referenced by frontend_init().
INT interrupt_configure | ( | INT | cmd, |
INT | source, | ||
POINTER_T | adr | ||
) |
Definition at line 144 of file hv_detectors_scfe.cxx.
INT pause_run | ( | INT | run_number, |
char * | error | ||
) |
Called by the mfe when the run is paused. Here it is only a dummy.
Definition at line 484 of file hv_detectors_scfe.cxx.
INT poll_event | ( | INT | source, |
INT | count, | ||
BOOL | test | ||
) |
Definition at line 143 of file hv_detectors_scfe.cxx.
INT resume_run | ( | INT | run_number, |
char * | error | ||
) |
Called by the mfe when the run is resumed. Here it is only a dummy.
Definition at line 494 of file hv_detectors_scfe.cxx.
INT display_period = 1000 |
a frontend status page is displayed with this frequency in ms
Definition at line 37 of file hv_detectors_scfe.cxx.
EQUIPMENT equipment[] |
equipment structure for the mfe.c
Definition at line 114 of file hv_detectors_scfe.cxx.
BOOL equipment_common_overwrite = FALSE |
equipment_common_overwrite:
Definition at line 111 of file hv_detectors_scfe.cxx.
INT event_buffer_size = 10*10000 |
buffer size to hold events
Definition at line 46 of file hv_detectors_scfe.cxx.
BOOL frontend_call_loop = TRUE |
frontend_loop is called periodically if this variable is TRUE
Definition at line 34 of file hv_detectors_scfe.cxx.
const char* frontend_file_name = __FILE__ |
The frontend file name, don't change it.
Definition at line 31 of file hv_detectors_scfe.cxx.
const char* frontend_name = "HV Detectors" |
The frontend name (client name) as seen by other MIDAS clients.
Definition at line 29 of file hv_detectors_scfe.cxx.
DWORD hv_dectector_timestamp |
cyclic timer to check hv's
Definition at line 84 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
float hv_detectors_demand[HV_DETECTOR_CHANNELS] |
Definition at line 73 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
int hv_detectors_drop_counter[HV_DETECTOR_CHANNELS] |
Definition at line 71 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
HNDLE hv_detectors_hDB |
Definition at line 68 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
float hv_detectors_measured[HV_DETECTOR_CHANNELS] |
Definition at line 74 of file hv_detectors_scfe.cxx.
Referenced by frontend_exit(), frontend_init(), frontend_loop(), and hv_detectors_scfe_td_check().
HNDLE hv_detectors_measured_hKey |
Definition at line 69 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
char hv_detectors_names[HV_DETECTOR_CHANNELS *NAME_LENGTH] |
Definition at line 72 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and frontend_loop().
DEVICE_DRIVER hv_driver[] |
device driver list
Definition at line 89 of file hv_detectors_scfe.cxx.
INT hv_hvAlreadyOff |
HV already switched off.
Definition at line 79 of file hv_detectors_scfe.cxx.
Referenced by frontend_init().
INT hv_monitoring_enabled |
Monitoring enabled (hotlinked)
Definition at line 78 of file hv_detectors_scfe.cxx.
Referenced by frontend_init().
int hv_td_hv_check_counter |
counter needed in the TD HV check
Definition at line 75 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), and hv_detectors_scfe_td_check().
float lemvac_in[27] |
holds the status info of lemvac input variables
Definition at line 82 of file hv_detectors_scfe.cxx.
Referenced by frontend_init(), hv_detectors_scfe_gas_inlet(), and hv_fug_scfe_gas_inlet().
INT max_event_size = 10000 |
maximum event size produced by this frontend
Definition at line 40 of file hv_detectors_scfe.cxx.
INT max_event_size_frag = 5*1024*1024 |
maximum event size for fragmented events (EQ_FRAGMENTED)
Definition at line 43 of file hv_detectors_scfe.cxx.