7 typedef unsigned int UINT32 ;
8 typedef unsigned short UINT16 ;
9 typedef unsigned char UINT8 ;
12 #include <SECTOR/sector.h>
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
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>
49 #define TRG_VERSION 0x47
50 #include <trgDataDefs_47.h>
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)
60 #define FMT_PADK (1 << 5)
61 #define FMT_SEQD (1 << 6)
62 #define FMT_ADCX (1 << 7)
64 #define FMT_NOT_FREE (FMT_ADCR | FMT_ADCD | FMT_ADCHUF)
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)
78 #define DAQ_RAW_FORMAT_VERSION 0x00020003 // 2.30
81 #define DAQ_RAW_FORMAT_ORDER 0x04030201
86 #define DAQ_RAW_FORMAT_WORD9 0x00000000
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
118 #define TPC_MZP_BANKS_NUM 12
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 "
127 #define CHAR_DATAP "DATAP "
128 #define CHAR_DATAPX "DATAPX "
131 #define CHAR_TPCP "TPCP "
133 #define CHAR_TPCSECLP "TPCSECLP"
134 #define CHAR_TPCRBCLP "TPCRBCLP"
135 #define CHAR_TPCMZCLD "TPCMZCLD"
137 #define CHAR_TPCSECP "TPCSECP "
138 #define CHAR_TPCRBP "TPCRBP "
139 #define CHAR_TPCMZP "TPCMZP "
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...
155 #define CHAR_SVTP "SVTP "
157 #define CHAR_SVTSECLP "SVTSECLP"
158 #define CHAR_SVTRBCLP "SVTRBCLP"
159 #define CHAR_SVTMZCLD "SVTMZCLD"
161 #define CHAR_SVTSECP "SVTSECP "
162 #define CHAR_SVTRBP "SVTRBP "
163 #define CHAR_SVTMZP "SVTMZP "
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 "
178 #define CHAR_FTPP "FTPP "
180 #define CHAR_FTPSECLP "FTPSECLP"
181 #define CHAR_FTPRBCLP "FTPRBCLP"
182 #define CHAR_FTPMZCLD "FTPMZCLD"
184 #define CHAR_FTPSECP "FTPSECP "
185 #define CHAR_FTPRBP "FTPRBP "
186 #define CHAR_FTPMZP "FTPMZP "
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 "
201 #define CHAR_SSDP "SSDP "
203 #define CHAR_SSDSECLP "SSDSECLP"
204 #define CHAR_SSDRBCLP "SSDRBCLP"
205 #define CHAR_SSDMZCLD "SSDMZCLD"
207 #define CHAR_SSDSECP "SSDSECP "
208 #define CHAR_SSDRBP "SSDRBP "
209 #define CHAR_SSDMZP "SSDMZP "
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 "
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 "
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 "
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 "
250 #define CHAR_BBCDAT "BBCDAT "
251 #define CHAR_BBCPED "BBCPED "
252 #define CHAR_BBCSCL "BBCSCL "
256 #define CHAR_FP2P "FP2P "
260 #define CHAR_EMCP "EMCP "
261 #define CHAR_EMCSECP "EMCSECP "
262 #define CHAR_EMCRBP "EMCRBP "
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 "
277 #define CHAR_EECP "EECP "
278 #define CHAR_EECSECP "EECSECP "
279 #define CHAR_EECRBP "EECRBP "
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 "
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 "
303 #define CHAR_TRGP "TRGP "
304 #define CHAR_TRGD "TRGD "
305 #define CHAR_TRGID "TRGID "
308 #define CHAR_PP2PPP "PP2PPP "
309 #define CHAR_PP2PPR "PP2PPR "
311 #define CHAR_L3P "L3P "
314 #define CHAR_SCD "SCD "
316 #define CHAR_TPXP "TPXP "
333 UINT32 format_number ;
365 char record_type[8] ;
379 #if defined(UNIX_LITTLE_ENDIAN) || defined(RTS_LITTLE_ENDIAN)
381 UINT8 format_version;
401 UINT8 format_version;
418 unsigned short TCUdataBytes;
420 unsigned char TrgDataFmtVer;
421 unsigned int bunchXing_hi;
422 unsigned int bunchXing_lo;
423 unsigned short actionWdDetectorBitMask;
424 unsigned char actionWdTrgCommand;
425 unsigned char actionWdDaqCommand;
426 unsigned short TrgToken;
427 unsigned short addBits;
428 unsigned short DSMInput;
429 unsigned short externalBusy;
430 unsigned short modifiedBusyStatus;
431 unsigned short physicsWord;
432 unsigned short TriggerWord;
433 unsigned short DSMAddress;
434 unsigned short contaminationBusyStatus;
436 unsigned short npost;
437 unsigned short dummy;
444 unsigned int bunchXing_hi;
445 unsigned int bunchXing_lo;
446 unsigned short actionWdDetectorBitMask;
447 unsigned char actionWdTrgCommand;
448 unsigned char actionWdDaqCommand;
449 unsigned short TrgToken;
450 unsigned short addBits;
451 unsigned short DSMInput;
452 unsigned short externalBusy;
453 unsigned short modifiedBusyStatus;
454 unsigned short physicsWord;
455 unsigned short TriggerWord;
456 unsigned short DSMAddress;
457 unsigned short contaminationBusyStatus;
459 unsigned short npost;
460 unsigned short dummy;
472 UINT32 TRG_L1_summary[2];
473 UINT32 TRG_L2_summary[2];
486 UINT32 triggerId[32] ;
533 struct offlen rb[SB_RB_NUM] ;
538 struct offlen mz[RB_MZ_NUM] ;
539 UINT8 fiberHdr[RB_FIBER_HDR_LEN] ;
556 struct offlen rb[SB_RB_NUM] ;
562 struct offlen mz[RB_MZ_NUM] ;
563 UINT8 fiberHdr[RB_FIBER_HDR_LEN] ;
568 struct offlen banks[TPC_MZP_BANKS_NUM] ;
576 UINT32 padrowFiller[2*MZ_MAX_ROWS] ;
577 struct mzCentroid centroidFiller[MZ_MAX_CLUSTERS] ;
587 } lrow[MZ_MAX_ROWS] ;
592 UINT8 adc[MZ_MAX_CHANNELS] ;
597 UINT16 seq[MZ_MAX_CHANNELS/2] ;
605 UINT8 ped[MZ_MAX_CHANNELS] ;
611 UINT8 rms[MZ_MAX_CHANNELS] ;
638 struct row_pad rp[MZ_MAX_PADS] ;
650 struct row_pad rp[MZ_TPC_MAX_PADS_PER_MEZ] ;
661 struct row_pad rp[MZ_FTP_PADS_PER_MEZ] ;
675 #ifdef TONKO_ELABORATE
692 UINT8 feeId[MZ_MAX_PADS] ;
697 UINT8 feeId[MZ_TPC_MAX_PADS_PER_MEZ] ;
702 UINT8 feeId[MZ_FTP_PADS_PER_MEZ] ;
707 UINT8 feeId[MZ_SVT_MAX_PADS_PER_MEZ] ;
719 }
gain[MZ_MAX_PADS] ;
720 UINT8 trans_table[1024] ;
721 UINT16 exp_table[256] ;
728 unsigned short rel_gain ;
729 }
gain[MZ_MAX_PADS] ;
730 UINT8 trans_table[1024] ;
731 UINT16 exp_table[256] ;
743 }
gain[MZ_SVT_MAX_PADS_PER_MEZ] ;
744 UINT8 trans_table[1024] ;
745 UINT16 exp_table[256] ;
756 }
gain[MZ_TPC_MAX_PADS_PER_MEZ] ;
757 UINT8 trans_table[1024] ;
758 UINT16 exp_table[256] ;
769 }
gain[MZ_FTP_PADS_PER_MEZ] ;
770 UINT8 trans_table[1024] ;
771 UINT16 exp_table[256] ;
777 struct row_pad rp[MZ_MAX_PADS] ;
782 struct row_pad rp[MZ_TPC_MAX_PADS_PER_MEZ] ;
787 struct row_pad rp[MZ_FTP_PADS_PER_MEZ] ;
792 struct row_pad rp[MZ_SVT_MAX_PADS_PER_MEZ] ;
797 #define RIC_BANK_DATAD 0
798 #define RIC_BANK_DATAR 1
799 #define RIC_BANK_PEDR 2
800 #define RIC_BANK_RMSR 3
814 unsigned short data[2*960] ;
841 #define FPDP_MAX_BANKS 8
848 #define FPDP_BBCDAT 5
849 #define FPDP_BBCPED 6
850 #define FPDP_BBCSCL 7
855 struct offlen type[FPDP_MAX_BANKS] ;
860 unsigned short data[256] ;
865 unsigned short data[8] ;
870 unsigned short data[4] ;
875 unsigned short ped[256] ;
876 unsigned short rms[256] ;
881 unsigned int scl[128] ;
886 unsigned short pulse[32] ;
887 unsigned short time[32] ;
888 unsigned short proof[2] ;
889 unsigned short spare[6] ;
894 unsigned short ped[32] ;
895 unsigned short rms[32] ;
896 unsigned short peaks[64] ;
901 unsigned int scl[32] ;
917 unsigned int data[180] ;
922 unsigned int data[184] ;
927 unsigned int data[32] ;
932 unsigned int data[12] ;
942 #define PMD_CRAMS_MAX 12
943 #define PMD_CRAMS_CH_MAX 1728
963 UINT32
data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ;
968 UINT16
data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ;
974 UINT16
data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ;
979 UINT16
data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)] ;
995 #define EMC_SEC_NUM 6 // num. of "sections" i.e. subparts
996 #define EMC_FIBER_NUM 12 // max num of fibers per subemc
1008 struct offlen sec[EMC_SEC_NUM] ;
1013 struct offlen fiber[EMC_FIBER_NUM] ;
1018 struct offlen banks[TPC_MZP_BANKS_NUM] ;
1023 unsigned short version ;
1024 unsigned short count ;
1025 unsigned short cap ;
1026 unsigned short fiber ;
1034 unsigned short version ;
1035 unsigned short count ;
1036 unsigned short cap ;
1037 unsigned short fiber ;
1054 unsigned int seqAdj ;
1055 unsigned int xingAdj ;
1057 unsigned int res[1] ;
1062 #define SCD_FORMAT_VERSION 0x00050001 // Run FY05, version 1
1067 unsigned int rich_scalers[16] ;
1073 #include "L3/L3Formats.h"
1103 static UINT32 sTPCSECP =
sizeof(
struct TPCSECP) ;
1104 static UINT32 aTPCSECP = __alignof__(
struct TPCSECP) ;
1106 static UINT32 sTPCSECLP =
sizeof(
struct TPCSECLP) ;
1107 static UINT32 aTPCSECLP = __alignof__(
struct TPCSECLP) ;
1109 static UINT32 sTPCRBCLP =
sizeof(
struct TPCRBCLP) ;
1110 static UINT32 aTPCRBCLP = __alignof__(
struct TPCRBCLP) ;
1113 static UINT32 aTPCMZCLD_local = __alignof__(
struct TPCMZCLD_local) ;
1115 static UINT32 sTPCRBP =
sizeof(
struct TPCRBP) ;
1116 static UINT32 aTPCRBP = __alignof__(
struct TPCRBP) ;
1118 static UINT32 sTPCMZP =
sizeof(
struct TPCMZP) ;
1119 static UINT32 aTPCMZP = __alignof__(
struct TPCMZP) ;
1121 static UINT32 sTPCADCX =
sizeof(
struct TPCADCX) ;
1122 static UINT32 aTPCADCX = __alignof__(
struct TPCADCX) ;
1124 static UINT32 sTPCADCD =
sizeof(
struct TPCADCD) ;
1125 static UINT32 aTPCADCD = __alignof__(
struct TPCADCD) ;
1127 static UINT32 sTPCSEQD =
sizeof(
struct TPCSEQD) ;
1128 static UINT32 aTPCSEQD = __alignof__(
struct TPCSEQD) ;
1130 static UINT32 sTPCPADK =
sizeof(
struct TPCPADK) ;
1131 static UINT32 aTPCPADK = __alignof__(
struct TPCPADK) ;
1133 static UINT32 sTPCCFGR =
sizeof(
struct TPCCFGR) ;
1134 static UINT32 aTPCCFGR = __alignof__(
struct TPCCFGR) ;
1136 static UINT32 sTPCGAINR =
sizeof(
struct TPCGAINR) ;
1137 static UINT32 aTPCGAINR = __alignof__(
struct TPCGAINR) ;
1139 static UINT32 sTPCPEDR =
sizeof(
struct TPCPEDR) ;
1140 static UINT32 aTPCPEDR = __alignof__(
struct TPCPEDR) ;
1142 static UINT32 sTPCRMSR =
sizeof(
struct TPCRMSR) ;
1143 static UINT32 aTPCRMSR = __alignof__(
struct TPCRMSR) ;
1145 static UINT32 sTPCBADR =
sizeof(
struct TPCBADR) ;
1146 static UINT32 aTPCBADR = __alignof__(
struct TPCBADR) ;
1148 static UINT32 sTPCADCR_l =
sizeof(
struct TPCADCR_l) ;
1149 static UINT32 aTPCADCR_l = __alignof__(
struct TPCADCR_l) ;
1151 static UINT32 sTPCCPPR_l =
sizeof(
struct TPCCPPR_l) ;
1152 static UINT32 aTPCCPPR_l = __alignof__(
struct TPCCPPR_l) ;