00001 #ifndef TRG_DATA_DEFS 00002 #define TRG_DATA_DEFS 00003 /****** 00004 * 00005 * Layout of new Trigger Data Block 00006 * 00007 * J.M. Nelson 30 January 2009 00008 * 00009 * Notes: The event descriptor will describe data from either 00010 * the Mk1 or Mk2 TCUs. The variable TCU_Mark will be 1 for Mk1 00011 * and 2 for the Mk2 TCU. Variables not used by one or other of the 00012 * TCUs will be zero. 00013 * 00014 * The data block structure will always begin with a 4 character 00015 * name, followed by the byte-count of data following. The structure of 00016 * data will depend on the configuration of particular crates. 00017 * 00018 * Note: PrePost data will only be available on local trigger disks and 00019 * will not be present in event files. 00020 ******************************************************************************/ 00021 #include "daqFormats.h" 00022 #define FORMAT_VERSION 0x11110141 /* Format yymmddvv */ 00023 #define MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */ 00024 #define MAX_OFFLEN 20 /* Depends on the number of crates in the system */ 00025 00026 #define ADD_BIT_FORCE 5 /* Force store of this event */ 00027 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */ 00028 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */ 00029 00030 /* Event Descriptor Data Structures */ 00031 00032 typedef struct { 00033 char name[3]; /* Contains EVD */ 00034 char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */ 00035 int length; /* Byte count of data that follows */ 00036 unsigned int bunchXing_hi; 00037 unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */ 00038 unsigned short actionWdDetectorBitMask; /* from Fifo 1 */ 00039 unsigned char actionWdTrgCommand; /* from Fifo 1 */ 00040 unsigned char actionWdDaqCommand; /* from Fifo 1 */ 00041 unsigned short TrgToken; /* from Fifo 2 */ 00042 unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */ 00043 unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */ 00044 unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */ 00045 unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */ 00046 unsigned short physicsWord; /* Fifo 4 Mk1 TCU. 0 if Mk2 TCU is used */ 00047 unsigned short TriggerWord; /* Fifo 5 Mk1 TCU. 0 if Mk2 TCU is used */ 00048 unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */ 00049 unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */ 00050 unsigned short npre; /* pre value for detector raw data */ 00051 unsigned short npost; /* post value for detector raw data */ 00052 unsigned short res1; /* Reserved for future use */ 00053 } EvtDescData; 00054 00055 /* L1 DSM data structures */ 00056 00057 typedef struct { 00058 char name[4]; /* Contains L1DS */ 00059 int length; /* Byte count of data that follows */ 00060 unsigned short TOF[8]; /* TOF and MTD data */ 00061 unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */ 00062 unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */ 00063 unsigned short TPCMask[8]; /* TPC mask for DAQ10K */ 00064 00065 unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */ 00066 unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */ 00067 unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */ 00068 unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */ 00069 } L1_DSM_Data; 00070 00071 /* Trigger Summary Data Structures */ 00072 00073 typedef struct { 00074 char name[4]; /* Contains TSUM */ 00075 int length; /* Byte count of data that follows */ 00076 unsigned int L1Sum[2]; /* L1 Summary */ 00077 unsigned int L2Sum[2]; /* L2 Summary */ 00078 unsigned int L1Result[32]; /* Result from L1 CPU */ 00079 unsigned int L2Result[64]; /* Result from L2 CPU */ 00080 unsigned int C2Result[64]; /* Result from last algorithm */ 00081 } TrgSumData; 00082 00083 typedef struct { 00084 char name[4]; 00085 int length; /* Byte count of data that follows */ 00086 unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */ 00087 } DataBlock; 00088 00089 typedef struct { 00090 char name[4]; /* Contains BBC */ 00091 int length; /* Byte count of data that follows */ 00092 unsigned short BBClayer1[16]; /* This is the layer1 DSM that feeds the VTX DSM */ 00093 unsigned short ZDClayer1[8]; /* This is the new layer1 ZDC DSM that also feeds the VTX DSM */ 00094 unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/ 00095 } BBCBlock; 00096 00097 typedef struct { 00098 char name[4]; /* Contains MIX */ 00099 int length; /* Byte count of data that follows */ 00100 unsigned short FPDEastNSLayer1[8]; /* FPD east north/south layer 1 */ 00101 unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */ 00102 unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */ 00103 unsigned short TOF[48]; /* TOF data */ 00104 } MIXBlock; 00105 00106 typedef struct { 00107 char name[4]; 00108 int length; /* Byte count of data that follows */ 00109 int dataLoss; /* Byte count of data truncated due to buffer limitations */ 00110 unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */ 00111 } QTBlock; 00112 00113 typedef struct { 00114 char name[4]; 00115 int length; 00116 unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */ 00117 } BEastBlock; 00118 00119 typedef struct { 00120 char name[4]; 00121 int length; 00122 unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */ 00123 } BWestBlock; 00124 00125 typedef struct { 00126 char name[4]; 00127 int length; 00128 unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */ 00129 unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */ 00130 unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */ 00131 } BELayerBlock; 00132 00133 typedef struct { 00134 char name[4]; 00135 int length; 00136 unsigned char FMS[256]; /* 16 DSMs for FMS */ 00137 } FMSBlock; 00138 00139 typedef struct { 00140 int offset; /* Offset (in bytes) from the start of Trigger block to data */ 00141 int length; /* Length (in bytes) of data */ 00142 } TrgOfflen; 00143 00144 typedef struct { 00145 int FormatVersion; /* Trigger Data Definition Version yymmddvv */ 00146 int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */ 00147 int eventNumber; /* Event number in this run */ 00148 TrgOfflen EventDesc_ofl; /* Offset/length pair to Event Descriptor */ 00149 TrgOfflen L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */ 00150 TrgOfflen Summary_ofl; /* Offset/length pair to Summary Data */ 00151 TrgOfflen MainX[MAX_OFFLEN]; /* Offset/length pairs for main crossing */ 00152 int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */ 00153 int raw_data[MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */ 00154 } TriggerDataBlk; 00155 00156 00157 00158 00159 // jml - 9/12/11 00160 // 00161 // These are the data blocks transferred from L1 --> L2 via stp 00162 // Back engineered and relabled. 00163 // Originally there were multiple instances of these structures in a very confusing set of 00164 // of local directories and trgStructures.h etc... Many structs were not consistent 00165 // 00166 // The 2011 nomenclature is just to differentiate between these structs and the obsolete ones. The 00167 // underlying format does not change in 2011 00168 00169 // These are the datum that L1 creates... 00170 typedef struct { 00171 EvtDescData EvtDesc; /* L1 Event Descriptor Data */ 00172 L1_DSM_Data L1_DSM; /* L1 DSM Data */ 00173 TrgSumData TrgSum; /* Summary data */ 00174 } L1DataType2011; 00175 00176 // This is the specialized L1 version of the dsmMemcpy2Buf packet 00177 // which is shipped L1-->L2 Note that the size is 876 bytes which is not 8 byte aligned 00178 // The start of this buffer has to be 8 byte aligned for STP sends, however... 00179 typedef struct { 00180 int src_nodeId; /* Source nodeId */ 00181 int cur_token; 00182 int Npre; 00183 int Npost; 00184 unsigned int localClock; /* Local DSM clock */ 00185 int numGroup; /* Number of DSMs in first group */ 00186 int numDSM; /* Total number of DSMs */ 00187 int byteCount; /* Ensure alignment of long long */ 00188 00189 //long long dsmData[RAW_MAX_LEN*11/8]; /* Make this 8-byte aligned */ 00190 L1DataType2011 l1Data; // This is the true format of the "dsmData" for L1 00191 } L1_Data_Block2011; 00192 00193 // This structure is for internal use in L1. This structure has a length that is 8-byte 00194 // aligned so that elements of an array remain 8 byte aligned. 00195 typedef struct { 00196 L1_Data_Block2011 l1; 00197 UINT32 currentBusy; 00198 //unsigned int pad; 00199 } L1_Data_Storage2011; 00200 00201 #endif 00202
1.5.9