StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daq_fgt.h
1 #ifndef _DAQ_FGT_H_
2 #define _DAQ_FGT_H_
3 
4 
5 #include <DAQ_READER/daq_det.h>
6 
7 // logical maps
8 // represent the _maximums_ over any APV-type detector: FGT, GMT, IST...
9 
10 #define FGT_RDO_COU 6 // aka ARC; but counts from 1..6
11 #define FGT_ARM_COU 6 // from 0..5
12 #define FGT_APV_COU 24 // from 0..23
13 #define FGT_CH_COU 128 // from 0..127
14 #define FGT_TB_COU 31 // from 0..30
15 
16 #define FST_ARM_COU 3
17 #define FST_TB_COU 9
18 
19 /*
20 #define FGT_CH_STAT_SHOULD 0x01 // exists in hardware
21 #define FGT_CH_STAT_NO_CONFIG 0x02 // killed in RC or config file
22 #define FGT_CH_STAT_NO_RESPONSE 0x04 // killed in ARS_configure, non responding CH
23 #define FGT_CH_STAT_BAD 0x08 // killed in bad_channel
24 */
25 
26 // when asking for the "adc" or "phys"bank
27 struct fgt_adc_t {
28  unsigned short ch ;
29  unsigned char tb ;
30  unsigned char flags ; // FST specific
31  short adc ;
32 } ;
33 
34 
35 struct fgt_pedrms_t {
36  unsigned short ch ;
37  unsigned char tb ;
38  float ped ;
39  float rms ;
40 
41  float cmn_rms ; // FST specific
42 } ;
43 
44 struct apv_meta_t {
45  u_int version ;
46 
47  struct {
48  char present ;
49  char error ;
50 
51  int format_code ;
52  int arm_mask ;
53 
54  struct {
55  char present ;
56  char error ;
57 
58  int arm_id ;
59  int arm_seq ;
60  int arm_err ;
61  int apv_mask ;
62 
63  struct {
64  char present ;
65  char error ;
66 
67  int apv_id ;
68  int fmt ;
69  int length ;
70  int seq ;
71  int capid ;
72  int nhits ;
73  int is_error ;
74  int refadc ;
75  int ntim ;
76 
77  } apv[FGT_APV_COU] ; // from 0..23
78 
79  } arm[FGT_ARM_COU] ; // from 0..23...
80 
81  } arc[FGT_RDO_COU+1] ; // or RDO; from 1..6
82 
83 } ;
84 
85 const short META_ZS_VERSION = 0x0001 ;
86 const short META_PED_ZS_VERSION = 0x0101 ;
87 
88 struct apv_meta_zs_t { // used in the header of the ZS bank
89  u_char tb_cou ;
90 
91  u_char status[FGT_ARM_COU][FGT_APV_COU] ; // bits: 1 present; 2 error
92 } ;
93 
94 
95 class daq_fgt : public daq_det {
96 private:
97  class daq_dta *handle_raw(int sec, int rdo) ;
98  class daq_dta *handle_ped(int sec, int rdo) ;
99 
100  class daq_dta *raw ; // "raw"
101  class daq_dta *adc ; // "adc"
102  class daq_dta *ped ; // "ped"
103  class daq_dta *zs ; // "zs"
104 
105  static const char *help_string ;
106 
107 protected:
108 
109 
110 public:
111  daq_fgt(daqReader *rts_caller=0) ;
112  ~daq_fgt() ;
113 
114  struct apv_meta_t apv_meta ;
115 
116  void set_flavor(int id) ;
117 
118  daq_dta *get(const char *bank="*",int c1=-1, int c2=-1, int c3=-1, void *p1=0, void *p2=0) ;
119 
120  int get_l2(char *buff, int buff_bytes, struct daq_trg_word *trg, int prompt) ;
121 
122  const char *GetCVS() const { // Offline
123  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs;
124  }
125 
126 
127  class daq_dta *handle_adc(int sec, int rdo, char *rdobuff = 0 ) ;
128  class daq_dta *handle_zs(int sec, int rdo, char *rdobuff = 0, int inbytes = 0 ) ;
129 
130  u_int rdo_warns[7] ; // number of warnings issued, per rdo; count from 1
131  u_char rdo_id[7] ; // for RDO checks in get_l2; count from 1
132  u_int t_data ; // for trg_cmd==1 pattern tests...
133 
134 
135 } ;
136 
137 
138 #endif // _DAQ_FGT_H_