StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daq_fps.h
1 #ifndef _DAQ_FPS_H_
2 #define _DAQ_FPS_H_
3 
4 #include <DAQ_READER/daq_det.h>
5 
6 #define FPS_FORMAT_VERSION 0x000001
7 
8 //#define FPS_VME_PORT 3000
9 
10 
11 //raw data header
12 struct fps_evt_hdr_t {
13  u_int ver ; // version<<8 | (header words)
14  u_int words ; // of the event, including this header
15 
16  u_int ev ; // event counter
17  u_int token ; // trg/daq/token, 20bits
18 
19 
20  u_int xing ;
21 
22  u_char qt_cou ;
23  u_char pre_post_cou ;
24  char status ; // 1 OK; something else otherwise
25  u_char trg_type ;
26 
27  u_int tick ; //at event start, in us
28  int delta ; //in us
29 
30  u_int stp_data[3] ;
31  u_int reserved[2] ;
32 } ;
33 
34 #if 0
35 
36 #define FPS_QT_COU 8
37 #define FPS_QT_MAX_TIMEBINS 41
38 
39 // raw data
40 struct fps_dta_t {
41  char timebin ; // relative to time of trigger!
42  struct {
43  char ix ;
44  char ch_cou ;
45  u_short adc[32] ;
46  u_char tdc[32] ;
47  u_char ch[32] ;
48  } qt[FPS_QT_COU] ;
49 } ;
50 
51 //raw data event
52 struct fps_evt_t {
53  fps_evt_hdr_t hdr ;
54  fps_dta_t xing[FPS_QT_MAX_TIMEBINS] ;
55 };
56 #endif
57 
58 
59 // transformed to ADC data
60 struct fps_adc_t {
61  u_char ch ;
62  u_char tdc ;
63  u_short adc ;
64 } ;
65 
66 struct fps_config_t {
67  u_int run_type ; //3:physics, 1:pedestal
68  u_int ped_mode ; //1:do zs, 0:no zs
69  u_int qt_mask ;
70  u_int pre ;
71  u_int post ;
72  u_int log_level ; // tonkoLogLevel thing
73  u_int run_number ;
74 
75  u_int trg_type ; //2:pulser, 4:coinc, 0x1000:STP
76  u_int rcc_required ;
77  u_int events_required ;
78  u_int qt_cou ;
79 
80  u_int reserved[27] ;
81 
82 };
83 
84 #define FPS_PED_VERSION 0x0
85 
86 struct fps_pedrms_t {
87  u_char version ;
88  u_char qt_ix ; //0..7
89  u_char ch_cou ; //32
90 
91  struct {
92  float ped ;
93  float rms ;
94  u_char flag ; //1=error
95  } ped[32] ;
96 } ;
97 
98 
99 class daq_fps : public daq_det {
100 private:
101  class daq_dta *handle_raw(int sec) ;
102  class daq_dta *handle_pedrms(int sec) ;
103  class daq_dta *handle_adc(int sec) ;
104 
105  class daq_dta *raw ;
106  class daq_dta *adc ;
107  class daq_dta *pedrms ;
108 
109  static const char *help_string ;
110 
111 public:
112  daq_fps(daqReader *rts_caller=0) ;
113  ~daq_fps() ;
114 
115  daq_dta *get(const char *bank="*",int c1=-1,int c2=-1,int c3=-1, void *p1=0, void *p2=0) ;
116 
117  int get_l2(char *addr, int words, struct daq_trg_word *trg, int rdo) ;
118 
119 
120  // this is the meta data, overwritten per sector!
121  struct fps_evt_hdr_t meta_hdr ;
122 
123  const char *GetCVS() const {
124  static const char cvs[] = "Tag $Name: $Id built " __DATE__ " " __TIME__ ; return cvs ;
125  }
126 } ;
127 
128 #endif