StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daqFormats.h
1 #ifndef _DAQ_FORMATS_H
2 #define _DAQ_FORMATS_H
3 
4 #ifdef VXWORKS
5 #include <vxWorks.h>
6 #else
7 typedef unsigned int UINT32 ;
8 typedef unsigned short UINT16 ;
9 typedef unsigned char UINT8 ;
10 #endif
11 
12 #include <SECTOR/sector.h> // for the size constants
13 
14 // Don't kill everybody else while John & Jeff work on trigger structs...
15 //#ifndef TRG_VERSION
16 //#define TRG_VERSION 0x32
17 //#endif
18 
19 #if (TRG_VERSION == 0x20)
20 #include <TRG/trgStructures_20.h>
21 #elif (TRG_VERSION == 0x12)
22 #include <TRG/trgStructures-Jan2002.h>
23 #elif (TRG_VERSION == 0x21)
24 #include <TRG/trgStructures_21.h>
25 #elif (TRG_VERSION == 0x22)
26 #include <TRG/trgStructures_v22.h>
27 #elif (TRG_VERSION == 0x30)
28 #include <TRG/trgStructures_30.h>
29 #elif (TRG_VERSION == 0x32)
30 #include <trgStructures_32.h>
31 #else // after version 0x40, no TRGD
32 #define NOTRGD
33  #if (TRG_VERSION == 0x40)
34  #include <trgDataDefs_40.h>
35  #elif (TRG_VERSION == 0x41)
36  #include <trgDataDefs_41.h>
37  #elif (TRG_VERSION == 0x42)
38  #include <trgDataDefs_42.h>
39  #elif (TRG_VERSION == 0x43)
40  #include <trgDataDefs_43.h>
41  #elif (TRG_VERSION == 0x44)
42  #include <trgDataDefs_44.h>
43  #elif (TRG_VERSION == 0x45)
44  #include <trgDataDefs_45.h>
45  #elif (TRG_VERSION == 0x46)
46  #define TRG_VERSION 0x46
47  #include <trgDataDefs_46.h>
48  #else
49  #define TRG_VERSION 0x47
50  #include <trgDataDefs_47.h>
51  #endif
52 #endif
53 
54 #define FMT_ADCD (1 << 0)
55 #define FMT_ADCR (1 << 1)
56 #define FMT_ADCHUF (1 << 2)
57 #define FMT_CPPR (1 << 3)
58 #define FMT_CLD (1 << 4)
59 
60 #define FMT_PADK (1 << 5)
61 #define FMT_SEQD (1 << 6)
62 #define FMT_ADCX (1 << 7)
63 
64 #define FMT_NOT_FREE (FMT_ADCR | FMT_ADCD | FMT_ADCHUF)
65 
66 #define FMT_PEDR (1 << 8)
67 #define FMT_RMSR (1 << 9)
68 #define FMT_GAINR (1 << 10)
69 #define FMT_BADR (1 << 11)
70 #define FMT_CFGR (1 << 12)
71 #define FMT_NONE (1 << 13)
72 
73 
74 // Version below corresponds to "DAQ Raw Data Format" document's version
75 // changed from:
76 //#define DAQ_RAW_FORMAT_VERSION 0x00020002 // 2.2
77 // on April 14, 2002. Tonko
78 #define DAQ_RAW_FORMAT_VERSION 0x00020003 // 2.30
79 
80 
81 #define DAQ_RAW_FORMAT_ORDER 0x04030201
82 
83 // changed from
84 //#define DAQ_RAW_FORMAT_WORD9 0x9999c0de
85 // on April 14, 2002. Tonko
86 #define DAQ_RAW_FORMAT_WORD9 0x00000000
87 
88 #define DATAP_FORMAT_NUMBER 1
89 #define SVTP_FORMAT_NUMBER 1
90 #define TPCP_FORMAT_NUMBER 1
91 #define FTPCP_FORMAT_NUMBER 1
92 #define LRHD_FORMAT_NUMBER 1
93 #define TRGP_FORMAT_NUMBER 1
94 #define EMCP_FORMAT_NUMBER 1
95 #define SSDP_FORMAT_NUMBER 1
96 #define TRGID_FORMAT_NUMBER 1
97 #define TPXP_FORMAT_NUMBER 1
98 
99 // ALL the structures and defines that share the same structure types as the TPC
100 // (i.e. SVT, FTPC, SSD) will be called, by definition, TPC_
101 
102 // order in the mezzanine bank
103 #define TPC_ADCD 0
104 #define TPC_SEQD 1
105 #define TPC_ADCX 2
106 #define TPC_PADK 3
107 #define SVT_ANODK 3
108 #define TPC_CPPR 4
109 #define TPC_ADCR 5
110 #define TPC_MZCLD 6
111 #define TPC_CFGR 7
112 #define TPC_PEDR 8
113 #define TPC_RMSR 9
114 #define TPC_GAINR 10
115 #define TPC_GAIND 10
116 #define TPC_BADR 11
117 
118 #define TPC_MZP_BANKS_NUM 12
119 
120 // gloabal character names
121 #define CHAR_LRHD "LRHD "
122 #define CHAR_BEGR "BEGR "
123 #define CHAR_ENDR "ENDR "
124 #define CHAR_DATA "DATA "
125 #define CHAR_SLOW "SLOW "
126 
127 #define CHAR_DATAP "DATAP "
128 #define CHAR_DATAPX "DATAPX "
129 
130 // real TPC names
131 #define CHAR_TPCP "TPCP "
132 
133 #define CHAR_TPCSECLP "TPCSECLP"
134 #define CHAR_TPCRBCLP "TPCRBCLP"
135 #define CHAR_TPCMZCLD "TPCMZCLD"
136 
137 #define CHAR_TPCSECP "TPCSECP "
138 #define CHAR_TPCRBP "TPCRBP "
139 #define CHAR_TPCMZP "TPCMZP "
140 
141 #define CHAR_TPCADCD "TPCADCD "
142 #define CHAR_TPCSEQD "TPCSEQD "
143 #define CHAR_TPCADCX "TPCADCX "
144 #define CHAR_TPCPADK "TPCPADK "
145 #define CHAR_TPCCPPR "TPCCPPR "
146 #define CHAR_TPCADCR "TPCADCR "
147 #define CHAR_TPCCFGR "TPCCFGR "
148 #define CHAR_TPCPEDR "TPCPEDR "
149 #define CHAR_TPCRMSR "TPCRMSR "
150 #define CHAR_TPCGAINR "TPCGAINR"
151 #define CHAR_TPCGAIND "TPCGAIND" // new, sane gain bank
152 #define CHAR_TPCBADR "TPCBADR " // this is obsolete...
153 
154 // real SVT names
155 #define CHAR_SVTP "SVTP "
156 
157 #define CHAR_SVTSECLP "SVTSECLP"
158 #define CHAR_SVTRBCLP "SVTRBCLP"
159 #define CHAR_SVTMZCLD "SVTMZCLD"
160 
161 #define CHAR_SVTSECP "SVTSECP "
162 #define CHAR_SVTRBP "SVTRBP "
163 #define CHAR_SVTMZP "SVTMZP "
164 
165 #define CHAR_SVTADCD "SVTADCD "
166 #define CHAR_SVTSEQD "SVTSEQD "
167 #define CHAR_SVTADCX "SVTADCX "
168 #define CHAR_SVTANODK "SVTANODK"
169 #define CHAR_SVTCPPR "SVTCPPR "
170 #define CHAR_SVTADCR "SVTADCR "
171 #define CHAR_SVTCFGR "SVTCFGR "
172 #define CHAR_SVTPEDR "SVTPEDR "
173 #define CHAR_SVTRMSR "SVTRMSR "
174 #define CHAR_SVTGAINR "SVTGAINR"
175 #define CHAR_SVTBADR "SVTBADR "
176 
177 // real FTP names
178 #define CHAR_FTPP "FTPP "
179 
180 #define CHAR_FTPSECLP "FTPSECLP"
181 #define CHAR_FTPRBCLP "FTPRBCLP"
182 #define CHAR_FTPMZCLD "FTPMZCLD"
183 
184 #define CHAR_FTPSECP "FTPSECP "
185 #define CHAR_FTPRBP "FTPRBP "
186 #define CHAR_FTPMZP "FTPMZP "
187 
188 #define CHAR_FTPADCD "FTPADCD "
189 #define CHAR_FTPSEQD "FTPSEQD "
190 #define CHAR_FTPADCX "FTPADCX "
191 #define CHAR_FTPPADK "FTPPADK "
192 #define CHAR_FTPCPPR "FTPCPPR "
193 #define CHAR_FTPADCR "FTPADCR "
194 #define CHAR_FTPCFGR "FTPCFGR "
195 #define CHAR_FTPPEDR "FTPPEDR "
196 #define CHAR_FTPRMSR "FTPRMSR "
197 #define CHAR_FTPGAINR "FTPGAINR"
198 #define CHAR_FTPBADR "FTPBADR "
199 
200 // real SSD names
201 #define CHAR_SSDP "SSDP "
202 
203 #define CHAR_SSDSECLP "SSDSECLP"
204 #define CHAR_SSDRBCLP "SSDRBCLP"
205 #define CHAR_SSDMZCLD "SSDMZCLD"
206 
207 #define CHAR_SSDSECP "SSDSECP "
208 #define CHAR_SSDRBP "SSDRBP "
209 #define CHAR_SSDMZP "SSDMZP "
210 
211 #define CHAR_SSDADCD "SSDADCD "
212 #define CHAR_SSDSEQD "SSDSEQD "
213 #define CHAR_SSDADCX "SSDADCX "
214 #define CHAR_SSDPADK "SSDPADK "
215 #define CHAR_SSDCPPR "SSDCPPR "
216 #define CHAR_SSDADCR "SSDADCR "
217 #define CHAR_SSDCFGR "SSDCFGR "
218 #define CHAR_SSDPEDR "SSDPEDR "
219 #define CHAR_SSDRMSR "SSDRMSR "
220 #define CHAR_SSDGAINR "SSDGAINR"
221 #define CHAR_SSDBADR "SSDBADR "
222 
223 
224 // real RICH names
225 #define CHAR_RICP "RICP "
226 #define CHAR_RICCRAMP "RICCRAMP"
227 #define CHAR_RICDATAD "RICDATAD"
228 #define CHAR_RICDATAR "RICDATAR"
229 #define CHAR_RICPEDR "RICPEDR "
230 #define CHAR_RICRMSR "RICRMSR "
231 #define CHAR_RICTHRER "RICTHRER"
232 #define CHAR_RICBADR "RICBADR "
233 
234 // real TOF names
235 #define CHAR_TOFP "TOFP "
236 #define CHAR_TOFADCD "TOFADCD "
237 #define CHAR_TOFTDCD "TOFTDCD "
238 #define CHAR_TOFA2DD "TOFA2DD "
239 #define CHAR_TOFSCAD "TOFSCAD "
240 #define CHAR_TOFDDLR "TOFDDLR "
241 
242 // real FPD names
243 #define CHAR_FPDP "FPDP "
244 #define CHAR_FPDADCD "FPDADCD "
245 #define CHAR_FPDTDCD "FPDTDCD "
246 #define CHAR_FPDREGD "FPDREGD "
247 #define CHAR_FPDPEDR "FPDPEDR "
248 #define CHAR_FPDSCL "FPDSCL "
249 // BBC comes under FPDP!
250 #define CHAR_BBCDAT "BBCDAT "
251 #define CHAR_BBCPED "BBCPED "
252 #define CHAR_BBCSCL "BBCSCL "
253 
254 
255 // "new" (2002-2003) FPD
256 #define CHAR_FP2P "FP2P "
257 
258 
259 // real EMC names
260 #define CHAR_EMCP "EMCP "
261 #define CHAR_EMCSECP "EMCSECP "
262 #define CHAR_EMCRBP "EMCRBP "
263 
264 #define CHAR_EMCADCD "EMCADCD "
265 #define CHAR_EMCSEQD "EMCSEQD "
266 #define CHAR_EMCADCX "EMCADCX "
267 #define CHAR_EMCPADK "EMCPADK "
268 #define CHAR_EMCCPPR "EMCCPPR "
269 #define CHAR_EMCADCR "EMCADCR "
270 #define CHAR_EMCCFGR "EMCCFGR "
271 #define CHAR_EMCPEDR "EMCPEDR "
272 #define CHAR_EMCRMSR "EMCRMSR "
273 #define CHAR_EMCGAINR "EMCGAINR"
274 #define CHAR_EMCBADR "EMCBADR "
275 
276 // real EEC names
277 #define CHAR_EECP "EECP "
278 #define CHAR_EECSECP "EECSECP "
279 #define CHAR_EECRBP "EECRBP "
280 
281 #define CHAR_EECADCD "EECADCD "
282 #define CHAR_EECSEQD "EECSEQD "
283 #define CHAR_EECADCX "EECADCX "
284 #define CHAR_EECPADK "EECPADK "
285 #define CHAR_EECCPPR "EECCPPR "
286 #define CHAR_EECADCR "EECADCR "
287 #define CHAR_EECCFGR "EECCFGR "
288 #define CHAR_EECPEDR "EECPEDR "
289 #define CHAR_EECRMSR "EECRMSR "
290 #define CHAR_EECGAINR "EECGAINR"
291 #define CHAR_EECBADR "EECBADR "
292 
293 
294 // PMD
295 #define CHAR_PMDP "PMDP "
296 #define CHAR_PMDSECP "PMDSECP "
297 #define CHAR_PMDADCD "PMDADCD "
298 #define CHAR_PMDRMSR "PMDRMSR "
299 #define CHAR_PMDPEDR "PMDPEDR "
300 #define CHAR_PMDTHRR "PMDTHRR "
301 
302 // trigger
303 #define CHAR_TRGP "TRGP "
304 #define CHAR_TRGD "TRGD "
305 #define CHAR_TRGID "TRGID "
306 
307 // PP2PP
308 #define CHAR_PP2PPP "PP2PPP "
309 #define CHAR_PP2PPR "PP2PPR "
310 
311 #define CHAR_L3P "L3P "
312 
313 // Slow Controls and friends
314 #define CHAR_SCD "SCD "
315 
316 #define CHAR_TPXP "TPXP "
317 
318 /*
319 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && defined(__I960)
320 #pragma align 1
321 #pragma pack 1
322 #endif
323 */
324 
325 
326 // generic section for all of DAQ
327 struct bankHeader {
328  char bank_type[8] ;
329  UINT32 length ;
330  UINT32 bank_id ;
331  UINT32 format_ver ;
332  UINT32 byte_order ;
333  UINT32 format_number ;
334  UINT32 token ;
335  UINT32 w9 ;
336  UINT32 crc ;
337 } ;
338 
340  char bank_type[8] ;
341  UINT32 length ;
342  UINT32 run ;
343  UINT32 format_ver ;
344  UINT32 byte_order ;
345  UINT32 w7 ;
346  UINT32 w8 ;
347  UINT32 w9 ;
348  UINT32 crc ;
349 } ;
350 
351 struct offlen {
352  UINT32 off ;
353  UINT32 len;
354 } ;
355 
356 struct row_pad {
357  UINT8 row ;
358  UINT8 pad ;
359 } ;
360 
361 struct LOGREC {
362  struct logicalHeader lh ;
363  UINT32 length ;
364  UINT32 blocking ;
365  char record_type[8] ;
366  UINT32 crc ;
367 } ;
368 
369 
370 
371 // Tonko, 4/11/2002, Changed the name of the EventDescriptor
372 // structure to EventDescriptor2001 since it is still used
373 // in DATAP (i.e.) for backward compatibility
374 
375 // the EventDescriptor is passed to DAQ from Trigger
376 // Tonko, 7/13/00 noticed that detectorMask and TRG_DAQ_cmds were
377 // swapped in real trigger data. Swapped them!
378 
379 #if defined(UNIX_LITTLE_ENDIAN) || defined(RTS_LITTLE_ENDIAN)
380 struct EventDescriptor2001 {
381  UINT8 format_version;
382  UINT8 tag; // 'E'
383  UINT16 byteCount; // 28
384  UINT32 bx_hi; // Bunch Xing hi 32 bits
385  UINT32 bx_lo; // Bunch Xing lo 32 bits
386  UINT8 detectorMask; // makes the Action Word with TRG_DAQ_cmds
387  UINT8 TRG_DAQ_cmds; // 16*TRG_cmd | DAQ_cmd
388  UINT16 token;
389  UINT16 dsm_address; // address of raw data for this crossing
390  UINT16 dsm_data; // output of last DSM
391  UINT16 TRG_word;
392  UINT8 add_bits; // bit 7 - fake data; bit 6 - L2.5 abort; bit 1 - priority; bit 0 - pileup
393  UINT8 busy; // BUSY at start of this Xing
394  UINT16 npost;
395  UINT16 npre;
396 };
397 #else
399  UINT16 byteCount; // 28
400  UINT8 tag; // 'E'
401  UINT8 format_version;
402  UINT32 bx_hi; // Bunch Xing hi 32 bits
403  UINT32 bx_lo; // Bunch Xing lo 32 bits
404  UINT16 token;
405  UINT8 TRG_DAQ_cmds; // 16*TRG_cmd | DAQ_cmd
406  UINT8 detectorMask; // makes the Action Word with TRG_DAQ_cmds
407  UINT16 dsm_data; // output of last DSM
408  UINT16 dsm_address; // address of raw data for this crossing
409  UINT8 busy; // BUSY at start of this Xing
410  UINT8 add_bits; // bit 7 - fake data; bit 6 - L2.5 abort; bit 1 - priority; bit 0 - pileup
411  UINT16 TRG_word;
412  UINT16 npre;
413  UINT16 npost;
414 } ;
415 #endif
416 
417 typedef struct {
418  unsigned short TCUdataBytes;
419  char TCUEvtDesc;
420  unsigned char TrgDataFmtVer;
421  unsigned int bunchXing_hi;
422  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
423  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
424  unsigned char actionWdTrgCommand; /* from Fifo 1 */
425  unsigned char actionWdDaqCommand; /* from Fifo 1 */
426  unsigned short TrgToken; /* from Fifo 2 */
427  unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */
428  unsigned short DSMInput; /* from Fifo 3 */
429  unsigned short externalBusy; /* from Fifo 3 */
430  unsigned short modifiedBusyStatus; /* from Fifo 4 */
431  unsigned short physicsWord; /* from Fifo 4 */
432  unsigned short TriggerWord; /* from Fifo 5 */
433  unsigned short DSMAddress; /* from Fifo 6 */
434  unsigned short contaminationBusyStatus; /* from Fifo 6 */
435  unsigned short npre; /* pre value for detector raw data */
436  unsigned short npost; /* post value for detector raw data */
437  unsigned short dummy; /* dummy - filler */
438 } EventDescriptor2007; /* 40 bytes total */
439 
440 typedef struct {
441  char name[3]; /* Contains EVD */
442  char TrgDataFmtVer; /* Exception for use by DAQ */
443  int length; /* Byte count of data that follows */
444  unsigned int bunchXing_hi;
445  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
446  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
447  unsigned char actionWdTrgCommand; /* from Fifo 1 */
448  unsigned char actionWdDaqCommand; /* from Fifo 1 */
449  unsigned short TrgToken; /* from Fifo 2 */
450  unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */
451  unsigned short DSMInput; /* from Fifo 3 */
452  unsigned short externalBusy; /* from Fifo 3 */
453  unsigned short modifiedBusyStatus; /* from Fifo 4 */
454  unsigned short physicsWord; /* from Fifo 4 */
455  unsigned short TriggerWord; /* from Fifo 5 */
456  unsigned short DSMAddress; /* from Fifo 6 */
457  unsigned short contaminationBusyStatus; /* from Fifo 6 */
458  unsigned short npre; /* pre value for detector raw data */
459  unsigned short npost; /* post value for detector raw data */
460  unsigned short dummy; /* dummy - filler since this structures must be zero (mod 4) */
461 } EventDescriptor2008a; // pre-new TCU
462 
463 struct DATAP {
464  struct bankHeader bh ;
465  UINT32 len ;
466  UINT32 time ;
467  UINT32 seq ;
468  UINT32 trg_word ;
469  UINT32 trg_in_word ;
470  UINT32 detector ;
471  struct offlen det[10] ; // DET_ID "EXT_ID" points to DATAPX if it exists!
472  UINT32 TRG_L1_summary[2];
473  UINT32 TRG_L2_summary[2];
474  UINT32 L3_Summary[4] ;
475  struct EventDescriptor2001 evtdes ;
476  // total data len is 40 words (header not included)
477 } ;
478 
479 struct DATAPX {
480  struct bankHeader bh ;
481  struct offlen det[22] ; // index 0 is det_id 10 !!!!
482 } ;
483 
484 struct TRGID {
485  struct bankHeader bh ;
486  UINT32 triggerId[32] ; // index is the l3 summary bit.
487 };
488 
489 struct DUMMYDATA {
490  struct bankHeader bh ;
491 } ;
492 
493 struct TPCP {
494  struct bankHeader bh ;
495  struct offlen sb[24] ; // 24 sectors
496 } ;
497 
498 struct TPXP {
499  struct bankHeader bh;
500  struct offlen sb;
501 };
502 
503 struct TPXD {
504  struct bankHeader;
505  UINT32 data[1]; // size is actually variable...
506 };
507 
508 
509 struct TRGP {
510  struct bankHeader bh ;
511  struct offlen trgData ;
512  struct offlen trgId;
513 };
514 
515 
516 #ifndef NOTRGD
517 
518 struct TRGD {
519  struct bankHeader bh ;
520  EvtDescData desc ;
521  TrgSumData sum ;
522  RawTrgDet raw[MAX_RAW_DATA_BLOCKS] ;
523 } ;
524 
525 #endif
526 
527 // Level 3 structures
528 // Level 3 banks - most are defined in file included at end
529 //
530 
531 struct TPCSECLP {
532  struct bankHeader bh ;
533  struct offlen rb[SB_RB_NUM] ;
534 } ;
535 
536 struct TPCRBCLP {
537  struct bankHeader bh ;
538  struct offlen mz[RB_MZ_NUM] ;
539  UINT8 fiberHdr[RB_FIBER_HDR_LEN] ;
540 } ;
541 
542 struct mzCentroid {
543  UINT16 x ;
544  UINT16 t ;
545  UINT16 flags ;
546  UINT16 charge ;
547 } ;
548 
549 
550 
551 
552 
553 // Formatting structures
554 struct TPCSECP {
555  struct bankHeader bh ;
556  struct offlen rb[SB_RB_NUM] ;
557 } ;
558 
559 
560 struct TPCRBP {
561  struct bankHeader bh ;
562  struct offlen mz[RB_MZ_NUM] ;
563  UINT8 fiberHdr[RB_FIBER_HDR_LEN] ;
564 } ;
565 
566 struct TPCMZP {
567  struct bankHeader bh ;
568  struct offlen banks[TPC_MZP_BANKS_NUM] ;
569 } ;
570 
571 // this is a local structure that is just used to allocate space
572 // it will be recast to the real TPCMZCLD later...
574  struct bankHeader bh ;
575  UINT32 rows ; // how many "rowlike" objects follow...
576  UINT32 padrowFiller[2*MZ_MAX_ROWS] ; // max 6 padrows, each occupies 2 UINT32s...
577  struct mzCentroid centroidFiller[MZ_MAX_CLUSTERS] ;
578 } ;
579 
580 // change the name of the "struct row" to something else - Tonko, 2/22/2001
581 struct TPCADCX {
582  struct bankHeader bh ;
583  struct rowx {
584  UINT32 row ;
585  UINT32 offADC ;
586  UINT32 offSEQ ;
587  } lrow[MZ_MAX_ROWS] ; // MAX 6 padrows/hybrids in a mezzanine
588 } ;
589 
590 struct TPCADCD {
591  struct bankHeader bh ;
592  UINT8 adc[MZ_MAX_CHANNELS] ; // this is the worst case
593 } ;
594 
595 struct TPCSEQD {
596  struct bankHeader bh ;
597  UINT16 seq[MZ_MAX_CHANNELS/2] ; // theoretical maximum
598  // see TPCADCD...
599 } ;
600 
601 
602 struct TPCPEDR {
603  struct bankHeader bh ;
604  UINT32 events ;
605  UINT8 ped[MZ_MAX_CHANNELS] ;
606 } ;
607 
608 struct TPCRMSR {
609  struct bankHeader bh ;
610  UINT32 events ;
611  UINT8 rms[MZ_MAX_CHANNELS] ;
612 } ;
613 
614 
615 struct TPCADCR_l {
616  struct bankHeader bh ;
617 } ;
618 
619 struct TPCCPPR_l {
620  struct bankHeader bh ;
621  UINT8 thr_lo ;
622  UINT8 thr_hi ;
623  UINT8 seq_lo ;
624  UINT8 seq_hi ;
625 } ;
626 
627 
628 // structures that are detector dependent
629 
630 struct DETPADK {
631  struct bankHeader bh ;
632  UINT32 bytesADC ;
633  UINT32 bytesCPP ;
634  UINT32 bytesPED ;
635  UINT32 bytesRMS ;
636  UINT32 bytesCFG ;
637  UINT32 bytesGAIN ;
638  struct row_pad rp[MZ_MAX_PADS] ;
639 } ;
640 
641 
642 struct TPCPADK {
643  struct bankHeader bh ;
644  UINT32 bytesADC ;
645  UINT32 bytesCPP ;
646  UINT32 bytesPED ;
647  UINT32 bytesRMS ;
648  UINT32 bytesCFG ;
649  UINT32 bytesGAIN ;
650  struct row_pad rp[MZ_TPC_MAX_PADS_PER_MEZ] ;
651 } ;
652 
653 struct FTPPADK {
654  struct bankHeader bh ;
655  UINT32 bytesADC ;
656  UINT32 bytesCPP ;
657  UINT32 bytesPED ;
658  UINT32 bytesRMS ;
659  UINT32 bytesCFG ;
660  UINT32 bytesGAIN ;
661  struct row_pad rp[MZ_FTP_PADS_PER_MEZ] ;
662 } ;
663 
664 
665 
666 struct SVTANODK {
667  struct bankHeader bh ;
668  UINT32 bytesADC ;
669  UINT32 bytesCPP ;
670  UINT32 bytesPED ;
671  UINT32 bytesRMS ;
672  UINT32 bytesCFG ;
673  UINT32 bytesGAIN ;
674  UINT32 hybrids[6] ;
675 #ifdef TONKO_ELABORATE
676  struct hybrids {
677  UINT8 barrel ;
678  UINT8 ladder ;
679  UINT8 hy_wf ;
680  UINT8 hybridID ;
681  } hybrids[6] ;
682 #endif
683  // used in SVT specific processing...
684  UINT32 pre ;
685  UINT32 post ;
686  UINT32 pedOff ;
687 } ;
688 
689 
690 struct DETCFGR {
691  struct bankHeader bh ;
692  UINT8 feeId[MZ_MAX_PADS] ;
693 } ;
694 
695 struct TPCCFGR {
696  struct bankHeader bh ;
697  UINT8 feeId[MZ_TPC_MAX_PADS_PER_MEZ] ;
698 } ;
699 
700 struct FTPCFGR {
701  struct bankHeader bh ;
702  UINT8 feeId[MZ_FTP_PADS_PER_MEZ] ;
703 } ;
704 
705 struct SVTCFGR {
706  struct bankHeader bh ;
707  UINT8 feeId[MZ_SVT_MAX_PADS_PER_MEZ] ;
708 } ;
709 
710 
711 struct DETGAINR {
712  struct bankHeader bh ;
713  UINT32 events ;
714  UINT32 meanGain ;
715  struct gain {
716  UINT16 t0 ;
717  UINT8 t0_rms ;
718  UINT8 rel_gain ;
719  } gain[MZ_MAX_PADS] ;
720  UINT8 trans_table[1024] ;
721  UINT16 exp_table[256] ;
722 } ;
723 
724 struct DETGAIND {
725  struct bankHeader bh ;
726  struct gain {
727  short t0 ;
728  unsigned short rel_gain ;
729  } gain[MZ_MAX_PADS] ;
730  UINT8 trans_table[1024] ;
731  UINT16 exp_table[256] ;
732 } ;
733 
734 
735 struct SVTGAINR {
736  struct bankHeader bh ;
737  UINT32 events ;
738  UINT32 meanGain ;
739  struct gain {
740  UINT16 t0 ;
741  UINT8 t0_rms ;
742  UINT8 rel_gain ;
743  } gain[MZ_SVT_MAX_PADS_PER_MEZ] ;
744  UINT8 trans_table[1024] ;
745  UINT16 exp_table[256] ;
746 } ;
747 
748 struct TPCGAINR {
749  struct bankHeader bh ;
750  UINT32 events ;
751  UINT32 meanGain ;
752  struct gain {
753  UINT16 t0 ;
754  UINT8 t0_rms ;
755  UINT8 rel_gain ;
756  } gain[MZ_TPC_MAX_PADS_PER_MEZ] ;
757  UINT8 trans_table[1024] ;
758  UINT16 exp_table[256] ;
759 } ;
760 
761 struct FTPGAINR {
762  struct bankHeader bh ;
763  UINT32 events ;
764  UINT32 meanGain ;
765  struct gain {
766  UINT16 t0 ;
767  UINT8 t0_rms ;
768  UINT8 rel_gain ;
769  } gain[MZ_FTP_PADS_PER_MEZ] ;
770  UINT8 trans_table[1024] ;
771  UINT16 exp_table[256] ;
772 } ;
773 
774 
775 struct DETBADR {
776  struct bankHeader bh ;
777  struct row_pad rp[MZ_MAX_PADS] ;
778 } ;
779 
780 struct TPCBADR {
781  struct bankHeader bh ;
782  struct row_pad rp[MZ_TPC_MAX_PADS_PER_MEZ] ;
783 } ;
784 
785 struct FTPBADR {
786  struct bankHeader bh ;
787  struct row_pad rp[MZ_FTP_PADS_PER_MEZ] ;
788 } ;
789 
790 struct SVTBADR {
791  struct bankHeader bh ;
792  struct row_pad rp[MZ_SVT_MAX_PADS_PER_MEZ] ;
793 } ;
794 
795 
796 // RIC stuff
797 #define RIC_BANK_DATAD 0
798 #define RIC_BANK_DATAR 1
799 #define RIC_BANK_PEDR 2
800 #define RIC_BANK_RMSR 3
801 
802 struct RICP {
803  struct bankHeader bh ;
804  struct offlen crams[18] ;
805 } ;
806 
807 struct RICCRAMP {
808  struct bankHeader bh ;
809  struct offlen banks[8] ;
810 } ;
811 
812 struct RICDATAD {
813  struct bankHeader bh ;
814  unsigned short data[2*960] ;
815 } ;
816 
817 struct RICDATAR {
818  struct bankHeader bh ;
819 } ;
820 
821 struct RICPEDR {
822  struct bankHeader bh ;
823 };
824 
825 struct RICRMSR {
826  struct bankHeader bh ;
827 } ;
828 
829 struct RICTHRER {
830  struct bankHeader bh ;
831 } ;
832 
833 struct RICBADR {
834  struct bankHeader bh ;
835 } ;
836 
837 
838 
839 
840 // FPD
841 #define FPDP_MAX_BANKS 8
842 // index of the banks in FPDP
843 #define FPDP_ADCD 0
844 #define FPDP_TDCD 1
845 #define FPDP_REGD 2
846 #define FPDP_PEDR 3
847 #define FPDP_SCL 4
848 #define FPDP_BBCDAT 5
849 #define FPDP_BBCPED 6
850 #define FPDP_BBCSCL 7
851 
852 
853 struct FPDP {
854  struct bankHeader bh ;
855  struct offlen type[FPDP_MAX_BANKS] ;
856 } ;
857 
858 struct FPDADCD {
859  struct bankHeader bh ;
860  unsigned short data[256] ;
861 } ;
862 
863 struct FPDTDCD {
864  struct bankHeader bh ;
865  unsigned short data[8] ;
866 } ;
867 
868 struct FPDREGD {
869  struct bankHeader bh ;
870  unsigned short data[4] ;
871 } ;
872 
873 struct FPDPEDR {
874  struct bankHeader bh ;
875  unsigned short ped[256] ;
876  unsigned short rms[256] ;
877 } ;
878 
879 struct FPDSCL {
880  struct bankHeader bh ;
881  unsigned int scl[128] ;
882 } ;
883 
884 struct BBCDAT {
885  struct bankHeader bh ;
886  unsigned short pulse[32] ;
887  unsigned short time[32] ;
888  unsigned short proof[2] ;
889  unsigned short spare[6] ;
890 } ;
891 
892 struct BBCPED {
893  struct bankHeader bh ;
894  unsigned short ped[32] ;
895  unsigned short rms[32] ;
896  unsigned short peaks[64] ;
897 } ;
898 
899 struct BBCSCL {
900  struct bankHeader bh ;
901  unsigned int scl[32] ;
902 } ;
903 
904 
905 
906 // TOF
907 // Format Version 2 for FY03
908 // FOrmat Version ? for FY04
909 // Format Version 0x50000 for FY05 - RORC! - changed type count from 4 to 8
910 struct TOFP {
911  struct bankHeader bh ;
912  struct offlen type[8] ;
913 } ;
914 
915 struct TOFADCD {
916  struct bankHeader bh ;
917  unsigned int data[180] ; // 48 in FY02, 132 in FY03
918 } ;
919 
920 struct TOFTDCD {
921  struct bankHeader bh ;
922  unsigned int data[184] ; // 48 in FY02, 120 in FY03
923 } ;
924 
925 struct TOFA2DD {
926  struct bankHeader bh ;
927  unsigned int data[32] ; // 32 in FY02
928 } ;
929 
930 struct TOFSCAD {
931  struct bankHeader bh ;
932  unsigned int data[12] ; // 12 in FY02
933 } ;
934 
935 struct TOFDDLR {
936  struct bankHeader bh ;
937  char data[0] ;
938 } ;
939 
940 // PMP
941 // misc. counters
942 #define PMD_CRAMS_MAX 12
943 #define PMD_CRAMS_CH_MAX 1728
944 
945 // bank seqeuence in the SECP bank
946 #define PMD_ADCD_N 0
947 #define PMD_PEDR_N 1
948 #define PMD_RMSR_N 2
949 #define PMD_THRR_N 3
950 
951 struct PMDP {
952  struct bankHeader bh ;
953  struct offlen sec[2] ;
954 } ;
955 
956 struct PMDSECP {
957  struct bankHeader bh ;
958  struct offlen type[4] ;
959 } ;
960 
961 struct PMDADCD {
962  struct bankHeader bh ;
963  UINT32 data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ; // variable
964 } ;
965 
966 struct PMDPEDR {
967  struct bankHeader bh ;
968  UINT16 data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ; // variable
969 
970 } ;
971 
972 struct PMDRMSR {
973  struct bankHeader bh ;
974  UINT16 data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ; // variable
975 } ;
976 
977 struct PMDTHRR {
978  struct bankHeader bh ;
979  UINT16 data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ; // variable
980 } ;
981 
982 
983 
984 // EMC
985 /*
986  Tonko, Nov 2, 2004 -- the Barrel people _finally_ decided
987  how the preshower looks like and it will be fibers 9-12
988  in the BSMD. This means:
989  EMC_FIBER_NUM increases from 8 to 12
990  EMC_SEC_NUM stays at 6 but the B_PRE/E_PRE is unused
991 
992  NOTE: the FIBER_NUM increase may cause pain for Offline. *shrug*
993 
994 */
995 #define EMC_SEC_NUM 6 // num. of "sections" i.e. subparts
996 #define EMC_FIBER_NUM 12 // max num of fibers per subemc
997 
998 // indices in the EMCP
999 #define EMC_B_TOW 0
1000 #define EMC_B_SMD 1
1001 #define EMC_B_PRE 2
1002 #define EMC_E_TOW 3
1003 #define EMC_E_SMD 4
1004 #define EMC_E_PRE 5
1005 
1006 struct EMCP {
1007  struct bankHeader bh ;
1008  struct offlen sec[EMC_SEC_NUM] ; // 6 sections...
1009 } ;
1010 
1011 struct EMCSECP {
1012  struct bankHeader bh ;
1013  struct offlen fiber[EMC_FIBER_NUM] ; // for 8 fibers contribs
1014 } ;
1015 
1016 struct EMCRBP {
1017  struct bankHeader bh ;
1018  struct offlen banks[TPC_MZP_BANKS_NUM] ; // same number of banks as TPC
1019 } ;
1020 
1021 struct EMCADCD {
1022  struct bankHeader bh ;
1023  unsigned short version ;
1024  unsigned short count ;
1025  unsigned short cap ; // or other stuff
1026  unsigned short fiber ;
1027  // the following repeats "count" times
1028  // unsigned short channel ;
1029  // unsigned short datum ;
1030 } ;
1031 
1032 struct EMCPEDR {
1033  struct bankHeader bh ;
1034  unsigned short version ;
1035  unsigned short count ;
1036  unsigned short cap ;
1037  unsigned short fiber ;
1038  // cap*count shorts of this form
1039  // unsigned short data = (rms*8)<<10 | ped ;
1040 } ;
1041 
1042 struct PP2PPP { // main pointer bank
1043  struct bankHeader bh ;
1044  struct offlen sec[3] ;
1045 } ;
1046 
1047 // WARNING: sizeof() will not give the correct length!
1048 struct PP2PPR { // void data dump...
1049  struct bankHeader bh ;
1050  unsigned int type ;
1051  unsigned int xing ;
1052  unsigned int seq ;
1053  unsigned int hash ; // adjusted seq * 1000 + adjusted xing
1054  unsigned int seqAdj ; // sequence adjuster
1055  unsigned int xingAdj ; // xing adjuster
1056  unsigned int ms ; // miliseconds from the beginning of the run
1057  unsigned int res[1] ;
1058  char data[0] ; // unknown at compile time...
1059 } ;
1060 
1061 // Slow Controls and Friends
1062 #define SCD_FORMAT_VERSION 0x00050001 // Run FY05, version 1
1063 struct SCD {
1064  struct bankHeader bh ;
1065  unsigned int time ; // unix time
1066  int mag_field ;
1067  unsigned int rich_scalers[16] ; // ask Jamie Dunlop
1068 } ;
1069 
1070 
1071 // Level 3 structures
1072 // Level 3 banks
1073 #include "L3/L3Formats.h"
1074 
1075 /*
1076 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && defined(__I960)
1077 #pragma pack 0
1078 #pragma align 0
1079 #endif
1080 */
1081 
1082 
1083 
1084 
1085 // Define for linker-level checking only! See comment at the
1086 // end of this file.
1087 //#define VERIFY_SIZES
1088 
1089 #ifdef VERIFY_SIZES
1090 /*
1091 
1092 If this is defined the follwing variables will show up
1093 in the dissaemby of this file when compiled so one can
1094 immediatelly check the sizes of these ovjects without
1095 printf statements and actual code since the sizes (i.e. sizeof)
1096 are knwon at compile time...
1097 
1098 For normal compilation this should be undefined...
1099 
1100 __alignof__ exists in GCC...
1101 */
1102 
1103 static UINT32 sTPCSECP = sizeof(struct TPCSECP) ;
1104 static UINT32 aTPCSECP = __alignof__(struct TPCSECP) ;
1105 
1106 static UINT32 sTPCSECLP = sizeof(struct TPCSECLP) ;
1107 static UINT32 aTPCSECLP = __alignof__(struct TPCSECLP) ;
1108 
1109 static UINT32 sTPCRBCLP = sizeof(struct TPCRBCLP) ;
1110 static UINT32 aTPCRBCLP = __alignof__(struct TPCRBCLP) ;
1111 
1112 static UINT32 sTPCMZCLD_local = sizeof(struct TPCMZCLD_local) ;
1113 static UINT32 aTPCMZCLD_local = __alignof__(struct TPCMZCLD_local) ;
1114 
1115 static UINT32 sTPCRBP = sizeof(struct TPCRBP) ;
1116 static UINT32 aTPCRBP = __alignof__(struct TPCRBP) ;
1117 
1118 static UINT32 sTPCMZP = sizeof(struct TPCMZP) ;
1119 static UINT32 aTPCMZP = __alignof__(struct TPCMZP) ;
1120 
1121 static UINT32 sTPCADCX = sizeof(struct TPCADCX) ;
1122 static UINT32 aTPCADCX = __alignof__(struct TPCADCX) ;
1123 
1124 static UINT32 sTPCADCD = sizeof(struct TPCADCD) ;
1125 static UINT32 aTPCADCD = __alignof__(struct TPCADCD) ;
1126 
1127 static UINT32 sTPCSEQD = sizeof(struct TPCSEQD) ;
1128 static UINT32 aTPCSEQD = __alignof__(struct TPCSEQD) ;
1129 
1130 static UINT32 sTPCPADK = sizeof(struct TPCPADK) ;
1131 static UINT32 aTPCPADK = __alignof__(struct TPCPADK) ;
1132 
1133 static UINT32 sTPCCFGR = sizeof(struct TPCCFGR) ;
1134 static UINT32 aTPCCFGR = __alignof__(struct TPCCFGR) ;
1135 
1136 static UINT32 sTPCGAINR = sizeof(struct TPCGAINR) ;
1137 static UINT32 aTPCGAINR = __alignof__(struct TPCGAINR) ;
1138 
1139 static UINT32 sTPCPEDR = sizeof(struct TPCPEDR) ;
1140 static UINT32 aTPCPEDR = __alignof__(struct TPCPEDR) ;
1141 
1142 static UINT32 sTPCRMSR = sizeof(struct TPCRMSR) ;
1143 static UINT32 aTPCRMSR = __alignof__(struct TPCRMSR) ;
1144 
1145 static UINT32 sTPCBADR = sizeof(struct TPCBADR) ;
1146 static UINT32 aTPCBADR = __alignof__(struct TPCBADR) ;
1147 
1148 static UINT32 sTPCADCR_l = sizeof(struct TPCADCR_l) ;
1149 static UINT32 aTPCADCR_l = __alignof__(struct TPCADCR_l) ;
1150 
1151 static UINT32 sTPCCPPR_l = sizeof(struct TPCCPPR_l) ;
1152 static UINT32 aTPCCPPR_l = __alignof__(struct TPCCPPR_l) ;
1153 
1154 
1155 #endif
1156 
1157 #endif
1158