ICP  1
isiscrpt.h
Go to the documentation of this file.
1 #ifndef ISISCRPT_H
2 #define ISISCRPT_H
3 
5 #define ISISCRPT_VERSION 3
6 
7 static const char* crpt_rcsid = "$Revision: 1675 $";
8 
9 #include "DAEstatus.h"
10 #include "isisdae.h"
11 #include "isiscrpt_types.h"
12 #include "icputils.h"
13 
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
38 
39 #define ICP_NAME_LEN 80
40 
41 #define ISISCRPT_MAX_DATADAE 10
42 
43 // for old VMS log section
44 #define ISISCRPT_LOG_MAXLINES 20
45 #define ISISCRPT_LOG_LINELEN 80
46 
47 
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
56 
57 static const char* runstatus_names[] = {
58  "PROCESSING", "SETUP", "RUNNING", "PAUSED",
59  "WAITING", "VETOING", "ENDING", "SAVING"
60 };
61 
62 #define SESTATUS_INRANGE 1
63 #define SESTATUS_OUTOFRANGE 0
64 
65 static const char* sestatus_names[] = {
66  "OUT_OF_RANGE", "IN_RANGE"
67 };
68 
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);
72 
74 #define NULL_TERMINATE(__array) __array[sizeof(__array) - 1] = '\0'
75 
76 struct RUNTABLE
77 {
78  time_t mod_time;
79  size_t file_size;
82  bool hasFileChanged(DAEstatus& status) const;
83 };
84 
85 inline bool RUNTABLE::hasFileChanged(DAEstatus& status) const
86 {
87  md5checksum_t current_checksum;
88  md5sumFile(fname, current_checksum, status);
89  return !compareChecksums(current_checksum, checksum);
90 }
91 
92 
94 {
98 };
99 
101 {
103 };
104 
106 static const char* veto_names[] = {
107  "smp", "fifo", "internal", "ext0", "ext1", "ext2", "ext3",
108  "fermi_chopper0", "fermi_chopper1", "fermi_chopper2", "fermi_chopper3",
109  "msmode", "TS2_pulse", "ISIS_50Hz"
110 };
111 
112 #define ISISCRPT_NUM_VETOS (sizeof(veto_names) / sizeof(const char*))
113 
114 struct VETO
115 {
116  int enabled;
118 };
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
125 
126 
127 struct TCBRANGE
128 {
129  int mode;
130  float start;
131  float end;
132  boost::array<float,ISISCRPT_MAX_TCPAR> tcpar;
133  int npar;
135 };
136 
137 static bool tcbRangesPurelyShifted(const TCBRANGE& t1, const TCBRANGE& t2)
138 {
139  bool pure_shift;
140  pure_shift = (fabs((t1.end - t1.start) - (t2.end - t2.start)) < 1e-5)
141  && (t1.mode == t2.mode || t1.mode == TCBRANGE_SHIFTED || t2.mode == TCBRANGE_SHIFTED)
142  && (t1.npar == t2.npar)
143  && !memcmp(t1.tcpar.data(), t2.tcpar.data(), sizeof(t1.tcpar));
144  if ( pure_shift && (t1.mode == TCBRANGE_FILE) )
145  {
146  pure_shift = !strcmp(t1.tcb_file.fname, t2.tcb_file.fname);
147  }
148  return pure_shift;
149 }
150 
153 struct PERIOD
154 {
155  int type;
158  int output;
159  time_t start_time;
160  time_t stop_time;
161  time_t duration;
162  float good_uamph;
163  float total_uamph;
168  unsigned good_frames;
169  unsigned total_frames;
171 };
172 
173 
175 {
176  int id;
177  char name[256];
178  char raw_units[64];
179  char scaled_units[64];
180  int crate;
181  int tr;
182  int data_type;
184  double scale;
185  double offset;
186 };
187 
189 {
190  float beams;
191  int ts;
192  float beamt;
193  int ts1_repr;
194  int repr;
195  bool repr_normal;
196  float ts_total;
197  int shutter;
200  time_t beam_on_time;
201  bool beam_on;
202  bool valid;
203  time_t time;
204 };
205 
206 struct nagios_t
207 {
208  double veto_percent;
209  double wait_mins;
210  int shutter_val; // 0 for closed plus running, 1 for closed, 2 for open
214 };
215 
216 
217 // n/p monitoring
219 {
220  int spectrum;
221  float t_low;
222  float t_high;
223  float last_value;
224  float last_change;
225 };
226 
227 struct SplitItem
228 {
229  std::string item;
230  int number;
231 };
232 
233 #define ISISCRPT_MAX_LVXML_SIZE 50000
234 
235 // use int rather than bool
237 {
238 // these first two (rcsid, version) should always be in this order
239  char rcsid[ISISCRPT_MAX_RCSID+1]; // crpt_rcsid
240  int version; // version number of structure = ISISCRPT_VERSION
242  int initialised; // has the CRPT been filled with non-default constructor values (1=yes, anything else no)
243  unsigned long crpt_size; // size of this structure; used as a check
244  time_t icp_start_time;
245  time_t crpt_load_time;
247  int dae_type; // ISISDAE:: constant
248  int run_status; // as per RUNSTATUS_* macros
249  int se_status; // as per SESTATUS_* macros
250  int software_period; // current period number (0 = first) for software periods
251  int period_type; // see ISISDAE::PeriodType in isisdae.h for codes
252  int period_source; // PeriodSetupSource where period information is read from
253  char period_file[ICP_NAME_LEN]; // file to read period information from is period_source == file
254  time_t start_time; // time run initially started i.e. BEGIN
255  time_t resume_time; // last time data collection was restarted
256  time_t stop_time; // time run paused
257  time_t duration; // total collection in all periods (seconds) up to last pause
258  boost::array<PERIOD,ISISCRPT_MAX_PERIOD> period;
259  int nperseq; // number of period cycles/sequences completed
260  int nperseq_request; // number of period cycles requested
261  int clock_frequency; // dae clock frequency in units of time_scale (32 MHz for DAE2)
262 // get 0.21us for free (7 clock pulses)
263  int electronics_delay; // in clock pulses
264  int time_scaler; // ^10 scaler for time units. 6=Mhz/microseconds, 9=GHz/nanosecond
265  float tcb_minwidth; // minimum channel width dae can handle (0.25)
266  float tcb_mintime; // lowest time dae can handle
267  float tcb_maxtime; // max time dae can handle
268  int tcb_maxdelay; // max delay on frame clock
269  int tcb_delay; // global frame synch delay in us, but must be a multiple of 4 ***B
270  boost::array<int,ISISCRPT_MAX_NTRG> tcb_trdelay; // additional time regime specific delay
271  FrameSync tcb_sync; // frm snch origin
272  int tcb_pulse_generator; // are we using an external pulse generator?// are we using a pulse generator to simulate a frame synch delay?
278  unsigned good_frames; // total up to last pause
279  unsigned total_frames; // total up to last pause
280  float good_uamph; // total up to last pause
281  float total_uamph; // total up to last pause
286  int auto_save_type; // 0 = frames, 1=events, 2=minutes, 3=uamps
287  int auto_save_value; // auto save e.g. frames per save; 0 =disabled
288  int auto_save_last; // frame count last save
289  int auto_save_count; // number of saves
290  int run_number; // run number
291  int rb_number; // proposal number
292  int ndet; // number of detectors NDET
293  int nmon; // number of monitors NMON
294  int nuse; // number of user defined UTn tables NUSE
295  boost::array<int,ISISCRPT_MAX_MONITOR> mdet; // detector index for monitors (size NMON) - indicates index into spec(), udet() etc arrays. Index starts at 1 for historical reasons
296  boost::array<int,ISISCRPT_MAX_MONITOR> monp; // prescale value for each monitor (size NMON)
297  boost::array<int,ISISCRPT_MAX_MONITOR> save_monitor_events;
298  int monitor_spectrum; // dashboard monitor spectrum
299  float monitor_range[ISISCRPT_MAX_MONITOR][2]; // low and high values to sum over
300  boost::array<unsigned,ISISCRPT_MAX_MONITOR> monitor_sum; // low and high values to sum over
301  int spec[ISISCRPT_MAX_DETECTOR]; // spectrum number table (size NDET)
302  float delt[ISISCRPT_MAX_DETECTOR]; // hold off table (size NDET)
303  float len2[ISISCRPT_MAX_DETECTOR]; // L2 table (size NDET)
304  int code[ISISCRPT_MAX_DETECTOR]; // code for UTn tables (size NDET)
305  float tthe[ISISCRPT_MAX_DETECTOR]; // 2theta scattering angle (size NDET)
306  float ut[ISISCRPT_MAX_USER * ISISCRPT_MAX_DETECTOR]; // nuse UT* user tables (total size NUSE*NDET) ut01=phi
307  int crat[ISISCRPT_MAX_DETECTOR]; // crate number for each detector (size NDET)
308  int modn[ISISCRPT_MAX_DETECTOR]; // module number for each detector (size NDET)
309  int mpos[ISISCRPT_MAX_DETECTOR]; // module position for each detector (size NDET)
310  boost::array<int,ISISCRPT_MAX_DETECTOR> det_mode; // 0x0=histogram, 0x1=event
311  // used to have just timr, now split
312  int timr_dae[ISISCRPT_MAX_DETECTOR]; // DAE time regime for each detector (size NDET)
313  int timr_crpt[ISISCRPT_MAX_DETECTOR]; // CRPT time regime for each detector (size NDET)
314  int timr_file[ISISCRPT_MAX_DETECTOR]; // FILE time regime for each detector (size NDET) - not used at present
315  int udet[ISISCRPT_MAX_DETECTOR]; // user detector number for each detector (size NDET)
316  boost::array<int,ISISCRPT_MAX_DETECTOR> spec_to_index;
317  boost::array<int,ISISCRPT_MAX_DETECTOR> spec_to_crpt_offset;
318  boost::array<int,ISISCRPT_MAX_DETECTOR> det_group;
320 
321  int ndetcard;
322  boost::array<int,ISISCRPT_MAX_DC> dae2cardtr;
323  boost::array<int,ISISCRPT_MAX_DC> dae2cardmode;
324  boost::array<int,ISISCRPT_MAX_DC> dae2cardpos;
325  boost::array<int,ISISCRPT_MAX_NUM_DAE*100> cardpos2index;
326 
327  boost::array<int,ISISCRPT_MAX_DC> dae2highspec;
329 
330  int ntrg; // number of time regimes
331  int nper; // number of periods (daq + dwell)
332  int nper_daq; // number of periods (daq)
333 // int nsp1; // number of spectra in time regime 1
334  boost::array<int,ISISCRPT_MAX_NTRG> nsp;
335  boost::array<int,ISISCRPT_MAX_NTRG> spec_min;
336  boost::array<int,ISISCRPT_MAX_NTRG> spec_max;
337 // int ntc1; // number of time channels in time regime 1
338  TCBRANGE tcr[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TCR]; // time channel parameters
339  boost::array<int,ISISCRPT_MAX_NTRG> ntcr;
340 // int tcb1[ISISCRPT_MAX_TIMECHANB]; // time channel boundaries in clock pulses (size NTC[i]+1)
341 // float rtcb1[ISISCRPT_MAX_TIMECHANB]; // time channel boundaries in clock pulses (size NTC[i]+1)
342 
343  int tcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]; // time channel boundaries in clock pulses (size NTC[i]+1)
344  float rtcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]; // time channel boundaries in clock pulses (size NTC[i]+1)
345  int tcb_map[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]; // tcb_map[i-1][j-1][n] returns channel in regime i for j[n]
346  boost::array<int,ISISCRPT_MAX_NTRG> ntc;
347 
348  int persize;
349 
350  char long_title[ISISCRPT_TITLE_LEN+1]; // run title
351  char inst_name[ISISCRPT_INST_LEN+1]; // instrument name
352  char inst_abrv[ISISCRPT_INST_ABRV_LEN+1]; // instrument abbreviated name
353  char user_name[ISISCRPT_USER_NAME_LEN+1]; // user name
355  char user_email[128];
356  char user_telephone[128];
357  char user_id[128]; // isis user number
358  char local_contact[ISISCRPT_USER_NAME_LEN+1]; // user name
359  float i_l1; // L1 scattering length
360  boost::array<VETO,ISISCRPT_NUM_VETOS> vetos;
361 // int smp; // Secondary Master Pulse (0:en,1:dis)
362 // int ext_vetos[ISISCRPT_MAX_VETO]; // External vetoes (0 dis,1 en)
363  int sav_file_count; // number of SAV (s01, s02 etc) files created
364  // status updates
365  struct timeb update_time;
366  int update_poll_time; // how long between updates
373  int update_num_polls; // number of updates since run began
374  float beam_current; // microamps
376  long update_good_frames; // make these unsigned in case of issues of subtraction -> negative -> wrap
384 
385  float count_rate; // million events per hour
386 
389 
390  boost::array<int,ISISCRPT_NUM_FC_VETO> fermi_chopper_delay;
391  boost::array<int,ISISCRPT_NUM_FC_VETO> fermi_chopper_width;
392  //int fermi_chopper_delay[ISISCRPT_NUM_FC_VETO]; // in 20ns
393  //int fermi_chopper_width[ISISCRPT_NUM_FC_VETO]; // in 20ns
394 
395  // muon specific bits
397  char sample_name[256];
398  char field_label[256];
399  char temperature_label[256];
400  char comment[512];
401  char instrument_geometry[5]; // 'l' or 't'
402  int muon_cerenkov_pulse; // first=0, second=1
403  int period_output_delay; // how many microseconds in isis frame before switch of period outputs
404 
405  // for loq
408  float aperture1;
409  float aperture2;
414  char beamstop_position[16]; // 'IN', 'OUT' or 'UNKNOWN'
416  char sample_geometry[80];
417  char sample_type[80];
418  float sdd;
419 
420  // crisp
423 
426 
427  // these are for old VMS log section
430 
436 
442 
447 
448 #define MAX_MONITORING_PAR 200
449  struct Monitoring
450  {
451  int n; // number of monitoring pars
452  typedef boost::array<monitoring_par,MAX_MONITORING_PAR> par_type;
456  float valid_low;
457  float valid_high;
458  int action; // when out of range
459  int action_period; // period to change to when out of range and correct "action" specified
461  // used during running
462  struct timeb calc_last_time;
463  float last_ua;
464  long last_gf;
465  long last_tc;
466  int return_period; // period to change back to when back in range
467  int enabled;
468  int log_freq;
470  int alerts;
471  };
473 
476 
477  char comp_name[MAX_COMPUTERNAME_LENGTH + 1];
478  char alert_email[1024];
479  float uamp_scale;
482 
483  struct
484  {
485  LONGLONG perf_counter;
486  LONGLONG proc_freq;
487  FILETIME filetime;
488  } icp_clock;
489 
494 
495  unsigned magic; // fixed number to check on size
496  // data must be at the end so we can easily flush
497  // everything except the data to disk
498 
499  void markInitialised() { initialised = 1; }
501  bool isInitialised() { return (initialised == 1); }
502 
503  ISISCRPT_STRUCT(ISISDAE::DAEType dae_type_, const std::string& comp_name);
504 
505 public:
506 
507  bool isRunning() const { return run_status == RUNSTATUS_RUNNING; }
508  const char* runStatusName() const { return runstatus_names[run_status]; }
510  int getCharItem(const char* item_name, std::string& cvalue, DAEstatus& status) const ;
511  int getIntItem(const char* item_name, long& lVal, DAEstatus& status) const ;
512  int getRealItem(const char* item_name, double& dblVal, DAEstatus& status) const;
513  int getIntArrayItemSize(const char* item_name, int* dims_array, int& ndims, DAEstatus& status) const;
514  int getIntArrayItemSize(const char* item_name, const long* spec_array, int nspec, int* dims_array, int& ndims, DAEstatus& status) const;
515  int getIntArrayItem(const isisU32_t* raw_data, int raw_data_size, const char* item_name, long* larray, DAEstatus& status) const;
516  int getRealArrayItemSize(const char* item_name, int* dims_array, int& ndims, DAEstatus& status) const;
517  int getRealArrayItem(const isisU32_t* raw_data, int raw_data_size, const char* item_name, double* darray, DAEstatus& status) const;
518  int getRealArrayItem(const isisU32_t* raw_data, int raw_data_size, const char* item_name, float* farray, DAEstatus& status) const;
519 
520  int getCharItem(const char* item_name, long spec, std::string& cvalue, DAEstatus& status) const;
521 
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;
526  int getRealArrayItem(const isisU32_t* raw_data, int raw_data_size, const char* item_name, const long* spec_array, int nspec, float* farray, DAEstatus& status) const;
527 
528  bool checkCRPT() const { return (magic == 0x12345678) && (crpt_size == sizeof(ISISCRPT_STRUCT)); } // true if OK
529 
530  int crptTR(int tr) const;
531  int fileTR(int tr) const;
532  int fullTR(int index) const;
533  bool isEventTR(int tr) const;
534  bool isEventSpectrum(int spec) const;
535  int daeTR(int tr) const;
536  int spectrumCRPTTR(int spec) const;
537  int spectrumDAETR(int spec) const;
538  int spectrumNTC(int spec) const;
539  int getNumSpectra(bool include_spectrum_zero = false) const;
540  int getNumSpectra(int tr, bool include_spectrum_zero = false) const;
541  int getHighestSpectrumNumber() const;
542  uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period) const;
543  uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period, int raw_data_size) const;
544  uint32_t trCRPTOffset(int tr, int daq_period, int raw_data_size) const;
545  int getPeriodSize() const;
546  int monitorNumberToSpectrum(int monitor_number) const;
547  int spectrumToMonitorNumber(int spec) const;
548  bool saveMonitorEvents(int monitor_number) const;
549  bool isMonitorSpectrum(int spec) const;
550  void calculateCRPTOffsets();
551  int dae1SpecForCard(int pos, int dae2_spec) const;
552  int dae1SpecForCardIndex(int index, int dae2_spec) const;
553  int daeTRForCard(int pos) const;
554  int cardIndexFromPos(int pos) const;
555  int spectrumCardPos(int spec) const;
556  int spectrumGroup(int spec) const;
557 
558  int udetFromSpec(int spec) const;
559  int buildTimeRegimeMap();
560  int simpleChannelRebin(int from_chan, int from_tr, int to_tr) const;
561  int randomisedChannelRebin(int from_chan, int from_tr, int to_tr) const;
562  int channelLookup(int from_chan, int from_tr, int to_tr, float tof_val) const;
563  void setInstName(const std::string& comp_name);
564  bool usingEventMode() const;
565  void eventModeCards(int& ndetcard_event, int& ndetcard_used) const;
566  double eventModeCardFraction() const;
567 
568 private:
569  template <typename T> int getRealArrayItemHelper(const isisU32_t* raw_data, int raw_data_size, const char* item_name, T* darray, DAEstatus& status) const;
570  template <typename T> int getRealArrayItemHelper(const isisU32_t* raw_data, int raw_data_size, const char* item_name, const long* spec_array, int nspec, T* darray, DAEstatus& status) const;
572  static void splitItemName(const std::string& sitem_name, SplitItem& split_item);
573  int makeEventTRValue(int dae_tr, int crpt_tr, int file_tr) const;
574 };
575 
577 inline int ISISCRPT_STRUCT::monitorNumberToSpectrum(int monitor_number) const
578 {
579  if (monitor_number >= 1 && monitor_number <= nmon)
580  {
581  return spec[ mdet[monitor_number - 1] - 1 ];
582  }
583  else
584  {
585  return 0;
586  }
587 }
588 
589 inline bool ISISCRPT_STRUCT::saveMonitorEvents(int monitor_number) const
590 {
591  if (monitor_number >= 1 && monitor_number <= nmon)
592  {
593  return (save_monitor_events[monitor_number - 1] != 0);
594  }
595  else
596  {
597  return 0;
598  }
599 }
600 
601 inline int ISISCRPT_STRUCT::udetFromSpec(int spec) const
602 {
603  return udet[spec_to_index[spec]];
604 }
605 
608 {
609  for(int i=1; i <= nmon; ++i)
610  {
611  if (monitorNumberToSpectrum(i) == spec)
612  {
613  return i;
614  }
615  }
616  return 0;
617 }
618 
619 inline bool ISISCRPT_STRUCT::isMonitorSpectrum(int spec) const
620 {
621  return (spectrumToMonitorNumber(spec) != 0 ? true : false);
622 }
623 
624 inline uint32_t ISISCRPT_STRUCT::spectrumCRPTOffsetImpl(int spec, int daq_period) const
625 {
626  int perspec = getNumSpectra(true);
627  int spec_daq_period = spec / perspec; // this is to allow for higher spectrum numbers beiging used to indicate periods
628  if (daq_period >= 0 && daq_period < nper_daq)
629  {
630  return (daq_period + spec_daq_period) * persize + spec_to_crpt_offset[spec % perspec];
631  }
632  else
633  {
634  return 0;
635  }
636 }
637 
638 inline uint32_t ISISCRPT_STRUCT::spectrumCRPTOffsetImpl(int spec, int daq_period, int raw_data_size) const
639 {
640  uint32_t offset = spectrumCRPTOffsetImpl(spec, daq_period);
641  if (offset < raw_data_size)
642  {
643  return offset;
644  }
645  else
646  {
647  return 0;
648  }
649 }
650 
651 inline uint32_t ISISCRPT_STRUCT::trCRPTOffset(int tr, int daq_period, int raw_data_size) const
652 {
653  return spectrumCRPTOffsetImpl(spec_min[crptTR(tr) - 1], daq_period, raw_data_size);
654 }
655 
659 {
660  return persize;
661 }
662 
666 {
667  // calculate CRPT offsets of each spectrum
668  spec_to_crpt_offset[0] = 0;
669  for(int i=1; i <= getHighestSpectrumNumber(); ++i)
670  {
671  spec_to_crpt_offset[i] = spec_to_crpt_offset[i-1] + (spectrumNTC(i-1) + 1);
672  }
673  // calculate period size
674  int n = 0;
675  for(int i=0; i<ntrg; ++i)
676  {
677  n += ( nsp[i] * (1 + ntc[i]) );
678  }
679  n += (1 + spectrumNTC(0));
680  persize = n;
681 }
682 
684 inline int ISISCRPT_STRUCT::dae1SpecForCard(int pos, int dae2_spec) const
685 {
686 // for(int i=0; i<ndetcard; ++i)
687 // {
688 // if ( (dae2cardpos[i] == pos) && (dae2_spec >= 0) && (dae2_spec <= dae2highspec[i]) && (dae2_spec < ISISCRPT_MAX_DC_DETECTOR) )
689 // {
690 // if (cardpos2index[pos] != i)
691 // {
692 // throw std::runtime_error("cardpos2index");
693 // }
694 // return dae1SpecForCardIndex(i, dae2_spec);
695 // }
696 // }
697 // return -1;
698  return dae1SpecForCardIndex(cardpos2index[pos], dae2_spec);
699 }
700 
701 inline int ISISCRPT_STRUCT::dae1SpecForCardIndex(int index, int dae2_spec) const
702 {
703  if ( (dae2_spec >= 0) && (dae2_spec <= dae2highspec[index]) && (dae2_spec < ISISCRPT_MAX_DC_DETECTOR) )
704  {
705  return dae2specmap[index][dae2_spec];
706  }
707  return -1;
708 }
709 
710 inline int ISISCRPT_STRUCT::daeTRForCard(int pos) const
711 {
712 // for(int i=0; i<ndetcard; ++i)
713 // {
714 // if (dae2cardpos[i] == pos)
715 // {
716 // if (cardpos2index[pos] != i)
717 // {
718 // throw std::runtime_error("cardpos2index");
719 // }
720 // return dae2cardtr[i];
721 // }
722 // }
723 // return -1;
724  return dae2cardtr[cardpos2index[pos]];
725 }
726 
727 inline int ISISCRPT_STRUCT::cardIndexFromPos(int pos) const
728 {
729 // for(int i=0; i<ndetcard; ++i)
730 // {
731 // if (dae2cardpos[i] == pos)
732 // {
733 // if (cardpos2index[pos] != i)
734 // {
735 // throw std::runtime_error("cardpos2index");
736 // }
737 // return i;
738 // }
739 // }
740 // return -1;
741  return cardpos2index[pos];
742 }
743 
744 #define TR_EVENT_MOD 100
745 
746 // time regime is XXYY integer where
747 // XX == 0 -> dae histogram collection in YY time regime, CRPT rebinned the same (YY)
748 // XX > 0 -> dae event mode collection in YY with on the fly rebinning to XX in CRPT
749 inline int ISISCRPT_STRUCT::daeTR(int tr) const // time regime for DAE, 0 = pure event mode
750 {
751  return tr % TR_EVENT_MOD;
752 }
753 
754 // time regime used to histogram to CRPT
755 // 0 as answer is invalid
756 inline int ISISCRPT_STRUCT::crptTR(int tr) const
757 {
758  return (tr / TR_EVENT_MOD > 0) ? (tr / TR_EVENT_MOD) : tr;
759 }
760 
762 inline int ISISCRPT_STRUCT::fileTR(int tr) const
763 {
764  return crptTR(tr);
765 }
766 
767 inline bool ISISCRPT_STRUCT::isEventTR(int tr) const
768 {
769  return (tr / TR_EVENT_MOD > 0);
770 }
771 
773 inline int ISISCRPT_STRUCT::makeEventTRValue(int dae_tr, int crpt_tr, int /*file_tr*/) const
774 {
775  return crpt_tr * TR_EVENT_MOD + dae_tr;
776 }
777 
778 inline int ISISCRPT_STRUCT::fullTR(int index) const
779 {
780  if ( (det_mode[index] & 0x1) != 0 ) // event mode
781  {
782  return makeEventTRValue(timr_dae[index], timr_crpt[index], timr_file[index]);
783  }
784  else if (timr_dae[index] == timr_crpt[index]) // histogram mode
785  {
786  return timr_dae[index];
787  }
788  else // error - histogram mode and not same tr
789  {
790  return -1;
791  }
792 }
793 
794 inline int ISISCRPT_STRUCT::spectrumCRPTTR(int spec) const
795 {
796  return timr_crpt[ spec_to_index[spec] ];
797 }
798 
799 inline int ISISCRPT_STRUCT::spectrumDAETR(int spec) const
800 {
801  return timr_dae[ spec_to_index[spec] ];
802 }
803 
804 inline int ISISCRPT_STRUCT::spectrumNTC(int spec) const
805 {
806  int tr = spectrumCRPTTR(spec);
807  return ntc[tr-1];
808 }
809 
810 inline int ISISCRPT_STRUCT::spectrumCardPos(int spec) const
811 {
812  return crat[spec_to_index[spec]];
813 }
814 
815 inline int ISISCRPT_STRUCT::spectrumGroup(int spec) const
816 {
817  return spectrumCRPTTR(spec);
818 // return spectrumCardPos(spec);
819 }
820 
821 inline bool ISISCRPT_STRUCT::isEventSpectrum(int spec) const
822 {
823  return ( (det_mode[ spec_to_index[spec] ] & 0x1) != 0 );
824 }
825 
826 inline void ISISCRPT_STRUCT::eventModeCards(int& ndetcard_event, int& ndetcard_used) const
827 {
828  int mode;
829  ndetcard_event = ndetcard_used = 0;
830  for(int j=0; j<ndetcard; ++j)
831  {
832  mode = dae2cardmode[j];
833  if (mode != -1)
834  {
835  if (mode == 1)
836  {
837  ++ndetcard_event;
838  }
839  ++ndetcard_used;
840  }
841  }
842 }
843 
845 {
846  int ndetcard_event, ndetcard_used;
847  eventModeCards(ndetcard_event, ndetcard_used);
848  if (ndetcard_used > 0)
849  {
850  return static_cast<double>(ndetcard_event) / static_cast<double>(ndetcard_used);
851  }
852  else
853  {
854  return 0.0;
855  }
856 }
857 
859 {
860 // bool event_mode = false;
861 // for(int j=0; j<ndet; ++j)
862 // {
863 // if ( (det_mode[j] & 0x1) != 0 )
864 // {
865 // event_mode = true;
866 // break;
867 // }
868 // }
869  double d = eventModeCardFraction();
870  return (d > 0.0 ? true : false);
871 }
872 
873 
874 #endif /* ISIS_CRPT_H */
boost::array< int, ISISCRPT_MAX_DETECTOR > det_mode
Definition: isiscrpt.h:310
time_t crpt_load_time
time ICP started
Definition: isiscrpt.h:245
unsigned magic
Definition: isiscrpt.h:495
int md5sumFile(const char *filename, unsigned char *md5sum, DAEstatus &status)
Definition: icputils.cpp:253
char file[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:455
float uamp_scale
Definition: isiscrpt.h:479
int electronics_delay
Definition: isiscrpt.h:263
boost::array< int, ISISCRPT_NUM_FC_VETO > fermi_chopper_delay
in 20ns
Definition: isiscrpt.h:390
int data_type
0=unknown, 1=int, 2=float
Definition: isiscrpt.h:182
int ts1_repr
for ts1
Definition: isiscrpt.h:193
time_t stop_time
last time period paused
Definition: isiscrpt.h:160
char comment[512]
Definition: isiscrpt.h:400
static const char * sestatus_names[]
Definition: isiscrpt.h:65
char sample_geometry[80]
Definition: isiscrpt.h:416
int getIntArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, long *larray, DAEstatus &status) const
Definition: isiscrpt.cpp:755
uint32_t trCRPTOffset(int tr, int daq_period, int raw_data_size) const
Definition: isiscrpt.h:651
int timr_crpt[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:313
#define ISISCRPT_MAX_FNAMELEN
Definition: isiscrpt.h:23
int getPeriodSize() const
Definition: isiscrpt.h:658
int getNumSpectra(bool include_spectrum_zero=false) const
Definition: isiscrpt.cpp:926
long update_period_sequence
Definition: isiscrpt.h:379
int code[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:304
int udet[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:315
char log_data[ISISCRPT_LOG_MAXLINES][ISISCRPT_LOG_LINELEN]
Definition: isiscrpt.h:429
int64_t update_total_counts
Definition: isiscrpt.h:375
md5checksum_t checksum
Definition: isiscrpt.h:80
float update_good_uamph
Definition: isiscrpt.h:372
int spectrumCardPos(int spec) const
Definition: isiscrpt.h:810
#define ISISCRPT_INST_ABRV_LEN
Definition: isiscrpt.h:32
LONGLONG proc_freq
Definition: isiscrpt.h:486
int auto_save_count
Definition: isiscrpt.h:289
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...
Definition: isiscrpt.h:577
float sample_phi_angle
Definition: isiscrpt.h:422
#define ISISCRPT_MAX_DC
Definition: isiscrpt.h:26
double veto_percent
Definition: isiscrpt.h:208
isisU32_t frames
frames vetoed if enabled
Definition: isiscrpt.h:117
float rtcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
Definition: isiscrpt.h:344
#define ISISCRPT_INSTITUTE_NAME_LEN
Definition: isiscrpt.h:36
char field_label[256]
Definition: isiscrpt.h:398
float update_raw_uamph
Definition: isiscrpt.h:371
int modn[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:308
isisU32_t good_ppp_high
Definition: isiscrpt.h:165
float beams
synchrottron
Definition: isiscrpt.h:190
unsigned total_frames
total up to last pause
Definition: isiscrpt.h:169
float sample_thickness
Definition: isiscrpt.h:412
float sample_height
Definition: isiscrpt.h:411
int tcb_map[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
Definition: isiscrpt.h:345
float last_change
Definition: isiscrpt.h:224
char label[ISISCRPT_PERIOD_LABEL_LEN]
Definition: isiscrpt.h:170
beamlogger_t beamlogger
Definition: isiscrpt.h:490
RUNTABLE wiring_table
Definition: isiscrpt.h:274
int setDAESpecificParameters()
Definition: isiscrpt.cpp:102
bool compareChecksums(const unsigned char *md5sum1, const unsigned char *md5sum2)
Definition: icputils.cpp:313
char lvxml_monitoring[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:435
char lvxml_periods[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:434
#define ISISCRPT_MAX_NTRG
Definition: isiscrpt.h:20
boost::array< float, ISISCRPT_MAX_TCPAR > tcpar
Definition: isiscrpt.h:132
boost::array< int, ISISCRPT_MAX_NUM_DAE *100 > cardpos2index
reverse of dae2cardpos above - turns position into array index. 100 here is DAE2CardPolicy::CRATE_MOD...
Definition: isiscrpt.h:325
char lvxml_tcb[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:432
uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period) const
Definition: isiscrpt.h:624
time_t resume_time
Definition: isiscrpt.h:255
void markUninitialised()
Definition: isiscrpt.h:500
#define ISISCRPT_LOG_LINELEN
Definition: isiscrpt.h:45
int npar
length of tcpar used
Definition: isiscrpt.h:133
char epics_lastread_iso[64]
Definition: isiscrpt.h:492
double offset
Definition: isiscrpt.h:185
int getRealArrayItemHelper(const isisU32_t *raw_data, int raw_data_size, const char *item_name, T *darray, DAEstatus &status) const
Definition: isiscrpt.cpp:796
float last_value
Definition: isiscrpt.h:223
time_t start_time
Definition: isiscrpt.h:254
float tcb_minwidth
Definition: isiscrpt.h:265
RUNTABLE tcb_file
used if TCBRANGE_FILE
Definition: isiscrpt.h:134
static const char * veto_names[]
these names will be used in the NeXus data file, so no spaces and lowercase only
Definition: isiscrpt.h:106
float sample_width
Definition: isiscrpt.h:410
bool isRunning() const
Definition: isiscrpt.h:507
unsigned long isisU32_t
Definition: isisvme_types.h:8
char rcsid[ISISCRPT_MAX_RCSID+1]
Definition: isiscrpt.h:239
int period_output_delay
Definition: isiscrpt.h:403
struct timeb calc_last_time
Definition: isiscrpt.h:462
char period_file[ICP_NAME_LEN]
Definition: isiscrpt.h:253
bool saveMonitorEvents(int monitor_number) const
Definition: isiscrpt.h:589
time_t beam_on_time
Definition: isiscrpt.h:200
int getCharItem(const char *item_name, std::string &cvalue, DAEstatus &status) const
Definition: isiscrpt.cpp:228
int shutter
0 = closed, 1 = open
Definition: isiscrpt.h:197
char alert_email[1024]
Definition: isiscrpt.h:478
int clock_frequency
Definition: isiscrpt.h:261
RUNTABLE spectra_table
Definition: isiscrpt.h:275
int output
logic output value
Definition: isiscrpt.h:158
int mode
must be a TCBRANGE_* define
Definition: isiscrpt.h:129
#define ISISCRPT_MAX_DETECTOR
Definition: isiscrpt.h:14
int auto_save_type
Definition: isiscrpt.h:286
time_t start_time
first time period started
Definition: isiscrpt.h:159
isisU32_t good_ppp_low
Definition: isiscrpt.h:164
int spaceTrimCopy(char *output, int output_size, const char *input, int input_size)
Definition: isiscrpt.cpp:161
int mpos[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:309
float total_uamph
Definition: isiscrpt.h:281
int muonkicker
0 = off, 1 = on
Definition: isiscrpt.h:198
unsigned good_frames
Definition: isiscrpt.h:278
int crate
Definition: isiscrpt.h:180
char scaled_units[64]
Definition: isiscrpt.h:179
char instrument_xml_file[ISISCRPT_MAX_FNAMELEN]
Definition: isiscrpt.h:445
boost::array< int, ISISCRPT_MAX_MONITOR > monp
Definition: isiscrpt.h:296
boost::array< int, ISISCRPT_MAX_DC > dae2cardpos
detector card positions, length ndetcard
Definition: isiscrpt.h:324
bool hasFileChanged(DAEstatus &status) const
Definition: isiscrpt.h:85
int spacePadCopyVa(char *output, int output_size, const char *format,...)
Definition: isiscrpt.cpp:142
#define ISISCRPT_PERIOD_LABEL_LEN
Definition: isiscrpt.h:37
long update_period
Definition: isiscrpt.h:378
bool beam_on
Definition: isiscrpt.h:201
int fileTR(int tr) const
file_tr same as crpt_tr for now
Definition: isiscrpt.h:762
int dae2specmap[ISISCRPT_MAX_DC][ISISCRPT_MAX_DC_DETECTOR]
give spectrum number from dae2 card and dae2 spec number
Definition: isiscrpt.h:328
float aperture2
Definition: isiscrpt.h:409
#define TCBRANGE_FILE
read from file
Definition: isiscrpt.h:119
float beam_centre_x
Definition: isiscrpt.h:406
int compression_block_size
Definition: isiscrpt.h:481
int dae_status
Definition: isiscrpt.h:212
static bool tcbRangesPurelyShifted(const TCBRANGE &t1, const TCBRANGE &t2)
Definition: isiscrpt.h:137
char beamstop_position[16]
Definition: isiscrpt.h:414
int requested_frames
Definition: isiscrpt.h:157
long update_raw_frames
Definition: isiscrpt.h:377
float beamt
for appropriate target
Definition: isiscrpt.h:192
void markInitialised()
Definition: isiscrpt.h:499
time_t time
update time
Definition: isiscrpt.h:203
int timr_dae[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:312
int persize
size of a period in 32bit words
Definition: isiscrpt.h:348
#define TCBRANGE_SHIFTED
pure shift from an existing range
Definition: isiscrpt.h:124
#define ISISCRPT_MAX_DATADAE
Definition: isiscrpt.h:41
boost::array< int, ISISCRPT_MAX_NTRG > spec_min
range of spectrum numbers in CRPT time regime
Definition: isiscrpt.h:335
long update_duration
Definition: isiscrpt.h:382
float tthe[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:305
struct timeb update_time
Definition: isiscrpt.h:365
time_t crpt_unload_time
time CRPT loaded
Definition: isiscrpt.h:246
boost::array< VETO, ISISCRPT_NUM_VETOS > vetos
Definition: isiscrpt.h:360
int monitor_spectrum
Definition: isiscrpt.h:298
bool repr_normal
running at 40/50Hz if TS1, or 10Hz or TS2
Definition: isiscrpt.h:195
char lvxml_dae[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:431
char institute[ISISCRPT_INSTITUTE_NAME_LEN+1]
Definition: isiscrpt.h:354
#define ISISCRPT_MAX_MONITOR
Definition: isiscrpt.h:16
#define TR_EVENT_MOD
used to pull out the event mode specific bit from a time regimne definition
Definition: isiscrpt.h:744
char user_id[128]
Definition: isiscrpt.h:357
isisU32_t update_good_frames_period
Definition: isiscrpt.h:380
int spectrumDAETR(int spec) const
Definition: isiscrpt.h:799
size_t file_size
Definition: isiscrpt.h:79
isisU32_t good_ppp_high
Definition: isiscrpt.h:283
int repr
for appropriate target
Definition: isiscrpt.h:194
data_dae_t data_dae[ISISCRPT_MAX_DATADAE]
Definition: isiscrpt.h:474
char user_email[128]
Definition: isiscrpt.h:355
isisU32_t total_ppp_high
Definition: isiscrpt.h:285
char temperature_label[256]
Definition: isiscrpt.h:399
int channelLookup(int from_chan, int from_tr, int to_tr, float tof_val) const
Definition: isiscrpt.cpp:985
int buildTimeRegimeMap()
Definition: isiscrpt.cpp:968
int auto_save_value
Definition: isiscrpt.h:287
float delt[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:302
int number
Definition: isiscrpt.h:230
isisU32_t total_ppp_high
Definition: isiscrpt.h:167
int nperseq_request
Definition: isiscrpt.h:260
float beam_current
Definition: isiscrpt.h:374
boost::array< int, ISISCRPT_MAX_MONITOR > save_monitor_events
whether to save monitor events in event mode (size NMON)
Definition: isiscrpt.h:297
int cardIndexFromPos(int pos) const
Definition: isiscrpt.h:727
int getRealItem(const char *item_name, double &dblVal, DAEstatus &status) const
Definition: isiscrpt.cpp:391
#define ISISCRPT_LOG_MAXLINES
Definition: isiscrpt.h:44
int dae_type
time CRPT unloaded (may not be set if program crashed)
Definition: isiscrpt.h:247
char long_title[ISISCRPT_TITLE_LEN+1]
Definition: isiscrpt.h:350
void calculateCRPTOffsets()
Definition: isiscrpt.h:665
int shutter_val
Definition: isiscrpt.h:210
long update_good_frames
Definition: isiscrpt.h:376
char measurement_id[ICP_NAME_LEN]
Definition: isiscrpt.h:437
int spectrumToMonitorNumber(int spec) const
return monitor number, or 0 if not monitor
Definition: isiscrpt.h:607
boost::array< unsigned, ISISCRPT_MAX_MONITOR > monitor_sum
Definition: isiscrpt.h:300
float tcb_mintime
Definition: isiscrpt.h:266
char name[256]
Definition: isiscrpt.h:177
time_t stop_time
Definition: isiscrpt.h:256
static const char * runstatus_names[]
Definition: isiscrpt.h:57
bool isEventTR(int tr) const
Definition: isiscrpt.h:767
isisU32_t update_raw_frames_period
Definition: isiscrpt.h:381
char journal_blocks[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:443
RUNTABLE detector_table
Definition: isiscrpt.h:273
float angle_of_incidence
Definition: isiscrpt.h:421
void eventModeCards(int &ndetcard_event, int &ndetcard_used) const
Definition: isiscrpt.h:826
int daq_period
DAQ period number (set to -1 if DWELL or UNUSED as not relevant )
Definition: isiscrpt.h:156
int tcb[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TIMECHANB]
Definition: isiscrpt.h:343
#define ISISCRPT_INST_LEN
Definition: isiscrpt.h:31
int wait_status
Definition: isiscrpt.h:211
isisU32_t update_good_ppp_high
Definition: isiscrpt.h:368
isisU32_t update_total_ppp_high
Definition: isiscrpt.h:370
unsigned char md5checksum_t[16]
Definition: icputils.h:303
LONGLONG perf_counter
Definition: isiscrpt.h:485
boost::array< int, ISISCRPT_MAX_NTRG > tcb_trdelay
Definition: isiscrpt.h:270
FrameSync
Definition: isiscrpt_types.h:5
int spec[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:301
float chopper_opening_angle
Definition: isiscrpt.h:415
unsigned total_frames
Definition: isiscrpt.h:279
char fname[ISISCRPT_MAX_FNAMELEN]
Definition: isiscrpt.h:81
Definition: isiscrpt.h:114
static const char * crpt_rcsid
Definition: isiscrpt.h:7
char instrument_parameter_map_file[ISISCRPT_MAX_FNAMELEN]
Definition: isiscrpt.h:446
bool isMonitorSpectrum(int spec) const
Definition: isiscrpt.h:619
unsigned epics_lastread_nano
Definition: isiscrpt.h:493
#define ISISCRPT_MAX_DC_DETECTOR
Definition: isiscrpt.h:15
int spectrumGroup(int spec) const
Definition: isiscrpt.h:815
boost::array< int, ISISCRPT_MAX_NTRG > ntcr
Definition: isiscrpt.h:339
float update_npratio_current
Definition: isiscrpt.h:424
int getRealArrayItemSize(const char *item_name, int *dims_array, int &ndims, DAEstatus &status) const
Definition: isiscrpt.cpp:519
boost::array< int, ISISCRPT_MAX_MONITOR > mdet
Definition: isiscrpt.h:295
isisU32_t good_ppp_low
Definition: isiscrpt.h:282
#define RUNSTATUS_RUNNING
Definition: isiscrpt.h:50
char isis_cycle[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:444
int shutter_status
Definition: isiscrpt.h:213
double eventModeCardFraction() const
Definition: isiscrpt.h:844
char sample_name[256]
Definition: isiscrpt.h:397
float ts_total
since midnight for appropriate target
Definition: isiscrpt.h:196
float good_uamph
Definition: isiscrpt.h:280
FILETIME filetime
Definition: isiscrpt.h:487
isisU32_t total_ppp_low
Definition: isiscrpt.h:166
int getRealArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, double *darray, DAEstatus &status) const
Definition: isiscrpt.cpp:775
const char * runStatusName() const
Definition: isiscrpt.h:508
float foe_mirror_angle
Definition: isiscrpt.h:413
int spectrumCRPTTR(int spec) const
Definition: isiscrpt.h:794
int update_poll_time
Definition: isiscrpt.h:366
unsigned good_frames
total up to last pause
Definition: isiscrpt.h:168
md5checksum_t tcb_xml_checksum
Definition: isiscrpt.h:388
isisU32_t update_good_ppp_low
Definition: isiscrpt.h:367
int dae1SpecForCard(int pos, int dae2_spec) const
if spectrum is out of range, returns -1
Definition: isiscrpt.h:684
char inst_abrv[ISISCRPT_INST_ABRV_LEN+1]
Definition: isiscrpt.h:352
char icp_version[ICP_NAME_LEN]
Definition: isiscrpt.h:241
char user_telephone[128]
Definition: isiscrpt.h:356
md5checksum_t dae_xml_checksum
Definition: isiscrpt.h:387
char comp_name[MAX_COMPUTERNAME_LENGTH+1]
Definition: isiscrpt.h:477
double wait_mins
Definition: isiscrpt.h:209
VetoNames
Definition: isiscrpt.h:93
int dae1SpecForCardIndex(int index, int dae2_spec) const
Definition: isiscrpt.h:701
int udetFromSpec(int spec) const
Definition: isiscrpt.h:601
boost::array< PERIOD, ISISCRPT_MAX_PERIOD > period
Definition: isiscrpt.h:258
int crat[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:307
float good_uamph
total up to last pause
Definition: isiscrpt.h:162
time_t icp_start_time
Definition: isiscrpt.h:244
#define ISISCRPT_TITLE_LEN
Definition: isiscrpt.h:33
bool isInitialised()
Definition: isiscrpt.h:501
double scale
Definition: isiscrpt.h:184
#define ISISCRPT_MAX_LVXML_SIZE
Definition: isiscrpt.h:233
bool checkCRPT() const
Definition: isiscrpt.h:528
int timr_file[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:314
char sample_type[80]
Definition: isiscrpt.h:417
bool isEventSpectrum(int spec) const
Definition: isiscrpt.h:821
char measurement_type[ICP_NAME_LEN]
Definition: isiscrpt.h:439
char raw_units[64]
Definition: isiscrpt.h:178
TCBRANGE tcr[ISISCRPT_MAX_NTRG][ISISCRPT_MAX_TCR]
Definition: isiscrpt.h:338
boost::array< int, ISISCRPT_MAX_NTRG > ntc
number of time channels per CRPT time regime
Definition: isiscrpt.h:346
float monitor_range[ISISCRPT_MAX_MONITOR][2]
Definition: isiscrpt.h:299
float count_rate
Definition: isiscrpt.h:385
bool usingEventMode() const
Definition: isiscrpt.h:858
boost::array< int, ISISCRPT_MAX_DC > dae2highspec
length ndetcard
Definition: isiscrpt.h:327
time_t duration
Definition: isiscrpt.h:257
char user_name[ISISCRPT_USER_NAME_LEN+1]
Definition: isiscrpt.h:353
int simpleChannelRebin(int from_chan, int from_tr, int to_tr) const
Definition: isiscrpt.cpp:1015
boost::array< int, ISISCRPT_MAX_DETECTOR > spec_to_crpt_offset
maps spectrum number to offset in raw data of crpt
Definition: isiscrpt.h:317
char inst_name[ISISCRPT_INST_LEN+1]
Definition: isiscrpt.h:351
bool valid
Definition: isiscrpt.h:202
int crptTR(int tr) const
Definition: isiscrpt.h:756
int ts
1 for ts1, 2 for ts2
Definition: isiscrpt.h:191
boost::array< int, ISISCRPT_MAX_DC > dae2cardmode
-1 unused, 0 histogram, 1 event. length ndetcard
Definition: isiscrpt.h:323
isisU32_t total_ppp_low
Definition: isiscrpt.h:284
float t_high
Definition: isiscrpt.h:222
char lvxml_update[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:433
char sample_id[ICP_NAME_LEN]
Definition: isiscrpt.h:440
char sample_orientation[256]
Definition: isiscrpt.h:396
boost::array< int, ISISCRPT_MAX_DETECTOR > spec_to_index
maps spectrum number to index into spec,udet,timr etc arrays in crpt
Definition: isiscrpt.h:316
Monitoring monitoring
Definition: isiscrpt.h:472
int data_bytes
Definition: isiscrpt.h:183
#define ICP_NAME_LEN
Definition: isiscrpt.h:39
float end
Definition: isiscrpt.h:131
static void splitItemName(const std::string &sitem_name, SplitItem &split_item)
Definition: isiscrpt.cpp:908
PeriodSetupSource
Definition: isiscrpt.h:100
RUNTABLE data_dae_table
Definition: isiscrpt.h:276
void setInstName(const std::string &comp_name)
Definition: isiscrpt.cpp:1068
int auto_save_last
Definition: isiscrpt.h:288
#define ISISCRPT_MAX_TIMECHANB
Definition: isiscrpt.h:17
char measurement_subid[ICP_NAME_LEN]
Definition: isiscrpt.h:438
float update_npratio_average
Definition: isiscrpt.h:425
char local_contact[ISISCRPT_USER_NAME_LEN+1]
Definition: isiscrpt.h:358
long update_duration_period
Definition: isiscrpt.h:383
int daeTRForCard(int pos) const
Definition: isiscrpt.h:710
isisU32_t update_total_ppp_low
Definition: isiscrpt.h:369
char instrument_geometry[5]
Definition: isiscrpt.h:401
float total_uamph
total up to last pause
Definition: isiscrpt.h:163
int tcb_pulse_generator
Definition: isiscrpt.h:272
float tcb_maxtime
Definition: isiscrpt.h:267
float aperture1
Definition: isiscrpt.h:408
FrameSync tcb_sync
Definition: isiscrpt.h:271
int getHighestSpectrumNumber() const
Definition: isiscrpt.cpp:957
unsigned long crpt_size
Definition: isiscrpt.h:243
float len2[ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:303
int randomisedChannelRebin(int from_chan, int from_tr, int to_tr) const
Definition: isiscrpt.cpp:1045
int getIntItem(const char *item_name, long &lVal, DAEstatus &status) const
Definition: isiscrpt.cpp:233
float ut[ISISCRPT_MAX_USER *ISISCRPT_MAX_DETECTOR]
Definition: isiscrpt.h:306
time_t mod_time
Definition: isiscrpt.h:78
#define ISISCRPT_MAX_USER
Definition: isiscrpt.h:18
int spectrumNTC(int spec) const
Definition: isiscrpt.h:804
int makeEventTRValue(int dae_tr, int crpt_tr, int file_tr) const
file_tr ignored for now
Definition: isiscrpt.h:773
int getIntArrayItemSize(const char *item_name, int *dims_array, int &ndims, DAEstatus &status) const
Definition: isiscrpt.cpp:432
std::string item
Definition: isiscrpt.h:229
struct ISISCRPT_STRUCT::@9 icp_clock
#define ISISCRPT_MAX_RCSID
Definition: isiscrpt.h:24
#define ISISCRPT_USER_NAME_LEN
Definition: isiscrpt.h:35
int daeTR(int tr) const
Definition: isiscrpt.h:749
char expression[ISISCRPT_MAX_LVXML_SIZE]
Definition: isiscrpt.h:454
time_t duration
total data collection time in periods (seconds)
Definition: isiscrpt.h:161
float beam_centre_y
Definition: isiscrpt.h:407
boost::array< int, ISISCRPT_MAX_NTRG > nsp
number of spectra per CRPT time regime
Definition: isiscrpt.h:334
char script_name[ICP_NAME_LEN]
Definition: isiscrpt.h:441
boost::array< int, ISISCRPT_MAX_DETECTOR > det_group
0 = monitor, else logical det number
Definition: isiscrpt.h:318
int update_num_polls
Definition: isiscrpt.h:373
boost::array< int, ISISCRPT_MAX_NTRG > spec_max
range of spectrum numbers in CRPT time regime
Definition: isiscrpt.h:336
int software_period
Definition: isiscrpt.h:250
int spacePadCopy(char *output, const char *input, int output_size)
Definition: isiscrpt.cpp:127
boost::array< int, ISISCRPT_NUM_FC_VETO > fermi_chopper_width
in 20ns
Definition: isiscrpt.h:391
int muon_cerenkov_pulse
Definition: isiscrpt.h:402
#define ISISCRPT_MAX_TCR
Definition: isiscrpt.h:21
boost::array< int, ISISCRPT_MAX_DC > dae2cardtr
detector card DAE time regime (-1 if card not used), length ndetcard - individual spectra on card may...
Definition: isiscrpt.h:322
int sav_file_count
Definition: isiscrpt.h:363
int compression_level
Definition: isiscrpt.h:480
nagios_t nagios
Definition: isiscrpt.h:491
int enabled
1 = enabled, 0 = disabled
Definition: isiscrpt.h:116
boost::array< monitoring_par, MAX_MONITORING_PAR > par_type
Definition: isiscrpt.h:452
int type
0=unused, 1=DAQ, 2=DWELL
Definition: isiscrpt.h:155
time_t beam_off_time
Definition: isiscrpt.h:199
int fullTR(int index) const
Definition: isiscrpt.h:778
DAEType
Definition: isisdae.h:63
float start
Definition: isiscrpt.h:130