|
| 1 | +#ifndef trgStructures2022_h |
| 2 | +#define trgStructures2022_h |
| 3 | +/****** |
| 4 | +* |
| 5 | +* Layout of new Trigger Data Block |
| 6 | +* |
| 7 | +* J.M. Nelson 30 January 2009 |
| 8 | +* |
| 9 | +* Notes: The event descriptor will describe data from either |
| 10 | +* the Mk1 or Mk2 TCUs. The variable TCU_Mark will be 1 for Mk1 |
| 11 | +* and 2 for the Mk2 TCU. Variables not used by one or other of the |
| 12 | +* TCUs will be zero. |
| 13 | +* |
| 14 | +* The data block structure will always begin with a 4 character |
| 15 | +* name, followed by the byte-count of data following. The structure of |
| 16 | +* data will depend on the configuration of particular crates. |
| 17 | +* |
| 18 | +* Note: PrePost data will only be available on local trigger disks and |
| 19 | +* will not be present in event files. |
| 20 | +* |
| 21 | +* 8Dec16: JMN changed FORMAT_VERSION |
| 22 | +* 3Oct17: je - removed DAQ10k TPCpreMask from MIX added EPDlayer# to BBC |
| 23 | +* 6Dec18: je - modified BBCBlock structure for added EPD DSMs |
| 24 | +* 4Jan19: JMN removed redundant info from BBCBlock |
| 25 | +* 12Oct21: JMN and JE: remove FPD[8] from L1_DSM_Data and |
| 26 | +* FPDEastNSLayer1[8] from MIXBlock |
| 27 | +* Updated FORMAT_VERSION to 47 |
| 28 | +* |
| 29 | +******************************************************************************/ |
| 30 | +#define y22FORMAT_VERSION 0x21101247 /* Format: yymmddvv */ |
| 31 | +#define y22MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */ |
| 32 | +#define y22MAX_OFFLEN 20 /* Depends on the number of crates in the system */ |
| 33 | + |
| 34 | +#define y22MAX_CONF_NUM 20 |
| 35 | +#define y22RCC_CONF_NUM 0 |
| 36 | +#define y22L1_CONF_NUM 1 |
| 37 | +#define y22BC1_CONF_NUM 2 |
| 38 | +#define y22MXQ_CONF_NUM 3 |
| 39 | +#define y22MIX_CONF_NUM 4 |
| 40 | +#define y22BCW_CONF_NUM 5 |
| 41 | +#define y22BCE_CONF_NUM 6 |
| 42 | +#define y22EQ3_CONF_NUM 7 |
| 43 | +#define y22BBC_CONF_NUM 8 |
| 44 | +#define y22BBQ_CONF_NUM 9 |
| 45 | +#define y22FMS_CONF_NUM 10 |
| 46 | +#define y22QT1_CONF_NUM 11 |
| 47 | +#define y22QT2_CONF_NUM 12 |
| 48 | +#define y22QT3_CONF_NUM 13 |
| 49 | +#define y22QT4_CONF_NUM 14 |
| 50 | +#define y22EQ1_CONF_NUM 15 |
| 51 | +#define y22EQ2_CONF_NUM 16 |
| 52 | +#define y22INF_CONF_NUM 20 |
| 53 | + |
| 54 | + |
| 55 | +#define y22ADD_BIT_PREPILEUP 0 /* pileup present */ |
| 56 | +#define y22ADD_BIT_POSTPILEUP 1 |
| 57 | +#define y22ADD_BIT_FORCE 5 /* Force store of this event */ |
| 58 | +#define y22ADD_BIT_L2_5 6 /* Level 2.5 abort */ |
| 59 | +#define y22ADD_BIT_SIM 7 /* Simulated event - used by DAQ */ |
| 60 | + |
| 61 | + /* Event Descriptor Data Structures */ |
| 62 | + |
| 63 | +//#pragma pack(1) |
| 64 | + |
| 65 | +typedef struct { |
| 66 | + char name[3]; /* Contains EVD */ |
| 67 | + char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */ |
| 68 | + int length; /* Byte count of data that follows */ |
| 69 | + unsigned int bunchXing_hi; |
| 70 | + unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */ |
| 71 | + unsigned short actionWdDetectorBitMask; /* from Fifo 1 */ |
| 72 | + unsigned char actionWdTrgCommand; /* from Fifo 1 */ |
| 73 | + unsigned char actionWdDaqCommand; /* from Fifo 1 */ |
| 74 | + unsigned short TrgToken; /* from Fifo 2 */ |
| 75 | + unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */ |
| 76 | + unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */ |
| 77 | + unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */ |
| 78 | + unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */ |
| 79 | + unsigned short trgDetMask; // After 11/8/16 |
| 80 | + unsigned short tcuCtrBunch_hi; // After 11/8/16 |
| 81 | + unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */ |
| 82 | + unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */ |
| 83 | + unsigned short npre; // (crate_mask & 0xfff) << 4 | npre (after 11/8/16) |
| 84 | + |
| 85 | + unsigned short npost; // (crate_mask & 0xfff000)>>8| npost (after 11/8/16) |
| 86 | + unsigned short res1; // (crate_mask & 0xff000000)>>20 | res1&0xf (after 11/8/16) |
| 87 | +} EvtDescData2022; |
| 88 | + |
| 89 | + /* L1 DSM data structures */ |
| 90 | + |
| 91 | +typedef struct { |
| 92 | + char name[4]; /* Contains L1DS */ |
| 93 | + int length; /* Byte count of data that follows */ |
| 94 | + unsigned short TOF[8]; /* TOF and MTD data */ |
| 95 | + unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */ |
| 96 | + unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */ |
| 97 | + unsigned short TPCMask[8]; /* TPC mask for DAQ10K */ |
| 98 | + unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */ |
| 99 | + unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */ |
| 100 | + unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */ |
| 101 | +} L1_DSM_Data2022; |
| 102 | + |
| 103 | + /* Trigger Summary Data Structures */ |
| 104 | + |
| 105 | +typedef struct { |
| 106 | + char name[4]; /* Contains TSUM */ |
| 107 | + int length; /* Byte count of data that follows */ |
| 108 | + unsigned int L1Sum[2]; /* L1 Summary */ |
| 109 | + unsigned int L2Sum[2]; /* L2 Summary */ |
| 110 | + unsigned int L1Result[32]; /* Result from L1 CPU */ |
| 111 | + unsigned int L2Result[64]; /* Result from L2 CPU */ |
| 112 | + unsigned int C2Result[64]; /* Result from last algorithm */ |
| 113 | + unsigned int LocalClocks[32]; /* localClock values from RCC2*/ |
| 114 | +} TrgSumData2022; |
| 115 | + |
| 116 | +typedef struct { |
| 117 | + char name[4]; |
| 118 | + int length; /* Byte count of data that follows */ |
| 119 | + unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */ |
| 120 | +} DataBlock2022; |
| 121 | + |
| 122 | +typedef struct { |
| 123 | + char name[4]; /* Contains BBC */ |
| 124 | + int length; /* Byte count of data that follows */ |
| 125 | + unsigned short BBClayer1[8]; /* BBC-small layer1 DSM feeding VT201 DSM */ |
| 126 | + unsigned short EPDlayer1a[8]; /* layer1 DSM feeding QT32C TAC info to VT201 DSM */ |
| 127 | + unsigned short ZDClayer1[8]; /* layer1 ZDC DSM that feeds the VT201 DSM */ |
| 128 | + unsigned short VPD[8]; /* layer1 VPD DSM feeding ADC & TAC values to VT201*/ |
| 129 | + unsigned short EPDlayer0t[16]; /* layer0 EPD DSM feeding east & west TAC to EP101 */ |
| 130 | + unsigned short EPDlayer1b[8]; /* 2nd layer1 EPD DSM taking EPD QT ADC data to VT201 */ |
| 131 | + unsigned short EPDlayer0a[16]; /* layer0 EPD DSM feeding east & west QT32C adcs to EP102 */ |
| 132 | + unsigned char EPDlayer0h[32]; /* layer0 EPD DSM feeding east & west QT32B to EP102 */ |
| 133 | +} BBCBlock2022; |
| 134 | + |
| 135 | + |
| 136 | +typedef struct { |
| 137 | + char name[4]; /* Contains MIX */ |
| 138 | + int length; /* Byte count of data that follows */ |
| 139 | + unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */ |
| 140 | + unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */ |
| 141 | + unsigned short TOF[48]; /* TOF data */ |
| 142 | +/* unsigned short TPCpreMask[24]; */ /* EMC, MTD, & TOF TPC Grid Masks je-removed starting run 18 */ |
| 143 | +} MIXBlock2022; |
| 144 | + |
| 145 | +typedef struct { |
| 146 | + char name[4]; |
| 147 | + int length; /* Byte count of data that follows */ |
| 148 | + int dataLoss; /* Byte count of data truncated due to buffer limitations */ |
| 149 | + unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */ |
| 150 | +} QTBlock2022; |
| 151 | + |
| 152 | +typedef struct { |
| 153 | + char name[4]; |
| 154 | + int length; |
| 155 | + unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */ |
| 156 | +} BEastBlock2022; |
| 157 | + |
| 158 | +typedef struct { |
| 159 | + char name[4]; |
| 160 | + int length; |
| 161 | + unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */ |
| 162 | +} BWestBlock2022; |
| 163 | + |
| 164 | +typedef struct { |
| 165 | + char name[4]; |
| 166 | + int length; |
| 167 | + unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */ |
| 168 | + unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */ |
| 169 | + unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */ |
| 170 | +} BELayerBlock2022; |
| 171 | + |
| 172 | +typedef struct { |
| 173 | + char name[4]; |
| 174 | + int length; |
| 175 | + unsigned char FMS[256]; /* 16 DSMs for FMS */ |
| 176 | +} FMSBlock2022; |
| 177 | + |
| 178 | +typedef struct { |
| 179 | + int offset; /* Offset (in bytes) from the start of Trigger block to data */ |
| 180 | + int length; /* Length (in bytes) of data */ |
| 181 | +} TrgOfflen2022; |
| 182 | + |
| 183 | +typedef struct { |
| 184 | + int FormatVersion; /* Trigger Data Definition Version yymmddvv */ |
| 185 | + int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */ |
| 186 | + int eventNumber; /* Event number in this run */ |
| 187 | + TrgOfflen2022 EventDesc_ofl; /* Offset/length pair to Event Descriptor */ |
| 188 | + TrgOfflen2022 L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */ |
| 189 | + TrgOfflen2022 Summary_ofl; /* Offset/length pair to Summary Data */ |
| 190 | + TrgOfflen2022 MainX[y22MAX_OFFLEN]; /* Offset/length pairs for main crossing */ |
| 191 | + int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */ |
| 192 | + int raw_data[y22MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */ |
| 193 | +} TriggerDataBlk2022; |
| 194 | + |
| 195 | +#endif |
| 196 | + |
0 commit comments