StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daq_emc.h
1 #ifndef _DAQ_EMC_H_
2 #define _DAQ_EMC_H_
3 
4 
5 #include <DAQ_READER/daq_det.h>
6 #include <stdio.h>
7 
8 
9 //BARREL TOWER constants
10 #define BTOW_MAXFEE 30
11 #define BTOW_PRESIZE 4
12 #define BTOW_DATSIZE 160
13 
14 //BARREL SMD constants
15 #define BSMD_FIBERS 12
16 #define BSMD_DATSIZE 4800
17 
18 // ENDCAP Tower constants; from Piotr
19 #define ETOW_MAXFEE 6
20 #define ETOW_PRESIZE 4
21 #define ETOW_DATSIZE 160
22 
23 // ENDACP ESMD
24 #define ESMD_MAXFEE 48 // used to be 30
25 #define ESMD_PRESIZE 4
26 #define ESMD_DATSIZE 192
27 
28 
29 #define EMC_PED_VERSION 0x01
30 
31 
32 struct emc_ped_t {
33  u_char crate_id ; //1..48
34  u_char ch_cou ; //160; 192
35  u_char version ; //for alignment
36  u_char dummy0 ; //ibid
37 
38  struct {
39  float rms ;
40  float ped ;
41  } ped[0] ;
42 } ;
43 
45  u_char rts_id ; //ETOW, BTOW, ESMD
46  u_char crate_cou ; //6, 30, 48
47  u_char version ;
48  u_char dummy ;
49  struct emc_ped_t crates[0] ;
50 } ;
51 
52 struct emc_t {
53  u_char btow_in ;
54  u_short btow_max_ch ;
55  u_short btow_ch ;
56  u_short btow[4800] ;
57  u_short *btow_raw ;
58  // added later
59  u_short btow_new[BTOW_MAXFEE][BTOW_DATSIZE] ;
60  u_short btow_pre[BTOW_MAXFEE][BTOW_PRESIZE] ;
61 
62  u_char bsmd_in ;
63  u_short bsmd_max_ch ;
64  u_short bsmd_ch ;
65  u_short bsmd[12][4800] ; // Nov 2, 2004 - extended from 8 to 12 to encompass the BPRE
66 #if 0
67  // Both raw and zs banks will _not_ be present in the legacy. This is to observe backwards compatibility.
68  // However, variable bsmd_raw_in will tell you what data it came from.
69  // Use the non-legacy for BSMD readers in case you need this.
70 
71  u_short bsmd_raw[12][4800] ; // Sep 2008 -- this bank is filled from the raw,non-zerosuppressed data
72  // if the event contained both the ZS & NZS bank!
73 #endif
74  u_char bsmd_raw_in ; // flag for above!
75  u_char bsmd_cap[12] ; // capacitor value...
76 
77 
78  // ENDCAP TOWERS
79  u_char etow_in ; // in this event?
80  u_short etow_max_ch ; // constant ETOW_MAXFEE * ETOW_DATSIZE
81 
82  u_short etow_ch ; // channels above zero
83  u_short etow[ETOW_MAXFEE][ETOW_DATSIZE] ; // ADC data...
84  u_short etow_pre[ETOW_MAXFEE][ETOW_PRESIZE]; // ETOW preamble
85  u_short *etow_raw ; // pointer to the beginning of rawdata; raw data is little endian
86 
87 
88 
89  // ENDCAP Showermax & preshower(?)
90  u_char esmd_in ; // in this event?
91  u_short esmd_max_ch ; // 48 * 192
92  u_short esmd_ch ; // channels above 0
93  u_short esmd_max_fee ; // ESMD_MAXFEE changed between FY04 and FY05...
94  u_short esmd[ESMD_MAXFEE][ESMD_DATSIZE] ; // ADC data
95  u_short esmd_pre[ESMD_MAXFEE][ESMD_PRESIZE]; // ESMD preamble
96  u_short *esmd_raw ; // pointer to the beginning of raw data; raw data is little endian
97 
98 
99 } ;
100 
101 extern char *getEmcTrgData(char *input, int idx, int *bytes) ;
102 extern char *emc_single_reader(char *e, int *bytes, int rts_id) ;
103 
104 extern int emc_reader(char *m, struct emc_t *emc, u_int driver, int rts_id, char *ptrs[12], int bytes[12]) ;
105 
106 
107 
108 class daq_emc : public daq_det {
109 private:
110  class daq_dta *handle_legacy() ;
111  class daq_dta *handle_pedrms() ;
112 
113  class daq_dta *legacy ; // "legacy" bank
114  class daq_dta *pedrms ;
115 
116  static const char *help_string ;
117 protected:
118 
119  int Make() ;
120 
121 public:
122  daq_emc(daqReader *rts_caller=0) ;
123  ~daq_emc() ;
124 
125 
126  daq_dta *get(const char *bank="*",int c1=-1, int c2=-1, int c3=-1, void *p1=0, void *p2=0) ;
127 
128  void help() const {
129  printf("%s\n%s\n",GetCVS(),help_string) ;
130  }
131 
132  const char *GetCVS() const { // Offline
133  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs;
134  }
135 
136 } ;
137 
138 
139 #endif // _DAQ_EMC_H_
Definition: daq_emc.h:52
u_short * esmd_raw
ESMD preamble.
Definition: daq_emc.h:96
u_short esmd_pre[ESMD_MAXFEE][ESMD_PRESIZE]
ADC data.
Definition: daq_emc.h:95