74 #ifndef StTriggerData2009_hh
75 #define StTriggerData2009_hh
77 #include "StTriggerData.h"
78 #include "StDaqLib/TRG/trgStructures2009.h"
87 void readData() {readData(0,0);}
92 unsigned int version()
const;
93 unsigned int numberOfPreXing()
const;
94 unsigned int numberOfPostXing()
const;
97 unsigned int eventNumber()
const;
98 unsigned int token()
const;
99 unsigned int triggerWord()
const;
100 unsigned int actionWord()
const;
101 unsigned short busyStatus()
const;
102 unsigned short dsmInput()
const;
103 unsigned short trgToken()
const;
104 unsigned short dsmAddress()
const;
105 unsigned short mAddBits()
const;
106 unsigned short bcData(
int channel)
const;
109 int L2ResultsOffset(StL2AlgorithmId
id)
const;
110 bool isL2Triggered(StL2TriggerResultType
id)
const;
111 unsigned long long l2sum()
const;
114 unsigned int bunchCounterHigh()
const;
115 unsigned int bunchCounterLow()
const;
116 unsigned int bunchId48Bit()
const;
117 unsigned int bunchId7Bit()
const;
118 unsigned int spinBit()
const;
119 unsigned int spinBitYellowFilled()
const;
120 unsigned int spinBitYellowUp()
const;
121 unsigned int spinBitYellowDown()
const;
122 unsigned int spinBitYellowUnpol()
const;
123 unsigned int spinBitBlueFilled()
const;
124 unsigned int spinBitBlueUp()
const;
125 unsigned int spinBitBlueDown()
const;
126 unsigned int spinBitBlueUnpol()
const;
129 unsigned short tcuBits()
const;
130 unsigned short lastDSM(
int address)
const;
131 unsigned short bemcLayer1DSM(
int channel,
int prepost=0)
const;
132 unsigned short eemcLayer1DSM(
int channel,
int prepost=0)
const;
133 unsigned short emcLayer2DSM(
int channel)
const;
134 unsigned short fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost=0)
const;
136 unsigned short fpdLayer2DSMRaw(
int channel)
const;
146 unsigned short bbcADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
147 unsigned short bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
148 unsigned short bbcADCSum(StBeamDirection eastwest,
int prepost=0)
const;
149 unsigned short bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost=0)
const;
150 unsigned short bbcEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
151 unsigned short bbcTimeDifference()
const;
152 unsigned short bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost=0)
const;
153 unsigned short bbcTimeDifferenceLarge()
const;
156 unsigned short fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost=0)
const;
157 unsigned short fpdSum(StBeamDirection eastwest,
int module)
const;
160 unsigned short nQTdata(
int prepost=0)
const;
161 unsigned int* QTdata(
int prepost=0)
const;
162 unsigned short fmsADC(
int crt,
int adr,
int ch,
int prepost=0)
const;
163 unsigned short fmsTDC(
int crt,
int adr,
int ch,
int prepost=0)
const;
166 bool zdcPresent(
int prepost=0)
const;
167 unsigned short zdcAtChannel(
int channel,
int prepost=0)
const;
168 unsigned short zdcAtAddress(
int address,
int prepost=0)
const;
169 unsigned short zdcUnAttenuated(StBeamDirection eastwest,
int prepost=0)
const;
170 unsigned short zdcAttenuated(StBeamDirection eastwest,
int prepost=0)
const;
171 unsigned short zdcADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
172 unsigned short zdcTDC(StBeamDirection eastwest,
int prepost=0)
const;
173 unsigned short zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
174 unsigned short zdcHardwareSum(
int prepost=0)
const;
176 unsigned short zdcEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
177 bool zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
178 bool zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
179 bool zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
180 unsigned short zdcTruncatedSum(StBeamDirection eastwest,
int prepost=0)
const;
182 bool zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const;
183 bool zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const;
184 bool zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const;
185 unsigned short zdcTimeDifference()
const;
187 bool zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const;
188 bool zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const;
189 bool zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const;
190 bool zdcTimeDifferenceInWindow()
const;
193 bool zdcSMDPresent(
int prepost=0)
const;
194 unsigned short zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost=0)
const;
195 unsigned short zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost=0)
const;
198 unsigned char bemcHighTower(
int patch_id,
int prepost=0)
const;
199 unsigned char bemcJetPatch (
int patch_id,
int prepost=0)
const;
200 unsigned char eemcHighTower(
int patch_id,
int prepost=0)
const;
201 unsigned char eemcJetPatch (
int patch_id,
int prepost=0)
const;
202 unsigned char bemcHighestTowerADC(
int prepost=0)
const;
203 unsigned char eemcHighestTowerADC(
int prepost=0)
const;
206 unsigned short vpdADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
207 unsigned short vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
208 unsigned short vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
209 unsigned short vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
210 unsigned short vpdEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
211 unsigned short vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost=0)
const;
212 unsigned short vpdTimeDifference()
const;
215 unsigned short mtdAtAddress(
int address,
int prepost=0)
const;
216 unsigned short mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
217 unsigned short mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
218 unsigned char mtdDsmAtCh(
int ch,
int prepost=0)
const;
219 bool mtdDsmHit(
int pmt,
int prepost=0)
const;
220 unsigned short mtdgemAtAddress(
int address,
int prepost=0)
const;
223 unsigned short tofAtAddress(
int address,
int prepost=0)
const;
224 unsigned short tofTrayMultiplicity(
int tray,
int prepost=0)
const;
225 unsigned short tofMultiplicity(
int prepost=0)
const;
228 unsigned short pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost=0)
const;
229 unsigned short pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost=0)
const;
230 unsigned long pp2ppDSM(
int prepost=0)
const;
233 char* getTriggerStructure();
235 int getRawSize()
const;
237 unsigned char* getDsm0_BEMCE(
int prepost=0)
const;
238 unsigned char* getDsm0_BEMCW(
int prepost=0)
const;
239 unsigned short* getDsm1_BEMC(
int prepost=0)
const;
240 unsigned char* getDsm0_EEMC(
int prepost=0)
const;
241 unsigned short* getDsm1_EEMC(
int prepost=0)
const;
242 unsigned short* getDsm2_EMC()
const;
244 unsigned short* getDsm3()
const;
245 unsigned char* getDsm_FMS(
int prepost=0)
const;
248 unsigned short* getDsm1_FMS(
int prepost=0)
const;
249 unsigned short* getDsm2_FMS()
const;
250 unsigned int l2ResultLength()
const;
251 const unsigned int* l2Result()
const;
275 unsigned short mxq[11][16][32],feq[11][16][32],bbq[11][16][32],qt1[11][16][32],qt2[11][16][32],qt3[11][16][32],qt4[11][16][32];
276 unsigned char tmxq[11][16][32],tfeq[11][16][32],tbbq[11][16][32],tqt1[11][16][32],tqt2[11][16][32],tqt3[11][16][32],tqt4[11][16][32];
284 void swapRawDet(
DataBlock2009* data,
int name,
int hlength,
int bs);
291 swapI((
unsigned int*)&offlen->offset);
292 swapI((
unsigned int*)&offlen->length);
297 swapI((
unsigned int*)&TrgData->FormatVersion);
298 swapI((
unsigned int*)&TrgData->totalTriggerLength);
299 swapI((
unsigned int*)&TrgData->eventNumber);
300 swapOfflen(&TrgData->EventDesc_ofl);
301 swapOfflen(&TrgData->L1_DSM_ofl);
302 swapOfflen(&TrgData->Summary_ofl);
303 swapIn((
unsigned int*)TrgData->PrePostList,10);
308 swapIn((
unsigned int*)&EvtDesc->length,3);
309 swapSCC((
unsigned int*)&EvtDesc->actionWdDetectorBitMask);
310 swapSSn((
unsigned int*)&EvtDesc->TrgToken,12);
315 swapI((
unsigned int*)&L1_DSM->length);
316 swapSSn((
unsigned int*)L1_DSM->TOF,16+8*6);
321 swapIn((
unsigned int*)&TrgSum->length,1+2+2+32+64+64);
324 inline void StTriggerData2009::swapRawDetOfflen(
TrgOfflen2009* offlen)
327 for (i=0; i<y9MAX_OFFLEN; i++) {
328 swapOfflen(&offlen[i]);
329 if (mDebug>0) printf(
"Offlen id=%2d offset=%d length=%d\n", i, offlen[i].offset, offlen[i].length);
333 inline void StTriggerData2009::swapRawDet(
DataBlock2009*
data,
int name,
int hlength,
int bs)
339 int header_length = 8;
340 if(bs) swapI((
unsigned int*)&data->length);
342 case y9MXQ_CONF_NUM :
case y9FEQ_CONF_NUM :
case y9BBQ_CONF_NUM :
343 case y9QT1_CONF_NUM :
case y9QT2_CONF_NUM :
case y9QT3_CONF_NUM :
case y9QT4_CONF_NUM :
344 header_length = 12;
break;
346 if (hlength != data->length + header_length){
347 mErrorFlag = mErrorFlag | (1 << name);
348 printf(
"StTriggerData2009: Error reading Block=%2d [%1c%1c%1c%1c] length %d != %d + %d\n",
349 name,data->name[0],data->name[1],data->name[2],data->name[3],
350 hlength,data->length,header_length);
351 printf(
"StTriggerData2009: Droping the data block =%2d [%1c%1c%1c%1c] with ErrorFlag=0x%x\n",
352 name,data->name[0],data->name[1],data->name[2],data->name[3],mErrorFlag);
358 case y9BC1_CONF_NUM :
360 swapSSn((
unsigned int*)bc1->BEMClayer1,48);
361 swapSSn((
unsigned int*)bc1->EEMClayer1,16);
363 case y9MIX_CONF_NUM :
365 swapSSn((
unsigned int*)mix->FPDEastNSLayer1,8);
366 swapSSn((
unsigned int*)mix->TOFLayer1,8+48);
368 case y9BCW_CONF_NUM :
371 case y9BCE_CONF_NUM :
374 case y9BBC_CONF_NUM :
376 swapSSn((
unsigned int*)bbc->BBClayer1,16+8+8);
378 case y9FMS_CONF_NUM :
381 case y9MXQ_CONF_NUM :
382 case y9FEQ_CONF_NUM :
383 case y9BBQ_CONF_NUM :
384 case y9QT1_CONF_NUM :
385 case y9QT2_CONF_NUM :
386 case y9QT3_CONF_NUM :
387 case y9QT4_CONF_NUM :
389 swapI((
unsigned int*)&qtdata->dataLoss);
390 swapIn(qtdata->data, qtdata->length/4);
395 printf(
"Read id=%2d name=%1c%1c%1c%1c length=%d\n",
396 name,data->name[0],data->name[1],data->name[2],data->name[3],data->length);