5 #define ISISCRPT_VERSION 3
14 #define ISISCRPT_MAX_DETECTOR 810000
15 #define ISISCRPT_MAX_DC_DETECTOR 65536
16 #define ISISCRPT_MAX_MONITOR 64
17 #define ISISCRPT_MAX_TIMECHANB 100000
18 #define ISISCRPT_MAX_USER 20
19 #define ISISCRPT_MAX_PERIOD 512
20 #define ISISCRPT_MAX_NTRG 6
21 #define ISISCRPT_MAX_TCR 5
22 #define ISISCRPT_MAX_TCPAR 4
23 #define ISISCRPT_MAX_FNAMELEN 256
24 #define ISISCRPT_MAX_RCSID 40
26 #define ISISCRPT_MAX_DC 35
27 #define ISISCRPT_MAX_NUM_DAE 4
29 #define ISISCRPT_NUM_FC_VETO 4
31 #define ISISCRPT_INST_LEN 16
32 #define ISISCRPT_INST_ABRV_LEN 3
33 #define ISISCRPT_TITLE_LEN 256
34 #define ISISCRPT_SHORT_TITLE_LEN 24
35 #define ISISCRPT_USER_NAME_LEN 80
36 #define ISISCRPT_INSTITUTE_NAME_LEN 80
37 #define ISISCRPT_PERIOD_LABEL_LEN 80
39 #define ICP_NAME_LEN 80
41 #define ISISCRPT_MAX_DATADAE 10
44 #define ISISCRPT_LOG_MAXLINES 20
45 #define ISISCRPT_LOG_LINELEN 80
48 #define RUNSTATUS_PROCESSING 0
49 #define RUNSTATUS_SETUP 1
50 #define RUNSTATUS_RUNNING 2
51 #define RUNSTATUS_PAUSED 3
52 #define RUNSTATUS_WAITING 4
53 #define RUNSTATUS_VETOING 5
54 #define RUNSTATUS_ENDING 6
55 #define RUNSTATUS_SAVING 7
58 "PROCESSING",
"SETUP",
"RUNNING",
"PAUSED",
59 "WAITING",
"VETOING",
"ENDING",
"SAVING"
62 #define SESTATUS_INRANGE 1
63 #define SESTATUS_OUTOFRANGE 0
66 "OUT_OF_RANGE",
"IN_RANGE"
69 extern int spacePadCopy(
char* output,
const char* input,
int output_size);
70 extern int spacePadCopyVa(
char* output,
int output_size,
const char* format, ... );
71 extern int spaceTrimCopy(
char* output,
int output_size,
const char* input,
int input_size);
74 #define NULL_TERMINATE(__array) __array[sizeof(__array) - 1] = '\0'
107 "smp",
"fifo",
"internal",
"ext0",
"ext1",
"ext2",
"ext3",
108 "fermi_chopper0",
"fermi_chopper1",
"fermi_chopper2",
"fermi_chopper3",
109 "msmode",
"TS2_pulse",
"ISIS_50Hz"
112 #define ISISCRPT_NUM_VETOS (sizeof(veto_names) / sizeof(const char*))
119 #define TCBRANGE_FILE -1
120 #define TCBRANGE_UNUSED 0
121 #define TCBRANGE_CONST_T 1
122 #define TCBRANGE_INC_T 2
123 #define TCBRANGE_INC_T_2 3
124 #define TCBRANGE_SHIFTED 4
132 boost::array<float,ISISCRPT_MAX_TCPAR>
tcpar;
233 #define ISISCRPT_MAX_LVXML_SIZE 50000
258 boost::array<PERIOD,ISISCRPT_MAX_PERIOD>
period;
295 boost::array<int,ISISCRPT_MAX_MONITOR>
mdet;
296 boost::array<int,ISISCRPT_MAX_MONITOR>
monp;
334 boost::array<int,ISISCRPT_MAX_NTRG>
nsp;
339 boost::array<int,ISISCRPT_MAX_NTRG>
ntcr;
346 boost::array<int,ISISCRPT_MAX_NTRG>
ntc;
360 boost::array<VETO,ISISCRPT_NUM_VETOS>
vetos;
448 #define MAX_MONITORING_PAR 200
452 typedef boost::array<monitoring_par,MAX_MONITORING_PAR>
par_type;
514 int getIntArrayItemSize(
const char* item_name,
const long* spec_array,
int nspec,
int* dims_array,
int& ndims,
DAEstatus& status)
const;
522 int getIntItem(
const char* item_name,
const long* spec_array,
int nspec,
long* lVal,
DAEstatus& status)
const;
523 int getRealItem(
const char* item_name,
const long* spec_array,
int nspec,
double* dblVal,
DAEstatus& status)
const;
524 int getIntArrayItem(
const isisU32_t* raw_data,
int raw_data_size,
const char* item_name,
const long* spec_array,
int nspec,
long* larray,
DAEstatus& status)
const;
525 int getRealArrayItem(
const isisU32_t* raw_data,
int raw_data_size,
const char* item_name,
const long* spec_array,
int nspec,
double* darray,
DAEstatus& status)
const;
532 int fullTR(
int index)
const;
535 int daeTR(
int tr)
const;
540 int getNumSpectra(
int tr,
bool include_spectrum_zero =
false)
const;
544 uint32_t
trCRPTOffset(
int tr,
int daq_period,
int raw_data_size)
const;
562 int channelLookup(
int from_chan,
int from_tr,
int to_tr,
float tof_val)
const;
565 void eventModeCards(
int& ndetcard_event,
int& ndetcard_used)
const;
579 if (monitor_number >= 1 && monitor_number <=
nmon)
581 return spec[
mdet[monitor_number - 1] - 1 ];
591 if (monitor_number >= 1 && monitor_number <=
nmon)
609 for(
int i=1; i <=
nmon; ++i)
627 int spec_daq_period = spec / perspec;
628 if (daq_period >= 0 && daq_period <
nper_daq)
641 if (offset < raw_data_size)
675 for(
int i=0; i<
ntrg; ++i)
677 n += (
nsp[i] * (1 +
ntc[i]) );
744 #define TR_EVENT_MOD 100
829 ndetcard_event = ndetcard_used = 0;
846 int ndetcard_event, ndetcard_used;
848 if (ndetcard_used > 0)
850 return static_cast<double>(ndetcard_event) / static_cast<double>(ndetcard_used);
870 return (d > 0.0 ?
true :
false);
boost::array< int, ISISCRPT_MAX_DETECTOR > det_mode
time_t crpt_load_time
time ICP started
int md5sumFile(const char *filename, unsigned char *md5sum, DAEstatus &status)
char file[ISISCRPT_MAX_LVXML_SIZE]
boost::array< int, ISISCRPT_NUM_FC_VETO > fermi_chopper_delay
in 20ns
int data_type
0=unknown, 1=int, 2=float
time_t stop_time
last time period paused
static const char * sestatus_names[]
int getIntArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, long *larray, DAEstatus &status) const
uint32_t trCRPTOffset(int tr, int daq_period, int raw_data_size) const
int timr_crpt[ISISCRPT_MAX_DETECTOR]
#define ISISCRPT_MAX_FNAMELEN
int getPeriodSize() const
int getNumSpectra(bool include_spectrum_zero=false) const
long update_period_sequence
int code[ISISCRPT_MAX_DETECTOR]
int udet[ISISCRPT_MAX_DETECTOR]
char log_data[ISISCRPT_LOG_MAXLINES][ISISCRPT_LOG_LINELEN]
int64_t update_total_counts
int spectrumCardPos(int spec) const
#define ISISCRPT_INST_ABRV_LEN
int monitorNumberToSpectrum(int monitor_number) const
monitor numbers start at 1, indexes in mdet also start at 1 for historical (i.e fortran and old raw f...
isisU32_t frames
frames vetoed if enabled
float rtcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
#define ISISCRPT_INSTITUTE_NAME_LEN
int modn[ISISCRPT_MAX_DETECTOR]
unsigned total_frames
total up to last pause
int tcb_map[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
char label[ISISCRPT_PERIOD_LABEL_LEN]
int setDAESpecificParameters()
bool compareChecksums(const unsigned char *md5sum1, const unsigned char *md5sum2)
char lvxml_monitoring[ISISCRPT_MAX_LVXML_SIZE]
char lvxml_periods[ISISCRPT_MAX_LVXML_SIZE]
#define ISISCRPT_MAX_NTRG
boost::array< float, ISISCRPT_MAX_TCPAR > tcpar
boost::array< int, ISISCRPT_MAX_NUM_DAE *100 > cardpos2index
reverse of dae2cardpos above - turns position into array index. 100 here is DAE2CardPolicy::CRATE_MOD...
char lvxml_tcb[ISISCRPT_MAX_LVXML_SIZE]
uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period) const
#define ISISCRPT_LOG_LINELEN
int npar
length of tcpar used
char epics_lastread_iso[64]
int getRealArrayItemHelper(const isisU32_t *raw_data, int raw_data_size, const char *item_name, T *darray, DAEstatus &status) const
RUNTABLE tcb_file
used if TCBRANGE_FILE
static const char * veto_names[]
these names will be used in the NeXus data file, so no spaces and lowercase only
char rcsid[ISISCRPT_MAX_RCSID+1]
struct timeb calc_last_time
char period_file[ICP_NAME_LEN]
bool saveMonitorEvents(int monitor_number) const
int getCharItem(const char *item_name, std::string &cvalue, DAEstatus &status) const
int shutter
0 = closed, 1 = open
int output
logic output value
int mode
must be a TCBRANGE_* define
#define ISISCRPT_MAX_DETECTOR
time_t start_time
first time period started
int spaceTrimCopy(char *output, int output_size, const char *input, int input_size)
int mpos[ISISCRPT_MAX_DETECTOR]
int muonkicker
0 = off, 1 = on
char instrument_xml_file[ISISCRPT_MAX_FNAMELEN]
boost::array< int, ISISCRPT_MAX_MONITOR > monp
boost::array< int, ISISCRPT_MAX_DC > dae2cardpos
detector card positions, length ndetcard
bool hasFileChanged(DAEstatus &status) const
int spacePadCopyVa(char *output, int output_size, const char *format,...)
#define ISISCRPT_PERIOD_LABEL_LEN
int fileTR(int tr) const
file_tr same as crpt_tr for now
int dae2specmap[ISISCRPT_MAX_DC][ISISCRPT_MAX_DC_DETECTOR]
give spectrum number from dae2 card and dae2 spec number
#define TCBRANGE_FILE
read from file
int compression_block_size
static bool tcbRangesPurelyShifted(const TCBRANGE &t1, const TCBRANGE &t2)
char beamstop_position[16]
float beamt
for appropriate target
int timr_dae[ISISCRPT_MAX_DETECTOR]
int persize
size of a period in 32bit words
#define TCBRANGE_SHIFTED
pure shift from an existing range
#define ISISCRPT_MAX_DATADAE
boost::array< int, ISISCRPT_MAX_NTRG > spec_min
range of spectrum numbers in CRPT time regime
float tthe[ISISCRPT_MAX_DETECTOR]
time_t crpt_unload_time
time CRPT loaded
boost::array< VETO, ISISCRPT_NUM_VETOS > vetos
bool repr_normal
running at 40/50Hz if TS1, or 10Hz or TS2
char lvxml_dae[ISISCRPT_MAX_LVXML_SIZE]
char institute[ISISCRPT_INSTITUTE_NAME_LEN+1]
#define ISISCRPT_MAX_MONITOR
#define TR_EVENT_MOD
used to pull out the event mode specific bit from a time regimne definition
isisU32_t update_good_frames_period
int spectrumDAETR(int spec) const
int repr
for appropriate target
data_dae_t data_dae[ISISCRPT_MAX_DATADAE]
char temperature_label[256]
int channelLookup(int from_chan, int from_tr, int to_tr, float tof_val) const
float delt[ISISCRPT_MAX_DETECTOR]
boost::array< int, ISISCRPT_MAX_MONITOR > save_monitor_events
whether to save monitor events in event mode (size NMON)
int cardIndexFromPos(int pos) const
int getRealItem(const char *item_name, double &dblVal, DAEstatus &status) const
#define ISISCRPT_LOG_MAXLINES
int dae_type
time CRPT unloaded (may not be set if program crashed)
char long_title[ISISCRPT_TITLE_LEN+1]
void calculateCRPTOffsets()
char measurement_id[ICP_NAME_LEN]
int spectrumToMonitorNumber(int spec) const
return monitor number, or 0 if not monitor
boost::array< unsigned, ISISCRPT_MAX_MONITOR > monitor_sum
static const char * runstatus_names[]
bool isEventTR(int tr) const
isisU32_t update_raw_frames_period
char journal_blocks[ISISCRPT_MAX_LVXML_SIZE]
void eventModeCards(int &ndetcard_event, int &ndetcard_used) const
int daq_period
DAQ period number (set to -1 if DWELL or UNUSED as not relevant )
int tcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
#define ISISCRPT_INST_LEN
isisU32_t update_good_ppp_high
isisU32_t update_total_ppp_high
unsigned char md5checksum_t[16]
boost::array< int, ISISCRPT_MAX_NTRG > tcb_trdelay
int spec[ISISCRPT_MAX_DETECTOR]
float chopper_opening_angle
char fname[ISISCRPT_MAX_FNAMELEN]
static const char * crpt_rcsid
char instrument_parameter_map_file[ISISCRPT_MAX_FNAMELEN]
bool isMonitorSpectrum(int spec) const
unsigned epics_lastread_nano
#define ISISCRPT_MAX_DC_DETECTOR
int spectrumGroup(int spec) const
boost::array< int, ISISCRPT_MAX_NTRG > ntcr
float update_npratio_current
int getRealArrayItemSize(const char *item_name, int *dims_array, int &ndims, DAEstatus &status) const
boost::array< int, ISISCRPT_MAX_MONITOR > mdet
#define RUNSTATUS_RUNNING
char isis_cycle[ISISCRPT_MAX_LVXML_SIZE]
double eventModeCardFraction() const
float ts_total
since midnight for appropriate target
int getRealArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, double *darray, DAEstatus &status) const
const char * runStatusName() const
int spectrumCRPTTR(int spec) const
unsigned good_frames
total up to last pause
md5checksum_t tcb_xml_checksum
isisU32_t update_good_ppp_low
int dae1SpecForCard(int pos, int dae2_spec) const
if spectrum is out of range, returns -1
char inst_abrv[ISISCRPT_INST_ABRV_LEN+1]
char icp_version[ICP_NAME_LEN]
md5checksum_t dae_xml_checksum
char comp_name[MAX_COMPUTERNAME_LENGTH+1]
int dae1SpecForCardIndex(int index, int dae2_spec) const
int udetFromSpec(int spec) const
boost::array< PERIOD, ISISCRPT_MAX_PERIOD > period
int crat[ISISCRPT_MAX_DETECTOR]
float good_uamph
total up to last pause
#define ISISCRPT_TITLE_LEN
#define ISISCRPT_MAX_LVXML_SIZE
int timr_file[ISISCRPT_MAX_DETECTOR]
bool isEventSpectrum(int spec) const
char measurement_type[ICP_NAME_LEN]
TCBRANGE tcr[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TCR]
boost::array< int, ISISCRPT_MAX_NTRG > ntc
number of time channels per CRPT time regime
float monitor_range[ISISCRPT_MAX_MONITOR][2]
bool usingEventMode() const
boost::array< int, ISISCRPT_MAX_DC > dae2highspec
length ndetcard
char user_name[ISISCRPT_USER_NAME_LEN+1]
int simpleChannelRebin(int from_chan, int from_tr, int to_tr) const
boost::array< int, ISISCRPT_MAX_DETECTOR > spec_to_crpt_offset
maps spectrum number to offset in raw data of crpt
char inst_name[ISISCRPT_INST_LEN+1]
int ts
1 for ts1, 2 for ts2
boost::array< int, ISISCRPT_MAX_DC > dae2cardmode
-1 unused, 0 histogram, 1 event. length ndetcard
char lvxml_update[ISISCRPT_MAX_LVXML_SIZE]
char sample_id[ICP_NAME_LEN]
char sample_orientation[256]
boost::array< int, ISISCRPT_MAX_DETECTOR > spec_to_index
maps spectrum number to index into spec,udet,timr etc arrays in crpt
static void splitItemName(const std::string &sitem_name, SplitItem &split_item)
void setInstName(const std::string &comp_name)
#define ISISCRPT_MAX_TIMECHANB
char measurement_subid[ICP_NAME_LEN]
float update_npratio_average
char local_contact[ISISCRPT_USER_NAME_LEN+1]
long update_duration_period
int daeTRForCard(int pos) const
isisU32_t update_total_ppp_low
char instrument_geometry[5]
float total_uamph
total up to last pause
int getHighestSpectrumNumber() const
float len2[ISISCRPT_MAX_DETECTOR]
int randomisedChannelRebin(int from_chan, int from_tr, int to_tr) const
int getIntItem(const char *item_name, long &lVal, DAEstatus &status) const
float ut[ISISCRPT_MAX_USER *ISISCRPT_MAX_DETECTOR]
#define ISISCRPT_MAX_USER
int spectrumNTC(int spec) const
int makeEventTRValue(int dae_tr, int crpt_tr, int file_tr) const
file_tr ignored for now
int getIntArrayItemSize(const char *item_name, int *dims_array, int &ndims, DAEstatus &status) const
struct ISISCRPT_STRUCT::@9 icp_clock
#define ISISCRPT_MAX_RCSID
#define ISISCRPT_USER_NAME_LEN
char expression[ISISCRPT_MAX_LVXML_SIZE]
time_t duration
total data collection time in periods (seconds)
boost::array< int, ISISCRPT_MAX_NTRG > nsp
number of spectra per CRPT time regime
char script_name[ICP_NAME_LEN]
boost::array< int, ISISCRPT_MAX_DETECTOR > det_group
0 = monitor, else logical det number
boost::array< int, ISISCRPT_MAX_NTRG > spec_max
range of spectrum numbers in CRPT time regime
int spacePadCopy(char *output, const char *input, int output_size)
boost::array< int, ISISCRPT_NUM_FC_VETO > fermi_chopper_width
in 20ns
boost::array< int, ISISCRPT_MAX_DC > dae2cardtr
detector card DAE time regime (-1 if card not used), length ndetcard - individual spectra on card may...
int enabled
1 = enabled, 0 = disabled
boost::array< monitoring_par, MAX_MONITORING_PAR > par_type
int type
0=unused, 1=DAQ, 2=DWELL
int fullTR(int index) const