30 #include "StTriggerData2019.h"
43 mYear=2019; mRun = run; mDebug = 0;
50 mYear=2019; mRun = run; mDebug = dbg;
51 if(mDebug==1) printf(
"StTriggerData2019 Constructor with trigger data block and byteswap option=%d\n",bs);
56 void StTriggerData2019::blindRunInfo()
58 mRun=1000000*int(mRun/1000000);
59 mData->eventNumber = 0;
60 EvtDesc->bunchXing_hi = 0;
61 EvtDesc->bunchXing_lo = 0;
62 L1_DSM->BCdata[2] = 0;
63 L1_DSM->BCdata[3] = 0;
64 L1_DSM->BCdata[10] = 0;
65 L1_DSM->BCdata[11] = 0;
70 if (data==0) {copyflag=0;}
71 if(mDebug==1) printf(
"StTriggerData2019::readData copyflag=%d byteswap=%d data=%p mData=%p\n",copyflag,bs,data,mData);
74 unsigned int ver = data->FormatVersion;
77 if (ver == y19FORMAT_VERSION ) {
78 if (mDebug==1) printf(
"StTriggerData2019: version = 0x%x (0x%x or 0x08121140)\n",ver,y19FORMAT_VERSION);
81 mErrorFlag = mErrorFlag | 0x1;
82 printf(
"StTriggerData2019: version = 0x%x != (0x%x)\n",ver,y19FORMAT_VERSION);
86 unsigned int size = data->totalTriggerLength;
88 if (size > y19MAX_TRG_BLK_SIZE) {
89 gMessMgr->Warning() <<
"StTriggerData2019: Data length = " << size
90 <<
" is bigger than max = " << y19MAX_TRG_BLK_SIZE
94 if (mDebug==1) printf(
"StTriggerData2019: size = %d, maxsize = %d\n",size,y19MAX_TRG_BLK_SIZE);
95 memcpy(mData,data,size);
99 if (bs) swapDataBlk(mData);
101 printf(
"StTriggerData2019: version = 0x%x (0x%x)\n",mData->FormatVersion,y19FORMAT_VERSION);
102 printf(
"StTriggerData2019: size = %d, maxsize = %d\n",mData->totalTriggerLength,y19MAX_TRG_BLK_SIZE);
103 printf(
"EventDesc length=%10d offset=%10d\n",mData->EventDesc_ofl.length,mData->EventDesc_ofl.offset);
104 printf(
"L1_DSM length=%10d offset=%10d\n",mData->L1_DSM_ofl.length,mData->L1_DSM_ofl.offset);
105 printf(
"Summary length=%10d offset=%10d\n",mData->Summary_ofl.length,mData->Summary_ofl.offset);
108 EvtDesc=0; L1_DSM=0; TrgSum=0;
109 if (mData->EventDesc_ofl.length > 0) EvtDesc = (
EvtDescData2019*)((
char*)mData + mData->EventDesc_ofl.offset);
110 if (mData->L1_DSM_ofl.length > 0) L1_DSM = (
L1_DSM_Data2019*)((
char*)mData + mData->L1_DSM_ofl.offset);
111 if (mData->Summary_ofl.length > 0) TrgSum = (
TrgSumData2019* )((
char*)mData + mData->Summary_ofl.offset);
113 if (EvtDesc) swapEvtDesc(EvtDesc);
114 if (L1_DSM) swapL1_DSM(L1_DSM);
115 if (TrgSum) swapTrgSum(TrgSum);
117 if (EvtDesc==0 || L1_DSM==0 || TrgSum==0){
118 mErrorFlag = mErrorFlag | 0x1;
119 gMessMgr->Warning() <<
"StTriggerData2019: EvtDesc, L1_DSM or TrgSum is missing"
120 <<
" mErrorFlag="<<mErrorFlag<<endm;
123 int npre = numberOfPreXing();
124 int npost = numberOfPostXing();
125 if (npre<0 || npre>10 || npost<0 || npost>10){
126 mErrorFlag = mErrorFlag | 0x2;
127 gMessMgr->Warning() <<
"StTriggerData2019: Invalid npre/post = "<< npre <<
" / " << npost
128 <<
" mErrorFlag="<<mErrorFlag<<endm;
130 if (mDebug==1) printf(
"StTriggerData2019: pre=%d post=%d\n",npre,npost);
132 memset(mBC1,0,
sizeof(mBC1));
133 memset(mMXQ,0,
sizeof(mMXQ));
134 memset(mMIX,0,
sizeof(mMIX));
135 memset(mBCW,0,
sizeof(mBCW));
136 memset(mBCE,0,
sizeof(mBCE));
137 memset(mEQ3,0,
sizeof(mEQ3));
138 memset(mBBC,0,
sizeof(mBBC));
139 memset(mBBQ,0,
sizeof(mBBQ));
140 memset(mFMS,0,
sizeof(mFMS));
141 memset(mQT1,0,
sizeof(mQT1));
142 memset(mQT2,0,
sizeof(mQT2));
143 memset(mQT3,0,
sizeof(mQT3));
144 memset(mQT4,0,
sizeof(mQT4));
145 memset(mEQ1,0,
sizeof(mEQ1));
146 memset(mEQ2,0,
sizeof(mEQ2));
147 memset(mxq,0,
sizeof(mxq)); memset(tmxq,0,
sizeof(tmxq));
148 memset(eq3,0,
sizeof(eq3)); memset(teq3,0,
sizeof(teq3));
149 memset(bbq,0,
sizeof(bbq)); memset(tbbq,0,
sizeof(tbbq));
150 memset(qt1,0,
sizeof(qt1)); memset(tqt1,0,
sizeof(tqt1));
151 memset(qt2,0,
sizeof(qt2)); memset(tqt2,0,
sizeof(tqt2));
152 memset(qt3,0,
sizeof(qt3)); memset(tqt3,0,
sizeof(tqt3));
153 memset(qt4,0,
sizeof(qt4)); memset(tqt4,0,
sizeof(tqt4));
154 memset(eq1,0,
sizeof(eq1)); memset(teq1,0,
sizeof(teq1));
155 memset(eq2,0,
sizeof(eq2)); memset(teq2,0,
sizeof(teq2));
158 for (
int i=0; i<1+npre+npost; i++) {
161 offlen = mData->MainX;
165 if (mData->PrePostList[i-1]==0)
continue;
166 offlen = (
TrgOfflen2019*) ((
char*)mData + mData->PrePostList[i-1]);
168 if (bs) swapRawDetOfflen(offlen);
169 for(
int k=0; k<y19MAX_OFFLEN; k++) {
170 if(static_cast<unsigned int>(offlen[k].length + offlen[k].offset) > static_cast<unsigned int>(mData->totalTriggerLength)) {
171 mErrorFlag = mErrorFlag | (1 << k);
172 gMessMgr->Warning() <<
"StTriggerData2019: offset ("<<offlen[k].offset<<
") + length ("<<offlen[k].length
173 <<
") exceeds total size("<<mData->totalTriggerLength<<
") for data block id="<<k
174 <<
" mErrorFlag="<<mErrorFlag<<endm;
178 j=offlen[y19BC1_CONF_NUM].length;
if (j>0){mBC1[i] = (
BELayerBlock2019*)((
char*)mData + offlen[y19BC1_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mBC1[i],y19BC1_CONF_NUM,j,bs);}
179 j=offlen[y19MXQ_CONF_NUM].length;
if (j>0){mMXQ[i] = (
QTBlock2019* )((
char*)mData + offlen[y19MXQ_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mMXQ[i],y19MXQ_CONF_NUM,j,bs);}
180 j=offlen[y19MIX_CONF_NUM].length;
if (j>0){mMIX[i] = (
MIXBlock2019* )((
char*)mData + offlen[y19MIX_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mMIX[i],y19MIX_CONF_NUM,j,bs);}
181 j=offlen[y19BCW_CONF_NUM].length;
if (j>0){mBCW[i] = (
BWestBlock2019* )((
char*)mData + offlen[y19BCW_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mBCW[i],y19BCW_CONF_NUM,j,bs);}
182 j=offlen[y19BCE_CONF_NUM].length;
if (j>0){mBCE[i] = (
BEastBlock2019* )((
char*)mData + offlen[y19BCE_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mBCE[i],y19BCE_CONF_NUM,j,bs);}
183 j=offlen[y19EQ3_CONF_NUM].length;
if (j>0){mEQ3[i] = (
QTBlock2019* )((
char*)mData + offlen[y19EQ3_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mEQ3[i],y19EQ3_CONF_NUM,j,bs);}
184 j=offlen[y19BBC_CONF_NUM].length;
if (j>0){mBBC[i] = (
BBCBlock2019* )((
char*)mData + offlen[y19BBC_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mBBC[i],y19BBC_CONF_NUM,j,bs);}
185 j=offlen[y19BBQ_CONF_NUM].length;
if (j>0){mBBQ[i] = (
QTBlock2019* )((
char*)mData + offlen[y19BBQ_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mBBQ[i],y19BBQ_CONF_NUM,j,bs);}
186 j=offlen[y19FMS_CONF_NUM].length;
if (j>0){mFMS[i] = (
FMSBlock2019* )((
char*)mData + offlen[y19FMS_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mFMS[i],y19FMS_CONF_NUM,j,bs);}
187 j=offlen[y19QT1_CONF_NUM].length;
if (j>0){mQT1[i] = (
QTBlock2019* )((
char*)mData + offlen[y19QT1_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mQT1[i],y19QT1_CONF_NUM,j,bs);}
188 j=offlen[y19QT2_CONF_NUM].length;
if (j>0){mQT2[i] = (
QTBlock2019* )((
char*)mData + offlen[y19QT2_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mQT2[i],y19QT2_CONF_NUM,j,bs);}
189 j=offlen[y19QT3_CONF_NUM].length;
if (j>0){mQT3[i] = (
QTBlock2019* )((
char*)mData + offlen[y19QT3_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mQT3[i],y19QT3_CONF_NUM,j,bs);}
190 j=offlen[y19QT4_CONF_NUM].length;
if (j>0){mQT4[i] = (
QTBlock2019* )((
char*)mData + offlen[y19QT4_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mQT4[i],y19QT4_CONF_NUM,j,bs);}
191 j=offlen[y19EQ1_CONF_NUM].length;
if (j>0){mEQ1[i] = (
QTBlock2019* )((
char*)mData + offlen[y19EQ1_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mEQ1[i],y19EQ1_CONF_NUM,j,bs);}
192 j=offlen[y19EQ2_CONF_NUM].length;
if (j>0){mEQ2[i] = (
QTBlock2019* )((
char*)mData + offlen[y19EQ2_CONF_NUM].offset); swapRawDet((
DataBlock2019*)mEQ2[i],y19EQ2_CONF_NUM,j,bs);}
193 if (mMXQ[i]) decodeQT(mMXQ[i]->length/4, mMXQ[i]->data, mxq[i], tmxq[i]);
194 if (mEQ3[i]) decodeQT(mEQ3[i]->length/4, mEQ3[i]->data, eq3[i], teq3[i]);
195 if (mBBQ[i]) decodeQT(mBBQ[i]->length/4, mBBQ[i]->data, bbq[i], tbbq[i]);
196 if (mQT1[i]) decodeQT(mQT1[i]->length/4, mQT1[i]->data, qt1[i], tqt1[i]);
197 if (mQT2[i]) decodeQT(mQT2[i]->length/4, mQT2[i]->data, qt2[i], tqt2[i]);
198 if (mQT3[i]) decodeQT(mQT3[i]->length/4, mQT3[i]->data, qt3[i], tqt3[i]);
199 if (mQT4[i]) decodeQT(mQT4[i]->length/4, mQT4[i]->data, qt4[i], tqt4[i]);
200 if (mEQ1[i]) decodeQT(mEQ1[i]->length/4, mEQ1[i]->data, eq1[i], teq1[i]);
201 if (mEQ2[i]) decodeQT(mEQ2[i]->length/4, mEQ2[i]->data, eq2[i], teq2[i]);
203 if (mDebug==1) dump();
206 StTriggerData2019::~StTriggerData2019() {
delete mData;}
208 unsigned int StTriggerData2019::version()
const
210 return EvtDesc->TrgDataFmtVer;
213 unsigned int StTriggerData2019::eventNumber()
const
215 return mData->eventNumber;
218 unsigned int StTriggerData2019::token()
const
220 return EvtDesc->TrgToken;
223 unsigned int StTriggerData2019::triggerWord()
const
228 unsigned int StTriggerData2019::actionWord()
const
231 ( (
unsigned short)(EvtDesc->actionWdTrgCommand) * 16 * 16 * 16 ) +
232 ( (
unsigned short)(EvtDesc->actionWdDaqCommand) * 16 * 16 ) +
233 ( EvtDesc->actionWdDetectorBitMask & 0x00ff );
236 unsigned int StTriggerData2019::numberOfPreXing()
const
238 return EvtDesc->npre & 0xf;
241 unsigned int StTriggerData2019::numberOfPostXing()
const
243 return EvtDesc->npost & 0xf;
246 unsigned short StTriggerData2019::busyStatus()
const
248 return EvtDesc->internalBusy;
251 unsigned short StTriggerData2019::dsmInput()
const
253 return EvtDesc->DSMInput;
256 unsigned short StTriggerData2019::trgToken()
const
258 return EvtDesc->TrgToken;
261 unsigned short StTriggerData2019::dsmAddress()
const
263 return EvtDesc->DSMAddress;
266 unsigned short StTriggerData2019::mAddBits()
const
268 return EvtDesc->addBits;
271 unsigned short StTriggerData2019::bcData(
int channel)
const
273 return L1_DSM->BCdata[channel];
276 unsigned short StTriggerData2019::getTrgDetMask()
const
278 return EvtDesc->trgDetMask;
281 unsigned int StTriggerData2019::getTrgCrateMask()
const
283 unsigned int p = EvtDesc->npost & 0xfff0;
284 unsigned int r = EvtDesc->res1 & 0x0ff0;
286 ( ((EvtDesc->npre & 0xfff0) >> 4)
291 unsigned short StTriggerData2019::lastDSM(
int channel)
const
293 return L1_DSM->lastDSM[channel];
297 unsigned short StTriggerData2019::vertexDSM(
int channel)
const
299 int dsmmap[8] = {3,2,1,0,7,6,5,4};
300 if(channel<0 || channel>7)
return 0;
301 return L1_DSM->VTX[dsmmap[channel]];
304 unsigned short StTriggerData2019::tcuBits()
const
306 return EvtDesc->DSMInput;
310 unsigned int StTriggerData2019::tcuCounter()
const
312 unsigned int hi = EvtDesc->tcuCtrBunch_hi;
313 return (hi << 16) + EvtDesc->DSMAddress;
316 unsigned int StTriggerData2019::rccCounter(
int crate)
const
318 if(crate >= y19L1_CONF_NUM && crate <= y19EQ2_CONF_NUM){
319 return TrgSum->LocalClocks[crate];
324 unsigned long long StTriggerData2019::bunchCounter()
const
326 unsigned long long bxinghi,bxing1,bxinglo, bx;
327 bxinghi = L1_DSM->BCdata[3];
328 bxing1 = L1_DSM->BCdata[10];
329 bxinglo = (bxing1 << 16) + L1_DSM->BCdata[11];
330 bx = (bxinghi << 32) + bxinglo;
334 unsigned int StTriggerData2019::bunchCounterHigh()
const
336 return EvtDesc->bunchXing_hi;
339 unsigned int StTriggerData2019::bunchCounterLow()
const
341 return EvtDesc->bunchXing_lo;
344 unsigned int StTriggerData2019::bunchId48Bit()
const
346 return (
int)(bunchCounter() % 120);
349 unsigned int StTriggerData2019::bunchId7Bit()
const
352 b7dat = L1_DSM->BCdata[2];
357 unsigned int StTriggerData2019::revTick1()
const
359 return L1_DSM->BCdata[1] & 0x1;
362 unsigned int StTriggerData2019::revTick2()
const
364 return L1_DSM->BCdata[12] & 0x1;
367 unsigned int StTriggerData2019::revTick3()
const
369 return (L1_DSM->lastDSM[4] >> 3) & 0x1;
372 unsigned int StTriggerData2019::spinBit()
const
374 return (L1_DSM->lastDSM[4]/16)%256;
377 unsigned int StTriggerData2019::spinBitYellowFilled()
const
379 unsigned int sb = spinBit();
383 unsigned int StTriggerData2019::spinBitYellowUp()
const
388 unsigned int StTriggerData2019::spinBitYellowDown()
const
393 unsigned int StTriggerData2019::spinBitYellowUnpol()
const
398 unsigned int StTriggerData2019::spinBitBlueFilled()
const
400 unsigned int sb = spinBit();
404 unsigned int StTriggerData2019::spinBitBlueUp()
const
409 unsigned int StTriggerData2019::spinBitBlueDown()
const
414 unsigned int StTriggerData2019::spinBitBlueUnpol()
const
419 unsigned short StTriggerData2019::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
421 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
422 4, 4, 4, 4, 4, 4, 4, 4},
423 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 4, 4, 4, 4, 4, 4, 4, 4} };
425 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
426 0, 1, 2, 3, 8, 9,10,11},
427 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
428 16,17,18,19,24,25,26,27} };
429 int buffer = prepostAddress(prepost);
430 if (buffer >= 0 && pmt>=1 && pmt<=16)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]];
434 unsigned short StTriggerData2019::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
436 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
437 4, 4, 4, 4, 4, 4, 4, 4},
438 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 4, 4, 4, 4, 4, 4, 4, 4} };
440 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
441 0, 1, 2, 3, 8, 9,10,11},
442 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
443 16,17,18,19,24,25,26,27} };
444 int buffer = prepostAddress(prepost);
445 if (buffer >= 0 && pmt>=1 && pmt<=16)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]+4];
449 unsigned short StTriggerData2019::bbcTDC5bit(StBeamDirection eastwest,
int pmt,
int prepost)
const
451 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
452 4, 4, 4, 4, 4, 4, 4, 4},
453 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 4, 4, 4, 4, 4, 4, 4, 4} };
455 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
456 0, 1, 2, 3, 8, 9,10,11},
457 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
458 16,17,18,19,24,25,26,27} };
459 int buffer = prepostAddress(prepost);
460 if (buffer >= 0 && pmt>=1 && pmt<=16)
return tbbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]];
464 unsigned short StTriggerData2019::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
466 unsigned short sum=0;
467 int buffer = prepostAddress(prepost);
471 if(eastwest==east) { sum = mBBC[buffer]->BBClayer1[3]; }
472 else { sum = mBBC[buffer]->BBClayer1[1]; }
478 unsigned short StTriggerData2019::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
480 unsigned short sum=0;
486 unsigned short StTriggerData2019::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
488 int buffer = prepostAddress(prepost);
491 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[2]%4096;}
492 else {
return mBBC[buffer]->BBClayer1[0]%4096;}
498 unsigned short StTriggerData2019::bbcTimeDifference()
const
500 return L1_DSM->VTX[3]%8192;
503 unsigned short StTriggerData2019::bbcTacSum()
const
505 return (((L1_DSM->VTX[3]) >> 13) & 0x1);
508 unsigned short StTriggerData2019::bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost)
const
521 unsigned short StTriggerData2019::bbcTimeDifferenceLarge()
const
523 return L1_DSM->VTX[2]%8192;
527 unsigned short StTriggerData2019::bbcBB101(
int ch,
int prepost)
const
529 int dsmmap[8] = {3,2,1,0,7,6,5,4};
530 int buffer = prepostAddress(prepost);
533 if(ch>=0 && ch<=7)
return mBBC[buffer]->BBClayer1[dsmmap[ch]];
539 unsigned short StTriggerData2019::bbcBB102(
int ch,
int prepost)
const
541 int dsmmap[8] = {3,2,1,0,7,6,5,4};
542 int buffer = prepostAddress(prepost);
545 if(ch>=0 && ch<=7)
return mBBC[buffer]->BBClayer1[dsmmap[ch]+8];
551 unsigned short StTriggerData2019::epdTimeDifference()
const
553 return L1_DSM->VTX[6]%8192;
556 bool StTriggerData2019::epdHitLayer2(StBeamDirection eastwest)
const
558 if(eastwest==east)
return (L1_DSM->VTX[6] & 0x40) ?
true :
false;
559 return (L1_DSM->VTX[6] & 0x80) ?
true :
false;
562 unsigned short StTriggerData2019::epdLayer0t(
int ch,
int prepost)
const
564 int dsmmap[16] = {3,2,1,0,7,6,5,4, 11,10,9,8,15,14,13,12};
565 int buffer = prepostAddress(prepost);
568 if(ch>=0 && ch<16)
return mBBC[buffer]->EPDlayer0t[dsmmap[ch]];
574 unsigned short StTriggerData2019::epdLayer0a(
int ch,
int prepost)
const
576 int dsmmap[16] = {3,2,1,0,7,6,5,4, 11,10,9,8,15,14,13,12};
577 int buffer = prepostAddress(prepost);
580 if(ch>=0 && ch<16)
return mBBC[buffer]->EPDlayer0a[dsmmap[ch]];
586 unsigned char StTriggerData2019::epdLayer0h(
int ch,
int prepost)
const
588 int dsmmap[32] = { 7, 6, 5, 4, 3, 2, 1, 0,
589 15,14,13,12,11,10, 9, 8,
590 23,22,21,20,19,18,17,16,
591 31,30,29,28,27,26,25,24};
592 int buffer = prepostAddress(prepost);
595 if(ch>=0 && ch<32)
return mBBC[buffer]->EPDlayer0h[dsmmap[ch]];
601 unsigned short StTriggerData2019::epdLayer1(
int ch,
int prepost)
const
603 return epdLayer1a(ch,prepost);
606 unsigned short StTriggerData2019::epdLayer1a(
int ch,
int prepost)
const
608 int dsmmap[8] = {3,2,1,0,7,6,5,4};
609 int buffer = prepostAddress(prepost);
612 if(ch>=0 && ch<8)
return mBBC[buffer]->EPDlayer1a[dsmmap[ch]];
618 unsigned short StTriggerData2019::epdLayer1b(
int ch,
int prepost)
const
620 int dsmmap[8] = {3,2,1,0,7,6,5,4};
621 int buffer = prepostAddress(prepost);
624 if(ch>=0 && ch<8)
return mBBC[buffer]->EPDlayer1b[dsmmap[ch]];
630 unsigned short StTriggerData2019::epdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
632 int buffer = prepostAddress(prepost);
635 unsigned short dsmEP001OutR = epdLayer1(0, prepost);
636 unsigned short dsmEP001OutL = epdLayer1(1, prepost);
637 unsigned int dsmEP001Out = (dsmEP001OutL<<16) + dsmEP001OutR;
638 int maxTac03 = (dsmEP001Out >> 12) & 0xfff;
639 int maxTac47 = (dsmEP001Out >> 0 ) & 0xfff;
640 return (maxTac03>maxTac47)?maxTac03:maxTac47;
642 unsigned short dsmEP002OutR = epdLayer1(2, prepost);
643 unsigned short dsmEP002OutL = epdLayer1(3, prepost);
644 unsigned int dsmEP002Out = (dsmEP002OutL<<16) + dsmEP002OutR;
645 int maxTac03 = (dsmEP002Out >> 12) & 0xfff;
646 int maxTac47 = (dsmEP002Out >> 0 ) & 0xfff;
647 return (maxTac03>maxTac47)?maxTac03:maxTac47;
653 unsigned short StTriggerData2019::epdNHits(StBeamDirection eastwest,
int prepost)
const
655 int buffer = prepostAddress(prepost);
658 unsigned short dsmEP001OutR = epdLayer1(0, prepost);
659 unsigned short dsmEP001OutL = epdLayer1(1, prepost);
660 unsigned int dsmEP001Out = (dsmEP001OutL<<16) + dsmEP001OutR;
661 return (dsmEP001Out >> 24) & 0xff;
663 unsigned short dsmEP002OutR = epdLayer1(2, prepost);
664 unsigned short dsmEP002OutL = epdLayer1(3, prepost);
665 unsigned int dsmEP002Out = (dsmEP002OutL<<16) + dsmEP002OutR;
666 return (dsmEP002Out >> 24) & 0xff;
672 unsigned short StTriggerData2019::epdLayer0aMult(
int ch,
int prepost)
const{
674 return epdLayer0a(ch,prepost) & 0x001f;
677 unsigned short StTriggerData2019::epdLayer0hMult(
int ch,
int mult12,
int prepost)
const{
679 unsigned short dsm=0, c=ch, out=0;
680 if(ch>=10) {dsm=1; c=ch-10;}
681 unsigned short chdiv=c/2;
682 unsigned short chmod=c%2;
683 unsigned short base=dsm*16 + chdiv*3;
684 unsigned short o0=epdLayer0h(base , prepost);
685 unsigned short o1=epdLayer0h(base+1, prepost);
686 unsigned short o2=epdLayer0h(base+2, prepost);
688 out = o0 + ((o1 & 0x0f)<<8);
690 out = ((o1 & 0xf0)>>4) + (o2<<4);
692 if(mult12==0)
return out;
693 if(mult12==1)
return (out & 0x003f);
694 if(mult12==2)
return (out & 0x0fc0) >> 6;
698 unsigned short StTriggerData2019::epdNHitsQT(
int crate,
int qt,
int mult12,
int prepost)
const {
702 const unsigned short dsmmap[3][11]={
703 {6,6,6,6,6,6,4,4,4,4,4},
704 {5,5,5,5,5,5,3,3,3,3,3},
705 {5,5,5,3,3,6,6,6,4,4,0}
707 const unsigned short chmap[3][11]={
708 {0,1,2,3,4,5,0,1,2,3,4},
709 {0,1,2,3,4,5,0,1,2,3,4},
710 {6,7,8,5,7,6,7,8,5,7,0}
712 if(crate<1 || crate>3)
return 0;
713 if(qt<1 || qt>11)
return 0;
714 unsigned short dsm=dsmmap[crate-1][qt-1];
715 unsigned short ch=chmap[crate-1][qt-1];
716 if(dsm==3 || dsm==4)
return epdLayer0aMult(ch + (dsm-3)*8, prepost);
717 if(dsm==5 || dsm==6)
return epdLayer0hMult(ch + (dsm-5)*10, mult12, prepost);
721 unsigned short StTriggerData2019::epdLayer1bMult(StBeamDirection eastwest,
int ring,
int prepost)
const
725 case 1:
return (epdLayer1b(0,prepost) & 0x007f);
726 case 2:
return (epdLayer1b(0,prepost) & 0x7f00) >> 8;
727 case 5:
return (epdLayer1b(1,prepost) & 0x00ff);
728 case 4:
return (epdLayer1b(1,prepost) & 0xff00) >> 8;
729 case 3:
return (epdLayer1b(2,prepost) & 0x00ff);
734 case 1:
return (epdLayer1b(3,prepost) & 0x007f);
735 case 2:
return (epdLayer1b(3,prepost) & 0x7f00) >> 8;
736 case 5:
return (epdLayer1b(4,prepost) & 0x00ff);
737 case 4:
return (epdLayer1b(4,prepost) & 0xff00) >> 8;
738 case 3:
return (epdLayer1b(5,prepost) & 0x00ff);
744 unsigned short StTriggerData2019::epdMultTotal(
int prepost)
const
746 return L1_DSM->VTX[6] & 0x00ff;
749 unsigned short StTriggerData2019::epdMultDiff(
int prepost)
const
751 return (L1_DSM->VTX[6] & 0xff00) >> 8;
754 unsigned short StTriggerData2019::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
759 unsigned short StTriggerData2019::fpdSum(StBeamDirection eastwest,
int module)
const
764 unsigned short StTriggerData2019::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
765 int buffer = prepostAddress(prepost);
767 if (eastwest==east) {
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1[channel]; }
768 else {
if (mFMS[buffer])
return mFMS[buffer]->FMS[channel]; }
773 unsigned short StTriggerData2019::fpdLayer2DSMRaw(
int channel)
const{
774 if (channel<8)
return L1_DSM->FPD[channel];
778 bool StTriggerData2019::zdcPresent(
int prepost)
const
780 int buffer = prepostAddress(prepost);
781 if (buffer >= 0)
return mBBQ[buffer];
785 unsigned short StTriggerData2019::zdcAtChannel(
int channel,
int prepost)
const
787 int buffer = prepostAddress(prepost);
788 if (buffer >= 0 && channel>=0 && channel<32)
return bbq[buffer][14][channel];
792 unsigned short StTriggerData2019::zdcAtAddress(
int address,
int prepost)
const
794 return zdcAtChannel(address,prepost);
797 unsigned short StTriggerData2019::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
799 int buffer = prepostAddress(prepost);
801 if (eastwest == east)
return bbq[buffer][14][2];
802 else return bbq[buffer][14][18];
807 unsigned short StTriggerData2019::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
809 int buffer = prepostAddress(prepost);
811 if (eastwest == east)
return bbq[buffer][14][3];
812 else return bbq[buffer][14][19];
817 unsigned short StTriggerData2019::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
819 int buffer = prepostAddress(prepost);
820 if (buffer >= 0 && pmt>=1 && pmt<=3) {
821 if (eastwest == east) {
822 if (pmt == 1)
return bbq[buffer][14][0];
823 if (pmt == 2)
return bbq[buffer][14][8];
824 if (pmt == 3)
return bbq[buffer][14][9];
827 if (pmt == 1)
return bbq[buffer][14][16];
828 if (pmt == 2)
return bbq[buffer][14][24];
829 if (pmt == 3)
return bbq[buffer][14][25];
835 unsigned short StTriggerData2019::zdcTDC(StBeamDirection eastwest,
int prepost)
const
837 int buffer = prepostAddress(prepost);
839 if (eastwest == east)
return bbq[buffer][14][6];
840 else return bbq[buffer][14][22];
845 unsigned short StTriggerData2019::zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
847 int buffer = prepostAddress(prepost);
848 if (buffer >= 0 && pmt>=1 && pmt<=3) {
849 if (eastwest == east) {
850 if (pmt == 1)
return bbq[buffer][14][4];
851 if (pmt == 2)
return bbq[buffer][14][12];
852 if (pmt == 3)
return bbq[buffer][14][13];
855 if (pmt == 1)
return bbq[buffer][14][20];
856 if (pmt == 2)
return bbq[buffer][14][28];
857 if (pmt == 3)
return bbq[buffer][14][29];
863 unsigned short StTriggerData2019::zdcHardwareSum(
int prepost)
const
865 int buffer = prepostAddress(prepost);
866 if (buffer >= 0)
return bbq[buffer][14][11];
870 bool StTriggerData2019::zdcSMDPresent(
int prepost)
const
872 int buffer = prepostAddress(prepost);
873 if (buffer >= 0)
return mMXQ[buffer];
877 unsigned short StTriggerData2019::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
879 static const int zdcsmd_map[2][2][8] ={
880 { { 31, 30, 29, 28, 27, 26, 25, 19} ,
881 { 24, 23, 22, 21, 20, 16, 18, 17} } ,
882 { { 15, 14, 13, 12, 11, 10, 9, 2} ,
883 { 8, 7, 6, 5, 4, 3, 0, 1} }
885 static const int zdcsmd_map2011[2][2][8] ={
886 { {24, 25, 26, 27, 28, 29, 30, 31} ,
887 {16, 17, 18, 19, 20, 21, 22, 23} } ,
888 { {8, 9, 10, 11, 12, 13, 14, 15} ,
889 {0, 1, 2, 3, 4, 5, 6, 7} }
891 if (verthori<0 || verthori>1)
return 0;
892 if (strip<1 || strip>8)
return 0;
893 int buffer = prepostAddress(prepost);
896 return mxq[buffer][4][zdcsmd_map[eastwest][verthori][strip-1]];
898 return mxq[buffer][4][zdcsmd_map2011[eastwest][verthori][strip-1]];
904 unsigned short StTriggerData2019::zdcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
906 int buffer = prepostAddress(prepost);
910 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 12) % 16) | ((mBBC[buffer]->ZDClayer1[2] % 256) << 4);}
911 else {
return (mBBC[buffer]->ZDClayer1[3]) % 4096;}
913 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 10) % 64) | ((mBBC[buffer]->ZDClayer1[2] % 16) << 6);}
914 else {
return (mBBC[buffer]->ZDClayer1[3]) % 1024;}
921 bool StTriggerData2019::zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
922 int buffer = prepostAddress(prepost);
926 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (27-16));}
927 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
929 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
930 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (22-16));}
937 bool StTriggerData2019::zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
938 int buffer = prepostAddress(prepost);
942 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (29-16));}
943 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (26-16));}
945 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (23-16));}
946 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (20-16));}
953 bool StTriggerData2019::zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
954 int buffer = prepostAddress(prepost);
958 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (28-16));}
959 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
961 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
962 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (21-16));}
969 unsigned short StTriggerData2019::zdcTimeDifference()
const
971 return L1_DSM->VTX[1]%256;
974 bool StTriggerData2019::zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const {
975 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 10 : 11));
978 bool StTriggerData2019::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const {
979 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 12 : 14));
982 bool StTriggerData2019::zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const {
983 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 13 : 15));
986 bool StTriggerData2019::zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const {
987 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 7 : 8)); }
988 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 7 : 8)); }
991 bool StTriggerData2019::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const {
992 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 9 : 11)); }
993 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 9 : 11)); }
996 bool StTriggerData2019::zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const {
997 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 10 : 12)); }
998 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 10 : 12)); }
1001 bool StTriggerData2019::zdcTimeDifferenceInWindow()
const
1003 if(mRun<12000000){
return lastDSM(2) & (1 << 6); }
1004 else {
return lastDSM(1) & (1 << 6); }
1007 unsigned short StTriggerData2019::zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost)
const
1009 if(mRun<12000000)
return 0;
1011 int buffer = prepostAddress(prepost);
1014 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 6 : 9)) % 8;}
1015 else {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 0 : 3)) % 8;}
1021 unsigned short StTriggerData2019::zdcTruncatedSum(StBeamDirection eastwest,
int prepost)
const
1023 if(mRun<12000000)
return 0;
1024 int buffer = prepostAddress(prepost);
1027 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[2] >> (26-16)) % 8;}
1028 else {
return (mBBC[buffer]->ZDClayer1[2] >> (29-16)) % 8;}
1034 unsigned short StTriggerData2019::pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
1036 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
1037 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
1038 if (vh<0 || vh>1)
return 0;
1039 if (udio<0 || udio>1)
return 0;
1040 if (ch<0 || ch>1)
return 0;
1041 int buffer = prepostAddress(prepost);
1042 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]];
1046 unsigned short StTriggerData2019::pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
1048 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
1049 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
1050 if (vh<0 || vh>1)
return 0;
1051 if (udio<0 || udio>1)
return 0;
1052 if (ch<0 || ch>1)
return 0;
1053 int buffer = prepostAddress(prepost);
1054 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]+4];
1058 unsigned long StTriggerData2019::pp2ppDSM(
int prepost)
const {
1059 if (prepost!=0)
return 0;
1060 return L1_DSM->TOF[7];
1063 unsigned short StTriggerData2019::bemcLayer1DSM(
int channel,
int prepost)
const {
1064 const int n_bemc_layer1=48;
1065 if (channel<0 || channel >=n_bemc_layer1) {
1066 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
1069 int buffer = prepostAddress(prepost);
1070 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1[channel];
1074 unsigned short StTriggerData2019::eemcLayer1DSM(
int channel,
int prepost)
const {
1075 const int n_eemc_layer1=16;
1076 if (channel<0 || channel >=n_eemc_layer1) {
1077 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
1080 int buffer = prepostAddress(prepost);
1081 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1[channel];
1085 unsigned short StTriggerData2019::emcLayer2DSM(
int channel)
const {
1086 const int n_emc_layer2=8;
1087 if (channel<0 || channel >=n_emc_layer2) {
1088 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
1091 return L1_DSM->EMC[channel];
1094 unsigned short StTriggerData2019::tpcMaskDSM(
int channel)
const {
1095 const int n_tpcMask=8;
1096 if (channel<0 || channel >=n_tpcMask) {
1097 gMessMgr->Warning() <<
"TPCMask DSM out of range (" << channel <<
")" << endm;
1100 return L1_DSM->TPCMask[channel];
1103 unsigned char StTriggerData2019::bemcHighTower(
int patch_id,
int prepost)
const {
1105 const int m_max_patch=300;
1106 if ( patch_id < 0 || patch_id >= m_max_patch) {
1107 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
1110 int buffer = prepostAddress(prepost);
1112 int dsm=patch_id/10;
1113 int channel=patch_id%10;
1114 unsigned short trg_word;
1117 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
1123 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
1127 return trg_word & 0x3F;
1132 unsigned char StTriggerData2019::bemcJetPatch (
int patch_id,
int prepost)
const
1135 const int m_max_patch=300;
1136 if ( patch_id < 0 || patch_id >= m_max_patch) {
1137 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
1140 int buffer = prepostAddress(prepost);
1142 int dsm=patch_id/10;
1143 int channel=patch_id%10;
1144 unsigned short trg_word;
1147 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
1153 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
1157 return trg_word >> 6;
1163 unsigned char StTriggerData2019::eemcHighTower(
int patch_id,
int prepost)
const
1166 const int m_max_patch=90;
1167 if ( patch_id < 0 || patch_id >= m_max_patch) {
1168 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
1171 int buffer = prepostAddress(prepost);
1172 if (buffer >= 0 && mBC1[buffer]) {
1173 int dsm=patch_id/10;
1174 int channel=patch_id%10;
1175 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
1176 return trg_word & 0x3F;
1181 unsigned char StTriggerData2019::eemcJetPatch (
int patch_id,
int prepost)
const
1184 const int m_max_patch=90;
1185 if ( patch_id < 0 || patch_id >= m_max_patch) {
1186 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
1189 int buffer = prepostAddress(prepost);
1190 if (buffer >= 0 && mBC1[buffer]) {
1191 int dsm=patch_id/10;
1192 int channel=patch_id%10;
1193 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
1194 return trg_word >> 6;
1199 unsigned char StTriggerData2019::bemcHighestTowerADC(
int prepost)
const {
1201 const int m_max_patch=300;
1203 for (
int i=1; i<m_max_patch; i++){
1204 unsigned char hh=bemcHighTower(i,prepost);
1210 unsigned char StTriggerData2019::eemcHighestTowerADC(
int prepost)
const {
1212 const int m_max_patch=90;
1214 for (
int i=1; i<m_max_patch; i++){
1215 unsigned char hh=eemcHighTower(i,prepost);
1221 char* StTriggerData2019::getTriggerStructure()
1223 return (
char*) mData;
1231 int StTriggerData2019::getRawSize()
const
1233 return mData->totalTriggerLength;
1236 unsigned char* StTriggerData2019::getDsm0_BEMCE(
int prepost)
const {
1237 int buffer = prepostAddress(prepost);
1238 if (buffer >= 0)
if (mBCE[buffer])
return mBCE[buffer]->BEMCEast;
1242 unsigned char* StTriggerData2019::getDsm0_BEMCW(
int prepost)
const {
1243 int buffer = prepostAddress(prepost);
1244 if (buffer >= 0)
if (mBCW[buffer])
return mBCW[buffer]->BEMCWest;
1248 unsigned short* StTriggerData2019::getDsm1_BEMC(
int prepost)
const {
1249 int buffer = prepostAddress(prepost);
1250 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1;
1254 unsigned char* StTriggerData2019::getDsm0_EEMC(
int prepost)
const {
1255 int buffer = prepostAddress(prepost);
1256 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMC;
1260 unsigned short* StTriggerData2019::getDsm1_EEMC(
int prepost)
const{
1261 int buffer = prepostAddress(prepost);
1262 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1;
1266 unsigned short* StTriggerData2019::getDsm2_EMC()
const{
1270 unsigned short* StTriggerData2019::getDsm3()
const{
1271 return L1_DSM->lastDSM;
1274 int StTriggerData2019::L2ResultsOffset(StL2AlgorithmId
id)
const
1277 default:
return -999999999;
1281 bool StTriggerData2019::isL2Triggered(StL2TriggerResultType
id)
const
1286 unsigned int StTriggerData2019::l2ResultLength()
const
1288 return sizeof(TrgSum->L2Result)/
sizeof(
unsigned int);
1291 const unsigned int* StTriggerData2019::l2Result()
const
1293 return TrgSum->L2Result;
1296 unsigned long long StTriggerData2019::l2sum()
const
1300 unsigned long long hi = TrgSum->L2Sum[1];
1301 unsigned long long lo = TrgSum->L2Sum[0];
1302 unsigned long long mask=(hi<<32) | lo;
1306 unsigned short StTriggerData2019::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
1308 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1309 if (pmt<1 || pmt>16)
return 0;
1310 int buffer = prepostAddress(prepost);
1312 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]];}
1313 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1318 unsigned short StTriggerData2019::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
1320 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1321 if (pmt<1 || pmt>16)
return 0;
1322 int buffer = prepostAddress(prepost);
1324 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]+4];}
1325 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1330 unsigned short StTriggerData2019::vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1332 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1333 if (pmt<1 || pmt>16)
return 0;
1334 int buffer = prepostAddress(prepost);
1336 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1337 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1342 unsigned short StTriggerData2019::vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1344 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1345 if (pmt<1 || pmt>16)
return 0;
1346 int buffer = prepostAddress(prepost);
1348 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1349 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]+4];};
1354 unsigned short StTriggerData2019::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
1356 int buffer = prepostAddress(prepost);
1359 if (mRun<=10096084){
1360 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1361 else {
return mBBC[buffer]->VPD[4]%4096;}
1363 else if(mRun<=12003001) {
1364 if (eastwest==east) {
return mBBC[buffer]->VPD[2]%4096;}
1365 else {
return mBBC[buffer]->VPD[0]%4096;}
1368 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1369 else {
return mBBC[buffer]->VPD[4]%4096;}
1377 unsigned short StTriggerData2019::vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost)
const
1379 int buffer = prepostAddress(prepost);
1381 if (mRun<=10365999){
1384 else if(mRun<=12003001) {
1386 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1387 else {
return mBBC[buffer]->VPD[4]%4096;}
1389 }
else if(mRun<=14001001){
1391 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[13] + ((mMIX[buffer]->MTD_P2PLayer1[12]&0x0f)<<8);}
1392 else {
return mMIX[buffer]->MTD_P2PLayer1[9] + ((mMIX[buffer]->MTD_P2PLayer1[8]&0x0f)<<8);}
1396 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[11] + ((mMIX[buffer]->MTD_P2PLayer1[10]&0xf)<<8);}
1397 else {
return (mMIX[buffer]->MTD_P2PLayer1[10]>>4) + ((mMIX[buffer]->MTD_P2PLayer1[9]&0xff)<<4);}
1404 unsigned short StTriggerData2019::vpdADCSum(StBeamDirection eastwest,
int prepost)
const
1407 return (bbcVP101(4,prepost) & 0x7ff);
1409 return (bbcVP101(6,prepost) & 0x7ff);
1413 float StTriggerData2019::vpdMeanTimeDifference(
int prepost)
const
1416 unsigned int ne=(bbcVP101(4,prepost) >> 11) & 0x1f;
1417 unsigned int nw=(bbcVP101(6,prepost) >> 11) & 0x1f;
1418 unsigned int se=bbcVP101(5,prepost);
1419 unsigned int sw=bbcVP101(7,prepost);
1423 if(nenw>0)
return float(nwse-nesw)/float(nenw);
1427 unsigned short StTriggerData2019::bbcVP101(
int ch,
int prepost)
const
1429 int map[8]={3, 2, 1, 0, 7, 6, 5, 4};
1430 if(ch<0 || ch>7)
return 0;
1431 int buffer = prepostAddress(prepost);
1432 if (buffer >= 0 && mBBC[buffer]){
1433 return mBBC[buffer]->VPD[map[ch]];
1439 unsigned short StTriggerData2019::dsmTF201Ch(
int ch)
const
1441 int map[8]={3, 2, 1, 0, 7, 6, 5, 4};
1442 return L1_DSM->TOF[map[ch]];
1445 unsigned short StTriggerData2019::mtd4AtAddress(
int address,
int prepost)
const
1447 if (mRun<=15001001)
return 0;
1448 int buffer = prepostAddress(prepost);
1449 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][14][address];
1453 unsigned short StTriggerData2019::nQTdata(
int prepost)
const
1458 unsigned int* StTriggerData2019::QTdata(
int prepost)
const
1463 unsigned short StTriggerData2019::fmsADC(
int crt,
int adr,
int ch,
int prepost)
const
1465 int buffer = prepostAddress(prepost);
1466 if (buffer >= 0 && crt>=1 && crt<=7 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1468 case 0:
return bbq[buffer][adr][ch];
1469 case 1:
return qt1[buffer][adr][ch];
1470 case 2:
return qt2[buffer][adr][ch];
1471 case 3:
return qt3[buffer][adr][ch];
1472 case 4:
return qt4[buffer][adr][ch];
1473 case 5:
return eq3[buffer][adr][ch];
1474 case 6:
return eq1[buffer][adr][ch];
1475 case 7:
return eq2[buffer][adr][ch];
1481 unsigned short StTriggerData2019::fmsTDC(
int crt,
int adr,
int ch,
int prepost)
const
1483 int buffer = prepostAddress(prepost);
1484 if (buffer >= 0 && crt>=0 && crt<=7 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1486 case 0:
return tbbq[buffer][adr][ch];
1487 case 1:
return tqt1[buffer][adr][ch];
1488 case 2:
return tqt2[buffer][adr][ch];
1489 case 3:
return tqt3[buffer][adr][ch];
1490 case 4:
return tqt4[buffer][adr][ch];
1491 case 5:
return teq3[buffer][adr][ch];
1492 case 6:
return teq1[buffer][adr][ch];
1493 case 7:
return teq2[buffer][adr][ch];
1499 unsigned short StTriggerData2019::epdADC(
int crt,
int adr,
int ch,
int prepost)
const
1501 int buffer = prepostAddress(prepost);
1502 if (buffer >= 0 && crt>=1 && crt<=3 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1504 case 1:
return eq1[buffer][adr][ch];
1505 case 2:
return eq2[buffer][adr][ch];
1506 case 3:
return eq3[buffer][adr][ch];
1512 unsigned short StTriggerData2019::epdTDC(
int crt,
int adr,
int ch,
int prepost)
const
1514 int buffer = prepostAddress(prepost);
1515 if (buffer >= 0 && crt>=1 && crt<=3 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1517 case 1:
return teq1[buffer][adr][ch];
1518 case 2:
return teq2[buffer][adr][ch];
1519 case 3:
return teq3[buffer][adr][ch];
1525 unsigned char* StTriggerData2019::getDsm_FMS(
int prepost)
const
1527 int buffer = prepostAddress(prepost);
1528 if (buffer >= 0)
if (mFMS[buffer])
return mFMS[buffer]->FMS;
1532 unsigned short* StTriggerData2019::getDsm1_FMS(
int prepost)
const
1534 int buffer = prepostAddress(prepost);
1535 if (buffer >= 0)
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1;
1539 unsigned short* StTriggerData2019::getDsm2_FMS()
const {
return L1_DSM->FPD;}
1541 unsigned short StTriggerData2019::mxqAtSlotAddress(
int address,
int prepost,
int slot)
const
1543 int buffer = prepostAddress(prepost);
1544 if (buffer >= 0 && address>=0 && address<32){
1545 if (slot >= 0 && slot<16){
1546 return mxq[buffer][slot][address];
1552 unsigned short StTriggerData2019::mtdQtAtCh(
int qtid,
int address,
int prepost)
const
1554 int map1[4] = {0, 10, 12, 14};
1555 int map2[8] = {0, 9, 10, 11, 12, 13, 14, 15};
1556 int map3[4] = {0, 9, 11, 13};
1558 int buffer = prepostAddress(prepost);
1559 if(buffer>=0 && qtid>0 && address>=0 && address<32){
1561 if(qtid>1)
return 0;
1562 else return mxq[buffer][map1[qtid-1]][address];
1564 else if(mRun<=14001001){
1565 if(qtid>2)
return 0;
1566 else return mxq[buffer][map1[qtid-1]][address];
1568 else if(mRun<=15001001){
1569 if(qtid>3)
return 0;
1570 else return mxq[buffer][map1[qtid-1]][address];
1572 else if(mRun<=17001001){
1573 if(qtid>4)
return 0;
1574 else return mxq[buffer][map1[qtid-1]][address];
1576 else if(mRun<=18001001){
1577 if(qtid>8)
return 0;
1578 else return mxq[buffer][map2[qtid-1]][address];
1581 if(qtid>4)
return 0;
1582 else return mxq[buffer][map3[qtid-1]][address];
1589 unsigned short StTriggerData2019::mtdAtAddress(
int address,
int prepost)
const
1591 int buffer = prepostAddress(prepost);
1592 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][0][address];
1596 unsigned short StTriggerData2019::mtdgemAtAddress(
int address,
int prepost)
const
1598 if (mRun<=12003001)
return 0;
1599 int buffer = prepostAddress(prepost);
1600 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][10][address];
1604 unsigned short StTriggerData2019::mtd3AtAddress(
int address,
int prepost)
const
1606 if (mRun<=14001001)
return 0;
1607 int buffer = prepostAddress(prepost);
1608 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][12][address];
1613 unsigned short StTriggerData2019::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1616 int buffer = prepostAddress(prepost);
1617 if (buffer >= 0 && pmt==0){
1618 if (eastwest==east) {
1619 if (mRun<=10133008)
return mxq[buffer][0][0];
1620 else return mxq[buffer][0][24];
1622 if (eastwest==west)
return mxq[buffer][0][8];
1627 unsigned short StTriggerData2019::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1630 int buffer = prepostAddress(prepost);
1631 if (buffer >= 0 && pmt==0){
1632 if (eastwest==east) {
1633 if (mRun<=10133008)
return mxq[buffer][0][4];
1634 else return mxq[buffer][0][28];
1636 if (eastwest==west)
return mxq[buffer][0][12];
1641 unsigned char StTriggerData2019::mtdDsmAtCh(
int ch,
int prepost)
const
1643 int map[16] = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8};
1645 int buffer = prepostAddress(prepost);
1646 if (buffer >= 0 && ch>=0){
1649 return mMIX[buffer]->MTD_P2PLayer1[map[ch]];
1662 bool StTriggerData2019::mtdDsmHit(
int pmt,
int prepost)
const
1665 int buffer = prepostAddress(prepost);
1668 if(mRun<10133008 && mRun<11000000){
1669 if( (mMIX[buffer]->MTD_P2PLayer1[5] & 0x1) && (mMIX[buffer]->MTD_P2PLayer1[5] & 0x10) )
return true;
1672 if(prepost!=0)
return false;
1673 return (L1_DSM->TOF[3] & 0x1);
1680 unsigned short StTriggerData2019::mtdVpdTacDiff()
const
1682 return (L1_DSM->TOF[3] & 0x3fff);
1685 unsigned short StTriggerData2019::tofAtAddress(
int address,
int prepost)
const
1687 int buffer = prepostAddress(prepost);
1688 if (buffer>=0 && address>=0 && address<48) {
1689 if (mMIX[buffer])
return mMIX[buffer]->TOF[address];
1694 unsigned short StTriggerData2019::tofTrayMultiplicity(
int tray,
int prepost)
const
1696 int dsmmap[8] = {3,2,1,0,7,6,5,4};
1697 int traydsm[120] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5,
1698 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3,
1699 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1700 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
1701 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
1702 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
1703 int traych[120] = { 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1704 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1705 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1706 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1707 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1708 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17};
1709 int buffer = prepostAddress(prepost);
1710 if (buffer>=0 && tray>=1 && tray<=120) {
1712 int address = traydsm[tray-1]*8 + dsmmap[traych[tray-1]/3];
1713 int ch = traych[tray-1]%3;
1714 return (mMIX[buffer]->TOF[address] >> (5*ch)) & 0x1f;
1720 unsigned short StTriggerData2019::tofMultiplicity(
int prepost)
const
1722 if (prepost==0)
return L1_DSM->TOF[1]%8192;
1726 void StTriggerData2019::dump()
const
1728 printf(
"***** StTriggerData Dump *****\n");
1729 printf(
" mDebug=%d mData=%p\n",mDebug,mData);
1730 printf(
" Year=%d EvtDesc version=%x header version%x\n",year(),version(),mData->FormatVersion);
1731 printf(
" Run#=%d Event#=%d\n",mRun,eventNumber());
1732 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
1733 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
1734 token(), triggerWord(), actionWord(), busyStatus());
1735 printf(
" TUC Bits=%d : ",tcuBits());
1736 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
1737 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
1738 printf(
" Spin Bits=%d : ",spinBit());
1739 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
1741 printf(
" BBC East ADC : ");
for (
int i=1; i<=16;i++){ printf(
"%2d ",bbcADC(east,i,0)); }; printf(
"\n");
1742 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%2d ",bbcTDC(east,i,0)); }; printf(
"\n");
1743 printf(
" BBC West ADC : ");
for (
int i=1; i<=16;i++){ printf(
"%2d ",bbcADC(west,i,0)); }; printf(
"\n");
1744 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%2d ",bbcTDC(west,i,0)); }; printf(
"\n");
1745 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
1746 printf(
" BBC Sums %d xing : ",i);
1747 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
1748 bbcADCSum(east,i),bbcADCSum(west,i),
1749 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
1751 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
1752 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
1753 printf(
" ZDC Earilest : "); printf(
"East=%d West=%d Difference=%d\n",
1754 zdcEarliestTDC(east,0),zdcEarliestTDC(west,0),zdcTimeDifference());
1755 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
1756 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
1757 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
1758 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
1759 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
1760 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
1761 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
1762 printf(
" L2 result : \n");
1763 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
1764 printf(
"BBClayer1:");
1765 int buffer = prepostAddress(0);
1768 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->BBClayer1[i]);
1772 printf(
"ZDClayer1:");
1775 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->ZDClayer1[i]);
1779 printf(
"VPDlayer1:");
1782 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->VPD[i]);
1785 printf(
"TOFMult=%d\n",tofMultiplicity());
1789 int map[3][16]={ {0x01,0x02,0xff, 0x03,0x04,0xff, 0x05,0x06,0xff, 0x07,0x08,0xff, 0x09,0x0a,0x0b, 0xff},
1790 {0x11,0x12,0xff, 0x13,0x14,0xff, 0x15,0x16,0xff, 0x17,0x18,0xff, 0x19,0x1a,0x1b, 0xff},
1791 {0x21,0x22,0xff, 0x23,0x24,0xff, 0x25,0x26,0xff, 0x27,0x28,0xff, 0x29,0x2a,0xff, 0xff}};
1792 int mbc[3][16]={ {0x0b,0x0b,0xff, 0x0b,0x0b,0xff, 0x0b,0x0b,0xff, 0x0c,0x0c,0xff, 0x0c,0x0c,0x0c, 0xff},
1793 {0x0b,0x0b,0xff, 0x0b,0x0b,0xff, 0x0b,0x0b,0xff, 0x0c,0x0c,0xff, 0x0c,0x0c,0x0c, 0xff},
1794 {0x0b,0x0b,0xff, 0x0b,0x0c,0xff, 0x0c,0x0b,0xff, 0x0b,0x0b,0xff, 0x0c,0x0c,0xff, 0xff}};
1795 int epdm[3][16]; memset(epdm,0,
sizeof(epdm));
1796 for(
int c=1; c<=3; c++){
1797 for(
int s=0; s<16; s++){
1798 int bd=map[c][s] & 0x0f;
1799 printf(
"EQ%1d S=%2d EQ0%02x bd=%1x 1/2 : ",c,s,map[c-1][s],bd);
1800 for (
int ch=0; ch<32; ch++){
1801 if(ch==16) printf(
"\nEQ%1d S=%2d EQ0%02x bd=%1x 2/2 : ",c,s,map[c-1][s],bd);
1802 printf(
"%4d ",epdADC(c,s,ch));
1803 if(map[c-1][s]<0xff){
1804 if(mbc[c-1][s]==0xb){
1805 if(epdADC(c,s,ch)>16) epdm[c-1][bd]++;
1806 }
else if(mbc[c-1][s]==0xc && (ch/4)%2==0){
1807 if(epdADC(c,s,ch)>16 && epdADC(c,s,ch+4)>300 && epdADC(c,s,ch+4)<2900) epdm[c-1][bd]++;
1811 printf(
" mult=%d\n",epdm[c-1][bd]);
1814 printf(
"EP001 TAC+hit: ");
for(
int c=0; c<8; c++){ printf(
"%4x ",epdLayer0t(c));} printf(
"\n");
1815 printf(
"EP002 TAC+hit: ");
for(
int c=8; c<16; c++){ printf(
"%4x ",epdLayer0t(c));} printf(
"\n");
1816 printf(
"EP003 Nhit: ");
for(
int c=0; c<8; c++){ printf(
"%2d ",epdLayer0aMult(c));} printf(
"\n");
1817 printf(
"EP004 Nhit: ");
for(
int c=8; c<16; c++){ printf(
"%2d ",epdLayer0aMult(c));} printf(
"\n");
1818 printf(
"EP005 Nhit1: ");
for(
int c=0; c<10; c++){ printf(
"%2d ",epdLayer0hMult(c,1));} printf(
"\n");
1819 printf(
"EP005 Nhit2: ");
for(
int c=0; c<10; c++){ printf(
"%2d ",epdLayer0hMult(c,2));} printf(
"\n");
1820 printf(
"EP006 Nhit1: ");
for(
int c=10; c<20; c++){ printf(
"%2d ",epdLayer0hMult(c,1));} printf(
"\n");
1821 printf(
"EP006 Nhit2: ");
for(
int c=10; c<20; c++){ printf(
"%2d ",epdLayer0hMult(c,2));} printf(
"\n");
1822 for(
int c=1; c<=3; c++){
1823 for(
int q=1; q<=11; q++){
1824 int eq=(c-1)*0x10 + q;
1825 printf(
"mult-EQ%03x %02x %02x | %02x : %02x\n",eq,epdNHitsQT(c,q,1),epdNHitsQT(c,q,2),epdm[c-1][q],epdNHitsQT(c,q,1)^epdm[c-1][q]);
1829 printf(
"EP102 : ");
for(
int c=0; c<8; c++){ printf(
"%04x ", epdLayer1b(c));} printf(
"\n");
1830 printf(
"EP102 east Mult : ");
for(
int r=1; r<=5; r++){ printf(
"%3d ", epdLayer1bMult(east, r));} printf(
"\n");
1831 printf(
"EP102 west Mult : ");
for(
int r=1; r<=5; r++){ printf(
"%3d ", epdLayer1bMult(west, r));} printf(
"\n");
1832 printf(
"EPD(VP201) mult total = %3d diff= %3d\n",epdMultTotal(),epdMultDiff());
1836 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->VTX[i]);
1839 printf(
"Last DSM:");
1841 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->lastDSM[i]);
1844 printf(
"***** End StTriggerData Dump *****\n");
1847 void StTriggerData2019::killFMS(){
1849 int npre = numberOfPreXing();
1850 int npost = numberOfPostXing();
1851 for (
int i=0; i<1+npre+npost; i++){
1853 {offlen = mData->MainX;}
1855 if (mData->PrePostList[i-1]==0)
continue;
1856 offlen = (
TrgOfflen2019*) ((
char*)mData + mData->PrePostList[i-1]);
1859 j=offlen[y19QT1_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y19QT1_CONF_NUM].offset, 0, j); offlen[y19QT1_CONF_NUM].length=0;};
1860 j=offlen[y19QT2_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y19QT2_CONF_NUM].offset, 0, j); offlen[y19QT2_CONF_NUM].length=0;};
1861 j=offlen[y19QT3_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y19QT3_CONF_NUM].offset, 0, j); offlen[y19QT3_CONF_NUM].length=0;};
1862 j=offlen[y19QT4_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y19QT4_CONF_NUM].offset, 0, j); offlen[y19QT4_CONF_NUM].length=0;};
1866 void StTriggerData2019::swapRawDet(
DataBlock2019* data,
int name,
int hlength,
int bs)
1872 int header_length = 8;
1873 if(bs) swapI((
unsigned int*)&data->length);
1875 case y19MXQ_CONF_NUM :
case y19EQ3_CONF_NUM :
case y19BBQ_CONF_NUM :
1876 case y19QT1_CONF_NUM :
case y19QT2_CONF_NUM :
case y19QT3_CONF_NUM :
case y19QT4_CONF_NUM :
1877 case y19EQ1_CONF_NUM :
case y19EQ2_CONF_NUM :
1878 header_length = 12;
break;
1880 if (hlength != data->length + header_length){
1881 mErrorFlag = mErrorFlag | (1 << name);
1882 printf(
"StTriggerData2019: Error reading Block=%2d [%1c%1c%1c%1c] length %d != %d + %d\n",
1883 name,data->name[0],data->name[1],data->name[2],data->name[3],
1884 hlength,data->length,header_length);
1885 printf(
"StTriggerData2019: Droping the data block =%2d [%1c%1c%1c%1c] with ErrorFlag=0x%x\n",
1886 name,data->name[0],data->name[1],data->name[2],data->name[3],mErrorFlag);
1892 case y19BC1_CONF_NUM :
1894 swapSSn((
unsigned int*)bc1->BEMClayer1,48);
1895 swapSSn((
unsigned int*)bc1->EEMClayer1,16);
1897 case y19MIX_CONF_NUM :
1899 swapSSn((
unsigned int*)mix->FPDEastNSLayer1,8);
1900 swapSSn((
unsigned int*)mix->TOFLayer1,8+48);
1902 case y19BCW_CONF_NUM :
1905 case y19BCE_CONF_NUM :
1908 case y19BBC_CONF_NUM :
1910 swapSSn((
unsigned int*)bbc->BBClayer1,8+8+8+8+16+8+16);
1913 case y19FMS_CONF_NUM :
1916 case y19MXQ_CONF_NUM :
1917 case y19EQ3_CONF_NUM :
1918 case y19BBQ_CONF_NUM :
1919 case y19QT1_CONF_NUM :
1920 case y19QT2_CONF_NUM :
1921 case y19QT3_CONF_NUM :
1922 case y19QT4_CONF_NUM :
1923 case y19EQ1_CONF_NUM :
1924 case y19EQ2_CONF_NUM :
1926 swapI((
unsigned int*)&qtdata->dataLoss);
1927 swapIn(qtdata->data, qtdata->length/4);
1932 printf(
"Read id=%2d name=%1c%1c%1c%1c length=%d\n",
1933 name,data->name[0],data->name[1],data->name[2],data->name[3],data->length);
1936 void StTriggerData2019::Streamer(TBuffer &R__b)
1940 if (R__b.IsReading()) {
1941 R__b.ReadClassBuffer(StTriggerData2019::Class(),
this);
1943 if(mData) readData();
1946 R__b.WriteClassBuffer(StTriggerData2019::Class(),
this);